1 #include "ConstituentsUtils.hxx" 7 #include "BaseDataClasses.hxx" 9 #include "SubDetId.hxx" 22 Int_t nnodes_max[3]={0,0,0};
23 Int_t itrack_nnodes_max[3]={-1,-1,-1};
24 for(Int_t iseg=0; iseg< nseg_in; iseg++){
26 if (in[iseg]->NNodes > nnodes_max[tpc]){
27 nnodes_max[tpc] = in[iseg]->
NNodes;
28 itrack_nnodes_max[tpc]=iseg;
33 for(Int_t i=0;i< 3;i++){
34 if (itrack_nnodes_max[i]!=-1)
35 out[nseg_out++]=in[itrack_nnodes_max[i]];
67 else return SubDetId::kInvalid;
73 if (det == SubDetId::kInvalid) {
93 case SubDetId::kECAL :
98 case SubDetId::kSMRD :
103 case SubDetId::kP0D :
113 segments[count] = tpc_track;
122 segments[count] = fgd_track;
131 segments[count] = ecal_track;
140 segments[count] = smrd_track;
161 int tpc_closest = SubDetId::kInvalid;
162 int tpc = SubDetId::kInvalid;
166 Float_t dist = 9999999.;
167 int nNodes[3] = {0,0,0};
171 Float_t dist_tmp = std::min(
182 if(tpc_track->
NNodes > nNodes[tpc-1]){
183 nNodes[tpc-1] = tpc_track->
NNodes;
184 subtrack[tpc-1] = tpc_track;
188 if(tpc_closest != (
int)SubDetId::kInvalid)
return subtrack[tpc_closest-1];
197 if (det == SubDetId::kInvalid) {
208 case SubDetId::kTPC :
211 if(tpc_track->
NNodes > nNodes){
212 nNodes = tpc_track->
NNodes;
213 subtrack = tpc_track;
218 case SubDetId::kFGD :
221 if(fgd_track->
NNodes > nNodes){
222 nNodes = fgd_track->
NNodes;
223 subtrack = fgd_track;
228 case SubDetId::kECAL :
231 if(tpc_track->
NNodes > nNodes){
232 nNodes = tpc_track->
NNodes;
233 subtrack = tpc_track;
238 case SubDetId::kSMRD :
241 if(smrd_track->
NNodes > nNodes){
242 nNodes = smrd_track->
NNodes;
243 subtrack = smrd_track;
248 case SubDetId::kP0D :
251 if(p0d_track->
NNodes > nNodes){
252 nNodes = p0d_track->
NNodes;
253 subtrack = p0d_track;
263 if(tpc_track->
NNodes > nNodes){
264 nNodes = tpc_track->
NNodes;
265 subtrack = tpc_track;
275 if(fgd_track->
NNodes > nNodes){
276 nNodes = fgd_track->
NNodes;
277 subtrack = fgd_track;
288 if(p0d_track->
NNodes > nNodes){
289 nNodes = p0d_track->
NNodes;
290 subtrack = p0d_track;
300 if(ecal_track->
NNodes > nNodes){
301 nNodes = ecal_track->
NNodes;
302 subtrack = ecal_track;
312 if(smrd_track->
NNodes > nNodes){
313 nNodes = smrd_track->
NNodes;
314 subtrack = smrd_track;
378 for(Int_t it = 0; it !=
static_cast<Int_t
>(SubDetId::kInvalidSubdetector); it++) {
383 return SubDetId::kInvalid;
390 Float_t null[3] = {0.,0.,0.};
397 case SubDetId::kFGD1:
400 case SubDetId::kFGD2:
410 case SubDetId::kTPC1:
413 case SubDetId::kTPC2:
416 case SubDetId::kTPC3:
422 case SubDetId::kECAL:
435 case SubDetId::kTECAL:
443 case SubDetId::kTopTECAL:
446 case SubDetId::kBottomTECAL:
449 case SubDetId::kLeftTECAL:
452 case SubDetId::kRightTECAL:
455 case SubDetId::kPECAL:
463 case SubDetId::kTopPECAL:
466 case SubDetId::kBottomPECAL:
469 case SubDetId::kLeftPECAL:
472 case SubDetId::kRightPECAL:
475 case SubDetId::kSMRD:
483 case SubDetId::kTopSMRD:
486 case SubDetId::kBottomSMRD:
489 case SubDetId::kLeftSMRD:
492 case SubDetId::kRightSMRD:
495 case SubDetId::kDSECAL:
499 std::cout <<
"Warning: anaUtils::InDetVolume() No Volume set for " << det << std::endl;
514 Float_t null[3] = {0.,0.,0.};
519 case SubDetId::kFGD1:
522 case SubDetId::kFGD2:
532 case SubDetId::kTPC1:
535 case SubDetId::kTPC2:
538 case SubDetId::kTPC3:
544 case SubDetId::kECAL:
557 case SubDetId::kTECAL:
565 case SubDetId::kTopTECAL:
568 case SubDetId::kBottomTECAL:
571 case SubDetId::kLeftTECAL:
574 case SubDetId::kRightTECAL:
577 case SubDetId::kPECAL:
585 case SubDetId::kTopPECAL:
588 case SubDetId::kBottomPECAL:
591 case SubDetId::kLeftPECAL:
594 case SubDetId::kRightPECAL:
597 case SubDetId::kSMRD:
605 case SubDetId::kTopSMRD:
608 case SubDetId::kBottomSMRD:
611 case SubDetId::kLeftSMRD:
614 case SubDetId::kRightSMRD:
617 case SubDetId::kDSECAL:
621 std::cout <<
"Warning: anaUtils::InFiducialVolume() No Fiducial Volume set for " << det << std::endl;
632 case SubDetId::kFGD1:
633 if (pos[0] > DetDef::fgd1min[0]+FVdefmin[0] &&
634 pos[0] < DetDef::fgd1max[0]-FVdefmax[0] &&
635 pos[1] > DetDef::fgd1min[1]+FVdefmin[1] &&
636 pos[1] < DetDef::fgd1max[1]-FVdefmax[1] &&
637 pos[2] > DetDef::fgd1min[2]+FVdefmin[2] &&
638 pos[2] < DetDef::fgd1max[2]-FVdefmax[2])
641 case SubDetId::kFGD2:
642 if (pos[0] > DetDef::fgd2min[0]+FVdefmin[0] &&
643 pos[0] < DetDef::fgd2max[0]-FVdefmax[0] &&
644 pos[1] > DetDef::fgd2min[1]+FVdefmin[1] &&
645 pos[1] < DetDef::fgd2max[1]-FVdefmax[1] &&
646 pos[2] > DetDef::fgd2min[2]+FVdefmin[2] &&
647 pos[2] < DetDef::fgd2max[2]-FVdefmax[2])
650 case SubDetId::kTPC1:
651 if (pos[0] > DetDef::tpc1min[0]+FVdefmin[0] &&
652 pos[0] < DetDef::tpc1max[0]-FVdefmax[0] &&
653 pos[1] > DetDef::tpc1min[1]+FVdefmin[1] &&
654 pos[1] < DetDef::tpc1max[1]-FVdefmax[1] &&
655 pos[2] > DetDef::tpc1min[2]+FVdefmin[2] &&
656 pos[2] < DetDef::tpc1max[2]-FVdefmax[2])
659 case SubDetId::kTPC2:
660 if (pos[0] > DetDef::tpc2min[0]+FVdefmin[0] &&
661 pos[0] < DetDef::tpc2max[0]-FVdefmax[0] &&
662 pos[1] > DetDef::tpc2min[1]+FVdefmin[1] &&
663 pos[1] < DetDef::tpc2max[1]-FVdefmax[1] &&
664 pos[2] > DetDef::tpc2min[2]+FVdefmin[2] &&
665 pos[2] < DetDef::tpc2max[2]-FVdefmax[2])
668 case SubDetId::kTPC3:
669 if (pos[0] > DetDef::tpc3min[0]+FVdefmin[0] &&
670 pos[0] < DetDef::tpc3max[0]-FVdefmax[0] &&
671 pos[1] > DetDef::tpc3min[1]+FVdefmin[1] &&
672 pos[1] < DetDef::tpc3max[1]-FVdefmax[1] &&
673 pos[2] > DetDef::tpc3min[2]+FVdefmin[2] &&
674 pos[2] < DetDef::tpc3max[2]-FVdefmax[2])
678 if (pos[0] > DetDef::p0dmin[0]+FVdefmin[0] &&
679 pos[0] < DetDef::p0dmax[0]-FVdefmax[0] &&
680 pos[1] > DetDef::p0dmin[1]+FVdefmin[1] &&
681 pos[1] < DetDef::p0dmax[1]-FVdefmax[1] &&
682 pos[2] > DetDef::p0dmin[2]+FVdefmin[2] &&
683 pos[2] < DetDef::p0dmax[2]-FVdefmax[2])
687 case SubDetId::kDSECAL:
688 if (pos[0] > DetDef::dsecalmin[0]+FVdefmin[0] &&
689 pos[0] < DetDef::dsecalmax[0]-FVdefmax[0] &&
690 pos[1] > DetDef::dsecalmin[1]+FVdefmin[1] &&
691 pos[1] < DetDef::dsecalmax[1]-FVdefmax[1] &&
692 pos[2] > DetDef::dsecalmin[2]+FVdefmin[2] &&
693 pos[2] < DetDef::dsecalmax[2]-FVdefmax[2])
697 case SubDetId::kLeftTECAL:
698 if (pos[0] > DetDef::tecalLmin[0]+FVdefmin[0] &&
699 pos[0] < DetDef::tecalLmax[0]-FVdefmax[0] &&
700 pos[1] > DetDef::tecalLmin[1]+FVdefmin[1] &&
701 pos[1] < DetDef::tecalLmax[1]-FVdefmax[1] &&
702 pos[2] > DetDef::tecalLmin[2]+FVdefmin[2] &&
703 pos[2] < DetDef::tecalLmax[2]-FVdefmax[2])
706 case SubDetId::kRightTECAL:
707 if (pos[0] > DetDef::tecalRmin[0]+FVdefmin[0] &&
708 pos[0] < DetDef::tecalRmax[0]-FVdefmax[0] &&
709 pos[1] > DetDef::tecalRmin[1]+FVdefmin[1] &&
710 pos[1] < DetDef::tecalRmax[1]-FVdefmax[1] &&
711 pos[2] > DetDef::tecalRmin[2]+FVdefmin[2] &&
712 pos[2] < DetDef::tecalRmax[2]-FVdefmax[2])
715 case SubDetId::kTopTECAL:
716 if (pos[0] > DetDef::tecalTLmin[0]+FVdefmin[0] &&
717 pos[0] < DetDef::tecalTLmax[0]-FVdefmax[0] &&
718 pos[1] > DetDef::tecalTLmin[1]+FVdefmin[1] &&
719 pos[1] < DetDef::tecalTLmax[1]-FVdefmax[1] &&
720 pos[2] > DetDef::tecalTLmin[2]+FVdefmin[2] &&
721 pos[2] < DetDef::tecalTLmax[2]-FVdefmax[2])
724 if (pos[0] > DetDef::tecalTRmin[0]+FVdefmax[0] &&
725 pos[0] < DetDef::tecalTRmax[0]-FVdefmin[0] &&
726 pos[1] > DetDef::tecalTRmin[1]+FVdefmin[1] &&
727 pos[1] < DetDef::tecalTRmax[1]-FVdefmax[1] &&
728 pos[2] > DetDef::tecalTRmin[2]+FVdefmin[2] &&
729 pos[2] < DetDef::tecalTRmax[2]-FVdefmax[2])
732 case SubDetId::kBottomTECAL:
733 if (pos[0] > DetDef::tecalBLmin[0]+FVdefmin[0] &&
734 pos[0] < DetDef::tecalBLmax[0]-FVdefmax[0] &&
735 pos[1] > DetDef::tecalBLmin[1]+FVdefmin[1] &&
736 pos[1] < DetDef::tecalBLmax[1]-FVdefmax[1] &&
737 pos[2] > DetDef::tecalBLmin[2]+FVdefmin[2] &&
738 pos[2] < DetDef::tecalBLmax[2]-FVdefmax[2])
741 if (pos[0] > DetDef::tecalBRmin[0]+FVdefmax[0] &&
742 pos[0] < DetDef::tecalBRmax[0]-FVdefmin[0] &&
743 pos[1] > DetDef::tecalBRmin[1]+FVdefmin[1] &&
744 pos[1] < DetDef::tecalBRmax[1]-FVdefmax[1] &&
745 pos[2] > DetDef::tecalBRmin[2]+FVdefmin[2] &&
746 pos[2] < DetDef::tecalBRmax[2]-FVdefmax[2])
750 case SubDetId::kLeftPECAL:
751 if (pos[0] > DetDef::pecalLmin[0]+FVdefmin[0] &&
752 pos[0] < DetDef::pecalLmax[0]-FVdefmax[0] &&
753 pos[1] > DetDef::pecalLmin[1]+FVdefmin[1] &&
754 pos[1] < DetDef::pecalLmax[1]-FVdefmax[1] &&
755 pos[2] > DetDef::pecalLmin[2]+FVdefmin[2] &&
756 pos[2] < DetDef::pecalLmax[2]-FVdefmax[2])
759 case SubDetId::kRightPECAL:
760 if (pos[0] > DetDef::pecalRmin[0]+FVdefmin[0] &&
761 pos[0] < DetDef::pecalRmax[0]-FVdefmax[0] &&
762 pos[1] > DetDef::pecalRmin[1]+FVdefmin[1] &&
763 pos[1] < DetDef::pecalRmax[1]-FVdefmax[1] &&
764 pos[2] > DetDef::pecalRmin[2]+FVdefmin[2] &&
765 pos[2] < DetDef::pecalRmax[2]-FVdefmax[2])
768 case SubDetId::kTopPECAL:
769 if (pos[0] > DetDef::pecalTLmin[0]+FVdefmin[0] &&
770 pos[0] < DetDef::pecalTLmax[0]-FVdefmax[0] &&
771 pos[1] > DetDef::pecalTLmin[1]+FVdefmin[1] &&
772 pos[1] < DetDef::pecalTLmax[1]-FVdefmax[1] &&
773 pos[2] > DetDef::pecalTLmin[2]+FVdefmin[2] &&
774 pos[2] < DetDef::pecalTLmax[2]-FVdefmax[2])
777 if (pos[0] > DetDef::pecalTRmin[0]+FVdefmax[0] &&
778 pos[0] < DetDef::pecalTRmax[0]-FVdefmin[0] &&
779 pos[1] > DetDef::pecalTRmin[1]+FVdefmin[1] &&
780 pos[1] < DetDef::pecalTRmax[1]-FVdefmax[1] &&
781 pos[2] > DetDef::pecalTRmin[2]+FVdefmin[2] &&
782 pos[2] < DetDef::pecalTRmax[2]-FVdefmax[2])
786 case SubDetId::kBottomPECAL:
787 if (pos[0] > DetDef::pecalBLmin[0]+FVdefmin[0] &&
788 pos[0] < DetDef::pecalBLmax[0]-FVdefmax[0] &&
789 pos[1] > DetDef::pecalBLmin[1]+FVdefmin[1] &&
790 pos[1] < DetDef::pecalBLmax[1]-FVdefmax[1] &&
791 pos[2] > DetDef::pecalBLmin[2]+FVdefmin[2] &&
792 pos[2] < DetDef::pecalBLmax[2]-FVdefmax[2])
795 if (pos[0] > DetDef::pecalBRmin[0]+FVdefmax[0] &&
796 pos[0] < DetDef::pecalBRmax[0]-FVdefmin[0] &&
797 pos[1] > DetDef::pecalBRmin[1]+FVdefmin[1] &&
798 pos[1] < DetDef::pecalBRmax[1]-FVdefmax[1] &&
799 pos[2] > DetDef::pecalBRmin[2]+FVdefmin[2] &&
800 pos[2] < DetDef::pecalBRmax[2]-FVdefmax[2])
804 case SubDetId::kLeftSMRD:
805 if (pos[1] > DetDef::smrd15Lmin[1]+FVdefmin[1] &&
806 pos[1] < DetDef::smrd15Lmax[1]-FVdefmax[1] &&
807 pos[2] > DetDef::smrd15Lmin[2]+FVdefmin[2] &&
808 pos[2] < DetDef::smrd78Lmax[2]-FVdefmax[2]){
810 if (pos[2] > DetDef::smrd15Lmin[2] &&
811 pos[2] < DetDef::smrd6Lmin[2] &&
812 pos[0] > DetDef::smrd15Lmin[0]+FVdefmin[0] &&
813 pos[0] < DetDef::smrd15Lmax[0]-FVdefmax[0])
816 if (pos[2] > DetDef::smrd6Lmin[2] &&
817 pos[2] < DetDef::smrd78Lmin[2] &&
818 pos[0] > DetDef::smrd6Lmin[0]+FVdefmin[0] &&
819 pos[0] < DetDef::smrd6Lmax[0]-FVdefmax[0])
822 if (pos[2] > DetDef::smrd78Lmin[2] &&
823 pos[2] < DetDef::smrd78Lmax[2] &&
824 pos[0] > DetDef::smrd78Lmin[0]+FVdefmin[0] &&
825 pos[0] < DetDef::smrd78Lmax[0]-FVdefmax[0])
830 case SubDetId::kRightSMRD:
831 if (pos[1] > DetDef::smrd15Rmin[1]+FVdefmin[1] &&
832 pos[1] < DetDef::smrd15Rmax[1]-FVdefmax[1] &&
833 pos[2] > DetDef::smrd15Rmin[2]+FVdefmin[2] &&
834 pos[2] < DetDef::smrd78Rmax[2]-FVdefmax[2]){
836 if (pos[2] > DetDef::smrd15Rmin[2] &&
837 pos[2] < DetDef::smrd6Rmin[2] &&
838 pos[0] > DetDef::smrd15Rmin[0]+FVdefmin[0] &&
839 pos[0] < DetDef::smrd15Rmax[0]-FVdefmax[0])
842 if (pos[2] > DetDef::smrd6Rmin[2] &&
843 pos[2] < DetDef::smrd78Rmin[2] &&
844 pos[0] > DetDef::smrd6Rmin[0]+FVdefmin[0] &&
845 pos[0] < DetDef::smrd6Rmax[0]-FVdefmax[0])
848 if (pos[2] > DetDef::smrd78Rmin[2] &&
849 pos[2] < DetDef::smrd78Rmax[2] &&
850 pos[0] > DetDef::smrd78Rmin[0]+FVdefmin[0] &&
851 pos[0] < DetDef::smrd78Rmax[0]-FVdefmax[0])
855 case SubDetId::kTopSMRD:
856 if (pos[0] > DetDef::smrdTLmin[0]+FVdefmin[0] &&
857 pos[0] < DetDef::smrdTLmax[0]-FVdefmax[0] &&
858 pos[1] > DetDef::smrdTLmin[1]+FVdefmin[1] &&
859 pos[1] < DetDef::smrdTLmax[1]-FVdefmax[1] &&
860 pos[2] > DetDef::smrdTLmin[2]+FVdefmin[2] &&
861 pos[2] < DetDef::smrdTLmax[2]-FVdefmax[2])
864 if (pos[0] > DetDef::smrdTRmin[0]+FVdefmax[0] &&
865 pos[0] < DetDef::smrdTRmax[0]-FVdefmin[0] &&
866 pos[1] > DetDef::smrdTRmin[1]+FVdefmin[1] &&
867 pos[1] < DetDef::smrdTRmax[1]-FVdefmax[1] &&
868 pos[2] > DetDef::smrdTRmin[2]+FVdefmin[2] &&
869 pos[2] < DetDef::smrdTRmax[2]-FVdefmax[2])
872 case SubDetId::kBottomSMRD:
873 if (pos[0] > DetDef::smrdBLmin[0]+FVdefmin[0] &&
874 pos[0] < DetDef::smrdBLmax[0]-FVdefmax[0] &&
875 pos[1] > DetDef::smrdBLmin[1]+FVdefmin[1] &&
876 pos[1] < DetDef::smrdBLmax[1]-FVdefmax[1] &&
877 pos[2] > DetDef::smrdBLmin[2]+FVdefmin[2] &&
878 pos[2] < DetDef::smrdBLmax[2]-FVdefmax[2])
881 if (pos[0] > DetDef::smrdBRmin[0]+FVdefmax[0] &&
882 pos[0] < DetDef::smrdBRmax[0]-FVdefmin[0] &&
883 pos[1] > DetDef::smrdBRmin[1]+FVdefmin[1] &&
884 pos[1] < DetDef::smrdBRmax[1]-FVdefmax[1] &&
885 pos[2] > DetDef::smrdBRmin[2]+FVdefmin[2] &&
886 pos[2] < DetDef::smrdBRmax[2]-FVdefmax[2])
890 std::cout <<
"Error: anaUtils::InFiducialVolume() given an unknown subdetector enumeration: " << det << std::endl;
903 for(Int_t i=0;i<
event.nTrueParticles;i++){
907 Float_t dist=-9999999;
908 for(Int_t idet=0;idet<
event.TrueParticles[i]->nDetCrossings;idet++){
912 if(sep>dist) dist=sep;
917 chargedtrajInBunch[count] =
event.TrueParticles[i];
940 for (Int_t i = 0; i <
event.nTrueParticles; i++) {
944 Float_t dist = -9999999;
945 for (Int_t idet = 0; idet <
event.TrueParticles[i]->nDetCrossings; idet++) {
952 if(sep>dist) dist=sep;
958 chargedtrajInBunch[count] =
event.TrueParticles[i];
973 for (Int_t i = 0; i < ntrajInBunchInFgdx; i++) {
974 Float_t dist=-999999.;
975 for(Int_t idet=0;idet<trajInBunchInFgdx[i]->
nDetCrossings;idet++){
977 if(
SubDetId::GetDetectorUsed(trajInBunchInFgdx[i]->DetCrossings[idet]->Detector, SubDetId::kTPC) && trajInBunchInFgdx[i]->DetCrossings[idet]->InActive) {
978 Float_t sep =
GetSeparationSquared(trajInBunchInFgdx[i]->DetCrossings[idet]->EntrancePosition, trajInBunchInFgdx[i]->DetCrossings[idet]->ExitPosition);
980 if(sep>dist) dist=sep;
984 bool cross_tpc =
false;
990 chargedtrajInBunch[count] = trajInBunchInFgdx[i];
1004 for(Int_t i=0;i<
event.nTrueParticles;i++){
1009 Float_t dist=-9999999;
1010 for(Int_t idet=0;idet<
event.TrueParticles[i]->nDetCrossings;idet++){
1013 for(Int_t idet1=0;idet1<
event.TrueParticles[i]->nDetCrossings;idet1++){
1021 if(sep>dist) dist=sep;
1029 chargedtrajInBunch[count] =
event.TrueParticles[i];
1044 for(Int_t i=0;i<
event.nTrueParticles;i++){
1050 for(Int_t idet=0;idet<
event.TrueParticles[i]->nDetCrossings;idet++){
1054 if(sep>dist) dist=sep;
1059 chargedtrajInBunch[count] =
event.TrueParticles[i];
1070 for (Int_t i = 0; i<
event.nTrueParticles; i++)
1075 Float_t dist = -9999999;
1076 for (Int_t idet = 0; idet<
event.TrueParticles[i]->nDetCrossings;idet++)
1080 if (sep>dist) dist = sep;
1084 chargedTrajInBunch[count] =
event.TrueParticles[i];
1087 if (count >= (
int) NMAXTRUEPARTICLES)
break;
1097 for (Int_t i = 0; i<
event.nTrueParticles; i++)
1102 Float_t dist = -9999999;
1103 for (Int_t idet = 0; idet<
event.TrueParticles[i]->nDetCrossings;idet++)
1106 for (Int_t idet1=0; idet1<
event.TrueParticles[i]->nDetCrossings; idet1++)
1110 if (sep>dist) dist = sep;
1116 chargedTrajInBunch[count] =
event.TrueParticles[i];
1119 if (count >= (
int) NMAXTRUEPARTICLES)
break;
1130 Int_t ntrajInP0D = GetAllChargedTrajInP0DInBunch(event,trajInP0D);
1132 for (Int_t i = 0; i < ntrajInP0D; i++){
1133 Float_t dist=-999999.;
1134 for (Int_t idet=0; idet<trajInP0D[i]->
nDetCrossings; idet++)
1136 if (
SubDetId::GetDetectorUsed(trajInP0D[i]->DetCrossings[idet]->Detector,SubDetId::kTPC1) && trajInP0D[i]->DetCrossings[idet]->InActive){
1138 if (sep>dist) dist=sep;
1143 bool cross_tpc =
false;
1147 chargedTrajInBunch[count] = trajInP0D[i];
1149 if (count>=(
int)NMAXTRUEPARTICLES)
break;
1164 for (
int it = 0; it <
event.nParticles; it++) {
1167 selTracks[count] = track;
1184 for (
int it = 0; it <
event.nParticles; it++) {
1187 selTracks[count] = track;
1199 bool anaUtils::HasTrackUsingTPC(
const AnaEventB& event) {
1201 return anaUtils::HasTrackUsingDet(event, SubDetId::kTPC);
1241 dets[0] = SubDetId::kTPC;
1245 for (
int it = 0; it <
event.nParticles; it++) {
1269 ecals[count] = ecal;
1292 Float_t pos_z = 1e4;
1333 if (det == SubDetId::kFGD1) std::cout <<
"FGD1 not supported" << std::endl;
1335 else return GetFgdModuleTypeNoFV(IsMC, pos, includeGlueSkin);
1340 Int_t anaUtils::GetFgdModuleTypeNoFV(
bool IsMC,
const Float_t* pos,
bool includeGlueSkin){
1343 Int_t material = GetFgdMaterialNoFV(IsMC, pos);
1345 if (includeGlueSkin) {
1346 if (material >= 10 && material <= 14)
return 0;
1347 if (material >= 15 && material <= 19)
return 1;
1348 if (material >= 20 && material <= 26)
return 2;
1352 if (material == 10)
return 0;
1353 if (material == 15)
return 1;
1354 if (material == 20)
return 2;
1365 if (det == SubDetId::kFGD1) std::cout <<
"FGD1 not supported" << std::endl;
1367 else return GetFgdMaterialNoFV(IsMC, pos);
1372 Int_t anaUtils::GetFgdMaterialNoFV(
bool IsMC,
const Float_t* pos){
1376 Float_t barCenter[14];
1377 Float_t waterCenter[6];
1379 for (Int_t i=0; i<14; i++) barCenter[i] = DetDef::fgd2BarCenterMC[i];
1380 for (Int_t i=0; i<6; i++) waterCenter[i] = DetDef::fgd2WaterCenterMC[i];
1382 for (Int_t i=0; i<14; i++) barCenter[i] = DetDef::fgd2BarCenterDATA[i];
1383 for (Int_t i=0; i<6; i++) waterCenter[i] = DetDef::fgd2WaterCenterDATA[i];
1387 Float_t midpos_preX[7];
1388 Float_t midpos_postY[7];
1389 Float_t midpos_XY[7];
1393 Float_t initZ, finalZ;
1394 for (Int_t ibar=0; ibar<14; ibar++) {
1396 initZ = barCenter[ibar] - (DetDef::fgdXYBarWidth/2);
1397 finalZ = barCenter[ibar] + (DetDef::fgdXYBarWidth/2);
1400 if (pos[2] >= initZ && pos[2] <= finalZ)
return 10;
1401 initZ = initZ - DetDef::fgdXYGlueWidth;
1402 if (pos[2] >= initZ && pos[2] <= finalZ)
return 11;
1403 initZ = initZ - DetDef::fgdXYSkinWidth;
1404 if (pos[2] >= initZ && pos[2] <= finalZ)
return 12;
1405 initZ = initZ - (DetDef::fgdWaterAirWidth/2);
1406 if (pos[2] >= initZ && pos[2] <= finalZ)
return 13;
1407 finalZ = finalZ + (DetDef::fgdXYMiddleGlueWidth/2);
1408 if (pos[2] >= initZ && pos[2] <= finalZ)
return 14;
1410 midpos_preX[ixymod] = initZ;
1411 midpos_XY[ixymod] = finalZ;
1413 }
else if (ibar%2 == 1) {
1414 if (pos[2] >= initZ && pos[2] <= finalZ)
return 15;
1415 finalZ = finalZ + DetDef::fgdXYGlueWidth;
1416 if (pos[2] >= initZ && pos[2] <= finalZ)
return 16;
1417 finalZ = finalZ + DetDef::fgdXYSkinWidth;
1418 if (pos[2] >= initZ && pos[2] <= finalZ)
return 17;
1419 finalZ = finalZ + (DetDef::fgdXYAirWidth/2);
1420 if (pos[2] >= initZ && pos[2] <= finalZ)
return 18;
1424 if (pos[2] >= midpos_XY[ixymod] && pos[2] <= finalZ)
return 19;
1426 midpos_postY[ixymod] = finalZ;
1432 for (Int_t ibar=0; ibar<6; ibar++) {
1433 initZ = waterCenter[ibar] - (DetDef::fgdWaterPCWidth/2);
1434 finalZ = waterCenter[ibar] + (DetDef::fgdWaterPCWidth/2);
1435 if (pos[2] >= initZ && pos[2] <= finalZ)
return 20;
1436 initZ = initZ - DetDef::fgdWaterGlueWidth;
1437 if (pos[2] >= initZ && pos[2] <= finalZ)
return 21;
1438 initZ = initZ - DetDef::fgdWaterSkinWidth;
1439 if (pos[2] >= initZ && pos[2] <= finalZ)
return 22;
1443 if (pos[2] >= midpos_postY[ibar] && pos[2] <= finalZ)
return 23;
1445 finalZ = finalZ + DetDef::fgdWaterGlueWidth;
1446 if (pos[2] >= initZ && pos[2] <= finalZ)
return 24;
1447 finalZ = finalZ + DetDef::fgdWaterSkinWidth;
1448 if (pos[2] >= initZ && pos[2] <= finalZ)
return 25;
1452 if (pos[2] >= initZ && pos[2] <= midpos_preX[ibar+1])
return 26;
1455 std::cout <<
"Error in GetFgdMaterialNoFV: material not found for this position." << std::endl;
1465 return anaUtils::kFGD1;
1467 if (anaUtils::GetFgdModuleTypeNoFV(IsMC,pos,
true) == 2)
1468 return anaUtils::kFGD2watermodules;
1470 return anaUtils::kFGD2xymodules;
1480 else return kInvalid;
int GetAllTracksUsingECAL(const AnaEventB &event, AnaTrackB *selTracks[])
bool InActive
If the particle passes through an active part of the subdetector.
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
int nP0DSegments
How many P0D tracks are associated with this track.
Float_t PositionStart[4]
The reconstructed start position of the particle.
AnaP0DParticleB * P0DSegments[NMAXP0DS]
The P0D segments that contributed to this global track.
int nDetCrossings
The number of DetCrossing objects.
bool UsesTrackerDsEcal(AnaTrackB *track)
Whether this track has an ecal segment in the TrackerECal or DsECal.
Float_t ExitPosition[4]
for each subdetector tell the exit position
static bool IsFGDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a FGD or not.
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
int nECALSegments
How many ECAL tracks are associated with this track.
int GetAllTracksUsingTPC(const AnaEventB &event, AnaTrackB *selTracks[])
AnaSMRDParticleB * SMRDSegments[NMAXSMRDS]
The SMRD segments that contributed to this global track.
static bool IsP0DDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRDP0D or not.
Int_t NNodes
The number of nodes in the reconstructed object.
SubDetId::SubDetEnum GetClosestTPC(const AnaTrackB &track)
For tracks that start in the FGD, get the closest TPC in the direction of the track.
Representation of an ECAL segment of a global track.
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
int GetAllChargedTrajInFGDAndNoTPCInBunch(const AnaEventB &event, AnaTrueParticleB *chargedtrajInBunch[], SubDetId::SubDetEnum det)
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
massComponentEnum GetMassComponent(bool IsMC, const Float_t *pos)
Get the detector component in which the position is.
Float_t Momentum
The initial momentum of the true particle.
SubDetId::SubDetEnum GetDetector(const Float_t *pos)
Return the detector in which the position is.
int GetAllTracksUsingFGD(const AnaEventB &event, AnaTrackB *selTracks[])
AnaParticleB * GetSegmentInDet(const AnaTrackB &track, SubDetId::SubDetEnum det)
float GetSeparationSquared(const Float_t *pos1, const Float_t *pos2)
Calculate the distance between two points.
int GetAllChargedTrajInTPCFGDInBunch(const AnaEventB &event, AnaTrueParticleB *chargedtrajInBunch[])
int GetAllChargedTrajInTPCInBunch(const AnaEventB &event, AnaTrueParticleB *traj[])
static bool CompareNHits(const AnaParticleB *t1, const AnaParticleB *t2)
Compare the NHits of two particles. Return whether t1 is higher NHts than t2.
int GetAllTracksUsingFGDorTPC(const AnaBunchB &bunch, AnaTrackB *selTracks[])
Int_t GetFgdModuleType(bool IsMC, const Float_t *pos, SubDetId::SubDetEnum det, bool includeGlueSkin=true)
AnaECALParticleB * GetMostUpstreamECalSegment(AnaTrackB *track)
int nSMRDSegments
How many SMRD tracks are associated with this track.
int GetAllTracksUsingP0D(const AnaEventB &event, AnaTrackB *selTracks[])
int nTPCSegments
How many TPC tracks are associated with this track.
Representation of a true Monte Carlo trajectory/particle.
Representation of an SMRD segment of a global track.
int GetNTracksUsingTPCAndDet(const AnaEventB &event, SubDetId::SubDetEnum det)
Returns the number of tracks using both the TPC and the subdetector 'det'.
int GetSegmentsInDet(const AnaTrackB &track, SubDetId::SubDetEnum det, AnaParticleB *selTracks[])
Float_t EntrancePosition[4]
for each subdetector tell the entrance position
static bool IsTPCDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a TPC or not.
AnaDetCrossingB ** DetCrossings
static bool IsECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a ECAL or not.
SubDetEnum
Enumeration of all detector systems and subdetectors.
int GetAllTracksUsingFGDAndNoTPC(const AnaBunchB &bunch, AnaTrackB *selTracks[])
Representation of a global track.
Int_t Bunch
The index of this bunch (0-7).
int GetAllBigEnoughChargedTrajInTPCInBunch(const AnaEventB &event, AnaTrueParticleB *chargedtrajInBunch[])
static SubDetId::SubDetEnum GetSubdetectorEnum(unsigned long BitField)
Get the single subdetector that this track is from.
Representation of a TPC segment of a global track.
bool InDetVolume(SubDetId::SubDetEnum det, const Float_t *pos)
Representation of a FGD segment of a global track.
int nFGDSegments
How many FGD tracks are associated with this track.
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
int GetAllTracksUsingSMRD(const AnaEventB &event, AnaTrackB *selTracks[])
AnaTPCParticleB * GetTPCBackSegment(const AnaTrackB *track)
Get the most dowstream TPC segment of the track.
bool TrackUsesDets(const AnaTrackB &track, SubDetId::SubDetEnum dets[], int nDets)
static int GetTPC(unsigned long BitField)
AnaParticleB * GetSegmentWithMostNodesInClosestTpc(const AnaTrackB &track)
Combined function to address NuMu selection needs as efficiently as possible - gets the TPC segment w...
Representation of a P0D segment of a global track.
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
Float_t Charge
The true charge of the particle.
int GetAllChargedTrajInFGDInBunch(const AnaEventB &event, AnaTrueParticleB *traj[], SubDetId::SubDetEnum det)
This namespace contains useful functions for analyses related to kinematics.
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)
AnaParticleB * GetSegmentWithMostNodesInDet(const AnaTrackB &track, SubDetId::SubDetEnum det)
Method to get the subtrack with most nodes in a given detector.
Representation of a reconstructed particle (track or shower).
AnaFGDParticleB * FGDSegments[NMAXFGDS]
The FGD segments that contributed to this global track.
int GetTrackerDsEcals(AnaTrackB *track, AnaECALParticleB *selTracks[])
static bool IsSMRDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRD or not.
Float_t PositionEnd[4]
The reconstructed end position of the particle.