StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Run2006SimuTriggerMaker.C
1 class StMuDstMaker;
2 class StChain *chain;
3 int total=0;
4 #include <string>
5 #include <map>
6 
7 void Run2006SimuTriggerMaker(const char *dir ="",
8  const char* file="/star/data32/reco/pp200/pythia6_205/above_35gev/cdf_a/y2004y/gheisha_on/p05ih/rcf1230_10_4000evts.MuDst.root",
9  const char *fname="/star/data32/reco/pp200/pythia6_205/above_35gev/cdf_a/y2004y/gheisha_on/p05ih/rcf1230_10_4000evts.event.root",
10  const char *filter = "")
11 {
12  int nevents = 10;
13 
14  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
15  loadSharedLibraries();
16  gSystem->Load("StTpcDb");
17  gSystem->Load("StDetectorDbMaker");
18  gSystem->Load("StDbUtilities");
19  gSystem->Load("StMcEvent");
20  gSystem->Load("StMcEventMaker");
21  gSystem->Load("StDaqLib");
22  gSystem->Load("StEmcRawMaker");
23  gSystem->Load("StEmcADCtoEMaker");
24  gSystem->Load("StPreEclMaker");
25  gSystem->Load("StEpcMaker");
26  gSystem->Load("StEmcSimulatorMaker");
27  gSystem->Load("StEmcUtil");
28  gSystem->Load("StDbBroker");
29  gSystem->Load("St_db_Maker");
30  gSystem->Load("StEEmcUtil");
31  gSystem->Load("StEEmcDbMaker");
32  gSystem->Load("StEmcTriggerMaker");
33 
34  double pi = atan(1.0)*4.0;
35  cout << " loading done " << endl;
36 
37  chain= new StChain("StChain");
38  chain->SetDebug(1);
39  gMessMgr->SwitchOff("D");
40  gMessMgr->SwitchOff("I");
41 
42  StIOMaker* ioMaker = new StIOMaker();
43  ioMaker->SetFile(fname);
44  ioMaker->SetIOMode("r");
45  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
46  ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
47 
48  class StMcEventMaker *mcEventMaker = new StMcEventMaker();
49  mcEventMaker->doPrintEventInfo = false;
50  mcEventMaker->doPrintMemoryInfo = false;
51 
53  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,1e6,"MuDst");
54 
55  //Database -- get a real calibration from the database
56  St_db_Maker* dbMk = new St_db_Maker("StarDb","MySQL:StarDb","MySQL:StarDb","$STAR/StarDb");
57  dbMk->SetDateTime(20060506,214129 ); // for simulation
58 
59  //to use ideal ideal gains/status/calib uncommment correct line below
60  //dbMk->SetFlavor("sim","bemcPed");
61  //dbMk->SetFlavor("sim","bemcStatus");
62  //dbMk->SetFlavor("sim","bemcCalib");
63  //dbMk->SetFlavor("sim","bemcGain");
64  //dbMk->SetFlavor("sim","eemcPMTcal");
65  //dbMk->SetFlavor("sim","eemcPIXcal");
66 
67  chain->ls(3);
68  //Database interface
69  StDetectorDbMaker* detDbMk = new StDetectorDbMaker();
70 
71  //Endcap DB
72  StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
73 
74  //StEmcADCtoEMaker *adc = new StEmcADCtoEMaker(); // this will just convert what's in MuDst to ADC, use for data only!
75  StEmcSimulatorMaker* emcSim = new StEmcSimulatorMaker(); //use this instead to "redo" converstion from geant->adc
76  emcSim->setCalibSpread(kBarrelEmcTowerId, 0.15);
77  StPreEclMaker* preEcl = new StPreEclMaker(); //need this to fill new StEvent information
78 
79  //StEmcTrigger
80  StEmcTriggerMaker *emcTrig = new StEmcTriggerMaker("bemctrigger");
81 
82  chain->Init();
83  chain->PrintInfo();
84 
85  chain->ls(3);
86  TChain* fileChain = muDstMaker->chain();
87 
88 
89  int BL1_ADC[6];
90  int hold=-1;
91  for (Int_t iev=0;iev<nevents; iev++) {
92  cout << "****************************************** " << endl;
93  cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<nevents<<endl;
94  cout << "*************************1***************** " << endl;
95  chain->Clear();
96  int iret = chain->Make(iev);
97  total++;
98  if (iret) {
99  cout << "Bad return code!" << endl;
100  break;
101  }
102 
103  cout<<" "<<endl;
104  map<int,int>::iterator iter;
105  map<int,int> tower;
106  map<int,int> tpatch;
107  map<int,int> jpatch;
108 
109  cout<<endl;
110  cout<<endl;
111  cout<<" 1101 ht1 = "<<emcTrig->isTrigger(1101)<<" = "<<emcTrig->is2003HT1()<<endl;
112  tower=emcTrig->barrelTowersAboveThreshold(1101);
113  cout<<"Total #'s of towers="<<tower.size()<<endl;
114  for ( iter=tower.begin();iter !=tower.end(); iter++){
115  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
116  cout<<"old tower id="<<emcTrig->get2003HT1_ID()<<" adc="<<emcTrig->get2003HT1_ADC()<<endl;
117  }
118 
119  cout<<endl;
120  cout<<endl;
121  cout<<" 2101 ht1 = "<<emcTrig->isTrigger(2201)<<" = "<<emcTrig->is2003HT1()<<endl;
122  tower=emcTrig->barrelTowersAboveThreshold(2201);
123  cout<<"Total #'s of towers="<<tower.size()<<endl;
124  for ( iter=tower.begin();iter !=tower.end(); iter++){
125  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
126  cout<<"old tower id="<<emcTrig->get2003HT1_ID()<<" adc="<<emcTrig->get2003HT1_ADC()<<endl;
127  }
128 
129  cout<<endl;
130  cout<<endl;
131  cout<<" 2202 ht2 = "<<emcTrig->isTrigger(2202)<<" = "<<emcTrig->is2003HT2()<<endl;
132  tower=emcTrig->barrelTowersAboveThreshold(2202);
133  cout<<"Total #'s of towers="<<tower.size()<<endl;
134  for ( iter=tower.begin();iter !=tower.end(); iter++){
135  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
136  cout<<"old tower id="<<emcTrig->get2003HT2_ID()<<" adc="<<emcTrig->get2003HT2_ADC()<<endl;
137  }
138 
139  cout<<endl;
140  cout<<endl;
141  cout<<" 45201 ht1 = "<<emcTrig->isTrigger(45201)<<" = "<<emcTrig->is2004HT1()<<endl;
142  tower=emcTrig->barrelTowersAboveThreshold(45201);
143  cout<<"Total #'s of towers="<<tower.size()<<endl;
144  for ( iter=tower.begin();iter !=tower.end(); iter++){
145  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
146  cout<<"old tower id="<<emcTrig->get2004HT1_ID()<<" adc="<<emcTrig->get2004HT1_ADC()<<endl;
147  }
148 
149  cout<<endl;
150  cout<<endl;
151  cout<<" 45202 ht1 = "<<emcTrig->isTrigger(45202)<<" = "<<emcTrig->is2004HT2()<<endl;
152  tower=emcTrig->barrelTowersAboveThreshold(45202);
153  cout<<"Total #'s of towers="<<tower.size()<<endl;
154  for ( iter=tower.begin();iter !=tower.end(); iter++){
155  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
156  cout<<"old tower id="<<emcTrig->get2004HT2_ID()<<" adc="<<emcTrig->get2004HT2_ADC()<<endl;
157  }
158 
159  cout<<endl;
160  cout<<endl;
161  cout<<" 45206 jp1 = "<<emcTrig->isTrigger(45206)<<" = "<<emcTrig->is2004JP1()<<endl;
162  jpatch=emcTrig->barrelJetPatchesAboveThreshold(45206);
163  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
164  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
165  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
166  cout<<"old patch id="<<emcTrig->get2004JP1_ID()<<" adc="<<emcTrig->get2004JP1_ADC()<<endl;
167  }
168 
169  cout<<endl;
170  cout<<endl;
171  cout<<" 45207 jp2 = "<<emcTrig->isTrigger(45207)<<" = "<<emcTrig->is2004JP2()<<endl;
172  jpatch=emcTrig->barrelJetPatchesAboveThreshold(45207);
173  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
174  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
175  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
176  cout<<"old patch id="<<emcTrig->get2004JP2_ID()<<" adc="<<emcTrig->get2004JP2_ADC()<<endl;
177  }
178 
179  cout<<endl;
180  cout<<endl;
181  cout<<" 127212 ht2 (matrix0)="<<emcTrig->isTrigger(127212)<<endl;
182  tower=emcTrig->barrelTowersAboveThreshold(127212);
183  cout<<"Total #'s of towers="<<tower.size()<<endl;
184  for ( iter=tower.begin();iter !=tower.end(); iter++){
185  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
186  }
187 
188  cout<<endl;
189  cout<<endl;
190  cout<<" 127213 ht2 (matrix1)="<<emcTrig->isTrigger(127213)<<endl;
191  tower=emcTrig->barrelTowersAboveThreshold(127213);
192  cout<<"Total #'s of towers="<<tower.size()<<endl;
193  for ( iter=tower.begin();iter !=tower.end(); iter++){
194  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
195  }
196 
197  cout<<endl;
198  cout<<endl;
199  cout<<" 137213 ht2 (matrix3) ="<<emcTrig->isTrigger(127213)<<endl;
200  tower=emcTrig->barrelTowersAboveThreshold(127213);
201  cout<<"Total #'s of towers="<<tower.size()<<endl;
202  for ( iter=tower.begin();iter !=tower.end(); iter++){
203  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
204  }
205 
206  cout<<endl;
207  cout<<endl;
208  cout<<" 127501 jp0 (matrix1)="<<emcTrig->isTrigger(127501)<<endl;
209  jpatch=emcTrig->barrelJetPatchesAboveThreshold(127501);
210  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
211  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
212  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
213  }
214 
215  cout<<endl;
216  cout<<endl;
217  cout<<" 137501 jp0 (matrix3) ="<<emcTrig->isTrigger(137501)<<endl;
218  jpatch=emcTrig->barrelJetPatchesAboveThreshold(137501);
219  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
220  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
221  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
222  }
223 
224  cout<<endl;
225  cout<<endl;
226  cout<<" 127221 jp1 (matrix1)="<<emcTrig->isTrigger(127221)<<endl;
227  jpatch=emcTrig->barrelJetPatchesAboveThreshold(127221);
228  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
229  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
230  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
231  }
232 
233  cout<<endl;
234  cout<<endl;
235  cout<<" 137221 jp1 (matrix2)="<<emcTrig->isTrigger(137221)<<endl;
236  jpatch=emcTrig->barrelJetPatchesAboveThreshold(137221);
237  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
238  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
239  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
240  }
241 
242  cout<<endl;
243  cout<<endl;
244  cout<<" 137222 jp1 (matrix3)="<<emcTrig->isTrigger(137222)<<endl;
245  jpatch=emcTrig->barrelJetPatchesAboveThreshold(127501);
246  cout<<"Total #'s of jpatches="<<jpatch.size()<<endl;
247  for ( iter=jpatch.begin();iter !=jpatch.end(); iter++){
248  cout<<"jpatch id="<<iter->first<<" adc="<<iter->second<<endl;
249  }
250 
251  cout<<endl;
252  cout<<endl;
253  cout<<" 127821 http (matrix1)="<<emcTrig->isTrigger(127821)<<endl;
254  tpatch=emcTrig->barrelTriggerPatchesAboveThreshold(127821);
255  cout<<"Total #'s of tpatches="<<tpatch.size()<<endl;
256  for ( iter=tpatch.begin();iter !=tpatch.end(); iter++){
257  cout<<"tpatch id="<<iter->first<<" adc="<<iter->second<<endl;
258  }
259  tower=emcTrig->barrelTowersAboveThreshold(127821);
260  cout<<"Total #'s of towers="<<tower.size()<<endl;
261  for ( iter=tower.begin();iter !=tower.end(); iter++){
262  int triggerPatch = emcTrig->barrelTriggerPatchForTower(iter->first);
263  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<" tp (id,adc)=("<< triggerPatch << "," << tpatch[triggerPatch] << ")" <<endl;
264  }
265 
266  cout<<endl;
267  cout<<endl;
268  cout<<" 137821 http (matrix3) ="<<emcTrig->isTrigger(137821)<<endl;
269  tpatch=emcTrig->barrelTriggerPatchesAboveThreshold(137821);
270  cout<<"Total #'s of tpatches="<<tpatch.size()<<endl;
271  for ( iter=tpatch.begin();iter !=tpatch.end(); iter++){
272  cout<<"tpatch id="<<iter->first<<" adc="<<iter->second<<endl;
273  }
274  tower=emcTrig->barrelTowersAboveThreshold(137821);
275  cout<<"Total #'s of towers="<<tower.size()<<endl;
276  for ( iter=tower.begin();iter !=tower.end(); iter++){
277  int triggerPatch = emcTrig->barrelTriggerPatchForTower(iter->first);
278  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<" tp (id,adc)=("<< triggerPatch << "," << tpatch[triggerPatch] << ")" <<endl;
279  }
280 
281  cout<<endl;
282  cout<<endl;
283  cout<<" 137822 http (matrix4)="<<emcTrig->isTrigger(137822)<<endl;
284  tpatch=emcTrig->barrelTriggerPatchesAboveThreshold(137822);
285  cout<<"Total #'s of tpatches="<<tpatch.size()<<endl;
286  for ( iter=tpatch.begin();iter !=tpatch.end(); iter++){
287  cout<<"tpatch id="<<iter->first<<" adc="<<iter->second<<endl;
288  }
289  tower=emcTrig->barrelTowersAboveThreshold(137822);
290  cout<<"Total #'s of towers="<<tower.size()<<endl;
291  for ( iter=tower.begin();iter !=tower.end(); iter++){
292  int triggerPatch = emcTrig->barrelTriggerPatchForTower(iter->first);
293  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<" tp (id,adc)=("<< triggerPatch << "," << tpatch[triggerPatch] << ")" <<endl;
294  }
295 
296  cout<<endl;
297  cout<<endl;
298  cout<<" 117705 jpsi (matrix1)="<<emcTrig->isTrigger(117705)<<endl;
299  tower=emcTrig->barrelTowersAboveThreshold(117705);
300  cout<<"Total #'s of towers="<<tower.size()<<endl;
301  for ( iter=tower.begin();iter !=tower.end(); iter++){
302  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
303  }
304 
305  cout<<endl;
306  cout<<endl;
307  cout<<" 117602 upsilon (matrix1)="<<emcTrig->isTrigger(117602)<<endl;
308  tower=emcTrig->barrelTowersAboveThreshold(117602);
309  cout<<"Total #'s of towers="<<tower.size()<<endl;
310  for ( iter=tower.begin();iter !=tower.end(); iter++){
311  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
312  }
313 
314  cout<<endl;
315  cout<<endl;
316  cout<<" 137602 upsilon (matrix3)="<<emcTrig->isTrigger(137602)<<endl;
317  tower=emcTrig->barrelTowersAboveThreshold(137602);
318  cout<<"Total #'s of towers="<<tower.size()<<endl;
319  for ( iter=tower.begin();iter !=tower.end(); iter++){
320  cout<<"tower id="<<iter->first<<" adc="<<iter->second<<endl;
321  }
322 
323 
324  cout<<endl;
325  cout<<endl;
326  cout<<" 127611 http-L2="<<emcTrig->isTrigger(127611)<<endl;
327 
328  cout<<endl;
329  cout<<endl;
330  cout<<" 127622 jp0-etot-L2="<<emcTrig->isTrigger(127622)<<endl;
331 
332  cout<<endl;
333  cout<<endl;
334  cout<<" 137622 jp0-etot-L2="<<emcTrig->isTrigger(137622)<<endl;
335 
336  for (int j=0;j<6;j++){
337  BL1_ADC[j]=0.0;
338  emcTrig->get2006BL1_ADC(j,&hold);
339  BL1_ADC[j]=hold;
340  cout<<" 2x1 Patch "<<j<<" = "<<BL1_ADC[j]<<endl;
341  }
342 
343 
344  }
345 
346  chain->Finish();
347  cout << "****************************************** " << endl;
348  cout << "total number of events " << total << endl;
349  cout << "****************************************** " << endl;
350 
351 }
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
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...
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
Bool_t doPrintMemoryInfo
lots of screen output
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.
void setCalibSpread(StDetectorId det, float spread)
smear simulator calibration coefficients using Gaussian with this RMS.