@@ -92,13 +92,14 @@ struct hadronnucleicorrelation {
9292 Configurable<bool > rejectionEl{" rejectionEl" , true , " use TPC El rejection" };
9393 Configurable<float > max_tpcSharedCls{" max_tpcSharedCls" , 0.4 , " maximum fraction of TPC shared clasters" };
9494 Configurable<int > min_itsNCls{" min_itsNCls" , 0 , " minimum allowed number of ITS clasters" };
95+ Configurable<int > maxmixcollsGen{" maxmixcollsGen" , 100 , " maxmixcollsGen" };
9596
9697 // Mixing parameters
9798 Configurable<int > _vertexNbinsToMix{" vertexNbinsToMix" , 10 , " Number of vertexZ bins for the mixing" };
9899 Configurable<int > _multNsubBins{" multSubBins" , 10 , " number of sub-bins to perform the mixing within" };
99100
100101 // pT/A bins
101- Configurable<std::vector<double >> pTBins{" pTBins" , {0 .4f , 0 . 6f , 0 . 8f }, " p_{T} bins" };
102+ Configurable<std::vector<double >> pTBins{" pTBins" , {0 .6f , 1 . 0f , 1 . 2f , 2 . f }, " p_{T} bins" };
102103
103104 ConfigurableAxis AxisNSigma{" AxisNSigma" , {35 , -7 .f , 7 .f }, " n#sigma" };
104105
@@ -359,9 +360,8 @@ struct hadronnucleicorrelation {
359360 }
360361
361362 if (isMCGen) {
362- registry.add (" Generated/hNEventsMC" , " hNEventsMC" , {HistType::kTH1D , {{2 , 0 .f , 2 .f }}});
363+ registry.add (" Generated/hNEventsMC" , " hNEventsMC" , {HistType::kTH1D , {{1 , 0 .f , 1 .f }}});
363364 registry.get <TH1>(HIST (" Generated/hNEventsMC" ))->GetXaxis ()->SetBinLabel (1 , " All" );
364- registry.get <TH1>(HIST (" Generated/hNEventsMC" ))->GetXaxis ()->SetBinLabel (2 , " |z_{vtx}| < 10 cm" );
365365 }
366366 }
367367
@@ -560,28 +560,26 @@ struct hadronnucleicorrelation {
560560
561561 template <int ME, typename Type>
562562 void mixMCParticles (Type const & particles1, Type const & particles2)
563- { // last value: 0 -- SE; 1 -- ME
563+ {
564564 for (auto it1 : particles1) {
565565 for (auto it2 : particles2) {
566-
567566 // Calculate Delta-eta Delta-phi (gen)
568567 float deltaEtaGen = it2->eta () - it1->eta ();
569- float deltaPhiGen = it2->phi () - it1->phi ();
570- deltaPhiGen = getDeltaPhi (deltaPhiGen);
568+ float deltaPhiGen = getDeltaPhi (it2->phi () - it1->phi ());
571569
570+ // Loop over pT bins
572571 for (int k = 0 ; k < nBinspT; k++) {
573-
574572 if (it1->pt () >= pTBins.value .at (k) && it1->pt () < pTBins.value .at (k + 1 )) {
575-
576- if (ME) {
573+ // Use correct histogram based on ME flag
574+ if constexpr (ME) {
577575 hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill (deltaEtaGen, deltaPhiGen, it2->pt ());
578576 } else {
579577 hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill (deltaEtaGen, deltaPhiGen, it2->pt ());
580- } // SE
581- } // pT condition
582- } // nBinspT loop
583- } // particles 2
584- } // particles 1
578+ }
579+ }
580+ }
581+ }
582+ }
585583 }
586584
587585 float getDeltaPhi (float deltaPhi)
@@ -1294,6 +1292,10 @@ struct hadronnucleicorrelation {
12941292 continue ;
12951293 }
12961294
1295+ if (std::abs (particle.eta ()) > etacut) {
1296+ continue ;
1297+ }
1298+
12971299 if (particle.pdgCode () == pdgDeuteron) {
12981300 selectedparticlesMC_d[particle.mcCollisionId ()].push_back (std::make_shared<decltype (particle)>(particle));
12991301 }
@@ -1308,83 +1310,59 @@ struct hadronnucleicorrelation {
13081310 }
13091311 }
13101312
1311- for (auto collision : mcCollisions) {
1313+ for (auto collision1 : mcCollisions) { // loop on collisions
13121314
13131315 registry.fill (HIST (" Generated/hNEventsMC" ), 0.5 );
1314- if (std::abs (collision.posZ ()) < 10 .f ) {
1315- // return;
1316- registry.fill (HIST (" Generated/hNEventsMC" ), 1.5 );
1317- }
1318-
1319- int vertexBinToMix = std::floor ((collision.posZ () + cutzvertex) / (2 * cutzvertex / _vertexNbinsToMix));
1320- // int centBinToMix = std::floor(collision.centFT0M() / (100.0 / _multNsubBins));
1321-
1322- if (selectedparticlesMC_antid.find (collision.globalIndex ()) != selectedparticlesMC_antid.end ()) {
1323- mixbinsMC_antidantip[vertexBinToMix].push_back (std::make_shared<decltype (collision)>(collision));
1324- }
1325- if (selectedparticlesMC_d.find (collision.globalIndex ()) != selectedparticlesMC_d.end ()) {
1326- mixbinsMC_dp[vertexBinToMix].push_back (std::make_shared<decltype (collision)>(collision));
1327- }
1328- } // coll
13291316
1330- if (!mixbinsMC_antidantip.empty ()) {
1331-
1332- for (auto i = mixbinsMC_antidantip.begin (); i != mixbinsMC_antidantip.end (); i++) { // iterating over all vertex&mult bins
1333-
1334- std::vector<MCcolType> value = i->second ;
1335- int EvPerBin = value.size (); // number of collisions in each vertex&mult bin
1317+ // anti-d - anti-p correlation
1318+ if (selectedparticlesMC_antid.find (collision1.globalIndex ()) != selectedparticlesMC_antid.end ()) {
1319+ if (selectedparticlesMC_antip.find (collision1.globalIndex ()) != selectedparticlesMC_antip.end ()) {
1320+ mixMCParticles<0 >(selectedparticlesMC_antid[collision1.globalIndex ()], selectedparticlesMC_antip[collision1.globalIndex ()]); // mixing SE
1321+ }
13361322
1337- for ( int indx1 = 0 ; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin
1323+ int stop1 = 0 ;
13381324
1339- auto col1 = value[indx1];
1325+ for ( auto collision2 : mcCollisions) { // nested loop on collisions
13401326
1341- if (selectedparticlesMC_antip. find (col1-> index ()) != selectedparticlesMC_antip. end ()) {
1342- mixMCParticles< 0 >(selectedparticlesMC_antid[col1-> index ()], selectedparticlesMC_antip[col1-> index ()]); // mixing SE
1327+ if (collision1. globalIndex () == collision2. globalIndex ()) {
1328+ continue ;
13431329 }
13441330
1345- for (int indx2 = indx1 + 1 ; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin
1346-
1347- auto col2 = (i->second )[indx2];
1348-
1349- if (col1 == col2) {
1350- continue ;
1351- }
1331+ if (stop1 > maxmixcollsGen) {
1332+ break ;
1333+ }
13521334
1353- if (selectedparticlesMC_antip.find (col2->index ()) != selectedparticlesMC_antip.end ()) {
1354- mixMCParticles<1 >(selectedparticlesMC_antid[col1->index ()], selectedparticlesMC_antip[col2->index ()]); // mixing ME
1355- }
1335+ if (selectedparticlesMC_antip.find (collision2.globalIndex ()) != selectedparticlesMC_antip.end ()) {
1336+ mixMCParticles<1 >(selectedparticlesMC_antid[collision1.globalIndex ()], selectedparticlesMC_antip[collision2.globalIndex ()]); // mixing ME
13561337 }
1338+
1339+ stop1++;
13571340 }
13581341 }
1359- }
1360-
1361- if (!mixbinsMC_dp.empty ()) {
13621342
1363- for (auto i = mixbinsMC_dp.begin (); i != mixbinsMC_dp.end (); i++) { // iterating over all vertex&mult bins
1364-
1365- std::vector<MCcolType> value = i->second ;
1366- int EvPerBin = value.size (); // number of collisions in each vertex&mult bin
1343+ // d - p correlation
1344+ if (selectedparticlesMC_d.find (collision1.globalIndex ()) != selectedparticlesMC_d.end ()) {
1345+ if (selectedparticlesMC_p.find (collision1.globalIndex ()) != selectedparticlesMC_p.end ()) {
1346+ mixMCParticles<0 >(selectedparticlesMC_d[collision1.globalIndex ()], selectedparticlesMC_p[collision1.globalIndex ()]); // mixing SE
1347+ }
13671348
1368- for ( int indx1 = 0 ; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin
1349+ int stop2 = 0 ;
13691350
1370- auto col1 = value[indx1];
1351+ for ( auto collision2 : mcCollisions) { // nested loop on collisions
13711352
1372- if (selectedparticlesMC_p. find (col1-> index ()) != selectedparticlesMC_p. end ()) {
1373- mixMCParticles< 0 >(selectedparticlesMC_d[col1-> index ()], selectedparticlesMC_p[col1-> index ()]); // mixing SE
1353+ if (collision1. globalIndex () == collision2. globalIndex ()) {
1354+ continue ;
13741355 }
13751356
1376- for (int indx2 = indx1 + 1 ; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin
1377-
1378- auto col2 = (i->second )[indx2];
1379-
1380- if (col1 == col2) {
1381- continue ;
1382- }
1357+ if (stop2 > maxmixcollsGen) {
1358+ break ;
1359+ }
13831360
1384- if (selectedparticlesMC_p.find (col2->index ()) != selectedparticlesMC_p.end ()) {
1385- mixMCParticles<1 >(selectedparticlesMC_d[col1->index ()], selectedparticlesMC_p[col2->index ()]); // mixing ME
1386- }
1361+ if (selectedparticlesMC_p.find (collision2.globalIndex ()) != selectedparticlesMC_p.end ()) {
1362+ mixMCParticles<1 >(selectedparticlesMC_d[collision1.globalIndex ()], selectedparticlesMC_p[collision2.globalIndex ()]); // mixing ME
13871363 }
1364+
1365+ stop2++;
13881366 }
13891367 }
13901368 }
@@ -1405,16 +1383,6 @@ struct hadronnucleicorrelation {
14051383 for (auto i = selectedparticlesMC_p.begin (); i != selectedparticlesMC_p.end (); i++)
14061384 (i->second ).clear ();
14071385 selectedparticlesMC_p.clear ();
1408-
1409- for (auto & pair : mixbinsMC_antidantip) {
1410- pair.second .clear (); // clear the vector associated with the key
1411- }
1412- mixbinsMC_antidantip.clear (); // clear the map
1413-
1414- for (auto & pair : mixbinsMC_dp) {
1415- pair.second .clear (); // clear the vector associated with the key
1416- }
1417- mixbinsMC_dp.clear (); // clear the map
14181386 }
14191387 PROCESS_SWITCH (hadronnucleicorrelation, processGen, " processGen" , false );
14201388};
0 commit comments