39 fMdcTrackCol =
new TObjArray();
40 fTofTrackCol =
new TObjArray();
41 fEmcTrackCol =
new TObjArray();
42 fMucTrackCol =
new TObjArray();
43 fExtTrackCol =
new TObjArray();
65 for (
int j = 0; j < fMdcTrackCol->GetEntries(); j++){
66 delete fMdcTrackCol->At(j);
68 fMdcTrackCol->Clear(
"C");
72 for (
int j = 0; j < fTofTrackCol->GetEntries(); j++){
73 delete fTofTrackCol->At(j);
75 fTofTrackCol->Clear(
"C");
79 for (
int j = 0; j < fEmcTrackCol->GetEntries(); j++){
80 delete fEmcTrackCol->At(j);
82 fEmcTrackCol->Clear(
"C");
86 for (
int j = 0; j < fMucTrackCol->GetEntries(); j++){
87 delete fMucTrackCol->At(j);
89 fMucTrackCol->Clear(
"C");
93 for (
int j = 0; j < fExtTrackCol->GetEntries(); j++){
94 delete fExtTrackCol->At(j);
96 fExtTrackCol->Clear(
"C");
106 TString opt = option;
109 fDigiEvent->
Clear(
"C");
117 fDigiEvent = digiEvent;
118 fEvtHeader = evtHeader;
119 fRecEvTime = recEvTime;
125 if (fTrigEvent != 0){
126 vector<Int_t> trigConditionVector;
127 vector<Int_t> trigChannelVector;
134 for (Int_t i = 0; i < 48; i++){
136 if (trigCondition) trigConditionVector.push_back(i);
139 for (Int_t i = 0; i < 16; i++){
141 if (trigChannel) trigChannelVector.push_back(i);
144 fEventHeader.
SetEventTrig(timeType, trigConditionVector, trigChannelVector);
147 std::cout <<
"fTrigEvent does not exit!" << std::endl;
152 if (fEvtHeader != 0){
155 now = (time_t)evtHeader->
time();
162 struct tm *local_time;
163 local_time = localtime(&now);
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;
182 cout <<
"fEvtHeader does not exit" << endl;
199 cout <<
"fRecEvTime does not exit" << endl;
207 Double_t p = 0.0, pt = 0.0, px = 0.0, py = 0.0, pz = 0.0;
229 if (fDigiEvent != 0){
266 for (
int j = 0; j < fMdcTrackCol->GetEntries(); j++){
267 delete fMdcTrackCol->At(j);
269 fMdcTrackCol->Clear(
"C");
272 for (Int_t i = 0; i < mdc_no; i++) {
278 fMdcTrackCol->Add(mdcTrack);
286 for (
int j = 0; j < fTofTrackCol->GetEntries(); j++){
287 delete fTofTrackCol->At(j);
289 fTofTrackCol->Clear(
"C");
293 for (Int_t i = 0; i < tof_no; i++) {
295 if ( !Is_tofCounter( recTrack->
status()))
continue;
300 fTofTrackCol->Add(tofTrack);
308 for (
int j = 0; j < fEmcTrackCol->GetEntries(); j++){
309 delete fEmcTrackCol->At(j);
311 fEmcTrackCol->Clear(
"C");
315 for (Int_t i = 0; i < emc_no; i++) {
321 fEmcTrackCol->Add(emcTrack);
329 for (
int j = 0; j < fMucTrackCol->GetEntries(); j++){
330 delete fMucTrackCol->At(j);
332 fMucTrackCol->Clear(
"C");
335 for (Int_t i = 0; i < muc_no; i++) {
341 fMucTrackCol->Add(mucTrack);
364 Double_t field = -f_Magnetic;
365 Double_t
kvC = 3.0e8;
367 Double_t pt = recTrack->
pxy();
368 Double_t pz = recTrack->
pz();
369 Double_t
pi = TMath::Pi();
372 Double_t orgx = recTrack->
x()*10;
373 Double_t orgy = recTrack->
y()*10;
374 Double_t orgz = recTrack->
z()*10;
379 Double_t radius,zStep;
385 radius = (pt * 1.0e9 /
kvC * 1e3) / fabs(
charge * field) ;
386 zStep = 2*
pi*radius * fabs(pz/pt);
388 Double_t curvature = 1.0/radius;
389 Double_t step = 10.0;
390 Double_t delt = step*(1.0e-3)/
kvC;
392 mdcTrack->
AddPoint(orgx, orgy, orgz, 0.0);
403 x = recTrack->
helix(0)* 10 *
405 - nStep * step *
sin(recTrack->
helix(1));
406 y = recTrack->
helix(0)* 10 *
408 + nStep * step *
cos(recTrack->
helix(1));
409 z = recTrack->
helix(3)* 10 +
410 nStep * step * recTrack->
helix(4);
417 mdcTrack->PaintMarker(
mp);
418 mdcTrack->SetMarkerColor(kBlack);
419 mdcTrack->SetMarkerSize(10);
420 mdcTrack->SetLineColor(kBlack);
424 while ( (
x*
x +
y*
y) < mdcR*mdcR && fabs(z) < mdcZ );
428 x = recTrack->
helix(0)* 10 *
430 - nStep * step *
sin(recTrack->
helix(1));
431 y = recTrack->
helix(0)* 10 *
433 + nStep * step *
cos(recTrack->
helix(1));
434 z = recTrack->
helix(3)* 10 +
435 nStep * step * recTrack->
helix(4);
442 mdcTrack->PaintMarker(
mp);
443 mdcTrack->SetMarkerColor(kBlack);
444 mdcTrack->SetMarkerSize(10);
445 mdcTrack->SetLineColor(kRed);
448 while ( (
x*
x +
y*
y) < mdcR*mdcR && fabs(z) < mdcZ );
451 TGeoHelix helix(curvature, zStep,
charge);
452 helix.InitPoint(orgx, orgy, orgz);
454 helix.InitDirection(recTrack->
px(), recTrack->
py(), recTrack->
pz(), kFALSE);
456 helix.SetField(0.0, 0.0, field, kFALSE);
461 p = helix.GetCurrentPoint();
463 mdcTrack->
AddPoint(p[0], p[1], p[2], delt*nStep);
468 mdcTrack->PaintMarker(
mp);
469 mdcTrack->SetMarkerColor(kBlack);
470 mdcTrack->SetMarkerSize(10);
473 while ( (p[0]*p[0] + p[1]*p[1]) < mdcR*mdcR && fabs(p[2]) < mdcZ );
478 vector<UInt_t> vecHits(0);
480 for (Int_t i = 0; i < recMdcHitCol->GetEntriesFast(); i++){
482 Int_t recHitId = recMdcHit->
getTrkId();
483 Int_t recTrkId = recTrack->
trackId();
484 if (recHitId == recTrkId) vecHits.push_back(recMdcHit->
getMdcId());
486 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
504 info = TString(
"MdcTrack ");
511 sprintf(
data,
"P=%-.3f GeV, Pt=%-.3f GeV", recTrack->
p(), recTrack->
pxy());
517 sprintf(
data,
"Pxyz=(%-.3f,%-.3f,%-.3f) GeV", recTrack->
px(),recTrack->
py(),recTrack->
pz());
520 sprintf(
data,
"helix(%-.3f,%-.3f,%-.3f,%-.3f,%-.3f)", recTrack->
helix(0),recTrack->
helix(1),recTrack->
helix(2),recTrack->
helix(3), recTrack->
helix(4));
523 sprintf(
data,
"Origin (%-.3f, %-.3f, %-.3f) cm", orgx/10, orgy/10, orgz/10);
667 vector<Int_t> vecBHits(0);
668 vector<Int_t> vecEHits(0);
671 for (Int_t i = 0; i < recTofTrackCol->GetEntriesFast(); i++){
673 if ( !Is_tofCounter( recHit->
status()))
continue;
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());
682 vecEHits.push_back(recHit->
tofID());
687 TGeoPhysicalNode *phyNode = 0;
688 Double_t
x=0.0,
y=0.0, z=0.0;
691 if (vecBHits.size()){
692 nHits = vecBHits.size();
693 for (Int_t i = 0; i < nHits; i++) {
698 if ( ( vecBHits[i] >= 0 ) && ( vecBHits[i] <= 87 ) ) {
704 scin = vecBHits[i] - 88;
711 Double_t local[3] = {0.0, 0.0, 0.0};
712 Double_t master[3] = {0.0, 0.0, 0.0};
716 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
726 z = recTrack->
zrhit();
731 else if (vecEHits.size()){
732 nHits = vecEHits.size();
733 for (Int_t i = 0; i < nHits; i++) {
738 if ( ( vecEHits[i] >= 0 ) && ( vecEHits[i] <= 47 ) ) {
744 scin = vecEHits[i] - 48;
752 Double_t local[3] = {0.0, 0.0, 0.0};
753 Double_t master[3] = {0.0, 0.0, 0.0};
757 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
774 info = TString(
"TofTrack ");
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;
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);
833 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
838 if (part == 1) theta = 43-theta;
851 info = TString(
"EmcShower ");
858 sprintf(
data,
"energy= (%.2f #pm %-.2f) MeV", recTrack->
energy()*1000.0, recTrack->
dE()*1000.0);
866 sprintf(
data,
"cell Id= (%i, #theta %i, #phi %i)", part, theta, phi);
896 if (recTrack->
depth() <= 0.0)
return;
898 Double_t field = 1e-3;
899 Double_t
kvC = 3.0e8;
901 Double_t pz = recTrack->
pz();
903 sqrt(recTrack->
px()*recTrack->
px() + recTrack->
py()*recTrack->
py());
904 Double_t
pi = TMath::Pi();
911 Double_t radius = 1.0e+9;
912 Double_t curvature = 1.0/radius;
913 Double_t zStep = 2*
pi*radius * fabs(pz/pt);
915 Double_t delt = step*(1.0e-3)/
kvC;
917 TGeoHelix helix(curvature, zStep,
charge);
919 Double_t
x = recTrack->
xPos() * 10.0;
920 Double_t
y = recTrack->
yPos() * 10.0;
921 Double_t z = recTrack->
zPos() * 10.0;
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);
933 p = helix.GetCurrentPoint();
934 mucTrack->
AddPoint(p[0], p[1], p[2], delt*nStep);
939 mucTrack->PaintMarker(
mp);
940 mucTrack->SetMarkerColor(kBlack);
941 mucTrack->SetMarkerSize(10);
944 while ( (p[0]*p[0] + p[1]*p[1]) < mucR*mucR && fabs(p[2]) < mucZ );
947 vector<Int_t> vecHits = recTrack->
vecHits();
948 for (Int_t i = 0; i < (Int_t)vecHits.size(); i++) {
968 info = TString(
"MucTrack ");
981 sprintf(
data,
"#chi^{2}= %-.3f, dof= %i, rms= %-.3f", recTrack->
chi2(), recTrack->
dof(), recTrack->
rms());
987 sprintf(
data,
"p (%-.3f, %-.3f, %-.3f) GeV", recTrack->
px(), recTrack->
py(), recTrack->
pz());
1079 for (Int_t i = 0; i < fMdcTrackCol->GetEntries(); i++)
1087 for (Int_t i = 0; i < fTofTrackCol->GetEntries(); i++)
1095 for (Int_t i = 0; i < fEmcTrackCol->GetEntries(); i++)
1103 for (Int_t i = 0; i < fMucTrackCol->GetEntries(); i++)
1111 for (Int_t i = 0; i < fExtTrackCol->GetEntries(); i++)
1133 TString opt = option;
1154 if ( opt.Contains(
"ALL") || opt.Contains(
"Digi") ) {
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;
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;
double sin(const BesAngle a)
double cos(const BesAngle a)
ClassImp(BesEvent) BesEvent
R__EXTERN BesGeometry * gBesGeometry
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)
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)
const TMdcDigi * GetMdcDigi(Int_t i) const
virtual void SetEvent(TDigiEvent *digiEvent, TDisTrack *recEvent, TEvtHeader *evtHeader, TRecEvTime *recEvTime, Bool_t isRec)
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 Construct3DLine()
virtual void SetMarker(Double_t x, Double_t y, Double_t z)
virtual void AddInfo(TString info)
virtual void AddHit(TObject *obj)
virtual void Add3DHit(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.
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)
static int wire(const Identifier &id)
void DrawHits(Option_t *option)
Draw 2D hits.
Mdc2DWire * Get2DWire(Int_t layer, Int_t replica)
Get Mdc2DWire;.
TGeoPhysicalNode * GetPhysicalReplica(int layer, int replica)
Get replica physical node;.
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;.
TGeoPhysicalNode * GetPhysicalStrip(int part, int seg, int gap, int strip)
Get strip physical node;.
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
Int_t getTrkId(void) 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
int getTimingType() const
int getTrigCondition(int i) const
int getTrigChannel(int i) 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;.