Skip to content

Commit 823cb00

Browse files
committed
Adding new HMPID tasks
1 parent d290f82 commit 823cb00

File tree

8 files changed

+4161
-74
lines changed

8 files changed

+4161
-74
lines changed

DPG/Tasks/AOTTrack/PID/HMPID/CMakeLists.txt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,27 @@
1010
# or submit itself to any jurisdiction.
1111

1212
# HMPID
13-
o2physics_add_dpl_workflow(pid-hmpid-qa
14-
SOURCES qaHMPID.cxx
15-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
13+
o2physics_add_dpl_workflow(pid-hmpid-qa-pp
14+
SOURCES qaHMPID_pp.cxx
15+
PUBLIC_LINK_LIBRARIES O2::HMPIDBase O2Physics::AnalysisCore
16+
COMPONENT_NAME Analysis)
17+
18+
o2physics_add_dpl_workflow(pid-hmpid-qa-pb
19+
SOURCES qaHMPID_pb.cxx
20+
PUBLIC_LINK_LIBRARIES O2::HMPIDBase O2Physics::AnalysisCore
1621
COMPONENT_NAME Analysis)
1722

1823
o2physics_add_dpl_workflow(pid-hmpid
1924
SOURCES analysisHMPID.cxx
2025
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
2126
COMPONENT_NAME Analysis)
27+
28+
o2physics_add_dpl_workflow(pid-hmpid-pbpb
29+
SOURCES analysisHMPID_pb.cxx
30+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase
31+
COMPONENT_NAME Analysis)
32+
33+
o2physics_add_dpl_workflow(pid-hmpid-deuteron
34+
SOURCES deuteronCS_HMPID.cxx
35+
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::ReconstructionDataFormats O2Physics::AnalysisCore
36+
COMPONENT_NAME Analysis)

DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx

Lines changed: 60 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -27,69 +27,35 @@
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

3339
using namespace o2;
3440
using namespace o2::framework;
3541
using 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

9145
struct 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

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
// O2 includes
13+
#include "ReconstructionDataFormats/Track.h"
14+
#include "Framework/runDataProcessing.h"
15+
#include "Framework/AnalysisTask.h"
16+
#include "Framework/AnalysisDataModel.h"
17+
#include "Framework/HistogramRegistry.h"
18+
#include "Framework/RunningWorkflowInfo.h"
19+
#include "ReconstructionDataFormats/TrackParametrization.h"
20+
#include "Common/DataModel/PIDResponse.h"
21+
#include "Common/Core/PID/PIDTOF.h"
22+
#include "Common/TableProducer/PID/pidTOFBase.h"
23+
#include "ReconstructionDataFormats/PID.h"
24+
#include "Common/Core/trackUtilities.h"
25+
#include "ReconstructionDataFormats/DCA.h"
26+
#include "Framework/ASoAHelpers.h"
27+
#include "Framework/ASoA.h"
28+
#include "Common/DataModel/EventSelection.h"
29+
#include "Common/DataModel/TrackSelectionTables.h"
30+
31+
#include "Common/DataModel/Multiplicity.h"
32+
#include "Common/DataModel/Centrality.h"
33+
34+
#include "tableHMPIDPb.h"
35+
#include "CCDB/BasicCCDBManager.h"
36+
#include "CCDB/CcdbApi.h"
37+
38+
#include <TTree.h>
39+
40+
41+
//CREATE AND FILL TABLE FOR PBPB COLLISIONS
42+
43+
using namespace o2;
44+
using namespace o2::framework;
45+
using namespace o2::framework::expressions;
46+
using namespace o2::constants::physics;
47+
48+
struct pidHmpidAnalysisPb {
49+
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
50+
51+
const AxisSpec axisEvtCounter{1, 0, +1, ""};
52+
53+
54+
// CCDB configurable
55+
Service<o2::ccdb::BasicCCDBManager> ccdb;
56+
struct : ConfigurableGroup {
57+
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
58+
} ccdbConfig;
59+
60+
61+
62+
Produces<aod::HMPID_analysisPb> HMPID_analysisPb;
63+
64+
// using TrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection>;
65+
66+
using CollisionCandidates = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>;
67+
68+
using TrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection,
69+
aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTPCFullDe,
70+
aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFFullDe>;
71+
72+
//using CentralityClass = o2::soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFV0As>;
73+
74+
75+
void init(o2::framework::InitContext&)
76+
{
77+
// Configure CCDB
78+
ccdb->setURL(ccdbConfig.ccdburl);
79+
ccdb->setCaching(true);
80+
ccdb->setLocalObjectValidityChecking();
81+
82+
histos.add("eventCounter", "eventCounter", kTH1F, {axisEvtCounter});
83+
}
84+
85+
//function to manage ccdb
86+
int mCCDBRunNumber = 0;
87+
void initCCDB(aod::BCsWithTimestamps::iterator const& bc)
88+
{
89+
if (mCCDBRunNumber == bc.runNumber()) {
90+
return;
91+
}
92+
mCCDBRunNumber = bc.runNumber();
93+
}
94+
95+
96+
97+
void process(soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFV0As>::iterator const& col,
98+
const aod::HMPIDs& hmpids,
99+
TrackCandidates const&,
100+
aod::BCsWithTimestamps const&)
101+
{
102+
histos.fill(HIST("eventCounter"), 0.5);
103+
104+
initCCDB(col.bc_as<aod::BCsWithTimestamps>());
105+
106+
107+
for (const auto& t : hmpids) {
108+
109+
//global tracks associated to hmpid tracks
110+
const auto& global_track = t.track_as<TrackCandidates>();
111+
if (!global_track.isGlobalTrack()) continue;
112+
if (!global_track.hasITS() || !global_track.hasTPC() || !global_track.hasTOF()) continue;
113+
114+
115+
// Verifica se la collisione è accessibile
116+
if (!global_track.has_collision()) {
117+
continue;
118+
}
119+
120+
float hmpidPhotsCharge2[10];
121+
122+
for (int i = 0; i < 10; i++) {
123+
hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i];
124+
}
125+
126+
float centrality = col.centFV0A();
127+
128+
/////FILL TABLE
129+
HMPID_analysisPb(t.hmpidSignal(), global_track.phi(), global_track.eta(), t.hmpidMom(),
130+
global_track.p(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(),
131+
t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, t.hmpidClusSize() / 1000000,
132+
hmpidPhotsCharge2, global_track.eta(), global_track.phi(), global_track.px(), global_track.py(), global_track.pz(),
133+
global_track.itsNCls(), global_track.tpcNClsFound(), global_track.tpcNClsCrossedRows(),global_track.tpcChi2NCl(), global_track.itsChi2NCl(),
134+
global_track.dcaXY(), global_track.dcaZ(), global_track.tpcNSigmaPi(), global_track.tofNSigmaPi(), global_track.tpcNSigmaKa(), global_track.tofNSigmaKa(),
135+
global_track.tpcNSigmaPr(), global_track.tofNSigmaPr(), global_track.tpcNSigmaDe(), global_track.tofNSigmaDe(),centrality);
136+
}
137+
}
138+
};
139+
140+
WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { return WorkflowSpec{adaptAnalysisTask<pidHmpidAnalysisPb>(cfg)}; }

0 commit comments

Comments
 (0)