BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEvent.cxx
Go to the documentation of this file.
1//
2// BesEvent.cxx
3//
4
5#include <TGeoHelix.h>
6#include <TMath.h>
7#include <TGeoTube.h>
8#include <iostream>
9
10#include "BesVisLib/BesEvent.h"
14#include "Identifier/MdcID.h"
15#include "Identifier/TofID.h"
16#include "Identifier/EmcID.h"
17#include "Identifier/MucID.h"
18
20
21using namespace std;
22
23#ifndef __CINT__
25#endif
26
27//__________________________________________________________
28// BesEvent
29// BesVis Event
30//
31//
32BesEvent::BesEvent() : TObject() {
33 //
34 // BesEvent default constructor
35
36 // Init
37 f_Magnetic = 1.0;
38
39 fMdcTrackCol = new TObjArray();
40 fTofTrackCol = new TObjArray();
41 fEmcTrackCol = new TObjArray();
42 fMucTrackCol = new TObjArray();
43 fExtTrackCol = new TObjArray();
44}
45
46//__________________________________________________________
47
49 //
50 // BesEvent default destructor
51
52 // Delete all array elements
53 Delete();
54}
55
56//__________________________________________________________
57
58void BesEvent::Delete(Option_t *option) {
59 //
60 // Clear event
61 TString opt = option;
62 opt.ToUpper();
63
64 if (fMdcTrackCol) {
65 for (int j = 0; j < fMdcTrackCol->GetEntries(); j++){
66 delete fMdcTrackCol->At(j);
67 }
68 fMdcTrackCol->Clear("C");
69 delete fMdcTrackCol;
70 }
71 if (fTofTrackCol) {
72 for (int j = 0; j < fTofTrackCol->GetEntries(); j++){
73 delete fTofTrackCol->At(j);
74 }
75 fTofTrackCol->Clear("C");
76 delete fTofTrackCol;
77 }
78 if (fEmcTrackCol) {
79 for (int j = 0; j < fEmcTrackCol->GetEntries(); j++){
80 delete fEmcTrackCol->At(j);
81 }
82 fEmcTrackCol->Clear("C");
83 delete fEmcTrackCol;
84 }
85 if (fMucTrackCol) {
86 for (int j = 0; j < fMucTrackCol->GetEntries(); j++){
87 delete fMucTrackCol->At(j);
88 }
89 fMucTrackCol->Clear("C");
90 delete fMucTrackCol;
91 }
92 if (fExtTrackCol) {
93 for (int j = 0; j < fExtTrackCol->GetEntries(); j++){
94 delete fExtTrackCol->At(j);
95 }
96 fExtTrackCol->Clear("C");
97 delete fExtTrackCol;
98 }
99}
100
101//__________________________________________________________
102
103void BesEvent::Clear(Option_t *option) {
104 //
105 // Clear event
106 TString opt = option;
107 opt.ToUpper();
108
109 fDigiEvent->Clear("C");
110}
111
112//__________________________________________________________
113//Long Peixun's update: add parameter "isRec"
114void BesEvent::SetEvent(TDigiEvent *digiEvent, TDisTrack *recEvent, TEvtHeader *evtHeader, TRecEvTime *recEvTime, Bool_t isRec)
115{
116 //fDigiEvent = 0;
117 fDigiEvent = digiEvent;
118 fEvtHeader = evtHeader;
119 fRecEvTime = recEvTime;
120 //fTrigEvent = trigEvt;
121 fTrigEvent = 0;
122 // ========================================
123 // set trig information
124 // ========================================
125 if (fTrigEvent != 0){
126 vector<Int_t> trigConditionVector;
127 vector<Int_t> trigChannelVector;
128
129 const TTrigData* trigData = fTrigEvent->getTrigData();
130 const Int_t timeType = trigData->getTimingType();
131 //std::cout << "BesEvent::timing type: " << timeType << std::endl;
132 Int_t trigCondition;
133 Int_t trigChannel;
134 for (Int_t i = 0; i < 48; i++){
135 trigCondition = trigData->getTrigCondition(i);
136 if (trigCondition) trigConditionVector.push_back(i);
137 //std::cout << "BesEvent::trig condition: " << trigCondition << std::endl;
138 }
139 for (Int_t i = 0; i < 16; i++){
140 trigChannel = trigData->getTrigChannel(i);
141 if (trigChannel) trigChannelVector.push_back(i);
142 //std::cout << "BesEvent::trigChannel: " << trigChannel << std::endl;
143 }
144 fEventHeader.SetEventTrig(timeType, trigConditionVector, trigChannelVector);
145 }
146 else {
147 std::cout << "fTrigEvent does not exit!" << std::endl;
148 }
149 // ========================================
150 // set time information
151 // ========================================
152 if (fEvtHeader != 0){
153 time_t now;
154 //now = time(NULL);
155 now = (time_t)evtHeader->time();
156 //char str_time[256];
157 //sprintf(str_time, ctime(&now));
158 //cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
159 //cout << "time now: " << str_time << endl;
160 //cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
161
162 struct tm *local_time;
163 local_time = localtime(&now);
164 //cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
165 //cout << "time now sec: " << local_time->tm_sec << endl;
166 //cout << "time now min: " << local_time->tm_min << endl;
167 //cout << "time now hour: "<< local_time->tm_hour << endl;
168 //cout << "time now day: " << local_time->tm_mday << endl;
169 //cout << "time now mon: " << local_time->tm_mon << endl;
170 //cout << "time now year: "<< local_time->tm_year << endl;
171 //cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
172
173 Int_t time1 = (1900 + local_time->tm_year) * 10000 + (1 + local_time->tm_mon) * 100
174 + local_time->tm_mday;
175 Int_t time2 = local_time->tm_hour * 10000 + local_time->tm_min * 100
176 + local_time->tm_sec;
177
178 fEventHeader.SetEventHeaderGeneral(fEvtHeader->getRunId(),
179 fEvtHeader->getEventId(), time1, time2);
180 }
181 else {
182 cout << "fEvtHeader does not exit" << endl;
183 }
184
185 // ========================================
186 // set event start time information
187 // ========================================
188 //Long Peixun's update: if this event is not a rec event, don't show estime, status and quality
189 if (fRecEvTime != 0)
190 {
191 fEventHeader.SetEventRec(isRec);
192 if (isRec)
193 fEventHeader.SetEventEvTime(fRecEvTime->estime(),fRecEvTime->status(),fRecEvTime->quality());
194 else
195 fEventHeader.SetEventEvTime(0.0, 0, 0.0);
196 }
197 else
198 {
199 cout << "fRecEvTime does not exit" << endl;
200 fEventHeader.SetEventRec(false);
201 fEventHeader.SetEventEvTime(0.0, 0, 0.0);
202 }
203
204 // ========================================
205 // set Mdc information
206 // ========================================
207 Double_t p = 0.0, pt = 0.0, px = 0.0, py = 0.0, pz = 0.0;
208 for (Int_t i = 0; i < GetMdcTrackNum(recEvent); i++) {
209 p += GetMdcTrack(i,recEvent)->p();
210 pt += GetMdcTrack(i,recEvent)->pxy();
211 px += GetMdcTrack(i,recEvent)->px();
212 py += GetMdcTrack(i,recEvent)->py();
213 pz += GetMdcTrack(i,recEvent)->pz();
214 }
215 fEventHeader.SetEventMdc(p, pt, px, py, pz);
216
217 // ========================================
218 // set Emc information
219 // ========================================
220 Double_t t = 9999.0;
221 Double_t e = 0.0;
222 for (Int_t i = 0; i < GetEmcShowerNum(recEvent); i++) {
223 e += GetEmcShower(i,recEvent)->energy();
224 }
225 fEventHeader.SetEventEmc(e);
226 // ========================================
227 // set digi and rec
228 // ========================================
229 if (fDigiEvent != 0){
230 SetHits();
231 fEventHeader.SetEventMC(fDigiEvent->getFromMc());
232 }
233 if (recEvent != 0)
234 SetTracks(recEvent);
235}
236
237//__________________________________________________________
238
240 if (gBesGeometry) {
245 }
246}
247
248//__________________________________________________________
249
251 if (gBesGeometry)
252 {
253 //Long Peixun's update: Add judging detector geometry code
254 SetMdcTracks(recEvent);
255 SetTofTracks(recEvent);
256 SetEmcShowers(recEvent);
257 SetMucTracks(recEvent);
258 SetExtTracks(recEvent);
259 }
260}
261
262//__________________________________________________________
263
265 if (fMdcTrackCol){
266 for (int j = 0; j < fMdcTrackCol->GetEntries(); j++){
267 delete fMdcTrackCol->At(j);
268 }
269 fMdcTrackCol->Clear("C");
270 }
271 int mdc_no = recEvent->getMdcTrackNum();
272 for (Int_t i = 0; i < mdc_no; i++) {
273 const TRecMdcTrack* recTrack =recEvent->getRecMdcTrack(i);
274 BesGeoTrack *mdcTrack = new BesGeoTrack();
275 mdcTrack->SetTrackType(0);
276
277 ConstructMdcTrackFromRec(mdcTrack, recTrack,recEvent);
278 fMdcTrackCol->Add(mdcTrack);
279 }
280}
281
282//__________________________________________________________
283
285 if (fTofTrackCol) {
286 for (int j = 0; j < fTofTrackCol->GetEntries(); j++){
287 delete fTofTrackCol->At(j);
288 }
289 fTofTrackCol->Clear("C");
290 }
291 int tof_no = recEvent->getTofTrackNum();
292
293 for (Int_t i = 0; i < tof_no; i++) {
294 const TRecTofTrack* recTrack = recEvent->getTofTrack(i);
295 if ( !Is_tofCounter( recTrack->status())) continue;
296 BesGeoTrack *tofTrack = new BesGeoTrack();
297 tofTrack->SetTrackType(1);
298
299 ConstructTofTrackFromRec(tofTrack, recTrack,recEvent);
300 fTofTrackCol->Add(tofTrack);
301 }
302}
303
304//__________________________________________________________
305
307 if (fEmcTrackCol) {
308 for (int j = 0; j < fEmcTrackCol->GetEntries(); j++){
309 delete fEmcTrackCol->At(j);
310 }
311 fEmcTrackCol->Clear("C");
312 }
313 int emc_no = recEvent->getEmcShowerNum();
314
315 for (Int_t i = 0; i < emc_no; i++) {
316 const TRecEmcShower* recShower =recEvent->getEmcShower(i);
317 BesGeoTrack *emcTrack = new BesGeoTrack();
318 emcTrack->SetTrackType(2);
319
320 ConstructEmcTrackFromRec(emcTrack, recShower);
321 fEmcTrackCol->Add(emcTrack);
322 }
323}
324
325//__________________________________________________________
326
328 if (fMucTrackCol) {
329 for (int j = 0; j < fMucTrackCol->GetEntries(); j++){
330 delete fMucTrackCol->At(j);
331 }
332 fMucTrackCol->Clear("C");
333 }
334 int muc_no = recEvent->getMucTrackNum();
335 for (Int_t i = 0; i < muc_no; i++) {
336 const TRecMucTrack* recTrack =recEvent->getMucTrack(i);
337 BesGeoTrack *mucTrack = new BesGeoTrack();
338 mucTrack->SetTrackType(3);
339
340 ConstructMucTrackFromRec(mucTrack, recTrack);
341 fMucTrackCol->Add(mucTrack);
342 }
343}
344
345//__________________________________________________________
346
348 //if (fExtTrackCol) fExtTrackCol->Clear("C");
349
350 //for (Int_t i = 0; i < GetExtTrackNum(); i++) {
351 // const TExtTrack* recTrack = GetExtTrack(i);
352 // BesGeoTrack *extTrack = new BesGeoTrack();
353 // extTrack->SetTrackType(4);
354
355 // ConstructExtTrackFromRec(extTrack, recTrack);
356 // fExtTrackCol->Add(extTrack);
357 //}
358}
359
360//__________________________________________________________
361
362void BesEvent::ConstructMdcTrackFromRec(BesGeoTrack *mdcTrack, const TRecMdcTrack *recTrack,TDisTrack *fRecEvent) {
363
364 Double_t field = -f_Magnetic; // Tesla
365 Double_t kvC = 3.0e8; // light speed
366 Int_t charge = recTrack->charge();
367 Double_t pt = recTrack->pxy(); // GeV
368 Double_t pz = recTrack->pz(); // GeV
369 Double_t pi = TMath::Pi();
370
371 // unit is "cm"
372 Double_t orgx = recTrack->x()*10;
373 Double_t orgy = recTrack->y()*10;
374 Double_t orgz = recTrack->z()*10;
375
376 Double_t mdcR = ((TGeoTube*)gBesGeometry->GetMdcROOTGeo()->GetVolumeMdc()->GetShape())->GetRmax();
377 Double_t mdcZ = ((TGeoTube*)gBesGeometry->GetMdcROOTGeo()->GetVolumeMdc()->GetShape())->GetDz();
378
379 Double_t radius,zStep;
380 if (charge == 0) {
381 radius = 1e9 ; // cosmic ray test
382 zStep = 1e9;
383 }
384 else {
385 radius = (pt * 1.0e9 / kvC * 1e3) / fabs(charge * field) ;
386 zStep = 2*pi*radius * fabs(pz/pt);
387 }
388 Double_t curvature = 1.0/radius;
389 Double_t step = 10.0; // mm
390 Double_t delt = step*(1.0e-3)/kvC;
391
392 mdcTrack->AddPoint(orgx, orgy, orgz, 0.0);
393 const Double_t *p;
394 Int_t nStep = 0;
395
396 Double_t x,y,z,t;
397 x = orgx;
398 y = orgy;
399 z = orgz;
400
401 if (charge == 0){ //cosmic ray test
402 do {
403 x = recTrack->helix(0)* 10 *
404 cos(recTrack->helix(1))
405 - nStep * step * sin(recTrack->helix(1));
406 y = recTrack->helix(0)* 10 *
407 sin(recTrack->helix(1))
408 + nStep * step * cos(recTrack->helix(1));
409 z = recTrack->helix(3)* 10 +
410 nStep * step * recTrack->helix(4);
411
412 mdcTrack->AddPoint(x, y, z, delt*nStep);
413 Double_t mp[3];
414 mp[0] = 0;
415 mp[1] = 0;
416 mp[2] = 0;
417 mdcTrack->PaintMarker(mp);
418 mdcTrack->SetMarkerColor(kBlack);
419 mdcTrack->SetMarkerSize(10);
420 mdcTrack->SetLineColor(kBlack);
421
422 nStep++;
423 }
424 while ( (x*x + y*y) < mdcR*mdcR && fabs(z) < mdcZ );
425
426 nStep = 0;
427 do {
428 x = recTrack->helix(0)* 10 *
429 cos(recTrack->helix(1))
430 - nStep * step * sin(recTrack->helix(1));
431 y = recTrack->helix(0)* 10 *
432 sin(recTrack->helix(1))
433 + nStep * step * cos(recTrack->helix(1));
434 z = recTrack->helix(3)* 10 +
435 nStep * step * recTrack->helix(4);
436
437 mdcTrack->AddPoint(x, y, z, delt*nStep);
438 Double_t mp[3];
439 mp[0] = 0;
440 mp[1] = 0;
441 mp[2] = 0;
442 mdcTrack->PaintMarker(mp);
443 mdcTrack->SetMarkerColor(kBlack);
444 mdcTrack->SetMarkerSize(10);
445 mdcTrack->SetLineColor(kRed);
446
447 }
448 while ( (x*x + y*y) < mdcR*mdcR && fabs(z) < mdcZ );
449 }
450 else{ //normal track
451 TGeoHelix helix(curvature, zStep, charge);
452 helix.InitPoint(orgx, orgy, orgz);
453
454 helix.InitDirection(recTrack->px(), recTrack->py(), recTrack->pz(), kFALSE);
455 //helix.InitDirection(1000, 10, 10, kFALSE);
456 helix.SetField(0.0, 0.0, field, kFALSE);
457
458 do {
459 // helix Step before GetCurrentPoint, or first point will be wrong
460 helix.Step(step);
461 p = helix.GetCurrentPoint();
462
463 mdcTrack->AddPoint(p[0], p[1], p[2], delt*nStep);
464 Double_t mp[3];
465 mp[0] = p[0];
466 mp[1] = p[1];
467 mp[2] = p[2];
468 mdcTrack->PaintMarker(mp);
469 mdcTrack->SetMarkerColor(kBlack);
470 mdcTrack->SetMarkerSize(10);
471 nStep++;
472 }
473 while ( (p[0]*p[0] + p[1]*p[1]) < mdcR*mdcR && fabs(p[2]) < mdcZ );
474
475 }
476
477 // Add associated mdc hits
478 vector<UInt_t> vecHits(0);
479 const TObjArray *recMdcHitCol = fRecEvent->getRecMdcHitCol();
480 for (Int_t i = 0; i < recMdcHitCol->GetEntriesFast(); i++){
481 TRecMdcHit *recMdcHit = (TRecMdcHit*)recMdcHitCol->At(i);
482 Int_t recHitId = recMdcHit->getTrkId();
483 Int_t recTrkId = recTrack->trackId();
484 if (recHitId == recTrkId) vecHits.push_back(recMdcHit->getMdcId());
485 }
486 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
487 Identifier aMdcID( vecHits[i] );
488 int layer = MdcID::layer( aMdcID );
489 int wire = MdcID::wire( aMdcID );
490
491 Mdc2DWire* aHit = gBesGeometry->GetMdcROOTGeo()->Get2DWire(layer, wire);
492 mdcTrack->AddHit( aHit );
493 //Long Peixun's update: for Mdc 3D track display
494 TGeoPhysicalNode* pHit = gBesGeometry->GetMdcROOTGeo()->GetPhysicalReplica(layer, wire);
495 mdcTrack->Add3DHit(pHit);
496 }
497
498 mdcTrack->SetCharge(recTrack->charge());
499
500 // Add mdc track info
501 char data[200]; //Long Peixun's update: 100 -> 200
502 TString info;
503
504 info = TString("MdcTrack ");
505 info += recTrack->trackId();
506 mdcTrack->AddInfo( info );
507
508 sprintf(data, "charge=%i, status=%i", recTrack->charge(), recTrack->stat());
509 mdcTrack->AddInfo( TString(data) );
510
511 sprintf(data, "P=%-.3f GeV, Pt=%-.3f GeV", recTrack->p(), recTrack->pxy());
512 mdcTrack->AddInfo( TString(data) );
513
514 //sprintf(data, "Pt= %-.3f GeV", recTrack->pxy());
515 //mdcTrack->AddInfo( TString(data) );
516
517 sprintf(data, "Pxyz=(%-.3f,%-.3f,%-.3f) GeV", recTrack->px(),recTrack->py(),recTrack->pz());
518 mdcTrack->AddInfo( TString(data) );
519
520 sprintf(data, "helix(%-.3f,%-.3f,%-.3f,%-.3f,%-.3f)", recTrack->helix(0),recTrack->helix(1),recTrack->helix(2),recTrack->helix(3), recTrack->helix(4));
521 mdcTrack->AddInfo( TString(data) );
522
523 sprintf(data, "Origin (%-.3f, %-.3f, %-.3f) cm", orgx/10, orgy/10, orgz/10); //recTrack->x(), recTrack->y(), recTrack->z());
524 mdcTrack->AddInfo( TString(data) );
525
526 sprintf(data, "#phi=%-.3f #theta=%-.3f cos#theta=%-.3f", recTrack->phi(),recTrack->theta(),cos(recTrack->theta()));
527 mdcTrack->AddInfo( TString(data) );
528
529
530 sprintf(data, "nHit=%i, #chi^{2}= %-.3f",recTrack->ndof()+5, recTrack->chi2());
531 mdcTrack->AddInfo( TString(data) );
532
533 // sprintf(data, "ndof= %i, rms= %-.3f", recTrack->ndof(), recTrack->rms());
534 // mdcTrack->AddInfo( TString(data) );
535
536 // sprintf(data, "extrp= %-.3f, pathL= %-.3f", recTrack->extrp(), recTrack->pathLength());
537 // mdcTrack->AddInfo( TString(data) );
538
539 //sprintf(data, "nHits= %i, nSter= %i", recTrack->getNhits(), recTrack->nster());
540 //mdcTrack->AddInfo( TString(data) ); //Long Peixun's update: this line should be annotated
541
542 mdcTrack->CloseInfo();
543}
544
545//__________________________________________________________
546
547//void BesEvent::ConstructTofTrackFromRec(BesGeoTrack *tofTrack, const TRecETofTrack *recETrack){
548//
549// // Add associated tof hits
550// //vector<Int_t> vecBHits = recTrack->vecBHits();
551// //vector<Int_t> vecEHits = recTrack->vecEHits();
552// //vector<Int_t> vecHits;
553// //for (Int_t i = 0; i < (Int_t)vecBHits.size(); i++)
554// // vecHits.push_back( vecBHits[i] );
555// //for (Int_t i = 0; i < (Int_t)vecEHits.size(); i++)
556// // vecHits.push_back( vecEHits[i] );
557//
558// vector<Int_t> vecHits(0);
559// const TObjArray *recETofTrackCol = fRecEvent->getETofTrackCol();
560// for (Int_t i = 0; i < recETofTrackCol->GetEntriesFast(); i++){
561// TRecETofTrack *recHit = (TRecETofTrack*)recETofTrackCol->At(i);
562// if ( !Is_tofCounter( recHit->status())) continue;
563//
564// Int_t recHitId = recHit->trackID();
565// Int_t recTrkId = recETrack->trackID();
566// if (recHitId == recTrkId) vecHits.push_back(recHit->tofID());
567// }
568//
569// TGeoPhysicalNode *phyNode = 0;
570// Double_t x=0.0, y=0.0, z=0.0;
571// Int_t nHits = vecHits.size();
572// for (Int_t i = 0; i < nHits; i++) {
573// Identifier aTofID( vecHits[i] );
574//
575// int part;
576// if (recETrack->tofID() < 48) part = 0;
577// else part = 2;
578//
579// int layer = TofID::layer( aTofID );
580// int scin = TofID::phi_module( aTofID );
581//
582// Tof2DScin* aHit = gBesGeometry->GetTofROOTGeo()->Get2DScin(part, layer, scin);
583// tofTrack->AddHit( aHit );
584//
585// // calculate average position
586// Double_t local[3] = {0.0, 0.0, 0.0};
587// Double_t master[3] = {0.0, 0.0, 0.0};
588// phyNode = gBesGeometry->GetTofROOTGeo()->GetPhysicalScin(part, layer, scin);
589// if (phyNode)
590// phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
591// // transform to top
592// x += master[0];
593// y += master[1];
594// z += master[2];
595// }
596// x /= nHits;
597// y /= nHits;
598// z /= nHits;
599//
600// //if (recTrack->getPart() == 1) {
601// // z = 0.5*(recTrack->getZHit1() + recTrack->getZHit2());
602// //}
603// //else {
604// Double_t curR = TMath::Sqrt(x*x+y*y);
605// Double_t newR = recETrack->zrhit();
606// if (curR != 0.0) {
607// x = x * (newR/curR);
608// y = y * (newR/curR);
609// }
610//
611//
612// tofTrack->SetMarker(x, y, z);
613//
614// // Add tof track info
615// char data[100];
616// TString info;
617//
618// info = TString("TofTrack ");
619// info += recETrack->trackID();
620// tofTrack->AddInfo(info);
621//
622// //sprintf(data, "Part = %i, Qual1 = %i, Qual2 = %i", recTrack->getPart(), recTrack->getQual1(), recTrack->getQual2());
623// //tofTrack->AddInfo( TString(data) );
624//
625// //sprintf(data, "Tof = (%-.3f #pm %-.3f) ns", recTrack->getTof(), recTrack->getETof());
626// //tofTrack->AddInfo( TString(data) );
627//
628// //sprintf(data, "Tof1 = (%-.3f #pm %-.3f) ns", recTrack->getTof1(), recTrack->getETof1());
629// //tofTrack->AddInfo( TString(data) );
630//
631// //sprintf(data, "Tof2 = (%-.3f #pm %-.3f) ns", recTrack->getTof2(), recTrack->getETof2());
632// //tofTrack->AddInfo( TString(data) );
633//
634// //sprintf(data, "Path(1=%-.2f, 2=%-.2f) mm", recTrack->getPath1(), recTrack->getPath2());
635// //tofTrack->AddInfo( TString(data) );
636//
637// //sprintf(data, "Pulse(1=%-.0f, 2=%-.0f)", recTrack->getPh1(), recTrack->getPh2());
638// //tofTrack->AddInfo( TString(data) );
639//
640// //sprintf(data, "ZHit(1=%-.2fmm, 2=%-.2f)mm", recTrack->getZHit1(), recTrack->getZHit2());
641// //tofTrack->AddInfo( TString(data) );
642//
643// ////sprintf(data, "ZTDC1=%-.2fmm, ZTDC2=%-.2fmm", recTrack->getZTDC1(), recTrack->getZTDC2());
644// ////tofTrack->AddInfo( TString(data) );
645//
646// //sprintf(data, "RHit = %-.3f, Beta = %-.3f", recTrack->getRHit(), recTrack->getBeta());
647// //tofTrack->AddInfo( TString(data) );
648//
649// //sprintf(data, "w_e = %-.2f%%, w_mu = %-.2f%%", recTrack->getWeightElectron()*100.0, recTrack->getWeightMuon()*100.0);
650// //tofTrack->AddInfo( TString(data) );
651//
652// //sprintf(data, "w_pi = %-.2f%%, w_K = %-.2f%%", recTrack->getWeightPion()*100.0, recTrack->getWeightKaon()*100.0);
653// //tofTrack->AddInfo( TString(data) );
654//
655// //sprintf(data, "w_P = %-.2f%%", recTrack->getWeightProton()*100.0);
656// //tofTrack->AddInfo( TString(data) );
657//
658// tofTrack->CloseInfo();
659//}
660
661
662//__________________________________________________________
664 const TRecTofTrack *recTrack,
665 TDisTrack *fRecEvent){
666
667 vector<Int_t> vecBHits(0);
668 vector<Int_t> vecEHits(0);
669
670 const TObjArray *recTofTrackCol = fRecEvent->getTofTrackCol();
671 for (Int_t i = 0; i < recTofTrackCol->GetEntriesFast(); i++){
672 TRecTofTrack *recHit = (TRecTofTrack*)recTofTrackCol->At(i);
673 if ( !Is_tofCounter( recHit->status())) continue;
674
675 Int_t recHitId = recHit->trackID();
676 Int_t recTrkId = recTrack->trackID();
677 if (recHitId == recTrkId) {
678 if ( Is_tofBarrel( recHit->status() ) ) {
679 vecBHits.push_back(recHit->tofID());
680 }
681 else {
682 vecEHits.push_back(recHit->tofID());
683 }
684 }
685 }
686
687 TGeoPhysicalNode *phyNode = 0;
688 Double_t x=0.0, y=0.0, z=0.0;
689
690 Int_t nHits;
691 if (vecBHits.size()){
692 nHits = vecBHits.size();
693 for (Int_t i = 0; i < nHits; i++) {
694
695 int part = 1;
696 int layer = 0;
697 int scin = 0;
698 if ( ( vecBHits[i] >= 0 ) && ( vecBHits[i] <= 87 ) ) {
699 layer = 0;
700 scin = vecBHits[i];
701 }
702 else {
703 layer = 1;
704 scin = vecBHits[i] - 88;
705 }
706
707 Tof2DScin* aHit = gBesGeometry->GetTofROOTGeo()->Get2DScin(part, layer, scin);
708 tofTrack->AddHit( aHit );
709
710 // calculate average position
711 Double_t local[3] = {0.0, 0.0, 0.0};
712 Double_t master[3] = {0.0, 0.0, 0.0};
713 phyNode = gBesGeometry->GetTofROOTGeo()->GetPhysicalScin(part, layer, scin);
714 tofTrack->Add3DHit(phyNode); //Long Peixun's update: for Tof 3D track display
715 if (phyNode)
716 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
717 // transform to top
718 x += master[0];
719 y += master[1];
720 z += master[2];
721 }
722 x /= nHits;
723 y /= nHits;
724 z /= nHits;
725
726 z = recTrack->zrhit();
727
728 tofTrack->SetMarker(x, y, z);
729 }
730
731 else if (vecEHits.size()){
732 nHits = vecEHits.size();
733 for (Int_t i = 0; i < nHits; i++) {
734
735 int part = 0;
736 int layer = 0;
737 int scin = 0;
738 if ( ( vecEHits[i] >= 0 ) && ( vecEHits[i] <= 47 ) ) {
739 part = 2;
740 scin = vecEHits[i];
741 }
742 else {
743 part = 0;
744 scin = vecEHits[i] - 48;
745 }
746
747
748 Tof2DScin* aHit = gBesGeometry->GetTofROOTGeo()->Get2DScin(part, layer, scin);
749 tofTrack->AddHit( aHit );
750
751 // calculate average position
752 Double_t local[3] = {0.0, 0.0, 0.0};
753 Double_t master[3] = {0.0, 0.0, 0.0};
754 phyNode = gBesGeometry->GetTofROOTGeo()->GetPhysicalScin(part, layer, scin);
755 tofTrack->Add3DHit(phyNode); //Long Peixun's update: for Tof 3D track display
756 if (phyNode)
757 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
758 // transform to top
759 x += master[0];
760 y += master[1];
761 z += master[2];
762 }
763 x /= nHits;
764 y /= nHits;
765 z /= nHits;
766
767 tofTrack->SetMarker(x, y, z);
768 }
769
770 // Add tof track info
771 char data[100];
772 TString info;
773
774 info = TString("TofTrack ");
775 info += recTrack->trackID();
776 tofTrack->AddInfo(info);
777
778 //sprintf(data, "Part = %i, Qual1 = %i, Qual2 = %i", recTrack->getPart(), recTrack->getQual1(), recTrack->getQual2());
779 //tofTrack->AddInfo( TString(data) );
780
781 //sprintf(data, "Tof = (%-.3f #pm %-.3f) ns", recTrack->getTof(), recTrack->getETof());
782 //tofTrack->AddInfo( TString(data) );
783
784 //sprintf(data, "Tof1 = (%-.3f #pm %-.3f) ns", recTrack->getTof1(), recTrack->getETof1());
785 //tofTrack->AddInfo( TString(data) );
786
787 //sprintf(data, "Tof2 = (%-.3f #pm %-.3f) ns", recTrack->getTof2(), recTrack->getETof2());
788 //tofTrack->AddInfo( TString(data) );
789
790 //sprintf(data, "Path(1=%-.2f, 2=%-.2f) mm", recTrack->getPath1(), recTrack->getPath2());
791 //tofTrack->AddInfo( TString(data) );
792
793 //sprintf(data, "Pulse(1=%-.0f, 2=%-.0f)", recTrack->getPh1(), recTrack->getPh2());
794 //tofTrack->AddInfo( TString(data) );
795
796 //sprintf(data, "ZHit(1=%-.2fmm, 2=%-.2f)mm", recTrack->getZHit1(), recTrack->getZHit2());
797 //tofTrack->AddInfo( TString(data) );
798
799 ////sprintf(data, "ZTDC1=%-.2fmm, ZTDC2=%-.2fmm", recTrack->getZTDC1(), recTrack->getZTDC2());
800 ////tofTrack->AddInfo( TString(data) );
801
802 //sprintf(data, "RHit = %-.3f, Beta = %-.3f", recTrack->getRHit(), recTrack->getBeta());
803 //tofTrack->AddInfo( TString(data) );
804
805 //sprintf(data, "w_e = %-.2f%%, w_mu = %-.2f%%", recTrack->getWeightElectron()*100.0, recTrack->getWeightMuon()*100.0);
806 //tofTrack->AddInfo( TString(data) );
807
808 //sprintf(data, "w_pi = %-.2f%%, w_K = %-.2f%%", recTrack->getWeightPion()*100.0, recTrack->getWeightKaon()*100.0);
809 //tofTrack->AddInfo( TString(data) );
810
811 //sprintf(data, "w_P = %-.2f%%", recTrack->getWeightProton()*100.0);
812 //tofTrack->AddInfo( TString(data) );
813
814 tofTrack->CloseInfo();
815}
816
818
819 Double_t x=0.0, y=0.0, z=0.0;
820 x = recTrack->x() * 10.0;
821 y = recTrack->y() * 10.0;
822 z = recTrack->z() * 10.0;
823
824 emcTrack->SetMarker(x, y, z);
825 // Add associated emc hits
826 vector<Int_t> vecHits(0);
827 map<Int_t, Double_t> cellMap = recTrack->cellIdMap();
828 map<Int_t, Double_t>::iterator iCellMap;
829 for (iCellMap = cellMap.begin(); iCellMap != cellMap.end(); iCellMap++){
830 Int_t cellId = iCellMap->first;
831 vecHits.push_back(cellId);
832 }
833 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
834 Identifier aEmcID( vecHits[i] );
835 int part = EmcID::barrel_ec( aEmcID );
836 int theta = EmcID::theta_module( aEmcID );
837 int phi = EmcID::phi_module( aEmcID );
838 if (part == 1) theta = 43-theta; // 43 = m_kThetaBr-1
839
840 Emc2DCrystal* aHit = gBesGeometry->GetEmcROOTGeo()->Get2DCrystal(part, phi, theta);
841 emcTrack->AddHit( aHit );
842 //Long Peixun's update: for Emc 3D track display
843 TGeoPhysicalNode* pHit = gBesGeometry->GetEmcROOTGeo()->GetPhysicalCrystal(part, phi, theta);
844 emcTrack->Add3DHit(pHit);
845 }
846
847 // Add Emc track info
848 char data[100];
849 TString info;
850
851 info = TString("EmcShower ");
852 info += recTrack->trackId();
853 emcTrack->AddInfo(info);
854
855 sprintf(data, "nHits = %i, status = %i", recTrack->numHits(), recTrack->status());
856 emcTrack->AddInfo( TString(data) );
857
858 sprintf(data, "energy= (%.2f #pm %-.2f) MeV", recTrack->energy()*1000.0, recTrack->dE()*1000.0);
859 emcTrack->AddInfo( TString(data) );
860
861 Identifier aEmcID( recTrack->cellId() );
862 int part = EmcID::barrel_ec( aEmcID );
863 int theta = EmcID::theta_module( aEmcID );
864 int phi = EmcID::phi_module( aEmcID );
865
866 sprintf(data, "cell Id= (%i, #theta %i, #phi %i)", part, theta, phi);
867 emcTrack->AddInfo( TString(data) );
868
869 sprintf(data, "module = %i", recTrack->module());
870 emcTrack->AddInfo( TString(data) );
871
872 //sprintf(data, "x = (%-.3f #pm %-.3f) mm", x, recTrack->dx());
873 //emcTrack->AddInfo( TString(data) );
874
875 //sprintf(data, "y = (%-.3f #pm %-.3f) mm", y, recTrack->dy());
876 //emcTrack->AddInfo( TString(data) );
877
878 //sprintf(data, "z = (%-.3f #pm %-.3f) mm", z, recTrack->dz());
879 //emcTrack->AddInfo( TString(data) );
880
881 sprintf(data, "#theta = (%-.3f #pm %-.3f)", recTrack->theta(), recTrack->dtheta());
882 emcTrack->AddInfo( TString(data) );
883
884 sprintf(data, "#phi = (%-.3f #pm %-.3f)", recTrack->phi(), recTrack->dphi());
885 emcTrack->AddInfo( TString(data) );
886
887// sprintf(data, "cos (x=%-.3f, y=%-.3f, z=%-.3f)", recTrack->cosx(), recTrack->cosy(), recTrack->cosz()); //from boss6.1.0. no these varibles
888// emcTrack->AddInfo( TString(data) );
889
890 emcTrack->CloseInfo();
891}
892
893//__________________________________________________________
894
896 if (recTrack->depth() <= 0.0) return; // bad track
897
898 Double_t field = 1e-3; // Tesla
899 Double_t kvC = 3.0e8; // light speed
900 Int_t charge = 1;
901 Double_t pz = recTrack->pz(); // GeV
902 Double_t pt =
903 sqrt(recTrack->px()*recTrack->px() + recTrack->py()*recTrack->py()); // GeV
904 Double_t pi = TMath::Pi();
905
906 Double_t mucR =
907 ((TGeoBBox*)gBesGeometry->GetMucROOTGeo()->GetVolumeMuc()->GetShape())->GetDX();
908 Double_t mucZ =
909 ((TGeoBBox*)gBesGeometry->GetMucROOTGeo()->GetVolumeMuc()->GetShape())->GetDZ();
910
911 Double_t radius = 1.0e+9;
912 Double_t curvature = 1.0/radius;
913 Double_t zStep = 2*pi*radius * fabs(pz/pt);
914 Double_t step = 1.0; // mm
915 Double_t delt = step*(1.0e-3)/kvC;
916
917 TGeoHelix helix(curvature, zStep, charge);
918
919 Double_t x = recTrack->xPos() * 10.0;
920 Double_t y = recTrack->yPos() * 10.0;
921 Double_t z = recTrack->zPos() * 10.0;
922
923 helix.InitPoint(x, y, z);
924 helix.InitDirection(recTrack->px(), recTrack->py(), recTrack->pz(), kFALSE);
925 helix.SetField(0.0, 0.0, field, kFALSE);
926
927 mucTrack->AddPoint(x, y, z, 0.0);
928 const Double_t *p;
929 Int_t nStep = 0;
930 do {
931 // helix Step before GetCurrentPoint, or first point will be wrong
932 helix.Step(step);
933 p = helix.GetCurrentPoint();
934 mucTrack->AddPoint(p[0], p[1], p[2], delt*nStep);
935 Double_t mp[3];
936 mp[0] = p[0];
937 mp[1] = p[1];
938 mp[2] = p[2];
939 mucTrack->PaintMarker(mp);
940 mucTrack->SetMarkerColor(kBlack);
941 mucTrack->SetMarkerSize(10);
942 nStep++;
943 }
944 while ( (p[0]*p[0] + p[1]*p[1]) < mucR*mucR && fabs(p[2]) < mucZ );
945
946 // Add associated muc hits
947 vector<Int_t> vecHits = recTrack->vecHits();
948 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
949 Identifier aMucID( vecHits[i] );
950 int part = MucID::part( aMucID );
951 int seg = MucID::seg( aMucID );
952 int gap = MucID::gap( aMucID );
953 int strip = MucID::strip( aMucID );
954
955 Muc2DStrip* aHit = gBesGeometry->GetMucROOTGeo()->Get2DStrip(part, seg, gap, strip);
956 mucTrack->AddHit( aHit );
957 //Long Peixun's update: for Muc 3D track display
958 TGeoPhysicalNode* pHit = gBesGeometry->GetMucROOTGeo()->GetPhysicalStrip(part, seg, gap, strip);
959 mucTrack->Add3DHit(pHit);
960 }
961
962 mucTrack->SetCharge(charge);
963
964 // Add Muc track info
965 char data[100];
966 TString info;
967
968 info = TString("MucTrack ");
969 info += recTrack->trackId();
970 mucTrack->AddInfo(info);
971
972 sprintf(data, "nHits= %i, maxHits= %i, nLayers= %i", recTrack->numHits(), recTrack->maxHitsInLayer(), recTrack->numLayers());
973 mucTrack->AddInfo( TString(data) );
974
975 sprintf(data, "lastLayer (br= %i, ec= %i)", recTrack->brLastLayer(), recTrack->ecLastLayer());
976 mucTrack->AddInfo( TString(data) );
977
978 sprintf(data, "depth = %.3f cm", recTrack->depth());
979 mucTrack->AddInfo( TString(data) );
980
981 sprintf(data, "#chi^{2}= %-.3f, dof= %i, rms= %-.3f", recTrack->chi2(), recTrack->dof(), recTrack->rms());
982 mucTrack->AddInfo( TString(data) );
983
984 sprintf(data, "Origin (%-.2f, %-.2f, %-.2f) cm", recTrack->xPos(), recTrack->yPos(), recTrack->zPos());
985 mucTrack->AddInfo( TString(data) );
986
987 sprintf(data, "p (%-.3f, %-.3f, %-.3f) GeV", recTrack->px(), recTrack->py(), recTrack->pz());
988 mucTrack->AddInfo( TString(data) );
989
990 mucTrack->CloseInfo();
991}
992
993//__________________________________________________________
994
995//void BesEvent::ConstructExtTrackFromRec(BesGeoTrack *extTrack, const TExtTrack *recTrack) {
996//
997// extTrack->AddPoint(recTrack->GetTof1PositionX(),
998// recTrack->GetTof1PositionY(),
999// recTrack->GetTof1PositionZ(),
1000// 0.0);
1001// extTrack->AddPoint(recTrack->GetTof2PositionX(),
1002// recTrack->GetTof2PositionY(),
1003// recTrack->GetTof2PositionZ(),
1004// 0.1);
1005// extTrack->AddPoint(recTrack->GetEmcPositionX(),
1006// recTrack->GetEmcPositionY(),
1007// recTrack->GetEmcPositionZ(),
1008// 0.2);
1009// extTrack->AddPoint(recTrack->GetMucPositionX(),
1010// recTrack->GetMucPositionY(),
1011// recTrack->GetMucPositionZ(),
1012// 0.3);
1013//
1014// // Add Ext track info
1015// char data[100];
1016// TString info;
1017//
1018// info = TString("ExtTrack ");
1019// info += recTrack->GetTrackId();
1020// extTrack->AddInfo(info);
1021//
1022// sprintf(data, "Tof1 pos (%-.2f, %-.2f, %-.2f) mm",
1023// recTrack->GetTof1PositionX(), recTrack->GetTof1PositionY(), recTrack->GetTof1PositionZ());
1024// extTrack->AddInfo( TString(data) );
1025//
1026// sprintf(data, "Tof2 pos (%-.2f, %-.2f, %-.2f) mm",
1027// recTrack->GetTof2PositionX(), recTrack->GetTof2PositionY(), recTrack->GetTof2PositionZ());
1028// extTrack->AddInfo( TString(data) );
1029//
1030// sprintf(data, "Emc pos (%-.2f, %-.2f, %-.2f) mm",
1031// recTrack->GetEmcPositionX(), recTrack->GetEmcPositionY(), recTrack->GetEmcPositionZ());
1032// extTrack->AddInfo( TString(data) );
1033//
1034// sprintf(data, "Muc pos (%-.2f, %-.2f, %-.2f) mm",
1035// recTrack->GetMucPositionX(), recTrack->GetMucPositionY(), recTrack->GetMucPositionZ());
1036// extTrack->AddInfo( TString(data) );
1037//
1038// sprintf(data, "Tof1 p (%-.3f, %-.3f, %-.3f) GeV",
1039// recTrack->GetTof1MomentumX()/1000.0, recTrack->GetTof1MomentumY()/1000.0, recTrack->GetTof1MomentumZ()/1000.0);
1040// extTrack->AddInfo( TString(data) );
1041//
1042// sprintf(data, "Tof2 p (%-.3f, %-.3f, %-.3f) GeV",
1043// recTrack->GetTof2MomentumX()/1000.0, recTrack->GetTof2MomentumY()/1000.0, recTrack->GetTof2MomentumZ()/1000.0);
1044// extTrack->AddInfo( TString(data) );
1045//
1046// sprintf(data, "Emc p (%-.3f, %-.3f, %-.3f) GeV",
1047// recTrack->GetEmcMomentumX()/1000.0, recTrack->GetEmcMomentumY()/1000.0, recTrack->GetEmcMomentumZ()/1000.0);
1048// extTrack->AddInfo( TString(data) );
1049//
1050// sprintf(data, "Muc p (%-.3f, %-.3f, %-.3f) GeV",
1051// recTrack->GetMucMomentumX()/1000.0, recTrack->GetMucMomentumY()/1000.0, recTrack->GetMucMomentumZ()/1000.0);
1052// extTrack->AddInfo( TString(data) );
1053//
1054// extTrack->CloseInfo();
1055//}
1056
1057
1058//__________________________________________________________
1059
1060void BesEvent::DrawHits(Option_t *option) {
1061 if (gBesGeometry)
1062 {
1067 }
1068}
1069
1070//__________________________________________________________
1071
1072void BesEvent::DrawTracks(Option_t *option) {
1073
1074 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
1075
1076 //Long Peixun's update: Always construct 3D line, whether draw it or not
1077 if (view)
1078 {
1079 for (Int_t i = 0; i < fMdcTrackCol->GetEntries(); i++)
1080 {
1081 BesGeoTrack *track = (BesGeoTrack*)fMdcTrackCol->At(i);
1082 if (view->GetVisTracksGlobal() && view->GetVisTracksMdc())
1083 track->Draw();
1084 else track->Construct3DLine();
1085 }
1086
1087 for (Int_t i = 0; i < fTofTrackCol->GetEntries(); i++)
1088 {
1089 BesGeoTrack *track = (BesGeoTrack*)fTofTrackCol->At(i);
1090 if (view->GetVisTracksGlobal() && view->GetVisTracksTof())
1091 track->Draw();
1092 else track->Construct3DLine();
1093 }
1094
1095 for (Int_t i = 0; i < fEmcTrackCol->GetEntries(); i++)
1096 {
1097 BesGeoTrack *track = (BesGeoTrack*)fEmcTrackCol->At(i);
1098 if (view->GetVisTracksGlobal() && view->GetVisTracksEmc())
1099 track->Draw();
1100 else track->Construct3DLine();
1101 }
1102
1103 for (Int_t i = 0; i < fMucTrackCol->GetEntries(); i++)
1104 {
1105 BesGeoTrack *track = (BesGeoTrack*)fMucTrackCol->At(i);
1106 if (view->GetVisTracksGlobal() && view->GetVisTracksMuc())
1107 track->Draw();
1108 else track->Construct3DLine();
1109 }
1110
1111 for (Int_t i = 0; i < fExtTrackCol->GetEntries(); i++)
1112 {
1113 BesGeoTrack *track = (BesGeoTrack*)fExtTrackCol->At(i);
1114 if (view->GetVisTracksGlobal() && view->GetVisTracksExt())
1115 track->Draw();
1116 else track->Construct3DLine();
1117 }
1118 }
1119}
1120
1121//__________________________________________________________
1122
1123void BesEvent::Print(Option_t *option) {
1124 //
1125 // Print event information
1126 //
1127 // Options available:
1128 // '' - quiet, i.e. only numbers of hits and tracks etc. (default)
1129 // 'ALL' - very detailed output (might be hundreds of lines!)
1130 // 'Digi' - only Digi information
1131 // 'Dst' - only Dst information
1132 //
1133 TString opt = option;
1134 opt.ToUpper();
1135 Int_t i;
1136
1137 //cout << endl
1138 // << "==========================================================" << endl
1139 // << "Run: " << GetRun() << endl
1140 // << "Event: " << GetEvent() << endl
1141 // << "----------------------------------------------------------" << endl
1142 // << "Mdc digis: " << GetMdcDigiNum() << endl
1143 // << "Tof digis: " << GetTofDigiNum() << endl
1144 // << "Emc digis: " << GetEmcDigiNum() << endl
1145 // << "Muc digis: " << GetMucDigiNum() << endl
1146 // << "Mdc tracks: " << GetMdcTrackNum() << endl
1147 // << "Tof tracks: " << "debug++++++" /*GetTofTrackNum()*/ << endl
1148 // << "Emc tracks: " << GetEmcShowerNum() << endl
1149 // << "Muc tracks: " << GetMucTrackNum() << endl
1150 // << "Ext tracks: " << GetExtTrackNum() << endl
1151 // << "Dedx : " << GetDedxNum() << endl
1152 // << "----------------------------------------------------------" << endl;
1153
1154 if ( opt.Contains("ALL") || opt.Contains("Digi") ) {
1155 for ( i = 0; i < GetMdcDigiNum(); i++ ) GetMdcDigi(i)->Print();
1156 for ( i = 0; i < GetTofDigiNum(); i++ ) GetTofDigi(i)->Print();
1157 for ( i = 0; i < GetEmcDigiNum(); i++ ) GetEmcDigi(i)->Print();
1158 for ( i = 0; i < GetMucDigiNum(); i++ ) GetMucDigi(i)->Print();
1159 }
1160
1161 /* if ( opt.Contains("ALL") || opt.Contains("Dst") ) {
1162 for ( i = 0; i < GetMdcTrackNum(); i++ ) GetMdcTrack(i)->Print();
1163 // Tof -> BTof ETof
1164 //for ( i = 0; i < GetTofTrackNum(); i++ ) GetTofTrack(i)->Print();
1165 for ( i = 0; i < GetEmcShowerNum(); i++ ) GetEmcShower(i)->Print();
1166 for ( i = 0; i < GetMucTrackNum(); i++ ) GetMucTrack(i)->Print();
1167 cout << "wait for TRecExtEvent, BesEvent" << endl;
1168 //for ( i = 0; i < GetExtTrackNum(); i++ ) GetExtTrack(i)->Print();
1169 for ( i = 0; i < GetDedxNum(); i++ ) GetDedx(i)->Print();
1170 }
1171 */
1172 //cout << "=========================================================="
1173 //<< endl << endl;
1174}
1175
1176bool BesEvent::Is_tofCounter(UInt_t status){
1177 const unsigned int Counter_Mask = 0x00000004;
1178 const unsigned int Counter_Index = 2;
1179 return ((status & Counter_Mask) >> Counter_Index) ? true: false;
1180}
1181
1182bool BesEvent::Is_tofBarrel(UInt_t status) {
1183 const unsigned int Barrel_Index = 4;
1184 const unsigned int Barrel_Mask = 0x00000010;
1185 return ((status & Barrel_Mask) >> Barrel_Index ) ? true : false;
1186}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
BesEvent * gEvent
Definition: BesEvent.cxx:19
ClassImp(BesEvent) BesEvent
Definition: BesEvent.cxx:24
R__EXTERN BesGeometry * gBesGeometry
Definition: BesGeometry.h:108
const double kvC
TTree * t
Definition: binning.cxx:23
virtual void SetEventTrig(Int_t timeType, vector< Int_t > &trigConditionVector, vector< Int_t > &trigChannelVector)
virtual void SetEventMdc(Double_t p, Double_t pt, Double_t px, Double_t py, Double_t pz)
virtual void SetEventHeaderGeneral(Long64_t run, Long64_t event, Int_t time1, Int_t time2)
virtual void SetEventRec(Bool_t rec)
virtual void SetEventEvTime(Double_t time, Int_t status, Double_t quality)
virtual void SetEventEmc(Double_t e)
virtual void SetEventMC(Bool_t mc)
virtual void Delete(Option_t *option="")
Definition: BesEvent.cxx:58
virtual void SetHits()
Definition: BesEvent.cxx:239
virtual ~BesEvent()
Definition: BesEvent.cxx:48
const Int_t GetMucDigiNum() const
Definition: BesEvent.h:98
virtual void Clear(Option_t *option="")
Definition: BesEvent.cxx:103
const Int_t GetTofDigiNum() const
Definition: BesEvent.h:90
virtual void ConstructTofTrackFromRec(BesGeoTrack *tofTrack, const TRecTofTrack *recTrack, TDisTrack *recEvent)
Definition: BesEvent.cxx:663
virtual void SetTofTracks(TDisTrack *recEvent)
Definition: BesEvent.cxx:284
const TTofDigi * GetTofDigi(Int_t i) const
Definition: BesEvent.h:106
const TRecMdcTrack * GetMdcTrack(Int_t i, TDisTrack *recEvent) const
Definition: BesEvent.h:204
const Int_t GetMdcTrackNum(TDisTrack *recEvent) const
Definition: BesEvent.h:159
virtual void ConstructEmcTrackFromRec(BesGeoTrack *emcTrack, const TRecEmcShower *recTrack)
Definition: BesEvent.cxx:817
virtual void Print(Option_t *option="")
Definition: BesEvent.cxx:1123
const Int_t GetMdcDigiNum() const
Definition: BesEvent.h:86
virtual void SetMucTracks(TDisTrack *recEvent)
Definition: BesEvent.cxx:327
virtual void SetMdcTracks(TDisTrack *recEvent)
Definition: BesEvent.cxx:264
virtual void SetEmcShowers(TDisTrack *recEvent)
Definition: BesEvent.cxx:306
const Int_t GetEmcShowerNum(TDisTrack *recEvent) const
Definition: BesEvent.h:178
const TMucDigi * GetMucDigi(Int_t i) const
Definition: BesEvent.h:114
const TRecEmcShower * GetEmcShower(Int_t i, TDisTrack *recEvent) const
Definition: BesEvent.h:220
const Int_t GetEmcDigiNum() const
Definition: BesEvent.h:94
virtual void ConstructMucTrackFromRec(BesGeoTrack *mucTrack, const TRecMucTrack *recTrack)
Definition: BesEvent.cxx:895
const TMdcDigi * GetMdcDigi(Int_t i) const
Definition: BesEvent.h:102
virtual void SetEvent(TDigiEvent *digiEvent, TDisTrack *recEvent, TEvtHeader *evtHeader, TRecEvTime *recEvTime, Bool_t isRec)
Definition: BesEvent.cxx:114
const TEmcDigi * GetEmcDigi(Int_t i) const
Definition: BesEvent.h:110
virtual void ConstructMdcTrackFromRec(BesGeoTrack *mdcTrack, const TRecMdcTrack *recTrack, TDisTrack *recEvent)
Definition: BesEvent.cxx:362
virtual void DrawHits(Option_t *option)
Definition: BesEvent.cxx:1060
virtual void DrawTracks(Option_t *option)
Definition: BesEvent.cxx:1072
virtual void SetTracks(TDisTrack *recEvent)
Definition: BesEvent.cxx:250
virtual void SetExtTracks(TDisTrack *recEvent)
Definition: BesEvent.cxx:347
virtual void CloseInfo()
Definition: BesGeoTrack.cxx:54
virtual void SetTrackType(Int_t type)
Definition: BesGeoTrack.h:26
virtual void Draw(Option_t *option="")
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)
Definition: BesGeoTrack.cxx:63
virtual void Construct3DLine()
virtual void SetMarker(Double_t x, Double_t y, Double_t z)
Definition: BesGeoTrack.cxx:68
virtual void AddInfo(TString info)
Definition: BesGeoTrack.h:23
virtual void AddHit(TObject *obj)
Definition: BesGeoTrack.h:21
virtual void Add3DHit(TObject *obj)
Definition: BesGeoTrack.h:22
virtual void SetCharge(Int_t charge)
EmcROOTGeo * GetEmcROOTGeo()
Definition: BesGeometry.h:45
MdcROOTGeo * GetMdcROOTGeo()
Definition: BesGeometry.h:43
MucROOTGeo * GetMucROOTGeo()
Definition: BesGeometry.h:46
TofROOTGeo * GetTofROOTGeo()
Definition: BesGeometry.h:44
Bool_t GetVisTracksExt()
Definition: BesView.h:240
Bool_t GetVisTracksGlobal()
Definition: BesView.h:235
Bool_t GetVisTracksMuc()
Definition: BesView.h:239
Bool_t GetVisTracksTof()
Definition: BesView.h:237
Bool_t GetVisTracksEmc()
Definition: BesView.h:238
Bool_t GetVisTracksMdc()
Definition: BesView.h:236
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: EmcID.cxx:38
static unsigned int theta_module(const Identifier &id)
Definition: EmcID.cxx:43
static unsigned int phi_module(const Identifier &id)
Definition: EmcID.cxx:48
Emc2DCrystal * Get2DCrystal(Int_t part, Int_t phi, Int_t theta)
Get Emc2DCrystal;.
TGeoPhysicalNode * GetPhysicalCrystal(int part, int phi, int theta)
Get crystal physical node;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition: MdcID.cxx:49
static int wire(const Identifier &id)
Definition: MdcID.cxx:54
Mdc2DWire * Get2DWire(Int_t layer, Int_t replica)
Get Mdc2DWire;.
TGeoPhysicalNode * GetPhysicalReplica(int layer, int replica)
Get replica physical node;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
static int part(const Identifier &id)
Definition: MucID.cxx:46
static int gap(const Identifier &id)
Definition: MucID.cxx:66
static int seg(const Identifier &id)
Definition: MucID.cxx:56
static int strip(const Identifier &id)
Definition: MucID.cxx:76
TGeoPhysicalNode * GetPhysicalStrip(int part, int seg, int gap, int strip)
Get strip physical node;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
Muc2DStrip * Get2DStrip(int part, int seg, int gap, int strip)
Get Muc2DStrip;.
void Clear(Option_t *option="")
Definition: TDigiEvent.cxx:83
Bool_t getFromMc()
Definition: TDigiEvent.h:27
const TRecTofTrack * getTofTrack(Int_t i) const
retrieve a TofTrack From the collection, using the index into the array
Definition: TDisTrack.cxx:134
const TRecMucTrack * getMucTrack(Int_t i) const
retrieve a MucTrack From the collection, using the index into the array
Definition: TDisTrack.cxx:145
const TObjArray * getRecMdcHitCol() const
retrieve the whole TObjArray of RecMdcHit Data
Definition: TDisTrack.h:43
const TRecEmcShower * getEmcShower(Int_t i) const
retrieve a EmcShower from the collection, using the index into the array
Definition: TDisTrack.cxx:157
int getMdcTrackNum()
Definition: TDisTrack.cxx:163
const TObjArray * getTofTrackCol() const
retrieve the whole TObjArray of TofTrack Data
Definition: TDisTrack.h:52
int getMucTrackNum()
Definition: TDisTrack.cxx:193
int getEmcShowerNum()
Definition: TDisTrack.cxx:183
int getTofTrackNum()
Definition: TDisTrack.cxx:173
const TRecMdcTrack * getRecMdcTrack(Int_t i) const
retrieve a MdcTrack from the collection, using the index into the array
Definition: TDisTrack.cxx:113
Int_t getEventId()
Access the TEvtHeader number.
Definition: TEvtHeader.h:23
UInt_t time() const
Definition: TEvtHeader.h:28
Int_t getRunId()
Access the run number.
Definition: TEvtHeader.h:26
void Print(Option_t *option="") const
Definition: TRawData.cxx:25
Int_t module() const
Definition: TRecEmcShower.h:27
Double_t phi() const
Definition: TRecEmcShower.h:33
Double_t z() const
Definition: TRecEmcShower.h:30
Double_t dtheta() const
Definition: TRecEmcShower.h:32
Double_t dphi() const
Definition: TRecEmcShower.h:34
Int_t cellId() const
Definition: TRecEmcShower.h:26
map< Int_t, Double_t > cellIdMap() const
Definition: TRecEmcShower.h:49
Double_t theta() const
Definition: TRecEmcShower.h:31
Double_t x() const
Definition: TRecEmcShower.h:28
Int_t status() const
Definition: TRecEmcShower.h:25
Double_t dE() const
Definition: TRecEmcShower.h:36
Double_t energy() const
Definition: TRecEmcShower.h:35
Double_t y() const
Definition: TRecEmcShower.h:29
Int_t trackId() const
Definition: TRecEmcShower.h:23
Int_t numHits() const
Definition: TRecEmcShower.h:24
Double_t estime() const
Definition: TRecEvTime.h:26
Int_t status() const
Definition: TRecEvTime.h:25
Double_t quality() const
Definition: TRecEvTime.h:27
const UInt_t getMdcId() const
Definition: TRecMdcHit.h:29
const Int_t getTrkId(void) const
Definition: TRecMdcHit.h:21
const Double_t x() const
const Double_t phi() const
const Double_t pz() const
const Double_t z() const
const Double_t p() const
const Double_t px() const
const Double_t chi2() const
Definition: TRecMdcTrack.h:32
const Int_t trackId() const
Definition: TRecMdcTrack.h:17
const Double_t y() const
const Int_t stat() const
Definition: TRecMdcTrack.h:31
const Double_t pxy() const
const Int_t ndof() const
Definition: TRecMdcTrack.h:33
const Double_t theta() const
const Int_t charge() const
const Double_t py() const
const Double_t helix(Int_t i) const
Definition: TRecMdcTrack.h:18
Int_t brLastLayer() const
Definition: TRecMucTrack.h:30
Double_t yPos() const
Definition: TRecMucTrack.h:44
Double_t zPos() const
Definition: TRecMucTrack.h:45
Int_t trackId() const
Definition: TRecMucTrack.h:23
Int_t numLayers() const
Definition: TRecMucTrack.h:33
vector< Int_t > vecHits() const
Definition: TRecMucTrack.h:55
Double_t chi2() const
Definition: TRecMucTrack.h:37
Double_t xPos() const
Definition: TRecMucTrack.h:43
Double_t rms() const
Definition: TRecMucTrack.h:39
Int_t numHits() const
Definition: TRecMucTrack.h:32
Int_t maxHitsInLayer() const
Definition: TRecMucTrack.h:34
Double_t depth() const
Definition: TRecMucTrack.h:36
Int_t ecLastLayer() const
Definition: TRecMucTrack.h:31
Double_t pz() const
Definition: TRecMucTrack.h:53
Int_t dof() const
Definition: TRecMucTrack.h:38
Double_t px() const
Definition: TRecMucTrack.h:51
Double_t py() const
Definition: TRecMucTrack.h:52
Int_t tofID() const
Definition: TRecTofTrack.h:18
Int_t trackID() const
Definition: TRecTofTrack.h:17
Double_t zrhit() const
Definition: TRecTofTrack.h:23
UInt_t status() const
Definition: TRecTofTrack.h:20
const int getTrigChannel(int i) const
Definition: TTrigData.h:31
const int getTrigCondition(int i) const
Definition: TTrigData.h:29
const int getTimingType() const
Definition: TTrigData.h:34
const TTrigData * getTrigData() const
Definition: TTrigEvent.cxx:50
void SetHits()
Set all physicalNodes corresponding to digiCol;.
Tof2DScin * Get2DScin(Int_t part, Int_t layer, Int_t scin)
Get Tof2DScin;.
TGeoPhysicalNode * GetPhysicalScin(int part, int scin)
Get scintillator physical node;.
double y[1000]
double x[1000]
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
const double mp
Definition: incllambda.cxx:45
float charge
const float pi
Definition: vector3.h:133