2727#include " Framework/ASoA.h"
2828#include " Common/DataModel/EventSelection.h"
2929#include " Common/DataModel/TrackSelectionTables.h"
30+ // #include "ReconstructionDataFormats/MatchInfoHMP.h"
31+
32+ #include " tableHMPID.h"
33+
34+ #include " CCDB/BasicCCDBManager.h"
35+ #include " CCDB/CcdbApi.h"
3036
3137#include < TTree.h>
3238
3339using namespace o2 ;
3440using namespace o2 ::framework;
3541using namespace o2 ::framework::expressions;
42+ using namespace o2 ::constants::physics;
3643
37- namespace o2 ::aod
38- {
39-
40- namespace variables_table // declaration of columns to create
41- {
42- DECLARE_SOA_COLUMN (ChAngle, chAngle, float );
43- DECLARE_SOA_COLUMN (Phi, phi, float );
44- DECLARE_SOA_COLUMN (Eta, eta, float );
45- DECLARE_SOA_COLUMN (MomentumHMPID, momentumHMPID, float );
46- DECLARE_SOA_COLUMN (MomentumTrack, momentumTrack, float );
47- DECLARE_SOA_COLUMN (Xtrack, xtrack, float );
48- DECLARE_SOA_COLUMN (Ytrack, ytrack, float );
49- DECLARE_SOA_COLUMN (Xmip, xmip, float );
50- DECLARE_SOA_COLUMN (Ymip, ymip, float );
51- DECLARE_SOA_COLUMN (Nphotons, nphotons, float );
52- DECLARE_SOA_COLUMN (ChargeMIP, chargeMIP, float );
53- DECLARE_SOA_COLUMN (ClusterSize, clustersize, float );
54- DECLARE_SOA_COLUMN (Chamber, chamber, float );
55- DECLARE_SOA_COLUMN (Photons_charge, photons_charge, float [10 ]);
56-
57- DECLARE_SOA_COLUMN (EtaTrack, etatrack, float );
58- DECLARE_SOA_COLUMN (PhiTrack, phitrack, float );
59-
60- DECLARE_SOA_COLUMN (ITSNcluster, itsNcluster, float );
61- DECLARE_SOA_COLUMN (TPCNcluster, tpcNcluster, float );
62- DECLARE_SOA_COLUMN (TPCNClsCrossedRows, tpcNClsCrossedRows, float );
63- DECLARE_SOA_COLUMN (TPCchi2, tpcChi2, float );
64- DECLARE_SOA_COLUMN (ITSchi2, itsChi2, float );
65-
66- DECLARE_SOA_COLUMN (DCAxy, dcaxy, float );
67- DECLARE_SOA_COLUMN (DCAz, dcaz, float );
68-
69- DECLARE_SOA_COLUMN (TPCNSigmaPi, tpcNsigmaPi, float );
70- DECLARE_SOA_COLUMN (TOFNSigmaPi, tofNsigmaPi, float );
71- DECLARE_SOA_COLUMN (TPCNSigmaKa, tpcNsigmaKa, float );
72- DECLARE_SOA_COLUMN (TOFNSigmaKa, tofNsigmaKa, float );
73- DECLARE_SOA_COLUMN (TPCNSigmaPr, tpcNsigmaPr, float );
74- DECLARE_SOA_COLUMN (TOFNSigmaPr, tofNsigmaPr, float );
75- DECLARE_SOA_COLUMN (TPCNSigmaDe, tpcNsigmaDe, float );
76- DECLARE_SOA_COLUMN (TOFNSigmaDe, tofNsigmaDe, float );
77-
78- } // namespace variables_table
79-
80- DECLARE_SOA_TABLE (HMPID_analysis, " AOD" , " HMPIDANALYSIS" ,
81- variables_table::ChAngle, variables_table::Phi, variables_table::Eta, variables_table::MomentumHMPID,
82- variables_table::MomentumTrack, variables_table::Xtrack, variables_table::Ytrack, variables_table::Xmip,
83- variables_table::Ymip, variables_table::Nphotons, variables_table::ChargeMIP, variables_table::ClusterSize,
84- variables_table::Chamber, variables_table::Photons_charge, variables_table::EtaTrack, variables_table::PhiTrack,
85- variables_table::ITSNcluster, variables_table::TPCNcluster, variables_table::TPCNClsCrossedRows,
86- variables_table::TPCchi2, variables_table::ITSchi2, variables_table::DCAxy, variables_table::DCAz,
87- variables_table::TPCNSigmaPi, variables_table::TOFNSigmaPi, variables_table::TPCNSigmaKa, variables_table::TOFNSigmaKa,
88- variables_table::TPCNSigmaPr, variables_table::TOFNSigmaPr, variables_table::TPCNSigmaDe, variables_table::TOFNSigmaDe);
89- } // namespace o2::aod
9044
9145struct pidHmpidAnalysis {
9246
47+ HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
48+
49+ const AxisSpec axisEvtCounter{1 , 0 , +1 , " " };
50+
51+
52+ // CCDB configurable
53+ Service<o2::ccdb::BasicCCDBManager> ccdb;
54+ struct : ConfigurableGroup {
55+ Configurable<std::string> ccdburl{" ccdb-url" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
56+ } ccdbConfig;
57+
58+
9359 Produces<aod::HMPID_analysis> HMPID_analysis;
9460
9561 // using TrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection>;
@@ -100,21 +66,44 @@ struct pidHmpidAnalysis {
10066 aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTPCFullDe,
10167 aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFFullDe>;
10268
103- void process (const aod::HMPIDs& hmpids,
104- TrackCandidates const &,
105- CollisionCandidates const &)
69+
70+ void init (o2::framework::InitContext&)
10671 {
72+ // Configure CCDB
73+ ccdb->setURL (ccdbConfig.ccdburl );
74+ ccdb->setCaching (true );
75+ ccdb->setLocalObjectValidityChecking ();
10776
108- for (const auto & t : hmpids) {
109- if (t.track_as <TrackCandidates>().isGlobalTrack () != (uint8_t ) true ) {
110- continue ;
111- }
77+ histos.add (" eventCounter" , " eventCounter" , kTH1F , {axisEvtCounter});
78+ }
11279
113- const auto & track = t.track_as <TrackCandidates>();
80+ // function to manage ccdb
81+ int mCCDBRunNumber = 0 ;
82+ void initCCDB (aod::BCsWithTimestamps::iterator const & bc)
83+ {
84+ if (mCCDBRunNumber == bc.runNumber ()) {
85+ return ;
86+ }
87+ mCCDBRunNumber = bc.runNumber ();
88+ }
11489
115- if (!track.hasITS () || !track.hasTPC () || !track.hasTOF ()) {
116- continue ;
117- }
90+ void process (aod::Collision const & event,
91+ const aod::HMPIDs& hmpids,
92+ TrackCandidates const &,
93+ aod::BCsWithTimestamps const &)
94+ {
95+ // counter for all events processed (move into tracks loop if good event counter is needed)
96+ histos.fill (HIST (" eventCounter" ), 0.5 );
97+
98+ initCCDB (event.bc_as <aod::BCsWithTimestamps>());
99+
100+ // loop sulle tracce hmpid
101+ for (const auto & t : hmpids)
102+ {
103+ // global tracks associated to hmpid tracks
104+ const auto & global_track = t.track_as <TrackCandidates>();
105+ if (!global_track.isGlobalTrack ()) continue ;
106+ if (!global_track.hasITS () || !global_track.hasTPC () || !global_track.hasTOF ()) continue ;
118107
119108 float hmpidPhotsCharge2[10 ];
120109
@@ -123,14 +112,14 @@ struct pidHmpidAnalysis {
123112 }
124113
125114 // ///FILL TABLE
126- HMPID_analysis (t.hmpidSignal (), t. track_as <TrackCandidates>(). phi (), t. track_as <TrackCandidates>() .eta (), t.hmpidMom (),
127- track .p (), t.hmpidXTrack (), t.hmpidYTrack (), t.hmpidXMip (),
115+ HMPID_analysis (t.hmpidSignal (), global_track. phi (), global_track .eta (), t.hmpidMom (),
116+ global_track .p (), t.hmpidXTrack (), t.hmpidYTrack (), t.hmpidXMip (),
128117 t.hmpidYMip (), t.hmpidNPhotons (), t.hmpidQMip (), (t.hmpidClusSize () % 1000000 ) / 1000 , t.hmpidClusSize () / 1000000 ,
129- hmpidPhotsCharge2, track .eta (), track .phi (), track. itsNCls (), track. tpcNClsFound (), track. tpcNClsCrossedRows (),
130- track. tpcChi2NCl (), track. itsChi2NCl (), track. dcaXY (), track. dcaZ (),
131- track. tpcNSigmaPi (), track .tofNSigmaPi (), track .tpcNSigmaKa (), track .tofNSigmaKa (),
132- track .tpcNSigmaPr (), track .tofNSigmaPr (), track .tpcNSigmaDe (), track .tofNSigmaDe ());
133- }
118+ hmpidPhotsCharge2, global_track .eta (), global_track .phi (), global_track. px (), global_track. py (), global_track. pz (),
119+ global_track. itsNCls (), global_track. tpcNClsFound (), global_track. tpcNClsCrossedRows (),global_track. tpcChi2NCl (), global_track. itsChi2NCl (),
120+ global_track. dcaXY (), global_track. dcaZ (), global_track. tpcNSigmaPi (), global_track .tofNSigmaPi (), global_track .tpcNSigmaKa (), global_track .tofNSigmaKa (),
121+ global_track .tpcNSigmaPr (), global_track .tofNSigmaPr (), global_track .tpcNSigmaDe (), global_track .tofNSigmaDe ());
122+ } // end hmpid tracks loop
134123 }
135124};
136125
0 commit comments