18 #include "StTrigTreeMaker.h"
19 #include "StMuDSTMaker/COMMON/StMuDst.h"
20 #include "StMuDSTMaker/COMMON/StMuEvent.h"
22 #include "StRoot/StEEmcPool/./EEmcTreeContainers/TrigSet.h"
25 :
StMaker( myName ), mIsMC( isMC ), mUseSimuTrg( useSimu ), mFilename( filenameOut), mFile( 0 ), mTree( 0 ), mTrigSet( 0 ) { };
40 cout <<
"--------------------------------------------------> StTrigTreeMaker_t::Init() <--------------------------------------------------" << endl;
46 if( mTriggerSet.empty() ){
47 LOG_FATAL <<
"ERROR: trigger set is empty." << endm;
48 LOG_FATAL <<
"If you really want to process all triggers, enter a single trigger ID of -999." << endm;
50 }
else if (mTriggerSet.size() == 1 && mTriggerSet.count( -999 ) ) {
58 if(
mFile->IsOpen() ){
59 LOG_INFO <<
"Opened file '" <<
mFilename <<
"' for writing" << endm;
61 LOG_FATAL <<
"Error opening file '" <<
mFilename <<
"'" << endm;
68 mTree =
new TTree(
"tree",
"StMcTrigTree" );
70 mTree =
new TTree(
"tree",
"StTrigTree" );
73 mTree->Branch(
"trigSet", &mTrigSet, 32000, 1 );
77 cout <<
"--------------------------------------------------> end of StTrigTreeMaker_t::Init() <--------------------------------------------------" << endl;
88 cout <<
"--------------------------------------------------> StTrigTreeMaker_t::Make() <--------------------------------------------------" << endl;
92 Bool_t passesCuts = 1;
98 if( !mTriggerSet.empty() ){
101 std::set< UInt_t >::iterator iter = mTriggerSet.begin();
102 for( ; iter != mTriggerSet.end() && !passesCuts; ++iter )
103 passesCuts = trgSimMkr->isTrigger( (*iter) );
108 std::vector< UInt_t > trigIds;
109 const std::vector< int >& trigL0 = trgSimMkr->triggerIds();
112 for( UInt_t i=0; i<trigL0.size(); ++i )
113 if( trgSimMkr->isTrigger( (
id = trigL0[i] ) ) )
114 trigIds.push_back( static_cast< UInt_t >(
id ) );
116 mTrigSet->insert( trigIds );
126 const StTriggerId& l1trig =
event->triggerIdCollection().l1();
128 if( !mTriggerSet.empty() ){
131 std::set< UInt_t >::iterator iter = mTriggerSet.begin();
132 for( ; iter != mTriggerSet.end() && !passesCuts; ++iter )
133 passesCuts = l1trig.isTrigger( (*iter) );
137 const std::vector< UInt_t > &trigIds = l1trig.triggerIds();
138 mTrigSet->insert( trigIds );
145 cout <<
"--------------------------------------------------> fill (" << passesCuts <<
") <--------------------------------------------------" << endl;
152 cout <<
"--------------------------------------------------> end of StTrigTreeMaker_t::Make() <--------------------------------------------------" << endl;
161 cout <<
"--------------------------------------------------> StTrigTreeMaker_t::Clear() <--------------------------------------------------" << endl;
168 cout <<
"--------------------------------------------------> end of StTrigTreeMaker_t::Clear() <--------------------------------------------------" << endl;
177 cout <<
"--------------------------------------------------> StTrigTreeMaker_t::Finish() <--------------------------------------------------" << endl;
184 cout <<
"--------------------------------------------------> end of StTrigTreeMaker_t::Finish() <--------------------------------------------------" << endl;
Bool_t mIsMC
whether is Monte Carlo or data
void Clear(Option_t *opts="")
Clear for next event.
virtual ~StTrigTreeMaker_t()
deconstructor
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Int_t Finish()
Write everything to file.
Int_t Make()
Build an event.
TFile * mFile
TFiles/TTrees for writing.
std::string mFilename
filenames
StTrigTreeMaker_t(const Char_t *myName="TrigTreeMaker", const Char_t *filenameOut="trigTree.root", Bool_t isMC=0, Bool_t useSimu=1)
constructor
Bool_t mUseSimuTrg
whether to use MuDst (hardware) triggers or simulated (software) triggers