CGEM BOSS 6.6.5.h
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 ):trk_tuple(trk),cbtrk_tuple(cbtrk),cetrk_tuple(cetrk) {
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("raw", trk_raw );
19 trk_tuple->addItem("readout", trk_readout );
20 trk_tuple->addItem("counter", trk_counter );
21 trk_tuple->addItem("cluster", trk_cluster );
22 trk_tuple->addItem("barrel", trk_barrel );
23 trk_tuple->addItem("east", trk_east );
24 trk_tuple->addItem("layer", trk_layer );
25 trk_tuple->addItem("over", trk_overflow );
26 trk_tuple->addItem("cluster", trk_cluster );
27 trk_tuple->addItem("multihit", trk_multihit );
28 trk_tuple->addItem("ncounter", trk_ncounter );
29 trk_tuple->addItem("neast", trk_neast );
30 trk_tuple->addItem("nwest", trk_nwest );
31 trk_tuple->addItem("path", trk_path );
32 trk_tuple->addItem("zrhit", trk_zrhit );
33 trk_tuple->addItem("ph", trk_ph );
34 trk_tuple->addItem("tof", trk_tof );
35 trk_tuple->addItem("errtof", trk_errtof );
36 trk_tuple->addItem("beta", trk_beta );
37 trk_tuple->addItem("texpe", trk_texpe );
38 trk_tuple->addItem("texpmu", trk_texpmu );
39 trk_tuple->addItem("texppi", trk_texppi );
40 trk_tuple->addItem("texpk", trk_texpk );
41 trk_tuple->addItem("texpp", trk_texpp );
42 trk_tuple->addItem("offe", trk_offe );
43 trk_tuple->addItem("offmu", trk_offmu );
44 trk_tuple->addItem("offpi", trk_offpi );
45 trk_tuple->addItem("offk", trk_offk );
46 trk_tuple->addItem("offp", trk_offp );
47 trk_tuple->addItem("sige", trk_sige );
48 trk_tuple->addItem("sigmu", trk_sigmu );
49 trk_tuple->addItem("sigpi", trk_sigpi );
50 trk_tuple->addItem("sigk", trk_sigk );
51 trk_tuple->addItem("sigp", trk_sigp );
52 trk_tuple->addItem("qual", trk_quality );
53 trk_tuple->addItem("t0", trk_t0 );
54 trk_tuple->addItem("errt0", trk_errt0 );
55 trk_tuple->addItem("errz", trk_errz );
56 trk_tuple->addItem("phi", trk_phi );
57 trk_tuple->addItem("errphi", trk_errphi );
58 trk_tuple->addItem("e", trk_energy );
59 trk_tuple->addItem("erre", trk_errenergy );
60 }
61
62 if(!cbtrk_tuple) {
63 std::cerr<<" Error: invalid pionter in TofCheckData(NTuple::Tuple*) for cbtrk_tple"<<std::endl;
64 }
65 else{
66 cbtrk_tuple->addItem("run", cbtrk_run );
67 cbtrk_tuple->addItem("event", cbtrk_event );
68 cbtrk_tuple->addItem("tofid", cbtrk_tofid );
69 cbtrk_tuple->addItem("qual", cbtrk_qual );
70 cbtrk_tuple->addItem("texp", cbtrk_texp );
71 cbtrk_tuple->addItem("tdc1", cbtrk_tdc1 );
72 cbtrk_tuple->addItem("tdc2", cbtrk_tdc2 );
73 cbtrk_tuple->addItem("adc1", cbtrk_adc1 );
74 cbtrk_tuple->addItem("adc2", cbtrk_adc2 );
75 cbtrk_tuple->addItem("zhit", cbtrk_zhit );
76 cbtrk_tuple->addItem("dzhit", cbtrk_dzhit );
77 cbtrk_tuple->addItem("sint", cbtrk_sintheta );
78 cbtrk_tuple->addItem("p", cbtrk_p );
79 cbtrk_tuple->addItem("q", cbtrk_q );
80 cbtrk_tuple->addItem("path", cbtrk_path );
81 }
82
83 if(!cetrk_tuple) {
84 std::cerr<<" Error: invalid pionter in TofCheckData(NTuple::Tuple*) for cetrk_tple"<<std::endl;
85 }
86 else{
87 cetrk_tuple->addItem("run", cetrk_run );
88 cetrk_tuple->addItem("event", cetrk_event );
89 cetrk_tuple->addItem("tofid", cetrk_tofid );
90 cetrk_tuple->addItem("qual", cetrk_qual );
91 cetrk_tuple->addItem("texp", cetrk_texp );
92 cetrk_tuple->addItem("tdc", cetrk_tdc );
93 cetrk_tuple->addItem("adc", cetrk_adc );
94 cetrk_tuple->addItem("rhit", cetrk_rhit );
95 cetrk_tuple->addItem("drhit", cetrk_drhit );
96 // cetrk_tuple->addItem("sint", cetrk_sintheta );
97 cetrk_tuple->addItem("p", cetrk_p );
98 cetrk_tuple->addItem("q", cetrk_q );
99 cetrk_tuple->addItem("path", cetrk_path );
100 }
101}
102
103
104void TofCheckData::Fill(Event::EventHeader& eventHeader, RecTofTrack*& recTof, RecMdcKalTrack*& kalTrack, bool fillTrk ) {
105
106 int charge = 0;
107 double p[5]= {0.};
108 if( fillTrk ) {
110 double kappa = kalTrack->kappa();
111 if( kappa>0 ) { charge = 1; }
112 else { charge = -1; }
113 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
114 p[0] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa);
115 kalTrack->setPidType( RecMdcKalTrack::muon );
116 kappa = kalTrack->kappa();
117 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
118 p[1] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
119 kalTrack->setPidType( RecMdcKalTrack::pion );
120 kappa = kalTrack->kappa();
121 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
122 p[2] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
123 kalTrack->setPidType( RecMdcKalTrack::kaon );
124 kappa = kalTrack->kappa();
125 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
126 p[3] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
128 kappa = kalTrack->kappa();
129 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
130 p[4] = abs(sqrt( 1.0 + kalTrack->tanl()*kalTrack->tanl() ) / kappa );
131 }
132 trk_run = eventHeader.runNumber();
133 trk_event = eventHeader.eventNumber();
134 trk_toftrackid = recTof->tofTrackID();
135 trk_trackid = recTof->trackID();
136 trk_charge = charge;
137 for( unsigned int i=0; i<5; i++ ) {
138 trk_p[i] = p[i];
139 }
140 trk_tofid = recTof->tofID();
141 TofHitStatus* hitStatus = new TofHitStatus;
142 hitStatus->setStatus( recTof->status() );
143 trk_raw = hitStatus->is_raw();
144 trk_readout = hitStatus->is_readout();
145 trk_counter = hitStatus->is_counter();
146 trk_cluster = hitStatus->is_cluster();
147 trk_barrel = hitStatus->is_barrel();
148 trk_east = hitStatus->is_east();
149 trk_layer = hitStatus->layer();
150 trk_overflow = hitStatus->is_overflow();
151 trk_multihit = hitStatus->is_multihit();
152 trk_ncounter = hitStatus->ncounter();
153 trk_neast = hitStatus->neast();
154 trk_nwest = hitStatus->nwest();
155 delete hitStatus;
156 trk_path = recTof->path();
157 trk_zrhit = recTof->zrhit();
158 trk_ph = recTof->ph();
159 trk_tof = recTof->tof();
160 trk_errtof = recTof->errtof();
161 trk_beta = recTof->beta();
162 trk_texpe = recTof->texpElectron();
163 trk_texpmu = recTof->texpMuon();
164 trk_texppi = recTof->texpPion();
165 trk_texpk = recTof->texpKaon();
166 trk_texpp = recTof->texpProton();
167 trk_offe = recTof->toffsetElectron();
168 trk_offmu = recTof->toffsetMuon();
169 trk_offpi = recTof->toffsetPion();
170 trk_offk = recTof->toffsetKaon();
171 trk_offp = recTof->toffsetProton();
172 trk_sige = recTof->sigmaElectron();
173 trk_sigmu = recTof->sigmaMuon();
174 trk_sigpi = recTof->sigmaPion();
175 trk_sigk = recTof->sigmaKaon();
176 trk_sigp = recTof->sigmaProton();
177 trk_quality = recTof->quality();
178 trk_t0 = recTof->t0();
179 trk_errt0 = recTof->errt0();
180 trk_errz = recTof->errz();
181 trk_phi = recTof->phi();
182 trk_errphi = recTof->errphi();
183 trk_energy = recTof->energy();
184 trk_errenergy = recTof->errenergy();
185 trk_tuple->write();
186 return;
187}
188
189
191
192 cbtrk_run = eventHeader.runNumber();
193 cbtrk_event = eventHeader.eventNumber();
194 cbtrk_tofid = recBTof->mod();
195 cbtrk_qual = recBTof->qual();
196 cbtrk_texp = recBTof->tpred(1);
197 cbtrk_tdc1 = recBTof->tdc1();
198 cbtrk_tdc2 = recBTof->tdc2();
199 cbtrk_adc1 = recBTof->adc1();
200 cbtrk_adc2 = recBTof->adc2();
201 cbtrk_zhit = recBTof->zHit();
202 cbtrk_dzhit = recBTof->dzHit();
203 cbtrk_sintheta = recBTof->sinTheta();
204 cbtrk_p = recBTof->p();
205 cbtrk_q = recBTof->Q();
206 cbtrk_path = recBTof->path();
207 cbtrk_tuple->write();
208 return;
209}
210
211
213
214 cetrk_run = eventHeader.runNumber();
215 cetrk_event = eventHeader.eventNumber();
216 cetrk_tofid = recETof->mod();
217 cetrk_qual = recETof->qual();
218 cetrk_texp = recETof->tpred(1);
219 cetrk_tdc = recETof->tdc();
220 cetrk_adc = recETof->adc();
221 cetrk_rhit = recETof->rHit();
222 cetrk_drhit = recETof->drHit();
223 // cetrk_sintheta = recETof->sinTheta();
224 cetrk_p = recETof->p();
225 cetrk_q = recETof->Q();
226 cetrk_path = recETof->path();
227 cetrk_tuple->write();
228 return;
229}
230
231
232void TofCheckData::FillCol(Event::EventHeader& eventHeader, RecTofTrackCol& recTofTrackCol, RecMdcKalTrackCol& kalTrackCol) {
233 RecTofTrackCol::iterator iter_tof = recTofTrackCol.begin();
234 for( ; iter_tof!=recTofTrackCol.end(); iter_tof++ ) {
235 RecMdcKalTrackCol::iterator iter_kal = kalTrackCol.begin();
236 for( ; iter_kal!=kalTrackCol.end(); iter_kal++ ) {
237 if( (*iter_tof)->trackID() == (*iter_kal)->trackId() ) break;
238 }
239 Fill( eventHeader, *iter_tof, *iter_kal, iter_kal!=kalTrackCol.end() );
240 }
241 return;
242}
243
244void TofCheckData::FillCol(Event::EventHeader& eventHeader, RecBTofCalHitCol& recBTofCalHitCol) {
245 RecBTofCalHitCol::iterator iter_btof = recBTofCalHitCol.begin();
246 for( ; iter_btof!=recBTofCalHitCol.end(); iter_btof++ ) {
247 Fill( eventHeader, *iter_btof );
248 }
249 return;
250}
251
252void TofCheckData::FillCol(Event::EventHeader& eventHeader, RecETofCalHitCol& recETofCalHitCol) {
253 RecETofCalHitCol::iterator iter_etof = recETofCalHitCol.begin();
254 for( ; iter_etof!=recETofCalHitCol.end(); iter_etof++ ) {
255 Fill( eventHeader, *iter_etof );
256 }
257 return;
258}
double abs(const EvtComplex &c)
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:58
double toffsetProton() const
Definition DstTofTrack.h:65
int trackID() const
Definition DstTofTrack.h:41
double texpKaon() const
Definition DstTofTrack.h:57
unsigned int status() const
Definition DstTofTrack.h:44
double t0() const
Definition DstTofTrack.h:78
double texpElectron() const
Definition DstTofTrack.h:54
double path() const
Definition DstTofTrack.h:46
double errenergy() const
Definition DstTofTrack.h:85
double tof() const
Definition DstTofTrack.h:49
double errtof() const
Definition DstTofTrack.h:50
double sigmaMuon() const
Definition DstTofTrack.h:70
double toffsetMuon() const
Definition DstTofTrack.h:62
int quality() const
Definition DstTofTrack.h:76
double errt0() const
Definition DstTofTrack.h:79
double sigmaElectron() const
Definition DstTofTrack.h:69
double phi() const
Definition DstTofTrack.h:82
double energy() const
Definition DstTofTrack.h:84
double toffsetElectron() const
Definition DstTofTrack.h:61
double ph() const
Definition DstTofTrack.h:48
int tofID() const
Definition DstTofTrack.h:42
double toffsetKaon() const
Definition DstTofTrack.h:64
double texpPion() const
Definition DstTofTrack.h:56
double beta() const
Definition DstTofTrack.h:51
double zrhit() const
Definition DstTofTrack.h:47
double errz() const
Definition DstTofTrack.h:81
double texpMuon() const
Definition DstTofTrack.h:55
double sigmaPion() const
Definition DstTofTrack.h:71
double toffsetPion() const
Definition DstTofTrack.h:63
double sigmaKaon() const
Definition DstTofTrack.h:72
double errphi() const
Definition DstTofTrack.h:83
double sigmaProton() const
Definition DstTofTrack.h:73
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
TofCheckData(NTuple::Tuple *&trk, NTuple::Tuple *&cbtrk, NTuple::Tuple *&cetrk)
void FillCol(Event::EventHeader &, RecTofTrackCol &, RecMdcKalTrackCol &)
void Fill(Event::EventHeader &, RecTofTrack *&, RecMdcKalTrack *&, bool)
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_counter() const
bool is_east() const
bool is_readout() const
unsigned int neast() const
bool is_raw() const