]>
Commit | Line | Data |
---|---|---|
f67db810 | 1 | #ifndef ALIITSHANDLEDASSD_H |
2 | #define ALIITSHANDLEDASSD_H | |
3 | ||
223dda26 | 4 | /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * |
5 | * See cxx source for full Copyright notice */ | |
6 | /* */ | |
371588bb | 7 | /* $Id$ */ |
f67db810 | 8 | |
be4f467e | 9 | #include <string> |
223dda26 | 10 | #include "TObject.h" |
61a57d07 | 11 | #include "TArrayS.h" |
f67db810 | 12 | #include "AliITSModuleDaSSD.h" |
13 | ||
223dda26 | 14 | /////////////////////////////////////////////////////////////////////////////// |
15 | /// | |
16 | /// This class provides ITS SSD data handling | |
17 | /// used by DA. | |
2e2c6def | 18 | // Author: Oleksandr Borysov |
61a57d07 | 19 | // Date: 18/07/2008 |
223dda26 | 20 | /////////////////////////////////////////////////////////////////////////////// |
21 | ||
be4f467e | 22 | using namespace std; |
23 | ||
f67db810 | 24 | class AliITSHandleDaSSD : public TObject { |
25 | public : | |
26 | AliITSHandleDaSSD(); | |
c4d90345 | 27 | explicit AliITSHandleDaSSD(Char_t *rdfname); |
f67db810 | 28 | AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc); |
29 | AliITSHandleDaSSD& operator = (const AliITSHandleDaSSD& ssdadldc); | |
30 | virtual ~AliITSHandleDaSSD(); | |
31 | ||
be4f467e | 32 | virtual Bool_t Init(Char_t *rdfname); |
c4d90345 | 33 | Bool_t SetRawFileName (Char_t *rdfname) {return Init(rdfname); } |
f67db810 | 34 | |
61a57d07 | 35 | void SetZsDefaul(const Int_t zs) { fZsDefault = zs; } |
36 | void SetOffsetDefault(const Int_t offs) { fOffsetDefault = offs; } | |
37 | void SetZsMinimum(const Int_t zsm) { fZsMinimum = zsm; } | |
38 | void SetMergeBCFlag(const Byte_t mbcf) { fMergeBCLists = mbcf; } | |
39 | void SetZsFactor(const Float_t zsf) { fZsFactor = zsf; } | |
40 | void SetPedestalThresholdFactor(const Float_t pthf) { fPedestalThresholdFactor = pthf; } | |
41 | void SetCmThresholdFactor(const Float_t cmthf) { fCmThresholdFactor = cmthf; } | |
42 | void SetALaddersOff(const Int_t n, const Short_t *allist) { fALaddersOff.Set(n, allist); } | |
43 | void SetCLaddersOff(const Int_t n, const Short_t *cllist) { fCLaddersOff.Set(n, cllist); } | |
44 | void SetLaddersOff(const Int_t na, const Short_t *allist, const Int_t nc, const Short_t *cllist) | |
45 | { SetALaddersOff(na, allist); SetCLaddersOff(nc, cllist); } | |
46 | ||
47 | Int_t GetNumberOfEvents() const { return fNumberOfEvents; } | |
48 | Int_t GetZsDefault() const { return fZsDefault; } | |
49 | Int_t GetOffsetDefault() const { return fOffsetDefault; } | |
50 | Float_t GetZsFactor() const { return fZsFactor; } | |
51 | Int_t GetZsMinimum() const { return fZsMinimum; } | |
52 | Bool_t GetMergeBCFlag() const { return static_cast<Bool_t>(fMergeBCLists); } | |
be4f467e | 53 | Float_t GetPedestalThresholdFactor() const { return fPedestalThresholdFactor; } |
54 | Float_t GetCmThresholdFactor() const { return fCmThresholdFactor; } | |
61a57d07 | 55 | TArrayS GetALaddersOff () const { return fALaddersOff; } |
56 | TArrayS GetCLaddersOff () const { return fCLaddersOff; } | |
57 | Int_t GetEqIndex(const Short_t eq) const { for(Int_t i = 0; i < fEqIndex.GetSize(); i++) if (eq == fEqIndex.At(i)) return i; return -1; } | |
58 | ||
c4d90345 | 59 | Int_t GetNumberOfModules() const { return fNumberOfModules; } |
60 | UInt_t GetLdcId() const { return fLdcId; } | |
61 | UInt_t GetRunId() const { return fRunId; } | |
f67db810 | 62 | AliITSModuleDaSSD* GetModule (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const; |
63 | AliITSModuleDaSSD* GetModule (const Int_t index) const | |
64 | {if ((fModules) && (index < fNumberOfModules)) return fModules[index]; else return NULL;} | |
c4d90345 | 65 | Int_t GetModuleIndex (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const; |
61a57d07 | 66 | AliITSChannelDaSSD* GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const; |
67 | AliITSNoiseSSD* GetCalibrationOCDBNoise() const; | |
68 | AliITSBadChannelsSSD* GetCalibrationBadChannels() const; | |
69 | Bool_t SaveCalibrationSSDLDC(Char_t*& dafname); | |
70 | Int_t MergeBadChannels(AliITSBadChannelsSSD*& bcl) const; | |
f67db810 | 71 | |
c4d90345 | 72 | void SetModIndProcessed(Int_t mi) {fModIndProcessed = mi;} |
73 | void SetModIndRead (Int_t mr) {fModIndRead = mr;} | |
f67db810 | 74 | Bool_t SetNumberOfModules (const Int_t numberofmodules); |
75 | Bool_t SetModule(AliITSModuleDaSSD *const module, const Int_t index); | |
6e7691a5 | 76 | virtual Bool_t ReadStaticBadChannelsMap(const Char_t *filename = NULL); |
77 | virtual Bool_t ReadDDLModuleMap(const Char_t *filename = NULL); | |
371588bb | 78 | Int_t ReadCalibrationDataFile (char* fileName, const Long_t eventsnumber); |
61a57d07 | 79 | virtual Int_t ReadModuleRawData (const Int_t modulesnumber); |
c4d90345 | 80 | |
81 | virtual Bool_t CalculatePedestal(AliITSModuleDaSSD *const module); | |
a69c8ba0 | 82 | virtual Bool_t CalculateNoise(AliITSModuleDaSSD *const module); |
c4d90345 | 83 | virtual Bool_t CalculateNoiseCM(AliITSModuleDaSSD *const module); |
84 | virtual Bool_t CalculateCM(AliITSModuleDaSSD *const module); | |
371588bb | 85 | virtual Bool_t AddFeromCm(AliITSModuleDaSSD *const module); |
c4d90345 | 86 | virtual Bool_t ProcessRawData(const Int_t nmread = fgkNumberOfSSDModulesPerDdl); |
87 | virtual Bool_t RelocateModules(); | |
88 | virtual Bool_t AllocateSimulatedModules(const Int_t copymodind = 0); | |
be4f467e | 89 | |
90 | Bool_t AdDataPresent(const Int_t ddl, const Int_t ad) const; | |
91 | Int_t DdlToEquipmentId (Int_t ddl) const { return (512 + ddl); } | |
92 | Int_t ChannelIsBad(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const; | |
61a57d07 | 93 | Int_t LadderIsOff(const UChar_t ddl, const UChar_t ad, const UChar_t adc) const; |
be4f467e | 94 | Bool_t SaveEqSlotCalibrationData(const Int_t ddl, const Int_t ad, const Char_t *fname) const; |
95 | ULong_t OffsetValue(const AliITSChannelDaSSD *strip, const UChar_t ddl = 0, const UChar_t ad = 0, | |
96 | const UChar_t adc = 0, const Int_t strn = -1) const; | |
97 | ULong_t OffsetValue(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const; | |
98 | ULong_t ZsThreshold(AliITSChannelDaSSD *strip) const; | |
99 | ULong_t ZsThreshold(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const; | |
100 | ||
c4d90345 | 101 | virtual void Reset(); |
102 | virtual Short_t RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const; | |
103 | Bool_t DumpModInfo(const Float_t meannosethreshold) const; | |
104 | Bool_t PrintModCalibrationData(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Char_t *fname = NULL) const; | |
61a57d07 | 105 | Int_t CheckOffChips() const; |
c4d90345 | 106 | void DumpInitData(const Char_t *str = "") const; |
107 | void DeleteSignalAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteSignal();} | |
108 | void DeleteSignal() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteSignal();} | |
a69c8ba0 | 109 | void DeleteCMAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteCM();} |
110 | void DeleteCM() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCM();} | |
371588bb | 111 | void DeleteCMFerom() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCMFerom ();} |
f67db810 | 112 | |
113 | static Int_t GetNumberOfSSDModulesConst() { return fgkNumberOfSSDModules; } | |
114 | ||
115 | protected : | |
be4f467e | 116 | |
c4d90345 | 117 | static const Int_t fgkNumberOfSSDModules ; // Number of SSD modules in ITS |
2e2c6def | 118 | static const Int_t fgkNumberOfSSDModulesPerDdl; // Number of SSD modules in DDL |
119 | static const Int_t fgkNumberOfSSDModulesPerSlot; // Number of SSD modules in Slot | |
61a57d07 | 120 | static const Short_t fgkMinSSDModuleId; // Initial SSD modules number |
6e7691a5 | 121 | static const Int_t fgkNumberOfSSDDDLs; // Number of DDLs in SSD |
be4f467e | 122 | static const Int_t fgkNumberOfSSDSlotsPerDDL; // Number of SSD slots per DDL |
c4d90345 | 123 | static const Float_t fgkPedestalThresholdFactor; // Defalt value for fPedestalThresholdFactor |
124 | static const Float_t fgkCmThresholdFactor; // Defalt value for fCmThresholdFactor | |
be4f467e | 125 | |
126 | static const UInt_t fgkZsBitMask ; // Bit mask for FEROM ZS | |
127 | static const UInt_t fgkOffSetBitMask; // Bit mask for FEROM Offset correction | |
128 | static const UInt_t fgkBadChannelMask; // Mask to suppress the channel from the bad channel list | |
129 | static const Int_t fgkAdcPerDBlock; // FEROM configuration file constant | |
130 | ||
61a57d07 | 131 | Char_t *fRawDataFileName; // Name of the file with raw data |
132 | Int_t fNumberOfModules; // number of AliITSModuleDaSSD to allocate | |
133 | AliITSModuleDaSSD **fModules; //[fNumberOfModules] array of pointer on AliITSModuleDaSSD objects (1698 SSD Modules) | |
134 | Int_t fModIndProcessed; //! index of the last module in fModules array with processed data | |
135 | Int_t fModIndRead; //! index of the last module in fModules array with adc data present (read) | |
136 | Int_t *fModIndex; //! index array for fModules | |
137 | TArrayS fEqIndex; //! index array of equipmnts (DDLs). | |
138 | Long_t fNumberOfEvents; // Number of physics or calibration events in raw data file fRawDataFileName | |
139 | ||
140 | AliITSBadChannelsSSD *fBadChannelsList; //! List of bad channels: static or created on base of calculated noise and pedestal | |
141 | Int_t *fDDLModuleMap; //! DDL map | |
142 | TArrayS fALaddersOff; //! Lisst of ladders of side A that are off and should be suppressed | |
143 | TArrayS fCLaddersOff; //! Lisst of ladders of side C that are off and should be suppressed | |
c4d90345 | 144 | |
61a57d07 | 145 | UInt_t fLdcId; // LDC number, read from header |
146 | UInt_t fRunId; // Run number, read from header | |
f67db810 | 147 | |
be4f467e | 148 | Float_t fPedestalThresholdFactor; // configuration parameter: ThresholdFactor for pedestal calculation |
149 | Float_t fCmThresholdFactor; // configuration parameter: ThresholdFactor for CM calculation | |
150 | Int_t fZsDefault; // default value for ZS threshold | |
151 | Int_t fOffsetDefault; // default value for offset correction | |
61a57d07 | 152 | Int_t fZsMinimum; // minimum value for ZS threshold |
153 | Byte_t fMergeBCLists; // Flag, if it is not zero the static bad channels list is merged with dynamic one | |
be4f467e | 154 | Float_t fZsFactor; // zs factor 3.0 |
61a57d07 | 155 | |
be4f467e | 156 | protected : |
61a57d07 | 157 | Bool_t SignalOutOfRange (const Short_t signal) const { return ((signal >= AliITSChannelDaSSD::GetOverflowConst()) || |
158 | (signal <= AliITSChannelDaSSD::GetUnderflowConst())); } | |
be4f467e | 159 | string ConvBase(const unsigned long value, const long base) const; |
f67db810 | 160 | |
61a57d07 | 161 | ClassDef(AliITSHandleDaSSD, 6) |
f67db810 | 162 | |
163 | }; | |
164 | ||
165 | #endif |