10 #include "StEvent/StEvent.h"
11 #include "StEvent/StEventTypes.h"
12 #include "StEvent/StEventSummary.h"
13 #include "StEvent/StEventInfo.h"
14 #include "StEvent/StDetectorState.h"
15 #include "StEvent/StIstHitCollection.h"
16 #include "StEvent/StSsdHitCollection.h"
17 #include "StEvent/StPxlHitCollection.h"
18 #include "StEvent/StPxlSectorHitCollection.h"
19 #include "StEvent/StPxlLadderHitCollection.h"
21 #include "StEventUtilities/StuRefMult.hh"
22 #include "StEventUtilities/StuFtpcRefMult.hh"
24 #include "StarClassLibrary/SystemOfUnits.h"
25 #include "StarClassLibrary/StTimer.hh"
27 #include "StMuException.hh"
28 #include "StMuEvent.h"
29 #include "StMuTrack.h"
30 #include "StMuL3EventSummary.h"
32 #include "StMuDebug.h"
34 #include "StMuPrimaryVertex.h"
35 #include "StMuBTofHit.h"
36 #include "StMuETofHit.h"
37 #include "StMuETofDigi.h"
39 #include "TClonesArray.h"
50 int n = (
char*)mReactionPlanePtWgt - (
char*)&mRefMultPos+
sizeof(mReactionPlanePtWgt);
51 memset(&mRefMultPos,0,n);
56 StMuEvent::StMuEvent(
const StEvent* event) : mPrimaryVertexError(-999.,-999.,-999.) {
67 StMuEvent::~StMuEvent(){
73 void StMuEvent::clear(){
81 if ( !event )
throw StMuExceptionNullPointer(
"no StEvent",__PRETTYF__);
82 if ( !event->info() )
throw StMuExceptionNullPointer(
"no event info",__PRETTYF__);
83 if ( !event->runInfo() )
throw StMuExceptionNullPointer(
"no run info",__PRETTYF__);
84 if ( !event->summary() )
throw StMuExceptionNullPointer(
"no event summary",__PRETTYF__);
89 mRunInfo = *
event->runInfo();
90 mEventInfo = *
event->info();
91 mEventSummary = *
event->summary();
94 mPrimaryVertexError=p_vtx->positionError();
97 if ( !event->triggerDetectorCollection() ) {
98 DEBUGVALUE2(event->type());
99 DEBUGVALUE2(event->info()->time());
100 DEBUGMESSAGE2(
"no trigger detector collection, creating dummy");
103 mVpdTriggerDetector =
event->triggerDetectorCollection()->vpd();
104 mMtdTriggerDetector =
event->triggerDetectorCollection()->mtd();
105 mCtbTriggerDetector =
event->triggerDetectorCollection()->ctb();
106 mZdcTriggerDetector =
event->triggerDetectorCollection()->zdc();
107 mBbcTriggerDetector =
event->triggerDetectorCollection()->bbc();
108 mEmcTriggerDetector =
event->triggerDetectorCollection()->emc();
109 mFpdTriggerDetector =
event->triggerDetectorCollection()->fpd();
110 mFmsTriggerDetector =
event->triggerDetectorCollection()->fms();
113 if (event->fpdCollection())
114 mFpdCollection = *event->fpdCollection();
115 if (event->l0Trigger())
116 mL0Trigger = *event->l0Trigger();
117 mL3EventSummary.fill(event);
119 mTriggerIdCollection.fill( event->triggerIdCollection() );
122 mRefMultPos = uncorrectedNumberOfPositivePrimaries(*event);
123 mRefMultNeg = uncorrectedNumberOfNegativePrimaries(*event);
124 mRefMultFtpcEast = uncorrectedNumberOfFtpcEastPrimaries(*event);
125 mRefMultFtpcWest = uncorrectedNumberOfFtpcWestPrimaries(*event);
127 if (event->triggerData())
128 mL2Result.Set(event->triggerData()->l2ResultLength(),(
const Int_t*) event->triggerData()->l2Result());
131 mVpdEast = mVpdWest = 0;
132 mVpdTstart = mVpdTdiff = 0.;
133 if (event->tofCollection()) {
134 mVpdEast =
event->tofCollection()->vpdEast();
135 mVpdWest =
event->tofCollection()->vpdWest();
136 mVpdTstart =
event->tofCollection()->tstart();
137 mVpdTdiff =
event->tofCollection()->tdiff();
138 mVpdVz =
event->tofCollection()->vzVpd();
141 mTriggerData =
const_cast<StTriggerData*
>(
event->triggerData());
142 if(mTriggerData!=0) mTriggerData->setDebug(0);
145 for(
int i=0;i<4;i++) mNHitsHFT[i] = 0;
147 if(PxlHitCollection) {
148 UInt_t numberOfSectors=PxlHitCollection->numberOfSectors();
149 for(UInt_t i=0;i<numberOfSectors;i++){
151 if(!PxlSectorHitCollection)
continue;
153 UInt_t numberOfLadders=PxlSectorHitCollection->numberOfLadders();
154 for(UInt_t j=0;j<numberOfLadders;j++){
156 if(!PxlLadderHitCollection)
continue;
158 if(j==0) mNHitsHFT[0] += PxlLadderHitCollection->numberOfHits();
159 else mNHitsHFT[1] += PxlLadderHitCollection->numberOfHits();
165 if(IstHitCollection) mNHitsHFT[2] += IstHitCollection->numberOfHits();
168 if(SsdHitCollection) mNHitsHFT[3] += SsdHitCollection->numberOfHits();
175 if (StMuDst::numberOfPrimaryVertices()==0 && (vtx_id == 0 || vtx_id == -1))
186 if (StMuDst::numberOfPrimaryVertices()==0 && (vtx_id == 0 || vtx_id == -1))
199 if (StMuDst::numberOfPrimaryVertices()==0 && (vtx_id == 0 || vtx_id == -1))
200 return mRefMultFtpcEast;
210 if (StMuDst::numberOfPrimaryVertices()==0 && (vtx_id == 0 || vtx_id == -1))
211 return mRefMultFtpcWest;
224 if (StMuDst::numberOfPrimaryVertices()==0 && (vtx_id == 0 || vtx_id == -1)){
225 if(fabs(mEventSummary.primaryVertexPosition().x()) < 1.e-5 && fabs(mEventSummary.primaryVertexPosition().y()) < 1.e-5 && fabs(mEventSummary.primaryVertexPosition().z()) < 1.e-5)
return vz;
226 else return mEventSummary.primaryVertexPosition();
237 if (StMuDst::numberOfPrimaryVertices()==0 && (vtx_id == 0 || vtx_id == -1)){
238 if(fabs(mEventSummary.primaryVertexPosition().x()) < 1.e-5 && fabs(mEventSummary.primaryVertexPosition().y()) < 1.e-5 && fabs(mEventSummary.primaryVertexPosition().z()) < 1.e-5)
return vz;
239 else return mPrimaryVertexError;
248 unsigned short StMuEvent::grefmult(
int vtx_id){
249 unsigned short grefmult = 0;
252 if (StMuDst::numberOfPrimaryVertices()==0 && (vtx_id == 0 || vtx_id == -1)){
253 if(!(fabs(mEventSummary.primaryVertexPosition().x()) < 1.e-5 && fabs(mEventSummary.primaryVertexPosition().y()) < 1.e-5 && fabs(mEventSummary.primaryVertexPosition().z()) < 1.e-5)){
256 if (fabs(glob->
eta()) < 0.5 && fabs(glob->
dcaGlobal().mag()) < 3 && glob->
nHitsFit(kTpcId) >= 10) grefmult++;
269 if (fabs(glob->
eta()) < 0.5 && fabs(glob->
dcaGlobal(vtx_id).mag()) < 3 && glob->
nHitsFit(kTpcId) >= 10) grefmult++;
276 unsigned short StMuEvent::btofTrayMultiplicity(){
278 unsigned short btofmult = (
unsigned short)StMuDst::numberOfBTofHit();
279 for(
unsigned int i=0;i< StMuDst::numberOfBTofHit();i++)
if(
StMuDst::btofHit(i)->tray() > 120) btofmult--;
284 unsigned short StMuEvent::etofHitMultiplicity(){
285 return (
unsigned short) StMuDst::numberOfETofHit();
287 unsigned short StMuEvent::etofDigiMultiplicity(){
288 return (
unsigned short) StMuDst::numberOfETofDigi();
291 float StMuEvent::nearestVertexZ(
int vtx_id){
295 if (StMuDst::numberOfPrimaryVertices()==0)
return dz;
297 if(Nvert < 2)
return dz;
301 for(
int i=0;i<Nvert;i++){
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
static StMuBTofHit * btofHit(int i)
returns pointer to the i-th muBTofHit
static TObjArray * globalTracks()
returns pointer to the global tracks list
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in 'physical events'. Therefore there is only 1 primary vert...
unsigned short refMultNeg(int vtx_id=-1)
Reference multiplicity of negative particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
void fill(const StEvent *)
unsigned short refMultFtpcWest(int vtx_id=-1)
Reference multiplicity of particles in the west FTPC as defined in StEventUtilities/StuFtpcRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
static TClonesArray * primaryVertices()
returns pointer to the primary vertex list
UShort_t nHitsFit() const
Return total number of hits used in fit.
unsigned short refMultFtpc(int vtx_id=-1)
Reference multiplicity of particles in the east+west FTPC as defined in StEventUtilities/StuFtpcRefMu...
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
unsigned short refMult(int vtx_id=-1)
Reference multiplicity of charged particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
static Int_t currentVertexIndex()
Get the index number of the current primary vertex.
StThreeVectorF dcaGlobal(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex of associated global track.
unsigned short refMultPos(int vtx_id=-1)
Reference multiplicity of positive particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
unsigned short refMultFtpcEast(int vtx_id=-1)
Reference multiplicity of particles in the east FTPC as defined in StEventUtilities/StuFtpcRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)