1 #include "StTofMuDstEval.h"
15 #include "PhysicalConstants.h"
16 #include "SystemOfUnits.h"
17 #include "StThreeVector.hh"
18 #include "StThreeVectorF.hh"
19 #include "StThreeVectorD.hh"
20 #include "StLorentzVectorD.hh"
23 #include "StTofCollection.h"
24 #include "StTofRawData.h"
25 #include "StTofUtil/StSortTofRawData.h"
26 #include "StTofUtil/StTofrGeometry.h"
27 #include "StTriggerIdCollection.h"
28 #include "StTriggerId.h"
30 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
31 #include "StMuDSTMaker/COMMON/StMuEvent.h"
32 #include "StMuDSTMaker/COMMON/StMuDst.h"
33 #include "StMuDSTMaker/COMMON/StMuTrack.h"
34 #include "StMuDSTMaker/COMMON/StMuTofHit.h"
36 #include "StTofMuDstEval.h"
53 StTofMuDstEval::~StTofMuDstEval()
60 void StTofMuDstEval::Clear(
const char*)
62 if(mEvent)
delete mEvent;
64 if(mSortTofRawData)
delete mSortTofRawData;
72 if(mTofrGeom)
delete mTofrGeom;
79 Int_t StTofMuDstEval::Init()
83 mTofrGeom =
new StTofrGeometry(
"tofrGeom",
"tofrGeom in MuDstEval");
84 if(!mTofrGeom->IsInitDone()) {
85 gMessMgr->Info(
"TofrGemetry initialization..." ,
"OS");
87 mTofrGeom->Init(starHall);
95 cout <<
" StTofMuDstEval::Make()" << endl;
97 if( mMuDstMaker != NULL ) {
98 mMuDst = mMuDstMaker->
muDst();
101 if(!mMuDst)
return kStOK;
105 mEvent->setTofCollection(mTofCollection);
106 int nTofRawData = mMuDst->numberOfTofRawData();
107 for(
int i=0;i<nTofRawData;i++) {
111 unsigned short leteFlag = aMuRawData->leteFlag();
112 unsigned short channel = aMuRawData->channel();
113 unsigned int tdc = aMuRawData->tdc();
114 unsigned short quality = aMuRawData->quality();
115 aRawData =
new StTofRawData(leteFlag,channel,tdc,quality);
119 mTofCollection->addRawData(aRawData);
126 void StTofMuDstEval::GetPvpdNHits(
int &neast,
int &nwest)
128 IntVec validchannel = mSortTofRawData->GetValidChannel();
130 int used[mNPVPD] = {0,0,0,0,0,0};
131 int channum[mNPVPD] ={-1,-1,-1,-1,-1,-1};
132 float mPVPDLeTime[mNPVPD] = {0.,0.,0.,0.,0.,0.};
133 float mPVPDTot[mNPVPD] = {0.,0.,0.,0.,0.,0.};
135 const Float_t mPVPDTotMin = 2.0;
136 const Float_t mPVPDTotMax = 8.0;
138 for(
unsigned int ich=0;ich<validchannel.size();ich++){
139 int chan = validchannel[ich];
140 if(chan<mNTOFr5)
continue;
141 int ichan = chan - mNTOFr5;
142 if(ichan<0||ichan>=mNPVPD)
continue;
143 if(used[ichan]>0)
continue;
146 int tmptdc = (mSortTofRawData->GetLeadingTdc(chan))[0];
147 float pvpdletdc = tmptdc;
148 mPVPDLeTime[ichan] = pvpdletdc * VHRBIN2PS/1000.;
150 tmptdc = (mSortTofRawData->GetTrailingTdc(chan))[0];
151 float pvpdtetdc = tmptdc;
152 float tetime = pvpdtetdc * HRBIN2PS/1000.;
153 mPVPDTot[ichan] = tetime - mPVPDLeTime[ichan];
154 channum[ichan]=ichan;
159 for(
int i=0;i<mNPVPD;i++) {
167 for(
int i=0;i<mNPVPD;i++) {
168 if(channum[i]!=i)
continue;
170 for(
int j=0;j<mNPVPD;j++) {
171 if(channum[j]!=j)
continue;
172 float dt = mPVPDLeTime[j] - mPVPDLeTime[i];
173 if(fabs(dt)<200.) n0++;
176 if(n0>=nPVPDFired/2) {
184 for(
int i=0;i<mNPVPD/2;i++) {
185 if(mPVPDLeTime[i]>0.&&mPVPDTot[i]>mPVPDTotMin&&mPVPDTot[i]<mPVPDTotMax) neast++;
187 if(mPVPDLeTime[j]>0.&&mPVPDTot[j]>mPVPDTotMin&&mPVPDTot[j]<mPVPDTotMax) nwest++;
193 Float_t StTofMuDstEval::GetUncorrectedTot(
StMuTofHit *tofHit)
197 int daqIndex = tofHit->daqIndex();
198 IntVec validchannel = mSortTofRawData->GetValidChannel();
199 for(
unsigned int ich=0;ich<validchannel.size();ich++){
200 int chan = validchannel[ich];
202 int tmptdc = (mSortTofRawData->GetLeadingTdc(chan))[0];
203 float letime = tmptdc * VHRBIN2PS/1000.;
204 tmptdc = (mSortTofRawData->GetTrailingTdc(chan))[0];
205 float tetime = tmptdc * HRBIN2PS/1000.;
206 tot = tetime - letime;
214 void StTofMuDstEval::GetLocalHitPosition(
StMuTofHit *tofHit, Double_t* local)
217 int itray = tofHit->trayIndex();
218 int imodule = tofHit->moduleIndex();
221 gMessMgr->Warning(
"",
"OS") <<
" No sensitive module in the projection??? -- Something weird!!! " << endm;
225 Double_t global[3] = {0.,0.,0.};
226 global[0] = tofHit->projectedPoint().x();
227 global[1] = tofHit->projectedPoint().y();
228 global[2] = tofHit->projectedPoint().z();
230 sensor->Master2Local(&global[0],local);
static StTofRawData * tofRawData(int i)
returns pointer to the i-th tofRawData
virtual void Clear(Option_t *option="")
User defined functions.