BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeCorrectedETSCnv.cxx
Go to the documentation of this file.
2#include "CalibData/Ets/CorrectedETSCal.h"
3#include "CalibDataSvc/IInstrumentName.h"
4#include "CalibMySQLCnvSvc/TreeAddress.h"
5#include "GaudiKernel/MsgStream.h"
6#include "TBuffer.h"
7#include "TDirectory.h"
8#include "TFile.h"
9#include "TObject.h"
10#include "TTree.h"
11
12#include "GaudiKernel/DataObject.h"
13#include "GaudiKernel/GenericAddress.h"
14#include "GaudiKernel/IAddressCreator.h"
15#include "GaudiKernel/IConversionSvc.h"
16#include "GaudiKernel/IDataProviderSvc.h"
17#include "GaudiKernel/IOpaqueAddress.h"
18
19#include "CalibDataSvc/ICalibMetaCnvSvc.h"
20#include "CalibDataSvc/ICalibTreeSvc.h" //maybe
21
22// Temporary. Hope to find a better way to do this
23#include "CalibData/CalibModel.h"
24using namespace CalibData;
25
28
30
32
33StatusCode TreeCorrectedETSCnv::i_createObj( IOpaqueAddress* addr, DataObject*& refpObject ) {
34
35 MsgStream log( msgSvc(), "TreeCorrectedETSCnv" );
36 log << MSG::DEBUG << "SetProperty" << endmsg;
37 TreeAddress* add = dynamic_cast<TreeAddress*>( addr );
38 DatabaseRecord* records = add->pp();
39
40 TBufferFile* buf = new TBufferFile( TBuffer::kRead );
41 buf->SetBuffer( ( *records )["FinalETS"], 51200000, kFALSE );
42
43 // std::cout<<" SftVer is "<<(*records)["SftVer"];
44 // std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
45 std::cout << " File name is " << ( *records )["FileName"] << std::endl;
46
47 TTree* tree = new TTree();
48 tree->Streamer( *buf );
49
51 // Read in our object
52 int i, no;
53
54 // read TestCalibConst ------------------------------------------------------------
55 ULong64_t ets1, ets2_pre, flag_pre;
56 int trigChannel_9, evt;
57 tree->SetBranchAddress( "ets1", &ets1 );
58 tree->SetBranchAddress( "ets2_pre", &ets2_pre );
59 tree->SetBranchAddress( "flag_pre", &flag_pre );
60 tree->SetBranchAddress( "trigChannel_9", &trigChannel_9 );
61 tree->SetBranchAddress( "evt", &evt );
62 no = tree->GetEntries();
63 tmpObject->setNpar( no );
64 for ( i = 0; i < no; i++ )
65 {
66 tree->GetEntry( i );
67 tmpObject->setEts1( ets1 );
68 tmpObject->setEts2_pre( ets2_pre );
69 tmpObject->setFlag_pre( flag_pre );
70 tmpObject->setTrigChannel_9( trigChannel_9 );
71 tmpObject->setEvt( evt );
72 }
73
74 refpObject = tmpObject;
75
76 delete tree;
77 return StatusCode::SUCCESS;
78}
IMessageSvc * msgSvc()
void setFlag_pre(unsigned long flag_pre)
void setTrigChannel_9(int trigChannel_9)
void setEts1(unsigned long ets1)
void setEts2_pre(unsigned long ets2_pre)
TreeCalBaseCnv(ISvcLocator *svc, const CLID &clid)
TreeCorrectedETSCnv(ISvcLocator *svc)
const CLID & objType() const
virtual StatusCode i_createObj(IOpaqueAddress *address, DataObject *&refpObject)
static const CLID & classID()