#include <TofDataSet.h>
Definition at line 101 of file TofDataSet.h.
◆ TofDataSet()
TofDataSet::TofDataSet |
( |
| ) |
|
Definition at line 174 of file TofDataSet.cxx.
174 {
175 for(
unsigned int i=0; i<
NBarrel; i++ ) {
177 }
178 for(
unsigned int i=0; i<
NEndcap; i++ ) {
180 }
183 }
184 return;
185}
std::vector< Record * > RecordSet
const unsigned int NStrip
const unsigned int NBarrel
const unsigned int NEndcap
◆ ~TofDataSet()
TofDataSet::~TofDataSet |
( |
| ) |
|
Definition at line 188 of file TofDataSet.cxx.
188 {
189 for(
unsigned int i=0; i<
NBarrel; i++ ) {
190 barrelData[i]->clear();
191 delete barrelData[i];
192 }
193 for(
unsigned int i=0; i<
NEndcap; i++ ) {
194 endcapData[i]->clear();
195 delete endcapData[i];
196 }
198 etfData[i]->clear();
199 delete etfData[i];
200 }
201 return;
202}
◆ getBarrelData()
RecordSet * TofDataSet::getBarrelData |
( |
unsigned int |
i | ) |
const |
|
inline |
◆ getEndcapData()
RecordSet * TofDataSet::getEndcapData |
( |
unsigned int |
i | ) |
const |
|
inline |
◆ getEtfData()
RecordSet * TofDataSet::getEtfData |
( |
unsigned int |
i | ) |
const |
|
inline |
◆ setBarrelData()
Definition at line 274 of file TofDataSet.cxx.
274 {
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;
280
283 barrelData[tofid]->push_back(r);
284 }
285 else {
286 delete r;
287 }
288 }
289 return;
290}
Referenced by tofcalgsec::execute().
◆ setBarrelDataFiles()
void TofDataSet::setBarrelDataFiles |
( |
std::vector< std::string > & |
barrelFiles | ) |
|
Definition at line 205 of file TofDataSet.cxx.
205 {
206 TChain* data_barrel = new TChain("btrk");
207 if( !data_barrel ) {
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() ";
210 }
211 std::cout<<"begin reading barrel data file ... "<<std::endl;
212 try{
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() );
216 }
217 }
218 catch(...){
219 std::cerr << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl;
220 return;
221 }
223 delete data_barrel;
224 return;
225}
void setData(TTree *, unsigned int)
Referenced by tofcalgsec::finalize().
◆ setData()
void TofDataSet::setData |
( |
TTree * |
t, |
|
|
unsigned int |
isBarrel |
|
) |
| |
Definition at line 106 of file TofDataSet.cxx.
106 {
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 );
114 }
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 );
122 }
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 );
129
130 for(
unsigned int i=0; i<
t->GetEntries(); i++ ) {
135 unsigned int tofID = item.
tofid;
136 barrelData[tofID]->push_back(r);
137 }
138 else {
139 delete r;
140 }
141 }
142 else if( isBarrel==0 && ( item.
hitcase==3 || item.
hitcase==4 ) ) {
145 unsigned int tofID = item.
tofid;
146 endcapData[tofID]->push_back(r);
147 }
148 else {
149 delete r;
150 }
151 }
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);
159 }
160 else {
161 delete r;
162 }
163 }
164 }
165 }
166 else {
167 std::cerr << "Error: a invalid tree or a blank tree, When converting a tree to TofDataSet,exit" << std::endl;
168 }
169
170 return;
171}
Referenced by setBarrelDataFiles(), setEndcapDataFiles(), and setEtfDataFiles().
◆ setEndcapData()
Definition at line 293 of file TofDataSet.cxx.
293 {
294 RecETofCalHitCol::iterator
iter = ehitcol.begin();
295 for( ;
iter!=ehitcol.end();
iter++ ) {
296 int tofid = (*iter)->mod();
297 if( tofid<0 || tofid>95 ) continue;
298
301 endcapData[tofid]->push_back(r);
302 }
303 else {
304 delete r;
305 }
306 }
307 return;
308}
Referenced by tofcalgsec::execute().
◆ setEndcapDataFiles()
void TofDataSet::setEndcapDataFiles |
( |
std::vector< std::string > & |
endcapFiles | ) |
|
Definition at line 228 of file TofDataSet.cxx.
228 {
229 TChain* data_endcap = new TChain("etrk");
230 if( !data_endcap ) {
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() ";
233 }
234 std::cout<<"begin reading endcap data file ... "<<std::endl;
235 try{
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() );
239 }
240 }
241 catch(...){
242 std::cerr << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl;
243 return;
244 }
246 delete data_endcap;
247 return;
248}
Referenced by tofcalgsec::finalize().
◆ setEtfData()
Definition at line 311 of file TofDataSet.cxx.
311 {
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);
323 }
324 else {
325 delete r;
326 }
327 }
328 return;
329}
Referenced by tofcalgsec::execute().
◆ setEtfDataFiles()
void TofDataSet::setEtfDataFiles |
( |
std::vector< std::string > & |
etfFiles | ) |
|
Definition at line 251 of file TofDataSet.cxx.
251 {
252 TChain* data_etf = new TChain("etf");
253 if( !data_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() ";
256 }
257 std::cout<<"begin reading etf data file ... "<<std::endl;
258 try{
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() );
262 }
263 }
264 catch(...){
265 std::cerr << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) " << std::endl;
266 return;
267 }
269 delete data_etf;
270 return;
271}
Referenced by tofcalgsec::finalize().
The documentation for this class was generated from the following files: