42 {
43
44 MsgStream log(
msgSvc(),
"TreeEstTofCalibDataCnv" );
45 log << MSG::DEBUG << "SetProperty" << endmsg;
46
47 TreeAddress* add = dynamic_cast<TreeAddress*>( addr );
48 DatabaseRecord* records = add->
pp();
49
50 TBufferFile* buf1 = new TBufferFile( TBuffer::kRead );
51 TBufferFile* buf2 = new TBufferFile( TBuffer::kRead );
52 TBufferFile* buf3 = new TBufferFile( TBuffer::kRead );
53 TBufferFile* buf4 = new TBufferFile( TBuffer::kRead );
54 TBufferFile* buf5 = nullptr;
55
56 buf1->SetBuffer( ( *records )["BarTofPar"], 1024000, kFALSE );
57 buf2->SetBuffer( ( *records )["EndTofPar"], 1024000, kFALSE );
58 buf3->SetBuffer( ( *records )["TofConPar"], 1024000, kFALSE );
59 buf4->SetBuffer( ( *records )["BarTof"], 1024000, kFALSE );
60
61 if ( ( *records )["EtfTofPar"] != 0 )
62 {
63 buf5 = new TBufferFile( TBuffer::kRead );
64 buf5->SetBuffer( ( *records )["EtfTofPar"], 1024000, kFALSE );
65 }
66
67 std::cout << " CalVerSft is " << ( *records )["CalParVer"];
68 std::cout << " File name is " << ( *records )["FileName"] << std::endl;
69
70 TTree* btoftree = new TTree();
71 TTree* etoftree = new TTree();
72 TTree* etftree = new TTree();
73 TTree* btofcommontree = new TTree();
74 TTree* CalibInfo = new TTree();
75
76 btoftree->Streamer( *buf1 );
77 etoftree->Streamer( *buf2 );
78 btofcommontree->Streamer( *buf3 );
79 CalibInfo->Streamer( *buf4 );
80 if ( buf5 ) { etftree->Streamer( *buf5 ); }
81
82
83
84
85
86
87
88 std::vector<CalibData::bTofCalibBase> tmpbTof;
89 std::vector<CalibData::eTofCalibBase> tmpeTof;
90 std::vector<CalibData::etfCalibBase> tmpetf;
91 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
92 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
93
94
95 int cnt;
96
107
108 char brname[10];
109 for (
unsigned int i = 0; i <
nBarPar; i++ )
110 {
112 btoftree->SetBranchAddress( brname, &cnvBarPar1[i] );
113 }
114 for (
unsigned int i = 0; i <
nBarPar; i++ )
115 {
117 btoftree->SetBranchAddress( brname, &cnvBarPar2[i] );
118 }
119 for (
unsigned int i = 0; i <
nBarParOff; i++ )
120 {
121 sprintf( brname,
"Bunch0_Poff%i", i );
122 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch0[i] );
123 }
124 for (
unsigned int i = 0; i <
nBarParOff; i++ )
125 {
127 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch0[i] );
128 }
129 for (
unsigned int i = 0; i <
nBarParOff; i++ )
130 {
131 sprintf( brname,
"Bunch1_Poff%i", i );
132 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch1[i] );
133 }
134 for (
unsigned int i = 0; i <
nBarParOff; i++ )
135 {
137 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch1[i] );
138 }
139 for (
unsigned int i = 0; i <
nBarParOff; i++ )
140 {
141 sprintf( brname,
"Bunch2_Poff%i", i );
142 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch2[i] );
143 }
144 for (
unsigned int i = 0; i <
nBarParOff; i++ )
145 {
147 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch2[i] );
148 }
149 for (
unsigned int i = 0; i <
nBarParOff; i++ )
150 {
151 sprintf( brname,
"Bunch3_Poff%i", i );
152 btoftree->SetBranchAddress( brname, &cnvBarParOff1_bunch3[i] );
153 }
154 for (
unsigned int i = 0; i <
nBarParOff; i++ )
155 {
157 btoftree->SetBranchAddress( brname, &cnvBarParOff2_bunch3[i] );
158 }
159
160 int entries = btoftree->GetEntries();
161 for ( cnt = 0; cnt < entries; cnt++ )
162 {
163 CalibData::bTofCalibBase bTof;
164 btoftree->GetEntry( cnt );
165 bTof.
setP1( cnvBarPar1 );
166 bTof.
setP2( cnvBarPar2 );
175 tmpbTof.push_back( bTof );
176 }
177
178
180
181 char ecname[10];
182 for (
unsigned int i = 0; i <
nEndPar; i++ )
183 {
185 etoftree->SetBranchAddress( ecname, &cnvEndPar[i] );
186 }
187
188 entries = etoftree->GetEntries();
189 for ( cnt = 0; cnt < entries; cnt++ )
190 {
191 CalibData::eTofCalibBase eTof;
192 etoftree->GetEntry( cnt );
193 eTof.
setP( cnvEndPar );
194 tmpeTof.push_back( eTof );
195 }
196
197
198 if ( etftree->GetEntries() != 0 )
199 {
200
204
205 char etfname[10];
206 for (
unsigned int i = 0; i <
nEtfPar; i++ )
207 {
209 etftree->SetBranchAddress( etfname, &cnvEtfPar[i] );
211 etftree->SetBranchAddress( etfname, &cnvEtfPar1[i] );
213 etftree->SetBranchAddress( etfname, &cnvEtfPar2[i] );
214 }
215
216 entries = etftree->GetEntries();
217 for ( cnt = 0; cnt < entries; cnt++ )
218 {
219 CalibData::etfCalibBase etf;
220 etftree->GetEntry( cnt );
221 etf.
setP( cnvEtfPar );
222 etf.
setP1( cnvEtfPar1 );
223 etf.
setP2( cnvEtfPar2 );
224 tmpetf.push_back( etf );
225 }
226 }
227
228
230 for (
unsigned int i = 0; i <
nBarOffset; i++ )
231 {
232 sprintf( brname,
"t0offset%i", i );
233 btofcommontree->SetBranchAddress( brname, &cnvBarOffset[i] );
234 }
235
236 entries = btofcommontree->GetEntries();
237 for ( cnt = 0; cnt < entries; cnt++ )
238 {
239 CalibData::bTofCommonCalibBase bTofCommon;
240 btofcommontree->GetEntry( cnt );
242 tmpbTofCommon.push_back( bTofCommon );
243 }
244
245 int m_runFrom, m_runTo, m_eventFrom, m_eventTo;
246 if ( CalibInfo->GetBranchStatus( "runFrom" ) )
247 {
248 CalibInfo->SetBranchAddress( "runFrom", &m_runFrom );
249 CalibInfo->SetBranchAddress( "runTo", &m_runTo );
250 CalibInfo->SetBranchAddress( "eventFrom", &m_eventFrom );
251 CalibInfo->SetBranchAddress( "eventTo", &m_eventTo );
252 }
253 else
254 {
255 m_runFrom = -1;
256 m_runTo = -1;
257 m_eventFrom = -1;
258 m_eventTo = -1;
259 }
260
261 entries = CalibInfo->GetEntries();
262 for ( cnt = 0; cnt < entries; cnt++ )
263 {
264 CalibData::tofCalibInfoBase tofinfo;
265 CalibInfo->GetEntry( cnt );
270 tofinfoCol.push_back( tofinfo );
271 }
272
273 CalibData::TofCalibData* tmpObject =
274 new CalibData::TofCalibData( tmpbTof, tmpbTofCommon, tmpeTof, tmpetf, tofinfoCol );
275
276 refpObject = tmpObject;
277 delete btoftree;
278 delete etoftree;
279 delete etftree;
280 delete btofcommontree;
281 delete CalibInfo;
282
283 return StatusCode::SUCCESS;
284}
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)
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nEtfPar
const unsigned int nBarPar
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)
virtual DatabaseRecord * pp()