38 #include "StBTofMixerMaker.h"
39 #include "StEventTypes.h"
40 #include "StEvent/StBTofCollection.h"
42 #include "StBTofSimMaker/StBTofSimMaker.h"
61 int StBTofMixerMaker::Init()
64 return StMaker::Init();
69 int StBTofMixerMaker::InitRun(
int runnumber)
75 int StBTofMixerMaker::FinishRun(
int runnumber)
94 LOG_ERROR <<
"No StEvent! Bailing out ..." << endm;
105 LOG_WARN <<
"Embedding flag is false! StBTofMixerMaker should only be run if the embedding mode is active in StBTofSimMaker!" << endm;
111 LOG_ERROR <<
"No BTofCollection! Bailing out ..." << endm;
114 LOG_DEBUG <<
"The original size of the collection was " <<
mEventCollection->tofHits().size() << endm;
115 LOG_DEBUG <<
"There are " <<
mBTofSimCollection->tofHits().size() <<
" hits in the BTofSimMakers Collection" << endm;
117 std::vector<StBTofHit*> sortedEventHitsVec(23447,0);
127 LOG_DEBUG <<
"size of sortedEventHitsVec=" << sortedEventHitsVec.size() << endm;
128 for (
int k=0; k < (int)sortedEventHitsVec.size(); k++) {
129 if (sortedEventHitsVec[k]) {
130 StBTofHit aBTofHit = *sortedEventHitsVec[k];
138 LOG_DEBUG <<
"mEvent->btofCollection()=" <<
mEvent->btofCollection() << endm;
140 LOG_DEBUG <<
"mEvent->btofCollection()=" <<
mEvent->btofCollection() << endm;
143 LOG_DEBUG <<
"... Modified StBTofCollection Stored in StEvent! " << endm;
145 LOG_DEBUG <<
"The size of the collection is now " <<
mEvent->btofCollection()->tofHits().size() << endm;
155 for (
int i=0; i<(int)simHits->tofHits().size(); i++) {
156 if (simHits->tofHits()[i]) {
157 int simKeyId = simHits->tofHits()[i]->ID()*simHits->tofHits()[i]->kNCell + simHits->tofHits()[i]->cell()-1;
158 if (eventHits[simKeyId] != 0) {
160 if ( eventHits[i]->leadingEdgeTime() > simHits->tofHits()[i]->leadingEdgeTime() ) {
161 eventHits[simKeyId] = simHits->tofHits()[i];
165 eventHits[simKeyId] = simHits->tofHits()[i];
virtual ~StBTofMixerMaker()
bool mIsEmbedding
Embedding flag.
StBTofMixerMaker(const char *name="Simulation")
StBTofCollection * mEventCollection
BtofCollection from StEvent.
void findDuplicates(std::vector< StBTofHit * > &eventHits, StBTofCollection *simHits)
Find duplicate hits between the BTofCollections.
StEvent * mEvent
The StEvent info from previous Makers.
StBTofCollection * mBTofSimCollection
BTofCollection produced by BTofSimMaker.
StBTofCollection * mNewCollection
BTofCollection to be assembled by embedding.