BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
RootEmcCalibDataCnv Class Reference

#include <RootEmcCalibDataCnv.h>

+ Inheritance diagram for RootEmcCalibDataCnv:

Public Member Functions

const CLID & objType () const
 
 RootEmcCalibDataCnv (ISvcLocator *svc)
 
virtual ~RootEmcCalibDataCnv ()
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
virtual long repSvcType () const
 
- Public Member Functions inherited from RootCalBaseCnv
virtual ~RootCalBaseCnv ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
 
ICalibRootSvcgetCalibRootSvc ()
 
 RootCalBaseCnv (ISvcLocator *svc, const CLID &clid)
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
virtual StatusCode readRootObj (const std::string &treename, const std::string &branch, TObject *&pCalib, unsigned index=0)
 
virtual StatusCode readRootObj (TTree *tree, const std::string &branch, TObject *&pCalib, unsigned index=0)
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
- Static Public Member Functions inherited from RootCalBaseCnv
static const unsigned char storageType ()
 

Protected Member Functions

virtual StatusCode i_createObj (const std::string &fname, DataObject *&refpObject)
 
- Protected Member Functions inherited from RootCalBaseCnv
virtual StatusCode internalCreateObj (const std::string &fname, DataObject *&refpObject, IOpaqueAddress *address)
 
virtual StatusCode i_createObj (const std::string &fname, DataObject *&refpObject)
 
virtual StatusCode i_processObj (DataObject *pObject, IOpaqueAddress *address)
 In case there is additional work to do on the created object.
 
virtual StatusCode fillRoot (CalibData::CalibBase *pTDSObj, TObject *pRootObj)
 
virtual StatusCode openWrite (const std::string &fname)
 
StatusCode closeWrite ()
 
StatusCode openRead (const std::string &fname)
 
StatusCode closeRead ()
 
void setBaseInfo (CalibData::CalibBase1 *pObj)
 Another utility for derived classes to use.
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< RootEmcCalibDataCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootCalBaseCnv
ICalibRootSvcm_rootSvc
 
ICalibMetaCnvSvcm_metaSvc
 
IInstrumentNamem_instrSvc
 
int m_serNo
 
ITime * m_vstart
 
ITime * m_vend
 
int m_runfrm
 
int m_runto
 
TFile * m_outFile
 
TTree * m_ttree
 
TFile * m_inFile
 
TDirectory * m_saveDir
 

Detailed Description

Base class for CAL calibration converters from ROOT files to TCDS. All such converters need to do certain things, which are handled here. Methods common to all calibrations are in the base class RootCalBaseCnv

Author
J. Bogart

Definition at line 21 of file RootEmcCalibDataCnv.h.

Constructor & Destructor Documentation

◆ RootEmcCalibDataCnv()

RootEmcCalibDataCnv::RootEmcCalibDataCnv ( ISvcLocator *  svc)

Definition at line 31 of file RootEmcCalibDataCnv.cxx.

31 :
33
34}
const CLID CLID_Calib_EmcCal
Definition: CalibModel.h:47

◆ ~RootEmcCalibDataCnv()

virtual RootEmcCalibDataCnv::~RootEmcCalibDataCnv ( )
inlinevirtual

Definition at line 30 of file RootEmcCalibDataCnv.h.

30{};

Member Function Documentation

◆ classID()

const CLID & RootEmcCalibDataCnv::classID ( )
static

Definition at line 41 of file RootEmcCalibDataCnv.cxx.

41 {
42 return CLID_Calib_EmcCal;
43}

◆ createRoot()

StatusCode RootEmcCalibDataCnv::createRoot ( const std::string &  fname,
CalibData::CalibBase1 pTDSObj 
)
virtual

Create ROOT file corresponding to TDS object input.
Default implementation is to return an error. Must be separately implemented for each calibration type.

Parameters
fnameFilename for output file
pTDSObjPointer to tds object to be converted

Reimplemented from RootCalBaseCnv.

Definition at line 82 of file RootEmcCalibDataCnv.cxx.

