2020#include < CCDB/BasicCCDBManager.h>
2121#include < cmath>
2222#include < vector>
23+ #include < string>
2324// / ROOT
2425#include " TRandom3.h"
2526// / O2
@@ -53,6 +54,7 @@ struct TreeWriterTpcV0 {
5354 using Trks = soa::Join<aod::Tracks, aod::V0Bits, aod::TracksExtra, aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFFullEl, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::TrackSelection>;
5455 using Colls = soa::Join<aod::Collisions, aod::Mults, aod::EvSels>;
5556 using MyBCTable = soa::Join<aod::BCsWithTimestamps, aod::BCTFinfoTable>;
57+ using V0sWithID = soa::Join<aod::V0Datas, aod::V0MapID>;
5658
5759 // / Tables to be produced
5860 Produces<o2::aod::SkimmedTPCV0Tree> rowTPCTree;
@@ -63,6 +65,7 @@ struct TreeWriterTpcV0 {
6365 Configurable<float > nClNorm{" nClNorm" , 152 ., " Number of cluster normalization. Run 2: 159, Run 3 152" };
6466 Configurable<int > applyEvSel{" applyEvSel" , 2 , " Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection" };
6567 Configurable<int > trackSelection{" trackSelection" , 1 , " Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks" };
68+ Configurable<std::string> irSource{" irSource" , " T0VTX" , " Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)" };
6669 // / Configurables downsampling
6770 Configurable<double > dwnSmplFactor_Pi{" dwnSmplFactor_Pi" , 1 ., " downsampling factor for pions, default fraction to keep is 1." };
6871 Configurable<double > dwnSmplFactor_Pr{" dwnSmplFactor_Pr" , 1 ., " downsampling factor for protons, default fraction to keep is 1." };
@@ -90,6 +93,7 @@ struct TreeWriterTpcV0 {
9093 {
9194
9295 const double ncl = track.tpcNClsFound ();
96+ const double nclPID = track.tpcNClsFindableMinusPID ();
9397 const double p = track.tpcInnerParam ();
9498 const double mass = o2::track::pid_constants::sMasses [id];
9599 const double bg = p / mass;
@@ -118,6 +122,7 @@ struct TreeWriterTpcV0 {
118122 bg,
119123 multTPC / 11000 .,
120124 std::sqrt (nClNorm / ncl),
125+ nclPID,
121126 id,
122127 nSigmaTPC,
123128 nSigmaTOF,
@@ -140,6 +145,7 @@ struct TreeWriterTpcV0 {
140145 {
141146
142147 const double ncl = track.tpcNClsFound ();
148+ const double nclPID = track.tpcNClsFindableMinusPID ();
143149 const double p = track.tpcInnerParam ();
144150 const double mass = o2::track::pid_constants::sMasses [id];
145151 const double bg = p / mass;
@@ -168,6 +174,7 @@ struct TreeWriterTpcV0 {
168174 bg,
169175 multTPC / 11000 .,
170176 std::sqrt (nClNorm / ncl),
177+ nclPID,
171178 id,
172179 nSigmaTPC,
173180 nSigmaTOF,
@@ -252,22 +259,25 @@ struct TreeWriterTpcV0 {
252259 }
253260
254261 // / Apply a track quality selection with a filter!
255- void processStandard (Colls::iterator const & collision, soa::Filtered<Trks> const & tracks, aod::V0Datas const & v0s, aod::BCsWithTimestamps const &)
262+ void processStandard (Colls::iterator const & collision, soa::Filtered<Trks> const & tracks, V0sWithID const & v0s, aod::BCsWithTimestamps const &)
256263 {
257264 // / Check event slection
258265 if (!isEventSelected (collision, tracks)) {
259266 return ;
260267 }
261268 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
262269 const int runnumber = bc.runNumber ();
263- float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, " ZNC hadronic " ) * 1 .e -3 ;
270+ float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, irSource ) * 1 .e -3 ;
264271
265272 rowTPCTree.reserve (tracks.size ());
266273
267274 // / Loop over v0 candidates
268275 for (const auto & v0 : v0s) {
269276 auto posTrack = v0.posTrack_as <soa::Filtered<Trks>>();
270277 auto negTrack = v0.negTrack_as <soa::Filtered<Trks>>();
278+ if (v0.v0addid () == -1 ) {
279+ continue ;
280+ }
271281 // gamma
272282 if (static_cast <bool >(posTrack.pidbit () & (1 << 0 )) && static_cast <bool >(negTrack.pidbit () & (1 << 0 ))) {
273283 if (downsampleTsalisCharged (posTrack.pt (), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses [o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) {
@@ -313,8 +323,8 @@ struct TreeWriterTpcV0 {
313323 PROCESS_SWITCH (TreeWriterTpcV0, processStandard, " Standard V0 Samples for PID" , true );
314324
315325 Preslice<Trks> perCollisionTracks = aod::track::collisionId;
316- Preslice<aod::V0Datas > perCollisionV0s = aod::v0data::collisionId;
317- void processWithTrQA (Colls const & collisions, Trks const & myTracks, aod::V0Datas const & myV0s, MyBCTable const &, aod::TracksQA_002 const & tracksQA)
326+ Preslice<V0sWithID > perCollisionV0s = aod::v0data::collisionId;
327+ void processWithTrQA (Colls const & collisions, Trks const & myTracks, V0sWithID const & myV0s, MyBCTable const &, aod::TracksQA_002 const & tracksQA)
318328 {
319329 std::vector<int64_t > labelTrack2TrackQA;
320330 labelTrack2TrackQA.clear ();
@@ -333,7 +343,7 @@ struct TreeWriterTpcV0 {
333343 }
334344 auto bc = collision.bc_as <MyBCTable>();
335345 const int runnumber = bc.runNumber ();
336- float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, " ZNC hadronic " ) * 1 .e -3 ;
346+ float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, irSource ) * 1 .e -3 ;
337347 const int bcGlobalIndex = bc.globalIndex ();
338348 const int bcTimeFrameId = bc.tfId ();
339349 const int bcBcInTimeFrame = bc.bcInTF ();
@@ -342,6 +352,9 @@ struct TreeWriterTpcV0 {
342352 for (const auto & v0 : v0s) {
343353 auto posTrack = v0.posTrack_as <Trks>();
344354 auto negTrack = v0.negTrack_as <Trks>();
355+ if (v0.v0addid () == -1 ) {
356+ continue ;
357+ }
345358 aod::TracksQA_002::iterator posTrackQA;
346359 aod::TracksQA_002::iterator negTrackQA;
347360 bool existPosTrkQA;
@@ -432,6 +445,7 @@ struct TreeWriterTPCTOF {
432445 Configurable<int > applyEvSel{" applyEvSel" , 2 , " Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection" };
433446 Configurable<int > applyTrkSel{" applyTrkSel" , 1 , " Flag to apply track selection: 0 -> no track selection, 1 -> track selection" };
434447 Configurable<int > trackSelection{" trackSelection" , 1 , " Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks" };
448+ Configurable<std::string> irSource{" irSource" , " T0VTX" , " Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)" };
435449 // / Triton
436450 Configurable<float > maxMomTPCOnlyTr{" maxMomTPCOnlyTr" , 1.5 , " Maximum momentum for TPC only cut triton" };
437451 Configurable<float > maxMomHardCutOnlyTr{" maxMomHardCutOnlyTr" , 50 , " Maximum TPC inner momentum for triton" };
@@ -517,6 +531,7 @@ struct TreeWriterTPCTOF {
517531 {
518532
519533 const double ncl = track.tpcNClsFound ();
534+ const double nclPID = track.tpcNClsFindableMinusPID ();
520535 const double p = track.tpcInnerParam ();
521536 const double mass = o2::track::pid_constants::sMasses [id];
522537 const double bg = p / mass;
@@ -538,6 +553,7 @@ struct TreeWriterTPCTOF {
538553 bg,
539554 multTPC / 11000 .,
540555 std::sqrt (nClNorm / ncl),
556+ nclPID,
541557 id,
542558 nSigmaTPC,
543559 nSigmaTOF,
@@ -553,6 +569,7 @@ struct TreeWriterTPCTOF {
553569 {
554570
555571 const double ncl = track.tpcNClsFound ();
572+ const double nclPID = track.tpcNClsFindableMinusPID ();
556573 const double p = track.tpcInnerParam ();
557574 const double mass = o2::track::pid_constants::sMasses [id];
558575 const double bg = p / mass;
@@ -574,6 +591,7 @@ struct TreeWriterTPCTOF {
574591 bg,
575592 multTPC / 11000 .,
576593 std::sqrt (nClNorm / ncl),
594+ nclPID,
577595 id,
578596 nSigmaTPC,
579597 nSigmaTOF,
@@ -628,7 +646,7 @@ struct TreeWriterTPCTOF {
628646 }
629647 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
630648 const int runnumber = bc.runNumber ();
631- float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, " ZNC hadronic " ) * 1 .e -3 ;
649+ float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, irSource ) * 1 .e -3 ;
632650
633651 rowTPCTOFTree.reserve (tracks.size ());
634652 for (auto const & trk : tracks) {
@@ -688,7 +706,7 @@ struct TreeWriterTPCTOF {
688706 }
689707 auto bc = collision.bc_as <MyBCTable>();
690708 const int runnumber = bc.runNumber ();
691- float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, " ZNC hadronic " ) * 1 .e -3 ;
709+ float hadronicRate = mRateFetcher .fetch (ccdb.service , bc.timestamp (), runnumber, irSource ) * 1 .e -3 ;
692710 const int bcGlobalIndex = bc.globalIndex ();
693711 const int bcTimeFrameId = bc.tfId ();
694712 const int bcBcInTimeFrame = bc.bcInTF ();
0 commit comments