BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeCorrectedETSCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.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
31
32
33const CLID& TreeCorrectedETSCnv::objType() const {
35}
36
40
41StatusCode TreeCorrectedETSCnv::i_createObj(IOpaqueAddress* addr,
42 DataObject*& refpObject) {
43
44 MsgStream log(msgSvc(), "TreeCorrectedETSCnv");
45 log<<MSG::DEBUG<<"SetProperty"<<endreq;
46 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
47 DatabaseRecord *records=add->pp();
48
49 TBufferFile *buf = new TBufferFile(TBuffer::kRead);
50 buf->SetBuffer((*records)["FinalETS"],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(*buf);
58
60 // Read in our object
61 int i,no;
62
63 // read TestCalibConst ------------------------------------------------------------
64 ULong64_t ets1,ets2_pre,flag_pre;
65 int trigChannel_9,evt;
66 tree->SetBranchAddress("ets1", &ets1);
67 tree->SetBranchAddress("ets2_pre", &ets2_pre);
68 tree->SetBranchAddress("flag_pre", &flag_pre);
69 tree->SetBranchAddress("trigChannel_9", &trigChannel_9);
70 tree->SetBranchAddress("evt", &evt);
71 no = tree->GetEntries();
72 tmpObject->setNpar(no);
73 for(i=0; i<no; i++){
74 tree->GetEntry(i);
75 tmpObject ->setEts1(ets1);
76 tmpObject ->setEts2_pre(ets2_pre);
77 tmpObject ->setFlag_pre(flag_pre);
78 tmpObject ->setTrigChannel_9(trigChannel_9);
79 tmpObject ->setEvt(evt);
80 }
81
82 refpObject=tmpObject;
83
84 delete tree;
85 return StatusCode::SUCCESS;
86
87
88}
89
const CLID CLID_Calib_CorrectedETS
Definition CalibModel.h:71
const int no
IMessageSvc * msgSvc()
void setFlag_pre(unsigned long flag_pre)
void setTrigChannel_9(int trigChannel_9)
void setEts1(unsigned long ets1)
void setNpar(const int npar)
void setEts2_pre(unsigned long ets2_pre)
virtual DatabaseRecord * pp()
TreeCorrectedETSCnv(ISvcLocator *svc)
const CLID & objType() const
virtual StatusCode i_createObj(IOpaqueAddress *address, DataObject *&refpObject)
static const CLID & classID()