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