#include <TofDataSet.h>
Definition at line 99 of file TofDataSet.h.
◆ TofDataSet()
| TofDataSet::TofDataSet |
( |
| ) |
|
Definition at line 172 of file TofDataSet.cxx.
172 {
173 for (
unsigned int i = 0; i <
NBarrel; i++ ) { barrelData[i] =
new RecordSet; }
174 for (
unsigned int i = 0; i <
NEndcap; i++ ) { endcapData[i] =
new RecordSet; }
176 return;
177}
std::vector< Record * > RecordSet
const unsigned int NStrip
const unsigned int NBarrel
const unsigned int NEndcap
◆ ~TofDataSet()
| TofDataSet::~TofDataSet |
( |
| ) |
|
Definition at line 179 of file TofDataSet.cxx.
179 {
180 for (
unsigned int i = 0; i <
NBarrel; i++ )
181 {
182 barrelData[i]->clear();
183 delete barrelData[i];
184 }
185 for (
unsigned int i = 0; i <
NEndcap; i++ )
186 {
187 endcapData[i]->clear();
188 delete endcapData[i];
189 }
190 for (
unsigned int i = 0; i <
NEtf *
NStrip; i++ )
191 {
192 etfData[i]->clear();
193 delete etfData[i];
194 }
195 return;
196}
◆ 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 285 of file TofDataSet.cxx.
285 {
286 RecBTofCalHitCol::iterator
iter = bhitcol.begin();
287 for ( ;
iter != bhitcol.end();
iter++ )
288 {
289 int tofid = ( *iter )->mod();
290 if ( tofid < 0 || tofid > 175 ) continue;
291 if ( fabs( ( *iter )->dzHit() - 1.0 ) > 1.0e-6 ) continue;
292
293 Record* r =
new Record( ( *
iter ) );
294 if ( r->
cutBarrel() ) { barrelData[tofid]->push_back( r ); }
295 else { delete r; }
296 }
297 return;
298}
Referenced by tofcalgsec::execute().
◆ setBarrelDataFiles()
| void TofDataSet::setBarrelDataFiles |
( |
std::vector< std::string > & | barrelFiles | ) |
|
Definition at line 198 of file TofDataSet.cxx.
198 {
199 TChain* data_barrel = new TChain( "btrk" );
200 if ( !data_barrel )
201 {
202 std::cerr << " tofcalgsec Error Msg: creating a tree[barrel] fails in TofDataSet()"
203 << std::endl;
204 throw "Error Msg: creating a tree fails in TofDataSet() ";
205 }
206 std::cout << "begin reading barrel data file ... " << std::endl;
207 try
208 {
209 for ( std::vector<std::string>::iterator it = barrelFiles.begin(); it != barrelFiles.end();
210 it++ )
211 {
212 std::cout << " Add file : " << ( *it ) << std::endl;
213 data_barrel->Add( ( *it ).c_str() );
214 }
215 } catch ( ... )
216 {
217 std::cerr
218 << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) "
219 << 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 104 of file TofDataSet.cxx.
104 {
105 if (
t &&
t->GetEntries() > 0 )
106 {
108 t->SetBranchAddress(
"run", &item.
run );
109 t->SetBranchAddress(
"event", &item.
event );
110 t->SetBranchAddress(
"tofid", &item.
tofid );
111 if ( NULL !=
t->FindBranch(
"strip" ) ) {
t->SetBranchAddress(
"strip", &item.
strip ); }
112 t->SetBranchAddress(
"qleft", &item.
qleft );
113 t->SetBranchAddress(
"qright", &item.
qright );
114 t->SetBranchAddress(
"tleft", &item.
tleft );
115 t->SetBranchAddress(
"tright", &item.
tright );
116 t->SetBranchAddress(
"zrhit", &item.
zrhit );
117 if ( NULL !=
t->FindBranch(
"dt" ) ) {
t->SetBranchAddress(
"dt", &item.
dt ); }
118 t->SetBranchAddress(
"texp", &item.
texp );
119 t->SetBranchAddress(
"path", &item.
path );
120 t->SetBranchAddress(
"phi", &item.
phi );
121 t->SetBranchAddress(
"theta", &item.
theta );
122 t->SetBranchAddress(
"p", &item.
p );
123 t->SetBranchAddress(
"hitcase", &item.
hitcase );
124
125 for (
unsigned int i = 0; i <
t->GetEntries(); i++ )
126 {
129 {
130 Record* r = new Record( item );
132 {
133 unsigned int tofID = item.
tofid;
134 barrelData[tofID]->push_back( r );
135 }
136 else { delete r; }
137 }
138 else if ( isBarrel == 0 && ( item.
hitcase == 3 || item.
hitcase == 4 ) )
139 {
140 Record* r = new Record( item );
142 {
143 unsigned int tofID = item.
tofid;
144 endcapData[tofID]->push_back( r );
145 }
146 else { delete r; }
147 }
148 else if ( isBarrel == 2 && item.
hitcase >= 5 && item.
hitcase <= 6 )
149 {
150 Record* r = new Record( item );
152 {
153 unsigned int tofID = item.
tofid;
154 unsigned int strip = item.
strip;
155 unsigned int id = tofID * 12 + strip;
156 etfData[id]->push_back( r );
157 }
158 else { delete r; }
159 }
160 }
161 }
162 else
163 {
164 std::cerr
165 << "Error: a invalid tree or a blank tree, When converting a tree to TofDataSet,exit"
166 << std::endl;
167 }
168
169 return;
170}
struct tagItem rootRecord
Referenced by setBarrelDataFiles(), setEndcapDataFiles(), and setEtfDataFiles().
◆ setEndcapData()
Definition at line 300 of file TofDataSet.cxx.
300 {
301 RecETofCalHitCol::iterator
iter = ehitcol.begin();
302 for ( ;
iter != ehitcol.end();
iter++ )
303 {
304 int tofid = ( *iter )->mod();
305 if ( tofid < 0 || tofid > 95 ) continue;
306
307 Record* r =
new Record( ( *
iter ) );
308 if ( r->
cutEndcap() ) { endcapData[tofid]->push_back( r ); }
309 else { delete r; }
310 }
311 return;
312}
Referenced by tofcalgsec::execute().
◆ setEndcapDataFiles()
| void TofDataSet::setEndcapDataFiles |
( |
std::vector< std::string > & | endcapFiles | ) |
|
Definition at line 227 of file TofDataSet.cxx.
227 {
228 TChain* data_endcap = new TChain( "etrk" );
229 if ( !data_endcap )
230 {
231 std::cerr << " tofcalgsec Error Msg: creating a tree[endcap] fails in TofDataSet()"
232 << std::endl;
233 throw "Error Msg: creating a tree fails in TofDataSet() ";
234 }
235 std::cout << "begin reading endcap data file ... " << std::endl;
236 try
237 {
238 for ( std::vector<std::string>::iterator it = endcapFiles.begin(); it != endcapFiles.end();
239 it++ )
240 {
241 std::cout << " Add file : " << ( *it ) << std::endl;
242 data_endcap->Add( ( *it ).c_str() );
243 }
244 } catch ( ... )
245 {
246 std::cerr
247 << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) "
248 << std::endl;
249 return;
250 }
252 delete data_endcap;
253 return;
254}
Referenced by tofcalgsec::finalize().
◆ setEtfData()
Definition at line 314 of file TofDataSet.cxx.
314 {
315 RecBTofCalHitCol::iterator
iter = bhitcol.begin();
316 for ( ;
iter != bhitcol.end();
iter++ )
317 {
318 int tofid = ( *iter )->mod();
319 int strip = int( ( *iter )->sinTheta() );
320 if ( tofid < 0 || tofid > 71 ) continue;
321 if ( strip < 0 || strip > 11 ) continue;
322 if ( fabs( ( *iter )->dzHit() ) > 1.0e-6 ) continue;
323 unsigned int id = tofid * 12 + strip;
324 Record* r =
new Record( ( *
iter ) );
325 if ( r->
cutEtf() ) { etfData[id]->push_back( r ); }
326 else { delete r; }
327 }
328 return;
329}
Referenced by tofcalgsec::execute().
◆ setEtfDataFiles()
| void TofDataSet::setEtfDataFiles |
( |
std::vector< std::string > & | etfFiles | ) |
|
Definition at line 256 of file TofDataSet.cxx.
256 {
257 TChain* data_etf = new TChain( "etf" );
258 if ( !data_etf )
259 {
260 std::cerr << " tofcalgsec Error Msg: creating a tree[etf] fails in TofDataSet()"
261 << std::endl;
262 throw "Error Msg: creating a tree fails in TofDataSet() ";
263 }
264 std::cout << "begin reading etf data file ... " << std::endl;
265 try
266 {
267 for ( std::vector<std::string>::iterator it = etfFiles.begin(); it != etfFiles.end();
268 it++ )
269 {
270 std::cout << " Add file : " << ( *it ) << std::endl;
271 data_etf->Add( ( *it ).c_str() );
272 }
273 } catch ( ... )
274 {
275 std::cerr
276 << "tofcalgsec Error Msg : in TofDataSet::setDataFiles(std::vector<std::string>&) "
277 << std::endl;
278 return;
279 }
281 delete data_etf;
282 return;
283}
Referenced by tofcalgsec::finalize().
The documentation for this class was generated from the following files: