BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeEsTimeCalibDataCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
3#include "CalibData/EsTime/EsTimeCalibData.h"
4#include "CalibDataSvc/IInstrumentName.h"
5#include "CalibMySQLCnv/TreeAddress.h"
6#include "TFile.h"
7#include "TTree.h"
8#include "TDirectory.h"
9#include "TObject.h"
10#include "TBuffer.h"
11
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"
19
20#include "CalibDataSvc/ICalibTreeSvc.h" //maybe
21#include "CalibDataSvc/ICalibMetaCnvSvc.h"
22
23// Temporary. Hope to find a better way to do this
24#include "CalibData/CalibModel.h"
25using namespace CalibData;
26//static CnvFactory<TreeEsTimeCalibDataCnv> EsTimeCal_factory;
27//const ICnvFactory& TreeEsTimeCalibDataCnvFactory = EsTimeCal_factory;
28
29
30
33
34 }
35
36
39}
40
43}
44
45StatusCode TreeEsTimeCalibDataCnv::i_createObj(IOpaqueAddress* addr,
46 DataObject*& refpObject) {
47
48 MsgStream log(msgSvc(), "TreeEsTimeCalibDataCnv");
49 log<<MSG::DEBUG<<"SetProperty"<<endreq;
50 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
51 DatabaseRecord *records=add->pp();
52
53 TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
54 TBufferFile *buf2 = new TBufferFile(TBuffer::kRead);
55 buf1->SetBuffer((*records)["EsTimeH2"],512000,kFALSE);
56 buf2->SetBuffer((*records)["EsTimeH9"],512000,kFALSE);
57
58 std::cout<<" SftVer is "<<(*records)["SftVer"];
59 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
60 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
61
62 TTree* Testtree= new TTree();
63
64 Testtree->Streamer(*buf1);
65 TTree* tree2= new TTree();
66 tree2->Streamer(*buf2);
67
69 // Read in our object
70 int i;
71
72 // read TestCalibConst ------------------------------------------------------------
73 double EsTimeCalibConst;
74 vector<double> TestCalibConst;
75 Testtree -> SetBranchAddress("meant0", &EsTimeCalibConst);
76 int no= Testtree -> GetEntries();
77 for(i=0; i<no; i++){
78 Testtree->GetEntry(i);
79 TestCalibConst.push_back(EsTimeCalibConst);
80 }
81 tmpObject -> setTestCalibConst(&TestCalibConst);
82
83 double t0offsete,t0offsetb;
84 int bunchtime;
85 tree2->SetBranchAddress("t0offsete", &t0offsete);
86 tree2->SetBranchAddress("t0offsetb", &t0offsetb);
87 tree2->SetBranchAddress("bunchtime", &bunchtime);
88 tree2->GetEntry(0);
89 tmpObject ->setToffsetb(t0offsetb);
90 tmpObject ->setToffsete(t0offsete);
91 tmpObject ->setBunchTime(bunchtime);
92 refpObject=tmpObject;
93
94 delete Testtree;
95 delete tree2;
96 return StatusCode::SUCCESS;
97
98
99}
100
data SetBranchAddress("time",&time)
void setToffsetb(const double toffsetb)
void setBunchTime(const int bunchtime)
void setToffsete(const double toffsete)
static const CLID & classID()
TreeEsTimeCalibDataCnv(ISvcLocator *svc)
const CLID & objType() const
virtual StatusCode i_createObj(IOpaqueAddress *address, DataObject *&refpObject)