38 fMdcTrackCol =
new TObjArray();
39 fTofTrackCol =
new TObjArray();
40 fEmcTrackCol =
new TObjArray();
41 fMucTrackCol =
new TObjArray();
42 fExtTrackCol =
new TObjArray();
64 for (
int j = 0; j < fMdcTrackCol->GetEntries(); j++){
65 delete fMdcTrackCol->At(j);
67 fMdcTrackCol->Clear(
"C");
71 for (
int j = 0; j < fTofTrackCol->GetEntries(); j++){
72 delete fTofTrackCol->At(j);
74 fTofTrackCol->Clear(
"C");
78 for (
int j = 0; j < fEmcTrackCol->GetEntries(); j++){
79 delete fEmcTrackCol->At(j);
81 fEmcTrackCol->Clear(
"C");
85 for (
int j = 0; j < fMucTrackCol->GetEntries(); j++){
86 delete fMucTrackCol->At(j);
88 fMucTrackCol->Clear(
"C");
92 for (
int j = 0; j < fExtTrackCol->GetEntries(); j++){
93 delete fExtTrackCol->At(j);
95 fExtTrackCol->Clear(
"C");
105 TString opt = option;
108 fDigiEvent->
Clear(
"C");
115 fDigiEvent = digiEvent;
116 fEvtHeader = evtHeader;
117 fRecEvTime = recEvTime;
123 if (fTrigEvent != 0){
124 vector<Int_t> trigConditionVector;
125 vector<Int_t> trigChannelVector;
132 for (Int_t i = 0; i < 48; i++){
134 if (trigCondition) trigConditionVector.push_back(i);
137 for (Int_t i = 0; i < 16; i++){
139 if (trigChannel) trigChannelVector.push_back(i);
142 fEventHeader.
SetEventTrig(timeType, trigConditionVector, trigChannelVector);
145 std::cout <<
"fTrigEvent does not exit!" << std::endl;
150 if (fEvtHeader != 0){
153 now = (time_t)evtHeader->
time();
160 struct tm *local_time;
161 local_time = localtime(&now);
171 Int_t time1 = (1900 + local_time->tm_year) * 10000 + (1 + local_time->tm_mon) * 100
172 + local_time->tm_mday;
173 Int_t time2 = local_time->tm_hour * 10000 + local_time->tm_min * 100
174 + local_time->tm_sec;
180 cout <<
"fEvtHeader does not exit" << endl;
185 if (fRecEvTime != 0){
188 cout <<
"fRecEvTime does not exit" << endl;
194 Double_t p = 0.0, pt = 0.0, px = 0.0, py = 0.0, pz = 0.0;
216 if (fDigiEvent != 0){
250 for (
int j = 0; j < fMdcTrackCol->GetEntries(); j++){
251 delete fMdcTrackCol->At(j);
253 fMdcTrackCol->Clear(
"C");
256 for (Int_t i = 0; i < mdc_no; i++) {
262 fMdcTrackCol->Add(mdcTrack);
270 for (
int j = 0; j < fTofTrackCol->GetEntries(); j++){
271 delete fTofTrackCol->At(j);
273 fTofTrackCol->Clear(
"C");
277 for (Int_t i = 0; i < tof_no; i++) {
279 if ( !Is_tofCounter( recTrack->
status()))
continue;
284 fTofTrackCol->Add(tofTrack);
292 for (
int j = 0; j < fEmcTrackCol->GetEntries(); j++){
293 delete fEmcTrackCol->At(j);
295 fEmcTrackCol->Clear(
"C");
299 for (Int_t i = 0; i < emc_no; i++) {
305 fEmcTrackCol->Add(emcTrack);
313 for (
int j = 0; j < fMucTrackCol->GetEntries(); j++){
314 delete fMucTrackCol->At(j);
316 fMucTrackCol->Clear(
"C");
319 for (Int_t i = 0; i < muc_no; i++) {
325 fMucTrackCol->Add(mucTrack);
348 Double_t field = -f_Magnetic;
349 Double_t
kvC = 3.0e8;
350 Int_t charge = recTrack->
charge();
351 Double_t pt = recTrack->
pxy();
352 Double_t pz = recTrack->
pz();
353 Double_t
pi = TMath::Pi();
356 Double_t orgx = recTrack->
x()*10;
357 Double_t orgy = recTrack->
y()*10;
358 Double_t orgz = recTrack->
z()*10;
364 Double_t radius,zStep;
370 radius = (pt * 1.0e9 /
kvC * 1e3) / fabs(charge * field) ;
371 zStep = 2*
pi*radius * fabs(pz/pt);
373 Double_t curvature = 1.0/radius;
374 Double_t step = 10.0;
375 Double_t delt = step*(1.0e-3)/
kvC;
377 mdcTrack->
AddPoint(orgx, orgy, orgz, 0.0);
388 x = recTrack->
helix(0)* 10 *
390 - nStep * step *
sin(recTrack->
helix(1));
391 y = recTrack->
helix(0)* 10 *
393 + nStep * step *
cos(recTrack->
helix(1));
394 z = recTrack->
helix(3)* 10 +
395 nStep * step * recTrack->
helix(4);
402 mdcTrack->PaintMarker(
mp);
403 mdcTrack->SetMarkerColor(kBlack);
404 mdcTrack->SetMarkerSize(10);
405 mdcTrack->SetLineColor(kBlack);
409 while ( (
x*
x + y*y) < mdcR*mdcR && fabs(z) < mdcZ );
413 x = recTrack->
helix(0)* 10 *
415 - nStep * step *
sin(recTrack->
helix(1));
416 y = recTrack->
helix(0)* 10 *
418 + nStep * step *
cos(recTrack->
helix(1));
419 z = recTrack->
helix(3)* 10 +
420 nStep * step * recTrack->
helix(4);
427 mdcTrack->PaintMarker(
mp);
428 mdcTrack->SetMarkerColor(kBlack);
429 mdcTrack->SetMarkerSize(10);
430 mdcTrack->SetLineColor(kRed);
433 while ( (
x*
x + y*y) < mdcR*mdcR && fabs(z) < mdcZ );
436 TGeoHelix helix(curvature, zStep, charge);
437 helix.InitPoint(orgx, orgy, orgz);
439 helix.InitDirection(recTrack->
px(), recTrack->
py(), recTrack->
pz(), kFALSE);
441 helix.SetField(0.0, 0.0, field, kFALSE);
446 p = helix.GetCurrentPoint();
448 mdcTrack->
AddPoint(p[0], p[1], p[2], delt*nStep);
453 mdcTrack->PaintMarker(
mp);
454 mdcTrack->SetMarkerColor(kBlack);
455 mdcTrack->SetMarkerSize(10);
458 while ( (p[0]*p[0] + p[1]*p[1]) < mdcR*mdcR && fabs(p[2]) < mdcZ );
463 vector<UInt_t> vecHits(0);
465 for (Int_t i = 0; i < recMdcHitCol->GetEntriesFast(); i++){
467 Int_t recHitId = recMdcHit->
getTrkId();
468 Int_t recTrkId = recTrack->
trackId();
469 if (recHitId == recTrkId) vecHits.push_back(recMdcHit->
getMdcId());
471 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
486 info = TString(
"MdcTrack ");
490 sprintf(
data,
"charge=%i, status=%i", recTrack->
charge(), recTrack->
stat());
493 sprintf(
data,
"P=%-.3f GeV, Pt=%-.3f GeV", recTrack->
p(), recTrack->
pxy());
499 sprintf(
data,
"Pxyz=(%-.3f,%-.3f,%-.3f) GeV", recTrack->
px(),recTrack->
py(),recTrack->
pz());
502 sprintf(
data,
"helix(%-.3f,%-.3f,%-.3f,%-.3f,%-.3f)", recTrack->
helix(0),recTrack->
helix(1),recTrack->
helix(2),recTrack->
helix(3), recTrack->
helix(4));
505 sprintf(
data,
"Origin (%-.3f, %-.3f, %-.3f) cm", orgx/10, orgy/10, orgz/10);
508 sprintf(
data,
"#phi=%-.3f #theta=%-.3f cos#theta=%-.3f", recTrack->
phi(),recTrack->
theta(),
cos(recTrack->
theta()));
512 sprintf(
data,
"nHit=%i, #chi^{2}= %-.3f",recTrack->
ndof()+5, recTrack->
chi2());
649 vector<Int_t> vecBHits(0);
650 vector<Int_t> vecEHits(0);
653 for (Int_t i = 0; i < recTofTrackCol->GetEntriesFast(); i++){
655 if ( !Is_tofCounter( recHit->
status()))
continue;
657 Int_t recHitId = recHit->
trackID();
658 Int_t recTrkId = recTrack->
trackID();
659 if (recHitId == recTrkId) {
660 if ( Is_tofBarrel( recHit->
status() ) ) {
661 vecBHits.push_back(recHit->
tofID());
664 vecEHits.push_back(recHit->
tofID());
669 TGeoPhysicalNode *phyNode = 0;
670 Double_t
x=0.0, y=0.0, z=0.0;
673 if (vecBHits.size()){
674 nHits = vecBHits.size();
675 for (Int_t i = 0; i < nHits; i++) {
680 if ( ( vecBHits[i] >= 0 ) && ( vecBHits[i] <= 87 ) ) {
686 scin = vecBHits[i] - 88;
693 Double_t local[3] = {0.0, 0.0, 0.0};
694 Double_t master[3] = {0.0, 0.0, 0.0};
697 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
707 z = recTrack->
zrhit();
712 else if (vecEHits.size()){
713 nHits = vecEHits.size();
714 for (Int_t i = 0; i < nHits; i++) {
719 if ( ( vecEHits[i] >= 0 ) && ( vecEHits[i] <= 47 ) ) {
725 scin = vecEHits[i] - 48;
733 Double_t local[3] = {0.0, 0.0, 0.0};
734 Double_t master[3] = {0.0, 0.0, 0.0};
737 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
754 info = TString(
"TofTrack ");
799 Double_t
x=0.0, y=0.0, z=0.0;
800 x = recTrack->
x() * 10.0;
801 y = recTrack->
y() * 10.0;
802 z = recTrack->
z() * 10.0;
806 vector<Int_t> vecHits(0);
807 map<Int_t, Double_t> cellMap = recTrack->
cellIdMap();
808 map<Int_t, Double_t>::iterator iCellMap;
809 for (iCellMap = cellMap.begin(); iCellMap != cellMap.end(); iCellMap++){
810 Int_t cellId = iCellMap->first;
811 vecHits.push_back(cellId);
813 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
818 if (part == 1) theta = 43-theta;
828 info = TString(
"EmcShower ");
832 sprintf(
data,
"nHits = %i, status = %i", recTrack->
numHits(), recTrack->
status());
835 sprintf(
data,
"energy= (%.2f #pm %-.2f) MeV", recTrack->
energy()*1000.0, recTrack->
dE()*1000.0);
843 sprintf(
data,
"cell Id= (%i, #theta %i, #phi %i)", part, theta, phi);
846 sprintf(
data,
"module = %i", recTrack->
module());
858 sprintf(
data,
"#theta = (%-.3f #pm %-.3f)", recTrack->
theta(), recTrack->
dtheta());
861 sprintf(
data,
"#phi = (%-.3f #pm %-.3f)", recTrack->
phi(), recTrack->
dphi());
873 if (recTrack->
depth() <= 0.0)
return;
875 Double_t field = 1e-3;
876 Double_t
kvC = 3.0e8;
878 Double_t pz = recTrack->
pz();
880 sqrt(recTrack->
px()*recTrack->
px() + recTrack->
py()*recTrack->
py());
881 Double_t
pi = TMath::Pi();
888 Double_t radius = 1.0e+9;
889 Double_t curvature = 1.0/radius;
890 Double_t zStep = 2*
pi*radius * fabs(pz/pt);
892 Double_t delt = step*(1.0e-3)/
kvC;
894 TGeoHelix helix(curvature, zStep, charge);
896 Double_t
x = recTrack->
xPos() * 10.0;
897 Double_t y = recTrack->
yPos() * 10.0;
898 Double_t z = recTrack->
zPos() * 10.0;
900 helix.InitPoint(
x, y, z);
901 helix.InitDirection(recTrack->
px(), recTrack->
py(), recTrack->
pz(), kFALSE);
902 helix.SetField(0.0, 0.0, field, kFALSE);
910 p = helix.GetCurrentPoint();
911 mucTrack->
AddPoint(p[0], p[1], p[2], delt*nStep);
916 mucTrack->PaintMarker(
mp);
917 mucTrack->SetMarkerColor(kBlack);
918 mucTrack->SetMarkerSize(10);
921 while ( (p[0]*p[0] + p[1]*p[1]) < mucR*mucR && fabs(p[2]) < mucZ );
924 vector<Int_t> vecHits = recTrack->
vecHits();
925 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
942 info = TString(
"MucTrack ");
952 sprintf(
data,
"depth = %.3f cm", recTrack->
depth());
955 sprintf(
data,
"#chi^{2}= %-.3f, dof= %i, rms= %-.3f", recTrack->
chi2(), recTrack->
dof(), recTrack->
rms());
958 sprintf(
data,
"Origin (%-.2f, %-.2f, %-.2f) cm", recTrack->
xPos(), recTrack->
yPos(), recTrack->
zPos());
961 sprintf(
data,
"p (%-.3f, %-.3f, %-.3f) GeV", recTrack->
px(), recTrack->
py(), recTrack->
pz());
1052 for (Int_t i = 0; i < fMdcTrackCol->GetEntries(); i++) {
1059 for (Int_t i = 0; i < fTofTrackCol->GetEntries(); i++) {
1066 for (Int_t i = 0; i < fEmcTrackCol->GetEntries(); i++) {
1073 for (Int_t i = 0; i < fMucTrackCol->GetEntries(); i++) {
1080 for (Int_t i = 0; i < fExtTrackCol->GetEntries(); i++) {
1100 TString opt = option;
1121 if ( opt.Contains(
"ALL") || opt.Contains(
"Digi") ) {
1143bool BesEvent::Is_tofCounter(UInt_t status){
1144 const unsigned int Counter_Mask = 0x00000004;
1145 const unsigned int Counter_Index = 2;
1146 return ((status & Counter_Mask) >> Counter_Index) ?
true:
false;
1149bool BesEvent::Is_tofBarrel(UInt_t status) {
1150 const unsigned int Barrel_Index = 4;
1151 const unsigned int Barrel_Mask = 0x00000010;
1152 return ((status & Barrel_Mask) >> Barrel_Index ) ?
true :
false;
double sin(const BesAngle a)
double cos(const BesAngle a)
ClassImp(BesEvent) BesEvent
R__EXTERN BesGeometry * gBesGeometry
virtual void Delete(Option_t *option="")
const Int_t GetMucDigiNum() const
virtual void Clear(Option_t *option="")
const Int_t GetTofDigiNum() const
virtual void ConstructTofTrackFromRec(BesGeoTrack *tofTrack, const TRecTofTrack *recTrack, TDisTrack *recEvent)
virtual void SetTofTracks(TDisTrack *recEvent)
const TTofDigi * GetTofDigi(Int_t i) const
const TRecMdcTrack * GetMdcTrack(Int_t i, TDisTrack *recEvent) const
const Int_t GetMdcTrackNum(TDisTrack *recEvent) const
virtual void ConstructEmcTrackFromRec(BesGeoTrack *emcTrack, const TRecEmcShower *recTrack)
virtual void Print(Option_t *option="")
const Int_t GetMdcDigiNum() const
virtual void SetMucTracks(TDisTrack *recEvent)
virtual void SetMdcTracks(TDisTrack *recEvent)
virtual void SetEmcShowers(TDisTrack *recEvent)
const Int_t GetEmcShowerNum(TDisTrack *recEvent) const
const TMucDigi * GetMucDigi(Int_t i) const
const TRecEmcShower * GetEmcShower(Int_t i, TDisTrack *recEvent) const
const Int_t GetEmcDigiNum() const
virtual void ConstructMucTrackFromRec(BesGeoTrack *mucTrack, const TRecMucTrack *recTrack)
virtual void SetEvent(TDigiEvent *digiEvent, TDisTrack *recEvent, TEvtHeader *evtHeader, TRecEvTime *recEvTime)
const TMdcDigi * GetMdcDigi(Int_t i) const
const TEmcDigi * GetEmcDigi(Int_t i) const
virtual void ConstructMdcTrackFromRec(BesGeoTrack *mdcTrack, const TRecMdcTrack *recTrack, TDisTrack *recEvent)
virtual void DrawHits(Option_t *option)
virtual void DrawTracks(Option_t *option)
virtual void SetTracks(TDisTrack *recEvent)
virtual void SetExtTracks(TDisTrack *recEvent)
virtual void SetTrackType(Int_t type)
virtual void Draw(Option_t *option="")
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)
virtual void SetMarker(Double_t x, Double_t y, Double_t z)
virtual void AddInfo(TString info)
virtual void AddHit(TObject *obj)
virtual void SetCharge(Int_t charge)
EmcROOTGeo * GetEmcROOTGeo()
MdcROOTGeo * GetMdcROOTGeo()
MucROOTGeo * GetMucROOTGeo()
TofROOTGeo * GetTofROOTGeo()
Bool_t GetVisTracksGlobal()
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
Emc2DCrystal * Get2DCrystal(Int_t part, Int_t phi, Int_t theta)
Get Emc2DCrystal;.
void DrawHits(Option_t *option)
Draw 2D hits.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
void DrawHits(Option_t *option)
Draw 2D hits.
Mdc2DWire * Get2DWire(Int_t layer, Int_t replica)
Get Mdc2DWire;.
TGeoVolume * GetVolumeMdc()
Get Mdc volume;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
static int part(const Identifier &id)
static int gap(const Identifier &id)
static int seg(const Identifier &id)
static int strip(const Identifier &id)
TGeoVolume * GetVolumeMuc()
Get Muc volume;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
void DrawHits(Option_t *option)
Draw 2D hits.
Muc2DStrip * Get2DStrip(int part, int seg, int gap, int strip)
Get Muc2DStrip;.
void Clear(Option_t *option="")
const TRecTofTrack * getTofTrack(Int_t i) const
retrieve a TofTrack From the collection, using the index into the array
const TRecMucTrack * getMucTrack(Int_t i) const
retrieve a MucTrack From the collection, using the index into the array
const TObjArray * getRecMdcHitCol() const
retrieve the whole TObjArray of RecMdcHit Data
const TRecEmcShower * getEmcShower(Int_t i) const
retrieve a EmcShower from the collection, using the index into the array
const TObjArray * getTofTrackCol() const
retrieve the whole TObjArray of TofTrack Data
const TRecMdcTrack * getRecMdcTrack(Int_t i) const
retrieve a MdcTrack from the collection, using the index into the array
void Print(Option_t *option="") const
map< Int_t, Double_t > cellIdMap() const
const UInt_t getMdcId() const
const Int_t getTrkId(void) const
const Double_t phi() const
const Double_t pz() const
const Double_t px() const
const Double_t chi2() const
const Int_t trackId() const
const Double_t pxy() const
const Double_t theta() const
const Int_t charge() const
const Double_t py() const
const Double_t helix(Int_t i) const
Int_t brLastLayer() const
vector< Int_t > vecHits() const
Int_t maxHitsInLayer() const
Int_t ecLastLayer() const
const int getTrigChannel(int i) const
const int getTrigCondition(int i) const
const int getTimingType() const
const TTrigData * getTrigData() const
void SetHits()
Set all physicalNodes corresponding to digiCol;.
void DrawHits(Option_t *option)
Draw 2D hits.
Tof2DScin * Get2DScin(Int_t part, Int_t layer, Int_t scin)
Get Tof2DScin;.
TGeoPhysicalNode * GetPhysicalScin(int part, int scin)
Get scintillator physical node;.