@@ -9,6 +9,12 @@ double tof_sigma0 = 0.20; // [ns]
99double tof_mismatch = 0.01 ;
1010std ::string tof_mismatch_fname ;
1111
12+ // this part is for the PID of a potential MUON detector
13+ // it stores the probability for a track to be ID as a muon
14+ // one should do it nicely with the (eta-pt) dependence and correct numbers
15+ // this is just an example based on std::map to store flat probability for different input PID
16+ std ::map < int , double > muon_idp = { {11 , 0.01 } , {13 , 0.95 } , {211 , 0.10 } , {321 , 0.15 } , {2212 , 0.05 } };
17+
1218void
1319tof (const char * inputFile = "delphes.root" ,
1420 const char * outputFile = "tof.root" )
@@ -65,7 +71,9 @@ tof(const char *inputFile = "delphes.root",
6571 }
6672 }
6773 auto hMismatchTemplateOut = new TH1F ("hMismatchTemplate" , "" , 3000. , -5. , 25. );
68-
74+ auto hMuonPt [i ] = new TH1F ("hMuonPt" , ";#it{p_{T}} (GeV/#it{c});" , nbins , xbins );
75+
76+
6977 // read mismatch template if requested
7078 TH1 * hMismatchTemplateIn = nullptr ;
7179 if (!tof_mismatch_fname .empty ()) {
@@ -93,6 +101,12 @@ tof(const char *inputFile = "delphes.root",
93101 // smear track
94102 if (!smearer .smearTrack (* track )) continue ;
95103
104+ // check if it is identified as a muon by MUON ID
105+ auto pdg = std ::abs (track -> PID );
106+ auto muonp = muon_idp [pdg ];
107+ if (gRandom -> Uniform () < muonp )
108+ hMuonPt -> Fill (track -> PT );
109+
96110 // check if has TOF
97111 if (!toflayer .hasTOF (* track )) continue ;
98112
@@ -158,6 +172,7 @@ tof(const char *inputFile = "delphes.root",
158172 hNsigmaPt_true [i ][j ]-> Write ();
159173 }
160174 }
175+ hMuonPt -> Write ();
161176 fout -> Close ();
162177
163178}
0 commit comments