1616#include " Framework/AnalysisDataModel.h"
1717#include " Framework/ASoAHelpers.h"
1818#include " ReconstructionDataFormats/Track.h"
19+ #include " Common/DataModel/TrackSelectionTables.h"
20+ #include " Common/DataModel/Centrality.h"
21+ #include " Common/DataModel/Multiplicity.h"
1922#include " Common/Core/RecoDecay.h"
2023#include " Common/Core/trackUtilities.h"
2124#include " Common/DataModel/EventSelection.h"
@@ -38,7 +41,7 @@ using namespace o2;
3841using namespace o2 ::framework;
3942using namespace o2 ::framework::expressions;
4043
41- using TracksFull = soa::Join<aod::TracksIU , aod::TracksExtra, aod::TracksCovIU , aod::pidTPCDe, aod::pidTPCPr, aod::pidTPCPi, aod::TOFSignal, aod::TOFEvTime>;
44+ using TracksFull = soa::Join<aod::Tracks , aod::TracksExtra, aod::TracksDCA , aod::pidTPCDe, aod::pidTPCPr, aod::pidTPCPi, aod::TOFSignal, aod::TOFEvTime>;
4245
4346namespace
4447{
@@ -50,7 +53,6 @@ static const std::vector<std::string> pidHypotheses{"Electron", "Muon", "Pion",
5053} // namespace
5154
5255struct antidLambdaEbye {
53- Service<o2::ccdb::BasicCCDBManager> ccdb;
5456 o2::pid::tof::Beta<TracksFull::iterator> responseBeta;
5557
5658 Configurable<int > cfgMaterialCorrection{" cfgMaterialCorrection" , static_cast <int >(o2::base::Propagator::MatCorrType::USEMatCorrNONE), " Type of material correction" };
@@ -75,15 +77,6 @@ struct antidLambdaEbye {
7577 ConfigurableAxis tofAxis{" tofAxis" , {1 .e3 , 0 .f , 1 .f }, " tof signal axis binning" };
7678 ConfigurableAxis trackingPidAxis{" trackingPidAxis" , {static_cast <double >(pidHypotheses.size ()), 0 , static_cast <double >(pidHypotheses.size ())}, " tracking pid hypothesis binning" };
7779
78- // CCDB options
79- Configurable<double > d_bz_input{" d_bz" , -999 , " bz field, -999 is automatic" };
80- Configurable<std::string> ccdburl{" ccdb-url" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
81- Configurable<std::string> grpPath{" grpPath" , " GLO/GRP/GRP" , " Path of the grp file" };
82- Configurable<std::string> grpmagPath{" grpmagPath" , " GLO/Config/GRPMagField" , " CCDB path of the GRPMagField object" };
83- Configurable<std::string> lutPath{" lutPath" , " GLO/Param/MatLUT" , " Path of the Lut parametrization" };
84- Configurable<std::string> geoPath{" geoPath" , " GLO/Config/GeometryAligned" , " Path of the geometry file" };
85- Configurable<std::string> pidPath{" pidPath" , " " , " Path to the PID response object" };
86-
8780 Configurable<float > zVtxMax{" zVtxMax" , 10 .0f , " maximum z position of the primary vertex" };
8881 Configurable<float > etaMax{" etaMax" , 0 .8f , " maximum eta" };
8982
@@ -110,9 +103,6 @@ struct antidLambdaEbye {
110103 Configurable<float > v0setting_radius{" v0setting_radius" , 0 .5f , " v0radius" };
111104 Configurable<float > lambdaMassCut{" lambdaMassCut" , 0 .005f , " maximum deviation from PDG mass" };
112105
113- int mRunNumber ;
114- float d_bz;
115-
116106 HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
117107
118108 Filter preFilterV0 = (nabs(aod::v0data::dcapostopv) > v0setting_dcapostopv &&
@@ -156,13 +146,6 @@ struct antidLambdaEbye {
156146
157147 void init (o2::framework::InitContext&)
158148 {
159- ccdb->setURL (ccdburl);
160- ccdb->setCaching (true );
161- ccdb->setLocalObjectValidityChecking ();
162- ccdb->setFatalWhenNull (false );
163-
164- mRunNumber = 0 ;
165- d_bz = 0 ;
166149
167150 histos.add <TH1>(" zVtx" , " ;#it{z}_{vtx} (cm);Entries" , HistType::kTH1F , {zVtxAxis});
168151
@@ -213,75 +196,22 @@ struct antidLambdaEbye {
213196 }
214197 }
215198
216- void initCCDB (aod::BCsWithTimestamps::iterator const & bc )
199+ void fillEvent (TracksFull const & tracks, soa::Filtered<aod::V0Datas> const & V0s, float const & centrality, float const & multiplicity = 0 )
217200 {
218- if (mRunNumber == bc.runNumber ()) {
219- return ;
220- }
221- auto run3grp_timestamp = bc.timestamp ();
222-
223- o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp <o2::parameters::GRPObject>(grpPath, run3grp_timestamp);
224- o2::parameters::GRPMagField* grpmag = 0x0 ;
225- if (grpo) {
226- o2::base::Propagator::initFieldFromGRP (grpo);
227- if (d_bz_input < -990 ) {
228- // Fetch magnetic field from ccdb for current collision
229- d_bz = grpo->getNominalL3Field ();
230- LOG (info) << " Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG" ;
231- } else {
232- d_bz = d_bz_input;
233- }
234- } else {
235- grpmag = ccdb->getForTimeStamp <o2::parameters::GRPMagField>(grpmagPath, run3grp_timestamp);
236- if (!grpmag) {
237- LOG (fatal) << " Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp;
238- }
239- o2::base::Propagator::initFieldFromGRP (grpmag);
240- if (d_bz_input < -990 ) {
241- // Fetch magnetic field from ccdb for current collision
242- d_bz = std::lround (5 .f * grpmag->getL3Current () / 30000 .f );
243- LOG (info) << " Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG" ;
244- } else {
245- d_bz = d_bz_input;
246- }
247- }
248- mRunNumber = bc.runNumber ();
249- }
250-
251- void process (soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>::iterator const & collision, TracksFull const & tracks, soa::Filtered<aod::V0Datas> const & V0s, aod::BCsWithTimestamps const &)
252- {
253- auto bc = collision.bc_as <aod::BCsWithTimestamps>();
254- initCCDB (bc);
255-
256- if (!collision.sel8 ())
257- return ;
258-
259- if (std::abs (collision.posZ ()) > zVtxMax)
260- return ;
261-
262- const o2::math_utils::Point3D<float > collVtx{collision.posX (), collision.posY (), collision.posZ ()};
263-
264- histos.fill (HIST (" zVtx" ), collision.posZ ());
265-
266201 double q1antid{0 .}, q2antid{0 .};
267202 for (const auto & track : tracks) {
268203 if (!selectAntid (track)) {
269204 continue ;
270205 }
271206
272- auto trackParCov = getTrackParCov (track);
273- gpu::gpustd::array<float , 2 > dcaInfo;
274- o2::base::Propagator::Instance ()->propagateToDCABxByBz (collVtx, trackParCov, 2 .f , static_cast <o2::base::Propagator::MatCorrType>(cfgMaterialCorrection.value ), &dcaInfo);
275-
276- float dcaXYZ = dcaInfo[0 ];
277- if (std::abs (dcaXYZ) > antidDcaCut) {
207+ if (std::hypot (track.dcaXY (), track.dcaZ ()) > antidDcaCut) {
278208 continue ;
279209 }
280210
281211 histos.fill (HIST (" tpcSignal" ), track.tpcInnerParam (), track.tpcSignal ());
282- histos.fill (HIST (" tpcSignal_glo" ), trackParCov. getP (), track.tpcSignal (), track.pidForTracking ());
212+ histos.fill (HIST (" tpcSignal_glo" ), track. p (), track.tpcSignal (), track.pidForTracking ());
283213
284- if (trackParCov. getPt () < antidPtMin || trackParCov. getPt () > antidPtMax) {
214+ if (track. pt () < antidPtMin || track. pt () > antidPtMax) {
285215 continue ;
286216 }
287217
@@ -298,33 +228,33 @@ struct antidLambdaEbye {
298228 continue ;
299229 }
300230 histos.fill (HIST (" tpcNsigma" ), track.tpcInnerParam (), nSigmaTPC);
301- histos.fill (HIST (" momCorr" ), trackParCov. getP (), track.tpcInnerParam () - trackParCov. getP (), track.pidForTracking ());
231+ histos.fill (HIST (" momCorr" ), track. p (), track.tpcInnerParam () - track. p (), track.pidForTracking ());
302232 // check contamination
303233 if (track.tpcInnerParam () < tpcInnerParamMax) {
304234 histos.fill (HIST (" tpcSignalBkg" ), track.tpcInnerParam (), track.tpcSignal ());
305- histos.fill (HIST (" tpcSignalBkg_glo" ), trackParCov. getP (), track.tpcSignal (), track.pidForTracking ());
235+ histos.fill (HIST (" tpcSignalBkg_glo" ), track. p (), track.tpcSignal (), track.pidForTracking ());
306236 }
307237
308- if (trackParCov. getPt () > antidPtTof && hasTof) {
309- histos.fill (HIST (" tofSignal_glo" ), trackParCov. getP (), beta);
238+ if (track. pt () > antidPtTof && hasTof) {
239+ histos.fill (HIST (" tofSignal_glo" ), track. p (), beta);
310240 histos.fill (HIST (" tofSignal" ), track.tpcInnerParam (), beta);
311241 }
312242
313243 // temporary cut to reject fake matches
314244 if (track.tpcInnerParam () < tpcInnerParamMax) {
315245 continue ;
316246 }
317- if (trackParCov. getPt () > antidPtTof && !track.hasTOF ()) {
247+ if (track. pt () > antidPtTof && !track.hasTOF ()) {
318248 continue ;
319249 }
320- histos.fill (HIST (" tofMassFull" ), trackParCov. getPt (), mass);
321- if (trackParCov. getPt () > antidPtTof && track.tofChi2 () > 3 ) {
250+ histos.fill (HIST (" tofMassFull" ), track. pt (), mass);
251+ if (track. pt () > antidPtTof && track.tofChi2 () > 3 ) {
322252 continue ;
323253 }
324- histos.fill (HIST (" tofMass" ), trackParCov. getPt (), mass);
254+ histos.fill (HIST (" tofMass" ), track. pt (), mass);
325255
326- if (trackParCov. getPt () <= antidPtTof || (trackParCov. getPt () > antidPtTof && hasTof && std::abs (mass - o2::constants::physics::MassDeuteron) < tofMassMax)) {
327- histos.fill (HIST (" tpcNsigmaGlo" ), trackParCov. getPt (), nSigmaTPC);
256+ if (track. pt () <= antidPtTof || (track. pt () > antidPtTof && hasTof && std::abs (mass - o2::constants::physics::MassDeuteron) < tofMassMax)) {
257+ histos.fill (HIST (" tpcNsigmaGlo" ), track. pt (), nSigmaTPC);
328258 q1antid += 1 .; // TODO: correct for efficiency
329259 q2antid += 1 .;
330260 }
@@ -343,7 +273,7 @@ struct antidLambdaEbye {
343273
344274 auto pos = v0.template posTrack_as <TracksFull>();
345275 auto neg = v0.template negTrack_as <TracksFull>();
346- if (std::abs (pos.eta ()) > etaMax || std::abs (pos .eta ()) > etaMax) {
276+ if (std::abs (pos.eta ()) > etaMax || std::abs (neg .eta ()) > etaMax) {
347277 continue ;
348278 }
349279
@@ -374,24 +304,55 @@ struct antidLambdaEbye {
374304 return ;
375305 }
376306
377- histos.fill (HIST (" nEv" ), collision.centFT0C ());
307+ histos.fill (HIST (" nEv" ), centrality);
308+
309+ histos.fill (HIST (" q1antid" ), centrality, q1antid);
310+ histos.fill (HIST (" q1sqantid" ), centrality, std::pow (q1antid, 2 ));
311+ histos.fill (HIST (" q2antid" ), centrality, q2antid);
378312
379- histos.fill (HIST (" q1antid" ), collision.centFT0C (), q1antid);
380- histos.fill (HIST (" q1sqantid" ), collision.centFT0C (), std::pow (q1antid, 2 ));
381- histos.fill (HIST (" q2antid" ), collision.centFT0C (), q2antid);
313+ histos.fill (HIST (" q1L" ), centrality, q1L);
314+ histos.fill (HIST (" q1sqL" ), centrality, std::pow (q1L, 2 ));
315+ histos.fill (HIST (" q2L" ), centrality, q2L);
316+
317+ histos.fill (HIST (" q1antiL" ), centrality, q1antiL);
318+ histos.fill (HIST (" q1sqantiL" ), centrality, std::pow (q1antiL, 2 ));
319+ histos.fill (HIST (" q2antiL" ), centrality, q2antiL);
320+
321+ histos.fill (HIST (" q11LantiL" ), centrality, q1L * q1antiL);
322+ histos.fill (HIST (" q11Lantid" ), centrality, q1L * q1antid);
323+ histos.fill (HIST (" q11antiLantid" ), centrality, q1antiL * q1antid);
324+ }
382325
383- histos.fill (HIST (" q1L" ), collision.centFT0C (), q1L);
384- histos.fill (HIST (" q1sqL" ), collision.centFT0C (), std::pow (q1L, 2 ));
385- histos.fill (HIST (" q2L" ), collision.centFT0C (), q2L);
326+ void processRun3 (soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>::iterator const & collision, TracksFull const & tracks, soa::Filtered<aod::V0Datas> const & V0s)
327+ {
328+ if (!collision.sel8 ())
329+ return ;
386330
387- histos.fill (HIST (" q1antiL" ), collision.centFT0C (), q1antiL);
388- histos.fill (HIST (" q1sqantiL" ), collision.centFT0C (), std::pow (q1antiL, 2 ));
389- histos.fill (HIST (" q2antiL" ), collision.centFT0C (), q2antiL);
331+ if (std::abs (collision.posZ ()) > zVtxMax)
332+ return ;
390333
391- histos.fill (HIST (" q11LantiL" ), collision.centFT0C (), q1L * q1antiL);
392- histos.fill (HIST (" q11Lantid" ), collision.centFT0C (), q1L * q1antid);
393- histos.fill (HIST (" q11antiLantid" ), collision.centFT0C (), q1antiL * q1antid);
334+ histos.fill (HIST (" zVtx" ), collision.posZ ());
335+ auto centrality = collision.centFT0C ();
336+ fillEvent (tracks, V0s, centrality);
337+ }
338+ PROCESS_SWITCH (antidLambdaEbye, processRun3, " process (Run 3)" , false );
339+
340+ void processRun2 (soa::Join<aod::Collisions, aod::EvSels, aod::FV0Mults, aod::CentRun2V0Ms>::iterator const & collision, TracksFull const & tracks, soa::Filtered<aod::V0Datas> const & V0s)
341+ {
342+ if (!collision.sel7 ())
343+ return ;
344+
345+ if (!collision.alias_bit (kINT7 ))
346+ return ;
347+
348+ if (std::abs (collision.posZ ()) > zVtxMax)
349+ return ;
350+
351+ histos.fill (HIST (" zVtx" ), collision.posZ ());
352+ auto centrality = collision.centRun2V0M ();
353+ fillEvent (tracks, V0s, centrality);
394354 }
355+ PROCESS_SWITCH (antidLambdaEbye, processRun2, " process (Run 2)" , false );
395356};
396357
397358WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments