#include <TofDataSet.h>
Public Member Functions | |
TofDataSet () | |
~TofDataSet () | |
RecordSet * | getBarrelData (unsigned int i) const |
RecordSet * | getEndcapData (unsigned int i) const |
RecordSet * | getEtfData (unsigned int i) const |
void | setData (TTree *, unsigned int) |
void | setBarrelDataFiles (std::vector< std::string > &) |
void | setEndcapDataFiles (std::vector< std::string > &) |
void | setEtfDataFiles (std::vector< std::string > &) |
void | setBarrelData (RecBTofCalHitCol &) |
void | setEndcapData (RecETofCalHitCol &) |
void | setEtfData (RecBTofCalHitCol &) |
Private Attributes | |
RecordSet * | barrelData [NBarrel] |
RecordSet * | endcapData [NEndcap] |
RecordSet * | etfData [NEtf *NStrip] |
Definition at line 101 of file TofDataSet.h.
TofDataSet::TofDataSet | ( | ) |
Definition at line 174 of file TofDataSet.cxx.
References barrelData, endcapData, etfData, genRecEmupikp::i, NBarrel, NEndcap, NEtf, and NStrip.
00174 { 00175 for( unsigned int i=0; i<NBarrel; i++ ) { 00176 barrelData[i] = new RecordSet; 00177 } 00178 for( unsigned int i=0; i<NEndcap; i++ ) { 00179 endcapData[i] = new RecordSet; 00180 } 00181 for( unsigned int i=0; i<NEtf*NStrip; i++ ) { 00182 etfData[i] = new RecordSet; 00183 } 00184 return; 00185 }
TofDataSet::~TofDataSet | ( | ) |
Definition at line 188 of file TofDataSet.cxx.
References barrelData, endcapData, etfData, genRecEmupikp::i, NBarrel, NEndcap, NEtf, and NStrip.
00188 { 00189 for( unsigned int i=0; i<NBarrel; i++ ) { 00190 barrelData[i]->clear(); 00191 delete barrelData[i]; 00192 } 00193 for( unsigned int i=0; i<NEndcap; i++ ) { 00194 endcapData[i]->clear(); 00195 delete endcapData[i]; 00196 } 00197 for( unsigned int i=0; i<NEtf*NStrip; i++ ) { 00198 etfData[i]->clear(); 00199 delete etfData[i]; 00200 } 00201 return; 00202 }
RecordSet* TofDataSet::getBarrelData | ( | unsigned int | i | ) | const [inline] |
Definition at line 107 of file TofDataSet.h.
References barrelData.
Referenced by TofCalibManager::doCalibration(), and TofCalibManager::fillRoot().
00107 { return barrelData[i]; }
RecordSet* TofDataSet::getEndcapData | ( | unsigned int | i | ) | const [inline] |
Definition at line 108 of file TofDataSet.h.
References endcapData.
Referenced by TofCalibManager::doCalibration(), and TofCalibManager::fillRoot().
00108 { return endcapData[i]; }
RecordSet* TofDataSet::getEtfData | ( | unsigned int | i | ) | const [inline] |
Definition at line 109 of file TofDataSet.h.
References etfData.
Referenced by TofCalibManager::doCalibration(), and TofCalibManager::fillRoot().
void TofDataSet::setBarrelData | ( | RecBTofCalHitCol & | ) |
Definition at line 274 of file TofDataSet.cxx.
References barrelData, Record::cutBarrel(), iter(), and push_back().
Referenced by tofcalgsec::execute().
00274 { 00275 RecBTofCalHitCol::iterator iter = bhitcol.begin(); 00276 for( ; iter!=bhitcol.end(); iter++ ) { 00277 int tofid = (*iter)->mod(); 00278 if( tofid<0 || tofid>175 ) continue; 00279 if( fabs( (*iter)->dzHit() - 1.0 )>1.0e-6 ) continue; 00280 00281 Record *r = new Record( (*iter) ); 00282 if( r->cutBarrel() ) { 00283 barrelData[tofid]->push_back(r); 00284 } 00285 else { 00286 delete r; 00287 } 00288 } 00289 return; 00290 }
void TofDataSet::setBarrelDataFiles | ( | std::vector< std::string > & | ) |
Definition at line 205 of file TofDataSet.cxx.
References setData().
Referenced by tofcalgsec::finalize().
00205 { 00206 TChain* data_barrel = new TChain("btrk"); 00207 if( !data_barrel ) { 00208 std::cerr << " tofcalgsec Error Msg: creating a tree[barrel] fails in TofDataSet()"<<std::endl; 00209 throw "Error Msg: creating a tree fails in TofDataSet() "; 00210 } 00211 std::cout<<"begin reading barrel data file ... "<<std::endl; 00212 try{ 00213 for( std::vector<std::string>::iterator it=barrelFiles.begin(); it!=barrelFiles.end(); it++ ) { 00214 std::cout << " Add file : " << (*it) << std::endl; 00215 data_barrel->Add( (*it).c_str() ); 00216 } 00217 } 00218 catch(...){ 00219 std::cerr << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl; 00220 return; 00221 } 00222 setData( data_barrel, 1 ); 00223 delete data_barrel; 00224 return; 00225 }
void TofDataSet::setData | ( | TTree * | , | |
unsigned | int | |||
) |
Definition at line 106 of file TofDataSet.cxx.
References barrelData, Record::cutBarrel(), Record::cutEndcap(), Record::cutEtf(), tagItem::dt, endcapData, etfData, tagItem::event, tagItem::hitcase, genRecEmupikp::i, tagItem::p, tagItem::path, tagItem::phi, tagItem::qleft, tagItem::qright, tagItem::run, tagItem::strip, tagItem::texp, tagItem::theta, tagItem::tleft, tagItem::tofid, tagItem::tright, and tagItem::zrhit.
Referenced by setBarrelDataFiles(), setEndcapDataFiles(), and setEtfDataFiles().
00106 { 00107 if( t && t->GetEntries()>0 ) { 00108 rootRecord item; 00109 t->SetBranchAddress( "run", &item.run ); 00110 t->SetBranchAddress( "event", &item.event ); 00111 t->SetBranchAddress( "tofid", &item.tofid ); 00112 if( NULL != t->FindBranch( "strip" ) ) { 00113 t->SetBranchAddress( "strip", &item.strip ); 00114 } 00115 t->SetBranchAddress( "qleft", &item.qleft ); 00116 t->SetBranchAddress( "qright", &item.qright ); 00117 t->SetBranchAddress( "tleft", &item.tleft ); 00118 t->SetBranchAddress( "tright", &item.tright ); 00119 t->SetBranchAddress( "zrhit", &item.zrhit ); 00120 if( NULL != t->FindBranch( "dt" ) ) { 00121 t->SetBranchAddress( "dt", &item.dt ); 00122 } 00123 t->SetBranchAddress( "texp", &item.texp ); 00124 t->SetBranchAddress( "path", &item.path ); 00125 t->SetBranchAddress( "phi", &item.phi ); 00126 t->SetBranchAddress( "theta", &item.theta ); 00127 t->SetBranchAddress( "p", &item.p ); 00128 t->SetBranchAddress( "hitcase", &item.hitcase ); 00129 00130 for( unsigned int i=0; i<t->GetEntries(); i++ ) { 00131 t->GetEntry(i); 00132 if( isBarrel==1 && item.hitcase>=0 && item.hitcase<=2 ) { 00133 Record *r = new Record( item ); 00134 if( r->cutBarrel() ) { 00135 unsigned int tofID = item.tofid; 00136 barrelData[tofID]->push_back(r); 00137 } 00138 else { 00139 delete r; 00140 } 00141 } 00142 else if( isBarrel==0 && ( item.hitcase==3 || item.hitcase==4 ) ) { 00143 Record *r = new Record( item ); 00144 if( r->cutEndcap() ) { 00145 unsigned int tofID = item.tofid; 00146 endcapData[tofID]->push_back(r); 00147 } 00148 else { 00149 delete r; 00150 } 00151 } 00152 else if( isBarrel==2 && item.hitcase>=5 && item.hitcase<=6 ) { 00153 Record *r = new Record( item ); 00154 if( r->cutEtf() ) { 00155 unsigned int tofID = item.tofid; 00156 unsigned int strip = item.strip; 00157 unsigned int id = tofID*12 + strip; 00158 etfData[id]->push_back(r); 00159 } 00160 else { 00161 delete r; 00162 } 00163 } 00164 } 00165 } 00166 else { 00167 std::cerr << "Error: a invalid tree or a blank tree, When converting a tree to TofDataSet,exit" << std::endl; 00168 } 00169 00170 return; 00171 }
void TofDataSet::setEndcapData | ( | RecETofCalHitCol & | ) |
Definition at line 293 of file TofDataSet.cxx.
References Record::cutEndcap(), endcapData, iter(), and push_back().
Referenced by tofcalgsec::execute().
00293 { 00294 RecETofCalHitCol::iterator iter = ehitcol.begin(); 00295 for( ; iter!=ehitcol.end(); iter++ ) { 00296 int tofid = (*iter)->mod(); 00297 if( tofid<0 || tofid>95 ) continue; 00298 00299 Record *r = new Record( (*iter) ); 00300 if( r->cutEndcap() ) { 00301 endcapData[tofid]->push_back(r); 00302 } 00303 else { 00304 delete r; 00305 } 00306 } 00307 return; 00308 }
void TofDataSet::setEndcapDataFiles | ( | std::vector< std::string > & | ) |
Definition at line 228 of file TofDataSet.cxx.
References setData().
Referenced by tofcalgsec::finalize().
00228 { 00229 TChain* data_endcap = new TChain("etrk"); 00230 if( !data_endcap ) { 00231 std::cerr << " tofcalgsec Error Msg: creating a tree[endcap] fails in TofDataSet()"<<std::endl; 00232 throw "Error Msg: creating a tree fails in TofDataSet() "; 00233 } 00234 std::cout<<"begin reading endcap data file ... "<<std::endl; 00235 try{ 00236 for( std::vector<std::string>::iterator it=endcapFiles.begin(); it!=endcapFiles.end(); it++ ) { 00237 std::cout << " Add file : " << (*it) << std::endl; 00238 data_endcap->Add( (*it).c_str() ); 00239 } 00240 } 00241 catch(...){ 00242 std::cerr << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl; 00243 return; 00244 } 00245 setData( data_endcap, 0 ); 00246 delete data_endcap; 00247 return; 00248 }
void TofDataSet::setEtfData | ( | RecBTofCalHitCol & | ) |
Definition at line 311 of file TofDataSet.cxx.
References Record::cutEtf(), etfData, iter(), and push_back().
Referenced by tofcalgsec::execute().
00311 { 00312 RecBTofCalHitCol::iterator iter = bhitcol.begin(); 00313 for( ; iter!=bhitcol.end(); iter++ ) { 00314 int tofid = (*iter)->mod(); 00315 int strip = int( (*iter)->sinTheta() ); 00316 if( tofid<0 || tofid>71 ) continue; 00317 if( strip<0 || strip>11 ) continue; 00318 if( fabs( (*iter)->dzHit() )>1.0e-6 ) continue; 00319 unsigned int id = tofid*12 + strip; 00320 Record *r = new Record( (*iter) ); 00321 if( r->cutEtf() ) { 00322 etfData[id]->push_back(r); 00323 } 00324 else { 00325 delete r; 00326 } 00327 } 00328 return; 00329 }
void TofDataSet::setEtfDataFiles | ( | std::vector< std::string > & | ) |
Definition at line 251 of file TofDataSet.cxx.
References setData().
Referenced by tofcalgsec::finalize().
00251 { 00252 TChain* data_etf = new TChain("etf"); 00253 if( !data_etf ) { 00254 std::cerr << " tofcalgsec Error Msg: creating a tree[etf] fails in TofDataSet()"<<std::endl; 00255 throw "Error Msg: creating a tree fails in TofDataSet() "; 00256 } 00257 std::cout<<"begin reading etf data file ... "<<std::endl; 00258 try{ 00259 for( std::vector<std::string>::iterator it=etfFiles.begin(); it!=etfFiles.end(); it++ ) { 00260 std::cout << " Add file : " << (*it) << std::endl; 00261 data_etf->Add( (*it).c_str() ); 00262 } 00263 } 00264 catch(...){ 00265 std::cerr << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl; 00266 return; 00267 } 00268 setData( data_etf, 2 ); 00269 delete data_etf; 00270 return; 00271 }
RecordSet* TofDataSet::barrelData[NBarrel] [private] |
Definition at line 122 of file TofDataSet.h.
Referenced by getBarrelData(), setBarrelData(), setData(), TofDataSet(), and ~TofDataSet().
RecordSet* TofDataSet::endcapData[NEndcap] [private] |
Definition at line 123 of file TofDataSet.h.
Referenced by getEndcapData(), setData(), setEndcapData(), TofDataSet(), and ~TofDataSet().
RecordSet* TofDataSet::etfData[NEtf *NStrip] [private] |
Definition at line 124 of file TofDataSet.h.
Referenced by getEtfData(), setData(), setEtfData(), TofDataSet(), and ~TofDataSet().