StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Run2006DataTriggerMaker.C
1 class StMuDstMaker;
2 class StChain *chain;
3 int total=0;
4 #include <string>
5 #include <map>
6 
7 void Run2006DataTriggerMaker(const char *dir ="",
8  const char *file="/star/u/balewski/2007-EEtrig-simu/R7098001.lis",
9  const char *filter = "")
10 {
11  int nevents = 10;
12 
13  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
14  loadSharedLibraries();
15  gSystem->Load("StTpcDb");
16  gSystem->Load("StDetectorDbMaker");
17  gSystem->Load("StDbUtilities");
18  gSystem->Load("StMcEvent");
19  gSystem->Load("StMcEventMaker");
20  gSystem->Load("StDaqLib");
21  gSystem->Load("StEmcRawMaker");
22  gSystem->Load("StEmcADCtoEMaker");
23  gSystem->Load("StPreEclMaker");
24  gSystem->Load("StEpcMaker");
25  gSystem->Load("StEmcUtil");
26  gSystem->Load("StDbBroker");
27  gSystem->Load("St_db_Maker");
28  gSystem->Load("StEEmcUtil");
29  gSystem->Load("StEEmcDbMaker");
30  gSystem->Load("StEmcTriggerMaker");
31 
32  double pi = atan(1.0)*4.0;
33  cout << " loading done " << endl;
34 
35  chain= new StChain("StChain");
36  chain->SetDebug(1);
37  gMessMgr->SwitchOff("D");
38  gMessMgr->SwitchOff("I");
39 
40 
42  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,1e6,"MuDst");
43 
44  //Database -- get a real calibration from the database
45  St_db_Maker* dbMk = new St_db_Maker("StarDb","MySQL:StarDb","MySQL:StarDb","$STAR/StarDb");
46 
47  //Database interface
48  StDetectorDbMaker* detDbMk = new StDetectorDbMaker();
49 
50  //Endcap DB
51  StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
52 
53  //BEMC adc->Et
54  StEmcADCtoEMaker *adc = new StEmcADCtoEMaker(); // this will just convert what's in MuDst to ADC, use for data only!
55 
56  //StEmcTrigger
57  StEmcTriggerMaker *emcTrig = new StEmcTriggerMaker("bemctrigger");
58 
59  chain->Init();
60  chain->PrintInfo();
61  chain->ls(3);
62  TChain* fileChain = muDstMaker->chain();
63 
64 
65  int BL1_ADC[6];
66  int hold=-1;
67  for (Int_t iev=0;iev<nevents; iev++) {
68  cout << "****************************************** " << endl;
69  cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<nevents<<endl;
70  cout << "*************************1***************** " << endl;
71  chain->Clear();
72  int iret = chain->Make(iev);
73  total++;
74  if (iret) {
75  cout << "Bad return code!" << endl;
76  break;
77  }
78 
79  cout<<" "<<endl;
80  map<int,int>::iterator iter;
81  map<int,int> tower;
82  map<int,int> tpatch;
83  map<int,int> jpatch;
84 
85  cout<<" 127212 ht2 (matrix0)="<<emcTrig->isTrigger(127212)<<endl;
86  tower=emcTrig->barrelTowersAboveThreshold(127212);
87  cout<<"Total #'s of towers="<<tower.size()<<endl;
88  for ( iter=tower.begin();iter !=tower.end(); iter++){
89  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
90  }
91 
92  cout<<endl;
93  cout<<endl;
94  cout<<" 127213 ht2 (matrix1)="<<emcTrig->isTrigger(127213)<<endl;
95  tower=emcTrig->barrelTowersAboveThreshold(127213);
96  cout<<"Total #'s of towers="<<tower.size()<<endl;
97  for ( iter=tower.begin();iter !=tower.end(); iter++){
98  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
99  }
100 
101  cout<<endl;
102  cout<<endl;
103  cout<<" 137213 ht2 (matrix3) ="<<emcTrig->isTrigger(127213)<<endl;
104  tower=emcTrig->barrelTowersAboveThreshold(127213);
105  cout<<"Total #'s of towers="<<tower.size()<<endl;
106  for ( iter=tower.begin();iter !=tower.end(); iter++){
107  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
108  }
109 
110  cout<<endl;
111  cout<<endl;
112  cout<<" 127501 jp0 (matrix1)="<<emcTrig->isTrigger(127501)<<endl;
113  jpatch=emcTrig->barrelJetPatchesAboveThreshold(127501);
114  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
115  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
116  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
117  }
118 
119  cout<<endl;
120  cout<<endl;
121  cout<<" 137501 jp0 (matrix3) ="<<emcTrig->isTrigger(137501)<<endl;
122  jpatch=emcTrig->barrelJetPatchesAboveThreshold(137501);
123  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
124  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
125  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
126  }
127 
128  cout<<endl;
129  cout<<endl;
130  cout<<" 127221 jp1 (matrix1)="<<emcTrig->isTrigger(127221)<<endl;
131  jpatch=emcTrig->barrelJetPatchesAboveThreshold(127221);
132  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
133  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
134  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
135  }
136 
137  cout<<endl;
138  cout<<endl;
139  cout<<" 137221 jp1 (matrix2)="<<emcTrig->isTrigger(137221)<<endl;
140  jpatch=emcTrig->barrelJetPatchesAboveThreshold(137221);
141  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
142  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
143  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
144  }
145 
146  cout<<endl;
147  cout<<endl;
148  cout<<" 137222 jp1 (matrix3)="<<emcTrig->isTrigger(137222)<<endl;
149  jpatch=emcTrig->barrelJetPatchesAboveThreshold(127501);
150  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
151  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
152  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
153  }
154 
155  cout<<endl;
156  cout<<endl;
157  cout<<" 127821 http (matrix1)="<<emcTrig->isTrigger(127821)<<endl;
158  tpatch=emcTrig->barrelTriggerPatchesAboveThreshold(127821);
159  cout<<"Total #'s of tpatches="<<tpatch.size()<<endl;
160  for ( iter=tpatch.begin();iter !=tpatch.end(); iter++){
161  cout<<"tpatch id="<<iter->first<<" adc="<<iter->second<<endl;
162  }
163  tower=emcTrig->barrelTowersAboveThreshold(127821);
164  cout<<"Total #'s of towers="<<tower.size()<<endl;
165  for ( iter=tower.begin();iter !=tower.end(); iter++){
166  int triggerPatch = emcTrig->barrelTriggerPatchForTower(iter->first);
167  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<" tp (id,adc)=("<< triggerPatch << "," << tpatch[triggerPatch] << ")" <<endl;
168  }
169 
170  cout<<endl;
171  cout<<endl;
172  cout<<" 137821 http (matrix3) ="<<emcTrig->isTrigger(137821)<<endl;
173  tpatch=emcTrig->barrelTriggerPatchesAboveThreshold(137821);
174  cout<<"Total #'s of tpatches="<<tpatch.size()<<endl;
175  for ( iter=tpatch.begin();iter !=tpatch.end(); iter++){
176  cout<<"tpatch id="<<iter->first<<" adc="<<iter->second<<endl;
177  }
178  tower=emcTrig->barrelTowersAboveThreshold(137821);
179  cout<<"Total #'s of towers="<<tower.size()<<endl;
180  for ( iter=tower.begin();iter !=tower.end(); iter++){
181  int triggerPatch = emcTrig->barrelTriggerPatchForTower(iter->first);
182  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<" tp (id,adc)=("<< triggerPatch << "," << tpatch[triggerPatch] << ")" <<endl;
183  }
184 
185  cout<<endl;
186  cout<<endl;
187  cout<<" 137822 http (matrix4)="<<emcTrig->isTrigger(137822)<<endl;
188  tpatch=emcTrig->barrelTriggerPatchesAboveThreshold(137822);
189  cout<<"Total #'s of tpatches="<<tpatch.size()<<endl;
190  for ( iter=tpatch.begin();iter !=tpatch.end(); iter++){
191  cout<<"tpatch id="<<iter->first<<" adc="<<iter->second<<endl;
192  }
193  tower=emcTrig->barrelTowersAboveThreshold(137822);
194  cout<<"Total #'s of towers="<<tower.size()<<endl;
195  for ( iter=tower.begin();iter !=tower.end(); iter++){
196  int triggerPatch = emcTrig->barrelTriggerPatchForTower(iter->first);
197  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<" tp (id,adc)=("<< triggerPatch << "," << tpatch[triggerPatch] << ")" <<endl;
198  }
199 
200  cout<<endl;
201  cout<<endl;
202  cout<<" 117705 jpsi (matrix1)="<<emcTrig->isTrigger(117705)<<endl;
203  tower=emcTrig->barrelTowersAboveThreshold(117705);
204  cout<<"Total #'s of towers="<<tower.size()<<endl;
205  for ( iter=tower.begin();iter !=tower.end(); iter++){
206  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
207  }
208 
209  cout<<endl;
210  cout<<endl;
211  cout<<" 117602 upsilon (matrix1)="<<emcTrig->isTrigger(117602)<<endl;
212  tower=emcTrig->barrelTowersAboveThreshold(117602);
213  cout<<"Total #'s of towers="<<tower.size()<<endl;
214  for ( iter=tower.begin();iter !=tower.end(); iter++){
215  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
216  }
217 
218  cout<<endl;
219  cout<<endl;
220  cout<<" 137602 upsilon (matrix3)="<<emcTrig->isTrigger(137602)<<endl;
221  tower=emcTrig->barrelTowersAboveThreshold(137602);
222  cout<<"Total #'s of towers="<<tower.size()<<endl;
223  for ( iter=tower.begin();iter !=tower.end(); iter++){
224  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
225  }
226 
227 
228  cout<<endl;
229  cout<<endl;
230  cout<<" 127611 http-L2="<<emcTrig->isTrigger(127611)<<endl;
231 
232  cout<<endl;
233  cout<<endl;
234  cout<<" 127622 jp0-etot-L2="<<emcTrig->isTrigger(127622)<<endl;
235 
236  cout<<endl;
237  cout<<endl;
238  cout<<" 137622 jp0-etot-L2="<<emcTrig->isTrigger(137622)<<endl;
239 
240  for (int j=0;j<6;j++){
241  BL1_ADC[j]=0.0;
242  emcTrig->get2006BL1_ADC(j,&hold);
243  BL1_ADC[j]=hold;
244  cout<<" 2x1 Patch "<<j<<" = "<<BL1_ADC[j]<<endl;
245  }
246 
247 
248  }
249 
250  chain->Finish();
251  cout << "****************************************** " << endl;
252  cout << "total number of events " << total << endl;
253  cout << "****************************************** " << endl;
254 
255 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
virtual Int_t Finish()
Definition: StChain.cxx:85
map< int, int > barrelTriggerPatchesAboveThreshold(int trigId)
map contains (key,value) = (patchId,ADC) of all TP above DSM threshold. map is empty if threshold = 0...
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
map< int, int > barrelJetPatchesAboveThreshold(int trigId)
map contains (key,value) = (patchId,ADC) of all JP above DSM threshold. map is empty if threshold = 0...
virtual Int_t Make()
Definition: StChain.cxx:110
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426
map< int, int > barrelTowersAboveThreshold(int trigId)
map contains (key,value) = (softId,ADC) of all towers above DSM threshold. map is empty if threshold ...
int isTrigger(int trigId)
1==Yes,0==No,-1==Don&#39;t Know. Same convention holds for other methods where appropriate.