StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcSpin.C
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M University
4 // 5 December 2009
5 //
6 // Example macro to use the BFC trigger filter maker.
7 // Takes as input fzd file, then processes EMC response.
8 // If event fires selected bits from EMC layer 2 DSM
9 // (which corresponds to selecting triggers), then
10 // BFC reconstruction continues. Otherwise, event
11 // is skipped. Substantial savings in processing
12 // time and disk space can be achieved when
13 // reconstruction of complex detectors like the
14 // TPC is skipped for uninteresting events.
15 //
16 
17 class StBFChain;
18 StBFChain* chain = 0;
19 
20 void bfcSpin(int nevents = 2000,
21  const char* chainopt = "tpcrs fss y2009a IAna tpcI fcf ftpc Tree logger ITTF Sti VFPPV bbcSim tofsim tags emcY2 EEfs evout -dstout IdTruth geantout big fzin MiniMcMk clearmem eemcDb beamLine sdt20090628.053220",
22  const char* fzfile = "/star/u/mattheww/vmstuff/filterprep/TriggerFilter/testC8__27721041.fzd")
23 {
24  gROOT->LoadMacro("bfc.C");
25  bfc(-1,chainopt,fzfile);
26 
27  // We want to achieve the following ordering for makers:
28  // 1. BBC simulator
29  // 2. EMC makers (emcY2+eefs)
30  // 3. EEMC slow simulator
31  // 4. Pythia event maker
32  // 5. Trigger simulator
33  // 6. Trigger filter
34  // 7. TPC maker
35 
36  // Use full BEMC detector
37  StEmcSimulatorMaker* emcSim = (StEmcSimulatorMaker*)chain->GetMaker("EmcSimulator");
38  emcSim->setCheckStatus(kBarrelEmcTowerId,false);
39  emcSim->setMakeFullDetector(kBarrelEmcTowerId,true);
40  emcSim->setDoZeroSuppression(kBarrelEmcTowerId,false);
41 
42  // Use full EEMC detector
43  StEEmcFastMaker* eefs = dynamic_cast<StEEmcFastMaker*>(chain->GetMaker("eefs"));
44  assert(eefs);
45  eefs->UseFullTower(true);
46  //eefs->UseFullPreShower(true);
47  //eefs->UseFullSmdu(true);
48  //eefs->UseFullSmdv(true);
49 
50  // Place TPC chain after EMC makers
51  chain->AddAfter("eefs",chain->GetMaker("tpcChain"));
52 
53  // Place Pythia maker after GEANT maker
54  // and trigger filter after EMC makers
55  gSystem->Load("StJetSkimEvent");
56  gSystem->Load("StBfcTriggerFilterMaker");
57 
59  TString pyfile = gSystem->BaseName(fzfile);
60  pyfile.ReplaceAll(".fzd",".pythia.root");
61  pythia->SetPythiaFile(pyfile);
62  chain->AddAfter("geant",pythia);
63 
64  // Place trigger simulator after EMC makers
65  gSystem->Load("StTriggerUtilities");
67  trgsim->setMC(1);
68  // BBC was not used in Run 9 jet triggers
69  //trgsim->useBbc();
70  //trgsim->bbc->setSource("StEvent");
71  trgsim->useBemc();
72  trgsim->bemc->setConfig(StBemcTriggerSimu::kOffline);
73  trgsim->useEemc();
74  trgsim->eemc->setSource("StEvent");
75 
76  gSystem->Load("StMCAsymMaker");
78  // The BFC trigger filter will select only JP1, AJP and BHT3 events
79  trgfilt->SetJP1();
80  trgfilt->SetAJP();
81  trgfilt->SetBHT3();
82  // Lower all jet patch thresholds by one unit from
83  // their values obtained from the database using
84  // the current timestamp.
85  trgfilt->changeJPThresh(-1);
86  chain->AddAfter("eefs",trgfilt);
87 
88  chain->AddAfter("eefs",trgsim);
89 
90  // Place EEMC slow simulator after EMC makers
91  StEEmcSlowMaker* slowSim = new StEEmcSlowMaker;
92  slowSim->setSource("StEvent");
93  slowSim->setAddPed(true);
94  slowSim->setSmearPed(true);
95  chain->AddAfter("eefs",slowSim);
96 
97  // Run chain
98  int istat = chain->Init();
99  if (istat) {
100  cout << "Chain initialization failed" << endl;
101  chain->Fatal(istat,"during Init()");
102  }
103  // Detailed listing of makers in the chain
104  //chain->ls(0);
105  cout << "Order of makers in BFC:" << endl;
106  StMaker::lsMakers(chain);
107  chain->EventLoop(nevents);
108 }
void setDoZeroSuppression(StDetectorId det, bool flag)
void setAddPed(Bool_t a=true)
Add pedestal offsets from DB.
void setCheckStatus(StDetectorId det, bool flag)
virtual void setSource(const char *source)
Options are: &quot;MuDst&quot;, &quot;StEvent&quot;.
void setSmearPed(Bool_t s=true)
Smear the pedestal with sigma from DB.
Slow simulator for EEMC.
void setMakeFullDetector(StDetectorId det, bool flag)
simulate pedestal noise where no MC hits are found. Default is true for BTOW, false otherwise...
void setSource(const Char_t *name)
Set the source of ADC. Can be &quot;MuDst&quot; (default) or &quot;StEvent&quot;.