BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
TofCheckData.cxx
Go to the documentation of this file.
3#include <iostream>
4
5TofCheckData::TofCheckData( NTuple::Tuple*& trk, NTuple::Tuple*& cbtrk, NTuple::Tuple*& cetrk, NTuple::Tuple*& cetftrk ):trk_tuple(trk),cbtrk_tuple(cbtrk),cetrk_tuple(cetrk),cetftrk_tuple(cetftrk) {
6
7 if(!trk_tuple) {
8 std::cerr<<" Error: invalid pionter in TofCheckData(NTuple::Tuple*) for trk_tple"<<std::endl;
9 }
10 else{
11 trk_tuple->addItem("run", trk_run );
12 trk_tuple->addItem("event", trk_event );
13 trk_tuple->addItem("toftrackid", trk_toftrackid );
14 trk_tuple->addItem("trackid", trk_trackid );
15 trk_tuple->addItem("charge", trk_charge );
16 trk_tuple->addItem("p", 5, trk_p );
17 trk_tuple->addItem("tofid", trk_tofid );
18 trk_tuple->addItem("strip", trk_strip );
19 trk_tuple->addItem("raw", trk_raw );
20 trk_tuple->addItem("readout", trk_readout );
21 trk_tuple->addItem("counter", trk_counter );
22 trk_tuple->addItem("cluster", trk_cluster );
23 trk_tuple->addItem("barrel", trk_barrel );
24 trk_tuple->addItem("east", trk_east );
25 trk_tuple->addItem("layer", trk_layer );
26 trk_tuple->addItem("over", trk_overflow );
27 trk_tuple->addItem("cluster", trk_cluster );
28 trk_tuple->addItem("multihit", trk_multihit );
29 trk_tuple->addItem("ncounter", trk_ncounter );
30 trk_tuple->addItem("neast", trk_neast );
31 trk_tuple->addItem("nwest", trk_nwest );
32 trk_tuple->addItem("mrpc", trk_mrpc );
33 trk_tuple->addItem("path", trk_path );
34 trk_tuple->addItem("zrhit", trk_zrhit );
35 trk_tuple->addItem("ph", trk_ph );
36 trk_tuple->addItem("tof", trk_tof );
37 trk_tuple->addItem("errtof", trk_errtof );
38 trk_tuple->addItem("beta", trk_beta );
39 trk_tuple->addItem("texpe", trk_texpe );
40 trk_tuple->addItem("texpmu", trk_texpmu );
41 trk_tuple->addItem("texppi", trk_texppi );
42 trk_tuple->addItem("texpk", trk_texpk );
43 trk_tuple->addItem("texpp", trk_texpp );
44 trk_tuple->addItem("offe", trk_offe );
45 trk_tuple->addItem("offmu", trk_offmu );
46 trk_tuple->addItem("offpi", trk_offpi );
47 trk_tuple->addItem("offk", trk_offk );
48 trk_tuple->addItem("offp", trk_offp );
49 trk_tuple->addItem("sige", trk_sige );
50 trk_tuple->addItem("sigmu", trk_sigmu );
51 trk_tuple->addItem("sigpi", trk_sigpi );
52 trk_tuple->addItem("sigk", trk_sigk );
53 trk_tuple->addItem("sigp", trk_sigp );
54 trk_tuple->addItem("qual", trk_quality );
55 trk_tuple->addItem("t0", trk_t0 );
56 trk_tuple->addItem("errt0", trk_errt0 );
57 trk_tuple->addItem("errz", trk_errz );
58 trk_tuple->addItem("phi", trk_phi );
59 trk_tuple->addItem("errphi", trk_errphi );
60 trk_tuple->addItem("e", trk_energy );
61 trk_tuple->addItem("erre", trk_errenergy );
62 }
63
64 if(!cbtrk_tuple) {
65 std::cerr<<" Error: invalid pionter in TofCheckData(NTuple::Tuple*) for cbtrk_tple"<<std::endl;
66 }
67 else{
68 cbtrk_tuple->addItem("run", cbtrk_run );
69 cbtrk_tuple->addItem("event", cbtrk_event );
70 cbtrk_tuple->addItem("tofid", cbtrk_tofid );
71 cbtrk_tuple->addItem("qual", cbtrk_qual );
72 cbtrk_tuple->addItem("texp", cbtrk_texp );
73 cbtrk_tuple->addItem("tdc1", cbtrk_tdc1 );
74 cbtrk_tuple->addItem("tdc2", cbtrk_tdc2 );
75 cbtrk_tuple->addItem("adc1", cbtrk_adc1 );
76 cbtrk_tuple->addItem("adc2", cbtrk_adc2 );
77 cbtrk_tuple->addItem("zhit", cbtrk_zhit );
78 cbtrk_tuple->addItem("dzhit", cbtrk_dzhit );
79 cbtrk_tuple->addItem("sint", cbtrk_sintheta );
80 cbtrk_tuple->addItem("p", cbtrk_p );
81 cbtrk_tuple->addItem("q", cbtrk_q );
82 cbtrk_tuple->addItem("path", cbtrk_path );
83 }
84
85 if(!cetrk_tuple) {
86 std::cerr<<" Error: invalid pionter in TofCheckData(NTuple::Tuple*) for cetrk_tple"<<std::endl;
87 }
88 else{
89 cetrk_tuple->addItem("run", cetrk_run );
90 cetrk_tuple->addItem("event", cetrk_event );
91 cetrk_tuple->addItem("tofid", cetrk_tofid );
92 cetrk_tuple->addItem("qual", cetrk_qual );
93 cetrk_tuple->addItem("texp", cetrk_texp );
94 cetrk_tuple->addItem("tdc", cetrk_tdc );
95 cetrk_tuple->addItem("adc", cetrk_adc );
96 cetrk_tuple->addItem("rhit", cetrk_rhit );
97 cetrk_tuple->addItem("drhit", cetrk_drhit );
98 // cetrk_tuple->addItem("sint", cetrk_sintheta );
99 cetrk_tuple->addItem("p", cetrk_p );
100 cetrk_tuple->addItem("q", cetrk_q );
101 cetrk_tuple->addItem("path", cetrk_path );
102 }
103
104 if(!cetftrk_tuple) {
105 std::cerr<<" Error: invalid pionter in TofCheckData(NTuple::Tuple*) for cetftrk_tple"<<std::endl;
106 }
107 else{
108 cetftrk_tuple->addItem("run", cetftrk_run );
109 cetftrk_tuple->addItem("event", cetftrk_event );
110 cetftrk_tuple->addItem("tofid", cetftrk_tofid );
111 cetftrk_tuple->addItem("qual", cetftrk_qual );
112 cetftrk_tuple->addItem("texp", cetftrk_texp );
113 cetftrk_tuple->addItem("tdc1", cetftrk_tdc1 );
114 cetftrk_tuple->addItem("tdc2", cetftrk_tdc2 );
115 cetftrk_tuple->addItem("adc1", cetftrk_adc1 );
116 cetftrk_tuple->addItem("adc2", cetftrk_adc2 );
117 cetftrk_tuple->addItem("zhit", cetftrk_zhit );
118 cetftrk_tuple->addItem("dzhit", cetftrk_dzhit );
119 cetftrk_tuple->addItem("sint", cetftrk_sintheta );
120 cetftrk_tuple->addItem("p", cetftrk_p );
121 cetftrk_tuple->addItem("q", cetftrk_q );
122 cetftrk_tuple->addItem("path", cetftrk_path );
123 }
124}
125
126
127void TofCheckData::Fill(Event::EventHeader& eventHeader, RecTofTrack*& recTof, RecMdcKalTrack*& kalTrack, bool fillTrk ) {
128
129 int charge = 0;
130 double p[5]= {0.};
131 if( fillTrk ) {
133 double kappa = kalTrack->kappa();
134 if( kappa>0 ) { charge = 1; }
135 else { charge = -1; }
136 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
137 p[0] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa);
138 kalTrack->setPidType( RecMdcKalTrack::muon );
139 kappa = kalTrack->kappa();
140 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
141 p[1] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
142 kalTrack->setPidType( RecMdcKalTrack::pion );
143 kappa = kalTrack->kappa();
144 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
145 p[2] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
146 kalTrack->setPidType( RecMdcKalTrack::kaon );
147 kappa = kalTrack->kappa();
148 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
149 p[3] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
151 kappa = kalTrack->kappa();
152 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
153 p[4] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
154 }
155 trk_run = eventHeader.runNumber();
156 trk_event = eventHeader.eventNumber();
157 trk_toftrackid = recTof->tofTrackID();
158 trk_trackid = recTof->trackID();
159 trk_charge = charge;
160 for( unsigned int i=0; i<5; i++ ) {
161 trk_p[i] = p[i];
162 }
163 trk_tofid = recTof->tofID();
164 trk_strip = recTof->strip();
165 TofHitStatus* hitStatus = new TofHitStatus;
166 hitStatus->setStatus( recTof->status() );
167 trk_raw = hitStatus->is_raw();
168 trk_readout = hitStatus->is_readout();
169 trk_counter = hitStatus->is_counter();
170 trk_cluster = hitStatus->is_cluster();
171 trk_barrel = hitStatus->is_barrel();
172 trk_east = hitStatus->is_east();
173 trk_layer = hitStatus->layer();
174 trk_overflow = hitStatus->is_overflow();
175 trk_multihit = hitStatus->is_multihit();
176 trk_ncounter = hitStatus->ncounter();
177 trk_neast = hitStatus->neast();
178 trk_nwest = hitStatus->nwest();
179 trk_mrpc = hitStatus->is_mrpc();
180 delete hitStatus;
181 /*
182 if( hitStatus->is_mrpc() ) {
183 if( recTof->tofID() >= 0 ) {
184 trk_tofid = static_cast<int>(recTof->tofID()/12);
185 trk_strip = static_cast<int>(recTof->tofID()%12);
186 }
187 }
188 */
189 trk_path = recTof->path();
190 trk_zrhit = recTof->zrhit();
191 trk_ph = recTof->ph();
192 trk_tof = recTof->tof();
193 trk_errtof = recTof->errtof();
194 trk_beta = recTof->beta();
195 trk_texpe = recTof->texpElectron();
196 trk_texpmu = recTof->texpMuon();
197 trk_texppi = recTof->texpPion();
198 trk_texpk = recTof->texpKaon();
199 trk_texpp = recTof->texpProton();
200 trk_offe = recTof->toffsetElectron();
201 trk_offmu = recTof->toffsetMuon();
202 trk_offpi = recTof->toffsetPion();
203 trk_offk = recTof->toffsetKaon();
204 trk_offp = recTof->toffsetProton();
205 trk_sige = recTof->sigmaElectron();
206 trk_sigmu = recTof->sigmaMuon();
207 trk_sigpi = recTof->sigmaPion();
208 trk_sigk = recTof->sigmaKaon();
209 trk_sigp = recTof->sigmaProton();
210 trk_quality = recTof->quality();
211 trk_t0 = recTof->t0();
212 trk_errt0 = recTof->errt0();
213 trk_errz = recTof->errz();
214 trk_phi = recTof->phi();
215 trk_errphi = recTof->errphi();
216 trk_energy = recTof->energy();
217 trk_errenergy = recTof->errenergy();
218 trk_tuple->write();
219 return;
220}
221
222
224
225 cbtrk_run = eventHeader.runNumber();
226 cbtrk_event = eventHeader.eventNumber();
227 cbtrk_tofid = recBTof->mod();
228 cbtrk_qual = recBTof->qual();
229 cbtrk_texp = recBTof->tpred(1);
230 cbtrk_tdc1 = recBTof->tdc1();
231 cbtrk_tdc2 = recBTof->tdc2();
232 cbtrk_adc1 = recBTof->adc1();
233 cbtrk_adc2 = recBTof->adc2();
234 cbtrk_zhit = recBTof->zHit();
235 cbtrk_dzhit = recBTof->dzHit();
236 cbtrk_sintheta = recBTof->sinTheta();
237 cbtrk_p = recBTof->p();
238 cbtrk_q = recBTof->Q();
239 cbtrk_path = recBTof->path();
240 cbtrk_tuple->write();
241 return;
242}
243
244
246
247 cetrk_run = eventHeader.runNumber();
248 cetrk_event = eventHeader.eventNumber();
249 cetrk_tofid = recETof->mod();
250 cetrk_qual = recETof->qual();
251 cetrk_texp = recETof->tpred(1);
252 cetrk_tdc = recETof->tdc();
253 cetrk_adc = recETof->adc();
254 cetrk_rhit = recETof->rHit();
255 cetrk_drhit = recETof->drHit();
256 // cetrk_sintheta = recETof->sinTheta();
257 cetrk_p = recETof->p();
258 cetrk_q = recETof->Q();
259 cetrk_path = recETof->path();
260 cetrk_tuple->write();
261 return;
262}
263
265
266 cetftrk_run = eventHeader.runNumber();
267 cetftrk_event = eventHeader.eventNumber();
268 cetftrk_tofid = recBTof->mod();
269 cetftrk_qual = recBTof->qual();
270 cetftrk_texp = recBTof->tpred(1);
271 cetftrk_tdc1 = recBTof->tdc1();
272 cetftrk_tdc2 = recBTof->tdc2();
273 cetftrk_adc1 = recBTof->adc1();
274 cetftrk_adc2 = recBTof->adc2();
275 cetftrk_zhit = recBTof->zHit();
276 cetftrk_dzhit = recBTof->dzHit();
277 cetftrk_sintheta = recBTof->sinTheta();
278 cetftrk_p = recBTof->p();
279 cetftrk_q = recBTof->Q();
280 cetftrk_path = recBTof->path();
281 cetftrk_tuple->write();
282 return;
283}
284
285
286void TofCheckData::FillCol(Event::EventHeader& eventHeader, RecTofTrackCol& recTofTrackCol, RecMdcKalTrackCol& kalTrackCol) {
287 RecTofTrackCol::iterator iter_tof = recTofTrackCol.begin();
288 for( ; iter_tof!=recTofTrackCol.end(); iter_tof++ ) {
289 RecMdcKalTrackCol::iterator iter_kal = kalTrackCol.begin();
290 for( ; iter_kal!=kalTrackCol.end(); iter_kal++ ) {
291 if( (*iter_tof)->trackID() == (*iter_kal)->trackId() ) break;
292 }
293 Fill( eventHeader, *iter_tof, *iter_kal, iter_kal!=kalTrackCol.end() );
294 }
295 return;
296}
297
298void TofCheckData::FillCol(Event::EventHeader& eventHeader, RecBTofCalHitCol& recBTofCalHitCol) {
299 RecBTofCalHitCol::iterator iter_btof = recBTofCalHitCol.begin();
300 for( ; iter_btof!=recBTofCalHitCol.end(); iter_btof++ ) {
301 if( fabs( (*iter_btof)->dzHit() - 1.0 )<1.0e-6 ) {
302 FillBarrel( eventHeader, *iter_btof );
303 }
304 else {
305 FillETF( eventHeader, *iter_btof );
306 }
307 }
308 return;
309}
310
311void TofCheckData::FillCol(Event::EventHeader& eventHeader, RecETofCalHitCol& recETofCalHitCol) {
312 RecETofCalHitCol::iterator iter_etof = recETofCalHitCol.begin();
313 for( ; iter_etof!=recETofCalHitCol.end(); iter_etof++ ) {
314 Fill( eventHeader, *iter_etof );
315 }
316 return;
317}
curve Fill()
ObjectVector< RecBTofCalHit > RecBTofCalHitCol
ObjectVector< RecETofCalHit > RecETofCalHitCol
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecTofTrack > RecTofTrackCol
Definition RecTofTrack.h:33
const double tanl(void) const
static void setPidType(PidType pidType)
const double kappa(void) const
double texpProton() const
Definition DstTofTrack.h:59
double toffsetProton() const
Definition DstTofTrack.h:66
int trackID() const
Definition DstTofTrack.h:41
double texpKaon() const
Definition DstTofTrack.h:58
unsigned int status() const
Definition DstTofTrack.h:45
double t0() const
Definition DstTofTrack.h:79
double texpElectron() const
Definition DstTofTrack.h:55
double path() const
Definition DstTofTrack.h:47
double errenergy() const
Definition DstTofTrack.h:86
double tof() const
Definition DstTofTrack.h:50
double errtof() const
Definition DstTofTrack.h:51
double sigmaMuon() const
Definition DstTofTrack.h:71
double toffsetMuon() const
Definition DstTofTrack.h:63
int quality() const
Definition DstTofTrack.h:77
double errt0() const
Definition DstTofTrack.h:80
double sigmaElectron() const
Definition DstTofTrack.h:70
double phi() const
Definition DstTofTrack.h:83
double energy() const
Definition DstTofTrack.h:85
double toffsetElectron() const
Definition DstTofTrack.h:62
double ph() const
Definition DstTofTrack.h:49
double toffsetKaon() const
Definition DstTofTrack.h:65
double texpPion() const
Definition DstTofTrack.h:57
double beta() const
Definition DstTofTrack.h:52
double zrhit() const
Definition DstTofTrack.h:48
double errz() const
Definition DstTofTrack.h:82
double texpMuon() const
Definition DstTofTrack.h:56
double sigmaPion() const
Definition DstTofTrack.h:72
double toffsetPion() const
Definition DstTofTrack.h:64
double sigmaKaon() const
Definition DstTofTrack.h:73
double errphi() const
Definition DstTofTrack.h:84
double sigmaProton() const
Definition DstTofTrack.h:74
int tofTrackID() const
Definition DstTofTrack.h:40
int eventNumber() const
Retrieve event number.
Definition EventHeader.h:37
int runNumber() const
Retrieve run number.
Definition EventHeader.h:42
double dzHit() const
double tpred() const
double p() const
double Q() const
double zHit() const
double tdc1() const
int mod() const
double adc1() const
double tdc2() const
int qual() const
double adc2() const
double sinTheta() const
double path() const
double drHit() const
double p() const
double tpred() const
double path() const
double Q() const
int mod() const
double adc() const
double tdc() const
double rHit() const
int qual() const
void FillCol(Event::EventHeader &, RecTofTrackCol &, RecMdcKalTrackCol &)
void Fill(Event::EventHeader &, RecTofTrack *&, RecMdcKalTrack *&, bool)
TofCheckData(NTuple::Tuple *&trk, NTuple::Tuple *&cbtrk, NTuple::Tuple *&cetrk, NTuple::Tuple *&cetftrk)
void FillETF(Event::EventHeader &, RecBTofCalHit *&)
void FillBarrel(Event::EventHeader &, RecBTofCalHit *&)
bool is_barrel() const
unsigned int ncounter() const
unsigned int layer() const
bool is_cluster() const
void setStatus(unsigned int status)
bool is_multihit() const
bool is_overflow() const
unsigned int nwest() const
bool is_mrpc() const
bool is_counter() const
bool is_east() const
bool is_readout() const
unsigned int neast() const
bool is_raw() const
float charge