3030#include " Common/DataModel/EventSelection.h"
3131#include " Common/DataModel/FT0Corrected.h"
3232#include " Common/DataModel/Multiplicity.h"
33+ #include " Framework/HistogramRegistry.h"
34+ #include " Framework/runDataProcessing.h"
3335#include " TableHelper.h"
3436#include " pidTOFBase.h"
3537
@@ -39,15 +41,6 @@ using namespace o2::pid;
3941using namespace o2 ::framework::expressions;
4042using namespace o2 ::track;
4143
42- void customize (std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
43- {
44- std::vector<ConfigParamSpec> options{{" add-qa" , VariantType::Int, 0 , {" Legacy. No effect." }},
45- {" evtime" , VariantType::Int, 1 , {" Produce the table for the Event Time" }}};
46- std::swap (workflowOptions, options);
47- }
48-
49- #include " Framework/runDataProcessing.h"
50-
5144// / Selection criteria for tracks used for TOF event time
5245float trackDistanceForGoodMatch = 999 .f;
5346float trackDistanceForGoodMatchLowMult = 999 .f;
@@ -69,6 +62,8 @@ bool isTrackGoodMatchForTOFPID(const Run3Trks::iterator& tr, const Run3Cols& /*e
6962struct tofSignal {
7063 o2::framework::Produces<o2::aod::TOFSignal> table;
7164 o2::framework::Produces<o2::aod::pidTOFFlags> tableFlags;
65+ HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
66+
7267 bool enableTable = false ; // Flag to check if the TOF signal table is requested or not
7368 bool enableTableFlags = false ; // Flag to check if the TOF signal flags table is requested or not
7469 // CCDB configuration
@@ -78,6 +73,7 @@ struct tofSignal {
7873 Configurable<float > distanceForGoodMatch{" distanceForGoodMatch" , 999 .f , " Maximum distance to consider a good match" };
7974 Configurable<float > distanceForGoodMatchLowMult{" distanceForGoodMatchLowMult" , 999 .f , " Maximum distance to consider a good match for low multiplicity events" };
8075 Configurable<int > multThreshold{" multThreshold" , 0 , " Multiplicity threshold to consider a low multiplicity event" };
76+ Configurable<bool > enableQaHistograms{" enableQaHistograms" , false , " Flag to enable the QA histograms" };
8177
8278 void init (o2::framework::InitContext& initContext)
8379 {
@@ -90,17 +86,26 @@ struct tofSignal {
9086
9187 // Checking that the table is requested in the workflow and enabling it
9288 enableTable = isTableRequiredInWorkflow (initContext, " TOFSignal" );
89+ enableTable = true ;
9390 if (enableTable) {
9491 LOG (info) << " Table TOFSignal enabled!" ;
9592 }
9693 enableTableFlags = isTableRequiredInWorkflow (initContext, " pidTOFFlags" );
94+ enableTableFlags = true ;
9795 if (enableTableFlags) {
9896 LOG (info) << " Table pidTOFFlags enabled!" ;
9997 }
10098 trackDistanceForGoodMatch = distanceForGoodMatch;
10199 trackDistanceForGoodMatchLowMult = distanceForGoodMatchLowMult;
102100 multiplicityThreshold = multThreshold;
103101 LOG (info) << " Configuring selections for good match: " << trackDistanceForGoodMatch << " low mult " << trackDistanceForGoodMatchLowMult << " mult. threshold " << multiplicityThreshold;
102+ if (!enableQaHistograms) {
103+ return ;
104+ }
105+ histos.add (" tofSignal" , " tofSignal" , kTH1D , {{1000 , -1000 , 1000000 , " tofSignal (ps)" }});
106+ if (enableTableFlags) {
107+ histos.add (" goodForPIDFlags" , " goodForPIDFlags" , kTH1D , {{3 , 0 , 3 , " flags" }});
108+ }
104109 }
105110 void processRun3 (Run3Trks const & tracks, Run3Cols const & collisions)
106111 {
@@ -112,11 +117,19 @@ struct tofSignal {
112117 tableFlags.reserve (tracks.size ());
113118 }
114119 for (auto & t : tracks) {
115- table (o2::pid::tof::TOFSignal<Run3Trks::iterator>::GetTOFSignal (t));
120+ const auto s = o2::pid::tof::TOFSignal<Run3Trks::iterator>::GetTOFSignal (t);
121+ if (enableQaHistograms) {
122+ histos.fill (HIST (" tofSignal" ), s);
123+ }
124+ table (s);
116125 if (!enableTableFlags) {
117126 continue ;
118127 }
119- tableFlags (isTrackGoodMatchForTOFPID (t, collisions));
128+ const auto b = isTrackGoodMatchForTOFPID (t, collisions);
129+ if (enableQaHistograms) {
130+ histos.fill (HIST (" goodForPIDFlags" ), s);
131+ }
132+ tableFlags (b);
120133 }
121134 }
122135 PROCESS_SWITCH (tofSignal, processRun3, " Process Run3 data i.e. input is TrackIU" , true );
@@ -235,13 +248,16 @@ struct tofEventTime {
235248 }
236249 // Checking that the table is requested in the workflow and enabling it
237250 enableTable = isTableRequiredInWorkflow (initContext, " TOFEvTime" );
251+ enableTable = true ;
252+
238253 if (!enableTable) {
239254 LOG (info) << " Table for TOF Event time (TOFEvTime) is not required, disabling it" ;
240255 return ;
241256 }
242257 LOG (info) << " Table TOFEvTime enabled!" ;
243258
244259 enableTableTOFOnly = isTableRequiredInWorkflow (initContext, " EvTimeTOFOnly" );
260+ enableTableTOFOnly = true ;
245261 if (enableTableTOFOnly) {
246262 LOG (info) << " Table EvTimeTOFOnly enabled!" ;
247263 }
@@ -279,8 +295,8 @@ struct tofEventTime {
279295 LOGF (warning, " Pass '%s' not available in the retrieved CCDB object" , passName.value .data ());
280296 }
281297 } else {
282- mRespParamsV2 .setShiftParameters (paramCollection.getPars (passName.value ));
283- mRespParamsV2 .printShiftParameters ();
298+ mRespParamsV2 .setMomentumChargeShiftParameters (paramCollection.getPars (passName.value ));
299+ mRespParamsV2 .printMomentumChargeShiftParameters ();
284300 }
285301 } else {
286302 mRespParamsV2 .loadParamFromFile (fname.data (), parametrizationPath.value );
@@ -297,8 +313,8 @@ struct tofEventTime {
297313 LOGF (warning, " Pass '%s' not available in the retrieved CCDB object" , passName.value .data ());
298314 }
299315 } else {
300- mRespParamsV2 .setShiftParameters (paramCollection->getPars (passName.value ));
301- mRespParamsV2 .printShiftParameters ();
316+ mRespParamsV2 .setMomentumChargeShiftParameters (paramCollection->getPars (passName.value ));
317+ mRespParamsV2 .printMomentumChargeShiftParameters ();
302318 }
303319 }
304320 mRespParamsV2 .print ();
@@ -537,9 +553,6 @@ struct tofEventTime {
537553WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
538554{
539555 auto workflow = WorkflowSpec{adaptAnalysisTask<tofSignal>(cfgc)};
540- if (!cfgc.options ().get <int >(" evtime" )) {
541- return workflow;
542- }
543556 workflow.push_back (adaptAnalysisTask<tofEventTime>(cfgc));
544557 return workflow;
545558}
0 commit comments