HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hshowertaskset.cc
Go to the documentation of this file.
1 using namespace std;
2 #include "hshowertaskset.h"
3 #include "htask.h"
4 #include "htaskset.h"
5 #include "hdebug.h"
6 #include "TROOT.h"
7 #include "TClass.h"
8 #include "haddef.h"
9 #include "hades.h"
10 #include "hshowercalibrater.h"
11 #include "hshowerhitfinder.h"
12 #include "hshowercopy.h"
13 #include "hshowerhitdigitizer.h"
14 #include "hshowerpaddigitizer.h"
15 #include "hshowerhittrackmatcher.h"
16 #include "TBrowser.h"
17 #include "TString.h"
18 #include "TObjString.h"
19 #include <iostream>
20 #include <iomanip>
21 #include <stdlib.h>
22 
23 //*-- Author : Dan Magestro
24 //*-- Modified: 05/04/2003 by J.Otwinowski
25 // simulation flag set for hshowertofinocorrealtor
26 //*-- Modified: 19/11/2001 by D. Magestro
27 //*-- Modified: 14/02/2002 by J.Otwinowski
28 //*-- Modified: 02/06/2006 by J.Otwinowski
29 // lowshowerefficiency flag added
30 //_HADES_CLASS_DESCRIPTION
31 ///////////////////////////////////////////////////////////////////////////////
32 // HShowerTaskSet
33 //
34 // This HTaskSet contains the tasks for the Shower - Tofino detector
35 //
36 // BEGIN_HTML<b><font color="maroon">For more information, see <a target="_top" href="http://webdb.gsi.de:8010/pls/hades_webdbs/hanal.hal_posting_query.show_posting_text?p_id=436">this analysis logbook entry<a>.</font></b> END_HTML
37 //
38 ///////////////////////////////////////////////////////////////////////////////
39 
45 Bool_t HShowerTaskSet::isCoilOff=kFALSE;
46 Bool_t HShowerTaskSet::isSimulation=kFALSE;
48 
49 HShowerTaskSet::HShowerTaskSet(const Text_t name[],const Text_t title[]) : HTaskSet(name,title) {
50  // Constructor
51 }
52 
53 
55  // Default constructor
56 }
57 
58 
60  // Destructor.
61 }
62 
63 
64 HTask* HShowerTaskSet::make(const Char_t *select,const Option_t *option) {
65  // Returns a pointer to the Shower task or taskset specified by 'select'
66 
67 
68  HTaskSet *tasks = new HTaskSet("Shower","List of Shower tasks");
69 
70  TString sel = select;
71  sel.ToLower() ;
72  passArguments(sel);
73 
74  TString opt = option;
75 
76  passArguments(opt);
77 
79  {
80  Error("HShowerTaskSet::make()","Embedding is not implemented in Simulation! Use Real for embedding!");
81  exit(1);
82  }
83 
84 
85  //if( isLowShowerEfficiency == kFALSE) pShTofCorr->setLowShowerEfficiencyFlag(kFALSE);
86  //else pShTofCorr->setLowShowerEfficiencyFlag(kTRUE);
87 
88 
89  if(!isSimulation)
90  {
91  // real or embedding
92  if(analysisLevel >= 1 )
93  {
94  tasks->add( new HShowerCalibrater("sho.cal","sho.cal") );
95 
96  if(gHades->getEmbeddingMode()>0)
97  { // embedding
98  tasks->add( new HShowerHitDigitizer("shohit.digi","shohit.digi") );
99  tasks->add( new HShowerPadDigitizer("shopad.digi","shopad.digi") );
100  tasks->add( new HShowerCopy("sho.copy","sho.copy"));
101  }
102  }
103  if(analysisLevel >= 2)
104  {
105  tasks->add( new HShowerHitFinder("sho.hitf","sho.hitf") );
106  if(gHades->getEmbeddingMode()>0)
107  { // embedding
108  tasks->add( new HShowerHitTrackMatcher("sho.htmatch","sho.htmatch") );
109  }
110  }
111  }
112  else
113  {
114  // simulation
115  if(analysisLevel >=1 )
116  {
117  tasks->add( new HShowerHitDigitizer("shohit.digi","shohit.digi") );
118  tasks->add( new HShowerPadDigitizer("shopad.digi","shopad.digi") );
119  tasks->add( new HShowerCopy("sho.copy","sho.copy"));
120  }
121  if(analysisLevel >=2)
122  {
123  tasks->add( new HShowerHitFinder("sho.hitf","sho.hitf") );
124  tasks->add( new HShowerHitTrackMatcher("sho.htmatch","sho.htmatch") );
125  }
126  }
127  return tasks;
128 }
129 
130 void HShowerTaskSet::setAnalysisSimOrReal(Option_t* optrealorsim="") {
131  TString optRealOrSim=optrealorsim;
132 
133  optRealOrSim.ToLower();
134  if(optRealOrSim.CompareTo("real")==0)
135  {
136  isSimulation=kFALSE;
137  }
138  else if(optRealOrSim.CompareTo("simulation")==0)
139  {
140  isSimulation=kTRUE;
141  }
142  else
143  {
144  cerr<<"HShowerTaskSet:setRealOrSim() unknown argument :use real or simulation" << endl;
145  exit(1);
146  }
147 }
148 
149 void HShowerTaskSet::setAnalysisLevel(Option_t* optanalysislevel="") {
150  // Sets maximum analysis levels leprecognition
151  TString optanalLavel = optanalysislevel;
152 
153  optanalLavel.ToLower();
154  if(optanalLavel.CompareTo("leprecognition")==0)
155  {
156  analysisLevel=1;
157  }
158  else
159  {
160  cerr<<"HShowerTaskSet::setAnalysisLevel(Option_t*): unknown argument use leprecognition" << endl;
161  exit(1);
162  }
163 }
164 
166  // pass arguments to the make tasks function
167 
168  TString ssimulation = "simulation" ;
169  TString sreal = "real" ;
170  TString smagneton = "magneton" ;
171  TString smagnetoff = "magnetoff" ;
172  TString sraw = "raw" ;
173  TString scal = "cal" ;
174  TString shit = "hit" ;
175  TString slowshowerefficiency = "nolowshowerefficiency" ;
176 
177  TString s2 = s1;
178 
179  s1.ToLower();
180  s1.ReplaceAll(" ","");
181 
182  Ssiz_t len=s1.Length();
183 
184  if(len!=0) {
185 
186  TObjArray* myarguments = s1.Tokenize(",");
187  TObjString *stemp;
188  TString argument;
189 
191  ianalysisLevel=0;
192  imagnet=0;
193 
194  TIterator* myiter=myarguments->MakeIterator();
195  // go over list of arguments and compare the known keys
196 
197  while ((stemp=(TObjString*)myiter->Next())!= 0)
198  {
199  argument=stemp->GetString();
200 
201  Info("parseArguments()","option: %s", argument.Data() );
202 
203  if( argument.CompareTo(slowshowerefficiency) == 0) isLowShowerEfficiency = kFALSE;
204 
205  if(argument.CompareTo(sraw) == 0)
206  {
207  ianalysisLevel++;
208  if(ianalysisLevel>1)
209  {
210  cerr<<"HShowerTaskSet: overlap with other argument for analysis level:RAW!" << endl;
211 
212  cout << "input option string: " << s2 << endl;
213  exit(1);
214  }
215 
216  analysisLevel=0;
217  }
218 
219  else if(argument.CompareTo(scal) == 0)
220  {
221  ianalysisLevel++;
222  if(ianalysisLevel>1)
223  {
224  cerr<<"HShowerTaskSet: overlap with other argument for analysis level:CAL!" << endl;
225 
226  cout << "input option string: " << s2 << endl;
227  exit(1);
228  }
229 
230  analysisLevel=1;
231  }
232 
233  else if(argument.CompareTo(shit) == 0)
234  {
235  ianalysisLevel++;
236  if(ianalysisLevel>1)
237  {
238  cerr<<"HShowerTaskSet: overlap with other argument for analysis level:HIT!" << endl;
239 
240  cout << "input option string: " << s2 << endl;
241  exit(1);
242  }
243 
244  analysisLevel=2;
245  }
246 
247  else if(argument.CompareTo(ssimulation) == 0) {
248 
250  if(ianalysisSimOrReal>1)
251  {
252  cerr<<"HShowerTaskSet: ovrlap with other argument for analysis level:SIMULATION!"<< endl;
253  cout << "input option string: " << s2 << endl;
254  exit(1);
255  }
256  isSimulation=kTRUE;
257  }
258 
259  else if(argument.CompareTo(sreal)==0)
260  {
262  if(ianalysisSimOrReal>1)
263  {
264  cerr<<"HShowerTaskSet: overlap with other argument for analysis level:REAL!" << endl;
265  cout << "input option string: " << s2 << endl;
266  exit(1);
267  }
268  isSimulation=kFALSE;
269  }
270 
271  else if(argument.CompareTo(smagnetoff)==0)
272  {
273  imagnet++;
274  if(imagnet>1)
275  {
276  cerr<< "HShowerTaskSet: overlap with other argument for magnet status:MagnetOff!" << endl;
277  cout<<"INPUT OPTIONSTRING: "<<s2<<endl;
278  printOptions();
279  exit(1);
280  }
281  isCoilOff=kTRUE;
282  }
283 
284  else if(argument.CompareTo(smagneton)==0)
285  {
286  imagnet++;
287  cout<<"INPUT OPTIONSTRING: "<<s2<<endl;
288  if(imagnet>1)
289  {
290  cerr<<"HShowerTaskSet: overlap with other argument for magnet status:MagnetOn!" << endl;
291  cout<<"INPUT OPTIONSTRING: "<<s2<<endl;
292  printOptions();
293  exit(1);
294  }
295  isCoilOff=kFALSE;
296  }
297  }
298  delete myiter;
299 
300  myarguments->Delete();
301  delete myarguments ;
302  }
303 }
304 
306 
307  printf("*********************************************************** \n\n");
308 
309  printf("THESE ARE POSSIBLE ANALYSIS OPTIONS FOR SHOWER - TOFINO DETECTOR \n\n");
310  printf("real - REAL DATA ANALYSIS / DEFAULT \n");
311  printf("simulation - SIMULATION DATA ANALYSIS \n");
312  printf("magnetoff - MAGNETIC FIELD SWITCH OFF \n");
313  printf("magneton - MAGNETIC FIELD SWITCH ON / DEFAULT \n");
314  printf("raw - ANALYSIS UP TO THE RAW LEVEL");
315  printf("cal - ANALYSIS UP TO THE CAL LEVEL \n");
316  printf("hit - ANALYSIS UP TO THE HIT LEVEL \n");
317 
318  printf("*********************************************************** \n");
319 }
320 
322 
static Int_t ianalysisLevel
Int_t getEmbeddingMode()
Definition: hades.h:98
static Bool_t isLowShowerEfficiency
static Int_t analysisSimOrReal
void setAnalysisSimOrReal(Option_t *)
static Bool_t isSimulation
HTaskSet(void)
Definition: htaskset.cc:42
void printOptions(void)
static Int_t ianalysisSimOrReal
ClassImp(HDbColumn) HDbColumn
Definition: hdbcolumn.cc:18
void setAnalysisLevel(Option_t *)
Hades * gHades
Definition: hades.cc:1213
static Int_t analysisLevel
static Int_t imagnet
Bool_t add(HTask *)
Definition: htaskset.cc:82
Definition: htask.h:14
void passArguments(TString s1)
static Bool_t isCoilOff
HTask * make(const Char_t *select="", const Option_t *option="")