@@ -46,7 +46,7 @@ namespace tpc
4646class TPCCalibPedestalDevice : public o2 ::framework::Task
4747{
4848 public:
49- TPCCalibPedestalDevice (int lane, const std::vector<int >& sectors) : mLane {lane}, mSectors (sectors) {}
49+ TPCCalibPedestalDevice (uint32_t lane, const std::vector<int >& sectors, uint32_t publishAfterTFs ) : mLane {lane}, mSectors (sectors), mPublishAfter (publishAfterTFs ) {}
5050
5151 void init (o2::framework::InitContext& ic) final
5252 {
@@ -87,11 +87,20 @@ class TPCCalibPedestalDevice : public o2::framework::Task
8787 calib_processing_helper::processRawData (pc.inputs (), reader, mUseOldSubspec , mSectors );
8888
8989 mCalibPedestal .incrementNEvents ();
90- LOGP (info, " Number of processed events: {} ({})" , mCalibPedestal .getNumberOfProcessedEvents (), mMaxEvents );
90+ const auto nTFs = mCalibPedestal .getNumberOfProcessedEvents ();
91+ LOGP (info, " Number of processed TFs: {} ({})" , nTFs, mMaxEvents );
9192
92- if ((mCalibPedestal .getNumberOfProcessedEvents () >= mMaxEvents ) && !mCalibDumped ) {
93- LOGP (info, " Maximm number of events reached ({}), no more processing will be done" , mMaxEvents );
93+ if ((mPublishAfter && (nTFs % mPublishAfter ) == 0 )) {
94+ LOGP (info, " Publishing after {} TFs" , nTFs);
95+ mCalibPedestal .analyse ();
96+ dumpCalibData ();
97+ sendOutput (pc.outputs ());
98+ }
99+
100+ if (mMaxEvents && (mCalibPedestal .getNumberOfProcessedEvents () >= mMaxEvents ) && !mCalibDumped ) {
101+ LOGP (info, " Maximm number of TFs reached ({}), no more processing will be done" , mMaxEvents );
94102 mReadyToQuit = true ;
103+ mCalibPedestal .analyse ();
95104 dumpCalibData ();
96105 if (mForceQuit ) {
97106 pc.services ().get <ControlService>().endOfStream ();
@@ -105,6 +114,7 @@ class TPCCalibPedestalDevice : public o2::framework::Task
105114 void endOfStream (o2::framework::EndOfStreamContext& ec) final
106115 {
107116 LOGP (info, " endOfStream" );
117+ mCalibPedestal .analyse ();
108118 dumpCalibData ();
109119 sendOutput (ec.outputs ());
110120 ec.services ().get <ControlService>().readyToQuit (QuitRequest::Me);
@@ -113,8 +123,9 @@ class TPCCalibPedestalDevice : public o2::framework::Task
113123 private:
114124 CalibPedestal mCalibPedestal ;
115125 rawreader::RawReaderCRUManager mRawReader ;
116- uint32_t mMaxEvents {100 }; // /< maximum number of events to process
117- int mLane {0 }; // /< lane number of processor
126+ uint32_t mMaxEvents {0 }; // /< maximum number of events to process
127+ uint32_t mPublishAfter {0 }; // /< number of events after which to dump the calibration
128+ uint32_t mLane {0 }; // /< lane number of processor
118129 std::vector<int > mSectors {}; // /< sectors to process in this instance
119130 bool mReadyToQuit {false }; // /< if processor is ready to quit
120131 bool mCalibDumped {false }; // /< if calibration object already dumped
@@ -134,7 +145,7 @@ class TPCCalibPedestalDevice : public o2::framework::Task
134145 auto image = o2::utils::MemFileHelper::createFileImage (cal, typeid (*cal), cal->getName (), " data" );
135146 int type = int (dataType[i]);
136147
137- header::DataHeader::SubSpecificationType subSpec{(header::DataHeader::SubSpecificationType)i };
148+ header::DataHeader::SubSpecificationType subSpec{(header::DataHeader::SubSpecificationType)(( mLane << 4 ) + i) };
138149 output.snapshot (Output{clbUtils::gDataOriginCLB , " TPCCLBPART" , subSpec}, *image.get ());
139150 output.snapshot (Output{clbUtils::gDataOriginCLB , " TPCCLBPARTINFO" , subSpec}, type);
140151 }
@@ -145,14 +156,13 @@ class TPCCalibPedestalDevice : public o2::framework::Task
145156 {
146157 if (mDirectFileDump && !mCalibDumped ) {
147158 LOGP (info, " Dumping output" );
148- mCalibPedestal .analyse ();
149159 mCalibPedestal .dumpToFile (fmt::format (" pedestals_{:02}.root" , mLane ));
150160 mCalibDumped = true ;
151161 }
152162 }
153163};
154164
155- DataProcessorSpec getTPCCalibPedestalSpec (const std::string inputSpec, int ilane = 0 , std::vector<int > sectors = {})
165+ DataProcessorSpec getTPCCalibPedestalSpec (const std::string inputSpec, uint32_t ilane = 0 , std::vector<int > sectors = {}, uint32_t publishAfterTFs = 0 )
156166{
157167 std::vector<o2::framework::OutputSpec> outputs;
158168 outputs.emplace_back (ConcreteDataTypeMatcher{clbUtils::gDataOriginCLB , " TPCCLBPART" });
@@ -163,9 +173,9 @@ DataProcessorSpec getTPCCalibPedestalSpec(const std::string inputSpec, int ilane
163173 id.data (),
164174 select (inputSpec.data ()),
165175 outputs,
166- AlgorithmSpec{adaptFromTask<TPCCalibPedestalDevice>(ilane, sectors)},
176+ AlgorithmSpec{adaptFromTask<TPCCalibPedestalDevice>(ilane, sectors, publishAfterTFs )},
167177 Options{
168- {" max-events" , VariantType::Int, 100 , {" maximum number of events to process" }},
178+ {" max-events" , VariantType::Int, 0 , {" maximum number of events to process" }},
169179 {" use-old-subspec" , VariantType::Bool, false , {" use old subsecifiation definition" }},
170180 {" force-quit" , VariantType::Bool, false , {" force quit after max-events have been reached" }},
171181 {" direct-file-dump" , VariantType::Bool, false , {" directly dump calibration to file" }},
0 commit comments