]>
Commit | Line | Data |
---|---|---|
3f0e013c | 1 | #ifndef ALIITSPREPROCESSORSPD_H |
2 | #define ALIITSPREPROCESSORSPD_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id$ */ | |
8 | ||
9 | /////////////////////////////////////////////////////////////////////////// | |
10 | // AliITSPreprocessorSPD declaration by P. Nilsson 2005 | |
11 | // AUTHOR/CONTACT: Paul.Nilsson@cern.ch | |
12 | // | |
13 | // The purpose of this class is to provide algorithms for identification | |
14 | // of "bad channels" such as dead channels and noisy channels in the SPD | |
15 | /////////////////////////////////////////////////////////////////////////// | |
16 | ||
3f0e013c | 17 | #include <TTask.h> |
3f0e013c | 18 | #include <TH2F.h> |
3f0e013c | 19 | #include <TKey.h> |
3f0e013c | 20 | #include "AliRunLoader.h" |
21 | #include "AliITSLoader.h" | |
3f0e013c | 22 | #include "AliITSBadChannelsSPD.h" |
23 | #include "AliITSBadChannelsAuxSPD.h" | |
3f0e013c | 24 | #include "AliCDBLocal.h" |
fcf95fc7 | 25 | |
26 | class AliCDBManager; | |
27 | class AliCDBMetaData; | |
28 | class AliCDBId; | |
29 | class AliCDBStorage; | |
30 | class AliITSChannelSPD; | |
3f0e013c | 31 | |
32 | class AliITSPreprocessorSPD : public TTask { | |
33 | ||
34 | public: | |
35 | ||
36 | AliITSPreprocessorSPD(void); // Default constructor | |
37 | AliITSPreprocessorSPD(const char *fileName, const char *mode, // Standard constructor | |
62ef98ab | 38 | const char *fileNameg, Int_t maxNumberOfEvents); |
3f0e013c | 39 | AliITSPreprocessorSPD(const AliITSPreprocessorSPD &prep); // Default copy constructor |
40 | AliITSPreprocessorSPD& operator=(const AliITSPreprocessorSPD &prep); // Assignment operator | |
41 | virtual ~AliITSPreprocessorSPD(void); // Virtual destructor | |
42 | ||
43 | void Init(void); // Initialization of the SPD preprocessor | |
44 | Bool_t Open(const char *fileName, const char *mode, // Open the input file (of either "daq" or "vme" type) | |
45 | const char *fileNameg); // and the galice file | |
46 | Bool_t FindDeadChannels(void); // Find dead channels | |
47 | Bool_t FindDeadChannelsInModule(UInt_t module); // Find dead channels in a module | |
48 | Bool_t FindNoisyChannels(void); // Locate the noisy channels among the digits | |
49 | Bool_t FindNoisyChannelsInModuleAlgo0(UInt_t module); // Locate the noisy channels in a module (for real data) | |
50 | Bool_t FindNoisyChannelsInModuleAlgo1(UInt_t module); // Locate the noisy channels in a module (for calibration data) | |
fcf95fc7 | 51 | Bool_t Store(AliCDBId &Id, AliCDBMetaData *md, Int_t runNumber); // Write the final object to the calibration database |
3f0e013c | 52 | // Returns kTRUE if successful |
53 | Bool_t GetVMEHistograms(TFile *vmeFile); // Get pre-filled digit histograms from input VME file | |
54 | void MarkNoisyChannels(void); // Mark all found noisy channels among the digits | |
55 | void PrintChannels(void); // Print all found bad channels to stdout | |
56 | ||
57 | // Getters and setters | |
58 | void SetMaximumNumberOfEvents(UInt_t n) // Set the maximum number of events | |
59 | { fMaximumNumberOfEvents = n; }; // (filling of noisy channel histograms will stop) | |
60 | UInt_t GetMaximumNumberOfEvents(void) const // Get the maximum number of events | |
61 | { return fMaximumNumberOfEvents; }; | |
62 | ||
63 | void SetGeometryMode(UInt_t mode); // Set the geometry mode | |
64 | UInt_t GetGeometryMode(void) const // Get the geometry mode | |
65 | { return fGeometryMode; }; // (kALICEGeometry is default, alt is kTestBeamGeometry) | |
66 | ||
67 | void SetThreshold(UInt_t t) // Set the noisy channel threshold | |
68 | { fThreshold = t; }; // (A channel has to fire mode times than this value to be noisy) | |
69 | void SetThreshold(Double_t t) // Set the noisy channel threshold (overloaded) | |
70 | { fThreshold = (UInt_t)t; }; // (A channel has to fire mode times than this value to be noisy) | |
71 | UInt_t GetThreshold(void) const // Get the noisy channel threshold | |
72 | { return fThreshold; }; // (A channel has to fire mode times than this value to be noisy) | |
73 | ||
74 | void SetThresholdRatio(Double_t r) // Set the noisy channel threshold ratio | |
75 | { fThresholdRatio = r; }; // (threshold to average neighboring channels) | |
76 | Double_t GetThresholdRatio(void) const // Get the noisy channel threshold ratio | |
77 | { return fThresholdRatio; }; // (threshold to average neighboring channels) | |
78 | ||
79 | void SelectAlgorithm(UInt_t a) // Select algorithm for read data or calibration data | |
80 | { fSelectedAlgorithm = a; }; // (either kOptimizedForRealData or kOptimizedForCalibrationData) | |
81 | UInt_t GetSelectedAlgorithm(void) const // Get the selected algorithm for read data or calibration data | |
82 | { return fSelectedAlgorithm; }; // (either kOptimizedForRealData or kOptimizedForCalibrationData) | |
83 | ||
84 | // Geometry mode constants | |
85 | enum { kTestBeamGeometry, kALICEGeometry }; | |
86 | ||
87 | // Algorithm constants | |
88 | enum { kOptimizedForRealData, kOptimizedForRealDataRMS, kOptimizedForCalibrationData }; | |
89 | ||
90 | // Noisy/dead pixel encoding (0001b, 0010b) used with the digit TObject statusbit | |
91 | enum { kNoisyChannel = 1, kDeadChannel = 2 }; | |
92 | ||
93 | // Replace later with reading from geometry object | |
94 | // During the 2004 test beam, 4 modules were used but had internal hardware addresses of 0,1,4,5 | |
95 | enum { kNumberOfTestBeamSPDModules = 6, kNumberOfSPDModules = 240 }; | |
96 | enum { kNumberOfColumns = 160, kNumberOfRows = 256 }; // In one module/ladder | |
97 | enum { kNumberOfChannels = 40960 }; // 5*8192 | |
98 | ||
99 | private: | |
100 | ||
101 | void ConvertObjToIntArray(void); // Convert the bad channel TObjArray to an Int_t array | |
102 | void SetFakeNoisyChannel(Int_t module, Int_t column, Int_t row); | |
103 | // For testing purposes it is possible to add fake noisy channels | |
104 | // to the noisy pixel tree. These will be added to the hit histograms | |
105 | void CreateHistograms(void); // Create digit histograms | |
106 | void CreateNoisyChannelsTree(void); // Create noisy channels tree | |
107 | TClonesArray *CreateDigitsArray(void) const; // Create the SPD digits array | |
108 | Bool_t CreateGeometryObj(void); // Creation of geometry object | |
109 | Bool_t GetITSDigits(const char *fileName); // Get the ITS digits | |
110 | Bool_t GetgAlice(void); // Get the gAlice object | |
111 | Bool_t FillHistograms(void); // Fill the histograms with digits | |
112 | void SetNumberOfModules(UInt_t n) // Set the number of modules | |
113 | { fNumberOfModules = n; }; | |
114 | UInt_t GetNumberOfModules(void) const // Get the number of modules | |
115 | { return fNumberOfModules; }; | |
116 | ||
117 | // AliITSGeometry *fGeometryObj; //! Pointer to the geometry object | |
118 | AliITSLoader *fITSLoader; //! ITS loader | |
119 | AliRunLoader *fRunLoader; //! Run Loader | |
120 | Double_t fThresholdRatio; //! Noisy channel ratio | |
121 | UInt_t fThreshold; //! Noisy channel threshold | |
122 | UInt_t fMaximumNumberOfEvents; //! Maximum number of events per histograms | |
123 | UInt_t fNumberOfModules; //! Number of modules, used for digit histograms | |
124 | UInt_t fHighestModuleNumber; //! The highest module number with found bad channels | |
125 | UInt_t fNumberOfColumns; //! Number of SPD columns | |
126 | UInt_t fNumberOfRows; //! Number of SPD rows | |
127 | UInt_t fSelectedAlgorithm; //! Removal algorithm selection, either set to | |
128 | //! kOptimizedForRealData or kOptimizedForCalibrationData | |
129 | UInt_t fGeometryMode; //! Geometry mode (kALICEGeometry is default, alt is kTestBeamGeometry) | |
130 | Int_t *fNumberOfBadChannels; //! Total number of bad channels counter | |
131 | Int_t fIndex; //! Bad channels array index to be stored in fBadChannelsIndexArray | |
132 | Bool_t fInit; //! Initialization boolean (true when histograms are created) | |
133 | Bool_t fVMEMode; //! Initialization boolean (true when using a VME file as input) | |
134 | TObjArray *fDigitsHistogram; //! Digits histogram array | |
135 | TObjArray *fBadChannelsObjArray; //! Bad channels array (size unknown initially) | |
136 | Int_t *fBadChannelsIntArray; //! Bad channels array | |
137 | Int_t *fBadChannelsIndexArray; //! Indices for the bad channels | |
138 | AliITSBadChannelsSPD *fBadChannelsContainer; //! Container object for database storage | |
139 | ||
140 | ClassDef(AliITSPreprocessorSPD,1) | |
141 | }; | |
142 | ||
143 | #endif |