Skip to content

Commit

Permalink
StEpdHitMaker can now make EPD hit collection by reading trigger data…
Browse files Browse the repository at this point in the history
… from MuDsts
  • Loading branch information
dkapukchyan committed Jul 15, 2024
1 parent e23deba commit e106df1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
39 changes: 27 additions & 12 deletions StRoot/StEpdHitMaker/StEpdHitMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "StEvent/StEpdCollection.h"
#include "StEpdDbMaker/StEpdDbMaker.h"

#include "StMuDSTMaker/COMMON/StMuTypes.hh"

#include <iostream>
#include <fstream>
Expand All @@ -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"<<endm; return 0; }
TClonesArray* epdhits = mudst->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;
Expand Down Expand Up @@ -81,20 +89,30 @@ int StEpdHitMaker::Finish(){
}

//----------------------------------------------
StTriggerData* StEpdHitMaker::GetTriggerData(){
StTriggerData* trg=0;
mStEvent = dynamic_cast<StEvent *> (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" <<endm; return 0; }
else{ trg = muevent->triggerData(); }
}
else{
mStEvent = dynamic_cast<StEvent *> (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;
}

//----------------------------------------------
// 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<StEvent *> (GetInputDS("StEvent")); // this is how the StBtofHitMaker does it.
if (mStEvent){
epdCollection = mStEvent->epdCollection();
Expand All @@ -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++){
Expand Down
11 changes: 9 additions & 2 deletions StRoot/StEpdHitMaker/StEpdHitMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/


Expand All @@ -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();
Expand All @@ -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;

Expand Down

0 comments on commit e106df1

Please sign in to comment.