Skip to content

Commit a118336

Browse files
committed
update
1 parent efc8457 commit a118336

1 file changed

Lines changed: 28 additions & 50 deletions

File tree

Common/Tasks/centralityStudy.cxx

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,20 @@ struct centralityStudy {
5353
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
5454
std::map<std::string, HistPtr> histPointers;
5555
std::string histPath;
56-
Service<o2::ccdb::BasicCCDBManager> mCcdb;
56+
Service<o2::ccdb::BasicCCDBManager> ccdb;
5757
ctpRateFetcher mRateFetcher;
5858
int mRunNumber;
5959
uint64_t startOfRunTimestamp;
6060

6161
// vertex Z equalization
62-
TList* hCalibObjects;
63-
TProfile* hVtxZFV0A;
64-
TProfile* hVtxZFT0A;
65-
TProfile* hVtxZFT0C;
66-
TProfile* hVtxZNTracks;
67-
TProfile* hVtxZNGlobals;
68-
TProfile* hVtxZMFT;
69-
TProfile* hVtxZFDDA;
70-
TProfile* hVtxZFDDC;
62+
TProfile* hVtxZFV0A = nullptr;
63+
TProfile* hVtxZFT0A = nullptr;
64+
TProfile* hVtxZFT0C = nullptr;
65+
TProfile* hVtxZNTracks = nullptr;
66+
TProfile* hVtxZNGlobals = nullptr;
67+
TProfile* hVtxZMFT = nullptr;
68+
TProfile* hVtxZFDDA = nullptr;
69+
TProfile* hVtxZFDDC = nullptr;
7170

7271
// calibration histograms
7372
TH1* hCentralityFV0A = nullptr;
@@ -93,15 +92,15 @@ struct centralityStudy {
9392
Configurable<float> minTimeDelta{"minTimeDelta", -1.0f, "reject collision if another collision is this close or less in time"};
9493

9594
struct : ConfigurableGroup {
96-
std::string prefix = "ccdb";
95+
std::string prefix = "ccdbSettings";
9796
Configurable<std::string> ccdbURL{"ccdbURL", "http://alice-ccdb.cern.ch", "ccdb url"};
98-
Configurable<std::string> pathCentrality{"pathCentrality", "Centrality/Estimators", "path to centrality calibration"};
97+
Configurable<std::string> pathCentrality{"pathCentrality", "Centrality/Estimators", "path to centrality calibration if fetchCentralityCalibration is enabled"};
9998
Configurable<std::string> pathGRPECSObject{"pathGRPECSObject", "GLO/Config/GRPECS", "Path to GRPECS object"};
10099
Configurable<std::string> pathVertexZ{"pathVertexZ", "Users/d/ddobrigk/Centrality/Calibration", "Path to vertexZ profiles"};
101100
Configurable<std::string> irSource{"irSource", "ZNC hadronic", "Source of the interaction rate: (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
102101
Configurable<bool> irCrashOnNull{"irCrashOnNull", false, "Flag to avoid CTP RateFetcher crash."};
103102
Configurable<bool> fetchCentralityCalibration{"fetchCentralityCalibration", false, "Flag to fetch the centrality calibration within the task instead of the centrality table"};
104-
} ccdb;
103+
} ccdbSettings;
105104

106105
// _______________________________________
107106
// Configurable group
@@ -151,7 +150,6 @@ struct centralityStudy {
151150
Configurable<float> vertexZwithT0{"vertexZwithT0", 1000.0f, "require a certain vertex-Z in BC analysis"};
152151
Configurable<bool> rejectIsFlangeEvent{"rejectIsFlangeEvent", false, "At least one channel with -350 TDC < time < -450 TDC"};
153152
Configurable<float> minFT0CforVertexZ{"minFT0CforVertexZ", -1.0f, "minimum FT0C for vertex-Z profile calculation"};
154-
155153
} bcsel;
156154

157155
// _______________________________________
@@ -226,29 +224,10 @@ struct centralityStudy {
226224

227225
void init(InitContext&)
228226
{
229-
hCalibObjects = nullptr;
230-
hVtxZFV0A = nullptr;
231-
hVtxZFT0A = nullptr;
232-
hVtxZFT0C = nullptr;
233-
hVtxZNTracks = nullptr;
234-
hVtxZNGlobals = nullptr;
235-
hVtxZMFT = nullptr;
236-
hVtxZFDDA = nullptr;
237-
hVtxZFDDC = nullptr;
238-
239-
hCentralityFV0A = nullptr;
240-
hCentralityFT0A = nullptr;
241-
hCentralityFT0C = nullptr;
242-
hCentralityFT0M = nullptr;
243-
hCentralityFDDM = nullptr;
244-
hCentralityNTPV = nullptr;
245-
hCentralityNGlo = nullptr;
246-
hCentralityMFT = nullptr;
247-
248-
mCcdb->setURL(ccdb.ccdbURL);
249-
// mCcdb->setCaching(true);
250-
// mCcdb->setLocalObjectValidityChecking();
251-
mCcdb->setFatalWhenNull(false);
227+
ccdb->setURL(ccdbSettings.ccdbURL);
228+
// ccdb->setCaching(true);
229+
// ccdb->setLocalObjectValidityChecking();
230+
ccdb->setFatalWhenNull(false);
252231

253232
if (doprocessCollisions || doprocessCollisionsWithCentrality) {
254233
histos.add("hCollisionSelection", "hCollisionSelection", kTH1D, {{20, -0.5f, +19.5f}});
@@ -324,7 +303,7 @@ struct centralityStudy {
324303
histos.add("hFT0COccupancyVsNGlobalTracksVsFT0C", "hFT0COccupancyVsNGlobalTracksVsFT0C", kTH3F, {axisFT0COccupancy, axisMultGlobalTracks, axisMultFT0C});
325304
}
326305

327-
if (doprocessCollisionsWithCentrality || ccdb.fetchCentralityCalibration) {
306+
if (doprocessCollisionsWithCentrality || ccdbSettings.fetchCentralityCalibration) {
328307
// in case requested: do vs centrality debugging
329308
histos.add("hCentrality", "hCentrality", kTH1F, {axisCentrality});
330309
histos.add("hNContribsVsCentrality", "hNContribsVsCentrality", kTH2F, {axisCentrality, axisMultPVContributors});
@@ -413,13 +392,13 @@ struct centralityStudy {
413392
LOGF(info, "Setting up for run: %i", mRunNumber);
414393

415394
// only get object when switching runs
416-
o2::parameters::GRPECSObject* grpo = mCcdb->getForRun<o2::parameters::GRPECSObject>(ccdb.pathGRPECSObject, mRunNumber);
395+
o2::parameters::GRPECSObject* grpo = ccdb->getForRun<o2::parameters::GRPECSObject>(ccdbSettings.pathGRPECSObject, mRunNumber);
417396
startOfRunTimestamp = grpo->getTimeStart();
418397

419398
if (applyVertexZEqualization.value) {
420399
// acquire vertex-Z equalization histograms if requested
421400
LOGF(info, "Acquiring vertex-Z profiles for run %i", mRunNumber);
422-
hCalibObjects = mCcdb->getForRun<TList>(ccdb.pathVertexZ, mRunNumber);
401+
TList* hCalibObjects = ccdb->getForRun<TList>(ccdbSettings.pathVertexZ, mRunNumber);
423402

424403
hVtxZFV0A = static_cast<TProfile*>(hCalibObjects->FindObject("hVtxZFV0A"));
425404
hVtxZFT0A = static_cast<TProfile*>(hCalibObjects->FindObject("hVtxZFT0A"));
@@ -436,10 +415,9 @@ struct centralityStudy {
436415
}
437416
}
438417

439-
if (ccdb.fetchCentralityCalibration) {
418+
if (ccdbSettings.fetchCentralityCalibration) {
440419
LOGF(info, "Acquiring centrality calibration for run %i", mRunNumber);
441-
TList* hCentralityObjects = nullptr;
442-
hCentralityObjects = mCcdb->getForRun<TList>(ccdb.pathCentrality, mRunNumber);
420+
TList* hCentralityObjects = ccdb->getForRun<TList>(ccdbSettings.pathCentrality, mRunNumber);
443421
hCentralityFV0A = dynamic_cast<TH1*>(hCentralityObjects->FindObject("hCalibZeqFV0"));
444422
hCentralityFT0A = dynamic_cast<TH1*>(hCentralityObjects->FindObject("hCalibZeqFT0A"));
445423
hCentralityFT0C = dynamic_cast<TH1*>(hCentralityObjects->FindObject("hCalibZeqFT0C"));
@@ -450,7 +428,7 @@ struct centralityStudy {
450428
hCentralityMFT = dynamic_cast<TH1*>(hCentralityObjects->FindObject("hCalibZeqMFT"));
451429

452430
// won't capture null pointers -> explicitly check for those when attempting to evaluate
453-
auto reportSuccess = [](TH1* hist, std::string name) {
431+
auto reportSuccess = [](TH1* hist, const std::string& name) {
454432
if (!hist) {
455433
LOGF(info, "Calibration missing for %s", name);
456434
} else {
@@ -570,7 +548,7 @@ struct centralityStudy {
570548
histPointers.insert({histPath + "hFDDCVsFT0C", histos.add((histPath + "hFDDCVsFT0C").c_str(), "hFDDCVsFT0C", {kTH2F, {{axisMultFT0C, axisMultFDDC}}})});
571549
}
572550

573-
if (doprocessCollisionsWithCentrality || ccdb.fetchCentralityCalibration) {
551+
if (doprocessCollisionsWithCentrality || ccdbSettings.fetchCentralityCalibration) {
574552
// in case requested: do vs centrality debugging
575553
histPointers.insert({histPath + "hCentrality", histos.add((histPath + "hCentrality").c_str(), "hCentrality", {kTH1F, {{axisCentrality}}})});
576554
histPointers.insert({histPath + "hNContribsVsCentrality", histos.add((histPath + "hNContribsVsCentrality").c_str(), "hNContribsVsCentrality", {kTH2F, {{axisCentrality, axisMultPVContributors}}})});
@@ -937,7 +915,7 @@ struct centralityStudy {
937915

938916
// if the table has centrality information
939917
// process FT0C centrality plots
940-
if (doprocessCollisionsWithCentrality || ccdb.fetchCentralityCalibration) {
918+
if (doprocessCollisionsWithCentrality || ccdbSettings.fetchCentralityCalibration) {
941919
histos.fill(HIST("hCentrality"), centFT0C);
942920
histos.fill(HIST("hNContribsVsCentrality"), centFT0C, collision.multPVTotalContributors());
943921
histos.fill(HIST("hNITSTPCTracksVsCentrality"), centFT0C, collision.multNTracksITSTPC());
@@ -973,9 +951,9 @@ struct centralityStudy {
973951
if (collision.has_multBC()) {
974952
auto multbc = collision.template multBC_as<aod::MultBCs>();
975953
const uint64_t bcTimestamp = multbc.timestamp();
976-
const float interactionRate = mRateFetcher.fetch(mCcdb.service, bcTimestamp, mRunNumber, ccdb.irSource.value, ccdb.irCrashOnNull) / 1000.; // kHz
954+
const float interactionRate = mRateFetcher.fetch(ccdb.service, bcTimestamp, mRunNumber, ccdbSettings.irSource.value, ccdbSettings.irCrashOnNull) / 1000.; // kHz
977955
histos.fill(HIST("hInteractionRate"), interactionRate);
978-
if (doprocessCollisionsWithCentrality || ccdb.fetchCentralityCalibration) {
956+
if (doprocessCollisionsWithCentrality || ccdbSettings.fetchCentralityCalibration) {
979957
histos.fill(HIST("hInteractionRateVsCentrality"), centFT0C, interactionRate);
980958
}
981959
if (studies.doRunByRunHistograms) {
@@ -1125,8 +1103,8 @@ struct centralityStudy {
11251103
histos.fill(HIST("hFV0A_BCs"), multbc.multFV0A() * scale.factorFV0A);
11261104
histos.fill(HIST("hFV0AT0C_BCs"), (multbc.multFV0A() + multbc.multFT0C()) * scale.factorFV0AT0C);
11271105

1128-
uint64_t bcTimestamp = multbc.timestamp();
1129-
const float interactionRate = mRateFetcher.fetch(mCcdb.service, bcTimestamp, mRunNumber, ccdb.irSource.value, ccdb.irCrashOnNull) / 1000.; // kHz
1106+
const uint64_t bcTimestamp = multbc.timestamp();
1107+
const float interactionRate = mRateFetcher.fetch(ccdb.service, bcTimestamp, mRunNumber, ccdbSettings.irSource.value, ccdbSettings.irCrashOnNull) / 1000.; // kHz
11301108
histos.fill(HIST("hInteractionRate_BCs"), interactionRate);
11311109

11321110
if (studies.do2DPlots) {

0 commit comments

Comments
 (0)