91 MsgStream log(
msgSvc(), name() );
92 log << MSG::INFO <<
"tofcalgsec::initialize()!" << endmsg;
96 NTuplePtr nt1(
ntupleSvc(),
"TofCalib/btrk" );
97 NTuplePtr nt2(
ntupleSvc(),
"TofCalib/etrk" );
98 NTuplePtr nt3(
ntupleSvc(),
"TofCalib/etf" );
99 if ( nt1 || nt2 || nt3 )
107 mtuple_barrel =
ntupleSvc()->book(
"TofCalib/btrk", CLID_ColumnWiseTuple,
"TofCalib" );
108 mtuple_endcap =
ntupleSvc()->book(
"TofCalib/etrk", CLID_ColumnWiseTuple,
"TofCalib" );
109 mtuple_etf =
ntupleSvc()->book(
"TofCalib/etf", CLID_ColumnWiseTuple,
"TofCalib" );
111 if ( mtuple_barrel ) { m_checkbarrel =
new TofCalibCheck( mtuple_barrel ); }
114 log << MSG::ERROR <<
"Cannot book N-tuple:" << long( mtuple_barrel ) << endmsg;
115 return StatusCode::FAILURE;
117 if ( mtuple_endcap ) { m_checkendcap =
new TofCalibCheck( mtuple_endcap ); }
120 log << MSG::ERROR <<
"Cannot book N-tuple:" << long( mtuple_endcap ) << endmsg;
121 return StatusCode::FAILURE;
123 if ( mtuple_etf ) { m_checketf =
new TofCalibCheck( mtuple_etf ); }
126 log << MSG::ERROR <<
"Cannot book N-tuple:" << long( mtuple_etf ) << endmsg;
127 return StatusCode::FAILURE;
133 m_calibration =
true;
136 if ( !m_online || m_calibration )
139 std::cout <<
" tofcalgsec checks your configurations ..." << std::endl;
141 if ( ( pdir = gSystem->OpenDirectory( m_workdir.c_str() ) ) == 0 )
143 std::cerr <<
"WorkDir " << m_workdir <<
" doesn't exist " << std::endl;
144 if ( gSystem->MakeDirectory( m_workdir.c_str() ) == -1 )
146 std::cerr <<
" Fail to create directory : " << m_workdir
147 <<
" Specify ./ as current work directory" << std::endl;
153 gSystem->FreeDirectory( pdir );
161 if ( ( pdir = gSystem->OpenDirectory( m_datafile_dir.c_str() ) ) )
164 std::vector<string>::iterator it = m_datafile_barrel.begin();
165 for ( ; it != m_datafile_barrel.end(); it++ )
167 if ( ( *it ).size() > 0 )
169 std::string thefile = ( m_datafile_dir +
"/" + ( *it ) );
170 if ( gSystem->GetPathInfo( thefile.c_str(),
fs ) == 0 )
171 { m_barrelfile.push_back( thefile ); }
172 else { std::cerr <<
" File " << thefile <<
" doesn't exist! " << std::endl; }
175 it = m_datafile_endcap.begin();
176 for ( ; it != m_datafile_endcap.end(); it++ )
178 if ( ( *it ).size() > 0 )
180 std::string thefile = ( m_datafile_dir +
"/" + ( *it ) );
181 if ( gSystem->GetPathInfo( thefile.c_str(),
fs ) == 0 )
182 { m_endcapfile.push_back( thefile ); }
183 else { std::cerr <<
" File " << thefile <<
" doesn't exist! " << std::endl; }
186 it = m_datafile_etf.begin();
187 for ( ; it != m_datafile_etf.end(); it++ )
189 if ( ( *it ).size() > 0 )
191 std::string thefile = ( m_datafile_dir +
"/" + ( *it ) );
192 if ( gSystem->GetPathInfo( thefile.c_str(),
fs ) == 0 )
193 { m_etffile.push_back( thefile ); }
194 else { std::cerr <<
" File " << thefile <<
" doesn't exist! " << std::endl; }
197 gSystem->FreeDirectory( pdir );
202 std::cerr <<
" Error : Please specify the InputDataDir which contains input data files "
209 if ( !m_online || m_calibration )
211 std::cout <<
"******************* Report of before Calibration ********************"
213 <<
"* WorkDir = " << m_workdir <<
" [ results are save in this directory ] "
215 <<
"* WorkMode = " << ( m_online ?
"OnLine" :
"OffLine" )
216 <<
" [ run alone or with other algorithms ] " << std::endl
217 <<
"* CalibItem = " << m_calibItem <<
" [ which calibraions you perform ]"
223 std::cout <<
"* ==> InputDataDir : " << m_datafile_dir << std::endl
224 <<
"* ===>Files of Barrel : ";
225 for ( std::vector<std::string>::iterator it = m_barrelfile.begin();
226 it != m_barrelfile.end(); it++ )
227 { std::cout <<
"'" << ( *it ) <<
"' "; }
228 std::cout << std::endl <<
"* ===>Files of Endcap : ";
229 for ( std::vector<std::string>::iterator it = m_endcapfile.begin();
230 it != m_endcapfile.end(); it++ )
231 { std::cout <<
"'" << ( *it ) <<
"' "; }
232 std::cout << std::endl <<
"* ===>Files of Etf : ";
233 for ( std::vector<std::string>::iterator it = m_etffile.begin(); it != m_etffile.end();
235 { std::cout <<
"'" << ( *it ) <<
"' "; }
236 std::cout << std::endl;
238 std::cout <<
"*********************************************************************"
241 return StatusCode::SUCCESS;
251 MsgStream log(
msgSvc(), name() );
252 log << MSG::INFO <<
"start "
253 <<
"tofcalgsec::execute()" << endmsg;
257 SmartDataPtr<RecBTofCalHitCol> bhitcol( eventSvc(),
"/Event/Recon/RecBTofCalHitCol" );
260 m_checkbarrel->FillBarrelCol( bhitcol );
273 SmartDataPtr<RecETofCalHitCol> ehitcol( eventSvc(),
"/Event/Recon/RecETofCalHitCol" );
276 m_checkendcap->FillEndcapCol( ehitcol );
288 m_checketf->FillEtfCol( bhitcol );
298 log << MSG::INFO <<
"end "
299 <<
"tofcalgsec::execute()" << endmsg;
300 return StatusCode::SUCCESS;