File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,21 +153,19 @@ void PHOSEnergyCalibDevice::fillOutputTree()
153153 mHistoFileName = mOutputDir + fmt::format (" PHOS_CalibHistos_{}.root" , mRunNumber );
154154 mHistoFileOut = std::make_unique<TFile>(mHistoFileName .c_str (), " recreate" );
155155 mHistoFileMetaData = std::make_unique<o2::dataformats::FileMetaData>();
156+ mFileOut ->cd ();
156157 }
157158 // else Tree will be memory resident
158- mTreeOut = std::make_unique<TTree>(" phosCalibDig" , " O2 PHOS calib tree" );
159+ if (!mTreeOut ) {
160+ LOG (info) << " Creating new tree for PHOS calib digits" ;
161+ mTreeOut = std::make_unique<TTree>(" phosCalibDig" , " O2 PHOS calib tree" );
162+ }
159163 }
160164 auto * br = mTreeOut ->GetBranch (" PHOSCalib" );
161- auto * pptr = &mOutputDigits ;
162- if (br) {
163- LOG (info) << " Using existing branch" ;
164- br->SetAddress (&pptr);
165- } else {
166- LOG (info) << " Create new branch" ;
167- br = mTreeOut ->Branch (" PHOSCalib" , &pptr);
165+ if (!br) {
166+ br = mTreeOut ->Branch (" PHOSCalib" , &mOutputDigits );
168167 }
169- mTreeOut ->Fill ();
170- br->ResetAddress ();
168+ int abits = mTreeOut ->Fill ();
171169}
172170
173171void PHOSEnergyCalibDevice::writeOutFile ()
@@ -180,7 +178,7 @@ void PHOSEnergyCalibDevice::writeOutFile()
180178 return ;
181179 }
182180 LOG (info) << " Writing calibration digits" ;
183- mFileOut -> cd ();
181+
184182 int nbits = mTreeOut ->Write ();
185183 LOG (info) << " Wrote " << nbits << " bits" ;
186184 mTreeOut .reset ();
You can’t perform that action at this time.
0 commit comments