Go to the documentation of this file. 1 #ifndef PAIRANALYSISVARMANAGER_H
2 #define PAIRANALYSISVARMANAGER_H
15 #include <TDatabasePDG.h>
21 #include <TMatrixFSym.h>
33 #include <CbmTofHit.h>
36 #include <FairRootManager.h>
38 #include <FairMCPoint.h>
39 #include <FairTrackParam.h>
51 #include <FairMCEventHeader.h>
355 static void Fill(
const TObject* particle, Double_t*
const values);
358 Double_t*
const values);
359 static void FillSum(
const TObject* particle, Double_t*
const values);
426 Double_t*
const values);
429 Double_t*
const values);
431 Double_t*
const values);
434 Double_t*
const values);
438 Double_t*
const values);
440 Double_t*
const values);
444 Double_t*
const values);
450 Double_t*
const values);
451 static void FillVarMCPoint(
const FairMCPoint* hit, Double_t*
const values);
454 Double_t*
const values);
475 Double_t*
const values) {
483 if (object->IsA() == PairAnalysisEvent::Class())
486 else if (object->IsA() == CbmVertex::Class())
488 else if (object->IsA() == PairAnalysisTrack::Class())
491 else if (object->IsA() == CbmGlobalTrack::Class())
493 else if (object->IsA() == CbmStsTrack::Class())
495 else if (object->IsA() == CbmMuchTrack::Class())
497 else if (object->IsA() == CbmTrdTrack::Class())
499 else if (object->IsA() == CbmRichRing::Class())
501 else if (object->IsA() == CbmMCTrack::Class())
503 else if (object->InheritsFrom(PairAnalysisPair::Class()))
506 else if (object->IsA() == CbmMvdHit::Class())
508 else if (object->IsA() == CbmStsHit::Class())
510 else if (object->IsA() == CbmMuchPixelHit::Class())
512 else if (object->IsA() == CbmTrdHit::Class())
514 else if (object->IsA() == CbmRichHit::Class())
516 else if (object->IsA() == CbmTofHit::Class())
518 else if (object->InheritsFrom(FairMCPoint::Class()))
521 printf(
"PairAnalysisVarManager::Fill: Type %s is not supported by "
522 "PairAnalysisVarManager! \n",
523 object->ClassName());
528 Double_t*
const values) {
536 else if (object->InheritsFrom(FairMCPoint::Class()))
539 printf(
"PairAnalysisVarManager::FillSum: Type %s is not supported by "
540 "PairAnalysisVarManager! \n",
541 object->ClassName());
545 Double_t*
const values) {
559 values[
kBeta] = -999.;
570 Double_t*
const values) {
593 Double_t*
const values) {
606 values[
kNTrk] =
event->GetNumberOfTracks();
611 const Double_t proMass = TDatabasePDG::Instance()->GetParticle(2212)->Mass();
613 TMath::Sqrt(values[
kEbeam] * values[
kEbeam] - proMass * proMass)
614 / (values[
kEbeam] + proMass);
615 values[
kYbeam] = TMath::ATanH(beta);
617 values[
kNTrkMC] =
event->GetNumberOfMCTracks();
630 Double_t*
const values) {
650 values[
kNPrimMC] = header->GetNPrim();
664 Double_t*
const values) {
687 Double_t*
const values) {
706 values[
kP] = track->
P();
714 FairTrackParam* param = NULL;
716 values[
kRichhasProj] = (TMath::Abs(param->GetX() + param->GetY()) > 0.);
721 Double_t innerLimit = 0.5;
722 Double_t outerLimit = 2.5;
723 values[
kMvdhasEntr] = ((TMath::Abs(param->GetX()) > innerLimit
724 && TMath::Abs(param->GetX()) < outerLimit
725 && TMath::Abs(param->GetY()) < outerLimit)
726 || (TMath::Abs(param->GetY()) > innerLimit
727 && TMath::Abs(param->GetY()) < outerLimit
728 && TMath::Abs(param->GetX()) < outerLimit));
740 Int_t trueHits = 0, distHits = 0, fakeHits = 0;
752 Int_t trueHits = 0, distHits = 0, fakeHits = 0;
782 values[
kPx] = track->
Px();
783 values[
kPy] = track->
Py();
784 values[
kPz] = track->
Pz();
785 values[
kPt] = track->
Pt();
786 values[
kPtSq] = track->
Pt() * track->
Pt();
787 values[
kP] = track->
P();
789 values[
kXv] = track->
Xv();
790 values[
kYv] = track->
Yv();
791 values[
kZv] = track->
Zv();
795 (TMath::IsNaN(track->
Phi()) ? -999. : TVector2::Phi_0_2pi(track->
Phi()));
798 values[
kY] = track->
Y() - values[
kYbeam];
799 values[
kYlab] = track->
Y();
800 values[
kE] = track->
E();
801 values[
kM] = track->
M();
807 TMath::Sqrt(TMath::Power(TMath::Abs(values[
kXv] - values[
kXvPrim]), 2)
808 + TMath::Power(TMath::Abs(values[
kYv] - values[
kYvPrim]), 2));
822 Double_t*
const values) {
837 values[
kPin] = mom.Mag();
838 values[
kPtin] = mom.Pt();
840 values[
kPout] = mom.Mag();
841 values[
kPtout] = mom.Pt();
846 Double_t*
const values) {
875 Double_t*
const values) {
887 for (Int_t ihit = 0; ihit < track->
GetNofHits(); ihit++) {
940 Double_t*
const values) {
949 Double_t minSts = 9999.;
952 for (Int_t ihit = 0; ihit < track->
GetNofStsHits(); ihit++) {
955 if (hit && minSts > hit->
GetZ()) {
956 minSts = hit->
GetZ();
961 Double_t minMvd = 9999.;
964 for (Int_t ihit = 0; ihit < track->
GetNofMvdHits(); ihit++) {
967 if (hit && minMvd > hit->
GetZ()) { minMvd = hit->
GetZ(); }
998 Double_t*
const values) {
1008 for (Int_t ihit = 0; ihit < track->
GetNofHits(); ihit++) {
1024 Double_t*
const values) {
1033 if (!p1 || !p2)
return;
1037 if (!mc->
HasMC())
return;
1056 values[
kPMC] = pair->
P();
1065 (TMath::IsNaN(pair->
Phi()) ? -999. : TVector2::Phi_0_2pi(pair->
Phi()));
1070 values[
kEMC] = pair->
E();
1071 values[
kMMC] = pair->
M();
1084 Double_t*
const values) {
1093 if (!particle)
return;
1097 if (!mc->
HasMC())
return;
1132 (particle->
GetPt() > 1.0e-3 ? 1. / particle->
GetPt() : 0.0);
1134 (TMath::IsNaN(mom.Phi()) ? -999. : TVector2::Phi_0_2pi(mom.Phi()));
1140 Double_t pom = particle->
GetP() / particle->
GetMass();
1141 Double_t beta = pom / TMath::Sqrt(pom * pom + 1.);
1143 values[
kBetaGammaMC] = 1. / TMath::Sqrt(1. - beta * beta);
1145 values[
kMMC] = mom.M();
1159 Double_t*
const values) {
1183 values[
kPx] = pair->
Px();
1184 values[
kPy] = pair->
Py();
1185 values[
kPz] = pair->
Pz();
1186 values[
kPt] = pair->
Pt();
1187 values[
kPtSq] = pair->
Pt() * pair->
Pt();
1188 values[
kP] = pair->
P();
1190 values[
kXv] = pair->
Xv();
1191 values[
kYv] = pair->
Yv();
1192 values[
kZv] = pair->
Zv();
1196 (TMath::IsNaN(pair->
Phi()) ? -999. : TVector2::Phi_0_2pi(pair->
Phi()));
1199 values[
kY] = pair->
Y() - values[
kYbeam];
1200 values[
kYlab] = pair->
Y();
1201 values[
kE] = pair->
E();
1202 values[
kM] = pair->
M();
1212 Double_t thetaHE = 0;
1214 Double_t thetaCS = 0;
1222 values[
kCos2PhiHE] = TMath::Cos(2.0 * phiHE);
1224 ? (TMath::Cos(phiHE -
TMath::Pi() / 4.))
1225 : (TMath::Cos(phiHE - 3 *
TMath::Pi() / 4.));
1229 values[
kCos2PhiCS] = TMath::Cos(2.0 * phiCS);
1231 ? (TMath::Cos(phiCS -
TMath::Pi() / 4.))
1232 : (TMath::Cos(phiCS - 3 *
TMath::Pi() / 4.));
1237 values[
kR] = pair->
GetR();
1256 Double_t d0z0[2] = {-999., -999.};
1266 Double_t*
const values) {
1284 Double_t*
const values) {
1303 Double_t*
const values) {
1323 Double_t*
const values) {
1342 Double_t*
const values) {
1362 Double_t*
const values) {
1378 if (cluster->GetEntriesFast() > 0) {
1395 Double_t*
const values) {
1416 / TMath::Sqrt(values[
kMEL] * values[
kMEL] + values[
kP] * values[
kP]));
1420 / TMath::Sqrt(values[
kMMU] * values[
kMMU] + values[
kP] * values[
kP]));
1424 / TMath::Sqrt(values[
kMPI] * values[
kMPI] + values[
kP] * values[
kP]));
1428 / TMath::Sqrt(values[
kMKA] * values[
kMKA] + values[
kP] * values[
kP]));
1432 / TMath::Sqrt(values[
kMPR] * values[
kMPR] + values[
kP] * values[
kP]));
1435 values[
kP] * values[
kP] * (TMath::Power(1. / values[
kBeta], 2) - 1);
1443 Double_t*
const values) {
1452 if (!cluster)
return;
1463 Double_t*
const values) {
1475 values[
kPosXMC] = hit->GetX();
1476 values[
kPosYMC] = hit->GetY();
1477 values[
kPosZMC] = hit->GetZ();
1478 values[
kElossMC] = hit->GetEnergyLoss() * 1.e+6;
1482 Double_t*
const values) {
1493 values[
kPosXMC] += hit->GetX();
1494 values[
kPosYMC] += hit->GetY();
1495 values[
kPosZMC] += hit->GetZ();
1496 values[
kElossMC] += hit->GetEnergyLoss() * 1.e+6;
1506 values[
kMEL] = TDatabasePDG::Instance()->GetParticle(kElectron)->Mass();
1507 values[
kMMU] = TDatabasePDG::Instance()->GetParticle(kMuonMinus)->Mass();
1508 values[
kMPI] = TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass();
1509 values[
kMKA] = TDatabasePDG::Instance()->GetParticle(kKPlus)->Mass();
1510 values[
kMPR] = TDatabasePDG::Instance()->GetParticle(kProton)->Mass();
1511 values[
kMK0] = TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass();
1512 values[
kMLA] = TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass();
1564 if (trkl) nhits =
static_cast<CbmStsTrack*
>(trkl)->GetNofMvdHits();
1567 if (trkl) nhits =
static_cast<CbmStsTrack*
>(trkl)->GetNofStsHits();
1598 *fakeH = (mctrk > -1 ? 0 : nhits);
1599 if (
hits && pnts && mctrk > -1) {
1600 for (Int_t ihit = 0; ihit < nhits; ihit++) {
1606 idx =
static_cast<CbmStsTrack*
>(trkl)->GetMvdHitIndex(ihit);
1609 idx =
static_cast<CbmStsTrack*
>(trkl)->GetStsHitIndex(ihit);
1632 Bool_t btrueH = kTRUE;
1633 Bool_t bfakeH = kTRUE;
1636 for (Int_t iLink = 0; iLink < nlinks; iLink++) {
1638 FairMCPoint* pnt =
static_cast<FairMCPoint*
>(
1644 Int_t lbl = pnt->GetTrackID();
1647 if (lbl != mctrk && lblM != mctrk && lblG != mctrk) {
1655 if (btrueH) (*trueH)++;
1656 if (bfakeH) (*fakeH)++;
1657 if (!btrueH && !bfakeH) (*distH)++;
1678 static UInt_t arr[10] = {0};
1679 arr[0] =
static_cast<UInt_t
>(var0);
1680 arr[1] =
static_cast<UInt_t
>(var1);
1681 arr[2] =
static_cast<UInt_t
>(var2);
1682 arr[3] =
static_cast<UInt_t
>(var3);
1683 arr[4] =
static_cast<UInt_t
>(var4);
1684 arr[5] =
static_cast<UInt_t
>(var5);
1685 arr[6] =
static_cast<UInt_t
>(var6);
1686 arr[7] =
static_cast<UInt_t
>(var7);
1687 arr[8] =
static_cast<UInt_t
>(var8);
1688 arr[9] =
static_cast<UInt_t
>(var9);
static void FillVarTrdHit(const CbmTrdHit *hit, Double_t *const values)
void SetVertex(Double_t x, Double_t y, Double_t z, Double_t chi2, Int_t ndf, Int_t nTracks, const TMatrixFSym &covMat)
Double_t GetPidLikePR() const
void GetDCA(const CbmVertex *primVtx, Double_t d0z0[2]) const
ClassDef(PairAnalysisVarManager, 1)
Int_t GetMotherId() const
const CbmLink & GetMatchedLink() const
static void SetEvent(PairAnalysisEvent *const ev)
CbmVertex * GetPrimaryVertex() const
static void FillVarMuchHit(const CbmMuchPixelHit *hit, Double_t *const values)
Double_t GetWeight() const
Double_t GetChiSq() const
Double_t GetMass() const
Mass of the associated particle.
static void FillVarMuchTrack(const CbmMuchTrack *track, Double_t *const values)
static TFormula * fgFormula[kNMaxValuesMC]
Double_t GetStartX() const
static void FillVarMCPoint(const FairMCPoint *hit, Double_t *const values)
PairAnalysisTrack * GetFirstDaughter() const
virtual Double_t DistanceDaughtersXY() const
const FairTrackParam * GetParamLast() const
Double_t GetWeight() const
PairAnalysisVarManager & operator=(const PairAnalysisVarManager &c)
static void FillVarConstants(Double_t *const values)
static void FillVarPairAnalysisPair(const PairAnalysisPair *pair, Double_t *const values)
const CbmLink & GetLink(Int_t i) const
static void SetFillMap(TBits *map)
Int_t GetNofLinks() const
static UInt_t * GetArray(ValueTypes var0, ValueTypes var1=kNMaxValuesMC, ValueTypes var2=kNMaxValuesMC, ValueTypes var3=kNMaxValuesMC, ValueTypes var4=kNMaxValuesMC, ValueTypes var5=kNMaxValuesMC, ValueTypes var6=kNMaxValuesMC, ValueTypes var7=kNMaxValuesMC, ValueTypes var8=kNMaxValuesMC, ValueTypes var9=kNMaxValuesMC)
virtual Int_t GetNofHits() const
virtual Double_t Zv() const
static void FillVarPairAnalysisEvent(const PairAnalysisEvent *event, Double_t *const values)
virtual Double_t E() const
Double_t GetPidLikeEL() const
Double_t GetELoss() const
CbmRichRing * GetRichRing() const
const FairTrackParam * GetParamLast() const
static Double_t GetValue(ValueTypes val)
static void ResetArrayDataMC(Int_t to, Double_t *const values)
Int_t GetGlobalIndex() const
static PairAnalysisEvent * fgEvent
static void FillVarVertex(const CbmVertex *vertex, Double_t *const values)
static void FillVarTrdCluster(const CbmTrdCluster *cluster, Double_t *const values)
static Int_t fgCurrentRun
virtual void GetThetaPhiCM(Double_t &thetaHE, Double_t &phiHE, Double_t &thetaCS, Double_t &phiCS) const =0
data class for a reconstructed Energy-4D measurement in the TRD
CbmMCTrack * GetMCTrack() const
@ kZvPrim
prim vertex [cm]
static void SetEventData(const Double_t data[PairAnalysisVarManager::kNMaxValuesMC])
static void FillVarRichRing(const CbmRichRing *track, Double_t *const values)
FairTrackParam * GetMvdEntrance() const
@ kMvd
Micro-Vertex Detector.
static void Fill(const TObject *particle, Double_t *const values)
static void FillVarMCParticle(const CbmMCTrack *p1, const CbmMCTrack *p2, Double_t *const values)
static const char * GetValueName(Int_t i)
Double_t GetLength() const
virtual Double_t M() const
static UInt_t GetValueType(const char *valname)
virtual Double_t OpeningAngle() const
static PairAnalysisEvent * GetCurrentEvent()
CbmStsTrack * GetStsTrack() const
CbmTrack * GetTrack(ECbmModuleId det) const
virtual Double_t GetChi2() const
@ kTof
Time-of-flight Detector.
Float_t GetRadialPosition() const
static void ResetArrayData(Int_t to, Double_t *const values)
static const CbmKFVertex * GetKFVertex()
CbmTofHit * GetTofHit() const
virtual Double_t Phi() const
static void FillVarTofHit(const CbmTofHit *hit, Double_t *const values)
static void FillVarGlobalTrack(const CbmGlobalTrack *track, Double_t *const values)
@ kYvPrimMC
MC vertex [cm].
TClonesArray * GetPoints(ECbmModuleId det) const
Int_t GetNofDigis() const
Number of digis in cluster.
Double_t GetCharge() const
Charge of the associated particle.
static void InitFormulas()
Data Container for TRD clusters.
Int_t GetNofMvdHits() const
static void FillSumVarMCPoint(const FairMCPoint *hit, Double_t *const values)
virtual Double_t GetArmPt() const =0
Double_t GetRadialAngle() const
Double_t GetStartZ() const
CbmMatch * GetMatch() const
data class for a reconstructed 3-d hit in the STS
static void FillVarRichHit(const CbmRichHit *hit, Double_t *const values)
virtual Double_t Yv() const
UInt_t GetHit(Int_t i) const
Data class for STS tracks.
Double_t GetELoss() const
static void FillVarTrdTrack(const CbmTrdTrack *track, Double_t *const values)
Double_t GetPidANN() const
virtual Double_t OneOverPt() const
virtual Double_t Py() const
static void SetBeamEnergy(Double_t beamEbyHand=-1.)
PairAnalysisVarManager(const PairAnalysisVarManager &c)
CbmTrackMatchNew * GetTrackMatch(ECbmModuleId det) const
Int_t GetNPoints(ECbmModuleId detId) const
virtual Double_t GetDecayLength() const
static void FillVarPairAnalysisTrack(const PairAnalysisTrack *track, Double_t *const values)
@ kCentrality
number of primary vertex contibutors
@ kStsMatches
MC vertex [cm].
UShort_t GetNRows() const
static Double_t fgData[kNMaxValuesMC]
Double_t GetPidLikeKA() const
CbmTrdTrack * GetTrdTrack() const
static const char * GetValueLabel(Int_t i)
Int_t GetHitIndex(Int_t iHit) const
virtual Double_t DaughtersP() const
static Bool_t Req(ValueTypes var)
@ kXRes
nof degrees of freedom
static void FillVarPixelHit(const CbmPixelHit *hit, Double_t *const values)
@ kRich
Ring-Imaging Cherenkov Detector.
Double_t ChiToVertex() const
virtual Int_t GetNdf() const
Class for hits in TRD detector.
UInt_t GetGeantProcessId() const
Double_t GetPidLikePI() const
void GetStartVertex(TVector3 &vertex) const
static void FillVarMvdHit(const CbmMvdHit *hit, Double_t *const values)
static const char * fgkParticleNames[kNMaxValuesMC][3]
data
HitType GetHitType(Int_t iHit) const
const FairTrackParam * GetParamFirst() const
Double_t GetAaxis() const
static void FillVarMCHeader(const FairMCEventHeader *header, Double_t *const values)
static void SetValue(ValueTypes var, Double_t val)
static void CalculateHitTypes(const PairAnalysisTrack *track, ECbmModuleId idet, Int_t *trueH, Int_t *distH, Int_t *fakeH)
@ kTrd
Transition Radiation Detector.
virtual Int_t GetPmtId() const
UShort_t GetNCols() const
Double_t GetBaxis() const
CbmMuchTrack * GetMuchTrack() const
Double_t GetRapidity() const
static CbmRichElectronIdAnn & GetInstance()
Double_t GetStartY() const
virtual Double_t Pz() const
TClonesArray * GetCluster(ECbmModuleId det) const
static CbmKFVertex * fgKFVertex
TClonesArray * GetHits(ECbmModuleId det) const
CbmMCTrack * GetMCTrackMother(const PairAnalysisTrack *_track)
FairTrackParam * GetRichProj() const
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Double_t GetPidWkn() const
Int_t GetNofHitsOnRing() const
static UInt_t GetValueTypeMC(UInt_t var)
Class for pixel hits in MUCH detector.
double CalculateAnnValue(int globalTrackIndex, double momentum)
Calculate output value of the ANN.
virtual void SetMCTracks(const CbmMCTrack *const particle1, const CbmMCTrack *const particle2)=0
virtual Double_t Px() const
@ kVtxChi
prim vertex [cm]
static vector< vector< QAHit > > hits
@ kZvPrimMC
MC vertex [cm].
Int_t GetMvdHitIndex(Int_t iHit) const
Float_t GetRadius() const
static Double_t * GetData()
CbmMCTrack * GetMCTrackFromMCEvent(Int_t label) const
Float_t GetCenterY() const
@ kMuch
Muon detection system.
static void FillVarStsTrack(const CbmStsTrack *track, Double_t *const values)
virtual Double_t Y() const
Implementation of the electron identification algorithm in the RICH detector using Artificial Neural ...
static PairAnalysisMC * Instance()
virtual Double_t Xv() const
void Get4Momentum(TLorentzVector &momentum) const
Base class for cluster objects.
const FairTrackParam * GetParamFirst() const
virtual Double_t Pt() const
Data Container for TRD clusters.
static void FillVarMCTrack(const CbmMCTrack *particle, Double_t *const values)
Double_t GetPidLikeMU() const
static void FillVarStsHit(const CbmStsHit *hit, Double_t *const values)
Int_t GetStsHitIndex(Int_t iHit) const
virtual Double_t GetArmAlpha() const =0
virtual Double_t DistanceDaughters() const
virtual Double_t Theta() const
Double_t GetEnergy() const
virtual ~PairAnalysisVarManager()
@ kSts
Silicon Tracking System.
@ kYvPrim
prim vertex [cm]
virtual Double_t GetR() const
Float_t GetCenterX() const
static CbmVertex * fgVertexMC
static void FillSum(const TObject *particle, Double_t *const values)
PairAnalysisTrack * GetSecondDaughter() const
Double_t OneOverPt() const
static const char * GetValueUnit(Int_t i)
CbmGlobalTrack * GetGlobalTrack() const
FairMCEventHeader * GetMCHeader() const
Data class for a reconstructed hit in the STS.
virtual Double_t GetCosPointingAngle(const CbmVertex *primVtx) const
Int_t GetNofStsHits() const
virtual Double_t P() const
Int_t GetMothersLabel(Int_t daughterLabel) const
Int_t GetPlaneId() const
Inherited from CbmBaseHit.