1#include "GaudiKernel/MsgStream.h"
3#include "CalibData/Tof/TofCalibData.h"
4#include "CalibDataSvc/IInstrumentName.h"
5#include "CalibMySQLCnv/TreeAddress.h"
12#include "GaudiKernel/CnvFactory.h"
13#include "GaudiKernel/IOpaqueAddress.h"
14#include "GaudiKernel/DataObject.h"
15#include "GaudiKernel/IAddressCreator.h"
16#include "GaudiKernel/IDataProviderSvc.h"
17#include "GaudiKernel/IConversionSvc.h"
18#include "GaudiKernel/GenericAddress.h"
20#include "CalibDataSvc/ICalibTreeSvc.h"
21#include "CalibDataSvc/ICalibMetaCnvSvc.h"
24#include "CalibData/CalibModel.h"
50 DataObject*& refpObject) {
52 MsgStream log(
msgSvc(),
"TreeEstTofCalibDataCnv");
53 log<<MSG::DEBUG<<
"SetProperty"<<endreq;
58 TBufferFile *buf1 =
new TBufferFile(TBuffer::kRead);
59 TBufferFile *buf2 =
new TBufferFile(TBuffer::kRead);
60 TBufferFile *buf3 =
new TBufferFile(TBuffer::kRead);
61 TBufferFile *buf4 =
new TBufferFile(TBuffer::kRead);
62 TBufferFile *buf5 = 0;
64 buf1->SetBuffer((*records)[
"BarTofPar"],512000,kFALSE);
65 buf2->SetBuffer((*records)[
"EndTofPar"],512000,kFALSE);
66 buf3->SetBuffer((*records)[
"TofConPar"],512000,kFALSE);
67 buf4->SetBuffer((*records)[
"BarTof"],512000,kFALSE);
69 if( (*records)[
"EtfTofPar"]!=0 ) {
70 buf5 =
new TBufferFile(TBuffer::kRead);
71 buf5->SetBuffer((*records)[
"EtfTofPar"],512000,kFALSE);
74 std::cout<<
" CalVerSft is "<<(*records)[
"CalParVer"];
75 std::cout<<
" File name is "<<(*records)[
"FileName"]<<std::endl;
77 TTree *btoftree =
new TTree();
78 TTree *etoftree =
new TTree();
79 TTree *etftree =
new TTree();
80 TTree *btofcommontree =
new TTree();
81 TTree *CalibInfo =
new TTree();
83 btoftree->Streamer(*buf1);
84 etoftree->Streamer(*buf2);
85 btofcommontree->Streamer(*buf3);
86 CalibInfo->Streamer(*buf4);
88 etftree->Streamer(*buf5);
97 std::vector<CalibData::bTofCalibBase> tmpbTof;
98 std::vector<CalibData::eTofCalibBase> tmpeTof;
99 std::vector<CalibData::etfCalibBase> tmpetf;
100 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
101 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
118 for(
unsigned int i=0; i<
nBarPar; i++ ) {
119 sprintf( brname,
"P%i", i );
122 for(
unsigned int i=0; i<
nBarPar; i++ ) {
123 sprintf( brname,
"P%i", i+
nBarPar );
127 sprintf( brname,
"Bunch0_Poff%i", i );
131 sprintf( brname,
"Bunch0_Poff%i", i+
nBarParOff );
135 sprintf( brname,
"Bunch1_Poff%i", i );
139 sprintf( brname,
"Bunch1_Poff%i", i+
nBarParOff );
143 sprintf( brname,
"Bunch2_Poff%i", i );
147 sprintf( brname,
"Bunch2_Poff%i", i+
nBarParOff );
151 sprintf( brname,
"Bunch3_Poff%i", i );
155 sprintf( brname,
"Bunch3_Poff%i", i+
nBarParOff );
159 for(cnt=0; cnt<176; cnt++){
161 bTof.
setP1( cnvBarPar1 );
162 bTof.
setP2( cnvBarPar2 );
171 tmpbTof.push_back(bTof);
179 for(
unsigned int i=0; i<
nEndPar; i++ ) {
180 sprintf( ecname,
"P%i", i );
184 for( cnt=0; cnt<96; cnt++ ) {
186 eTof.
setP( cnvEndPar );
187 tmpeTof.push_back( eTof );
192 if( etftree->GetEntries() != 0 ) {
199 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
200 sprintf( etfname,
"P%i", i );
202 sprintf( etfname,
"P%i",
nEtfPar+i );
204 sprintf( etfname,
"P%i", 2*
nEtfPar+i );
208 for(cnt=0; cnt<(72*12); cnt++){
210 etf.
setP( cnvEtfPar );
211 etf.
setP1( cnvEtfPar1 );
212 etf.
setP2( cnvEtfPar2 );
213 tmpetf.push_back(etf);
222 sprintf( brname,
"t0offset%i", i );
226 int entries = btofcommontree->GetEntries();
227 for(cnt=0;cnt<entries;cnt++){
228 btofcommontree->GetEntry(cnt);
230 tmpbTofCommon.push_back(bTofCommon);
235 refpObject=tmpObject;
239 delete btofcommontree;
242 return StatusCode::SUCCESS;
const CLID CLID_Calib_EstTofCal
data SetBranchAddress("time",&time)
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nEtfPar
const unsigned int nBarPar
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nEtfPar
const unsigned int nBarPar
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)
void setP(const double *etfP)
void setP1(const double *etfP1)
void setP2(const double *etfP2)
virtual DatabaseRecord * pp()
TreeEstTofCalibDataCnv(ISvcLocator *svc)
const CLID & objType() const
static const CLID & classID()
virtual StatusCode i_createObj(IOpaqueAddress *address, DataObject *&refpObject)