From e106df15ae4a1544dc507acfa9e90dfb5f1d8f63 Mon Sep 17 00:00:00 2001 From: dkap7827 Date: Mon, 15 Jul 2024 14:15:59 -0400 Subject: [PATCH] StEpdHitMaker can now make EPD hit collection by reading trigger data from MuDsts --- StRoot/StEpdHitMaker/StEpdHitMaker.cxx | 39 ++++++++++++++++++-------- StRoot/StEpdHitMaker/StEpdHitMaker.h | 11 ++++++-- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/StRoot/StEpdHitMaker/StEpdHitMaker.cxx b/StRoot/StEpdHitMaker/StEpdHitMaker.cxx index c17a34d4d86..2c0b37a07bd 100644 --- a/StRoot/StEpdHitMaker/StEpdHitMaker.cxx +++ b/StRoot/StEpdHitMaker/StEpdHitMaker.cxx @@ -23,6 +23,7 @@ #include "StEvent/StEpdCollection.h" #include "StEpdDbMaker/StEpdDbMaker.h" +#include "StMuDSTMaker/COMMON/StMuTypes.hh" #include #include @@ -47,6 +48,13 @@ int StEpdHitMaker::Init(){ int StEpdHitMaker::Make(){ mEventCounter++ ; mTriggerEventCounter++; + if( mReadMuDst ){ + StMuDst* mudst = (StMuDst*)GetInputDS("MuDst"); + if(!mudst){LOG_ERROR<<"StEpdHitMaker::GetEpdCollection found no StMuDst"<epdHits(); + if( epdhits!=0 && epdhits->GetEntriesFast()!=0 ){ return kStOk; } //If processing MuDsts and non-zero hits exist in MuDst then stop and just use those hits otherwise fill StEvent + } + mTriggerData = this->GetTriggerData(); if (!mTriggerData){ LOG_ERROR << "StEpdHitMaker::Make - no TriggerData object" << endm; @@ -81,13 +89,22 @@ int StEpdHitMaker::Finish(){ } //---------------------------------------------- -StTriggerData* StEpdHitMaker::GetTriggerData(){ - StTriggerData* trg=0; - mStEvent = dynamic_cast (GetInputDS("StEvent")); // this is how the StBtofHitMaker does it. - if (mStEvent){ - trg = mStEvent->triggerData(); +const StTriggerData* StEpdHitMaker::GetTriggerData(){ + const StTriggerData* trg=0; + if( mReadMuDst ){ + StMuDst* mudst = (StMuDst*)GetInputDS("MuDst"); + if( mudst==0 ){ LOG_ERROR << "StEpdHitMaker::GetTriggerData - !StMuDst" << endm; return 0; } + StMuEvent* muevent = mudst->event(); + if( muevent==0 ){ LOG_ERROR <<"StEpdHitMaker::GetTriggerData - !StMuEvent" <triggerData(); } + } + else{ + mStEvent = dynamic_cast (GetInputDS("StEvent")); // this is how the StBtofHitMaker does it. + if (mStEvent){ + trg = mStEvent->triggerData(); + } + else {LOG_WARN << "No StEvent found by StEpdHitMaker::GetTriggerData" << endm;} } - else {LOG_WARN << "No StEvent found by StEpdHitMaker::GetTriggerData" << endm;} return trg; } @@ -95,6 +112,7 @@ StTriggerData* StEpdHitMaker::GetTriggerData(){ // this is patterned after the StBTofHitMaker StEpdCollection* StEpdHitMaker::GetEpdCollection(){ StEpdCollection* epdCollection = 0; + //This will get executed if no epdhits from mudsts. This way it will still generate the epd collection mStEvent = dynamic_cast (GetInputDS("StEvent")); // this is how the StBtofHitMaker does it. if (mStEvent){ epdCollection = mStEvent->epdCollection(); @@ -104,20 +122,17 @@ StEpdCollection* StEpdHitMaker::GetEpdCollection(){ epdCollection = new StEpdCollection(); mStEvent->setEpdCollection(epdCollection); } - else { + else { LOG_INFO << "StEpdHitMaker::GetEpdCollection - StEvent already has a StEpdCollection - not making a new one" << endm; } } - else { - LOG_WARN << "No StEvent found by StEpdHitMaker::GetEpdCollection" << endm; - } - + else{ LOG_WARN << "No StEvent found by StEpdHitMaker::GetEpdCollection" << endm; } return epdCollection; } void StEpdHitMaker::FillStEpdData(){ - StTriggerData* trg=mTriggerData; + const StTriggerData* trg=mTriggerData; // This is for BBC. We can do this if we ever have a StBbc class. // for (Int_t ew=0; ew<2; ew++){ diff --git a/StRoot/StEpdHitMaker/StEpdHitMaker.h b/StRoot/StEpdHitMaker/StEpdHitMaker.h index 5a0c6ceefc9..bad26f3aa48 100644 --- a/StRoot/StEpdHitMaker/StEpdHitMaker.h +++ b/StRoot/StEpdHitMaker/StEpdHitMaker.h @@ -13,6 +13,10 @@ If it is not there, it creates one and fills it from the StTriggerData object and info from the StEpdDbMaker (database) + \author David Kapukchyan + \date 10 July 2024 + It can also process trigger data from Mudst data by calling #setReadMuDst(). Need to call StEventMaker to make it work right though since this maker will still fill into StEvent. This was done so StEvent will clean the collection from event to event. + */ @@ -39,11 +43,13 @@ class StEpdHitMaker : public StMaker { /// Finish does nothing right now virtual int Finish(); + void setReadMuDst(bool value=true){ mReadMuDst=value; } + /// Returns the collection of StEpdHits in the event StEpdCollection* GetEpdCollection(); // collection of StEpdHit objects /// Returns a pointer to the StTriggerData object - StTriggerData* GetTriggerData(); + const StTriggerData* GetTriggerData(); /// Returns a pointer to the StEpdDbMaker StEpdDbMaker* GetEpdDbMaker(); @@ -62,10 +68,11 @@ class StEpdHitMaker : public StMaker { int mEventCounter; /// simple event counter int mTriggerEventCounter; /// another event counter. At the moment, it is redundant with mEventCounter StEpdCollection* mEpdCollection; - StTriggerData* mTriggerData; + const StTriggerData* mTriggerData; StEpdDbMaker* mEpdDbMaker; StEvent* mStEvent; + bool mReadMuDst = false; // static const int mNPREPOST=2;