1#include "GaudiKernel/MsgStream.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"
59 DataObject*& refpObject) {
61 MsgStream log(
msgSvc(),
"TreeTofCalibDataCnv");
62 log<<MSG::DEBUG<<
"SetProperty"<<endreq;
68 TBufferFile *buf1 =
new TBufferFile(TBuffer::kRead);
69 TBufferFile *buf2 =
new TBufferFile(TBuffer::kRead);
70 TBufferFile *buf3 =
new TBufferFile(TBuffer::kRead);
71 TBufferFile *buf4 =
new TBufferFile(TBuffer::kRead);
73 buf1->SetBuffer((*records)[
"BarTofPar"],512000,kFALSE);
74 buf2->SetBuffer((*records)[
"EndTofPar"],512000,kFALSE);
75 buf3->SetBuffer((*records)[
"TofConPar"],512000,kFALSE);
76 buf4->SetBuffer((*records)[
"BarTof"],512000,kFALSE);
78 std::cout<<
" SftVer is "<<(*records)[
"SftVer"];
79 std::cout<<
" CalVerSft is "<<(*records)[
"CalParVer"];
80 std::cout<<
" File name is "<<(*records)[
"FileName"]<<std::endl;
82 TTree *btoftree=
new TTree();
83 TTree *etoftree=
new TTree();
84 TTree *btofcommontree =
new TTree();
85 TTree *CalibInfo =
new TTree();
87 btoftree->Streamer(*buf1);
88 etoftree->Streamer(*buf2);
89 btofcommontree->Streamer(*buf3);
90 CalibInfo->Streamer(*buf4);
92 int nentri = btoftree -> GetEntries();
93 int nentri1 = etoftree -> GetEntries();
94 int nentri2 = btofcommontree->GetEntries();
95 int nentri3 = CalibInfo->GetEntries();
102 std::vector<CalibData::bTofCalibBase> tmpbTof;
103 std::vector<CalibData::eTofCalibBase> tmpeTof;
104 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
105 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
127 for(
unsigned int i=0; i<
nBarAtten; i++ ) {
128 sprintf( brname,
"Atten%i", i );
131 for(
unsigned int i=0; i<
nBarSpeed; i++ ) {
132 sprintf( brname,
"Speed%i", i );
135 for(
unsigned int i=0; i<
nBarPar; i++ ) {
136 sprintf( brname,
"P%i", i );
139 for(
unsigned int i=0; i<
nBarPar; i++ ) {
140 sprintf( brname,
"P%i", i+
nBarPar );
144 sprintf( brname,
"Bunch0_Poff%i", i );
148 sprintf( brname,
"Bunch0_Poff%i", i+
nBarParOff );
152 sprintf( brname,
"Bunch1_Poff%i", i );
156 sprintf( brname,
"Bunch1_Poff%i", i+
nBarParOff );
160 sprintf( brname,
"Bunch2_Poff%i", i );
164 sprintf( brname,
"Bunch2_Poff%i", i+
nBarParOff );
168 sprintf( brname,
"Bunch3_Poff%i", i );
172 sprintf( brname,
"Bunch3_Poff%i", i+
nBarParOff );
175 for(
unsigned int i=0; i<
nBarSigma; i++ ) {
176 sprintf( brname,
"FLeft%i", i );
179 for(
unsigned int i=0; i<
nBarSigma; i++ ) {
180 sprintf( brname,
"FRight%i", i );
184 sprintf( brname,
"FCounter%i", i );
188 for(cnt=0; cnt<176; cnt++){
192 bTof.
setP1( cnvBarPar1 );
193 bTof.
setP2( cnvBarPar2 );
205 tmpbTof.push_back(bTof);
215 for(
unsigned int i=0; i<
nEndAtten; i++ ) {
216 sprintf( ecname,
"Atten%i", i );
219 for(
unsigned int i=0; i<
nEndSpeed; i++ ) {
220 sprintf( ecname,
"Speed%i", i );
223 for(
unsigned int i=0; i<
nEndPar; i++ ) {
224 sprintf( ecname,
"P%i", i );
227 for(
unsigned int i=0; i<
nEndSigma; i++ ) {
228 sprintf( ecname,
"FCounter%i", i );
232 for(cnt=0; cnt<96; cnt++){
236 eTof.
setP( cnvEndPar );
237 eTof.
setFP( cnvEndFPar );
238 tmpeTof.push_back(eTof);
245 sprintf( brname,
"sigmaCorr%i", i );
249 sprintf( brname,
"t0offset%i", i );
253 int entries = btofcommontree->GetEntries();
254 for(cnt=0;cnt<entries;cnt++){
255 btofcommontree->GetEntry(cnt);
258 tmpbTofCommon.push_back(bTofCommon);
261 int m_run1, m_run2, m_version;
262 int m_qCorr, m_qElec, m_misLable;
263 int m_tofidEast[5], m_tofidWest[5], m_tofidEndcap[5];
266 CalibInfo->SetBranchAddress(
"Run1",&m_run1);
267 CalibInfo->SetBranchAddress(
"Run2",&m_run2);
268 CalibInfo->SetBranchAddress(
"Version",&m_version);
269 CalibInfo->SetBranchAddress(
"ebrId0",&m_tofidEast[0]);
270 CalibInfo->SetBranchAddress(
"ebrId1",&m_tofidEast[1]);
271 CalibInfo->SetBranchAddress(
"ebrId2",&m_tofidEast[2]);
272 CalibInfo->SetBranchAddress(
"ebrId3",&m_tofidEast[3]);
273 CalibInfo->SetBranchAddress(
"ebrId4",&m_tofidEast[4]);
274 CalibInfo->SetBranchAddress(
"ecId0",&m_tofidEndcap[0]);
275 CalibInfo->SetBranchAddress(
"ecId1",&m_tofidEndcap[1]);
276 CalibInfo->SetBranchAddress(
"ecId2",&m_tofidEndcap[2]);
277 CalibInfo->SetBranchAddress(
"ecId3",&m_tofidEndcap[3]);
278 CalibInfo->SetBranchAddress(
"ecId4",&m_tofidEndcap[4]);
279 CalibInfo->SetBranchAddress(
"wbrId0",&m_tofidWest[0]);
280 CalibInfo->SetBranchAddress(
"wbrId1",&m_tofidWest[1]);
281 CalibInfo->SetBranchAddress(
"wbrId2",&m_tofidWest[2]);
282 CalibInfo->SetBranchAddress(
"wbrId3",&m_tofidWest[3]);
283 CalibInfo->SetBranchAddress(
"wbrId4",&m_tofidWest[4]);
284 CalibInfo->SetBranchAddress(
"misLable",&m_misLable);
285 CalibInfo->SetBranchAddress(
"qCorr",&m_qCorr);
286 CalibInfo->SetBranchAddress(
"qElec",&m_qElec);
288 entries= CalibInfo->GetEntries();
289 for(cnt=0;cnt<entries;cnt++){
290 CalibInfo->GetEntry(cnt);
300 tofinfoCol.push_back(tofinfo);
305 refpObject=tmpObject;
308 delete btofcommontree;
311 return StatusCode::SUCCESS;
const CLID CLID_Calib_TofCal
data SetBranchAddress("time",&time)
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nBarPar
const unsigned int nBarSigma
const unsigned int nEndSigma
const unsigned int nBarSigCor
const unsigned int nEndSpeed
const unsigned int nBarSpeed
const unsigned int nEndAtten
const unsigned int nBarAtten
const unsigned int nBarSigCnt
const unsigned int nBarSigma
const unsigned int nEndSigma
const unsigned int nBarSigCor
const unsigned int nEndSpeed
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nBarSpeed
const unsigned int nEndAtten
const unsigned int nBarAtten
const unsigned int nBarSigCnt
const unsigned int nBarPar
void setP2(const double *TofP2)
void setPoff1_bunch3(const double *TofPoff1_bunch3)
void setFPleft(const double *FP1)
void setPoff2_bunch1(const double *TofPoff2_bunch1)
void setSpeed(const double *Speed)
void setAtten(const double *Atten)
void setPoff1_bunch0(const double *TofPoff1_bunch0)
void setPoff2_bunch2(const double *TofPoff2_bunch2)
void setPoff1_bunch1(const double *TofPoff1_bunch1)
void setFPcounter(const double *FP3)
void setPoff1_bunch2(const double *TofPoff1_bunch2)
void setPoff2_bunch3(const double *TofPoff2_bunch3)
void setFPright(const double *FP2)
void setPoff2_bunch0(const double *TofPoff2_bunch0)
void setP1(const double *TofP1)
void setSigmaCorr(const double *sigmaCorr)
void setOffset(const double *offset)
void setAtten(const double *Atten)
void setP(const double *TofP)
void setFP(const double *FP)
void setSpeed(const double *Speed)
void setBrWest(const int *tofidWest)
void setRunEnd(const int run2)
void setVersion(const int version)
void setMisLable(const int misLable)
void setRunBegin(const int run1)
void setBrEast(const int *tofidEast)
void setQElec(const int qElec)
void setQCorr(const int qCorr)
void setEndcap(const int *tofidEndcap)
virtual DatabaseRecord * pp()
const CLID & objType() const
virtual StatusCode i_createObj(IOpaqueAddress *address, DataObject *&refpObject)
static const CLID & classID()
TreeTofCalibDataCnv(ISvcLocator *svc)