2#include "GaudiKernel/MsgStream.h"
4#include "CalibData/Tof/TofCalibData.h"
5#include "CalibData/Tof/eTofCalibBase.h"
6#include "CalibData/Tof/bTofCalibBase.h"
7#include "CalibDataSvc/IInstrumentName.h"
11#include "TDirectory.h"
14#include "GaudiKernel/CnvFactory.h"
15#include "GaudiKernel/IOpaqueAddress.h"
16#include "GaudiKernel/DataObject.h"
17#include "GaudiKernel/IAddressCreator.h"
18#include "GaudiKernel/IDataProviderSvc.h"
19#include "GaudiKernel/IConversionSvc.h"
20#include "GaudiKernel/GenericAddress.h"
22#include "CalibDataSvc/ICalibRootSvc.h"
23#include "CalibDataSvc/ICalibMetaCnvSvc.h"
29#include "CalibData/CalibModel.h"
53 DataObject*& refpObject) {
55 MsgStream log(
msgSvc(),
"RootEstTofCalibDataCnv");
56 log<<MSG::DEBUG<<
"SetProperty"<<endreq;
61 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
69 std::vector<CalibData::bTofCalibBase> tmpbTof;
70 std::vector<CalibData::eTofCalibBase> tmpeTof;
71 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
72 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
88 TTree *btoftree = (TTree*)
m_inFile -> Get(
"BarTofPar");
91 for(
unsigned int i=0; i<
nBarPar; i++ ) {
92 sprintf( brname,
"P%i", i );
95 for(
unsigned int i=0; i<
nBarPar; i++ ) {
96 sprintf( brname,
"P%i", i+
nBarPar );
100 sprintf( brname,
"Bunch0_Poff%i", i );
104 sprintf( brname,
"Bunch0_Poff%i", i+
nBarParOff );
108 sprintf( brname,
"Bunch1_Poff%i", i );
112 sprintf( brname,
"Bunch1_Poff%i", i+
nBarParOff );
116 sprintf( brname,
"Bunch2_Poff%i", i );
120 sprintf( brname,
"Bunch2_Poff%i", i+
nBarParOff );
124 sprintf( brname,
"Bunch3_Poff%i", i );
128 sprintf( brname,
"Bunch3_Poff%i", i+
nBarParOff );
132 for(cnt=0; cnt<176; cnt++){
134 bTof.
setP1( cnvBarPar1 );
135 bTof.
setP2( cnvBarPar2 );
144 tmpbTof.push_back( bTof );
150 TTree *etoftree = (TTree*)
m_inFile -> Get(
"EndTofPar");
153 for(
unsigned int i=0; i<
nEndPar; i++ ) {
154 sprintf( ecname,
"P%i", i );
158 for(cnt=0; cnt<96; cnt++){
159 etoftree->GetEntry(cnt);
160 eTof.
setP( cnvEndPar );
161 tmpeTof.push_back(eTof);
166 TTree *btofcommontree = (TTree*)
m_inFile -> Get(
"BarTofParCommon");
168 sprintf( brname,
"t0offset%i", i );
172 int entries = btofcommontree->GetEntries();
173 for(cnt=0;cnt<entries;cnt++){
174 btofcommontree->GetEntry(cnt);
176 tmpbTofCommon.push_back(bTofCommon);
181 refpObject=tmpObject;
183 return StatusCode::SUCCESS;
188 MsgStream log(
msgSvc(),
"RootEstTofCalibDataCnv");
193 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
202 char brname[8], ibrname[8];
203 TTree *btoftree =
new TTree(
"BarTofPar",
"BarTofPar");
204 for(
unsigned int i=0; i<
nBarPar; i++ ) {
205 sprintf( brname,
"P%i", i );
206 sprintf( ibrname,
"P%i/D", i );
207 btoftree -> Branch( brname, &cnvBarPar1[i], ibrname );
210 for(
int i=0; i<176; i++ ) {
211 for(
int j=0;j<static_cast<int>(
nBarPar);j++){
221 char ecname[8], iecname[8];
222 TTree *etoftree =
new TTree(
"EndTofPar",
"EndTofPar");
223 for(
unsigned int i=0; i<
nEndPar; i++ ) {
224 sprintf( ecname,
"P%i", i );
225 sprintf( iecname,
"P%i/D", i );
226 etoftree -> Branch( ecname, &cnvEndPar[i], iecname );
229 for(
int i=0; i<96; i++){
230 for(
int j=0;j<static_cast<int>(
nEndPar);j++){
242 log<<MSG::INFO<<
"successfully create RootFile"<<endreq;
const CLID CLID_Calib_EstTofCal
data SetBranchAddress("time",&time)
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nBarPar
double getETofP(int index, int pardex)
double getBTofPleft(int index, int pardex)
double getBTofPright(int index, int pardex)
void setP2(const double *TofP2)
void setPoff1_bunch3(const double *TofPoff1_bunch3)
void setPoff2_bunch1(const double *TofPoff2_bunch1)
void setPoff1_bunch0(const double *TofPoff1_bunch0)
void setPoff2_bunch2(const double *TofPoff2_bunch2)
void setPoff1_bunch1(const double *TofPoff1_bunch1)
void setPoff1_bunch2(const double *TofPoff1_bunch2)
void setPoff2_bunch3(const double *TofPoff2_bunch3)
void setPoff2_bunch0(const double *TofPoff2_bunch0)
void setP1(const double *TofP1)
void setOffset(const double *offset)
void setP(const double *TofP)
StatusCode openRead(const std::string &fname)
virtual StatusCode openWrite(const std::string &fname)
const CLID & objType() const
RootEstTofCalibDataCnv(ISvcLocator *svc)
virtual StatusCode createRoot(const std::string &fname, CalibData::CalibBase1 *pTDSObj)
static const CLID & classID()
virtual StatusCode i_createObj(const std::string &fname, DataObject *&refpObject)