StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBbcTriggerSimu.cxx
1 //Author :: Renee Fatemi
2 //Emulates BBC trigger
3 
4 //StEvent
5 #include "StEventTypes.h"
6 
7 //StMuDSTMaker
8 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
9 
10 //StBBC
11 #include "StTriggerUtilities/Bbc/StBbcTriggerSimu.h"
12 
13 ClassImp(StBbcTriggerSimu)
14 //==================================================
15 //==================================================
16 
18  BBCadcNum=48;
19 }
20 //==================================================
21 //==================================================
22 
23 StBbcTriggerSimu::~StBbcTriggerSimu(){
24 }
25 //==================================================
26 //==================================================
27 void
28 StBbcTriggerSimu::Init(){
29 
30  LOG_INFO <<Form("Bbc::Init() MC_flag=%d, adcThres=%d",mMCflag,AdcTrigThresh)<<endm;
31  if(mMCflag) LOG_WARN <<"Bbc:: TDC thresholds not implemented"<<endm;
32 }
33 
34 //==================================================
35 //==================================================
36 void StBbcTriggerSimu::Clear(){
37 
38  bbcTrig=kNo;
39  Wbbc=0;
40  Ebbc=0;
41  for (int i=0;i<BBCadcNum;i++) {
42  BBCadc[i]=0;
43  }
44 
45 }
46 //==================================================
47 //==================================================
48 
49 void StBbcTriggerSimu::Make()
50 {
51 
52  if (mSource == "MuDst") {
53  StMuDst* mudst = (StMuDst*)StMaker::GetChain()->GetDataSet("MuDst");
54  if (mudst) Make(mudst);
55  }
56  else if (mSource == "StEvent") {
57  StEvent* event = (StEvent*)StMaker::GetChain()->GetDataSet("StEvent");
58  if (event) Make(event);
59  }
60  else {
61  LOG_ERROR << "StBbcTriggerSimu - Unknown source \"" << mSource << "\"" << endm;
62  }
63 
64  if ((Ebbc==1)&&(Wbbc==1)) bbcTrig=kYes;
65 
66  LOG_DEBUG<<" Wbbc ="<<Wbbc<<" Ebbc="<<Ebbc<<" bbcTrig="<<bbcTrig<<endm;
67  for (int i=0;i<BBCadcNum;i++) {
68  LOG_DEBUG<<i<<" adc="<<BBCadc[i]<<endm;
69  }
70 
71 }
72 
73 void StBbcTriggerSimu::Make(StMuDst*)
74 {
75  StBbcTriggerDetector& bbc = StMuDst::event()->bbcTriggerDetector();
76  Make(bbc);
77 }
78 
79 void StBbcTriggerSimu::Make(StEvent* event)
80 {
81  StTriggerDetectorCollection* trig = event->triggerDetectorCollection();
82  if (trig) {
83  StBbcTriggerDetector& bbc = trig->bbc();
84  Make(bbc);
85  }
86 }
87 
88 void StBbcTriggerSimu::Make(StBbcTriggerDetector& bbc)
89 {
90  bbc.setYear(StMaker::GetChain()->GetDBTime().GetYear());
91 
92  for (UInt_t pmt=0; pmt<bbc.numberOfPMTs(); pmt++) {
93 
94  BBCadc[pmt]=bbc.adc(pmt);
95 
96  int bbcadc=bbc.adc(pmt);
97 
98  if (bbcadc>AdcTrigThresh) {
99  if (pmt<16) Ebbc=1;
100  if (23<pmt && pmt<40) Wbbc=1;
101  }
102  }
103 }
104 
105 
106 //
107 // $Log: StBbcTriggerSimu.cxx,v $
108 // Revision 1.9 2010/07/07 16:48:21 pibero
109 // StBbcTriggerSimu sets year from DB maker to StBbcTrigggerDetector container
110 //
111 // Revision 1.8 2010/01/08 15:18:37 pibero
112 // Default input source is "MuDst" for all subdetectors.
113 //
114 // Revision 1.7 2010/01/08 06:38:54 pibero
115 // Set default input source to "MuDst" in constructor.
116 //
117 // Revision 1.6 2010/01/08 06:32:48 pibero
118 // Set default input source to "MuDst" in constructor.
119 //
120 // Revision 1.5 2009/12/22 18:11:01 pibero
121 // Added ability to set input source (MuDst or StEvent) for BBC trigger simulator.
122 //
123 // Revision 1.4 2007/11/08 20:59:43 kocolosk
124 // subdet isTrigger returns a bool
125 // triggerDecision returns enumerator including kDoNotCare
126 //
127 // Revision 1.3 2007/07/23 02:59:56 balewski
128 // cleanup, bbc for M-C still not working
129 //
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320