9 char *eemcSetupPath=
"/afs/rhic.bnl.gov/star/users/kocolosk/public/StarTrigSimuSetup/";
11 void rdMu2TrigSimu(
char *file=
"/star/data47/reco/pp200/pythia6_410/9_11gev/cdf_a/y2006c/gheisha_on/p07ic/rcf1309_*_2000evts.MuDst.root"){
18 int L2ConfigYear=2006;
23 TString outDir=
"./outL2/";
26 gROOT->LoadMacro(
"$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
27 loadSharedLibraries();
28 assert( !gSystem->Load(
"StDetectorDbMaker"));
29 assert( !gSystem->Load(
"StDbUtilities"));
30 assert( !gSystem->Load(
"StDbBroker"));
31 assert( !gSystem->Load(
"St_db_Maker"));
32 assert( !gSystem->Load(
"StEEmcUtil"));
33 assert( !gSystem->Load(
"StEEmcDbMaker"));
34 assert( !gSystem->Load(
"StDaqLib"));
35 assert( !gSystem->Load(
"StEmcRawMaker"));
36 assert( !gSystem->Load(
"StEmcADCtoEMaker"));
38 assert( !gSystem->Load(
"StMcEvent"));
39 assert( !gSystem->Load(
"StMcEventMaker"));
40 assert( !gSystem->Load(
"StEmcSimulatorMaker"));
41 assert( !gSystem->Load(
"StEEmcSimulatorMaker"));
42 assert( !gSystem->Load(
"StEpcMaker"));
44 assert( !gSystem->Load(
"StTriggerUtilities"));
46 gROOT->Macro(
"LoadLogger.C");
47 cout <<
" loading done " << endl;
54 geantFile.ReplaceAll(
"MuDst.root",
"geant.root");
55 printf(
"geantFile=%s\n", geantFile.Data());
57 ioMaker->SetFile(geantFile);
58 ioMaker->SetIOMode(
"r");
59 ioMaker->SetBranch(
"*",0,
"0");
60 ioMaker->SetBranch(
"geantBranch",0,
"r");
65 printf(
" Analyzing file=%s\n",file);
71 dbMk =
new St_db_Maker(
"StarDb",
"MySQL:StarDb",
"MySQL:StarDb",
"$STAR/StarDb");
73 dbMk =
new St_db_Maker(
"Calibrations",
"MySQL:Calibrations_emc");
78 if (flagMC) dbMk->SetDateTime(20060522, 55000);
81 TObjArray* HList=
new TObjArray;
88 if (flagMC && useBemc) {
90 if (bemcConfig == 1) {
95 if (flagMC==0 && useBemc){
97 if (bemcConfig == 1) {
103 if (flagMC==1 && useEemc){
112 simuTrig->setHList(HList);
113 simuTrig->setMC(flagMC);
116 simuTrig->useEemc(0);
117 simuTrig->eemc->setSetupPath(eemcSetupPath);
121 simuTrig->bemc->setConfig(bemcConfig);
124 if(flagMC && useEemc==2){
127 int eemcDsmSetup[20];
128 memset(eemcDsmSetup, 0,
sizeof(eemcDsmSetup));
136 simuTrig->eemc->setDsmSetup(eemcDsmSetup);
151 simL2Mk->setSetupPath(eemcSetupPath);
152 simL2Mk->setOutPath(outDir.Data());
153 if (flagMC) simL2Mk->setMC();
154 simuTrig->useL2(simL2Mk);
161 playMk->setConfig(playConfig);
162 playMk->setHList(HList);
168 for (Int_t iev=0;iev<nevents; iev++) {
169 cout <<
"\n****************************************** " << endl;
170 cout <<
"Working on eventNumber:\t" << iev <<
"\tof:\t"<<nevents<<endl;
171 cout <<
"****************************************** " << endl;
173 int iret = chain->
Make(iev);
176 cout <<
"Bad return code!" << endl;
180 int trigID[3]={127213,117211,137611};
185 if( l1trig.isTrigger(trigID[0])) {
186 cout<<
" SimuTrigger 127213 ="<<simuTrig->isTrigger(trigID[0])<<
" BEMC="<<simuTrig->bemc->
triggerDecision(trigID[0])<<
" L2="<<simuTrig->lTwo->
triggerDecision(trigID[0])<<endl;
188 if( l1trig.isTrigger(trigID[1])) {
189 cout<<
" SimuTrigger 117211 ="<<simuTrig->isTrigger(trigID[1])<<
" BEMC="<<simuTrig->bemc->
triggerDecision(trigID[1])<<
" L2="<<simuTrig->lTwo->
triggerDecision(trigID[1])<<endl;
191 if( l1trig.isTrigger(trigID[2])) {
192 cout<<
" SimuTrigger 137611 ="<<simuTrig->isTrigger(trigID[2])<<
" BEMC="<<simuTrig->bemc->
triggerDecision(trigID[2])<<
" L2="<<simuTrig->lTwo->
triggerDecision(trigID[2])<<endl;
197 if (trigResult.bemcDecision()==1){
198 vector<short> towerId = trigResult.highTowerIds();
199 for (
unsigned i=0; i<towerId.size(); i++) {
200 cout<<
" LO Trigger BEMC Tower="<<towerId[i]<<
" adc="<<trigResult.
highTowerAdc(towerId[i])<<endl;
205 if (trigResult.l2Decision()==1){
206 vector<short> towerId = trigResult.highTowerIds();
207 for (
unsigned i=0; i<towerId.size(); i++) {
208 cout<<
" L2 Trigger BEMC Tower="<<towerId[i]<<
" adc="<<trigResult.
highTowerAdc(towerId[i])<<endl;
216 cout <<
"****************************************** " << endl;
217 cout <<
"total number of events " << total << endl;
218 cout <<
"****************************************** " << endl;
221 if (outputL2Histo==1) {
224 printf(
"=%s=\n",fileMu.Data());
225 if(fileMu.Contains(
".lis")) fileMu.ReplaceAll(
".lis",
".trgSim");
226 if(fileMu.Contains(
".MuDst.root")) fileMu.ReplaceAll(
".MuDst.root",
".trgSim");
227 TString outF=outDir+fileMu;
229 printf(
"=%s=\n",outF.Data());
230 hf=
new TFile(outF,
"recreate");
233 printf(
"\n Histo saved -->%s<\n",outF.Data());
236 printf(
"\n Failed to open Histo-file -->%s<, continue\n",outF.Data());
250 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
254 int myTrgList[mxTr] ={127580,127551,127271,127571,127821,127831,127575,127622,127221,127611,117705,127501,127652};
256 char* myTrgListN[mxTr]={
"eemc-http*116",
"eemc-jp0-mb*221",
"eemc-jp1-mb*1",
"bemc-jp1*433",
257 "bemc-http-mb-fast*1",
"eemc-http-mb-fast*1",
"bemc-jp0-etot*979" ,
258 "bemc-jp0-etot-mb-L2jet*2",
"bemc-jp1-mb*1",
"bemc-http-mb-l2gamma*1",
259 "jpsi-mb*20",
"bemc-jp0-mb*909",
"eemc-jp0-etot-mb-L2jet*2"};
260 int nR[mxTr],nS[mxTr],nRS[mxTr];
261 memset(nR,0,
sizeof(nR));
262 memset(nS,0,
sizeof(nR));
263 memset(nRS,0,
sizeof(nR));
266 cout<<Form(
" Simu trgSize=%d, firedID:", simuTrig->mTriggerList.size())<<endl;
268 for(j=0; j<simuTrig->mTriggerList.size();j++)
269 cout<<Form(
"s%d, ", simuTrig->mTriggerList[j]);
278 vector<unsigned int> trgL=tic.nominal().triggerIds();
279 cout<<Form(
" real trgSize=%d, firedID:",trgL.size());
280 for(j=0; j<trgL.size();j++)
281 cout<<Form(
"r%d, ", trgL[j]);
285 for(j=0;j<mxTr;j++) {
286 int trgId=myTrgList[j];
287 bool realT=tic.nominal().isTrigger(trgId);
288 bool simT=simuTrig->isTrigger(trgId);
290 if(realT && simT) nRS[j]++;
292 cout <<Form(
"C:j=%d trg=%d R=%d S=%d RS=%d",j, myTrgList[j],realT,simT,realT && simT )<<endl;
295 for(j=0;j<mxTr;j++) {
296 cout <<Form(
"SUM trg=%d nR=%d nS=%d nRS=%d %s", myTrgList[j], nR[j],nS[j],nRS[j],myTrgListN[j])<<endl;
void setSamplingFraction(Float_t f)
Changes the sampling fraction from the default in the fast simulator.
void setAddPed(Bool_t a=true)
Add pedestal offsets from DB.
virtual void Clear(Option_t *option="")
User defined functions.
void setCheckStatus(StDetectorId det, bool flag)
int highTowerAdc(short towerId) const
returns DSM ADC if above trigger threshold, otherwise -1
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
StTriggerSimuDecision triggerDecision(int trigId)
like isTrigger(), but returns kDoNotCare if detector isn't a part of the given trigId ...
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
void setSmearPed(Bool_t s=true)
Smear the pedestal with sigma from DB.
const StTriggerSimuResult & detailedResult(int trigId)
returns object containing detailed information about simulation of given trigger
StTriggerSimuDecision triggerDecision(int trigId)
like isTrigger(), but returns kDoNotCare if detector isn't a part of the given trigId ...
Collection of trigger ids as stored in MuDst.
void setCalibSpread(StDetectorId det, float spread)
smear simulator calibration coefficients using Gaussian with this RMS.
void setCheckStatus(StDetectorId det, int flag, const char *option="")