92 MsgStream log(
msgSvc(), name());
93 log<<MSG::INFO<<
"tofcalgsec::initialize()!" <<endreq;
96 NTuplePtr nt1(
ntupleSvc(),
"TofCalib/btrk");
97 NTuplePtr nt2(
ntupleSvc(),
"TofCalib/etrk");
98 NTuplePtr nt3(
ntupleSvc(),
"TofCalib/etf");
99 if ( nt1 || nt2 || nt3 ) {
105 mtuple_barrel =
ntupleSvc()->book(
"TofCalib/btrk",CLID_ColumnWiseTuple,
"TofCalib");
106 mtuple_endcap =
ntupleSvc()->book(
"TofCalib/etrk",CLID_ColumnWiseTuple,
"TofCalib");
107 mtuple_etf =
ntupleSvc()->book(
"TofCalib/etf", CLID_ColumnWiseTuple,
"TofCalib");
109 if( mtuple_barrel ) {
113 log << MSG::ERROR <<
"Cannot book N-tuple:" << long(mtuple_barrel) <<endmsg;
114 return StatusCode::FAILURE;
116 if( mtuple_endcap ) {
120 log << MSG::ERROR <<
"Cannot book N-tuple:" << long(mtuple_endcap) <<endmsg;
121 return StatusCode::FAILURE;
127 log << MSG::ERROR <<
"Cannot book N-tuple:" << long(mtuple_etf) <<endmsg;
128 return StatusCode::FAILURE;
133 m_calibration =
true;
136 if( !m_online || m_calibration ) {
138 std::cout<<
" tofcalgsec checks your configurations ..."<<std::endl;
140 if((pdir=gSystem->OpenDirectory(m_workdir.c_str()))==0){
141 std::cerr<<
"WorkDir "<<m_workdir<<
" doesn't exist "<<std::endl;
142 if(gSystem->MakeDirectory(m_workdir.c_str())==-1){
143 std::cerr<<
" Fail to create directory : "<<m_workdir
144 <<
" Specify ./ as current work directory"<<std::endl;
149 gSystem->FreeDirectory(pdir);
156 if( (pdir=gSystem->OpenDirectory(m_datafile_dir.c_str())) ) {
158 std::vector<string>::iterator it = m_datafile_barrel.begin();
159 for( ; it!=m_datafile_barrel.end(); it++ ) {
160 if( (*it).size()>0 ) {
161 std::string thefile = (m_datafile_dir+
"/"+(*it));
162 if( gSystem->GetPathInfo(thefile.c_str(),
fs)==0 ) {
163 m_barrelfile.push_back(thefile);
166 std::cerr<<
" File "<<thefile<<
" doesn't exist! "<<std::endl;
170 it = m_datafile_endcap.begin();
171 for( ; it!=m_datafile_endcap.end(); it++ ) {
172 if( (*it).size()>0 ) {
173 std::string thefile=(m_datafile_dir+
"/"+(*it));
174 if( gSystem->GetPathInfo(thefile.c_str(),
fs)==0 ) {
175 m_endcapfile.push_back(thefile);
178 std::cerr<<
" File "<<thefile<<
" doesn't exist! "<<std::endl;
182 it = m_datafile_etf.begin();
183 for( ; it!=m_datafile_etf.end(); it++ ) {
184 if( (*it).size()>0 ) {
185 std::string thefile=(m_datafile_dir+
"/"+(*it));
186 if( gSystem->GetPathInfo(thefile.c_str(),
fs)==0 ) {
187 m_etffile.push_back(thefile);
190 std::cerr<<
" File "<<thefile<<
" doesn't exist! "<<std::endl;
194 gSystem->FreeDirectory(pdir);
198 std::cerr<<
" Error : Please specify the InputDataDir which contains input data files for calibration "<<std::endl;
203 if( !m_online || m_calibration ) {
204 std::cout<<
"******************* Report of before Calibration ********************"<<std::endl
205 <<
"* WorkDir = "<<m_workdir<<
" [ results are save in this directory ] "<<std::endl
206 <<
"* WorkMode = "<<(m_online?
"OnLine":
"OffLine")<<
" [ run alone or with other algorithms ] "<<std::endl
207 <<
"* CalibItem = "<<m_calibItem<<
" [ which calibraions you perform ]"<<std::endl;
211 std::cout <<
"* ==> InputDataDir : "<<m_datafile_dir<<std::endl
212 <<
"* ===>Files of Barrel : ";
213 for( std::vector<std::string>::iterator it=m_barrelfile.begin(); it!=m_barrelfile.end(); it++ ) {
214 std::cout <<
"'" << (*it) <<
"' ";
216 std::cout << std::endl
217 <<
"* ===>Files of Endcap : ";
218 for( std::vector<std::string>::iterator it=m_endcapfile.begin(); it!=m_endcapfile.end(); it++ ) {
219 std::cout <<
"'" << (*it) <<
"' ";
221 std::cout << std::endl
222 <<
"* ===>Files of Etf : ";
223 for( std::vector<std::string>::iterator it=m_etffile.begin(); it!=m_etffile.end(); it++ ) {
224 std::cout <<
"'" << (*it) <<
"' ";
226 std::cout << std::endl;
228 std::cout<<
"*********************************************************************"<<std::endl;
230 return StatusCode::SUCCESS;