17 #include "StEpdHitMaker.h"
19 #include "StEventTypes.h"
20 #include "StEvent/StTriggerData.h"
23 #include "StEvent/StEpdCollection.h"
24 #include "StEpdDbMaker/StEpdDbMaker.h"
26 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
38 mEventCounter(0), mTriggerEventCounter(0), mEpdCollection(0), mTriggerData(0), mEpdDbMaker(0), mStEvent(0) {
39 LOG_DEBUG <<
"StEpdHitMaker::ctor" << endm;
50 mTriggerEventCounter++;
53 if(!mudst){LOG_ERROR<<
"StEpdHitMaker::GetEpdCollection found no StMuDst"<<endm;
return 0; }
54 TClonesArray* epdhits = mudst->
epdHits();
55 if( epdhits!=0 && epdhits->GetEntriesFast()!=0 ){
return kStOk; }
60 LOG_ERROR <<
"StEpdHitMaker::Make - no TriggerData object" << endm;
65 LOG_ERROR <<
"StEpdHitMaker::Make - no EpdDbMaker object" << endm;
70 LOG_ERROR <<
"StEpdHitMaker::Make - no EpdCollection object" << endm;
82 if (!dbMaker) LOG_WARN <<
"No StEpdDbMaker found by StEpdHitMaker::GetEpdDbMaker" << endm;
96 if( mudst==0 ){ LOG_ERROR <<
"StEpdHitMaker::GetTriggerData - !StMuDst" << endm;
return 0; }
98 if( muevent==0 ){ LOG_ERROR <<
"StEpdHitMaker::GetTriggerData - !StMuEvent" <<endm;
return 0; }
99 else{ trg = muevent->triggerData(); }
102 mStEvent =
dynamic_cast<StEvent *
> (GetInputDS(
"StEvent"));
104 trg = mStEvent->triggerData();
106 else {LOG_WARN <<
"No StEvent found by StEpdHitMaker::GetTriggerData" << endm;}
116 mStEvent =
dynamic_cast<StEvent *
> (GetInputDS(
"StEvent"));
118 epdCollection = mStEvent->epdCollection();
121 LOG_INFO <<
"StEpdHitMaker::GetEpdCollection - making new StEpdCollection and giving it to StEvent" << endm;
123 mStEvent->setEpdCollection(epdCollection);
126 LOG_INFO <<
"StEpdHitMaker::GetEpdCollection - StEvent already has a StEpdCollection - not making a new one" << endm;
129 else{ LOG_WARN <<
"No StEvent found by StEpdHitMaker::GetEpdCollection" << endm; }
130 return epdCollection;
133 void StEpdHitMaker::FillStEpdData(){
155 for (
short ew=0; ew<2; ew++){
156 for (
short PP=1; PP<13; PP++){
157 for (
short TT=1;
TT<32;
TT++){
159 short crateAdc = mEpdDbMaker->GetCrateAdc(ew,PP,
TT);
161 short EWforHit=(ew==0)?-1:+1;
189 short boardAdc = mEpdDbMaker->GetBoardAdc(ew,PP,
TT);
190 short channelAdc = mEpdDbMaker->GetChannelAdc(ew,PP,
TT);
191 int ADC = trg->epdADC(crateAdc,boardAdc,channelAdc,PrePost);
194 int TDC = trg->epdTDC(crateAdc,boardAdc,channelAdc,PrePost);
199 bool HasTac = (mEpdDbMaker->GetChannelTac(ew,PP,
TT)>=0);
202 TAC = trg->epdADC(mEpdDbMaker->GetCrateTac(ew,PP,
TT),
203 mEpdDbMaker->GetBoardTac(ew,PP,
TT),
204 mEpdDbMaker->GetChannelTac(ew,PP,
TT),
209 double gain = mEpdDbMaker->GetMip(ew,PP,
TT);
210 if (gain<=0.0) gain = 1.0;
212 float nMIP = (ADC + mEpdDbMaker->GetOffset(ew,PP,
TT)) / mEpdDbMaker->GetMip(ew,PP,
TT);
227 mEpdCollection->addHit(hit);
238 LOG_INFO <<
"StEpdHitMaker::FillStEpdData - added " << nHitsAdded <<
" to StEpdHitCollection" << endm;
StEpdDbMaker * GetEpdDbMaker()
Returns a pointer to the StEpdDbMaker.
virtual int Init()
Init does nothing right now.
StEpdCollection * GetEpdCollection()
Returns the collection of StEpdHits in the event.
static TClonesArray * epdHits()
returns pointer to the EpdHitCollection
virtual int Finish()
Finish does nothing right now.
const StTriggerData * GetTriggerData()
Returns a pointer to the StTriggerData object.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Stores information for tiles in STAR Event Plane Detector.