StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
doBemcMuDst.C
1 
3 // Macro to run BEMC data analysis from StEvent
4 //
5 // AAPSuaide SEP-2004
6 //
8 
9 class StChain;
10 StChain *chain=0;
11 
12 void doBemcMuDst(bool StEv = true, char* list = "test.list", int nFiles = 5, int nevents = 2000000)
13 {
14  Bool_t debug = kFALSE; // debug mode. If true, prints a lot of information
15  Bool_t fillExtraHisto = kFALSE; // create and fill extra QA histograms
16  Bool_t saveAllStEvent = kFALSE; // flag to save all hits into StEvent. If false, use ADCtoEMaker cuts
17 
18  cout <<"list = "<<list<<endl;
19  cout <<"nFiles = "<<nFiles<<endl;
20  cout <<"nevents = "<<nevents<<endl;
21 
22  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
23  loadSharedLibraries();
24  gSystem->Load("StTpcDb");
25  gSystem->Load("StDbUtilities");
26  gSystem->Load("StDbLib");
27  gSystem->Load("StDbBroker");
28  gSystem->Load("St_db_Maker");
29  gSystem->Load("libgeometry_Tables");
30  gSystem->Load("StDaqLib");
31  gSystem->Load("StEmcRawMaker");
32  gSystem->Load("StEmcADCtoEMaker");
33  gSystem->Load("StPreEclMaker");
34  gSystem->Load("StEpcMaker");
35 
36  // Do not forget to load your personal libraries
37 
39  // create chain
41  chain = new StChain("StChain");
42  if(debug) chain->SetDebug();
43 
45  // Now we add Makers to the chain...
47  StMuDstMaker* muDst = new StMuDstMaker(0,0,"",list,"",nFiles);
48  StMuDbReader* muDB = StMuDbReader::instance();
49  if(StEv) StMuDst2StEventMaker *muDst2StEvent = new StMuDst2StEventMaker();
50 
52  // This is the DB Maker and it is the interface to Star database
53  St_db_Maker *db = new St_db_Maker("StarDb","MySQL:StarDb");
54  // if you want to use a different flavor for some table in the database
55  // use the SetFlavor method in the St_db_Maker.
56  // the defaul flavor for all the tables if "ofl"
57  //
58  // This example set the bemc status table to the table used by the pi0 analysis
59  // db->SetFlavor("pi0","bemcStatus");
60 
62  // BEMC Reco makers start here...
64 
65  // This is the maker that applies the calibration to the data
67  adc->saveAllStEvent(saveAllStEvent); // if set to kTRUE, saves all the hits into StEvent.
68  adc->setPrint(debug); // if true, prints extra information
69  controlADCtoE_st* c = adc->getControlTable(); // get control table. You can have access to detailed configuration for each sub detector
70 
72  // the constol table has the following parameters
73  // short DeductPedestal[det-1]; // switch for deducting pedestal, should be = 1 to deduct pedestals
74  // short Calibration[det-1]; // switch for calibration, should be = 1 to do the calibration
75  // float CutOff[det-1]; // cutoff value for hits close to pedestal. -1 = none
76  // short CutOffType[det-1]; // cutoff type (0 = energy, 1 = pedestal RMS)
77  // short OnlyCalibrated[det-1]; // save only calibrated hits
78  // short messLimit; // limit for warning message
79  //
80  // where 1 = bemc; 2 = bprs; 3 = bsmde; 4 = bsmdp;
82 
83  // This maker does clustering in the detectors
84  StPreEclMaker *ecl=new StPreEclMaker();
85  ecl->setFillHisto(fillExtraHisto); // if kTRUE it fillls extra histograms
86  ecl->setPrint(debug); // if true, prints extra information
87 
88  // This maker finds the BEMC points (matching)
89  StEpcMaker *epc = new StEpcMaker();
90  epc->setFillHisto(fillExtraHisto); // if kTRUE it fillls extra histograms
91  epc->setPrint(debug); // if true, prints extra information
92 
94  // you instantiate your analysis maker here
96 
97  chain->Init();
98 
100  // the EMC cluster finder parameters should be set after Init() method
101  // is called
102  // the syntax for SetClusterConditions is
103  // SetClusterConditions("det Name", sizeMax, energySeed, energyAdd, energyThresholdAll, kCheckClustersOk)
104  // sizeMax is the maximum size the cluster can have
105  // energySeed is the energy threshold to start looking for a cluster in that detector region
106  // energyAdd is the minimum energy a hit can have to be included as part of a cluster
107  // energyThresholdAll is the minimum energy a cluster can have in order to be saved
108  // kCheckClustersOk is a flag to do a refit of the cluster based on the shower profile. NOT TESTED !!!
109  //
110  // These are the default conditions
112  ecl->SetClusterConditions("bemc", 4, 0.7, 0.001, 0.1, kFALSE);
113  ecl->SetClusterConditions("bprs", 1, 0.1, 0.001, 0.1, kFALSE);
114  ecl->SetClusterConditions("bsmde", 5, 0.4, 0.001, 0.1, kFALSE);
115  ecl->SetClusterConditions("bsmdp", 5, 0.4, 0.001, 0.1, kFALSE);
116 
118  // start event loop
120  int n=0;
121  int stat=0;
122  int count = 1000;
123  if(debug) count =1;
124  TMemStat memory;
125 
126  while ( (stat==0 || stat==1 ) && n<nevents)
127  {
128  chain->Clear();
129  stat = chain->Make();
130  if(n%count==0)
131  {
132  cout << "Finished processing event number "<<n <<endl;
133  memory.PrintMem(NULL);
134  }
135  n++;
136  }
137  cout << endl;
138  chain->Finish();
139 }
140 
void setFillHisto(Bool_t a)
Turns on/off histogram filling.
Definition: StEpcMaker.h:93
void setPrint(Bool_t)
Obsolete function; users can control messages with logger config file.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setPrint(Bool_t a)
Obsolete function; users can control messages with logger config file.
Definition: StPreEclMaker.h:36
virtual Int_t Finish()
Definition: StChain.cxx:85
void SetClusterConditions(char *, Int_t, Float_t, Float_t, Float_t, Bool_t=kFALSE)
this is for background compatibility with the old finder
virtual Int_t Make()
Definition: StChain.cxx:110
void setPrint(Bool_t a)
Obsolete function; users can control messages with logger config file.
Definition: StEpcMaker.h:89
controlADCtoE_st * getControlTable()
Return Control table (NULL)
void saveAllStEvent(Bool_t a)
Set to kTRUE if all hits are to be saved on StEvent.