2#include "GaudiKernel/MsgStream.h"
12#include "TDirectory.h"
15#include "GaudiKernel/CnvFactory.h"
16#include "GaudiKernel/IOpaqueAddress.h"
17#include "GaudiKernel/DataObject.h"
18#include "GaudiKernel/IAddressCreator.h"
19#include "GaudiKernel/IDataProviderSvc.h"
20#include "GaudiKernel/IConversionSvc.h"
21#include "GaudiKernel/GenericAddress.h"
52 DataObject*& refpObject) {
54 MsgStream log(
msgSvc(),
"RootEstTofCalibDataCnv");
55 log<<MSG::DEBUG<<
"SetProperty"<<endreq;
60 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
69 std::vector<CalibData::bTofCalibBase> tmpbTof;
70 std::vector<CalibData::eTofCalibBase> tmpeTof;
71 std::vector<CalibData::etfCalibBase> tmpetf;
72 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
73 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
89 TTree *btoftree = (TTree*)
m_inFile -> Get(
"BarTofPar");
92 for(
unsigned int i=0; i<
nBarPar; i++ ) {
96 for(
unsigned int i=0; i<
nBarPar; i++ ) {
101 sprintf( brname,
"Bunch0_Poff%i", i );
109 sprintf( brname,
"Bunch1_Poff%i", i );
117 sprintf( brname,
"Bunch2_Poff%i", i );
125 sprintf( brname,
"Bunch3_Poff%i", i );
133 for(cnt=0; cnt< btoftree->GetEntries(); cnt++){
135 bTof.
setP1( cnvBarPar1 );
136 bTof.
setP2( cnvBarPar2 );
145 tmpbTof.push_back( bTof );
151 TTree *etoftree = (TTree*)
m_inFile -> Get(
"EndTofPar");
154 for(
unsigned int i=0; i<
nEndPar; i++ ) {
159 for(cnt=0; cnt<etoftree->GetEntries(); cnt++){
160 etoftree->GetEntry(cnt);
161 eTof.
setP( cnvEndPar );
162 tmpeTof.push_back(eTof);
170 if( NULL!=
m_inFile->Get(
"EtfTofPar") ) {
171 TTree *etftree = (TTree*)
m_inFile -> Get(
"EtfTofPar");
174 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
178 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
182 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
187 for(cnt=0; cnt<etftree->GetEntries(); cnt++){
189 etf.
setP( cnvEtfPar );
190 etf.
setP1( cnvEtfPar1 );
191 etf.
setP2( cnvEtfPar2 );
192 tmpetf.push_back(etf);
198 TTree *btofcommontree = (TTree*)
m_inFile -> Get(
"BarTofParCommon");
200 sprintf( brname,
"t0offset%i", i );
204 int entries = btofcommontree->GetEntries();
205 for(cnt=0;cnt<entries;cnt++){
206 btofcommontree->GetEntry(cnt);
208 tmpbTofCommon.push_back(bTofCommon);
211 int m_runFrom, m_runTo, m_eventFrom, m_eventTo;
213 TTree *CalibInfo = (TTree*)
m_inFile -> Get(
"CalibInfo");
215 if( CalibInfo->GetBranchStatus(
"runFrom") ) {
216 CalibInfo->SetBranchAddress(
"runFrom", &m_runFrom );
217 CalibInfo->SetBranchAddress(
"runTo", &m_runTo );
218 CalibInfo->SetBranchAddress(
"eventFrom", &m_eventFrom );
219 CalibInfo->SetBranchAddress(
"eventTo", &m_eventTo );
228 entries= CalibInfo->GetEntries();
229 for(cnt=0;cnt<entries;cnt++){
230 CalibInfo->GetEntry(cnt);
235 tofinfoCol.push_back(tofinfo);
240 refpObject=tmpObject;
242 return StatusCode::SUCCESS;
247 MsgStream log(
msgSvc(),
"RootEstTofCalibDataCnv");
252 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
261 char brname[8], ibrname[8];
262 TTree *btoftree =
new TTree(
"BarTofPar",
"BarTofPar");
263 for(
unsigned int i=0; i<
nBarPar; i++ ) {
265 sprintf( ibrname,
"P%i/D", i );
266 btoftree ->
Branch( brname, &cnvBarPar1[i], ibrname );
269 for(
int i=0; i<176; i++ ) {
270 for(
int j=0;j<static_cast<int>(
nBarPar);j++){
280 char ecname[8], iecname[8];
281 TTree *etoftree =
new TTree(
"EndTofPar",
"EndTofPar");
282 for(
unsigned int i=0; i<
nEndPar; i++ ) {
284 sprintf( iecname,
"P%i/D", i );
285 etoftree ->
Branch( ecname, &cnvEndPar[i], iecname );
288 for(
int i=0; i<96; i++){
289 for(
int j=0;j<static_cast<int>(
nEndPar);j++){
300 char etfname[8], ietfname[8];
301 TTree *etftree =
new TTree(
"EtfTofPar",
"EtfTofPar");
302 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
304 sprintf( ietfname,
"P%i/D", i );
305 etftree ->
Branch( etfname, &cnvEtfPar[i], ietfname );
307 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
310 etftree ->
Branch( etfname, &cnvEtfPar1[i], ietfname );
312 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
315 etftree ->
Branch( etfname, &cnvEtfPar2[i], ietfname );
318 for(
int i=0; i<72; i++ ) {
319 for(
int k=0; k<12; k++ ) {
320 for(
int j=0;j<static_cast<int>(
nEtfPar);j++){
337 log<<MSG::INFO<<
"successfully create RootFile"<<endreq;
const CLID CLID_Calib_EstTofCal
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nEtfPar
const unsigned int nBarPar
double getETofP(int index, int pardex)
double getEtfPleft(int index, int strip, int pardex)
double getEtfPcombine(int index, int strip, int pardex)
double getEtfPright(int index, int strip, int pardex)
double getBTofPleft(int index, int pardex)
double getBTofPright(int index, int pardex)
void setP2(const double *TofP2)
void setPoff1_bunch3(const double *TofPoff1_bunch3)
void setPoff2_bunch1(const double *TofPoff2_bunch1)
void setPoff1_bunch0(const double *TofPoff1_bunch0)
void setPoff2_bunch2(const double *TofPoff2_bunch2)
void setPoff1_bunch1(const double *TofPoff1_bunch1)
void setPoff1_bunch2(const double *TofPoff1_bunch2)
void setPoff2_bunch3(const double *TofPoff2_bunch3)
void setPoff2_bunch0(const double *TofPoff2_bunch0)
void setP1(const double *TofP1)
void setOffset(const double *offset)
void setP(const double *TofP)
void setP(const double *etfP)
void setP1(const double *etfP1)
void setP2(const double *etfP2)
void setRunFrom(const int runFrom)
void setEventTo(const int eventTo)
void setRunTo(const int runTo)
void setEventFrom(const int eventFrom)
StatusCode openRead(const std::string &fname)
virtual StatusCode openWrite(const std::string &fname)
const CLID & objType() const
RootEstTofCalibDataCnv(ISvcLocator *svc)
virtual StatusCode createRoot(const std::string &fname, CalibData::CalibBase1 *pTDSObj)
static const CLID & classID()
virtual StatusCode i_createObj(const std::string &fname, DataObject *&refpObject)
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
curve SetBranchAddress("CurveSize",&CurveSize)