StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
clusterDisplay.C
1 
3 //
4 // macro: clusterDisplay.C
5 // author: A.A.P.Suaide (2005)
6 //
7 // This macro loops over events in the muDST files, run the
8 // BEMC cluster finder and creates an event by event display
9 // of the hits and clusters in the detector. This is an important
10 // tool for cluster QA because you can test the cluster
11 // parameters and check the results online.
12 //
13 // it also has a method to do statistical cluster QA over many
14 // events
15 //
17 
18 class StChain;
19 class StClusterDisplay;
20 
21 StChain *chain = 0;
22 StClusterDisplay *t = 0;
23 TMemStat memory;
24 int n = 0;
25 int stat = 0;
26 int count = 1;
27 
29 // This method displays a small help
30 void help()
31 {
32  cout <<"////////////////////////////////////////////////////////////////"<<endl;
33  cout <<"//"<<endl;
34  cout <<"// macro: clusterDisplay.C"<<endl;
35  cout <<"// author: A.A.P.Suaide (2005)"<<endl;
36  cout <<"//"<<endl;
37  cout <<"// This macro loops over events in the muDST files, run the"<<endl;
38  cout <<"// BEMC cluster finder and creates an event by event display"<<endl;
39  cout <<"// of the hits and clusters in the detector. This is an important"<<endl;
40  cout <<"// tool for cluster QA because you can test the cluster"<<endl;
41  cout <<"// parameters and check the results online."<<endl;
42  cout <<"//"<<endl;
43  cout <<"// it also has a method to do statistical cluster QA over many"<<endl;
44  cout <<"// events"<<endl;
45  cout <<"//"<<endl;
46  cout <<"////////////////////////////////////////////////////////////////"<<endl;
47  cout <<endl;
48  cout <<"The commands available are:"<<endl;
49  cout <<endl;
50  cout <<" setHitThreshold(Int_t det, Float_t th)"<<endl;
51  cout <<" // This method defines the energy threshold for displaying"<<endl;
52  cout <<" // a detector HIT in the display. The default value in the"<<endl;
53  cout <<" // code is 0.2 GeV. Values should de entered in GeV."<<endl;
54  cout <<" //"<<endl;
55  cout <<" // the parameters are:"<<endl;
56  cout <<" // Int_t det = detector name. (BTOW = 1, BPRS = 2, BSMDE = 3 and BSMDP = 4)"<<endl;
57  cout <<" // Int_t th = hit energy threshold in GeV"<<endl;
58  cout <<endl;
59  cout <<" next()"<<endl;
60  cout <<" // This method displays the next event in the queue"<<endl;
61  cout <<endl;
62  cout <<" qa(Int_t nevents)"<<endl;
63  cout <<" // This method loops over many events in order to fill some"<<endl;
64  cout <<" // clusters QA histograms. The user needs to open a TBrowser"<<endl;
65  cout <<" // in order to access the histograms"<<endl;
66  cout <<" //"<<endl;
67  cout <<" // the parameters are:"<<endl;
68  cout <<" // Int_t nevents = number of events to be processed in QA"<<endl;
69  cout <<endl;
70  cout <<" help()"<<endl;
71  cout <<" // Displays this help"<<endl;
72  cout <<endl;
73 }
75 // This method defines the energy threshold for displaying
76 // a detector HIT in the display. The default value in the
77 // code is 0.2 GeV. Values should de entered in GeV.
78 //
79 // the parameters are:
80 // Int_t det = detector name. (BTOW = 1, BPRS = 2, BSMDE = 3 and BSMDP = 4)
81 // Int_t th = hit energy threshold in GeV
82 void setHitThreshold(Int_t det, Float_t th)
83 {
84  t->setHitThreshold(det,th);
85  cout <<"\nThreshold in detector = "<<det<<" changed to "<<th<<" GeV."<<endl;
86  cout <<"This will have effect only in the next event displayed."<<endl;
87  cout <<"\n******* TYPE next() for the next event\n";
88  cout <<"******* TYPE help() for help about the methods available\n";
89 }
90 
92 // This method displays the next event in the queue
93 void next()
94 {
95  chain->cd();
96  t->setDraw(kTRUE);
97  chain->Clear();
98  stat = chain->Make();
99  if(n%count==0)
100  {
101  cout << "Finished processing event number "<<n <<endl;
102  memory.PrintMem(NULL);
103  }
104  n++;
105  cout <<"\n******* TYPE next() for the next event\n";
106  cout <<"******* TYPE help() for help about the methods available\n";
107 }
108 
110 // This method loops over many events in order to fill some
111 // clusters QA histograms. The user needs to open a TBrowser
112 // in order to access the histograms
113 //
114 // the parameters are:
115 // Int_t nevents = number of events to be processed in QA
116 void qa(Int_t nevents = 100)
117 {
118  chain->cd();
119  t->setDraw(kFALSE);
120  n = 0;
121  while ( (stat==0 || stat==1) && n<nevents)
122  {
123  chain->Clear();
124  stat = chain->Make();
125  if(n%count==0)
126  {
127  cout << "Finished processing event number "<<n <<endl;
128  memory.PrintMem(NULL);
129  }
130  n++;
131  }
132  cout <<"\n******* TYPE help() for help about the methods available\n";
133 }
134 
136 // This is the main method in the macro.
137 // It loads the libraries, creates the chain and
138 // instantiate the makers.
139 // This macro works only with MuDST events but it
140 // is very simple for the user to modify it in order to
141 // run over .event.root files.
142 //
143 // the parameters are:
144 // char* list = defines the list of data files
145 // Int_t nFiles = defines how many files should be read from the list
146 void clusterDisplay(char* list = "./file.lis",Int_t nFiles = 10)
147 {
148  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
149  loadSharedLibraries();
150  gSystem->Load("StDbBroker");
151  gSystem->Load("St_db_Maker");
152  gSystem->Load("StDaqLib");
153  gSystem->Load("StEmcRawMaker");
154  gSystem->Load("StEmcADCtoEMaker");
155 
156  gStyle->SetOptStat(0);
157 
158 // create chain
159  chain = new StChain("StChain");
160 
161  maker = new StMuDstMaker(0,0,"",list,"",nFiles);
162  StMuDbReader* db = StMuDbReader::instance();
163 
165  St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
166 
168  adc->setPrint(kFALSE);
169 
170  StPreEclMaker *ecl=new StPreEclMaker();
171 
172  t = new StClusterDisplay();
173 
174  chain->Init();
175  next();
176 }
177 
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
virtual Int_t Make()
Definition: StChain.cxx:110