116 FairRootManager* fManager = FairRootManager::Instance();
117 fMCTracks = (TClonesArray*) fManager->GetObject(
"MCTrack");
118 if (
nullptr ==
fMCTracks) LOG(fatal) <<
"No MCTrack in input";
120 fStsTracks = (TClonesArray*) fManager->GetObject(
"StsTrack");
121 if (
nullptr ==
fStsTracks) LOG(fatal) <<
"No StsTrack in input";
126 fMuchTracks = (TClonesArray*) fManager->GetObject(
"MuchTrack");
127 if (
nullptr ==
fMuchTracks) LOG(fatal) <<
"No MuchTrack in input";
132 fGlobalTracks = (TClonesArray*) fManager->GetObject(
"GlobalTrack");
133 if (
nullptr ==
fGlobalTracks) LOG(fatal) <<
"No GlobalTrack in input";
135 fTrdTracks = (TClonesArray*) fManager->GetObject(
"TrdTrack");
136 if (
nullptr ==
fTrdTracks) LOG(fatal) <<
"No TrdTrack in input";
138 fTofHit = (TClonesArray*) fManager->GetObject(
"TofHit");
139 if (
nullptr ==
fTofHit) LOG(fatal) <<
"No TofHit in input";
142 fEvtHeader =
dynamic_cast<FairEventHeader*
>(fManager->GetObject(
"EventHeader."));
146 fManager->Register(
"MuPlus",
"Much",
fMuPlus, kTRUE);
147 fManager->Register(
"MuMinus",
"Much",
fMuMinus, kTRUE);
163 fParticles =
new TClonesArray(
"PParticle", 100);
166 TFile* oldFile = gFile;
167 TDirectory* oldDir = gDirectory;
174 for (
int iEvent = 0; iEvent <
fInputTree->GetEntries(); iEvent++) {
179 TLorentzVector mom1 = Part1->
Vect4();
180 TLorentzVector mom2 = Part2->
Vect4();
181 TLorentzVector Mom = mom1 + mom2;
191 TString title1 =
"STS accepted MC signal";
192 TString title2 =
"STS+MUCH accepted MC signal";
193 TString title3 =
"STS+MUCH+TRD accepted MC signal";
194 TString title4 =
"STS+MUCH+TRD+TOF accepted MC signal";
198 YPt_StsAcc->GetYaxis()->SetTitle(
"P_{t} (GeV/c)");
209 acc_P[0][0] =
new TProfile(
"signal_accP_Sts", title1,
PBINNING);
210 acc_P[0][0]->GetXaxis()->SetTitle(
"P (GeV/c)");
211 acc_P[0][0]->GetYaxis()->SetTitle(
"%");
213 acc_P[1][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_accP_StsMuch");
214 acc_P[1][0]->SetTitle(title2);
215 acc_P[2][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_accP_StsMuchTrd");
216 acc_P[2][0]->SetTitle(title3);
217 acc_P[3][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_accP_StsMuchTrdTof");
218 acc_P[3][0]->SetTitle(title4);
221 acc_Theta[0][0]->GetXaxis()->SetTitle(
"#Theta (#circ)");
222 acc_Theta[0][0]->GetYaxis()->SetTitle(
"%");
228 acc_Theta[3][0] = (TProfile*)
acc_Theta[0][0]->Clone(
"signal_accTheta_StsMuchTrdTof");
231 title1 =
"STS accepted MC #mu+";
232 title2 =
"STS+MUCH accepted MC #mu+";
233 title3 =
"STS+MUCH+TRD accepted MC #mu+";
234 title4 =
"STS+MUCH+TRD+TOF accepted MC #mu+";
236 acc_P[0][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_accP_Sts");
237 acc_P[0][1]->SetTitle(title1);
238 acc_P[1][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_accP_StsMuch");
239 acc_P[1][1]->SetTitle(title2);
240 acc_P[2][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_accP_StsMuchTrd");
241 acc_P[2][1]->SetTitle(title3);
242 acc_P[3][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_accP_StsMuchTrdTof");
243 acc_P[3][1]->SetTitle(title4);
254 title1 =
"STS accepted MC #mu-";
255 title2 =
"STS+MUCH accepted MC #mu-";
256 title3 =
"STS+MUCH+TRD accepted MC #mu-";
257 title4 =
"STS+MUCH+TRD+TOF accepted MC #mu-";
259 acc_P[0][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_accP_Sts");
260 acc_P[0][2]->SetTitle(title1);
261 acc_P[1][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_accP_StsMuch");
262 acc_P[1][2]->SetTitle(title2);
263 acc_P[2][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_accP_StsMuchTrd");
264 acc_P[2][2]->SetTitle(title3);
265 acc_P[3][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_accP_StsMuchTrdTof");
266 acc_P[3][2]->SetTitle(title4);
277 TString title0 =
"reconstructed MC signal after primary vertex cut (PVC)";
278 title1 =
"reconstructed MC signal after PVC and STS cuts (StsCs)";
280 "reconstructed MC signal after PVC+StsCs and MUCH cuts (MuchCs)";
281 title3 =
"reconstructed MC signal after PVC+StsCs+MuchCs and TRD cut (TrdC)";
283 "reconstructed MC signal after PVC+StsCs+MuchCs+TrdC and TOF cut";
285 effReco_P[0][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_effRecoP_VtxSts");
287 effReco_P[1][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_effRecoP_VtxStsMuch");
289 effReco_P[2][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_effRecoP_VtxStsMuchTrd");
291 effReco_P[3][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_effRecoP_VtxStsMuchTrdTof");
303 eff4pi_P[0][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_eff4piP_Vtx");
305 eff4pi_P[1][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_eff4piP_VtxSts");
307 eff4pi_P[2][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_eff4piP_VtxStsMuch");
309 eff4pi_P[3][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_eff4piP_VtxStsMuchTrd");
311 eff4pi_P[4][0] = (TProfile*)
acc_P[0][0]->Clone(
"signal_eff4piP_VtxStsMuchTrdTof");
336 title0 =
"reconstructed MC #mu+ after primary vertex cut (PVC)";
337 title1 =
"reconstructed MC #mu+ after PVC and STS cuts (StsCs)";
338 title2 =
"reconstructed MC #mu+ after PVC+StsCs and MUCH cuts (MuchCs)";
339 title3 =
"reconstructed MC #mu+ after PVC+StsCs+MuchCs and TRD cut (TrdC)";
340 title4 =
"reconstructed MC #mu+ after PVC+StsCs+MuchCs+TrdC and TOF cut";
342 effReco_P[0][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_effRecoP_VtxSts");
344 effReco_P[1][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_effRecoP_VtxStsMuch");
346 effReco_P[2][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_effRecoP_VtxStsMuchTrd");
348 effReco_P[3][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_effRecoP_VtxStsMuchTrdTof");
360 eff4pi_P[0][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_eff4piP_Vtx");
362 eff4pi_P[1][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_eff4piP_VtxSts");
364 eff4pi_P[2][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_eff4piP_VtxStsMuch");
366 eff4pi_P[3][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_eff4piP_VtxStsMuchTrd");
368 eff4pi_P[4][1] = (TProfile*)
acc_P[0][0]->Clone(
"muPl_eff4piP_VtxStsMuchTrdTof");
382 title0 =
"reconstructed MC #mu- after primary vertex cut (PVC)";
383 title1 =
"reconstructed MC #mu- after PVC and STS cuts (StsCs)";
384 title2 =
"reconstructed MC #mu- after PVC+StsCs and MUCH cuts (MuchCs)";
385 title3 =
"reconstructed MC #mu- after PVC+StsCs+MuchCs and TRD cut (TrdC)";
386 title4 =
"reconstructed MC #mu- after PVC+StsCs+MuchCs+TrdC and TOF cut";
388 effReco_P[0][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_effRecoP_VtxSts");
390 effReco_P[1][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_effRecoP_VtxStsMuch");
392 effReco_P[2][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_effRecoP_VtxStsMuchTrd");
394 effReco_P[3][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_effRecoP_VtxStsMuchTrdTof");
406 eff4pi_P[0][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_eff4piP_Vtx");
408 eff4pi_P[1][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_eff4piP_VtxSts");
410 eff4pi_P[2][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_eff4piP_VtxStsMuch");
412 eff4pi_P[3][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_eff4piP_VtxStsMuchTrd");
414 eff4pi_P[4][2] = (TProfile*)
acc_P[0][0]->Clone(
"muMn_eff4piP_VtxStsMuchTrdTof");
429 BgSup[0]->GetXaxis()->SetTitle(
"P (GeV/c)");
430 BgSup[0]->GetYaxis()->SetTitle(
"suppression");
432 title0 =
"reconstructed tracks after primary vertex cut (PVC)";
433 title1 =
"reconstructed tracks after PVC and STS cuts (StsCs)";
434 title2 =
"reconstructed tracks after PVC+StsCs and MUCH cuts (MuchCs)";
435 title3 =
"reconstructed tracks after PVC+StsCs+MuchCs and TRD cut (TrdC)";
436 title4 =
"reconstructed tracks after PVC+StsCs+MuchCs+TrdC and TOF cut";
439 BgSup[1]->SetTitle(title0);
441 BgSup[2]->SetTitle(title1);
443 BgSup[3]->SetTitle(title2);
445 BgSup[4]->SetTitle(title3);
447 BgSup[5]->SetTitle(title4);
449 TString dir = getenv(
"VMCWORKDIR");
451 dir +
"/parameters/much/TOF8gev_fitParam_sigma" + std::to_string(
fSigmaTofCut) +
"." +
fSetupName +
".root";
454 TFile* oldFile = gFile;
455 TDirectory* oldDir = gDirectory;
457 TFile* FF =
new TFile(name);
458 LOG_IF(fatal, !FF) <<
"Could not open file " << name;
461 TTree* MinParamMu = FF->Get<TTree>(
"MinParam");
462 LOG_IF(fatal, !MinParamMu) <<
"Could not read MinParam tree from file " << name;
463 MinParamMu->SetBranchAddress(
"p0", &
p0min);
464 MinParamMu->SetBranchAddress(
"p1", &
p1min);
465 MinParamMu->SetBranchAddress(
"p2", &
p2min);
466 MinParamMu->GetEntry(0);
468 TTree* MaxParamMu = FF->Get<TTree>(
"MaxParam");
469 LOG_IF(fatal, !MaxParamMu) <<
"Could not read MaxParam tree from file " << name;
470 MaxParamMu->SetBranchAddress(
"p0", &
p0max);
471 MaxParamMu->SetBranchAddress(
"p1", &
p1max);
472 MaxParamMu->SetBranchAddress(
"p2", &
p2max);
473 MaxParamMu->GetEntry(0);
483 fFileAnnName = dir +
"/parameters/much/muid_ann_16_sis100_muon_lmvm_weights.txt";
489 if (fgets(
buffer, 100, file) == NULL) {
490 LOG(info) <<
"======================================================";
491 LOG(info) <<
"The ANN weights file " <<
fFileAnnName <<
" does not exist";
493 fFileAnnName = dir +
"/parameters/much/muid_ann_16_sis100_muon_lmvm_weights.txt";
495 LOG(info) <<
"The default ANN weights file " <<
fFileAnnName <<
" will be used";
496 LOG(info) <<
"======================================================";
511 Int_t nStsTracks =
fStsTracks->GetEntriesFast();
515 LOG(debug) <<
"------------------------";
516 LOG(debug) << GetName() <<
": Event " <<
fEvent;
517 LOG(debug) <<
"Number of tracks: MC - " <<
nMCTracks <<
", global - " << nGlobalTracks <<
", STS - " << nStsTracks
518 <<
", MUCH - " << nMuchTracks;
519 LOG(debug) <<
"------------------------";
521 TLorentzVector pMC1, pMC2, M;
552 CbmMuonMC() : Mu(kFALSE), Nsts(kFALSE), Nmuch(kFALSE), Ntrd(kFALSE), Ntof(kFALSE) { ; }
564 for (Int_t iMCTrack = 0; iMCTrack <
nMCTracks; iMCTrack++) {
567 if (TMath::Abs(mcTrack->
GetPdgCode()) != 13)
continue;
571 muMn_mc.Nsts = kTRUE;
573 muMn_mc.Nmuch = kTRUE;
575 muMn_mc.Ntrd = kTRUE;
584 muPl_mc.Nsts = kTRUE;
586 muPl_mc.Nmuch = kTRUE;
588 muPl_mc.Ntrd = kTRUE;
596 if (muPl_mc.Mu && muMn_mc.Mu) signal_mc.Mu = kTRUE;
597 if (muPl_mc.Nsts && muMn_mc.Nsts) signal_mc.Nsts = kTRUE;
598 if (muPl_mc.Nmuch && muMn_mc.Nmuch) signal_mc.Nmuch = kTRUE;
599 if (muPl_mc.Ntrd && muMn_mc.Ntrd) signal_mc.Ntrd = kTRUE;
600 if (muPl_mc.Ntof && muMn_mc.Ntof) signal_mc.Ntof = kTRUE;
609 for (Int_t iTrack = 0; iTrack < nGlobalTracks; iTrack++) {
611 Bool_t analysis = kFALSE;
624 if (iStsTrack < 0)
continue;
629 if (!stsTrack)
continue;
633 Double_t chi2sts = 1000;
642 mom.SetVectM(p,
fMass);
644 Double_t momentum = mom.P();
646 BgSup[0]->Fill(momentum);
648 Int_t q = par.GetQp() > 0 ? 1 : -1;
653 Double_t chi2much = 1000;
655 if (iMuchTrack > -1) {
666 Double_t chi2trd = 1000;
668 if (iTrdTrack > -1) {
679 Double_t mass = -1000;
688 Double_t beta = globalTrack->
GetLength() * 0.01 / (time * 1e-9 * TMath::C());
692 FairTrackParam* stpl = (FairTrackParam*) globalTrack->
GetParamLast();
693 stpl->Momentum(momL);
695 if (beta != 0) mass = momL.Mag() * momL.Mag() * (1. / beta / beta - 1.);
723 muMn_reco.Mu = kTRUE;
726 muMn_reco.Chi2V = kTRUE;
729 muMn_reco.Nsts = kTRUE;
732 muMn_reco.Nmuch = kTRUE;
735 muMn_reco.Ntrd = kTRUE;
739 muMn_reco.Ntof = kTRUE;
746 muPl_reco.Mu = kTRUE;
748 muPl_reco.Chi2V = kTRUE;
751 muPl_reco.Nsts = kTRUE;
754 muPl_reco.Nmuch = kTRUE;
757 muPl_reco.Ntrd = kTRUE;
761 muPl_reco.Ntof = kTRUE;
772 if (muPl_reco.Mu && muMn_reco.Mu) signal_reco.Mu = kTRUE;
773 if (muPl_reco.Chi2V && muMn_reco.Chi2V) signal_reco.Chi2V = kTRUE;
774 if (muPl_reco.Nsts && muMn_reco.Nsts) signal_reco.Nsts = kTRUE;
775 if (muPl_reco.Nmuch && muMn_reco.Nmuch) signal_reco.Nmuch = kTRUE;
776 if (muPl_reco.Ntrd && muMn_reco.Ntrd) signal_reco.Ntrd = kTRUE;
777 if (muPl_reco.Ntof && muMn_reco.Ntof &&
fAnnCut < 0) signal_reco.Ntof = kTRUE;
780 BgSup[1]->Fill(momentum);
783 BgSup[2]->Fill(momentum);
786 BgSup[3]->Fill(momentum);
789 BgSup[4]->Fill(momentum);
793 BgSup[5]->Fill(momentum);
816 BgSup[5]->Fill(momentum);
817 if (isMu == 1 && q > 0)
818 muPl_reco.Ntof = kTRUE;
819 else if (isMu == 1 && q < 0)
820 muMn_reco.Ntof = kTRUE;
821 if (muPl_reco.Ntof && muMn_reco.Ntof) signal_reco.Ntof = kTRUE;
825 if (!analysis)
continue;
859 int NofPlus =
fMuPlus->GetEntriesFast();
860 int NofMinus =
fMuMinus->GetEntriesFast();
861 for (
int iPart = 0; iPart < NofPlus; iPart++) {
864 for (
int jPart = 0; jPart < NofMinus; jPart++) {
868 YPtM->Fill(M.Rapidity(), M.Pt(), M.M());
880 TLorentzVector mom1 = Part1->
Vect4();
881 TLorentzVector mom2 = Part2->
Vect4();
963 TLorentzVector Mom = mom1 + mom2;
973 if (signal_mc.Nsts) {
978 if (signal_mc.Nmuch) {
983 if (signal_mc.Ntrd) {
988 if (signal_mc.Ntof) {
994 if (signal_reco.Mu) {
995 if (signal_reco.Chi2V)
YPt_VtxReco->Fill(Mom.Rapidity(), Mom.Pt());
996 if (signal_reco.Nsts)
YPt_VtxStsReco->Fill(Mom.Rapidity(), Mom.Pt());