]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDBaseDA.h
new FMD correction objects
[u/mrichter/AliRoot.git] / FMD / AliFMDBaseDA.h
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 "TClonesArray.h"
26 #include "TFile.h"
27 #include "iostream"
28 #include "fstream"
29 #include "TString.h"
30 #include "AliRawReader.h"
31 #include "AliFMDDigit.h"
32 #include "AliFMDParameters.h"
33 #include "TArrayS.h"
34 class TDirectory;
35 class AliFMDRawReader;
36
37 class AliFMDBaseDA: public TNamed {
38   
39 public:
40   AliFMDBaseDA() ;
41   AliFMDBaseDA(const AliFMDBaseDA & baseDA) ;
42   //  AliFMDBaseDA& operator = (const AliFMDBaseDA & baseDA) ; 
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;}
49   Int_t GetRequiredEvents() {return fRequiredEvents ;}
50 protected:
51   
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()  {};
58   virtual void Terminate(TFile* ) {};
59   
60   Int_t GetCurrentEvent() {return fCurrentEvent;}
61   
62   static const UInt_t kBaseDDL = 3072;
63   //Char_t* fDiagnosticsFilename;
64   TString fDiagnosticsFilename;
65   std::ofstream fOutputFile;
66   std::ofstream fConditionsFile;
67   Bool_t fSaveHistograms;
68   TObjArray fDetectorArray;
69
70   Int_t GetHalfringIndex(UShort_t, Char_t, UShort_t);
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
78   
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;
85   
86
87   
88   TArrayS fPulseSize;
89   TArrayS fPulseLength;
90
91   Bool_t  fSeenDetectors[3];
92 private:
93  
94   void WriteConditionsData(AliFMDRawReader* fmdReader);
95   void SetCurrentEvent(Int_t currentEvent) {fCurrentEvent = currentEvent; }
96   void InitContainer(TDirectory* dir);
97   Int_t fRequiredEvents;
98   Int_t fCurrentEvent;   
99   
100   
101   
102   ClassDef(AliFMDBaseDA,0)
103
104 };
105 #endif
106