@@ -36,8 +36,7 @@ ITSMFTDeadMapBuilder::ITSMFTDeadMapBuilder(std::string datasource, bool doMFT)
3636ITSMFTDeadMapBuilder::~ITSMFTDeadMapBuilder ()
3737{
3838 // Clear dynamic memory
39- delete mDeadMapTF ;
40- delete mTreeObject ;
39+ return ;
4140}
4241
4342// ////////////////////////////////////////////////////////////////////////////
@@ -52,11 +51,9 @@ void ITSMFTDeadMapBuilder::init(InitContext& ic)
5251 N_CHIPS = o2::itsmft::ChipMappingITS::getNChips ();
5352 }
5453
55- mDeadMapTF = new std::vector< uint16_t >{} ;
54+ mDeadMapTF . clear () ;
5655
57- mTreeObject = new TTree (" ccdb_object" , " ccdb_object" );
58- mTreeObject ->Branch (" orbit" , &mFirstOrbitTF );
59- mTreeObject ->Branch (" deadmap" , &mDeadMapTF );
56+ mMapObject .clear ();
6057
6158 mTFSampling = ic.options ().get <int >(" tf-sampling" );
6259 mTFLength = ic.options ().get <int >(" tf-length" );
@@ -95,13 +92,11 @@ void ITSMFTDeadMapBuilder::finalizeOutput()
9592 if (mDoLocalOutput ) {
9693 std::string localoutfilename = mLocalOutputDir + " /" + mObjectName ;
9794 TFile outfile (localoutfilename.c_str (), " RECREATE" );
98- outfile.cd ();
99- mTreeObject ->Write ();
95+ outfile.WriteObjectAny (&mMapObject , " std::map<unsigned long, std::vector<uint16_t>>" , " ccdb_object" );
10096 outfile.Close ();
10197 }
10298 return ;
103-
104- } // finalizeOutput
99+ }
105100
106101// ////////////////////////////////////////////////////////////////////////////
107102// Main running function
@@ -120,14 +115,14 @@ void ITSMFTDeadMapBuilder::run(ProcessingContext& pc)
120115
121116 mFirstOrbitTF = pc.services ().get <o2::framework::TimingInfo>().firstTForbit ;
122117
123- if ((Long64_t )(mFirstOrbitTF / mTFLength ) % mTFSampling != 0 ) {
118+ if ((unsigned long )(mFirstOrbitTF / mTFLength ) % mTFSampling != 0 ) {
124119 return ;
125120 }
126121
127122 mStepCounter ++;
128123 LOG (info) << " Processing step #" << mStepCounter << " out of " << mTFCounter << " TF received. First orbit " << mFirstOrbitTF ;
129124
130- mDeadMapTF -> clear ();
125+ mDeadMapTF . clear ();
131126
132127 std::vector<bool > ElementsStatus (getElementIDFromChip (N_CHIPS), false );
133128
@@ -170,18 +165,18 @@ void ITSMFTDeadMapBuilder::run(ProcessingContext& pc)
170165 bool previous_dead = (el > 0 && !ElementsStatus.at (el - 1 ));
171166 bool next_dead = (el < ElementsStatus.size () - 1 && !ElementsStatus.at (el + 1 ));
172167 if (!previous_dead && next_dead) {
173- mDeadMapTF -> push_back (el | (uint16_t )(0x8000 ));
168+ mDeadMapTF . push_back (el | (uint16_t )(0x8000 ));
174169 } else if (previous_dead && next_dead) {
175170 continue ;
176171 } else {
177- mDeadMapTF -> push_back (el);
172+ mDeadMapTF . push_back (el);
178173 }
179174 }
180175
181- LOG (info) << " TF contains " << CountDead << " dead elements, saved into " << mDeadMapTF -> size () << " words." ;
176+ LOG (info) << " TF contains " << CountDead << " dead elements, saved into " << mDeadMapTF . size () << " words." ;
182177
183- // filling the tree
184- mTreeObject -> Fill () ;
178+ // filling the map
179+ mMapObject [ mFirstOrbitTF ] = mDeadMapTF ;
185180
186181 end = std::chrono::high_resolution_clock::now ();
187182 int difference = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count ();
@@ -207,7 +202,8 @@ void ITSMFTDeadMapBuilder::PrepareOutputCcdb(DataAllocator& output)
207202
208203 o2::ccdb::CcdbObjectInfo info ((path + name_str), " time_dead_map" , mObjectName , md, tstart, tend);
209204
210- auto image = o2::ccdb::CcdbApi::createObjectImage (mTreeObject , &info);
205+ auto image = o2::ccdb::CcdbApi::createObjectImage (&mMapObject , &info);
206+ info.setFileName (mObjectName );
211207
212208 info.setAdjustableEOV ();
213209
@@ -241,7 +237,7 @@ void ITSMFTDeadMapBuilder::endOfStream(EndOfStreamContext& ec)
241237}
242238
243239// ////////////////////////////////////////////////////////////////////////////
244- // DDS stop method: simply close the latest tree
240+ // DDS stop method: create local output if endOfStream not processed
245241void ITSMFTDeadMapBuilder::stop ()
246242{
247243 if (!isEnded) {
0 commit comments