59 DataObject*& refpObject ) {
61 MsgStream log(
msgSvc(),
"RootTofCalibDataCnv" );
62 log << MSG::DEBUG <<
"SetProperty" << endmsg;
66 if ( !sc ) { log << MSG::ERROR <<
"unable to open files" << endmsg; }
75 std::vector<CalibData::bTofCalibBase> tmpbTof;
76 std::vector<CalibData::eTofCalibBase> tmpeTof;
77 std::vector<CalibData::etfCalibBase> tmpetf;
78 std::vector<CalibData::etfBunchCalibBase> tmpetfBunch;
79 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
80 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
101 TTree* btoftree = (TTree*)
m_inFile->Get(
"BarTofPar" );
104 for (
unsigned int i = 0; i <
nBarAtten; i++ )
106 sprintf( brname,
"Atten%i", i );
107 btoftree->SetBranchAddress( brname, &cnvBarAtten[i] );
109 for (
unsigned int i = 0; i <
nBarSpeed; i++ )
111 sprintf( brname,
"Speed%i", i );
112 btoftree->SetBranchAddress( brname, &cnvBarSpeed[i] );
114 for (
unsigned int i = 0; i <
nBarPar; i++ )
117 btoftree->SetBranchAddress( brname, &cnvBarPar1[i] );
119 for (
unsigned int i = 0; i <
nBarPar; i++ )
122 btoftree->SetBranchAddress( brname, &cnvBarPar2[i] );
124 for (
unsigned int i = 0; i <
nBarParOff; i++ )
126 sprintf( brname,
"Bunch0_Poff%i", i );
127 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch0[i] );
129 for (
unsigned int i = 0; i <
nBarParOff; i++ )
132 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch0[i] );
134 for (
unsigned int i = 0; i <
nBarParOff; i++ )
136 sprintf( brname,
"Bunch1_Poff%i", i );
137 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch1[i] );
139 for (
unsigned int i = 0; i <
nBarParOff; i++ )
142 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch1[i] );
144 for (
unsigned int i = 0; i <
nBarParOff; i++ )
146 sprintf( brname,
"Bunch2_Poff%i", i );
147 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch2[i] );
149 for (
unsigned int i = 0; i <
nBarParOff; i++ )
152 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch2[i] );
154 for (
unsigned int i = 0; i <
nBarParOff; i++ )
156 sprintf( brname,
"Bunch3_Poff%i", i );
157 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch3[i] );
159 for (
unsigned int i = 0; i <
nBarParOff; i++ )
162 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch3[i] );
164 for (
unsigned int i = 0; i <
nBarSigma; i++ )
166 sprintf( brname,
"FLeft%i", i );
167 btoftree->SetBranchAddress( brname, &cnvFLeft[i] );
169 for (
unsigned int i = 0; i <
nBarSigma; i++ )
171 sprintf( brname,
"FRight%i", i );
172 btoftree->SetBranchAddress( brname, &cnvFRight[i] );
174 for (
unsigned int i = 0; i <
nBarSigCnt; i++ )
176 sprintf( brname,
"FCounter%i", i );
177 btoftree->SetBranchAddress( brname, &cnvFCount[i] );
180 for ( cnt = 0; cnt < btoftree->GetEntries(); cnt++ )
182 btoftree->GetEntry( cnt );
185 bTof.
setP1( cnvBarPar1 );
186 bTof.
setP2( cnvBarPar2 );
198 tmpbTof.push_back( bTof );
207 TTree* etoftree = (TTree*)
m_inFile->Get(
"EndTofPar" );
210 for (
unsigned int i = 0; i <
nEndAtten; i++ )
212 sprintf( ecname,
"Atten%i", i );
213 etoftree->SetBranchAddress( ecname, &cnvEndAtten[i] );
215 for (
unsigned int i = 0; i <
nEndSpeed; i++ )
217 sprintf( ecname,
"Speed%i", i );
218 etoftree->SetBranchAddress( ecname, &cnvEndSpeed[i] );
220 for (
unsigned int i = 0; i <
nEndPar; i++ )
223 etoftree->SetBranchAddress( ecname, &cnvEndPar[i] );
225 for (
unsigned int i = 0; i <
nEndSigma; i++ )
227 sprintf( ecname,
"FCounter%i", i );
228 etoftree->SetBranchAddress( ecname, &cnvEndFPar[i] );
231 for ( cnt = 0; cnt < etoftree->GetEntries(); cnt++ )
233 etoftree->GetEntry( cnt );
236 eTof.
setP( cnvEndPar );
237 eTof.
setFP( cnvEndFPar );
238 tmpeTof.push_back( eTof );
247 if ( NULL !=
m_inFile->Get(
"EtfTofPar" ) )
249 TTree* etftree = (TTree*)
m_inFile->Get(
"EtfTofPar" );
252 for (
unsigned int i = 0; i <
nEtfSpeed; i++ )
254 sprintf( etfname,
"Speed%i", i );
255 etftree->SetBranchAddress( etfname, &cnvEtfSpeed[i] );
257 for (
unsigned int i = 0; i <
nEtfPar; i++ )
260 etftree->SetBranchAddress( etfname, &cnvEtfPar[i] );
262 for (
unsigned int i = 0; i <
nEtfPar; i++ )
265 etftree->SetBranchAddress( etfname, &cnvEtfPar1[i] );
267 for (
unsigned int i = 0; i <
nEtfPar; i++ )
270 etftree->SetBranchAddress( etfname, &cnvEtfPar2[i] );
273 for ( cnt = 0; cnt < etftree->GetEntries(); cnt++ )
275 etftree->GetEntry( cnt );
277 etf.
setP( cnvEtfPar );
278 etf.
setP1( cnvEtfPar1 );
279 etf.
setP2( cnvEtfPar2 );
280 tmpetf.push_back( etf );
287 if ( NULL !=
m_inFile->Get(
"EtfTofBunch" ) )
289 TTree* etfbunchtree = (TTree*)
m_inFile->Get(
"EtfTofBunch" );
291 char etfbunchname[10];
292 for (
unsigned int i = 0; i <
nEtfBunch; i++ )
294 sprintf( etfbunchname,
"pbunch%i", i );
295 etfbunchtree->SetBranchAddress( etfbunchname, &cnvEtfBunchP[i] );
298 int entries = etfbunchtree->GetEntries();
299 for ( cnt = 0; cnt < entries; cnt++ )
301 etfbunchtree->GetEntry( cnt );
303 tmpetfBunch.push_back( etfBunch );
310 TTree* btofcommontree = (TTree*)
m_inFile->Get(
"BarTofParCommon" );
311 for (
unsigned int i = 0; i <
nBarSigCor; i++ )
313 sprintf( brname,
"sigmaCorr%i", i );
314 btofcommontree->SetBranchAddress( brname, &cnvBarSigCor[i] );
316 for (
unsigned int i = 0; i <
nBarOffset; i++ )
318 sprintf( brname,
"t0offset%i", i );
319 btofcommontree->SetBranchAddress( brname, &cnvBarOffset[i] );
322 int entries = btofcommontree->GetEntries();
323 for ( cnt = 0; cnt < entries; cnt++ )
325 btofcommontree->GetEntry( cnt );
328 tmpbTofCommon.push_back( bTofCommon );
331 int m_run1, m_run2, m_version;
332 int m_qCorr, m_qElec, m_misLable;
333 int m_tofidEast[5], m_tofidWest[5], m_tofidEndcap[5];
334 int m_runFrom, m_runTo, m_eventFrom, m_eventTo;
336 TTree* CalibInfo = (TTree*)
m_inFile->Get(
"CalibInfo" );
337 CalibInfo->SetBranchAddress(
"Run1", &m_run1 );
338 CalibInfo->SetBranchAddress(
"Run2", &m_run2 );
339 CalibInfo->SetBranchAddress(
"Version", &m_version );
340 CalibInfo->SetBranchAddress(
"ebrId0", &m_tofidEast[0] );
341 CalibInfo->SetBranchAddress(
"ebrId1", &m_tofidEast[1] );
342 CalibInfo->SetBranchAddress(
"ebrId2", &m_tofidEast[2] );
343 CalibInfo->SetBranchAddress(
"ebrId3", &m_tofidEast[3] );
344 CalibInfo->SetBranchAddress(
"ebrId4", &m_tofidEast[4] );
345 CalibInfo->SetBranchAddress(
"ecId0", &m_tofidEndcap[0] );
346 CalibInfo->SetBranchAddress(
"ecId1", &m_tofidEndcap[1] );
347 CalibInfo->SetBranchAddress(
"ecId2", &m_tofidEndcap[2] );
348 CalibInfo->SetBranchAddress(
"ecId3", &m_tofidEndcap[3] );
349 CalibInfo->SetBranchAddress(
"ecId4", &m_tofidEndcap[4] );
350 CalibInfo->SetBranchAddress(
"wbrId0", &m_tofidWest[0] );
351 CalibInfo->SetBranchAddress(
"wbrId1", &m_tofidWest[1] );
352 CalibInfo->SetBranchAddress(
"wbrId2", &m_tofidWest[2] );
353 CalibInfo->SetBranchAddress(
"wbrId3", &m_tofidWest[3] );
354 CalibInfo->SetBranchAddress(
"wbrId4", &m_tofidWest[4] );
355 CalibInfo->SetBranchAddress(
"misLable", &m_misLable );
356 CalibInfo->SetBranchAddress(
"qCorr", &m_qCorr );
357 CalibInfo->SetBranchAddress(
"qElec", &m_qElec );
358 if ( CalibInfo->GetBranchStatus(
"runFrom" ) )
360 CalibInfo->SetBranchAddress(
"runFrom", &m_runFrom );
361 CalibInfo->SetBranchAddress(
"runTo", &m_runTo );
362 CalibInfo->SetBranchAddress(
"eventFrom", &m_eventFrom );
363 CalibInfo->SetBranchAddress(
"eventTo", &m_eventTo );
373 entries = CalibInfo->GetEntries();
374 for ( cnt = 0; cnt < entries; cnt++ )
376 CalibInfo->GetEntry( cnt );
390 tofinfoCol.push_back( tofinfo );
394 tmpbTof, tmpbTofCommon, tmpeTof, tmpetf, tmpetfBunch, tofinfoCol );
396 refpObject = tmpObject;
398 return StatusCode::SUCCESS;
403 MsgStream log(
msgSvc(),
"RootTofCalibDataCnv" );
407 if ( !sc ) { log << MSG::ERROR <<
"unable to open files" << endmsg; }
429 char brname[8], ibrname[8];
430 TTree* btoftree =
new TTree(
"BarTofPar",
"BarTofPar" );
431 for (
unsigned int i = 0; i <
nBarAtten; i++ )
433 sprintf( brname,
"Atten%i", i );
434 sprintf( ibrname,
"Atten%i/D", i );
435 btoftree->Branch( brname, &cnvBarAtten[i], ibrname );
437 for (
unsigned int i = 0; i <
nBarSpeed; i++ )
439 sprintf( brname,
"Speed%i", i );
440 sprintf( ibrname,
"Speed%i/D", i );
441 btoftree->Branch( brname, &cnvBarSpeed[i], ibrname );
443 for (
unsigned int i = 0; i <
nBarPar; i++ )
446 sprintf( ibrname,
"P%i/D", i );
447 btoftree->Branch( brname, &cnvBarPar1[i], ibrname );
449 for (
unsigned int i = 0; i <
nBarPar; i++ )
453 btoftree->Branch( brname, &cnvBarPar2[i], ibrname );
455 for (
unsigned int i = 0; i <
nBarParOff; i++ )
457 sprintf( brname,
"Bunch0_Poff%i", i );
458 sprintf( ibrname,
"Bunch0_Poff%i/D", i );
459 btoftree->Branch( brname, &cnvBarParOff1_bunch0[i], ibrname );
461 for (
unsigned int i = 0; i <
nBarParOff; i++ )
465 btoftree->Branch( brname, &cnvBarParOff2_bunch0[i], ibrname );
467 for (
unsigned int i = 0; i <
nBarParOff; i++ )
469 sprintf( brname,
"Bunch1_Poff%i", i );
470 sprintf( ibrname,
"Bunch1_Poff%i/D", i );
471 btoftree->Branch( brname, &cnvBarParOff1_bunch1[i], ibrname );
473 for (
unsigned int i = 0; i <
nBarParOff; i++ )
477 btoftree->Branch( brname, &cnvBarParOff2_bunch1[i], ibrname );
479 for (
unsigned int i = 0; i <
nBarParOff; i++ )
481 sprintf( brname,
"Bunch2_Poff%i", i );
482 sprintf( ibrname,
"Bunch2_Poff%i/D", i );
483 btoftree->Branch( brname, &cnvBarParOff1_bunch2[i], ibrname );
485 for (
unsigned int i = 0; i <
nBarParOff; i++ )
489 btoftree->Branch( brname, &cnvBarParOff2_bunch2[i], ibrname );
491 for (
unsigned int i = 0; i <
nBarParOff; i++ )
493 sprintf( brname,
"Bunch3_Poff%i", i );
494 sprintf( ibrname,
"Bunch3_Poff%i/D", i );
495 btoftree->Branch( brname, &cnvBarParOff1_bunch3[i], ibrname );
497 for (
unsigned int i = 0; i <
nBarParOff; i++ )
501 btoftree->Branch( brname, &cnvBarParOff2_bunch3[i], ibrname );
503 for (
unsigned int i = 0; i <
nBarSigma; i++ )
505 sprintf( brname,
"FLeft%i", i );
506 sprintf( ibrname,
"FLeft%i/D", i );
507 btoftree->Branch( brname, &cnvFLeft[i], ibrname );
509 for (
unsigned int i = 0; i <
nBarSigma; i++ )
511 sprintf( brname,
"FRight%i", i );
512 sprintf( ibrname,
"FRight%i/D", i );
513 btoftree->Branch( brname, &cnvFRight[i], ibrname );
515 for (
unsigned int i = 0; i <
nBarSigCnt; i++ )
517 sprintf( brname,
"FCounter%i", i );
518 sprintf( ibrname,
"FCounter%i/D", i );
519 btoftree->Branch( brname, &cnvFCount[i], ibrname );
522 for (
int i = 0; i < 176; i++ )
524 for ( j = 0; j < static_cast<int>(
nBarAtten ); j++ )
526 for ( j = 0; j < static_cast<int>(
nBarSpeed ); j++ )
528 for ( j = 0; j < static_cast<int>(
nBarPar ); j++ )
533 for ( j = 0; j < static_cast<int>(
nBarParOff ); j++ )
538 for ( j = 0; j < static_cast<int>(
nBarParOff ); j++ )
543 for ( j = 0; j < static_cast<int>(
nBarParOff ); j++ )
548 for ( j = 0; j < static_cast<int>(
nBarParOff ); j++ )
553 for ( j = 0; j < static_cast<int>(
nBarSigma ); j++ )
558 for ( j = 0; j < static_cast<int>(
nBarSigCnt ); j++ )
569 char ecname[8], iecname[8];
570 TTree* etoftree =
new TTree(
"EndTofPar",
"EndTofPar" );
571 for (
unsigned int i = 0; i <
nEndAtten; i++ )
573 sprintf( ecname,
"Atten%i", i );
574 sprintf( iecname,
"Atten%i/D", i );
575 etoftree->Branch( ecname, &cnvEndAtten[i], iecname );
577 for (
unsigned int i = 0; i <
nEndSpeed; i++ )
579 sprintf( ecname,
"Speed%i", i );
580 sprintf( iecname,
"Speed%i/D", i );
581 etoftree->Branch( ecname, &cnvEndSpeed[i], iecname );
583 for (
unsigned int i = 0; i <
nEndPar; i++ )
586 sprintf( iecname,
"P%i/D", i );
587 etoftree->Branch( ecname, &cnvEndPar[i], iecname );
589 for (
unsigned int i = 0; i <
nEndSigma; i++ )
591 sprintf( ecname,
"FCounter%i", i );
592 sprintf( iecname,
"FCounter%i/D", i );
593 etoftree->Branch( ecname, &cnvEndFPar[i], iecname );
596 for (
int i = 0; i < 96; i++ )
598 for ( j = 0; j < static_cast<int>(
nEndAtten ); j++ )
600 for ( j = 0; j < static_cast<int>(
nEndSpeed ); j++ )
602 for ( j = 0; j < static_cast<int>(
nEndPar ); j++ )
603 { cnvEndPar[j] = btof->
getETofP( i, j ); }
604 for ( j = 0; j < static_cast<int>(
nEndSigma ); j++ )
605 { cnvEndFPar[j] = btof->
getETofFP( i, j ); }
615 char etfname[8], ietfname[8];
616 TTree* etftree =
new TTree(
"EtfTofPar",
"EtfTofPar" );
617 for (
unsigned int i = 0; i <
nEtfSpeed; i++ )
619 sprintf( etfname,
"Speed%i", i );
620 sprintf( ietfname,
"Speed%i/D", i );
621 etftree->Branch( etfname, &cnvEtfSpeed[i], ietfname );
623 for (
unsigned int i = 0; i <
nEtfPar; i++ )
626 sprintf( ietfname,
"P%i/D", i );
627 etftree->Branch( etfname, &cnvEtfPar[i], ietfname );
629 for (
unsigned int i = 0; i <
nEtfPar; i++ )
633 etftree->Branch( etfname, &cnvEtfPar1[i], ietfname );
635 for (
unsigned int i = 0; i <
nEtfPar; i++ )
639 etftree->Branch( etfname, &cnvEtfPar2[i], ietfname );
642 for (
int i = 0; i < 72; i++ )
644 for (
int k = 0; k < 12; k++ )
646 for ( j = 0; j < static_cast<int>(
nEtfSpeed ); j++ )
648 for ( j = 0; j < static_cast<int>(
nEtfPar ); j++ )
661 char etfbunchname[8], ietfbunchname[8];
662 TTree* etfbunchtree =
new TTree(
"EtfTofBunch",
"EtfTofBunch" );
663 for (
unsigned int i = 0; i <
nEtfBunch; i++ )
665 sprintf( etfbunchname,
"pbunch%i", i );
666 sprintf( ietfbunchname,
"pbunch%i/D", i );
667 etfbunchtree->Branch( etfbunchname, &cnvEtfBunchP[i], ietfbunchname );
670 for ( j = 0; j < static_cast<int>(
nEtfBunch ); j++ )
672 etfbunchtree->Fill();
678 etfbunchtree->Write();
684 log << MSG::INFO <<
"successfully create RootFile" << endmsg;