2#include "GaudiKernel/MsgStream.h"
4#include "CalibData/Tof/TofCalibData.h"
5#include "CalibData/Tof/bTofCalibBase.h"
6#include "CalibData/Tof/eTofCalibBase.h"
7#include "CalibData/Tof/etfCalibBase.h"
8#include "CalibDataSvc/IInstrumentName.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"
23#include "CalibDataSvc/ICalibRootSvc.h"
24#include "CalibDataSvc/ICalibMetaCnvSvc.h"
27#include "CalibData/CalibModel.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<176; 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<96; 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<(72*12); 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);
213 refpObject=tmpObject;
215 return StatusCode::SUCCESS;
220 MsgStream log(
msgSvc(),
"RootEstTofCalibDataCnv");
225 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
234 char brname[8], ibrname[8];
235 TTree *btoftree =
new TTree(
"BarTofPar",
"BarTofPar");
236 for(
unsigned int i=0; i<
nBarPar; i++ ) {
238 sprintf( ibrname,
"P%i/D", i );
239 btoftree -> Branch( brname, &cnvBarPar1[i], ibrname );
242 for(
int i=0; i<176; i++ ) {
243 for(
int j=0;j<static_cast<int>(
nBarPar);j++){
253 char ecname[8], iecname[8];
254 TTree *etoftree =
new TTree(
"EndTofPar",
"EndTofPar");
255 for(
unsigned int i=0; i<
nEndPar; i++ ) {
257 sprintf( iecname,
"P%i/D", i );
258 etoftree -> Branch( ecname, &cnvEndPar[i], iecname );
261 for(
int i=0; i<96; i++){
262 for(
int j=0;j<static_cast<int>(
nEndPar);j++){
273 char etfname[8], ietfname[8];
274 TTree *etftree =
new TTree(
"EtfTofPar",
"EtfTofPar");
275 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
277 sprintf( ietfname,
"P%i/D", i );
278 etftree -> Branch( etfname, &cnvEtfPar[i], ietfname );
280 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
283 etftree -> Branch( etfname, &cnvEtfPar1[i], ietfname );
285 for(
unsigned int i=0; i<
nEtfPar; i++ ) {
288 etftree -> Branch( etfname, &cnvEtfPar2[i], ietfname );
291 for(
int i=0; i<72; i++ ) {
292 for(
int k=0; k<12; k++ ) {
293 for(
int j=0;j<static_cast<int>(
nEtfPar);j++){
310 log<<MSG::INFO<<
"successfully create RootFile"<<endreq;
const CLID CLID_Calib_EstTofCal
data SetBranchAddress("time",&time)
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)
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)