]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSHandleDaSSD.h
For Pythia with tune don't switch off MI in ConfigHeavyFlavor
[u/mrichter/AliRoot.git] / ITS / AliITSHandleDaSSD.h
... / ...
CommitLineData
1#ifndef ALIITSHANDLEDASSD_H
2#define ALIITSHANDLEDASSD_H
3
4/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6/* */
7/* $Id$ */
8
9#include <string>
10#include "TObject.h"
11#include "TArrayS.h"
12#include "AliITSModuleDaSSD.h"
13#include "AliITSBadChannelsSSDv2.h"
14#include "AliITSNoiseSSDv2.h"
15
16///////////////////////////////////////////////////////////////////////////////
17///
18/// This class provides ITS SSD data handling
19/// used by DA.
20// Author: Oleksandr Borysov
21// Date: 09/02/2010
22///////////////////////////////////////////////////////////////////////////////
23
24using namespace std;
25
26class AliITSHandleDaSSD : public TObject {
27 public :
28 AliITSHandleDaSSD();
29 explicit AliITSHandleDaSSD(Char_t *rdfname);
30 AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc);
31 AliITSHandleDaSSD& operator = (const AliITSHandleDaSSD& ssdadldc);
32 virtual ~AliITSHandleDaSSD();
33
34 virtual Bool_t Init(Char_t *rdfname);
35 Bool_t SetRawFileName (Char_t *rdfname) {return Init(rdfname); }
36
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) { if (zsm >= 0) if (static_cast<UInt_t>(zsm) <= fgkZsBitMask) 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); }
55 Float_t GetPedestalThresholdFactor() const { return fPedestalThresholdFactor; }
56 Float_t GetCmThresholdFactor() const { return fCmThresholdFactor; }
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
61 Int_t GetNumberOfModules() const { return fNumberOfModules; }
62 UInt_t GetLdcId() const { return fLdcId; }
63 UInt_t GetRunId() const { return fRunId; }
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;}
67 Int_t GetModuleIndex (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
68 AliITSChannelDaSSD* GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const;
69 AliITSNoiseSSDv2* GetCalibrationOCDBNoise() const;
70 AliITSBadChannelsSSDv2* GetCalibrationBadChannels() const;
71 Bool_t SaveCalibrationSSDLDC(Char_t*& dafname);
72 Int_t MergeBadChannels(AliITSBadChannelsSSDv2*& bcl) const;
73
74 void SetModIndProcessed(Int_t mi) {fModIndProcessed = mi;}
75 void SetModIndRead (Int_t mr) {fModIndRead = mr;}
76 Bool_t SetNumberOfModules (const Int_t numberofmodules);
77 Bool_t SetModule(AliITSModuleDaSSD *const module, const Int_t index);
78 virtual Bool_t ReadStaticBadChannelsMap(const Char_t *filename = NULL);
79 virtual Bool_t ReadDDLModuleMap(const Char_t *filename = NULL);
80 Int_t ReadCalibrationDataFile (char* fileName, const Long_t eventsnumber);
81 virtual Int_t ReadModuleRawData (const Int_t modulesnumber);
82
83 virtual Bool_t CalculatePedestal(AliITSModuleDaSSD *const module);
84 virtual Bool_t CalculateNoise(AliITSModuleDaSSD *const module);
85 virtual Bool_t CalculateNoiseCM(AliITSModuleDaSSD *const module);
86 virtual Bool_t CalculateCM(AliITSModuleDaSSD *const module);
87 virtual Bool_t CalculatePedNoiseW(AliITSModuleDaSSD *const module);
88 virtual Bool_t CalculateCMW(AliITSModuleDaSSD *const module);
89 virtual Bool_t CalculateNoiseCMW(AliITSModuleDaSSD *const module);
90 virtual Bool_t AddFeromCm(AliITSModuleDaSSD *const module);
91 virtual Bool_t ProcessRawData(const Int_t nmread = fgkNumberOfSSDModulesPerDdl, const Bool_t usewelford = kTRUE);
92 virtual Bool_t RelocateModules();
93 virtual Bool_t AllocateSimulatedModules(const Int_t copymodind = 0);
94
95 Bool_t AdDataPresent(const Int_t ddl, const Int_t ad) const;
96 Int_t DdlToEquipmentId (Int_t ddl) const { return (512 + ddl); }
97 Int_t ChannelIsBad(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const;
98 UChar_t EvaluateIfChannelIsBad(const AliITSModuleDaSSD *const module, const Int_t stripn) const;
99 Int_t LadderIsOff(const UChar_t ddl, const UChar_t ad, const UChar_t adc) const;
100 Bool_t SaveEqSlotCalibrationData(const Int_t ddl, const Int_t ad, const Char_t *fname) const;
101 ULong_t OffsetValue(const AliITSChannelDaSSD *strip, const UChar_t ddl = 0, const UChar_t ad = 0,
102 const UChar_t adc = 0, const Int_t strn = -1) const;
103 ULong_t OffsetValue(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const;
104 ULong_t ZsThreshold(AliITSChannelDaSSD *strip) const;
105 ULong_t ZsThreshold(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const;
106
107 virtual void Reset();
108 virtual Short_t RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
109 Bool_t DumpModInfo(const Float_t meannosethreshold) const;
110 Bool_t PrintModCalibrationData(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Char_t *fname = NULL) const;
111 Int_t CheckOffChips() const;
112 void DumpInitData(const Char_t *str = "") const;
113 void DeleteSignalAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteSignal();}
114 void DeleteSignal() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteSignal();}
115 void DeleteCMAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteCM();}
116 void DeleteCM() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCM();}
117 void DeleteCMFerom() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCMFerom ();}
118
119 static Int_t GetNumberOfSSDModulesConst() { return fgkNumberOfSSDModules; }
120
121 protected :
122
123 static const Int_t fgkNumberOfSSDModules ; // Number of SSD modules in ITS
124 static const Int_t fgkNumberOfSSDModulesPerDdl; // Number of SSD modules in DDL
125 static const Int_t fgkNumberOfSSDModulesPerSlot; // Number of SSD modules in Slot
126 static const Short_t fgkMinSSDModuleId; // Initial SSD modules number
127 static const Int_t fgkNumberOfSSDDDLs; // Number of DDLs in SSD
128 static const Int_t fgkNumberOfSSDSlotsPerDDL; // Number of SSD slots per DDL
129 static const Float_t fgkPedestalThresholdFactor; // Defalt value for fPedestalThresholdFactor
130 static const Float_t fgkCmThresholdFactor; // Defalt value for fCmThresholdFactor
131
132 static const UInt_t fgkZsBitMask ; // Bit mask for FEROM ZS
133 static const UInt_t fgkOffSetBitMask; // Bit mask for FEROM Offset correction
134 static const UInt_t fgkBadChannelMask; // Mask to suppress the channel from the bad channel list
135 static const Int_t fgkAdcPerDBlock; // FEROM configuration file constant
136
137 Char_t *fRawDataFileName; // Name of the file with raw data
138 Int_t fNumberOfModules; // number of AliITSModuleDaSSD to allocate
139 AliITSModuleDaSSD **fModules; //[fNumberOfModules] array of pointer on AliITSModuleDaSSD objects (1698 SSD Modules)
140 Int_t fModIndProcessed; //! index of the last module in fModules array with processed data
141 Int_t fModIndRead; //! index of the last module in fModules array with adc data present (read)
142 Int_t *fModIndex; //! index array for fModules
143 TArrayS fEqIndex; //! index array of equipmnts (DDLs).
144 Long_t fNumberOfEvents; // Number of physics or calibration events in raw data file fRawDataFileName
145
146 AliITSBadChannelsSSDv2 *fBadChannelsList; //! List of bad channels: static or created on base of calculated noise and pedestal
147 Int_t *fDDLModuleMap; //! DDL map
148 TArrayS fALaddersOff; //! Lisst of ladders of side A that are off and should be suppressed
149 TArrayS fCLaddersOff; //! Lisst of ladders of side C that are off and should be suppressed
150
151 UInt_t fLdcId; // LDC number, read from header
152 UInt_t fRunId; // Run number, read from header
153
154 Float_t fPedestalThresholdFactor; // configuration parameter: ThresholdFactor for pedestal calculation
155 Float_t fCmThresholdFactor; // configuration parameter: ThresholdFactor for CM calculation
156 Int_t fZsDefault; // default value for ZS threshold
157 Int_t fOffsetDefault; // default value for offset correction
158 Int_t fZsMinimum; // minimum value for ZS threshold
159 Byte_t fMergeBCLists; // Flag, if it is not zero the static bad channels list is merged with dynamic one
160 Float_t fZsFactor; // zs factor 3.0
161
162 protected :
163 Bool_t SignalOutOfRange (const Short_t signal) const { return ((signal >= AliITSChannelDaSSD::GetOverflowConst()) ||
164 (signal <= AliITSChannelDaSSD::GetUnderflowConst())); }
165 string ConvBase(const unsigned long value, const long base) const;
166
167 ClassDef(AliITSHandleDaSSD, 8)
168
169};
170
171#endif
172