3 #include "ND280GeomId.hxx" 4 #include "ND280GeomIdDef.hxx" 7 #define ND280Warn(v) do {std::cout << "WARNING:" << v << std::endl;} while(0) 8 #define ND280Error(v) do {std::cout << "ERROR:" << v << std::endl;} while(0) 37 class TSettableGeometryId {
38 ND::TGeometryId fGeometryId;
40 TSettableGeometryId() : fGeometryId(0) {}
41 explicit TSettableGeometryId(ND::TGeometryId
id) : fGeometryId(id) {}
42 void SetField(
int val,
int msb,
int lsb) {
44 long mask = ((1<<(msb-lsb+1))-1) << lsb;
48 fGeometryId |= ((val << lsb)&mask);
51 int GetField(
int msb,
int lsb)
const {
52 int field = fGeometryId >> lsb;
53 int mask = (1<<(msb-lsb+1))-1;
54 return (field & mask);
57 operator ND::TGeometryId() {
68 TSettableGeometryId id(i);
78 TSettableGeometryId id(i);
79 return (ND::GeomId::Def::kP0D
85 TSettableGeometryId id;
86 id.SetField(ND::GeomId::Def::kP0D,
91 ND::GeomId::Def::P0D::kSeqIdLSB);
94 ND::GeomId::Def::P0D::Global::kSeqIdLSB);
97 ND::GeomId::Def::P0D::Global::kFieldLSB);
102 TSettableGeometryId id;
103 id.SetField(ND::GeomId::Def::kP0D,
108 ND::GeomId::Def::P0D::kSeqIdLSB);
111 ND::GeomId::Def::P0D::Global::kSeqIdLSB);
114 ND::GeomId::Def::P0D::Global::kFieldLSB);
119 TSettableGeometryId id(i);
120 if (ND::GeomId::Def::kP0D
125 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
128 ND::GeomId::Def::P0D::Global::kSeqIdLSB))
return -1;
130 ND::GeomId::Def::P0D::Global::kFieldLSB);
135 TSettableGeometryId id;
136 id.SetField(ND::GeomId::Def::kP0D,
141 ND::GeomId::Def::P0D::kSeqIdLSB);
144 ND::GeomId::Def::P0D::Global::kSeqIdLSB);
147 ND::GeomId::Def::P0D::Global::kFieldLSB);
152 TSettableGeometryId id(i);
153 if (ND::GeomId::Def::kP0D
158 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
161 ND::GeomId::Def::P0D::Global::kSeqIdLSB))
return -1;
163 ND::GeomId::Def::P0D::Global::kFieldLSB);
167 TSettableGeometryId id;
168 id.SetField(ND::GeomId::Def::kP0D,
173 ND::GeomId::Def::P0D::kSeqIdLSB);
176 ND::GeomId::Def::P0D::Global::kSeqIdLSB);
179 ND::GeomId::Def::P0D::Global::kFieldLSB);
184 TSettableGeometryId id(i);
185 if (ND::GeomId::Def::kP0D
190 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
193 ND::GeomId::Def::P0D::Global::kSeqIdLSB))
return -1;
195 ND::GeomId::Def::P0D::Global::kFieldLSB);
199 TSettableGeometryId id;
200 id.SetField(ND::GeomId::Def::kP0D,
205 ND::GeomId::Def::P0D::kSeqIdLSB);
208 ND::GeomId::Def::P0D::Global::kSeqIdLSB);
209 id.SetField(radiator,
211 ND::GeomId::Def::P0D::Global::kFieldLSB);
216 TSettableGeometryId id(i);
217 if (ND::GeomId::Def::kP0D
222 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
225 ND::GeomId::Def::P0D::Global::kSeqIdLSB))
return -1;
227 ND::GeomId::Def::P0D::Global::kFieldLSB);
231 TSettableGeometryId id;
232 id.SetField(ND::GeomId::Def::kP0D,
237 ND::GeomId::Def::P0D::kSeqIdLSB);
240 ND::GeomId::Def::P0D::Global::kSeqIdLSB);
241 id.SetField(targetRadiator,
243 ND::GeomId::Def::P0D::Global::kFieldLSB);
248 TSettableGeometryId id(i);
249 if (ND::GeomId::Def::kP0D
254 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
257 ND::GeomId::Def::P0D::Global::kSeqIdLSB))
return -1;
259 ND::GeomId::Def::P0D::Global::kFieldLSB);
265 TSettableGeometryId id;
266 id.SetField(ND::GeomId::Def::kP0D,
271 ND::GeomId::Def::P0D::kSeqIdLSB);
274 ND::GeomId::Def::P0D::Bar::kSP0DuleLSB);
277 ND::GeomId::Def::P0D::Bar::kP0DuleLSB);
280 ND::GeomId::Def::P0D::Bar::kLayerLSB);
283 ND::GeomId::Def::P0D::Bar::kBarLSB);
288 TSettableGeometryId id(i);
289 if (ND::GeomId::Def::kP0D
294 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
296 ND::GeomId::Def::P0D::Bar::kP0DuleLSB);
300 TSettableGeometryId id(i);
301 if (ND::GeomId::Def::kP0D
306 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
308 ND::GeomId::Def::P0D::Bar::kLayerLSB);
312 TSettableGeometryId id(i);
313 if (ND::GeomId::Def::kP0D
318 ND::GeomId::Def::P0D::kSeqIdLSB))
return -1;
320 ND::GeomId::Def::P0D::Bar::kBarLSB);
328 TSettableGeometryId id(i);
329 return (ND::GeomId::Def::kTPC
335 TSettableGeometryId id;
336 if (tpc<0 || tpc>2) {
337 ND280Warn(
"TPC module out of range [0,2]: " << tpc);
340 id.SetField(ND::GeomId::Def::kTPC,
345 ND::GeomId::Def::TPC::kSeqIdLSB);
346 id.SetField(ND::GeomId::Def::TPC::Global::kTPC,
347 ND::GeomId::Def::TPC::Global::kSeqIdMSB,
348 ND::GeomId::Def::TPC::Global::kSeqIdLSB);
350 ND::GeomId::Def::TPC::Global::kFieldMSB,
351 ND::GeomId::Def::TPC::Global::kFieldLSB);
356 TSettableGeometryId id(i);
357 if (ND::GeomId::Def::kTPC
362 ND::GeomId::Def::TPC::kSeqIdLSB))
return -1;
363 if (ND::GeomId::Def::TPC::Global::kTPC
364 !=
id.GetField(ND::GeomId::Def::TPC::Global::kSeqIdMSB,
365 ND::GeomId::Def::TPC::Global::kSeqIdLSB))
return -1;
366 return id.GetField(ND::GeomId::Def::TPC::Global::kFieldMSB,
367 ND::GeomId::Def::TPC::Global::kFieldLSB);
378 bool ND::GeomId::TPC::IsTPC2(TGeometryId i) {
382 bool ND::GeomId::TPC::IsTPC3(TGeometryId i) {
387 TSettableGeometryId id;
388 if (tpc<0 || tpc>2) {
389 ND280Warn(
"TPC module out of range [0,2]: " << tpc);
392 if (half<0 || half>1) {
393 ND280Warn(
"TPC half out of range [0,1]: " << half);
397 ND280Warn(
"TPC micromega out of range [0,11]: " << mm);
400 id.SetField(ND::GeomId::Def::kTPC,
405 ND::GeomId::Def::TPC::kSeqIdLSB);
408 ND::GeomId::Def::TPC::Pad::kTPCLSB);
411 ND::GeomId::Def::TPC::Pad::kHalfLSB);
414 ND::GeomId::Def::TPC::Pad::kMMegaLSB);
417 ND::GeomId::Def::TPC::Pad::kPadFlagLSB);
420 ND::GeomId::Def::TPC::Pad::kPadLSB);
425 TSettableGeometryId id(i);
428 if (detector != ND::GeomId::Def::kTPC)
return false;
431 ND::GeomId::Def::TPC::kSeqIdLSB);
434 ND::GeomId::Def::TPC::Pad::kPadFlagLSB);
435 if (padFlag)
return false;
440 TSettableGeometryId id;
441 if (tpc<0 || tpc>2) {
442 ND280Warn(
"TPC module out of range [0,2]: " << tpc);
445 if (half<0 || half>1) {
446 ND280Warn(
"TPC half out of range [0,1]: " << half);
450 ND280Warn(
"TPC micromega out of range [0,11]: " << mm);
453 if (pad<0 || pad>1727) {
454 ND280Warn(
"TPC pad out of range [0,1727]: " << pad);
457 id.SetField(ND::GeomId::Def::kTPC,
462 ND::GeomId::Def::TPC::kSeqIdLSB);
465 ND::GeomId::Def::TPC::Pad::kTPCLSB);
468 ND::GeomId::Def::TPC::Pad::kHalfLSB);
471 ND::GeomId::Def::TPC::Pad::kMMegaLSB);
474 ND::GeomId::Def::TPC::Pad::kPadFlagLSB);
477 ND::GeomId::Def::TPC::Pad::kPadLSB);
486 TSettableGeometryId id(i);
487 if (ND::GeomId::Def::kTPC
492 ND::GeomId::Def::TPC::kSeqIdLSB))
return -1;
494 ND::GeomId::Def::TPC::Pad::kTPCLSB);
497 int ND::GeomId::TPC::GetMicroMegaHalf(TGeometryId i) {
498 return ND::GeomId::TPC::GetPadHalf(i);
501 int ND::GeomId::TPC::GetPadHalf(TGeometryId i) {
502 TSettableGeometryId id(i);
503 if (ND::GeomId::Def::kTPC
508 ND::GeomId::Def::TPC::kSeqIdLSB))
return -1;
510 ND::GeomId::Def::TPC::Pad::kHalfLSB);
513 int ND::GeomId::TPC::GetMicroMegaNumber(TGeometryId i) {
514 return ND::GeomId::TPC::GetPadMicroMega(i);
517 int ND::GeomId::TPC::GetPadMicroMega(TGeometryId i) {
518 TSettableGeometryId id(i);
519 if (ND::GeomId::Def::kTPC
524 ND::GeomId::Def::TPC::kSeqIdLSB))
return -1;
526 ND::GeomId::Def::TPC::Pad::kMMegaLSB);
529 int ND::GeomId::TPC::GetPadNumber(TGeometryId i) {
530 TSettableGeometryId id(i);
531 if (ND::GeomId::Def::kTPC
536 ND::GeomId::Def::TPC::kSeqIdLSB))
return -1;
538 ND::GeomId::Def::TPC::Pad::kPadFlagLSB))
return -1;
540 ND::GeomId::Def::TPC::Pad::kPadLSB);
544 TSettableGeometryId id(i);
547 if (detector != ND::GeomId::Def::kTPC)
return false;
550 ND::GeomId::Def::TPC::kSeqIdLSB);
553 ND::GeomId::Def::TPC::Pad::kPadFlagLSB);
554 if (!padFlag)
return false;
562 TSettableGeometryId id(i);
563 return (ND::GeomId::Def::kFGD
569 TSettableGeometryId id;
570 if (fgd<0 || fgd>1) {
571 ND280Warn(
"FGD out of range [0,1]: " << fgd);
574 id.SetField(ND::GeomId::Def::kFGD,
579 ND::GeomId::Def::FGD::kSeqIdLSB);
582 ND::GeomId::Def::FGD::Global::kSeqIdLSB);
585 ND::GeomId::Def::FGD::Global::kFieldLSB);
593 TSettableGeometryId id(i);
594 if (ND::GeomId::Def::kFGD
599 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
602 ND::GeomId::Def::FGD::Global::kSeqIdLSB))
return -1;
604 ND::GeomId::Def::FGD::Global::kFieldLSB);
611 bool ND::GeomId::FGD::IsFGD2(TGeometryId
id) {
619 TSettableGeometryId id;
620 if (fgd<0 || fgd>1) {
621 ND280Warn(
"FGD out of range [0,1]: " << fgd);
624 id.SetField(ND::GeomId::Def::kFGD,
629 ND::GeomId::Def::FGD::kSeqIdLSB);
632 ND::GeomId::Def::FGD::Bar::kModuleLSB);
635 ND::GeomId::Def::FGD::Bar::kPlaneLSB);
638 ND::GeomId::Def::FGD::Bar::kLayerLSB);
641 ND::GeomId::Def::FGD::Bar::kBarLSB);
646 TSettableGeometryId id(i);
647 if (ND::GeomId::Def::kFGD
652 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
654 ND::GeomId::Def::FGD::Bar::kModuleLSB);
657 int ND::GeomId::FGD::GetBarModule(TGeometryId i) {
658 TSettableGeometryId id(i);
659 if (ND::GeomId::Def::kFGD
664 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
666 ND::GeomId::Def::FGD::Bar::kPlaneLSB);
669 int ND::GeomId::FGD::GetBarLayer(TGeometryId i) {
670 TSettableGeometryId id(i);
671 if (ND::GeomId::Def::kFGD
676 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
678 ND::GeomId::Def::FGD::Bar::kLayerLSB);
681 int ND::GeomId::FGD::GetBarNumber(TGeometryId i) {
682 TSettableGeometryId id(i);
683 if (ND::GeomId::Def::kFGD
688 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
690 ND::GeomId::Def::FGD::Bar::kBarLSB);
694 TSettableGeometryId id;
695 id.SetField(ND::GeomId::Def::kFGD,
700 ND::GeomId::Def::FGD::kSeqIdLSB);
703 ND::GeomId::Def::FGD::Global::kSeqIdLSB);
706 ND::GeomId::Def::FGD::Global::kFieldLSB);
711 TSettableGeometryId id(i);
712 if (ND::GeomId::Def::kFGD
717 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
720 ND::GeomId::Def::FGD::Global::kSeqIdLSB))
return -1;
722 ND::GeomId::Def::FGD::Global::kFieldLSB);
728 TSettableGeometryId id;
729 if (fgd<0 || fgd>1) {
730 ND280Warn(
"FGD out of range [0,1]: " << fgd);
733 id.SetField(ND::GeomId::Def::kFGD,
738 ND::GeomId::Def::FGD::kSeqIdLSB);
741 ND::GeomId::Def::FGD::Global::kSeqIdLSB);
744 ND::GeomId::Def::FGD::Global::Layer::kFGDLSB);
747 ND::GeomId::Def::FGD::Global::Layer::kLayerLSB);
750 ND::GeomId::Def::FGD::Global::Layer::kModuleLSB);
755 TSettableGeometryId id(i);
756 if (ND::GeomId::Def::kFGD
761 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
764 ND::GeomId::Def::FGD::Global::kSeqIdLSB))
return -1;
766 ND::GeomId::Def::FGD::Global::Layer::kFGDLSB);
769 int ND::GeomId::FGD::GetLayerModule(TGeometryId i) {
770 TSettableGeometryId id(i);
771 if (ND::GeomId::Def::kFGD
776 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
779 ND::GeomId::Def::FGD::Global::kSeqIdLSB))
return -1;
781 ND::GeomId::Def::FGD::Global::Layer::kModuleLSB);
784 int ND::GeomId::FGD::GetLayerNumber(TGeometryId i) {
785 TSettableGeometryId id(i);
786 if (ND::GeomId::Def::kFGD
791 ND::GeomId::Def::FGD::kSeqIdLSB))
return -1;
794 ND::GeomId::Def::FGD::Global::kSeqIdLSB))
return -1;
796 ND::GeomId::Def::FGD::Global::Layer::kLayerLSB);
804 TSettableGeometryId id;
805 if (ecal == ND::GeomId::Def::kDSECal) {
807 ND280Error(
"Downstream ECal with invalid clam: " << clam);
811 ND280Error(
"Downstream ECal with invalid module: " << module);
815 else if (ecal == ND::GeomId::Def::kTECal) {
816 if (clam != 0 && clam != 1) {
817 ND280Error(
"Tracker ECal with invalid clam: " << clam);
820 if (module<0 || 2<module) {
821 ND280Error(
"Tracker ECal with invalid module: " << module);
825 else if (ecal == ND::GeomId::Def::kPECal) {
826 if (clam != 0 && clam != 1) {
827 ND280Error(
"P0D ECal with invalid clam: " << clam);
830 if (module<0 || 2<module) {
831 ND280Error(
"P0D ECal with invalid module: " << module);
840 ND::GeomId::Def::ECal::kSeqIdLSB);
841 id.SetField(module*2+clam,
843 ND::GeomId::Def::ECal::kModuleLSB);
847 ND::GeomId::Def::ECal::Global::kSeqIdLSB);
850 ND::GeomId::Def::ECal::Global::kFieldLSB);
856 TSettableGeometryId id;
857 if (ecal == ND::GeomId::Def::kTECal) {
858 if (clam != 0 && clam != 1) {
859 ND280Error(
"Tracker ECal container with invalid clam: " << clam);
862 if (module<0 || 2<module) {
863 ND280Error(
"Tracker ECal container with invalid module: " << module);
867 else if (ecal == ND::GeomId::Def::kPECal) {
868 if (clam != 0 && clam != 1) {
869 ND280Error(
"P0D ECal container with invalid clam: " << clam);
872 if (module<0 || 2<module) {
873 ND280Error(
"P0D ECal container with invalid module: " << module);
878 ND280Error(
"Container for non-contained ECal: " << ecal);
887 ND::GeomId::Def::ECal::kSeqIdLSB);
888 id.SetField(module*2+clam,
890 ND::GeomId::Def::ECal::kModuleLSB);
894 ND::GeomId::Def::ECal::Global::kSeqIdLSB);
897 ND::GeomId::Def::ECal::Global::kFieldLSB);
904 TSettableGeometryId id(i);
906 if (det == ND::GeomId::Def::kDSECal)
return det;
907 else if (det == ND::GeomId::Def::kTECal)
return det;
908 else if (det == ND::GeomId::Def::kPECal)
return det;
912 int ND::GeomId::ECal::GetModuleNumber(TGeometryId i) {
913 TSettableGeometryId id(i);
917 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
920 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
923 ND::GeomId::Def::ECal::kModuleLSB) / 2;
926 int ND::GeomId::ECal::GetModuleClam(TGeometryId i) {
927 TSettableGeometryId id(i);
931 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
934 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
937 ND::GeomId::Def::ECal::kModuleLSB) % 2;
941 int module,
int layer) {
942 TSettableGeometryId id;
943 if (ecal == ND::GeomId::Def::kDSECal) {
945 ND280Error(
"Downstream ECal with invalid clam: " << clam);
949 ND280Error(
"Downstream ECal with invalid module: " << module);
953 else if (ecal == ND::GeomId::Def::kTECal) {
954 if (clam != 0 && clam != 1) {
955 ND280Error(
"Tracker ECal with invalid clam: " << clam);
958 if (module<0 || 2<module) {
959 ND280Error(
"Tracker ECal with invalid module: " << module);
963 else if (ecal == ND::GeomId::Def::kPECal) {
964 if (clam != 0 && clam != 1) {
965 ND280Error(
"P0D ECal with invalid clam: " << clam);
968 if (module<0 || 2<module) {
969 ND280Error(
"P0D ECal with invalid module: " << module);
978 ND::GeomId::Def::ECal::kSeqIdLSB);
979 id.SetField(module*2+clam,
981 ND::GeomId::Def::ECal::kModuleLSB);
984 ND::GeomId::Def::ECal::Global::kSeqIdLSB);
987 ND::GeomId::Def::ECal::Global::kFieldLSB);
992 TSettableGeometryId id(i);
994 if (det == ND::GeomId::Def::kDSECal)
return det;
995 else if (det == ND::GeomId::Def::kTECal)
return det;
996 else if (det == ND::GeomId::Def::kPECal)
return det;
1000 int ND::GeomId::ECal::GetLayerClam(TGeometryId i) {
1001 TSettableGeometryId id(i);
1005 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1008 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
1011 ND::GeomId::Def::ECal::kModuleLSB) % 2;
1014 int ND::GeomId::ECal::GetLayerModule(TGeometryId i) {
1015 TSettableGeometryId id(i);
1019 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1022 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
1025 ND::GeomId::Def::ECal::kModuleLSB) / 2;
1028 int ND::GeomId::ECal::GetLayerNumber(TGeometryId i) {
1029 TSettableGeometryId id(i);
1033 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1036 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
1039 ND::GeomId::Def::ECal::Global::kFieldLSB);
1043 int module,
int rad) {
1044 TSettableGeometryId id;
1045 if (ecal == ND::GeomId::Def::kDSECal) {
1047 ND280Error(
"Downstream ECal with invalid clam: " << clam);
1051 ND280Error(
"Downstream ECal with invalid module: " << module);
1055 else if (ecal == ND::GeomId::Def::kTECal) {
1056 if (clam != 0 && clam != 1) {
1057 ND280Error(
"Tracker ECal with invalid clam: " << clam);
1060 if (module<0 || 2<module) {
1061 ND280Error(
"Tracker ECal with invalid module: " << module);
1065 else if (ecal == ND::GeomId::Def::kPECal) {
1066 if (clam != 0 && clam != 1) {
1067 ND280Error(
"P0D ECal with invalid clam: " << clam);
1070 if (module<0 || 2<module) {
1071 ND280Error(
"P0D ECal with invalid module: " << module);
1080 ND::GeomId::Def::ECal::kSeqIdLSB);
1081 id.SetField(module*2+clam,
1083 ND::GeomId::Def::ECal::kModuleLSB);
1086 ND::GeomId::Def::ECal::Global::kSeqIdLSB);
1089 ND::GeomId::Def::ECal::Global::kFieldLSB);
1094 TSettableGeometryId id(i);
1096 if (det == ND::GeomId::Def::kDSECal)
return det;
1097 else if (det == ND::GeomId::Def::kTECal)
return det;
1098 else if (det == ND::GeomId::Def::kPECal)
return det;
1102 int ND::GeomId::ECal::GetRadiatorClam(TGeometryId i) {
1103 TSettableGeometryId id(i);
1107 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1110 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
1113 ND::GeomId::Def::ECal::kModuleLSB) % 2;
1116 int ND::GeomId::ECal::GetRadiatorModule(TGeometryId i) {
1117 TSettableGeometryId id(i);
1121 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1124 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
1127 ND::GeomId::Def::ECal::kModuleLSB) / 2;
1130 int ND::GeomId::ECal::GetRadiatorNumber(TGeometryId i) {
1131 TSettableGeometryId id(i);
1135 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1138 ND::GeomId::Def::ECal::Global::kSeqIdLSB))
return -1;
1141 ND::GeomId::Def::ECal::Global::kFieldLSB);
1145 int module,
int layer,
int bar) {
1146 TSettableGeometryId id;
1147 if (ecal == ND::GeomId::Def::kDSECal) {
1149 ND280Error(
"Downstream ECal with invalid clam: " << clam);
1153 ND280Error(
"Downstream ECal with invalid module: " << module);
1157 else if (ecal == ND::GeomId::Def::kTECal) {
1158 if (clam != 0 && clam != 1) {
1159 ND280Error(
"Tracker ECal with invalid clam: " << clam);
1162 if (module<0 || 2<module) {
1163 ND280Error(
"Tracker ECal with invalid module: " << module);
1167 else if (ecal == ND::GeomId::Def::kPECal) {
1168 if (clam != 0 && clam != 1) {
1169 ND280Error(
"P0D ECal with invalid clam: " << clam);
1172 if (module<0 || 2<module) {
1173 ND280Error(
"P0D ECal with invalid module: " << module);
1182 ND::GeomId::Def::ECal::kSeqIdLSB);
1183 id.SetField(module*2+clam,
1185 ND::GeomId::Def::ECal::kModuleLSB);
1188 ND::GeomId::Def::ECal::Bar::kLayerLSB);
1191 ND::GeomId::Def::ECal::Bar::kBarLSB);
1196 TSettableGeometryId id(i);
1198 if (det == ND::GeomId::Def::kDSECal)
return det;
1199 else if (det == ND::GeomId::Def::kTECal)
return det;
1200 else if (det == ND::GeomId::Def::kPECal)
return det;
1204 int ND::GeomId::ECal::GetBarClam(TGeometryId i) {
1205 TSettableGeometryId id(i);
1209 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1212 ND::GeomId::Def::ECal::kModuleLSB) % 2;
1215 int ND::GeomId::ECal::GetBarModule(TGeometryId i) {
1216 TSettableGeometryId id(i);
1220 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1223 ND::GeomId::Def::ECal::kModuleLSB) / 2;
1226 int ND::GeomId::ECal::GetBarLayer(TGeometryId i) {
1227 TSettableGeometryId id(i);
1231 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1234 ND::GeomId::Def::ECal::Bar::kLayerLSB);
1237 int ND::GeomId::ECal::GetBarNumber(TGeometryId i) {
1238 TSettableGeometryId id(i);
1242 ND::GeomId::Def::ECal::kSeqIdLSB))
return -1;
1245 ND::GeomId::Def::ECal::Bar::kBarLSB);
1252 TSettableGeometryId id(i);
1253 return (ND::GeomId::Def::kDSECal
1268 return ND::GeomId::ECal::GetLayerNumber(i);
1277 return ND::GeomId::ECal::GetRadiatorNumber(i);
1287 return ND::GeomId::ECal::GetBarLayer(i);
1290 int ND::GeomId::DSECal::GetBarNumber(TGeometryId i) {
1292 return ND::GeomId::ECal::GetBarNumber(i);
1299 TSettableGeometryId id(i);
1300 return (ND::GeomId::Def::kTECal
1322 clam,mod,layer,bar);
1325 int ND::GeomId::TECal::GetModuleNumber(TGeometryId i) {
1327 return ND::GeomId::ECal::GetModuleNumber(i);
1332 return ND::GeomId::ECal::GetModuleClam(i);
1335 int ND::GeomId::TECal::GetLayerNumber(TGeometryId i) {
1337 return ND::GeomId::ECal::GetLayerNumber(i);
1342 return ND::GeomId::ECal::GetLayerClam(i);
1345 int ND::GeomId::TECal::GetLayerModule(TGeometryId i) {
1347 return ND::GeomId::ECal::GetLayerModule(i);
1350 int ND::GeomId::TECal::GetRadiatorNumber(TGeometryId i) {
1352 return ND::GeomId::ECal::GetRadiatorNumber(i);
1357 return ND::GeomId::ECal::GetRadiatorClam(i);
1360 int ND::GeomId::TECal::GetRadiatorModule(TGeometryId i) {
1362 return ND::GeomId::ECal::GetRadiatorModule(i);
1365 int ND::GeomId::TECal::GetBarNumber(TGeometryId i) {
1367 return ND::GeomId::ECal::GetBarNumber(i);
1370 int ND::GeomId::TECal::GetBarLayer(TGeometryId i) {
1372 return ND::GeomId::ECal::GetBarLayer(i);
1377 return ND::GeomId::ECal::GetBarClam(i);
1380 int ND::GeomId::TECal::GetBarModule(TGeometryId i) {
1382 return ND::GeomId::ECal::GetBarModule(i);
1389 TSettableGeometryId id(i);
1390 return (ND::GeomId::Def::kPECal
1412 clam,mod,layer,bar);
1415 int ND::GeomId::PECal::GetModuleNumber(TGeometryId i) {
1417 return ND::GeomId::ECal::GetModuleNumber(i);
1422 return ND::GeomId::ECal::GetModuleClam(i);
1425 int ND::GeomId::PECal::GetLayerNumber(TGeometryId i) {
1427 return ND::GeomId::ECal::GetLayerNumber(i);
1432 return ND::GeomId::ECal::GetLayerClam(i);
1435 int ND::GeomId::PECal::GetLayerModule(TGeometryId i) {
1437 return ND::GeomId::ECal::GetLayerModule(i);
1440 int ND::GeomId::PECal::GetRadiatorNumber(TGeometryId i) {
1442 return ND::GeomId::ECal::GetRadiatorNumber(i);
1447 return ND::GeomId::ECal::GetRadiatorClam(i);
1450 int ND::GeomId::PECal::GetRadiatorModule(TGeometryId i) {
1452 return ND::GeomId::ECal::GetRadiatorModule(i);
1455 int ND::GeomId::PECal::GetBarNumber(TGeometryId i) {
1457 return ND::GeomId::ECal::GetBarNumber(i);
1460 int ND::GeomId::PECal::GetBarLayer(TGeometryId i) {
1462 return ND::GeomId::ECal::GetBarLayer(i);
1467 return ND::GeomId::ECal::GetBarClam(i);
1470 int ND::GeomId::PECal::GetBarModule(TGeometryId i) {
1472 return ND::GeomId::ECal::GetBarModule(i);
1479 TSettableGeometryId id(i);
1480 return (ND::GeomId::Def::kSMRD
1486 int layer,
int slot) {
1487 TSettableGeometryId id;
1488 id.SetField(ND::GeomId::Def::kSMRD,
1493 ND::GeomId::Def::SMRD::kSeqIdLSB);
1496 ND::GeomId::Def::SMRD::Global::kSeqIdLSB);
1499 ND::GeomId::Def::SMRD::Global::Module::kClamLSB);
1502 ND::GeomId::Def::SMRD::Global::Module::kYokeLSB);
1505 ND::GeomId::Def::SMRD::Global::Module::kLayerLSB);
1508 ND::GeomId::Def::SMRD::Global::Module::kSlotLSB);
1513 TSettableGeometryId id(i);
1514 if (ND::GeomId::Def::kSMRD
1519 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1522 ND::GeomId::Def::SMRD::Global::kSeqIdLSB))
return -1;
1525 ND::GeomId::Def::SMRD::Global::Module::kClamLSB);
1528 int ND::GeomId::SMRD::GetModuleYoke(TGeometryId i) {
1529 TSettableGeometryId id(i);
1530 if (ND::GeomId::Def::kSMRD
1535 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1538 ND::GeomId::Def::SMRD::Global::kSeqIdLSB))
return -1;
1542 ND::GeomId::Def::SMRD::Global::Module::kYokeLSB);
1545 int ND::GeomId::SMRD::GetModuleLayer(TGeometryId i) {
1546 TSettableGeometryId id(i);
1547 if (ND::GeomId::Def::kSMRD
1552 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1555 ND::GeomId::Def::SMRD::Global::kSeqIdLSB))
return -1;
1559 ND::GeomId::Def::SMRD::Global::Module::kLayerLSB);
1562 int ND::GeomId::SMRD::GetModuleSlot(TGeometryId i) {
1563 TSettableGeometryId id(i);
1564 if (ND::GeomId::Def::kSMRD
1569 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1572 ND::GeomId::Def::SMRD::Global::kSeqIdLSB))
return -1;
1576 ND::GeomId::Def::SMRD::Global::Module::kSlotLSB);
1580 int layer,
int slot,
int bar) {
1581 TSettableGeometryId id;
1582 id.SetField(ND::GeomId::Def::kSMRD,
1587 ND::GeomId::Def::SMRD::kSeqIdLSB);
1590 ND::GeomId::Def::SMRD::Bar::kClamLSB);
1593 ND::GeomId::Def::SMRD::Bar::kYokeLSB);
1596 ND::GeomId::Def::SMRD::Bar::kLayerLSB);
1599 ND::GeomId::Def::SMRD::Bar::kSlotLSB);
1602 ND::GeomId::Def::SMRD::Bar::kBarLSB);
1607 TSettableGeometryId id(i);
1608 if (ND::GeomId::Def::kSMRD
1613 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1616 ND::GeomId::Def::SMRD::Bar::kClamLSB);
1619 int ND::GeomId::SMRD::GetBarYoke(TGeometryId i) {
1620 TSettableGeometryId id(i);
1621 if (ND::GeomId::Def::kSMRD
1626 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1629 ND::GeomId::Def::SMRD::Bar::kYokeLSB);
1632 int ND::GeomId::SMRD::GetBarLayer(TGeometryId i) {
1633 TSettableGeometryId id(i);
1634 if (ND::GeomId::Def::kSMRD
1639 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1642 ND::GeomId::Def::SMRD::Bar::kLayerLSB);
1645 int ND::GeomId::SMRD::GetBarSlot(TGeometryId i) {
1646 TSettableGeometryId id(i);
1647 if (ND::GeomId::Def::kSMRD
1652 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1655 ND::GeomId::Def::SMRD::Bar::kSlotLSB);
1658 int ND::GeomId::SMRD::GetBarNumber(TGeometryId i) {
1659 TSettableGeometryId id(i);
1660 if (ND::GeomId::Def::kSMRD
1665 ND::GeomId::Def::SMRD::kSeqIdLSB))
return -1;
1668 ND::GeomId::Def::SMRD::Bar::kBarLSB);
1676 int objType,
int obj,
int trk,
int proj,
int scinti){
1677 TSettableGeometryId id;
1678 id.SetField(ND::GeomId::Def::kINGRID,
1681 id.SetField(objType,
1683 ND::GeomId::Def::INGRID::kIngridObjIDLSB);
1686 ND::GeomId::Def::INGRID::kIngridModNumLSB);
1689 ND::GeomId::Def::INGRID::kIngridTrkNumLSB);
1692 ND::GeomId::Def::INGRID::kIngridProjLSB);
1695 ND::GeomId::Def::INGRID::kIngridSciNumLSB);
1700 int obj,
int trk,
int proj,
int scinti){
bool IsFGD1(TGeometryId id)
TGeometryId VertVetoScintillator(int veto, int scinti)
The geometry of a vertical veto scintillator.
TGeometryId Bar(int p0dule, int layer, int bar)
One of the super-P0Dules.
One of the ECal Radiators.
TGeometryId Module(int mod)
const GeomIdBit kPlaneMSB
TGeometryId Container(int ecal, int clam, int module)
int GetRadiatorClam(TGeometryId id)
TGeometryId Layer(int clam, int module, int layer)
The layer within the ecal.
TGeometryId ECalRadiator(int radiator)
int GetTargetRadiator(TGeometryId id)
int GetLayer(TGeometryId id)
int GetBarClam(TGeometryId id)
const GeomIdBit kSeqIdMSB
TGeometryId MicroMega(int tpc, int half, int mm)
const GeomIdBit kDetectorIdLSB
The least significant bit of the detector identifier.
TGeometryId Module(int clam, int module)
The geometry identifier for the tracker ecal modules.
const GeomIdBit kIngridSciNumMSB
TGeometryId Radiator(int clam, int module, int radiator)
The geometry identifier for the radiators.
int GetSuperP0Dule(TGeometryId id)
const GeomIdBit kPadFlagMSB
const GeomIdBit kIngridObjIDMSB
TGeometryId Bar(int clam, int module, int layer, int bar)
The geometry identifiers for the scintillators.
const GeomIdBit kModuleMSB
int GetP0Dule(TGeometryId id)
int GetModuleClam(TGeometryId id)
One of the water targets.
int GetTarget(TGeometryId id)
TGeometryId Bar(int clam, int yoke, int layer, int slot, int bar)
The geometry identifer for a SMRD bar.
TGeometryId Bar(int layer, int bar)
The geometry identifiers for DSECal scintillators.
int GetTarget(TGeometryId id)
const GeomIdBit kSeqIdMSB
TGeometryId Target(int i)
The geometry identifier for the targets.
TGeometryId Module(int clam, int yoke, int layer, int slot)
The geometry identifier for a SMRD module.
const GeomIdBit kLayerMSB
int GetBarLayer(TGeometryId id)
TGeometryId Radiator(int clam, int module, int radiator)
The geometry identifier for the radiators.
int GetRadiatorClam(TGeometryId id)
TGeometryId Module(int ecal, int clam, int module)
TGeometryId Layer(int fgd, int module, int layer)
int GetMicroMegaTPC(TGeometryId id)
const GeomIdBit kFieldMSB
The sequence value for this type of global volume.
int GetLayerFGD(TGeometryId id)
bool IsTPC1(TGeometryId id)
Check to see if the id is for a TPCn.
const GeomIdBit kSP0DuleMSB
const GeomIdBit kIngridTrkNumMSB
const GeomIdBit kHalfMSB
The half of the drift volume.
TGeometryId Radiator(int ecal, int clam, int module, int radiator)
The geometry identifier for the radiators.
TGeometryId FGD1()
The geometry identifier for FGD1.
TGeometryId Empty()
Return the geometry id indication None.
int GetBarNumber(TGeometryId id)
TGeometryId Bar(int ecal, int clam, int module, int layer, int bar)
The geometry identifiers for the scintillators.
int GetLayerClam(TGeometryId id)
const GeomIdBit kMMegaMSB
const GeomIdBit kDetectorIdMSB
TGeometryId Scintillator(int objType, int obj, int trk, int proj, int scinti)
bool IsSMRD(TGeometryId id)
Test if this id is for the SMRD.
int GetModuleClam(TGeometryId id)
Access the information for an ECal Module.
A special case for one of a kind global volumes.
const GeomIdBit kSeqIdMSB
One of the brass target radiators.
One of the water target modules.
const GeomIdBit kModuleMSB
bool IsDSECal(TGeometryId id)
Check if the id corresponds to the DSECal.
const GeomIdBit kLayerMSB
const GeomIdBit kLayerMSB
const GeomIdBit kFieldMSB
The sequence value for this type of global volume.
bool IsPECal(TGeometryId id)
Check if the id corresponds to the PECal.
int GetPadTPC(TGeometryId id)
int GetRadiator(TGeometryId id)
const GeomIdBit kModuleMSB
int GetModuleECal(TGeometryId id)
Access the information for an ECal Module.
const TVector3 field
Constants.
TGeometryId Layer(int layer)
The layer within the ecal.
bool IsTPC(TGeometryId id)
Check to see if the id is for a TPC.
TGeometryId Target(int target)
TGeometryId Pad(int tpc, int half, int mm, int pad)
TGeometryId Module(int clam, int module)
The geometry identifier for the tracker ecal modules.
TGeometryId TargetRadiator(int radiator)
const GeomIdBit kP0DuleMSB
int GetBarFGD(TGeometryId id)
const GeomIdBit kLayerMSB
int GetLayerClam(TGeometryId id)
int GetBarLayer(TGeometryId id)
TGeometryId ModScintillator(int mod, int trk, int proj, int scinti)
The geometry of a module scintillator.
int GetModule(TGeometryId id)
int GetBarClam(TGeometryId id)
const GeomIdBit kSeqIdMSB
const GeomIdBit kIngridProjMSB
TGeometryId Detector()
The geometry identifier for the downstream ecal detector.
int GetModuleClam(TGeometryId id)
Access the information for an ECal Module.
TGeometryId HorzVetoScintillator(int veto, int scinti)
The geometry of an horizontal veto scintillator.
TGeometryId SuperP0Dule(int sP0Dule)
const GeomIdBit kLayerMSB
int GetBarClam(TGeometryId id)
int GetFGD(TGeometryId id)
Get the FGD number. This returns -1 if the id is invalid.
TGeometryId TPC2()
The geometry identifier for TPC2.
TGeometryId Detector()
Define a geometry identifier to the entire P0D detector.
const GeomIdBit kIngridModNumMSB
One of the ECal scintillator layers.
The sequence for all of the modules in the SMRD.
bool IsPad(TGeometryId id)
Check if a TGeometryId is a PAD.
TGeometryId Layer(int ecal, int clam, int module, int layer)
The layer within the ecal.
int GetECalRadiator(TGeometryId id)
TGeometryId Bar(int fgd, int module, int layer, int bar)
int GetRadiatorECal(TGeometryId id)
bool IsTECal(TGeometryId id)
Check if the id corresponds to the TECal.
const GeomIdBit kSeqIdMSB
TGeometryId TPC3()
The geometry identifier for TPC3.
const GeomIdBit kFieldMSB
The sequence value for this type of global volume.
const GeomIdBit kSeqIdMSB
bool IsMicroMega(TGeometryId id)
Check if a TGeometryId is a MicroMega.
const GeomIdBit kSeqIdMSB
int GetBarP0Dule(TGeometryId id)
const GeomIdBit kSeqIdMSB
int GetSubSystem(TGeometryId id)
Get the sub-system type.
int GetBarECal(TGeometryId id)
TGeometryId Radiator(int radiator)
The geometry identifier for the radiators.
int GetLayerECal(TGeometryId id)
A special case for one of a kind global volumes.
const GeomIdBit kTPCMSB
The TPC withing the tracker. 0) TPC1 1) TPC2 2) TPC3.
bool IsFGD(TGeometryId id)
Check if this is an FGD id.
const GeomIdBit kSlotMSB
The slot within a layer.
TGeometryId P0Dule(int p0dule)
const GeomIdBit kLayerMSB
TGeometryId FGD2()
The geometry identifier for FGD2. FGD2 has the water targets.
TGeometryId Layer(int clam, int module, int layer)
The layer within the ecal.
bool IsP0D(TGeometryId id)
Check if the id is for the P0D.
const GeomIdBit kSeqIdMSB
TGeometryId TPC1()
The geometry identifier for TPC1.
TGeometryId Bar(int clam, int module, int layer, int bar)
The geometry identifiers for the scintillators.
const GeomIdBit kSlotMSB
The slot within a layer.