@@ -48,7 +48,7 @@ struct AssociateMCInfo {
4848 Produces<o2::aod::EMPrimaryMuonMCLabels> emprimarymuonmclabels;
4949
5050 Configurable<float > max_rxy_gen{" max_rxy_gen" , 100 , " max rxy to store generated information" };
51- Configurable<float > max_Y_gen{" max_Y_gen" , 1.5 , " max rapidity Y to store generated information" };
51+ Configurable<float > max_Y_gen{" max_Y_gen" , 0.9 , " max rapidity Y to store generated information" };
5252 Configurable<float > margin_z_gen{" margin_z_gen" , 15 .f , " margin for Z of true photon conversion point to store generated information" };
5353
5454 HistogramRegistry registry{" EMMCEvent" };
@@ -58,6 +58,8 @@ struct AssociateMCInfo {
5858 auto hEventCounter = registry.add <TH1 >(" hEventCounter" , " hEventCounter" , kTH1I , {{6 , 0 .5f , 6 .5f }});
5959 hEventCounter->GetXaxis ()->SetBinLabel (1 , " all" );
6060 hEventCounter->GetXaxis ()->SetBinLabel (2 , " has mc collision" );
61+ registry.add <TH2 >(" PCM/hXY" , " hRxy;X (cm);Y (cm)" , kTH2F , {{400 , -100 , +100 }, {400 , -100 , +100 }});
62+ registry.add <TH2 >(" PCM/hRZ" , " hRxy;R (cm);Z (cm)" , kTH2F , {{400 , -100 , +100 }, {200 , 0 , +100 }});
6163 }
6264
6365 Preslice<aod::McParticles> perMcCollision = aod::mcparticle::mcCollisionId;
@@ -92,7 +94,6 @@ struct AssociateMCInfo {
9294 // make an entry for this MC event only if it was not already added to the table
9395 if (!(fEventLabels .find (mcCollision.globalIndex ()) != fEventLabels .end ())) {
9496 mcevents (mcCollision.globalIndex (), mcCollision.generatorsID (), mcCollision.posX (), mcCollision.posY (), mcCollision.posZ (), mcCollision.t (), mcCollision.impactParameter ());
95- // mcevents(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.t(), mcCollision.impactParameter());
9697 fEventLabels [mcCollision.globalIndex ()] = fCounters [1 ];
9798 fCounters [1 ]++;
9899 }
@@ -103,7 +104,7 @@ struct AssociateMCInfo {
103104 auto groupedMcTracks = mcTracks.sliceBy (perMcCollision, mcCollision.globalIndex ());
104105
105106 for (auto & mctrack : groupedMcTracks) { // store necessary information for denominator of efficiency
106- if (mctrack.pt () < 1e-3 || abs (mctrack.y ()) > max_Y_gen || abs (mctrack. vz ()) > 250 || sqrt (pow (mctrack.vx (), 2 ) + pow (mctrack.vy (), 2 )) > max_rxy_gen) {
107+ if (mctrack.pt () < 1e-3 || abs (mctrack.vz ()) > 250 || sqrt (pow (mctrack.vx (), 2 ) + pow (mctrack.vy (), 2 )) > max_rxy_gen) {
107108 continue ;
108109 }
109110 int pdg = mctrack.pdgCode ();
@@ -138,14 +139,30 @@ struct AssociateMCInfo {
138139 }
139140 // LOGF(info,"index = %d , mc track pdg = %d , producedByGenerator = %d , isPhysicalPrimary = %d", mctrack.index(), mctrack.pdgCode(), mctrack.producedByGenerator(), mctrack.isPhysicalPrimary());
140141
141- if (abs (pdg) == 11 ) { // electrons // extra check of production vertex for secondary electrons to reduce data size.
142- if (!mctrack.isPhysicalPrimary () && !mctrack.producedByGenerator () && sqrt (pow (mctrack.vx (), 2 ) + pow (mctrack.vy (), 2 )) < abs (mctrack.vz ()) * std::tan (2 * std::atan (std::exp (-max_Y_gen))) - margin_z_gen) {
143- continue ;
144- }
145- } else {
146- if (!mctrack.isPhysicalPrimary () && !mctrack.producedByGenerator ()) {
142+ if (!(mctrack.isPhysicalPrimary () || mctrack.producedByGenerator ())) { // neither physical primary nor producedByGenerator
143+ if (abs (pdg) == 11 ) { // one more check for secondary electrons. i.e. gamma->ee
144+
145+ if (sqrt (pow (mctrack.vx (), 2 ) + pow (mctrack.vy (), 2 )) < abs (mctrack.vz ()) * std::tan (2 * std::atan (std::exp (-max_Y_gen))) - margin_z_gen) {
146+ continue ;
147+ }
148+
149+ if (mctrack.has_mothers ()) {
150+ auto mp = mctrack.template mothers_first_as <aod::McParticles>(); // mother particle of electron
151+ int pdg_mother = mp.pdgCode ();
152+ if (pdg_mother != 22 || !(mp.isPhysicalPrimary () || mp.producedByGenerator ())) { // mother of electron is not photon, or not physical primary, or not producedByGenerator
153+ continue ;
154+ }
155+ }
156+ } else { // not physical primary, not producedByGenerator, not electrons
147157 continue ;
148158 }
159+ } else if (abs (mctrack.y ()) > max_Y_gen) { // physical primary or producedByGenerator, but outside of acceptance.
160+ continue ;
161+ }
162+
163+ if (abs (pdg) == 11 && !(mctrack.isPhysicalPrimary () || mctrack.producedByGenerator ())) { // only for quick check, only secondary electrons should appear.
164+ registry.fill (HIST (" PCM/hXY" ), mctrack.vx (), mctrack.vy ());
165+ registry.fill (HIST (" PCM/hRZ" ), mctrack.vz (), sqrt (pow (mctrack.vx (), 2 ) + pow (mctrack.vy (), 2 )));
149166 }
150167
151168 // these are used as denominator for efficiency. (i.e. generated information)
@@ -326,12 +343,7 @@ struct AssociateMCInfo {
326343
327344 std::vector<int > mothers;
328345 if (mctrack.has_mothers ()) {
329- // LOGF(info, "mother ids size = %d", mctrack.mothersIds().size());
330- // int counter = 0;
331346 for (auto & m : mctrack.mothersIds ()) {
332- // LOGF(info, "counter = %d , mother id = %d", counter, m);
333- // counter++;
334-
335347 if (m < mcTracks.size ()) { // protect against bad mother indices
336348 if (fNewLabels .find (m) != fNewLabels .end ()) {
337349 mothers.push_back (fNewLabels .find (m)->second );
0 commit comments