StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrigCounter.cxx
1 /*
2  * Created by S. Gliske, May 2012
3  *
4  * Description: see header
5  *
6  */
7 
8 #include <Rtypes.h>
9 
10 #include "StMuDSTMaker/COMMON/StMuDst.h"
11 #include "StMuDSTMaker/COMMON/StMuEvent.h"
12 
13 #include "StTrigCounter.h"
14 
15 StTrigCounter::StTrigCounter( const Char_t *myName, Int_t trigID ) : StMaker( myName ), mTrigID( trigID ), mNumEvents(0), mNumEventsInCut(0) {
16  // nothing else
17 };
18 
19 
22  // nothing else
23 };
24 
27  Int_t ierr = kStOk;
28 
29  // nothing else
30 
31  return ierr;
32 };
33 
34 
37  Int_t ierr = kStOk;
38 
39  // check trigger
40  const StMuDst* muDst = (const StMuDst*)GetInputDS( "MuDst" );
41  if( muDst ){
42  StMuEvent *event = muDst->event();
43 
44  if( event && event->triggerIdCollection().nominal().isTrigger( mTrigID ) ){
45  ++mNumEvents;
46 
47  UInt_t bbcOnlineTimeDiff = event->bbcTriggerDetector().onlineTimeDifference()/32;
48  if( bbcOnlineTimeDiff >= 6 && bbcOnlineTimeDiff <= 10 )
49  ++mNumEventsInCut;
50  };
51  };
52 
53  return ierr;
54 };
55 
57 void StTrigCounter::Clear(Option_t *opts ){
58  // nothing to do
59 };
60 
62  cout << "status: event " << GetEventNumber() << ", counts for trigger ID " << mTrigID << " are " << mNumEventsInCut << " and " << mNumEvents << endl;
63 };
64 
67  cout << "RESULT: Counts for trigger ID " << mTrigID << " are " << mNumEventsInCut << " and " << mNumEvents << endl;
68 
69  return kStOk;
70 };
71 
72 
74 UInt_t StTrigCounter::getTrigID() const {
75  return mTrigID;
76 };
77 
78 Int_t StTrigCounter::getNumEventsTot() const {
79  return mNumEvents;
80 };
81 
82 Int_t StTrigCounter::getNumEventsInCut() const {
83  return mNumEventsInCut;
84 };
85 
86 ClassImp( StTrigCounter );
87 
88 /*
89  * $Id: StTrigCounter.cxx,v 1.2 2013/02/28 23:37:18 sgliske Exp $
90  * $Log: StTrigCounter.cxx,v $
91  * Revision 1.2 2013/02/28 23:37:18 sgliske
92  * Updated so result of StTrigCounter gets saved in EEmcTree Part1
93  * rather than just being output to the console (log file)
94  *
95  * Revision 1.1 2012/12/17 20:58:56 sgliske
96  * first added to official StEEmcPool
97  *
98  *
99  */
Int_t Finish()
Write everything to file.
void printStatus()
monitering status
UInt_t getTrigID() const
get values
Int_t Init()
Initialize.
void Clear(Option_t *opts="")
Clear for next event.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
Int_t Make()
Build an event.
StTrigCounter(const Char_t *myName, Int_t trigID=117001)
constructor
Definition: Stypes.h:41
virtual ~StTrigCounter()
deconstructor