Skip to content

Commit d02ad1e

Browse files
authored
[Common] improve pvz QA histogram filling
1 parent ccc8508 commit d02ad1e

File tree

1 file changed

+50
-32
lines changed

1 file changed

+50
-32
lines changed

Common/Tasks/centralityStudy.cxx

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct centralityStudy {
4747
Service<o2::ccdb::BasicCCDBManager> ccdb;
4848
ctpRateFetcher mRateFetcher;
4949
int mRunNumber;
50-
uint64_t startOfRunTimestamp;
5150

5251
// Configurables
5352
Configurable<bool> do2DPlots{"do2DPlots", true, "0 - no, 1 - yes"};
@@ -64,10 +63,10 @@ struct centralityStudy {
6463
// Apply extra event selections
6564
Configurable<bool> rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"};
6665
Configurable<bool> rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"};
67-
Configurable<bool> requireIsVertexITSTPC{"requireIsVertexITSTPC", true, "require events with at least one ITS-TPC track"};
68-
Configurable<bool> requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"};
69-
Configurable<bool> requireIsVertexTOFmatched{"requireIsVertexTOFmatched", true, "require events with at least one of vertex contributors matched to TOF"};
70-
Configurable<bool> requireIsVertexTRDmatched{"requireIsVertexTRDmatched", true, "require events with at least one of vertex contributors matched to TRD"};
66+
Configurable<bool> requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track"};
67+
Configurable<bool> requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", false, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"};
68+
Configurable<bool> requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"};
69+
Configurable<bool> requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"};
7170
Configurable<bool> rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"};
7271

7372
Configurable<bool> rejectITSinROFpileupStandard{"rejectITSinROFpileupStandard", false, "reject collisions in case of in-ROF ITS pileup (standard)"};
@@ -82,7 +81,7 @@ struct centralityStudy {
8281
Configurable<float> vertexZwithT0{"vertexZwithT0", 1000.0f, "require a certain vertex-Z in BC analysis"};
8382

8483
Configurable<float> minTimeDelta{"minTimeDelta", -1.0f, "reject collision if another collision is this close or less in time"};
85-
Configurable<float> minFT0CforVertexZ{"minFT0CforVertexZ", 250, "minimum FT0C for vertex-Z profile calculation"};
84+
Configurable<float> minFT0CforVertexZ{"minFT0CforVertexZ", -1.0f, "minimum FT0C for vertex-Z profile calculation"};
8685

8786
Configurable<float> scaleSignalFT0C{"scaleSignalFT0C", 1.00f, "scale FT0C signal for convenience"};
8887
Configurable<float> scaleSignalFT0M{"scaleSignalFT0M", 1.00f, "scale FT0M signal for convenience"};
@@ -257,8 +256,8 @@ struct centralityStudy {
257256

258257
if (doTimeStudies) {
259258
ccdb->setURL(ccdbURL);
260-
// ccdb->setCaching(true);
261-
// ccdb->setLocalObjectValidityChecking();
259+
ccdb->setCaching(true);
260+
ccdb->setLocalObjectValidityChecking();
262261
ccdb->setFatalWhenNull(false);
263262
if (doTimeStudyFV0AOuterVsFT0A3d) {
264263
histos.add((histPath + "h3dFV0AVsTime").c_str(), "", {kTH3F, {{axisDeltaTimestamp, axisMultCoarseFV0A, axisMultCoarseFV0A}}});
@@ -274,13 +273,6 @@ struct centralityStudy {
274273
}
275274

276275
mRunNumber = collision.multRunNumber();
277-
278-
LOGF(info, "Setting up for run: %i", mRunNumber);
279-
280-
// only get object when switching runs
281-
o2::parameters::GRPECSObject* grpo = ccdb->getForRun<o2::parameters::GRPECSObject>(pathGRPECSObject, mRunNumber);
282-
startOfRunTimestamp = grpo->getTimeStart();
283-
284276
histPath = std::format("Run_{}/", mRunNumber);
285277

286278
if (doprocessCollisions || doprocessCollisionsWithCentrality) {
@@ -307,10 +299,12 @@ struct centralityStudy {
307299
histPointers.insert({histPath + "hNPVContributors", histos.add((histPath + "hNPVContributors").c_str(), "hNPVContributors", {kTH1D, {{axisMultUltraFinePVContributors}}})});
308300

309301
histPointers.insert({histPath + "hFT0CvsPVz_Collisions_All", histos.add((histPath + "hFT0CvsPVz_Collisions_All").c_str(), "hFT0CvsPVz_Collisions_All", {kTProfile, {{axisPVz}}})});
302+
histPointers.insert({histPath + "hFT0AvsPVz_Collisions", histos.add((histPath + "hFT0AvsPVz_Collisions").c_str(), "hFT0AvsPVz_Collisions", {kTProfile, {{axisPVz}}})});
310303
histPointers.insert({histPath + "hFT0CvsPVz_Collisions", histos.add((histPath + "hFT0CvsPVz_Collisions").c_str(), "hFT0CvsPVz_Collisions", {kTProfile, {{axisPVz}}})});
311304
histPointers.insert({histPath + "hFV0AvsPVz_Collisions", histos.add((histPath + "hFV0AvsPVz_Collisions").c_str(), "hFV0AvsPVz_Collisions", {kTProfile, {{axisPVz}}})});
312305
histPointers.insert({histPath + "hNGlobalTracksvsPVz_Collisions", histos.add((histPath + "hNGlobalTracksvsPVz_Collisions").c_str(), "hNGlobalTracksvsPVz_Collisions", {kTProfile, {{axisPVz}}})});
313306
histPointers.insert({histPath + "hNMFTTracksvsPVz_Collisions", histos.add((histPath + "hNMFTTracksvsPVz_Collisions").c_str(), "hNMFTTracksvsPVz_Collisions", {kTProfile, {{axisPVz}}})});
307+
histPointers.insert({histPath + "hNTPVvsPVz_Collisions", histos.add((histPath + "hNTPVvsPVz_Collisions").c_str(), "hNTPVvsPVz_Collisions", {kTProfile, {{axisPVz}}})});
314308
}
315309

316310
if (do2DPlots) {
@@ -359,7 +353,6 @@ struct centralityStudy {
359353
// process this collisions
360354
{
361355
initRun(collision);
362-
363356
histos.fill(HIST("hCollisionSelection"), 0); // all collisions
364357
getHist(TH1, histPath + "hCollisionSelection")->Fill(0);
365358

@@ -368,50 +361,77 @@ struct centralityStudy {
368361
histos.fill(HIST("hCollisionSelection"), 1);
369362
getHist(TH1, histPath + "hCollisionSelection")->Fill(1);
370363

364+
bool passRejectITSROFBorder = !(rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder));
365+
bool passRejectTFBorder = !(rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder));
366+
bool passRequireIsVertexITSTPC = !(requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC));
367+
bool passRequireIsGoodZvtxFT0VsPV = !(requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV));
368+
bool passRequireIsVertexTOFmatched = !(requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched));
369+
bool passRequireIsVertexTRDmatched = !(requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched));
370+
bool passRejectSameBunchPileup = !(rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup));
371+
bool passRejectITSinROFpileupStandard = !(rejectITSinROFpileupStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard));
372+
bool passRejectITSinROFpileupStrict = !(rejectITSinROFpileupStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict));
373+
bool passSelectUPCcollisions = !(selectUPCcollisions && collision.flags() < 1);
374+
bool passRejectCollInTimeRangeNarrow = !(rejectCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow));
375+
// _______________________________________________________
376+
// sidestep vertex-Z rejection for vertex-Z profile histograms
377+
if(passRejectITSROFBorder && passRejectTFBorder && passRequireIsVertexITSTPC && passRequireIsGoodZvtxFT0VsPV &&
378+
passRequireIsVertexTOFmatched && passRequireIsVertexTRDmatched && passRejectSameBunchPileup && passRejectITSinROFpileupStandard && passRejectITSinROFpileupStrict &&
379+
passSelectUPCcollisions && passRejectCollInTimeRangeNarrow){
380+
getHist(TProfile, histPath + "hFT0CvsPVz_Collisions_All")->Fill(collision.multPVz(), collision.multFT0C() * scaleSignalFT0C);
381+
getHist(TProfile, histPath + "hFT0CvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFT0C() * scaleSignalFT0C);
382+
getHist(TProfile, histPath + "hFT0AvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFT0A() * scaleSignalFT0C);
383+
getHist(TProfile, histPath + "hFV0AvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFV0A() * scaleSignalFV0A);
384+
getHist(TProfile, histPath + "hNGlobalTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.multNTracksGlobal());
385+
getHist(TProfile, histPath + "hNMFTTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.mftNtracks());
386+
getHist(TProfile, histPath + "hNTPVvsPVz_Collisions")->Fill(collision.multPVz(), collision.multNTracksPV());
387+
}
388+
389+
// _______________________________________________________
390+
371391
if (applyVtxZ && TMath::Abs(collision.multPVz()) > 10)
372392
return;
373393
histos.fill(HIST("hCollisionSelection"), 2);
374394
getHist(TH1, histPath + "hCollisionSelection")->Fill(2);
375395

376396
// _______________________________________________________
377397
// Extra event selections start here
378-
if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
398+
if (!passRejectITSROFBorder) {
379399
return;
380400
}
381401
histos.fill(HIST("hCollisionSelection"), 3 /* Not at ITS ROF border */);
382402
getHist(TH1, histPath + "hCollisionSelection")->Fill(3);
383403

384-
if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
404+
if (!passRejectTFBorder) {
385405
return;
386406
}
387407
histos.fill(HIST("hCollisionSelection"), 4 /* Not at TF border */);
388408
getHist(TH1, histPath + "hCollisionSelection")->Fill(4);
389409

390-
if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) {
410+
if (!passRequireIsVertexITSTPC) {
391411
return;
392412
}
393413
histos.fill(HIST("hCollisionSelection"), 5 /* Contains at least one ITS-TPC track */);
394414
getHist(TH1, histPath + "hCollisionSelection")->Fill(5);
395415

396-
if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
416+
if (!passRequireIsGoodZvtxFT0VsPV) {
397417
return;
398418
}
399419
histos.fill(HIST("hCollisionSelection"), 6 /* PV position consistency check */);
400420
getHist(TH1, histPath + "hCollisionSelection")->Fill(6);
401421

402-
if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) {
422+
if (!passRequireIsVertexTOFmatched) {
403423
return;
404424
}
405425
histos.fill(HIST("hCollisionSelection"), 7 /* PV with at least one contributor matched with TOF */);
406426
getHist(TH1, histPath + "hCollisionSelection")->Fill(7);
407427

408-
if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) {
428+
if (!passRequireIsVertexTRDmatched) {
409429
return;
410430
}
411431
histos.fill(HIST("hCollisionSelection"), 8 /* PV with at least one contributor matched with TRD */);
412432
getHist(TH1, histPath + "hCollisionSelection")->Fill(8);
413433

414-
if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
434+
if (!passRejectSameBunchPileup) {
415435
return;
416436
}
417437
histos.fill(HIST("hCollisionSelection"), 9 /* Not at same bunch pile-up */);
@@ -430,25 +450,25 @@ struct centralityStudy {
430450
getHist(TH1, histPath + "hCollisionSelection")->Fill(10);
431451
}
432452

433-
if (rejectITSinROFpileupStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) {
453+
if (!passRejectITSinROFpileupStandard) {
434454
return;
435455
}
436456
histos.fill(HIST("hCollisionSelection"), 11 /* Not ITS ROF pileup (standard) */);
437457
getHist(TH1, histPath + "hCollisionSelection")->Fill(11);
438458

439-
if (rejectITSinROFpileupStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) {
459+
if (!passRejectITSinROFpileupStrict) {
440460
return;
441461
}
442462
histos.fill(HIST("hCollisionSelection"), 12 /* Not ITS ROF pileup (strict) */);
443463
getHist(TH1, histPath + "hCollisionSelection")->Fill(12);
444464

445-
if (selectUPCcollisions && collision.flags() < 1) { // if zero then NOT upc, otherwise UPC
465+
if (!passSelectUPCcollisions) { // if zero then NOT upc, otherwise UPC
446466
return;
447467
}
448468
histos.fill(HIST("hCollisionSelection"), 13 /* is UPC event */);
449469
getHist(TH1, histPath + "hCollisionSelection")->Fill(13);
450470

451-
if (rejectCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) {
471+
if (!passRejectCollInTimeRangeNarrow) {
452472
return;
453473
}
454474
histos.fill(HIST("hCollisionSelection"), 14 /* Not ITS ROF pileup (strict) */);
@@ -488,10 +508,6 @@ struct centralityStudy {
488508
getHist(TH1, histPath + "hFV0A_Collisions")->Fill(collision.multFV0A() * scaleSignalFV0A);
489509
getHist(TH1, histPath + "hNGlobalTracks")->Fill(collision.multNTracksGlobal());
490510
getHist(TH1, histPath + "hNMFTTracks")->Fill(collision.mftNtracks());
491-
getHist(TProfile, histPath + "hFT0CvsPVz_Collisions_All")->Fill(collision.multPVz(), collision.multFT0C() * scaleSignalFT0C);
492-
getHist(TProfile, histPath + "hFV0AvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFV0A() * scaleSignalFV0A);
493-
getHist(TProfile, histPath + "hNGlobalTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.multNTracksGlobal());
494-
getHist(TProfile, histPath + "hNMFTTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.mftNtracks());
495511

496512
if (collision.multFT0C() > minFT0CforVertexZ) {
497513
histos.fill(HIST("hFT0CvsPVz_Collisions"), collision.multPVz(), collision.multFT0C() * scaleSignalFT0C);
@@ -576,9 +592,11 @@ struct centralityStudy {
576592
}
577593

578594
if (doTimeStudies && collision.has_multBC()) {
595+
initRun(collision);
579596
auto multbc = collision.template multBC_as<aod::MultBCs>();
580597
uint64_t bcTimestamp = multbc.timestamp();
581-
598+
o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp<o2::parameters::GRPECSObject>(pathGRPECSObject, bcTimestamp);
599+
uint64_t startOfRunTimestamp = grpo->getTimeStart();
582600
float hoursAfterStartOfRun = static_cast<float>(bcTimestamp - startOfRunTimestamp) / 3600000.0;
583601

584602
getHist(TH2, histPath + "hFT0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0A());

0 commit comments

Comments
 (0)