BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
CalibTreeCnv-00-02-04/src/cnv/TreeInjSigTimeCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2#include "TreeInjSigTimeCnv.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
22
23// Temporary. Hope to find a better way to do this
25using namespace CalibData;
26
27TreeInjSigTimeCnv::TreeInjSigTimeCnv( ISvcLocator* svc) :
29
30 }
31
32
33const CLID& TreeInjSigTimeCnv::objType() const {
35}
36
37const CLID& TreeInjSigTimeCnv::classID() {
39}
40
41StatusCode TreeInjSigTimeCnv::i_createObj(IOpaqueAddress* addr,
42 DataObject*& refpObject) {
43
44 MsgStream log(msgSvc(), "TreeInjSigTimeCnv");
45 log<<MSG::DEBUG<<"SetProperty"<<endreq;
46 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
47 DatabaseRecord *records=add->pp();
48
49 TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
50 buf1->SetBuffer((*records)["ist"],51200000,kFALSE);
51
52 std::cout<<" SftVer is "<<(*records)["SftVer"];
53 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
54 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
55
56 TTree* tree= new TTree();
57 tree->Streamer(*buf1);
58
60 // Read in our object
61 int i,no;
62
63 // read TestCalibConst ------------------------------------------------------------
64
65 ULong64_t IST;
66 int flag;
67 tree->SetBranchAddress("flag", &flag);
68 tree->SetBranchAddress("IST", &IST);
69
70 no = tree->GetEntries();
71 tmpObject->setNpar(no);
72 for(i=0; i<no; i++){
73 tree->GetEntry(i);
74 tmpObject ->setFlag(flag);
75 tmpObject ->setIST(IST);
76 }
77
78 refpObject=tmpObject;
79
80 delete tree;
81 return StatusCode::SUCCESS;
82
83
84}
85
const CLID CLID_Calib_InjSigTime
Definition: CalibModel.h:67
const int no
IMessageSvc * msgSvc()
void setIST(const ULong64_t Ist)
void setFlag(const int flag)
void setNpar(const int npar)
Definition: InjSigTimeCal.h:27
virtual DatabaseRecord * pp()
Definition: TreeAddress.h:130
virtual StatusCode i_createObj(IOpaqueAddress *address, DataObject *&refpObject)