e9c06036 |
1 | // -*- mode: C++ -*- |
a3b36d36 |
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 | // |
e9c06036 |
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. |
a3b36d36 |
19 | // |
e9c06036 |
20 | // Author: Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch |
a3b36d36 |
21 | // |
22 | |
23 | #include "TNamed.h" |
24 | #include "TObjArray.h" |
25 | #include "TClonesArray.h" |
26 | #include "TFile.h" |
27 | #include "iostream" |
28 | #include "fstream" |
a7e41e8d |
29 | #include "TString.h" |
a3b36d36 |
30 | #include "AliRawReader.h" |
31 | #include "AliFMDDigit.h" |
32 | #include "AliFMDParameters.h" |
427e8f99 |
33 | #include "TArrayS.h" |
e9c06036 |
34 | class TDirectory; |
3effc6e7 |
35 | class AliFMDRawReader; |
a3b36d36 |
36 | |
37 | class AliFMDBaseDA: public TNamed { |
38 | |
e9c06036 |
39 | public: |
a3b36d36 |
40 | AliFMDBaseDA() ; |
41 | AliFMDBaseDA(const AliFMDBaseDA & baseDA) ; |
fb10ff39 |
42 | // AliFMDBaseDA& operator = (const AliFMDBaseDA & baseDA) ; |
a3b36d36 |
43 | |
44 | ~AliFMDBaseDA() ; |
45 | |
46 | void Run(AliRawReader* fmdReader); |
47 | void SetSaveDiagnostics(Bool_t save) {fSaveHistograms = save;} |
48 | void SetRequiredEvents(Int_t nEvents) {fRequiredEvents = nEvents;} |
c5569fbc |
49 | Int_t GetRequiredEvents() const {return fRequiredEvents ;} |
e9c06036 |
50 | protected: |
a3b36d36 |
51 | |
26be6417 |
52 | virtual void Init() {}; |
53 | virtual void FillChannels(AliFMDDigit* ) {}; |
54 | virtual void Analyse(UShort_t, Char_t, UShort_t, UShort_t ) {}; |
55 | virtual void WriteHeaderToFile() {}; |
56 | virtual void AddChannelContainer(TObjArray*, UShort_t, Char_t, UShort_t, UShort_t ) {}; |
57 | virtual void FinishEvent() {}; |
f7f0b643 |
58 | virtual void Terminate(TFile* ) {}; |
a3b36d36 |
59 | |
c5569fbc |
60 | Int_t GetCurrentEvent() const {return fCurrentEvent;} |
a3b36d36 |
61 | |
c5569fbc |
62 | static const UInt_t fgkBaseDDL = 3072; // base FMD ddl |
a7e41e8d |
63 | //Char_t* fDiagnosticsFilename; |
c5569fbc |
64 | TString fDiagnosticsFilename; // name of diagnostics file |
65 | std::ofstream fOutputFile; // output file |
66 | std::ofstream fConditionsFile; // conditions file |
67 | Bool_t fSaveHistograms; // save hists or not |
68 | TObjArray fDetectorArray; // array indiced by detector |
427e8f99 |
69 | |
c5569fbc |
70 | Int_t GetHalfringIndex(UShort_t, Char_t, UShort_t) const; |
427e8f99 |
71 | Int_t GetPulseSize(UShort_t det , |
72 | Char_t ring, |
73 | UShort_t board) {return fPulseSize.At(GetHalfringIndex(det,ring,board));} |
74 | Int_t GetPulseLength(UShort_t det, |
75 | Char_t ring, |
76 | UShort_t board) {return fPulseLength.At(GetHalfringIndex(det,ring,board));} |
77 | |
a3b36d36 |
78 | |
e9c06036 |
79 | const char* GetDetectorPath(UShort_t det, Bool_t full=kTRUE) const; |
80 | const char* GetRingPath(UShort_t det, Char_t ring, Bool_t full=kTRUE) const; |
81 | const char* GetSectorPath(UShort_t det, Char_t ring, UShort_t sec, |
82 | Bool_t full=kTRUE) const; |
83 | const char* GetStripPath(UShort_t det, Char_t ring, UShort_t sec, |
84 | UShort_t str, Bool_t full=kTRUE) const; |
a3b36d36 |
85 | |
f7f0b643 |
86 | |
87 | |
c5569fbc |
88 | TArrayS fPulseSize; // Pulse size for gain calib |
89 | TArrayS fPulseLength; // Pulse length for gain calib |
427e8f99 |
90 | |
c5569fbc |
91 | Bool_t fSeenDetectors[3]; // Detectors seen so far |
e9c06036 |
92 | private: |
a3b36d36 |
93 | |
3effc6e7 |
94 | void WriteConditionsData(AliFMDRawReader* fmdReader); |
a3b36d36 |
95 | void SetCurrentEvent(Int_t currentEvent) {fCurrentEvent = currentEvent; } |
e9c06036 |
96 | void InitContainer(TDirectory* dir); |
c5569fbc |
97 | Int_t fRequiredEvents; // number of events required for this calib |
98 | Int_t fCurrentEvent; // the current event |
e9c06036 |
99 | |
427e8f99 |
100 | |
101 | |
a3b36d36 |
102 | ClassDef(AliFMDBaseDA,0) |
103 | |
104 | }; |
105 | #endif |
106 | |