83 {
84
85 MsgStream log(msgSvc(), "RootEmcCalibDataCnv");
86
87 // Open the file, create the branch
88 StatusCode sc = openWrite(fname);
89 if(!sc)
90 { log<<MSG::ERROR<<"unable to open files"<<endreq;
91 }
92 // write the Data in the TCDS to RootFile
93 CalibData::EmcCalibData* tmpObject = dynamic_cast<CalibData::EmcCalibData*>(pTDSObj);
94 int tmpNo;
95 double EmcCalibConst;
96 int EmcIxtalNumber;
97 int i;
98
99 //DigiCalibConst------------------------------------------------------------------
100 TTree *Digitree = new TTree("DigiCalibConst", "DigiCalibConst");
101 Digitree -> Branch("DigiCalibConst", &EmcCalibConst, "EmcCalibConst/D");
102 Digitree -> Branch("IxtalNumber", &EmcIxtalNumber, "IxtalNumber/I");
103 tmpNo = tmpObject -> getDigiCalibConstNo();
104 for(i=0; i<tmpNo; i++){
105 EmcCalibConst = tmpObject -> getDigiCalibConst(i);
106 EmcIxtalNumber = tmpObject -> getIxtalNumber(i);
107 Digitree -> Fill();
108 }
109
110
111 Digitree -> Write();
112
113
114 delete Digitree;
115
116 closeWrite();
117 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
118 return sc;
119
120}
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
curve Fill()
curve Write()
IMessageSvc * msgSvc()
StatusCode closeWrite()
virtual StatusCode openWrite(const std::string &fname)

◆ i_createObj()

StatusCode RootEmcCalibDataCnv::i_createObj ( const std::string &  fname,
DataObject *&  refpObject 
)
protectedvirtual

This creates the transient representation of an object from the corresponding ROOT object. This actually does the "new" operation and deals with the attributes of the node. This base class implementation does nothing; it should not normally be called because it doesn't correspond to any TCDS class. Instead, i_createObj of some derived class will be called.

Parameters
fnameThe ROOT file to be read in to be used to builds the object
refpObjectthe object to be built
Returns
status depending on the completion of the call

Reimplemented from RootCalBaseCnv.

Definition at line 45 of file RootEmcCalibDataCnv.cxx.

46 {
47
48 MsgStream log(msgSvc(), "RootEmcCalibDataCnv");
49 log<<MSG::DEBUG<<"SetProperty"<<endreq;
50
51 StatusCode sc = openRead(fname);
52 if(!sc)
53 { log<<MSG::ERROR<<"unable to open files"<<endreq;
54 }
55
57 // Read in our object
58 int i;
59 int nentries;
60
61 // read DigiCalibConst ------------------------------------------------------------
62 double EmcCalibConst[6240];
63 int EmcIxtalNumber[6240];
64 vector<double> DigiCalibConst;
65 vector<int> IxtalNumber;
66 TTree *Digitree = (TTree*)m_inFile -> Get("DigiCalibConst");
67 Digitree -> SetBranchAddress("DigiCalibConst", EmcCalibConst);
68 Digitree -> SetBranchAddress("IxtalNumber", EmcIxtalNumber);
69 Digitree -> GetEntry(0);
70 for(i=0; i<6240; i++){
71 DigiCalibConst.push_back(EmcCalibConst[i]);
72 IxtalNumber.push_back(EmcIxtalNumber[i]);
73 }
74 tmpObject -> setDigiCalibConst(&DigiCalibConst);
75 tmpObject -> setIxtalNumber(&IxtalNumber);
76
77 refpObject=tmpObject;
78
79 return StatusCode::SUCCESS;
80}
StatusCode openRead(const std::string &fname)
curve GetEntry(0)
curve SetBranchAddress("CurveSize",&CurveSize)

◆ objType()

const CLID & RootEmcCalibDataCnv::objType ( ) const

Definition at line 37 of file RootEmcCalibDataCnv.cxx.

37 {
38 return CLID_Calib_EmcCal;
39}

◆ repSvcType()

virtual long RootEmcCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file RootEmcCalibDataCnv.h.

34 {
36 }
unsigned const char CALIBROOT_StorageType
Definition: ICalibRootSvc.h:20

Friends And Related Function Documentation

◆ CnvFactory< RootEmcCalibDataCnv >

friend class CnvFactory< RootEmcCalibDataCnv >
friend

Definition at line 1 of file RootEmcCalibDataCnv.h.


The documentation for this class was generated from the following files: