Skip to content

Commit 8fbf7d0

Browse files
Getting prepared for boolean columns (#5025)
The internal boolean columns implementation has been changed to mimic the track selection one to easy the transition to actual full support of boolean columns Also the configuration parameters have been moved back to the main output list
1 parent c71d440 commit 8fbf7d0

File tree

1 file changed

+54
-72
lines changed

1 file changed

+54
-72
lines changed

Analysis/Tasks/PWGCF/dptdptcorrelations.cxx

Lines changed: 54 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ int tracktwocharge = -1;
8787
bool processpairs = false;
8888
std::string fTaskConfigurationString = "PendingToConfigure";
8989

90-
/* while we don't have proper bool columnst */
91-
uint8_t DPTDPT_TRUE = 1;
92-
uint8_t DPTDPT_FALSE = 0;
93-
9490
/// \enum SystemType
9591
/// \brief The type of the system under analysis
9692
enum SystemType {
@@ -230,20 +226,20 @@ bool matchTrackType(aod::TrackData const& track)
230226
}
231227
}
232228

233-
inline void AcceptTrack(aod::TrackData const& track, uint8_t& asone, uint8_t& astwo)
229+
inline void AcceptTrack(aod::TrackData const& track, bool& asone, bool& astwo)
234230
{
235231

236-
asone = DPTDPT_FALSE;
237-
astwo = DPTDPT_FALSE;
232+
asone = false;
233+
astwo = false;
238234

239235
/* TODO: incorporate a mask in the scanned tracks table for the rejecting track reason */
240236
if (matchTrackType(track)) {
241237
if (ptlow < track.pt() and track.pt() < ptup and etalow < track.eta() and track.eta() < etaup) {
242238
if (((track.charge() > 0) and (trackonecharge > 0)) or ((track.charge() < 0) and (trackonecharge < 0))) {
243-
asone = DPTDPT_TRUE;
239+
asone = true;
244240
}
245241
if (((track.charge() > 0) and (tracktwocharge > 0)) or ((track.charge() < 0) and (tracktwocharge < 0))) {
246-
astwo = DPTDPT_TRUE;
242+
astwo = true;
247243
}
248244
}
249245
}
@@ -302,7 +298,6 @@ struct DptDptCorrelationsFilterAnalysisTask {
302298
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"};
303299

304300
OutputObj<TList> fOutput{"DptDptCorrelationsGlobalInfo", OutputObjHandlingPolicy::AnalysisObject};
305-
OutputObj<TFolder> fConfOutput{"DptDptCorrelationsGlobalConfiguration", OutputObjHandlingPolicy::AnalysisObject};
306301

307302
Produces<aod::AcceptedEvents> acceptedevents;
308303
Produces<aod::ScannedTracks> scannedtracks;
@@ -336,21 +331,16 @@ struct DptDptCorrelationsFilterAnalysisTask {
336331
/* if the system type is not known at this time, we have to put the initalization somewhere else */
337332
fSystem = getSystemType();
338333

339-
/* create the configuration folder which will own the task configuration parameters */
340-
TFolder* fOutputFolder = new TFolder("DptDptCorrelationsGlobalConfigurationFolder", "DptDptCorrelationsGlobalConfigurationFolder");
341-
fOutputFolder->SetOwner(true);
342-
fConfOutput.setObject(fOutputFolder);
343-
344-
/* incorporate configuration parameters to the output */
345-
fOutputFolder->Add(new TParameter<Int_t>("TrackType", cfgTrackType, 'f'));
346-
fOutputFolder->Add(new TParameter<Int_t>("TrackOneCharge", cfgTrackOneCharge, 'f'));
347-
fOutputFolder->Add(new TParameter<Int_t>("TrackTwoCharge", cfgTrackTwoCharge, 'f'));
348-
349334
/* create the output list which will own the task histograms */
350335
TList* fOutputList = new TList();
351336
fOutputList->SetOwner(true);
352337
fOutput.setObject(fOutputList);
353338

339+
/* incorporate configuration parameters to the output */
340+
fOutputList->Add(new TParameter<Int_t>("TrackType", cfgTrackType, 'f'));
341+
fOutputList->Add(new TParameter<Int_t>("TrackOneCharge", cfgTrackOneCharge, 'f'));
342+
fOutputList->Add(new TParameter<Int_t>("TrackTwoCharge", cfgTrackTwoCharge, 'f'));
343+
354344
/* create the histograms */
355345
if (fSystem > kPbp) {
356346
fhCentMultB = new TH1F("CentralityB", "Centrality before cut; centrality (%)", 100, 0, 100);
@@ -407,10 +397,10 @@ struct DptDptCorrelationsFilterAnalysisTask {
407397
// LOGF(INFO,"New collision with %d filtered tracks", ftracks.size());
408398
fhCentMultB->Fill(collision.centV0M());
409399
fhVertexZB->Fill(collision.posZ());
410-
int acceptedevent = DPTDPT_FALSE;
400+
bool acceptedevent = false;
411401
float centormult = -100.0;
412402
if (IsEvtSelected(collision, centormult)) {
413-
acceptedevent = DPTDPT_TRUE;
403+
acceptedevent = true;
414404
fhCentMultA->Fill(collision.centV0M());
415405
fhVertexZA->Fill(collision.posZ());
416406
// LOGF(INFO,"New accepted collision with %d filtered tracks", ftracks.size());
@@ -430,9 +420,9 @@ struct DptDptCorrelationsFilterAnalysisTask {
430420

431421
/* track selection */
432422
/* tricky because the boolean columns issue */
433-
uint8_t asone, astwo;
423+
bool asone, astwo;
434424
AcceptTrack(track, asone, astwo);
435-
if ((asone == DPTDPT_TRUE) or (astwo == DPTDPT_TRUE)) {
425+
if (asone or astwo) {
436426
/* the track has been accepted */
437427
fhPtA->Fill(track.pt());
438428
fhEtaA->Fill(track.eta());
@@ -445,14 +435,14 @@ struct DptDptCorrelationsFilterAnalysisTask {
445435
fhPtNegA->Fill(track.pt());
446436
}
447437
}
448-
scannedtracks(asone, astwo);
438+
scannedtracks((uint8_t)asone, (uint8_t)astwo);
449439
}
450440
} else {
451441
for (auto& track : ftracks) {
452-
scannedtracks(DPTDPT_FALSE, DPTDPT_FALSE);
442+
scannedtracks((uint8_t) false, (uint8_t) false);
453443
}
454444
}
455-
acceptedevents(acceptedevent, centormult);
445+
acceptedevents((uint8_t)acceptedevent, centormult);
456446
}
457447
};
458448

@@ -470,13 +460,12 @@ struct DptDptCorrelationsTask {
470460
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"};
471461

472462
OutputObj<TList> fOutput{"DptDptCorrelationsData", OutputObjHandlingPolicy::AnalysisObject};
473-
OutputObj<TFolder> fConfOutput{"DptDptCorrelationsConfiguration", OutputObjHandlingPolicy::AnalysisObject};
474463

475-
Filter onlyacceptedevents = (aod::dptdptcorrelations::eventaccepted == DPTDPT_TRUE);
476-
Filter onlyacceptedtracks = ((aod::dptdptcorrelations::trackacceptedasone == DPTDPT_TRUE) or (aod::dptdptcorrelations::trackacceptedastwo == DPTDPT_TRUE));
464+
Filter onlyacceptedevents = (aod::dptdptcorrelations::eventaccepted == (uint8_t) true);
465+
Filter onlyacceptedtracks = ((aod::dptdptcorrelations::trackacceptedasone == (uint8_t) true) or (aod::dptdptcorrelations::trackacceptedastwo == (uint8_t) true));
477466

478-
Partition<aod::FilteredTracks> Tracks1 = aod::dptdptcorrelations::trackacceptedasone == DPTDPT_TRUE;
479-
Partition<aod::FilteredTracks> Tracks2 = aod::dptdptcorrelations::trackacceptedastwo == DPTDPT_TRUE;
467+
Partition<aod::FilteredTracks> Tracks1 = aod::dptdptcorrelations::trackacceptedasone == (uint8_t) true;
468+
Partition<aod::FilteredTracks> Tracks2 = aod::dptdptcorrelations::trackacceptedastwo == (uint8_t) true;
480469

481470
DptDptCorrelationsTask(float cmmin,
482471
float cmmax,
@@ -485,21 +474,19 @@ struct DptDptCorrelationsTask {
485474
{28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5},
486475
"triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"},
487476
OutputObj<TList> _fOutput = {"DptDptCorrelationsData", OutputObjHandlingPolicy::AnalysisObject},
488-
OutputObj<TFolder> _fConfOutput = {"DptDptCorrelationsConfiguration", OutputObjHandlingPolicy::AnalysisObject},
489-
Filter _onlyacceptedevents = (aod::dptdptcorrelations::eventaccepted == DPTDPT_TRUE),
490-
Filter _onlyacceptedtracks = ((aod::dptdptcorrelations::trackacceptedasone == DPTDPT_TRUE) or (aod::dptdptcorrelations::trackacceptedastwo == DPTDPT_TRUE)),
491-
Partition<aod::FilteredTracks> _Tracks1 = aod::dptdptcorrelations::trackacceptedasone == DPTDPT_TRUE,
492-
Partition<aod::FilteredTracks> _Tracks2 = aod::dptdptcorrelations::trackacceptedastwo == DPTDPT_TRUE)
477+
Filter _onlyacceptedevents = (aod::dptdptcorrelations::eventaccepted == (uint8_t) true),
478+
Filter _onlyacceptedtracks = ((aod::dptdptcorrelations::trackacceptedasone == (uint8_t) true) or (aod::dptdptcorrelations::trackacceptedastwo == (uint8_t) true)),
479+
Partition<aod::FilteredTracks> _Tracks1 = aod::dptdptcorrelations::trackacceptedasone == (uint8_t) true,
480+
Partition<aod::FilteredTracks> _Tracks2 = aod::dptdptcorrelations::trackacceptedastwo == (uint8_t) true)
493481
: fCentMultMin(cmmin),
494482
fCentMultMax(cmmax),
495483
cfgProcessPairs(_cfgProcessPairs),
496484
cfgBinning(_cfgBinning),
497485
fOutput(_fOutput),
498-
fConfOutput(_fConfOutput),
499-
onlyacceptedevents((aod::dptdptcorrelations::eventaccepted == DPTDPT_TRUE) and (aod::dptdptcorrelations::centmult > fCentMultMin) and (aod::dptdptcorrelations::centmult < fCentMultMax)),
500-
onlyacceptedtracks((aod::dptdptcorrelations::trackacceptedasone == DPTDPT_TRUE) or (aod::dptdptcorrelations::trackacceptedastwo == DPTDPT_TRUE)),
501-
Tracks1(aod::dptdptcorrelations::trackacceptedasone == DPTDPT_TRUE),
502-
Tracks2(aod::dptdptcorrelations::trackacceptedastwo == DPTDPT_TRUE)
486+
onlyacceptedevents((aod::dptdptcorrelations::eventaccepted == (uint8_t) true) and (aod::dptdptcorrelations::centmult > fCentMultMin) and (aod::dptdptcorrelations::centmult < fCentMultMax)),
487+
onlyacceptedtracks((aod::dptdptcorrelations::trackacceptedasone == (uint8_t) true) or (aod::dptdptcorrelations::trackacceptedastwo == (uint8_t) true)),
488+
Tracks1(aod::dptdptcorrelations::trackacceptedasone == (uint8_t) true),
489+
Tracks2(aod::dptdptcorrelations::trackacceptedastwo == (uint8_t) true)
503490
{
504491
}
505492

@@ -526,35 +513,30 @@ struct DptDptCorrelationsTask {
526513
etabinwidth = (etaup - etalow) / float(etabins);
527514
phibinwidth = (phiup - philow) / float(phibins);
528515

529-
/* create the configuration folder which will own the task configuration parameters */
530-
TFolder* fOutputFolder = new TFolder("DptDptCorrelationsConfigurationFolder", "DptDptCorrelationsConfigurationFolder");
531-
fOutputFolder->SetOwner(true);
532-
fConfOutput.setObject(fOutputFolder);
516+
/* create the output list which will own the task output */
517+
TList* fOutputList = new TList();
518+
fOutputList->SetOwner(true);
519+
fOutput.setObject(fOutputList);
533520

534521
/* incorporate configuration parameters to the output */
535-
fOutputFolder->Add(new TParameter<Int_t>("NoBinsVertexZ", zvtxbins, 'f'));
536-
fOutputFolder->Add(new TParameter<Int_t>("NoBinsPt", ptbins, 'f'));
537-
fOutputFolder->Add(new TParameter<Int_t>("NoBinsEta", etabins, 'f'));
538-
fOutputFolder->Add(new TParameter<Int_t>("NoBinsPhi", phibins, 'f'));
539-
fOutputFolder->Add(new TParameter<Double_t>("MinVertexZ", zvtxlow, 'f'));
540-
fOutputFolder->Add(new TParameter<Double_t>("MaxVertexZ", zvtxup, 'f'));
541-
fOutputFolder->Add(new TParameter<Double_t>("MinPt", ptlow, 'f'));
542-
fOutputFolder->Add(new TParameter<Double_t>("MaxPt", ptup, 'f'));
543-
fOutputFolder->Add(new TParameter<Double_t>("MinEta", etalow, 'f'));
544-
fOutputFolder->Add(new TParameter<Double_t>("MaxEta", etaup, 'f'));
545-
fOutputFolder->Add(new TParameter<Double_t>("MinPhi", philow, 'f'));
546-
fOutputFolder->Add(new TParameter<Double_t>("MaxPhi", phiup, 'f'));
547-
fOutputFolder->Add(new TParameter<Double_t>("PhiBinShift", phibinshift, 'f'));
522+
fOutputList->Add(new TParameter<Int_t>("NoBinsVertexZ", zvtxbins, 'f'));
523+
fOutputList->Add(new TParameter<Int_t>("NoBinsPt", ptbins, 'f'));
524+
fOutputList->Add(new TParameter<Int_t>("NoBinsEta", etabins, 'f'));
525+
fOutputList->Add(new TParameter<Int_t>("NoBinsPhi", phibins, 'f'));
526+
fOutputList->Add(new TParameter<Double_t>("MinVertexZ", zvtxlow, 'f'));
527+
fOutputList->Add(new TParameter<Double_t>("MaxVertexZ", zvtxup, 'f'));
528+
fOutputList->Add(new TParameter<Double_t>("MinPt", ptlow, 'f'));
529+
fOutputList->Add(new TParameter<Double_t>("MaxPt", ptup, 'f'));
530+
fOutputList->Add(new TParameter<Double_t>("MinEta", etalow, 'f'));
531+
fOutputList->Add(new TParameter<Double_t>("MaxEta", etaup, 'f'));
532+
fOutputList->Add(new TParameter<Double_t>("MinPhi", philow, 'f'));
533+
fOutputList->Add(new TParameter<Double_t>("MaxPhi", phiup, 'f'));
534+
fOutputList->Add(new TParameter<Double_t>("PhiBinShift", phibinshift, 'f'));
548535

549536
/* after the parameters dump the proper phi limits are set according to the phi shift */
550537
phiup = phiup - phibinwidth * phibinshift;
551538
philow = philow - phibinwidth * phibinshift;
552539

553-
/* create the output list which will own the task histograms */
554-
TList* fOutputList = new TList();
555-
fOutputList->SetOwner(true);
556-
fOutput.setObject(fOutputList);
557-
558540
/* create the histograms */
559541
Bool_t oldstatus = TH1::AddDirectoryStatus();
560542
TH1::AddDirectory(kFALSE);
@@ -807,13 +789,13 @@ struct TracksAndEventClassificationQA {
807789
fSelectedEvents->GetXaxis()->SetBinLabel(2, "Selected events");
808790
}
809791

810-
Filter onlyacceptedevents = (aod::dptdptcorrelations::eventaccepted == DPTDPT_TRUE);
811-
Filter onlyacceptedtracks = ((aod::dptdptcorrelations::trackacceptedasone == DPTDPT_TRUE) or (aod::dptdptcorrelations::trackacceptedastwo == DPTDPT_TRUE));
792+
Filter onlyacceptedevents = (aod::dptdptcorrelations::eventaccepted == (uint8_t) true);
793+
Filter onlyacceptedtracks = ((aod::dptdptcorrelations::trackacceptedasone == (uint8_t) true) or (aod::dptdptcorrelations::trackacceptedastwo == (uint8_t) true));
812794

813795
void process(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Cents, aod::AcceptedEvents>>::iterator const& collision,
814796
soa::Filtered<soa::Join<aod::Tracks, aod::ScannedTracks>> const& tracks)
815797
{
816-
if (collision.eventaccepted() != DPTDPT_TRUE) {
798+
if (collision.eventaccepted() != (uint8_t) true) {
817799
fSelectedEvents->Fill(0.5);
818800
} else {
819801
fSelectedEvents->Fill(1.5);
@@ -824,20 +806,20 @@ struct TracksAndEventClassificationQA {
824806
int ntracks_one_and_two = 0;
825807
int ntracks_none = 0;
826808
for (auto& track : tracks) {
827-
if ((track.trackacceptedasone() != DPTDPT_TRUE) and (track.trackacceptedastwo() != DPTDPT_TRUE)) {
809+
if ((track.trackacceptedasone() != (uint8_t) true) and (track.trackacceptedastwo() != (uint8_t) true)) {
828810
ntracks_none++;
829811
}
830-
if ((track.trackacceptedasone() == DPTDPT_TRUE) and (track.trackacceptedastwo() == DPTDPT_TRUE)) {
812+
if ((track.trackacceptedasone() == (uint8_t) true) and (track.trackacceptedastwo() == (uint8_t) true)) {
831813
ntracks_one_and_two++;
832814
}
833-
if (track.trackacceptedasone() == DPTDPT_TRUE) {
815+
if (track.trackacceptedasone() == (uint8_t) true) {
834816
ntracks_one++;
835817
}
836-
if (track.trackacceptedastwo() == DPTDPT_TRUE) {
818+
if (track.trackacceptedastwo() == (uint8_t) true) {
837819
ntracks_two++;
838820
}
839821
}
840-
if (collision.eventaccepted() != DPTDPT_TRUE) {
822+
if (collision.eventaccepted() != (uint8_t) true) {
841823
/* control for non selected events */
842824
fTracksOneUnsel->Fill(ntracks_one);
843825
fTracksTwoUnsel->Fill(ntracks_two);

0 commit comments

Comments
 (0)