@@ -73,7 +73,7 @@ enum Modes {
7373 kPPbar
7474};
7575
76- struct hadronnucleicorrelation {
76+ struct HadronNucleiCorrelation {
7777
7878 static constexpr int betahasTOFthr = -100 ;
7979
@@ -87,14 +87,14 @@ struct hadronnucleicorrelation {
8787 Configurable<bool > isMC{" isMC" , false , " is MC" };
8888 Configurable<bool > isMCGen{" isMCGen" , false , " is isMCGen" };
8989 Configurable<bool > isPrim{" isPrim" , true , " is isPrim" };
90- Configurable<bool > docorrection{ " docorrection " , false , " do efficiency correction" };
90+ Configurable<bool > doCorrection{ " doCorrection " , false , " do efficiency correction" };
9191
9292 Configurable<std::string> fCorrectionPath {" fCorrectionPath" , " " , " Correction path to file" };
9393 Configurable<std::string> fCorrectionHisto {" fCorrectionHisto" , " " , " Correction histogram" };
94- Configurable<std::string> url {" ccdb-url" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
94+ Configurable<std::string> cfgUrl {" ccdb-url" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
9595
9696 // Event selection
97- Configurable<float > cutzvertex{ " cutzvertex " , 10.0 , " |vertexZ| value limit" };
97+ Configurable<float > cutzVertex{ " cutzVertex " , 10.0 , " |vertexZ| value limit" };
9898
9999 // Track selection
100100 Configurable<double > par0{" par0" , 0.004 , " par 0" };
@@ -103,9 +103,9 @@ struct hadronnucleicorrelation {
103103 Configurable<float > min_TPC_nCrossedRowsOverFindableCls{" min_TPC_nCrossedRowsOverFindableCls" , 0.8 , " n TPC Crossed Rows Over Findable Cls" };
104104 Configurable<float > max_chi2_TPC{" max_chi2_TPC" , 4 .0f , " maximum TPC chi^2/Ncls" };
105105 Configurable<float > max_chi2_ITS{" max_chi2_ITS" , 36 .0f , " maximum ITS chi^2/Ncls" };
106- Configurable<float > etacut{ " etacut " , 0 .8f , " eta cut" };
107- Configurable<float > max_dcaxy{ " max_dcaxy " , 0 .14f , " Maximum DCAxy" };
108- Configurable<float > max_dcaz{ " max_dcaz " , 0 .1f , " Maximum DCAz" };
106+ Configurable<float > etaCut{ " etaCut " , 0 .8f , " eta cut" };
107+ Configurable<float > max_DCAxy{ " max_DCAxy " , 0 .14f , " Maximum DCAxy" };
108+ Configurable<float > max_DCAz{ " max_DCAz " , 0 .1f , " Maximum DCAz" };
109109 Configurable<float > nsigmaTPC{" nsigmaTPC" , 3 .0f , " cut nsigma TPC" };
110110 Configurable<float > nsigmaElPr{" nsigmaElPr" , 1 .0f , " cut nsigma TPC El for protons" };
111111 Configurable<float > nsigmaElDe{" nsigmaElDe" , 3 .0f , " cut nsigma TPC El for protons" };
@@ -122,14 +122,14 @@ struct hadronnucleicorrelation {
122122 Configurable<int > min_itsNCls{" min_itsNCls" , 0 , " minimum allowed number of ITS clasters" };
123123 Configurable<int > maxmixcollsGen{" maxmixcollsGen" , 100 , " maxmixcollsGen" };
124124 Configurable<float > radiusTPC{" radiusTPC" , 1.2 , " TPC radius to calculate phi_star for" };
125- Configurable<float > deta{ " deta " , 0.01 , " minimum allowed defference in eta between two tracks in a pair" };
126- Configurable<float > dphi{ " dphi " , 0.01 , " minimum allowed defference in phi_star between two tracks in a pair" };
125+ Configurable<float > dEta{ " dEta " , 0.01 , " minimum allowed difference in eta between two tracks in a pair" };
126+ Configurable<float > dPhi{ " dPhi " , 0.01 , " minimum allowed difference in phi_star between two tracks in a pair" };
127127
128128 // Mixing parameters
129129 ConfigurableAxis confMultBins{" confMultBins" , {VARIABLE_WIDTH, 0 .0f , 4 .0f , 8 .0f , 12 .0f , 16 .0f , 20 .0f , 24 .0f , 28 .0f , 50 .0f , 100 .0f , 99999 .f }, " Mixing bins - multiplicity" };
130130 ConfigurableAxis confVtxBins{" confVtxBins" , {VARIABLE_WIDTH, -10 .0f , -8 .f , -6 .f , -4 .f , -2 .f , 0 .f , 2 .f , 4 .f , 6 .f , 8 .f , 10 .f }, " Mixing bins - z-vertex" };
131131 ColumnBinningPolicy<aod::singletrackselector::PosZ, aod::singletrackselector::Mult> colBinning{{confVtxBins, confMultBins}, true };
132- ColumnBinningPolicy<aod::mccollision::PosZ, o2::aod::mult::MultMCNParticlesEta05 > colBinningGen{{confVtxBins, confMultBins}, true };
132+ ColumnBinningPolicy<aod::mccollision::PosZ, o2::aod::mult::MultMCNParticlesEta10 > colBinningGen{{confVtxBins, confMultBins}, true };
133133
134134 // pT/A bins
135135 Configurable<std::vector<double >> pTBins{" pTBins" , {0 .6f , 1 .0f , 1 .2f , 2 .f }, " p_{T} bins" };
@@ -147,12 +147,12 @@ struct hadronnucleicorrelation {
147147 HistogramRegistry QA{" QA" };
148148
149149 using trkType = const FilteredTracks::iterator*;
150- using trkTypeMC = const FilteredTracksMC::iterator*;
150+ // using trkTypeMC = const FilteredTracksMC::iterator*;
151151 // typedef std::shared_ptr<FilteredCollisions::iterator> colType;
152152 // typedef std::shared_ptr<SimCollisions::iterator> MCcolType;
153153
154154 std::unique_ptr<o2::aod::singletrackselector::FemtoPair<trkType>> Pair = std::make_unique<o2::aod::singletrackselector::FemtoPair<trkType>>();
155- std::unique_ptr<o2::aod::singletrackselector::FemtoPair<trkTypeMC>> PairMC = std::make_unique<o2::aod::singletrackselector::FemtoPair<trkTypeMC>>();
155+ // std::unique_ptr<o2::aod::singletrackselector::FemtoPair<trkTypeMC>> PairMC = std::make_unique<o2::aod::singletrackselector::FemtoPair<trkTypeMC>>();
156156
157157 // Data histograms
158158 std::vector<std::shared_ptr<TH3>> hEtaPhi_SE;
@@ -173,13 +173,13 @@ struct hadronnucleicorrelation {
173173
174174 void init (o2::framework::InitContext&)
175175 {
176- ccdb->setURL (url .value );
176+ ccdb->setURL (cfgUrl .value );
177177 ccdb->setCaching (true );
178178 ccdb->setLocalObjectValidityChecking ();
179179 ccdb->setCreatedNotAfter (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count ());
180180 ccdb->setFatalWhenNull (false );
181181
182- if (docorrection ) {
182+ if (doCorrection ) {
183183 GetCorrection (ccdb, TString (fCorrectionPath ), TString (fCorrectionHisto ));
184184 } else {
185185 hEffpTEta_proton = nullptr ;
@@ -207,25 +207,25 @@ struct hadronnucleicorrelation {
207207
208208 TString name = " AntiDeAntiPr" ;
209209 switch (mode) {
210- case 1 :
210+ case kDP :
211211 name = " DePr" ;
212212 break ;
213- case 2 :
213+ case kDbarP :
214214 name = " AntiDePr" ;
215215 break ;
216- case 3 :
216+ case kDPbar :
217217 name = " DeAntiPr" ;
218218 break ;
219- case 4 :
219+ case kPbarP :
220220 name = " AntiPrPr" ;
221221 break ;
222- case 5 :
222+ case kPbarPbar :
223223 name = " AntiPrAntiPr" ;
224224 break ;
225- case 6 :
225+ case kPP :
226226 name = " PrPr" ;
227227 break ;
228- case 7 :
228+ case kPPbar :
229229 name = " PrAntiPr" ;
230230 break ;
231231 }
@@ -283,7 +283,7 @@ struct hadronnucleicorrelation {
283283 QA.add (" QA/hnSigmaTOFVsPt_De" , " n#sigma TOF vs p_{T} for d hypothesis (all tracks); p_{T} (GeV/c); n#sigma TOF" , {HistType::kTH2D , {pTAxis, AxisNSigma}});
284284 QA.add (" QA/hnSigmaITSVsPt_Pr" , " n#sigma ITS vs p_{T} for p hypothesis (all tracks); p_{T} (GeV/c); n#sigma ITS" , {HistType::kTH2D , {pTAxis, AxisNSigma}});
285285 QA.add (" QA/hnSigmaITSVsPt_De" , " n#sigma ITS vs p_{T} for d hypothesis (all tracks); p_{T} (GeV/c); n#sigma ITS" , {HistType::kTH2D , {pTAxis, AxisNSigma}});
286- QA.add (" QA/hdetadphistar " , " ;dphi*;deta " , {HistType::kTH2D , {{101 , -0.2 , 0.2 , " dphi *" }, {101 , -0.2 , 0.2 , " deta " }}});
286+ QA.add (" QA/hdEtadPhistar " , " ;dPhi*;dEta " , {HistType::kTH2D , {{101 , -0.2 , 0.2 , " dPhi *" }, {101 , -0.2 , 0.2 , " dEta " }}});
287287
288288 if (!isMC) {
289289 QA.add (" QA/hEtaPr" , Form (" #eta ditribution for p" ), {HistType::kTH1F , {etaAxis}});
@@ -415,14 +415,14 @@ struct hadronnucleicorrelation {
415415 }
416416
417417 // Filters
418- Filter vertexFilter = nabs(o2::aod::singletrackselector::posZ) <= cutzvertex ;
418+ Filter vertexFilter = nabs(o2::aod::singletrackselector::posZ) <= cutzVertex ;
419419 Filter trackFilter = o2::aod::singletrackselector::tpcNClsFound >= min_TPC_nClusters &&
420420 o2::aod::singletrackselector::unPack<singletrackselector::binning::chi2>(o2::aod::singletrackselector::storedTpcChi2NCl) <= max_chi2_TPC &&
421421 o2::aod::singletrackselector::unPack<singletrackselector::binning::rowsOverFindable>(o2::aod::singletrackselector::storedTpcCrossedRowsOverFindableCls) >= min_TPC_nCrossedRowsOverFindableCls &&
422422 o2::aod::singletrackselector::unPack<singletrackselector::binning::chi2>(o2::aod::singletrackselector::storedItsChi2NCl) <= max_chi2_ITS &&
423- nabs (o2::aod::singletrackselector::unPack<singletrackselector::binning::dca>(o2::aod::singletrackselector::storedDcaXY)) <= max_dcaxy &&
424- nabs (o2::aod::singletrackselector::unPack<singletrackselector::binning::dca>(o2::aod::singletrackselector::storedDcaXY)) <= max_dcaz &&
425- nabs (o2::aod::singletrackselector::eta) <= etacut ;
423+ nabs (o2::aod::singletrackselector::unPack<singletrackselector::binning::dca>(o2::aod::singletrackselector::storedDcaXY)) <= max_DCAxy &&
424+ nabs (o2::aod::singletrackselector::unPack<singletrackselector::binning::dca>(o2::aod::singletrackselector::storedDcaXY)) <= max_DCAz &&
425+ nabs (o2::aod::singletrackselector::eta) <= etaCut ;
426426
427427 template <typename Type>
428428 bool IsProton (Type const & track, int sign)
@@ -560,8 +560,8 @@ struct hadronnucleicorrelation {
560560 {
561561 Pair->SetPair (&part0, &part1);
562562 Pair->SetIdentical (isIdentical);
563- if (isIdentical && Pair->IsClosePair (deta, dphi , radiusTPC)) {
564- QA.fill (HIST (" QA/hdetadphistar " ), Pair->GetPhiStarDiff (radiusTPC), Pair->GetEtaDiff ());
563+ if (isIdentical && Pair->IsClosePair (dEta, dPhi , radiusTPC)) {
564+ QA.fill (HIST (" QA/hdEtadPhistar " ), Pair->GetPhiStarDiff (radiusTPC), Pair->GetEtaDiff ());
565565 return ;
566566 }
567567
@@ -575,7 +575,7 @@ struct hadronnucleicorrelation {
575575
576576 float corr0 = 1 , corr1 = 1 ;
577577
578- if (docorrection ) { // Apply corrections
578+ if (doCorrection ) { // Apply corrections
579579 switch (mode) {
580580 case 0 :
581581 corr0 = hEffpTEta_antideuteron->Interpolate (part0.pt (), part0.eta ());
@@ -684,7 +684,7 @@ struct hadronnucleicorrelation {
684684 void processSameEvent (FilteredCollisions::iterator const & collision, FilteredTracks const & tracks)
685685 {
686686
687- if (std::abs (collision.posZ ()) > cutzvertex )
687+ if (std::abs (collision.posZ ()) > cutzVertex )
688688 return ;
689689
690690 registry.fill (HIST (" hNEvents" ), 0.5 );
@@ -757,6 +757,9 @@ struct hadronnucleicorrelation {
757757 }
758758 }
759759
760+ Pair->SetMagField1 (collision.magField ());
761+ Pair->SetMagField2 (collision.magField ());
762+
760763 if (mode == kPbarPbar || mode == kPP ) { // Identical particle combinations
761764
762765 for (const auto & [part0, part1] : combinations (CombinationsStrictlyUpperIndexPolicy (tracks, tracks))) {
@@ -853,7 +856,7 @@ struct hadronnucleicorrelation {
853856 }
854857 }
855858 }
856- PROCESS_SWITCH (hadronnucleicorrelation , processSameEvent, " processSameEvent" , true );
859+ PROCESS_SWITCH (HadronNucleiCorrelation , processSameEvent, " processSameEvent" , true );
857860
858861 void processMixedEvent (FilteredCollisions const & collisions, FilteredTracks const & tracks)
859862 {
@@ -872,6 +875,9 @@ struct hadronnucleicorrelation {
872875 continue ;
873876 }
874877
878+ Pair->SetMagField1 (magFieldTesla1);
879+ Pair->SetMagField2 (magFieldTesla2);
880+
875881 for (const auto & [part0, part1] : combinations (CombinationsFullIndexPolicy (groupPartsOne, groupPartsTwo))) {
876882
877883 if (part0.tpcFractionSharedCls () > max_tpcSharedCls)
@@ -946,12 +952,12 @@ struct hadronnucleicorrelation {
946952 }
947953 }
948954 }
949- PROCESS_SWITCH (hadronnucleicorrelation , processMixedEvent, " processMixedEvent" , true );
955+ PROCESS_SWITCH (HadronNucleiCorrelation , processMixedEvent, " processMixedEvent" , true );
950956
951957 void processMC (FilteredCollisions const &, FilteredTracksMC const & tracks)
952958 {
953959 for (const auto & track : tracks) {
954- if (std::abs (track.template singleCollSel_as <FilteredCollisions>().posZ ()) > cutzvertex )
960+ if (std::abs (track.template singleCollSel_as <FilteredCollisions>().posZ ()) > cutzVertex )
955961 continue ;
956962
957963 if (track.tpcFractionSharedCls () > max_tpcSharedCls)
@@ -1312,12 +1318,12 @@ struct hadronnucleicorrelation {
13121318 }
13131319 } // track
13141320 }
1315- PROCESS_SWITCH (hadronnucleicorrelation , processMC, " processMC" , false );
1321+ PROCESS_SWITCH (HadronNucleiCorrelation , processMC, " processMC" , false );
13161322
13171323 void processSameEventGen (SimCollisions::iterator const & mcCollision, SimParticles const & mcParticles)
13181324 {
13191325
1320- if (std::abs (mcCollision.posZ ()) > cutzvertex )
1326+ if (std::abs (mcCollision.posZ ()) > cutzVertex )
13211327 return ;
13221328
13231329 registry.fill (HIST (" Generated/hNEventsMC" ), 0.5 );
@@ -1348,7 +1354,7 @@ struct hadronnucleicorrelation {
13481354 registry.fill (HIST (" Generated/hAntiDeuteronsVsPt" ), particle.pt ());
13491355 }
13501356
1351- if (std::abs (particle.eta ()) > etacut ) {
1357+ if (std::abs (particle.eta ()) > etaCut ) {
13521358 continue ;
13531359 }
13541360 if (particle.pdgCode () == PDG_t::kProton ) {
@@ -1439,17 +1445,21 @@ struct hadronnucleicorrelation {
14391445 }
14401446 }
14411447 }
1442- PROCESS_SWITCH (hadronnucleicorrelation, processSameEventGen, " processSameEventGen" , false );
1448+ PROCESS_SWITCH (HadronNucleiCorrelation, processSameEventGen, " processSameEventGen" , false );
1449+
1450+ Preslice<SimParticles> perMcCollision = o2::aod::mcparticle::mcCollisionId;
14431451
14441452 void processMixedEventGen (SimCollisions const & mcCollisions, SimParticles const & mcParticles)
14451453 {
14461454
14471455 for (const auto & [collision1, collision2] : soa::selfCombinations (colBinningGen, 5 , -1 , mcCollisions, mcCollisions)) {
14481456
1449- // LOGF(info, "Mixed event collisions: (%d, %d) zvtx (%.1f, %.1f) mult (%d, %d)", collision1.globalIndex(), collision2.globalIndex(), collision1.posZ(), collision2.posZ(), collision1.mult(), collision2.mult());
1457+ // LOGF(info, "Mixed event collisions: (%d, %d) zvtx (%.1f, %.1f) mult (%d, %d)", collision1.globalIndex(), collision2.globalIndex(), collision1.posZ(), collision2.posZ(), collision1.multMCNParticlesEta10(), collision2.multMCNParticlesEta10());
1458+
1459+ auto groupPartsOne = mcParticles.sliceBy (perMcCollision, collision1.globalIndex ());
1460+ auto groupPartsTwo = mcParticles.sliceBy (perMcCollision, collision2.globalIndex ());
14501461
1451- auto groupPartsOne = mcParticles.sliceByCached (o2::aod::mcparticle::mcCollisionId, collision1.globalIndex (), cache);
1452- auto groupPartsTwo = mcParticles.sliceByCached (o2::aod::mcparticle::mcCollisionId, collision2.globalIndex (), cache);
1462+ registry.fill (HIST (" hMult" ), collision1.multMCNParticlesEta10 ());
14531463
14541464 for (const auto & [part0, part1] : combinations (CombinationsFullIndexPolicy (groupPartsOne, groupPartsTwo))) {
14551465
@@ -1506,10 +1516,10 @@ struct hadronnucleicorrelation {
15061516 }
15071517 }
15081518 }
1509- PROCESS_SWITCH (hadronnucleicorrelation , processMixedEventGen, " processMixedEventGen" , false );
1519+ PROCESS_SWITCH (HadronNucleiCorrelation , processMixedEventGen, " processMixedEventGen" , false );
15101520};
15111521
15121522WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
15131523{
1514- return WorkflowSpec{adaptAnalysisTask<hadronnucleicorrelation >(cfgc)};
1524+ return WorkflowSpec{adaptAnalysisTask<HadronNucleiCorrelation >(cfgc)};
15151525}
0 commit comments