AliRoot Core  edcc906 (edcc906)
AliFMDBaseDA.h
Go to the documentation of this file.
1 // -*- mode: C++ -*-
2 #ifndef ALIFMDBASEDA_H
3 #define ALIFMDBASEDA_H
4 
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
6  * reserved.
7  *
8  * See cxx source for full Copyright notice
9  */
10 //
11 // This class provides a base interface for the Detector Algorithms
12 // (DA) of the FMD. At least three implementations are needed:
13 // AliFMDPedestalDA, AliFMDGainDA and AliFMDPhysicsDA . These classes
14 // will provide the calibration data for the AliFMDPreprocessor to be
15 // used in the shuttle. The input for this class are raw data
16 // (AliRawReader) and the output is a comma-separated file
17 // (std::ofstream) that contains the values defined in the
18 // implementations of this class.
19 //
20 // Author: Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
21 //
22 
23 #include "TNamed.h"
24 #include "TObjArray.h"
25 #include "TString.h"
26 #include "TArrayS.h"
27 #include "TList.h"
28 #include <iosfwd>
29 #include <fstream>
30 class AliFMDDigit;
31 class AliRawReader;
32 class AliFMDParameters;
33 class AliFMDRawReader;
34 class TDirectory;
35 class TH2;
36 class TFile;
37 class TClonesArray;
38 
39 class AliFMDBaseDA: public TNamed
40 {
41 public:
42 #if 0
43  struct _Array : public TList
44  {
45  _Array() : TList() {}
46  _Array(Int_t) : TList() {}
47  _Array(const _Array& a) : TList() {}
48  ~_Array();
49  void AddAtAndExpand(TObject* o, Int_t idx) { AddAt(o,idx); }
50  Int_t GetEntriesFast() { return GetEntries(); }
51  };
52  typedef _Array Array;
53 #elif 0
54  struct _Array : public TObjArray
55  {
56  _Array() : TObjArray() {}
57  _Array(Int_t n) : TObjArray(n) {}
58  ~_Array();
59  };
60  typedef _Array Array;
61 #else
62  typedef TObjArray Array;
63 #endif
64 
69  AliFMDBaseDA() ;
75  AliFMDBaseDA(const AliFMDBaseDA & baseDA) ;
76  // AliFMDBaseDA& operator = (const AliFMDBaseDA & baseDA) ;
81  ~AliFMDBaseDA() ;
82  AliFMDBaseDA& operator=(const AliFMDBaseDA&) { return *this; }
90  Bool_t Run(AliRawReader* fmdReader, Bool_t appendRun, Bool_t isBase=false);
96  void SetSaveDiagnostics(Bool_t save) {fSaveHistograms = save;}
102  void SetDiagnosticsFilename(const TString& f) { fDiagnosticsFilename = f; }
108  void SetMakeSummaries(Bool_t save) {fMakeSummaries = save;}
114  void SetRequiredEvents(Int_t nEvents) {fRequiredEvents = nEvents;}
120  void SetTryAll(Bool_t all=true) { fAll = all; }
127  Int_t GetRequiredEvents() const {return fRequiredEvents ;}
133  const Array& GetSummaries() const { return fSummaries; }
140  Bool_t HasSeenDetector(UShort_t d) const;
141 
145  struct Runner {
146  Runner();
147  Runner(const Runner&)
148  : fReader(0),
149  fSource(""),
150  fDiagFile(""),
151  fDiag(false),
152  fAll(false),
153  fFast(true),
154  fUpload(true),
155  fAppendRun(false),
156  fOwnUpload(false)
157  {}
158  ~Runner() {}
159  Runner& operator=(const Runner&) { return *this; }
160  void AddHandlers();
161  void ShowUsage(std::ostream& o, const char* progname);
162  Int_t Init(int argc, char** argv, Bool_t reader=true);
163  Bool_t Exec(AliFMDBaseDA& da);
164  Int_t RunNumber() const;
165  AliRawReader* fReader;
166  TString fSource;
167  TString fDiagFile;
168  Bool_t fDiag;
169  Bool_t fAll;
170  Bool_t fFast;
171  Bool_t fUpload;
172  Bool_t fAppendRun;
173  Bool_t fOwnUpload;
174  };
175 protected:
194  virtual Bool_t OpenFiles(Bool_t appendRun=false);
199  virtual void CloseFiles();
203  virtual void Init() {};
207  virtual void FillChannels(AliFMDDigit* ) {};
211  virtual void Analyse(UShort_t, Char_t, UShort_t, UShort_t) {};
215  virtual void WriteHeaderToFile() {};
219  virtual void AddChannelContainer(Array*, UShort_t, Char_t,
220  UShort_t, UShort_t ) {};
225  virtual void AddSectorSummary(Array*, UShort_t, Char_t, UShort_t,
226  UShort_t) {}
230  virtual void FinishEvent() {};
234  virtual void Terminate(TFile* ) {};
241  Int_t GetCurrentEvent() const {return fCurrentEvent;}
252  void Rotate(const char* base, int max) const;
262  Int_t GetHalfringIndex(UShort_t, Char_t, UShort_t) const;
272  Int_t GetPulseSize(UShort_t det ,
273  Char_t ring,
274  UShort_t board)
275  {
276  return fPulseSize.At(GetHalfringIndex(det,ring,board));
277  }
287  Int_t GetPulseLength(UShort_t det,
288  Char_t ring,
289  UShort_t board)
290  {
291  return fPulseLength.At(GetHalfringIndex(det,ring,board));
292  }
293 
302  TString GetDetectorPath(UShort_t det, Bool_t full=kTRUE) const;
312  TString GetRingPath(UShort_t det, Char_t ring, Bool_t full=kTRUE) const;
323  TString GetSectorPath(UShort_t det, Char_t ring, UShort_t sec,
324  Bool_t full=kTRUE) const;
336  TString GetStripPath(UShort_t det, Char_t ring, UShort_t sec,
337  UShort_t str, Bool_t full=kTRUE) const;
338  Array* GetDetectorArray(UShort_t det);
339  Array* GetRingArray(UShort_t det, Char_t ring);
340  Array* GetSectorArray(UShort_t det, Char_t ring, UShort_t sector);
341  Array* GetStripArray(UShort_t det, Char_t ring,
342  UShort_t sector, UShort_t strip);
348  void WriteConditionsData(AliFMDRawReader* fmdReader);
354  void SetCurrentEvent(Int_t currentEvent) {fCurrentEvent = currentEvent; }
360  virtual void InitContainer(TDirectory* dir);
369  TH2* MakeSummaryHistogram(const char* prefix, const char* title,
370  UShort_t det, Char_t ring);
375  virtual void MakeSummary(UShort_t, Char_t) { }
376 
377  virtual Bool_t HaveEnough(Int_t nEvent) const;
378  virtual UShort_t GetProgress(Int_t nEvent) const;
379 
380  static const UInt_t fgkBaseDDL = 3072; // base FMD ddl
381  //Char_t* fDiagnosticsFilename;
382  TString fDiagnosticsFilename; // name of diagnostics file
383  std::ofstream fOutputFile; // output file
384  std::ofstream fConditionsFile; // conditions file
385  Bool_t fSaveHistograms; // save hists or not
386  Bool_t fMakeSummaries; // save hists or not
387  Array fDetectorArray; // array indiced by detector
388  TArrayS fPulseSize; // Pulse size for gain calib
389  TArrayS fPulseLength; // Pulse length for gain calib
390  Bool_t fSeenDetectors[3]; // Detectors seen so far
391  UInt_t fNEventsPerDetector[3];// # events per detector
392  Int_t fRequiredEvents; // # events required for this calib
393  Int_t fCurrentEvent; // the current event
394  UInt_t fRunno; // Current run number
395  Array fSummaries; // Summary histograms
396  Bool_t fAll; // Try to get data from all dets
397 
398  ClassDef(AliFMDBaseDA,0) // Base Detector algorithm for all run types
399 
400 };
401 //____________________________________________________________________
402 inline Bool_t
404 {
405  return (d == 0 || d > 3) ? false : fSeenDetectors[d-1];
406 }
407 
408 #endif
409 
class for digits
Definition: AliFMDDigit.h:28
virtual void AddSectorSummary(Array *, UShort_t, Char_t, UShort_t, UShort_t)
Definition: AliFMDBaseDA.h:225
AliRawReader * fReader
Definition: AliFMDBaseDA.h:165
virtual void InitContainer(TDirectory *dir)
Int_t GetPulseLength(UShort_t det, Char_t ring, UShort_t board)
Definition: AliFMDBaseDA.h:287
static const UInt_t fgkBaseDDL
Definition: AliFMDBaseDA.h:380
void SetRequiredEvents(Int_t nEvents)
Definition: AliFMDBaseDA.h:114
virtual void FillChannels(AliFMDDigit *)
Definition: AliFMDBaseDA.h:207
Int_t GetHalfringIndex(UShort_t, Char_t, UShort_t) const
virtual void Terminate(TFile *)
Definition: AliFMDBaseDA.h:234
std::ofstream fConditionsFile
Definition: AliFMDBaseDA.h:384
Int_t GetCurrentEvent() const
Definition: AliFMDBaseDA.h:241
#define TObjArray
Array * GetDetectorArray(UShort_t det)
void Rotate(const char *base, int max) const
virtual void FinishEvent()
Definition: AliFMDBaseDA.h:230
std::ofstream fOutputFile
Definition: AliFMDBaseDA.h:383
This class is a singleton that handles various parameters of the FMD detectors. This class reads from...
Class to read ALTRO formated raw data from an AliRawReader object.
Array * GetRingArray(UShort_t det, Char_t ring)
Runner(const Runner &)
Definition: AliFMDBaseDA.h:147
TString GetRingPath(UShort_t det, Char_t ring, Bool_t full=kTRUE) const
Bool_t HasSeenDetector(UShort_t d) const
Definition: AliFMDBaseDA.h:403
Array fSummaries
Definition: AliFMDBaseDA.h:395
void SetMakeSummaries(Bool_t save)
Definition: AliFMDBaseDA.h:108
virtual void AddChannelContainer(Array *, UShort_t, Char_t, UShort_t, UShort_t)
Definition: AliFMDBaseDA.h:219
Int_t fCurrentEvent
Definition: AliFMDBaseDA.h:393
TObjArray Array
Definition: AliFMDBaseDA.h:62
Array fDetectorArray
Definition: AliFMDBaseDA.h:387
virtual UShort_t GetProgress(Int_t nEvent) const
Bool_t Run(AliRawReader *fmdReader, Bool_t appendRun, Bool_t isBase=false)
void SetDiagnosticsFilename(const TString &f)
Definition: AliFMDBaseDA.h:102
TString GetSectorPath(UShort_t det, Char_t ring, UShort_t sec, Bool_t full=kTRUE) const
TString GetDetectorPath(UShort_t det, Bool_t full=kTRUE) const
void WriteConditionsData(AliFMDRawReader *fmdReader)
TString GetStripPath(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, Bool_t full=kTRUE) const
Bool_t fMakeSummaries
Definition: AliFMDBaseDA.h:386
TH2 * MakeSummaryHistogram(const char *prefix, const char *title, UShort_t det, Char_t ring)
char * prefix
void SetSaveDiagnostics(Bool_t save)
Definition: AliFMDBaseDA.h:96
TArrayS fPulseLength
Definition: AliFMDBaseDA.h:389
AliFMDBaseDA & operator=(const AliFMDBaseDA &)
Definition: AliFMDBaseDA.h:82
UInt_t fNEventsPerDetector[3]
Definition: AliFMDBaseDA.h:391
Bool_t fSaveHistograms
Definition: AliFMDBaseDA.h:385
TF1 * f
Definition: interpolTest.C:21
Int_t GetPulseSize(UShort_t det, Char_t ring, UShort_t board)
Definition: AliFMDBaseDA.h:272
TString fDiagnosticsFilename
Definition: AliFMDBaseDA.h:382
void SetTryAll(Bool_t all=true)
Definition: AliFMDBaseDA.h:120
Runner & operator=(const Runner &)
Definition: AliFMDBaseDA.h:159
virtual void CloseFiles()
Int_t GetRequiredEvents() const
Definition: AliFMDBaseDA.h:127
virtual Bool_t OpenFiles(Bool_t appendRun=false)
virtual void WriteHeaderToFile()
Definition: AliFMDBaseDA.h:215
virtual void Init()
Definition: AliFMDBaseDA.h:203
virtual void MakeSummary(UShort_t, Char_t)
Definition: AliFMDBaseDA.h:375
Array * GetSectorArray(UShort_t det, Char_t ring, UShort_t sector)
const Array & GetSummaries() const
Definition: AliFMDBaseDA.h:133
TArrayS fPulseSize
Definition: AliFMDBaseDA.h:388
Array * GetStripArray(UShort_t det, Char_t ring, UShort_t sector, UShort_t strip)
Bool_t fSeenDetectors[3]
Definition: AliFMDBaseDA.h:390
Int_t fRequiredEvents
Definition: AliFMDBaseDA.h:392
void SetCurrentEvent(Int_t currentEvent)
Definition: AliFMDBaseDA.h:354
virtual Bool_t HaveEnough(Int_t nEvent) const
virtual void Analyse(UShort_t, Char_t, UShort_t, UShort_t)
Definition: AliFMDBaseDA.h:211