1#include "tofcalgsec/TofDataSet.h"
40 m_event = hit->
event();
43 m_qleft = hit->
adc1();
44 m_qright = hit->
adc2();
45 m_tleft = hit->
tdc1();
46 m_tright = hit->
tdc2();
47 m_zrhit = hit->
zHit();
48 m_dt = ( hit->
tdc2() - hit->
tdc1() )/2.0;
49 m_texp = hit->
tpred();
54 m_hitcase = hit->
qual();
64 m_event = hit->
event();
68 m_zrhit = hit->
rHit();
69 m_texp = hit->
tpred();
74 m_hitcase = hit->
qual();
89 if( (
one.hitcase >= 0 &&
one.hitcase <=2 ) || (
one.hitcase==5 ||
one.hitcase==6 ) ) {
90 m_qright =
one.qright;
91 m_tright =
one.tright;
100 m_hitcase =
one.hitcase;
107 if(
t &&
t->GetEntries()>0 ) {
109 t->SetBranchAddress(
"run", &item.
run );
110 t->SetBranchAddress(
"event", &item.
event );
111 t->SetBranchAddress(
"tofid", &item.
tofid );
112 if( NULL !=
t->FindBranch(
"strip" ) ) {
113 t->SetBranchAddress(
"strip", &item.
strip );
115 t->SetBranchAddress(
"qleft", &item.
qleft );
116 t->SetBranchAddress(
"qright", &item.
qright );
117 t->SetBranchAddress(
"tleft", &item.
tleft );
118 t->SetBranchAddress(
"tright", &item.
tright );
119 t->SetBranchAddress(
"zrhit", &item.
zrhit );
120 if( NULL !=
t->FindBranch(
"dt" ) ) {
121 t->SetBranchAddress(
"dt", &item.
dt );
123 t->SetBranchAddress(
"texp", &item.
texp );
124 t->SetBranchAddress(
"path", &item.
path );
125 t->SetBranchAddress(
"phi", &item.
phi );
126 t->SetBranchAddress(
"theta", &item.
theta );
127 t->SetBranchAddress(
"p", &item.
p );
128 t->SetBranchAddress(
"hitcase", &item.
hitcase );
130 for(
unsigned int i=0; i<
t->GetEntries(); i++ ) {
135 unsigned int tofID = item.
tofid;
136 barrelData[tofID]->push_back(r);
142 else if( isBarrel==0 && ( item.
hitcase==3 || item.
hitcase==4 ) ) {
145 unsigned int tofID = item.
tofid;
146 endcapData[tofID]->push_back(r);
155 unsigned int tofID = item.
tofid;
156 unsigned int strip = item.
strip;
157 unsigned int id = tofID*12 + strip;
158 etfData[id]->push_back(r);
167 std::cerr <<
"Error: a invalid tree or a blank tree, When converting a tree to TofDataSet,exit" << std::endl;
175 for(
unsigned int i=0; i<
NBarrel; i++ ) {
178 for(
unsigned int i=0; i<
NEndcap; i++ ) {
189 for(
unsigned int i=0; i<
NBarrel; i++ ) {
190 barrelData[i]->clear();
191 delete barrelData[i];
193 for(
unsigned int i=0; i<
NEndcap; i++ ) {
194 endcapData[i]->clear();
195 delete endcapData[i];
206 TChain* data_barrel =
new TChain(
"btrk");
208 std::cerr <<
" tofcalgsec Error Msg: creating a tree[barrel] fails in TofDataSet()"<<std::endl;
209 throw "Error Msg: creating a tree fails in TofDataSet() ";
211 std::cout<<
"begin reading barrel data file ... "<<std::endl;
213 for( std::vector<std::string>::iterator it=barrelFiles.begin(); it!=barrelFiles.end(); it++ ) {
214 std::cout <<
" Add file : " << (*it) << std::endl;
215 data_barrel->Add( (*it).c_str() );
219 std::cerr <<
"tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl;
229 TChain* data_endcap =
new TChain(
"etrk");
231 std::cerr <<
" tofcalgsec Error Msg: creating a tree[endcap] fails in TofDataSet()"<<std::endl;
232 throw "Error Msg: creating a tree fails in TofDataSet() ";
234 std::cout<<
"begin reading endcap data file ... "<<std::endl;
236 for( std::vector<std::string>::iterator it=endcapFiles.begin(); it!=endcapFiles.end(); it++ ) {
237 std::cout <<
" Add file : " << (*it) << std::endl;
238 data_endcap->Add( (*it).c_str() );
242 std::cerr <<
"tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl;
252 TChain* data_etf =
new TChain(
"etf");
254 std::cerr <<
" tofcalgsec Error Msg: creating a tree[etf] fails in TofDataSet()"<<std::endl;
255 throw "Error Msg: creating a tree fails in TofDataSet() ";
257 std::cout<<
"begin reading etf data file ... "<<std::endl;
259 for( std::vector<std::string>::iterator it=etfFiles.begin(); it!=etfFiles.end(); it++ ) {
260 std::cout <<
" Add file : " << (*it) << std::endl;
261 data_etf->Add( (*it).c_str() );
265 std::cerr <<
"tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl;
275 RecBTofCalHitCol::iterator
iter = bhitcol.begin();
276 for( ;
iter!=bhitcol.end();
iter++ ) {
277 int tofid = (*iter)->mod();
278 if( tofid<0 || tofid>175 )
continue;
279 if( fabs( (*iter)->dzHit() - 1.0 )>1.0e-6 )
continue;
283 barrelData[tofid]->push_back(r);
294 RecETofCalHitCol::iterator
iter = ehitcol.begin();
295 for( ;
iter!=ehitcol.end();
iter++ ) {
296 int tofid = (*iter)->mod();
297 if( tofid<0 || tofid>95 )
continue;
301 endcapData[tofid]->push_back(r);
312 RecBTofCalHitCol::iterator
iter = bhitcol.begin();
313 for( ;
iter!=bhitcol.end();
iter++ ) {
314 int tofid = (*iter)->mod();
315 int strip = int( (*iter)->sinTheta() );
316 if( tofid<0 || tofid>71 )
continue;
317 if( strip<0 || strip>11 )
continue;
318 if( fabs( (*iter)->dzHit() )>1.0e-6 )
continue;
319 unsigned int id = tofid*12 + strip;
322 etfData[id]->push_back(r);
ObjectVector< RecBTofCalHit > RecBTofCalHitCol
ObjectVector< RecETofCalHit > RecETofCalHitCol
std::vector< Record * > RecordSet
const unsigned int NStrip
const unsigned int NBarrel
const unsigned int NEndcap
void setData(TTree *, unsigned int)
void setEtfDataFiles(std::vector< std::string > &)
void setEtfData(RecBTofCalHitCol &)
void setEndcapDataFiles(std::vector< std::string > &)
void setBarrelData(RecBTofCalHitCol &)
void setBarrelDataFiles(std::vector< std::string > &)
void setEndcapData(RecETofCalHitCol &)