14 #include "PndSciTPoint.h"
15 #include "PndSciTHit.h"
16 #include "PndEmcBump.h"
17 #include "PndEmcDigi.h"
18 #include "PndEmcStructure.h"
19 #include "PndEmcXtal.h"
20 #include "PndEmcErrorMatrix.h"
21 #include "PndEmcClusterCalibrator.h"
22 #include "PndEmcClusterEnergySums.h"
23 #include "PndMdtPoint.h"
24 #include "PndMdtHit.h"
25 #include "PndMdtTrk.h"
26 #include "PndDrcBarPoint.h"
27 #include "PndDrcHit.h"
28 #include "PndDskParticle.h"
35 #include "TObjArray.h"
37 #include "TGeoMatrix.h"
38 #include "TGeoManager.h"
54 delete fEmcErrorMatrix;
61 fTrackBranch(
"EicIdealGenTrack"),
62 fTrackIDBranch(
"EicIdealGenTrackID"),
63 fTrack(new TClonesArray()),
66 fCorrErrorProp(kTRUE),
68 fMcTrack(new TClonesArray()),
74 , ,, fTrackID(new TClonesArray()), fTrack2(new TClonesArray()), fTrackID2(new TClonesArray()), fPidChargedCand(new TClonesArray()), fPidNeutralCand(new TClonesArray()), fMdtTrack(new TClonesArray()), fMvdHitsStrip(new TClonesArray()), fMvdHitsPixel(new TClonesArray()), fTofHit(new TClonesArray()), fTofPoint(new TClonesArray()), fFtofHit(new TClonesArray()), fFtofPoint(new TClonesArray()), fEmcCluster(new TClonesArray()), fEmcBump(new TClonesArray()), fEmcDigi(new TClonesArray()), fMdtPoint(new TClonesArray()), fMdtHit(new TClonesArray()), fMdtTrk(new TClonesArray()), fDrcPoint(new TClonesArray()), fDrcHit(new TClonesArray()), fDskParticle(new TClonesArray()), fSttHit(new TClonesArray()), fFtsHit(new TClonesArray()),
75 fCorrPar(new PndPidCorrPar()), fEmcGeoPar(new PndEmcGeoPar()), fEmcErrorMatrixPar(new PndEmcErrorMatrixPar()), fEmcErrorMatrix(new PndEmcErrorMatrix()), fSttParameters(new PndGeoSttPar()), fEmcCalibrator(NULL), fEmcClstCount(0), fFscClstCount(0),
110 sFile =
"./pidcorrelator.root";
115 fPidNeutralCand =
new TClonesArray(
"PndPidCandidate");
118 for (Int_t
mm=0;
mm<3;
mm++)
119 for (Int_t ll=0; ll<20;ll++)
121 mdtLayerPos[
mm][ll] = -1;
122 mdtIronThickness[
mm][ll] = -1;
134 fMcTrack(new TClonesArray()), fTrack(new TClonesArray()), fTrackID(new TClonesArray()), fTrack2(new TClonesArray()), fTrackID2(new TClonesArray()), fPidChargedCand(new TClonesArray()), fPidNeutralCand(new TClonesArray()), fMdtTrack(new TClonesArray()), fMvdHitsStrip(new TClonesArray()), fMvdHitsPixel(new TClonesArray()), fTofHit(new TClonesArray()), fTofPoint(new TClonesArray()), fFtofHit(new TClonesArray()), fFtofPoint(new TClonesArray()), fEmcCluster(new TClonesArray()), fEmcBump(new TClonesArray()), fEmcDigi(new TClonesArray()), fMdtPoint(new TClonesArray()), fMdtHit(new TClonesArray()), fMdtTrk(new TClonesArray()), fDrcPoint(new TClonesArray()), fDrcHit(new TClonesArray()), fDskParticle(new TClonesArray()), fSttHit(new TClonesArray()), fFtsHit(new TClonesArray()),
135 fCorrPar(new PndPidCorrPar()), fEmcGeoPar(new PndEmcGeoPar()), fEmcErrorMatrixPar(new PndEmcErrorMatrixPar()), fEmcErrorMatrix(new PndEmcErrorMatrix()), fSttParameters(new PndGeoSttPar()), fEmcCalibrator(NULL), fEmcClstCount(0), fFscClstCount(0),
154 fCorrErrorProp(kTRUE),
176 fPidNeutralCand =
new TClonesArray(
"PndPidCandidate");
178 sFile =
"./pidcorrelator.root";
182 for (Int_t
mm=0;
mm<3;
mm++)
183 for (Int_t ll=0; ll<20;ll++)
185 mdtLayerPos[
mm][ll] = -1;
186 mdtIronThickness[
mm][ll] = -1;
201 cout <<
"-I- PndPidCorrelator::Init: No PndTrack array!" << endl;
209 cout <<
"-I- PndPidCorrelator::Init: No PndTrackID array! Switching MC propagation OFF" << endl;
215 if (fTrackBranch2!=
"")
217 fTrack2 = (TClonesArray *)fManager->
GetObject(fTrackBranch2);
219 cout <<
"-I- PndPidCorrelator::Init: No 2nd PndTrack array!" << endl;
224 if (fTrackIDBranch2!=
"")
226 fTrackID2 = (TClonesArray *)fManager->
GetObject(fTrackIDBranch2);
228 cout <<
"-I- PndPidCorrelator::Init: No 2nd PndTrackID array! Switching MC propagation OFF" << endl;
229 fTrackIDBranch2 =
"";
236 if (fMixMode==kFALSE)
238 fSttHit = (TClonesArray*) fManager->
GetObject(
"STTHit");
241 cout <<
"-I- PndPidCorrelator::Init: Using STTHit" << endl;
246 cout <<
"-W- PndPidCorrelator::Init: No STT hits array! Switching STT OFF" << endl;
252 fSttHit = (TClonesArray*) fManager->
GetObject(
"STTHitMix");
255 cout <<
"-I- PndPidCorrelator::Init: Using STTHitMix" << endl;
260 cout <<
"-W- PndPidCorrelator::Init: No STT hits mix array! Switching STT OFF" << endl;
269 if (fMixMode==kFALSE)
271 fFtsHit = (TClonesArray*) fManager->
GetObject(
"FTSHit");
274 cout <<
"-I- PndPidCorrelator::Init: Using FTSHit" << endl;
279 cout <<
"-W- PndPidCorrelator::Init: No FTS hits array! Switching FTS OFF" << endl;
285 fFtsHit = (TClonesArray*) fManager->
GetObject(
"FTSHitMix");
288 cout <<
"-I- PndPidCorrelator::Init: Using FTSHitMix" << endl;
293 cout <<
"-W- PndPidCorrelator::Init: No FTS hits mix array! Switching FTS OFF" << endl;
302 if (fMixMode==kFALSE)
304 fMvdHitsStrip = (TClonesArray*) fManager->
GetObject(
"MVDHitsStrip");
305 if ( ! fMvdHitsStrip )
307 cout <<
"-W- PndPidCorrelator::Init: No MVDHitsStrip array!" << endl;
311 fMvdHitsPixel = (TClonesArray*) fManager->
GetObject(
"MVDHitsPixel");
312 if ( ! fMvdHitsPixel )
314 cout <<
"-W- PndPidCorrelator::Init: No MVDHitsPixel array!" << endl;
320 fMvdHitsStrip = (TClonesArray*) fManager->
GetObject(
"MVDHitsStripMix");
321 if ( ! fMvdHitsStrip )
323 cout <<
"-W- PndPidCorrelator::Init: No MVDHitsStripMix array!" << endl;
327 fMvdHitsPixel = (TClonesArray*) fManager->
GetObject(
"MVDHitsPixelMix");
328 if ( ! fMvdHitsPixel )
330 cout <<
"-W- PndPidCorrelator::Init: No MVDHitsPixelMix array!" << endl;
335 if (( ! fMvdHitsStrip ) && ( ! fMvdHitsPixel ))
337 cout <<
"-W- PndPidCorrelator::Init: No MVD hits array! Switching MVD OFF" << endl;
342 cout <<
"-I- PndPidCorrelator::Init: Using MVDHit" << endl;
349 fTofHit = (TClonesArray*) fManager->
GetObject(
"SciTHit");
352 cout <<
"-W- PndPidCorrelator::Init: No SciTHit array!" << endl;
357 cout <<
"-I- PndPidCorrelator::Init: Using SciTHit" << endl;
362 fTofPoint = (TClonesArray*) fManager->
GetObject(
"SciTPoint");
365 cout <<
"-W- PndPidCorrelator::Init: No SciTPoint array!" << endl;
374 fFtofHit = (TClonesArray*) fManager->
GetObject(
"FtofHit");
377 cout <<
"-W- PndPidCorrelator::Init: No FtofHit array!" << endl;
382 cout <<
"-I- PndPidCorrelator::Init: Using FtofHit" << endl;
387 fFtofPoint = (TClonesArray*) fManager->
GetObject(
"FtofPoint");
390 cout <<
"-W- PndPidCorrelator::Init: No FtofPoint array!" << endl;
399 fEmcCluster = (TClonesArray*) fManager->
GetObject(
"EmcCluster");
402 cout <<
"-W- PndPidCorrelator::Init: No EmcCluster array!" << endl;
407 cout <<
"-I- PndPidCorrelator::Init: Using EmcCluster" << endl;
411 fEmcBump = (TClonesArray*) fManager->
GetObject(
"EmcBump");
414 cout <<
"-W- PndPidCorrelator::Init: No EmcBump array!" << endl;
418 cout <<
"-I- PndPidCorrelator::Init: Using EmcBump" << endl;
422 fEmcDigi = (TClonesArray*) fManager->
GetObject(
"EmcDigi");
425 cout <<
"-W- PndPidCorrelator::Init: No EmcDigi array! No EMC E1/E9/E25 information is propagated!" << endl;
432 fDrcHit = (TClonesArray*) fManager->
GetObject(
"DrcHit");
435 cout <<
"-W- PndPidCorrelator::Init: No DrcHit array!" << endl;
440 cout <<
"-I- PndPidCorrelator::Init: Using DrcHit" << endl;
448 fDskParticle = (TClonesArray*) fManager->
GetObject(
"DskParticle");
449 if ( ! fDskParticle )
451 cout <<
"-W- PndPidCorrelator::Init: No DskParticle array!" << endl;
456 cout <<
"-I- PndPidCorrelator::Init: Using DskParticle" << endl;
464 fMdtHit = (TClonesArray*) fManager->
GetObject(
"MdtHit");
467 cout <<
"-W- PndPidCorrelator::Init: No MdtHit array!" << endl;
472 cout <<
"-I- PndPidCorrelator::Init: Using MdtHit" << endl;
475 fMdtTrk = (TClonesArray*) fManager->
GetObject(
"MdtTrk");
478 cout <<
"-W- PndPidCorrelator::Init: No MdtTrk array!" << endl;
482 cout <<
"-I- PndPidCorrelator::Init: Using MdtTrk" << endl;
489 cout <<
"-I- PndPidCorrelator::Init: Using MonteCarlo correlation" << endl;
490 fTofPoint = (TClonesArray*) fManager->
GetObject(
"TofPoint");
493 cout <<
"-W- PndPidCorrelator::Init: No TofPoint array!" << endl;
498 cout <<
"-I- PndPidCorrelator::Init: Using TofPoint" << endl;
500 fDrcPoint = (TClonesArray*) fManager->
GetObject(
"DrcBarPoint");
503 cout <<
"-W- PndPidCorrelator::Init: No DrcBarPoint array!" << endl;
508 cout <<
"-I- PndPidCorrelator::Init: Using DrcPoint" << endl;
510 fMdtPoint = (TClonesArray*) fManager->
GetObject(
"MdtPoint");
513 cout <<
"-W- PndPidCorrelator::Init: No MdtPoint array!" << endl;
518 cout <<
"-I- PndPidCorrelator::Init: Using MdtPoint" << endl;
526 fCorrPar->printParams();
531 cout <<
"-I- PndPidCorrelator::Init: Using Geane for Track propagation" << endl;
534 cout <<
"-I- PndPidCorrelator::Init: Switching OFF Geane error propagation" << endl;
540 cout <<
"-I- PndPidCorrelator::Init: No PndMcTrack array! No ideal pid hypothesis is possible!" << endl;
544 cout <<
"-I- PndPidCorrelator::Init: No TrackID Branch name! No ideal pid hypothesis is possible!" << endl;
553 cout <<
"-I- PndPidCorrelator::Init: No PID set -> Using default PION hypothesis" << endl;
558 cout <<
"-I- PndPidCorrelator::Init: Using ELECTRON hypothesis" << endl;
563 cout <<
"-I- PndPidCorrelator::Init: Using MUON hypothesis" << endl;
568 cout <<
"-I- PndPidCorrelator::Init: Using PION hypothesis" << endl;
573 cout <<
"-I- PndPidCorrelator::Init: Using KAON hypothesis" << endl;
578 cout <<
"-I- PndPidCorrelator::Init: Using PROTON hypothesis" << endl;
583 cout <<
"-I- PndPidCorrelator::Init: Not recognised PID set -> Using default PION hypothesis" << endl;
599 cout <<
"-W- PndPidCorrelator::Init: No MDT geometry ???" << endl;
608 fFitter->SetNumIterations(1);
609 if (!fFitter->Init())
return kFATAL;
616 tofCorr =
new TNtuple(
"tofCorr",
"TRACK-TOF Correlation",
617 "track_x:track_y:track_z:track_phi:track_p:track_charge:track_theta:track_z0:tof_x:tof_y:tof_z:tof_phi:chi2:dphi:len:glen");
618 ftofCorr =
new TNtuple(
"ftofCorr",
"TRACK-FTOF Correlation",
619 "track_x:track_y:track_z:ver_x:ver_y:ver_z:ver_px:ver_py:ver_pz:track_p:track_charge:track_theta:track_z0:tof_x:tof_y:tof_z:chi2:len:glen:tlen");
620 emcCorr =
new TNtuple(
"emcCorr",
"TRACK-EMC Correlation",
621 "track_x:track_y:track_z:track_phi:track_p:track_charge:track_theta:track_z0:emc_x:emc_y:emc_z:emc_phi:chi2:dphi:emc_ene:glen:emc_mod");
622 fscCorr =
new TNtuple(
"fscCorr",
"TRACK-FSC Correlation",
623 "track_x:track_y:track_z:track_phi:track_p:track_charge:track_theta:track_z0:emc_x:emc_y:emc_z:emc_phi:chi2:dphi:emc_ene:glen:emc_mod");
624 mdtCorr =
new TNtuple(
"mdtCorr",
"TRACK-MDT Correlation",
625 "track_x:track_y:track_z:track_dx:track_dy:track_dz:track_phi:track_p:track_charge:track_theta:track_z0:mdt_x:mdt_y:mdt_z:mdt_phi:mdt_p:chi2:mdt_mod:dphi:glen:mdt_count:nhits");
626 drcCorr =
new TNtuple(
"drcCorr",
"TRACK-DRC Correlation",
627 "track_x:track_y:track_z:track_phi:track_p:track_charge:track_theta:track_z0:drc_x:drc_y:drc_phi:chi2:drc_thetac:drc_nphot:dphi:glen:flag");
628 dskCorr =
new TNtuple(
"dskCorr",
"TRACK-DSK Correlation",
629 "track_x:track_y:track_z:track_phi:track_p:track_charge:track_theta:track_z0:dsk_x:dsk_y:dsk_z:dsk_phi:chi2:dsk_thetac:dsk_nphot:dphi:glen:track_lx:track_ly:track_lz:track_xp:flag");
630 cout <<
"-I- PndPidCorrelator::Init: Filling Debug histograms" << endl;
637 if (fEmcErrorMatrixPar->IsValid())
639 fEmcErrorMatrix->Init(fEmcErrorMatrixPar->GetParObject());
643 Int_t emcGeomVersion=fEmcGeoPar->GetGeometryVersion();
644 fEmcErrorMatrix->InitFromFile(emcGeomVersion);
645 fEmcErrorMatrixPar->SetErrorMatrixObject(fEmcErrorMatrix->GetParObject());
648 fEmcCalibrator= PndEmcClusterCalibrator::MakeEmcClusterCalibrator(2, 1);
651 if (fFast) cout <<
"-W- PndPidCorrelator::Init: Using fast correlator!!" << endl;
654 cout <<
"-I- PndPidCorrelator::Init: Success!" << endl;
665 if ( ! run ) Fatal(
"PndPidCorrelator:: SetParContainers",
"No analysis run");
668 if ( ! db ) Fatal(
"PndPidCorrelator:: SetParContainers",
"No runtime database");
671 fCorrPar = (PndPidCorrPar*) db->
getContainer(
"PndPidCorrPar");
674 fEmcGeoPar = (PndEmcGeoPar*) db->
getContainer(
"PndEmcGeoPar");
677 fEmcErrorMatrixPar = (PndEmcErrorMatrixPar*) db->
getContainer(
"PndEmcErrorMatrixPar");
680 fSttParameters = (PndGeoSttPar*) db->
getContainer(
"PndGeoSttPar");
681 fFtsParameters = (PndGeoFtsPar*) db->
getContainer(
"PndGeoFtsPar");
689 cout <<
" ===== PndPidCorrelator - Event: " <<
fEventCounter;
693 nTracksTot +=
fTrack->GetEntriesFast();
698 nTracksTot += fTrack2->GetEntriesFast();
702 cout <<
" - Number of tracks for pid " << nTracksTot;
706 PndEmcCluster *tmp_cluster;
707 for(Int_t i=0; i < fEmcCluster->GetEntriesFast();i++)
709 tmp_cluster = (PndEmcCluster*)fEmcCluster->At(i);
710 if(tmp_cluster->GetModule() < 5 && tmp_cluster->GetModule() >0)
714 if(tmp_cluster->GetModule() == 5)
720 cout <<
" - Number of Clusters for pid: ";
721 cout <<
" EMC: " << fEmcClstCount;
722 cout <<
" FSC: " << fFscClstCount;
729 if ((fEmcMode>0) && (!fFast)) ConstructNeutralCandidate();
741 if (fMdtRefit) fMdtTrack->Delete();
742 if (fMdtMode>0) MdtMapping();
745 Int_t nTracks =
fTrack->GetEntriesFast();
746 for (Int_t i = 0; i < nTracks; i++) {
772 cout <<
"-I- PndPidCorrelator::ConstructChargedCandidate: PndMCTrack does not exist!! (why?) -> let's try with pion hyp " << endl;
781 std::cout <<
"-I- PndPidCorrelator::ConstructChargedCandidate: Track is an ion (PDGCode>100000000) -> let's try with pion hyp" << std::endl;
797 if ( (fMvdMode==2) && ((fMvdHitsStrip->GetEntriesFast()+fMvdHitsPixel->GetEntriesFast())>0) ) GetMvdInfo(track, pidCand);
798 if ( (fSttMode == 2) && (fSttHit ->GetEntriesFast()>0) ) GetSttInfo(track, pidCand);
799 GetGemInfo(track, pidCand);
802 if ( (fTofMode==2) && (fTofHit ->GetEntriesFast()>0) ) GetTofInfo(helix, pidCand);
803 if ( (fEmcMode>0) && (fEmcClstCount>0) ) GetEmcInfo(helix, pidCand);
804 if ( (fMdtMode>0) && (fMdtHit ->GetEntriesFast()>0) ) GetMdtInfo(track, pidCand);
805 if ( (fDrcMode>0) && (fDrcHit ->GetEntriesFast()>0) ) GetDrcInfo(helix, pidCand);
806 if ( (fDskMode>0) && (fDskParticle->GetEntriesFast()>0)) GetDskInfo(helix, pidCand);
816 if (fTrackBranch2!=
"")
818 Int_t nTracks2 = fTrack2->GetEntriesFast();
819 for (Int_t i = 0; i < nTracks2; i++) {
827 if (fTrackIDBranch2!=
"")
839 cout <<
"-I- PndPidCorrelator::ConstructChargedCandidate: PndMCTrack does not exist!! (why?) -> let's try with pion hyp " << endl;
848 std::cout <<
"-I- PndPidCorrelator::ConstructChargedCandidate: Track is an ion (PDGCode>100000000) -> let's try with pion hyp" << std::endl;
863 if ( (fMvdMode==2) && ((fMvdHitsStrip->GetEntriesFast()+fMvdHitsPixel->GetEntriesFast())>0) ) GetMvdInfo(track, pidCand);
864 if ( (fFtsMode == 2) && (fFtsHit ->GetEntriesFast()>0) ) GetFtsInfo(track, pidCand);
865 GetGemInfo(track, pidCand);
868 if ( (fFtofMode==2) && (fFtofHit->GetEntriesFast()>0) ) GetFtofInfo(helix, pidCand);
869 if ( (fEmcMode>0) && (fFscClstCount>0) ) GetFscInfo(helix, pidCand);
871 if (mapMdtForward.size()>0) GetFMdtInfo(&par, pidCand);
881 void PndPidCorrelator::ConstructNeutralCandidate() {
883 fPidNeutralCand->Delete();
889 nBumps = fEmcCluster->GetEntriesFast();
890 emcType =
"EmcCluster";
892 else if(fEmcMode == 3)
894 nBumps = fEmcBump->GetEntriesFast();
898 for (Int_t i = 0; i < nBumps; i++)
902 Float_t quality = -1.;
905 if (fClusterList[i])
continue;
906 bump = (PndEmcBump*) fEmcCluster->At(i);
907 clu = (PndEmcBump*) fEmcCluster->At(i);
908 quality = fClusterQ[i];
910 else if(fEmcMode == 3)
912 bump = (PndEmcBump*) fEmcBump->At(i);
913 if (fClusterList[bump->GetClusterIndex()])
continue;
914 clu = (PndEmcCluster*)fEmcCluster->At(bump->GetClusterIndex());
915 quality = fClusterQ[bump->GetClusterIndex()];
919 TVector3
v1=bump->where();
921 p3.SetMagThetaPhi(fEmcCalibrator->Energy(bump), v1.Theta(), v1.Phi());
922 TLorentzVector lv(p3,p3.Mag());
923 TMatrixD covP4=fEmcErrorMatrix->Get4MomentumErrorMatrix(*clu);
927 pidCand->SetEmcRawEnergy(bump->energy());
928 pidCand->SetEmcCalEnergy(fEmcCalibrator->Energy(bump));
929 pidCand->SetEmcIndex(i);
930 pidCand->SetEmcModule(bump->GetModule());
931 pidCand->SetEmcNumberOfCrystals(bump->NumberOfDigis());
932 pidCand->SetEmcNumberOfBumps(clu->NBumps());
933 pidCand->SetEmcQuality(quality);
935 pidCand->SetEmcClusterZ20(bump->Z20());
936 pidCand->SetEmcClusterZ53(bump->Z53());
937 pidCand->SetEmcClusterLat(bump->LatMom());
940 PndEmcClusterEnergySums esum(*clu, fEmcDigi);
941 pidCand->SetEmcClusterE1(esum.E1());
942 pidCand->SetEmcClusterE9(esum.E9());
943 pidCand->SetEmcClusterE25(esum.E25());
947 std::vector<Int_t> mclist = clu->GetMcList();
952 AddNeutralCandidate(pidCand);
961 if ((helix->
GetMomentum().Theta()*TMath::RadToDeg())<20.)
return kFALSE;
962 if ((helix->
GetMomentum().Theta()*TMath::RadToDeg())>150.)
return kFALSE;
969 PndSciTHit *tofHit = NULL;
970 Int_t tofEntries = fTofHit->GetEntriesFast();
972 Float_t tofTof = 0., tofLength = -1000, tofGLength = -1000, tofLengthTemp = -1000;
973 Float_t tofQuality = 1000000;
976 TVector3 vertex(0., 0., 0.);
977 TVector3 tofPos(0., 0., 0.);
979 for (Int_t tt = 0; tt<tofEntries; tt++)
981 tofHit = (PndSciTHit*)fTofHit->At(tt);
982 if ( fIdeal && ( ((PndSciTPoint*)fTofPoint->At(tofHit->GetRefIndex()))->GetTrackID() !=pidCand->
GetMcIndex()) )
continue;
983 tofHit->Position(tofPos);
994 vertex.SetXYZ(fRes->
GetX(), fRes->
GetY(), fRes->
GetZ());
996 fProVertex->
SetPoint(TVector3(0,0,0));
1003 Float_t dist = (tofPos-vertex).Mag2();
1005 if ( tofQuality > dist)
1009 tofTof = tofHit->GetTime();
1010 tofLength = tofLengthTemp;
1014 Float_t ntuple[] = {vertex.X(), vertex.Y(), vertex.Z(), vertex.Phi(),
1016 tofPos.X(), tofPos.Y(), tofPos.Z(), tofPos.Phi(),
1017 dist, vertex.DeltaPhi(tofPos), tofLength, tofGLength};
1018 tofCorr->Fill(ntuple);
1022 if ( (tofQuality<fCorrPar->GetTofCut()) || (fIdeal && tofIndex!=-1) )
1024 pidCand->SetTofQuality(tofQuality);
1025 pidCand->SetTofStopTime(tofTof);
1026 pidCand->SetTofTrackLength(tofLength);
1027 pidCand->SetTofIndex(tofIndex);
1031 Float_t mass2 = helix->
GetMomentum().Mag()*helix->
GetMomentum().Mag()*(30.*30.*tofTof*tofTof/tofLength/tofLength-1.);
1032 pidCand->SetTofM2(mass2);
1039 void PndPidCorrelator::ResetEmcQ()
1043 fClusterList.clear();
1044 for (Int_t ii=0; ii<fEmcCluster->GetEntriesFast(); ii++)
1047 fClusterList[ii] = kFALSE;
1054 std::cerr <<
"<Error> PndPidCorrelator EMCINFO: FairTrackParH NULL pointer parameter."
1059 std::cerr <<
"<Error> PndPidCorrelator EMCINFO: pidCand NULL pointer parameter."
1066 Float_t trackTheta = helix->
GetMomentum().Theta()*TMath::RadToDeg();
1068 Int_t emcEntries = fEmcCluster->GetEntriesFast();
1069 Int_t emcIndex = -1, emcModuleCorr = -1, emcNCrystals = -1, emcNBumps = -1;
1070 Float_t emcEloss = 0., emcElossCorr = 0., emcGLength = -1000;
1071 Float_t emcQuality = 1000000;
1073 TVector3 vertex(0., 0., 0.); TVector3 emcPos(0., 0., 0.);
1076 Double_t Z20 = 0.0, Z53 = 0.0, secLatM = 0.00, E1 = 0., E9 = 0., E25 = 0.;
1078 for (Int_t ee = 0; ee<emcEntries; ee++)
1080 PndEmcCluster *emcHit = (PndEmcCluster*)fEmcCluster->At(ee);
1084 std::vector<Int_t> mclist = emcHit->GetMcList();
1085 if (mclist.size()==0)
continue;
1086 if (mclist[0]!=pidCand->
GetMcIndex())
continue;
1089 if (emcHit->energy() < fCorrPar->GetEmc12Thr())
continue;
1090 Int_t emcModule = emcHit->GetModule();
1091 if (emcModule>4)
continue;
1093 emcPos = emcHit->where();
1098 vertex.SetXYZ(-10000, -10000, -10000);
1104 vertex.SetXYZ(fRes->
GetX(), fRes->
GetY(), fRes->
GetZ());
1111 Float_t dist = (emcPos-vertex).Mag2();
1112 if ( emcQuality > dist )
1116 emcEloss = emcHit->energy();
1117 emcElossCorr = fEmcCalibrator->Energy(emcHit);
1118 emcModuleCorr = emcModule;
1119 emcNCrystals = emcHit->NumberOfDigis();
1120 emcNBumps = emcHit->NBumps();
1121 Z20 = emcHit->Z20();
1122 Z53 = emcHit->Z53();
1123 secLatM = emcHit->LatMom();
1126 PndEmcClusterEnergySums esum(*emcHit, fEmcDigi);
1133 if ( (fClusterQ[ee]<0) || (dist < fClusterQ[ee]))
1136 fClusterQ[ee] = dist;
1140 Float_t ntuple[] = {vertex.X(), vertex.Y(), vertex.Z(), vertex.Phi(),
1142 emcPos.X(), emcPos.Y(), emcPos.Z(), emcPos.Phi(),
1143 dist, vertex.DeltaPhi(emcPos), emcHit->energy(), emcGLength, emcModule};
1144 emcCorr->Fill(ntuple);
1148 if ( (emcQuality < fCorrPar->GetEmc12Cut()) || ( fIdeal && emcIndex!=-1) ){
1149 fClusterList[emcIndex] = kTRUE;
1150 pidCand->SetEmcQuality(emcQuality);
1151 pidCand->SetEmcRawEnergy(emcEloss);
1152 pidCand->SetEmcCalEnergy(emcElossCorr);
1153 pidCand->SetEmcIndex(emcIndex);
1154 pidCand->SetEmcModule(emcModuleCorr);
1155 pidCand->SetEmcNumberOfCrystals(emcNCrystals);
1156 pidCand->SetEmcNumberOfBumps(emcNBumps);
1158 pidCand->SetEmcClusterZ20(Z20);
1159 pidCand->SetEmcClusterZ53(Z53);
1160 pidCand->SetEmcClusterLat(secLatM);
1161 pidCand->SetEmcClusterE1(E1);
1162 pidCand->SetEmcClusterE9(E9);
1163 pidCand->SetEmcClusterE25(E25);
1177 map<Int_t, Int_t>mapMdtTrk;
1183 for (Int_t tt = 0; tt<fMdtTrk->GetEntriesFast(); tt++)
1185 PndMdtTrk *mdtTrk = (PndMdtTrk*)fMdtTrk->At(tt);
1186 mapMdtTrk[mdtTrk->GetHitIndex(0)] = tt;
1189 PndMdtHit *mdtHit = NULL;
1190 Int_t mdtEntries = fMdtHit->GetEntriesFast();
1191 Int_t mdtIndex = -1, mdtMod = 0, mdtLayer = 0, mdtHits = 0;
1192 Float_t mdtGLength = -1000;
1193 Float_t mdtQuality = 1000000;
1194 Float_t mdtIron = 0., mdtMom = 0, mdtTempMom = 0;
1197 TVector3 vertex(0., 0., 0.);
1198 TVector3 vertexD(0., 0., 0.);
1199 TVector3 mdtPos(0., 0., 0.);
1201 for (Int_t
mm = 0;
mm<mdtEntries;
mm++)
1203 mdtHit = (PndMdtHit*)fMdtHit->At(
mm);
1204 if ( fIdeal && ( ((PndMdtPoint*)fMdtPoint->At(mdtHit->GetRefIndex()))->GetTrackID() !=pidCand->
GetMcIndex()) )
continue;
1205 if (mdtHit->GetLayerID()!=0)
continue;
1206 if (mdtHit->GetModule()>2)
continue;
1207 mdtHit->Position(mdtPos);
1213 vertex.SetXYZ(-10000, -10000, -10000);
1214 vertexD.SetXYZ(-10000, -10000, -10000);
1219 vertex.SetXYZ(fRes->
GetX(), fRes->
GetY(), fRes->
GetZ());
1225 if (mdtHit->GetModule()==1)
1227 dist = (mdtPos-vertex).Mag2();
1231 dist = (vertex.X()-mdtPos.X())*(vertex.X()-mdtPos.X())+(vertex.Y()-mdtPos.Y())*(vertex.Y()-mdtPos.Y());
1234 if ( mdtQuality > dist)
1238 mdtMod = mdtHit->GetModule();
1239 mdtMom = mdtTempMom;
1243 PndMdtTrk *mdtTrk = (PndMdtTrk*)fMdtTrk->At(mapMdtTrk[mdtIndex]);
1244 mdtIndex = mapMdtTrk[
mm];
1245 mdtLayer = mdtTrk->GetLayerCount();
1246 mdtIron = mdtTrk->GetIronDist();
1247 mdtMod = mdtTrk->GetModule();
1249 for (Int_t iLayer=0; iLayer<mdtLayer; iLayer++)
1251 mdtHits = mdtHits + mdtTrk->GetHitMult(iLayer);
1258 Float_t ntuple[] = {vertex.X(), vertex.Y(), vertex.Z(),
1259 vertexD.X(), vertexD.Y(), vertexD.Z(), vertex.Phi(),
1261 mdtPos.X(), mdtPos.Y(), mdtPos.Z(), mdtPos.Phi(), mdtTempMom,
1262 dist, mdtHit->GetModule(), vertex.DeltaPhi(mdtPos), mdtGLength, mdtLayer, mdtHits};
1263 mdtCorr->Fill(ntuple);
1267 if ((mdtQuality<fCorrPar->GetMdtCut()) || ( fIdeal && mdtIndex!=-1))
1269 pidCand->SetMuoIndex(mdtIndex);
1270 pidCand->SetMuoQuality(mdtQuality);
1271 pidCand->SetMuoIron(mdtIron);
1272 pidCand->SetMuoMomentumIn(mdtMom);
1273 pidCand->SetMuoModule(mdtMod);
1274 pidCand->SetMuoNumberOfLayers(mdtLayer);
1275 pidCand->SetMuoHits(mdtHits);
1278 if (fMdtRefit && (mdtIndex!=-1) && (mdtMom>0.) )
1280 PndMdtTrk *mdtTrk = (PndMdtTrk*)fMdtTrk->At(mdtIndex);
1286 Int_t PDGCode =
fPidHyp*fCharge;
1289 fitTrack = fFitter->Fit(mdtTrack, PDGCode);
1292 AddMdtTrack(pndTrack);
1299 if (helix->
GetZ()>120.)
return kFALSE;
1303 PndDrcHit *drcHit = NULL;
1304 Int_t drcEntries = fDrcHit->GetEntriesFast();
1305 Int_t drcIndex = -1, drcPhot = 0;
1306 Float_t drcThetaC = -1000, drcThetaCErr = 0, drcGLength = -1000;
1307 Float_t drcQuality = 1000000;
1309 TVector3 vertex(0., 0., 0.);
1310 Float_t vertex_z = -1000;
1311 TVector3 drcPos(0., 0., 0.);
1317 vertex.SetXYZ(-10000, -10000, -10000);
1320 if (!rc)
return kFALSE;
1321 vertex.SetXYZ(fRes->
GetX(), fRes->
GetY(), 0.);
1322 vertex_z = fRes->
GetZ();
1324 if (drcGLength<25.)
return kFALSE;
1327 for (Int_t dd = 0; dd<drcEntries; dd++)
1329 drcHit = (PndDrcHit*)fDrcHit->At(dd);
1330 if ( fIdeal && ( ((PndDrcBarPoint*)fDrcPoint->At(drcHit->GetRefIndex()))->GetTrackID() !=pidCand->
GetMcIndex()) )
continue;
1331 drcHit->Position(drcPos);
1333 Float_t dphi = vertex.DeltaPhi(drcPos);
1334 Float_t dist = dphi * dphi;
1335 if (drcQuality > dist)
1339 drcThetaC = drcHit->GetThetaC();
1340 drcThetaCErr = drcHit->GetErrThetaC();
1345 Float_t ntuple[] = {vertex.X(), vertex.Y(), vertex_z, vertex.Phi(),
1347 drcPos.X(), drcPos.Y(), drcPos.Phi(), dist, drcHit->GetThetaC(), 0., vertex.DeltaPhi(drcPos), drcGLength,
1350 drcCorr->Fill(ntuple);
1354 if ((drcQuality<fCorrPar->GetDrcCut()) || (fIdeal && drcIndex!=-1))
1356 pidCand->SetDrcQuality(drcQuality);
1357 pidCand->SetDrcThetaC(drcThetaC);
1358 pidCand->SetDrcThetaCErr(drcThetaCErr);
1359 pidCand->SetDrcNumberOfPhotons(drcPhot);
1360 pidCand->SetDrcIndex(drcIndex);
1367 if (helix->
GetZ()<180.)
return kFALSE;
1372 PndDskParticle *dskParticle = NULL;
1373 Int_t dskEntries = fDskParticle->GetEntriesFast();
1374 Int_t dskIndex = -1, dskPhot = 0;
1375 Float_t dskThetaC = -1000, dskThetaCErr = 0, dskGLength = -1000;
1376 Float_t dskQuality = 1000000;
1377 Float_t x_p = -1000;
1379 TVector3 vertex(0., 0., 0.);
1380 TVector3 dskPos(0., 0., 0.);
1386 vertex.SetXYZ(-10000, -10000, -10000);
1389 if (!rc)
return kFALSE;
1390 vertex.SetXYZ(fRes->
GetX(), fRes->
GetY(), fRes->
GetZ());
1395 for (Int_t dd = 0; dd<dskEntries; dd++)
1397 dskParticle = (PndDskParticle*)fDskParticle->At(dd);
1398 if ( fIdeal && (dskParticle->GetTrackID() !=pidCand->
GetMcIndex()) )
continue;
1399 dskParticle->Position(dskPos);
1401 Float_t dist = (vertex-dskPos).Mag2();
1402 if ( dskQuality > dist)
1406 dskThetaC = dskParticle->GetThetaC();
1412 Float_t ntuple[] = {vertex.X(), vertex.Y(), vertex.Z(), vertex.Phi(),
1414 dskPos.X(), dskPos.Y(), dskPos.Z(), dskPos.Phi(), dist, dskParticle->GetThetaC(), 0., vertex.DeltaPhi(dskPos), dskGLength,
1417 dskCorr->Fill(ntuple);
1421 if ((dskQuality<fCorrPar->GetDskCut()) || (fIdeal && dskIndex!=-1))
1423 pidCand->SetDiscQuality(dskQuality);
1424 pidCand->SetDiscThetaC(dskThetaC);
1426 pidCand->SetDiscNumberOfPhotons(dskPhot);
1427 pidCand->SetDiscIndex(dskIndex);
1441 Register(
"PidNeutralCand",
"Pid", fPidNeutralCand, kTRUE);
1445 Register(
"MdtTrack",
"Pid", fMdtTrack, kTRUE);
1498 fClusterList.clear();
1500 mapMdtBarrel.clear();
1501 mapMdtEndcap.clear();
1502 mapMdtForward.clear();
1510 Int_t size = pidRef.GetEntriesFast();
1519 TClonesArray& pidRef = *fPidNeutralCand;
1520 Int_t size = pidRef.GetEntriesFast();
1528 TClonesArray& pidRef = *fMdtTrack;
1529 Int_t size = pidRef.GetEntriesFast();
1530 return new(pidRef[size])
PndTrack(*track);