2525#include < DataFormatsFT0/ChannelData.h>
2626#include < Framework/InputRecord.h>
2727#include < vector>
28-
28+ # include " DataFormatsParameters/GRPLHCIFData.h "
2929#include " FITCommon/HelperHist.h"
3030#include " FITCommon/HelperCommon.h"
31-
31+ #include " DetectorsBase/GRPGeomHelper.h"
32+ #include " CommonDataFormat/BunchFilling.h"
3233namespace o2 ::quality_control_modules::ft0
3334{
3435
@@ -38,14 +39,23 @@ RecPointsQcTask::~RecPointsQcTask()
3839{
3940 delete mListHistGarbage ;
4041}
42+ void RecPointsQcTask::initHists ()
43+ {
44+ for (int iCh = 0 ; iCh < sNCHANNELS ; iCh++) {
45+ const std::string name = fmt::format (" hAmpVsTime_ch{}" , iCh);
46+ const std::string title = fmt::format (" Amp Vs Time channelID {}; Amp [ADC]; Time [ps]" , iCh);
47+ mArrAmpTimeDistribution [iCh] = o2::fit::AmpTimeDistribution (name, title, 200 , -2000 ., 2000 ., 50 , 4095 , 0 ); // in total 315 bins along x-axis
48+ getObjectsManager ()->startPublishing (mArrAmpTimeDistribution [iCh].mHist .get ());
49+ }
50+ }
4151
4252void RecPointsQcTask::initialize (o2::framework::InitContext& /* ctx*/ )
4353{
4454 ILOG (Info, Support) << " @@@@initialize RecoQcTask" << ENDM; // QcInfoLogger is used. FairMQ logs will go to there as well.
4555
46- mHistTime2Ch = std::make_unique<TH2F>(" TimePerChannel" , " Time vs Channel;Channel;Time [ps]" , NCHANNELS , 0 , NCHANNELS , 500 , -2050 , 2050 );
56+ mHistTime2Ch = std::make_unique<TH2F>(" TimePerChannel" , " Time vs Channel;Channel;Time [ps]" , sNCHANNELS , 0 , sNCHANNELS , 500 , -2050 , 2050 );
4757 mHistTime2Ch ->SetOption (" colz" );
48- mHistAmp2Ch = std::make_unique<TH2F>(" AmpPerChannel" , " Amplitude vs Channel;Channel;Amp [#ADC channels]" , NCHANNELS , 0 , NCHANNELS , 200 , 0 , 1000 );
58+ mHistAmp2Ch = std::make_unique<TH2F>(" AmpPerChannel" , " Amplitude vs Channel;Channel;Amp [#ADC channels]" , sNCHANNELS , 0 , sNCHANNELS , 200 , 0 , 1000 );
4959 mHistAmp2Ch ->SetOption (" colz" );
5060 mHistCollTimeAC = std::make_unique<TH1F>(" CollTimeAC" , " (T0A+T0C)/2;ps" , 100 , -1000 , 1000 );
5161 mHistCollTimeA = std::make_unique<TH1F>(" CollTimeA" , " T0A;ps" , 100 , -1000 , 1000 );
@@ -87,15 +97,16 @@ void RecPointsQcTask::initialize(o2::framework::InitContext& /*ctx*/)
8797 mHistTimeA_perTrg = helper::registerHist<TH2F>(getObjectsManager (), PublicationPolicy::Forever, " COLZ" , " TimeA_perTrg" , " T0A per Trigger;Time [ps]; Trigger" , binsTime, mMapTrgBits );
8898 mHistTimeC_perTrg = helper::registerHist<TH2F>(getObjectsManager (), PublicationPolicy::Forever, " COLZ" , " TimeC_perTrg" , " T0C per Trigger;Time [ps]; Trigger" , binsTime, mMapTrgBits );
8999 mHistBC_perTriggers = helper::registerHist<TH2F>(getObjectsManager (), PublicationPolicy::Forever, " COLZ" , " BC_perTriggers" , " BC per Triggers;BC; Trigger" , binsBC, mMapTrgBits );
90-
91- for (const auto & chID : mSetAllowedChIDs ) {
92- auto pairHistAmpVsTime = mMapHistAmpVsTime .insert ({ chID, new TH2F (Form (" Amp_vs_time_channel%i" , chID), Form (" Amplitude vs time, channel %i;Amp;Time" , chID), 1000 , 0 , 4000 , 100 , -1000 , 1000 ) });
93- if (pairHistAmpVsTime.second ) {
94- mListHistGarbage ->Add (pairHistAmpVsTime.first ->second );
95- getObjectsManager ()->startPublishing (pairHistAmpVsTime.first ->second );
100+ /*
101+ for (const auto& chID : mSetAllowedChIDs) {
102+ auto pairHistAmpVsTime = mMapHistAmpVsTime.insert({ chID, new TH2F(Form("Amp_vs_time_channel%i", chID), Form("Amplitude vs time, channel %i;Amp;Time", chID), 1000, 0, 4000, 100, -1000, 1000) });
103+ if (pairHistAmpVsTime.second) {
104+ mListHistGarbage->Add(pairHistAmpVsTime.first->second);
105+ getObjectsManager()->startPublishing(pairHistAmpVsTime.first->second);
106+ }
96107 }
97- }
98-
108+ */
109+ initHists ();
99110 ILOG (Info, Support) << " @@@ histos created" << ENDM;
100111}
101112
@@ -114,9 +125,8 @@ void RecPointsQcTask::startOfActivity(const Activity& activity)
114125 mHistTimeA_perTrg ->Reset ();
115126 mHistTimeC_perTrg ->Reset ();
116127 mHistBC_perTriggers ->Reset ();
117-
118- for (auto & entry : mMapHistAmpVsTime ) {
119- entry.second ->Reset ();
128+ for (int iCh = 0 ; iCh < sNCHANNELS ; iCh++) {
129+ mArrAmpTimeDistribution [iCh].mHist ->Reset ();
120130 }
121131}
122132
@@ -128,7 +138,9 @@ void RecPointsQcTask::monitorData(o2::framework::ProcessingContext& ctx)
128138{
129139 auto chan = ctx.inputs ().get <gsl::span<o2::ft0::ChannelDataFloat>>(" channels" );
130140 auto recpoints = ctx.inputs ().get <gsl::span<o2::ft0::RecPoints>>(" recpoints" );
131-
141+ const auto & grplhcif = o2::base::GRPGeomHelper::instance ().getGRPLHCIF ();
142+ const auto & bcSchema = grplhcif ? grplhcif->getBunchFilling ().getBCPattern () : o2::BunchFilling::Pattern{};
143+ const bool isPbPb = grplhcif ? grplhcif->getAtomicNumberB1 () == 82 && grplhcif->getAtomicNumberB2 () == 82 : false ;
132144 for (const auto & recpoint : recpoints) {
133145 const auto bc = recpoint.getInteractionRecord ().bc ;
134146 int time[o2::ft0::Constants::sNCHANNELS_PM ] = { 0 };
@@ -158,13 +170,14 @@ void RecPointsQcTask::monitorData(o2::framework::ProcessingContext& ctx)
158170 }
159171 }
160172 }
173+ const bool isMinBiasEvent = (isPbPb && minBias) || (!isPbPb && triggersignals.getVertex ()); // for pp only vertex, for PbPb vrt && (CENT || SCENT)
161174 for (const auto & chData : channels) {
162175 time[chData.ChId ] = chData.CFDTime ;
163176 amp[chData.ChId ] = chData.QTCAmpl ;
164177 mHistTime2Ch ->Fill (static_cast <Double_t>(chData.ChId ), static_cast <Double_t>(chData.CFDTime ));
165178 mHistAmp2Ch ->Fill (static_cast <Double_t>(chData.ChId ), static_cast <Double_t>(chData.QTCAmpl ));
166- if (mSetAllowedChIDs . find ( static_cast < unsigned int >(chData. ChId )) != mSetAllowedChIDs . end () && minBias ) { // ampt-time dependency is needed only for PbPb runs
167- mMapHistAmpVsTime [chData.ChId ]->Fill (chData.QTCAmpl , chData.CFDTime );
179+ if (bcSchema. test (bc) && isMinBiasEvent ) { // ampt-time dependency
180+ mArrAmpTimeDistribution [chData.ChId ]. mHist ->Fill (chData.QTCAmpl , chData.CFDTime );
168181 }
169182 }
170183 if (vertexTrigger) {
@@ -239,9 +252,8 @@ void RecPointsQcTask::reset()
239252 mHistTimeA_perTrg ->Reset ();
240253 mHistTimeC_perTrg ->Reset ();
241254 mHistBC_perTriggers ->Reset ();
242-
243- for (auto & entry : mMapHistAmpVsTime ) {
244- entry.second ->Reset ();
255+ for (int iCh = 0 ; iCh < sNCHANNELS ; iCh++) {
256+ mArrAmpTimeDistribution [iCh].mHist ->Reset ();
245257 }
246258}
247259
0 commit comments