Updated online raw data QA for the SSD - occupancy calculation per module (Panos)
[u/mrichter/AliRoot.git] / ITS / AliITSHandleDaSSD.h
CommitLineData
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"
f67db810 11#include "AliITSModuleDaSSD.h"
12
223dda26 13///////////////////////////////////////////////////////////////////////////////
14///
15/// This class provides ITS SSD data handling
16/// used by DA.
2e2c6def 17// Author: Oleksandr Borysov
6e7691a5 18// Date: 19/05/2008
223dda26 19///////////////////////////////////////////////////////////////////////////////
20
be4f467e 21using namespace std;
22
223dda26 23class TObjArray;
f67db810 24
25class AliITSHandleDaSSD : public TObject {
26 public :
27 AliITSHandleDaSSD();
c4d90345 28 explicit AliITSHandleDaSSD(Char_t *rdfname);
f67db810 29 AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc);
30 AliITSHandleDaSSD& operator = (const AliITSHandleDaSSD& ssdadldc);
31 virtual ~AliITSHandleDaSSD();
32
be4f467e 33 virtual Bool_t Init(Char_t *rdfname);
c4d90345 34 Bool_t SetRawFileName (Char_t *rdfname) {return Init(rdfname); }
f67db810 35
be4f467e 36 void SetZsDefaul(Int_t zs) { fZsDefault = zs; }
37 void SetOffsetDefault(Int_t offs) { fOffsetDefault = offs; }
38 void SetZsFactor(Float_t zsf) { fZsFactor = zsf; }
39 void SetPedestalThresholdFactor(Float_t pthf) { fPedestalThresholdFactor = pthf; }
40 void SetCmThresholdFactor(Float_t cmthf) { fCmThresholdFactor = cmthf; }
41
42 Int_t GetZsDefault() const { return fZsDefault; }
43 Int_t GetOffsetDefault() const { return fOffsetDefault; }
44 Float_t GetZsFactor() const { return fZsFactor; }
45 Float_t GetPedestalThresholdFactor() const { return fPedestalThresholdFactor; }
46 Float_t GetCmThresholdFactor() const { return fCmThresholdFactor; }
47
c4d90345 48 Int_t GetNumberOfModules() const { return fNumberOfModules; }
49 UInt_t GetLdcId() const { return fLdcId; }
50 UInt_t GetRunId() const { return fRunId; }
f67db810 51 AliITSModuleDaSSD* GetModule (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
52 AliITSModuleDaSSD* GetModule (const Int_t index) const
53 {if ((fModules) && (index < fNumberOfModules)) return fModules[index]; else return NULL;}
c4d90345 54 Int_t GetModuleIndex (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
f67db810 55 AliITSChannelDaSSD* GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const;
56 TObjArray* GetCalibrationSSDLDC() const;
c4d90345 57 Bool_t SaveCalibrationSSDLDC(Char_t*& dafname) const;
f67db810 58
c4d90345 59 void SetModIndProcessed(Int_t mi) {fModIndProcessed = mi;}
60 void SetModIndRead (Int_t mr) {fModIndRead = mr;}
f67db810 61 Bool_t SetNumberOfModules (const Int_t numberofmodules);
62 Bool_t SetModule(AliITSModuleDaSSD *const module, const Int_t index);
6e7691a5 63 virtual Bool_t ReadStaticBadChannelsMap(const Char_t *filename = NULL);
64 virtual Bool_t ReadDDLModuleMap(const Char_t *filename = NULL);
371588bb 65 Int_t ReadCalibrationDataFile (char* fileName, const Long_t eventsnumber);
c4d90345 66 Int_t ReadModuleRawData (const Int_t modulesnumber);
67
68 virtual Bool_t CalculatePedestal(AliITSModuleDaSSD *const module);
a69c8ba0 69 virtual Bool_t CalculateNoise(AliITSModuleDaSSD *const module);
c4d90345 70 virtual Bool_t CalculateNoiseCM(AliITSModuleDaSSD *const module);
71 virtual Bool_t CalculateCM(AliITSModuleDaSSD *const module);
371588bb 72 virtual Bool_t AddFeromCm(AliITSModuleDaSSD *const module);
c4d90345 73 virtual Bool_t ProcessRawData(const Int_t nmread = fgkNumberOfSSDModulesPerDdl);
74 virtual Bool_t RelocateModules();
75 virtual Bool_t AllocateSimulatedModules(const Int_t copymodind = 0);
be4f467e 76
77 Bool_t AdDataPresent(const Int_t ddl, const Int_t ad) const;
78 Int_t DdlToEquipmentId (Int_t ddl) const { return (512 + ddl); }
79 Int_t ChannelIsBad(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const;
80 Bool_t SaveEqSlotCalibrationData(const Int_t ddl, const Int_t ad, const Char_t *fname) const;
81 ULong_t OffsetValue(const AliITSChannelDaSSD *strip, const UChar_t ddl = 0, const UChar_t ad = 0,
82 const UChar_t adc = 0, const Int_t strn = -1) const;
83 ULong_t OffsetValue(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const;
84 ULong_t ZsThreshold(AliITSChannelDaSSD *strip) const;
85 ULong_t ZsThreshold(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const;
86
c4d90345 87 virtual void Reset();
88 virtual Short_t RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
89 Bool_t DumpModInfo(const Float_t meannosethreshold) const;
90 Bool_t PrintModCalibrationData(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Char_t *fname = NULL) const;
91 void DumpInitData(const Char_t *str = "") const;
92 void DeleteSignalAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteSignal();}
93 void DeleteSignal() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteSignal();}
a69c8ba0 94 void DeleteCMAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteCM();}
95 void DeleteCM() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCM();}
371588bb 96 void DeleteCMFerom() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCMFerom ();}
f67db810 97
98 static Int_t GetNumberOfSSDModulesConst() { return fgkNumberOfSSDModules; }
99
100 protected :
be4f467e 101
c4d90345 102 static const Int_t fgkNumberOfSSDModules ; // Number of SSD modules in ITS
2e2c6def 103 static const Int_t fgkNumberOfSSDModulesPerDdl; // Number of SSD modules in DDL
104 static const Int_t fgkNumberOfSSDModulesPerSlot; // Number of SSD modules in Slot
6e7691a5 105 static const Int_t fgkNumberOfSSDDDLs; // Number of DDLs in SSD
be4f467e 106 static const Int_t fgkNumberOfSSDSlotsPerDDL; // Number of SSD slots per DDL
c4d90345 107 static const Float_t fgkPedestalThresholdFactor; // Defalt value for fPedestalThresholdFactor
108 static const Float_t fgkCmThresholdFactor; // Defalt value for fCmThresholdFactor
be4f467e 109
110 static const UInt_t fgkZsBitMask ; // Bit mask for FEROM ZS
111 static const UInt_t fgkOffSetBitMask; // Bit mask for FEROM Offset correction
112 static const UInt_t fgkBadChannelMask; // Mask to suppress the channel from the bad channel list
113 static const Int_t fgkAdcPerDBlock; // FEROM configuration file constant
114
c4d90345 115 Char_t *fRawDataFileName; // Name of the file with raw data
f67db810 116 Int_t fNumberOfModules; // number of AliITSModuleDaSSD to allocate
c4d90345 117 AliITSModuleDaSSD **fModules; //[fNumberOfModules] array of pointer on AliITSModuleDaSSD objects (1698 SSD Modules)
118 Int_t fModIndProcessed; //! index of the last module in fModules array with processed data
119 Int_t fModIndRead; //! index of the last module in fModules array with adc data present (read)
2e2c6def 120 Int_t *fModIndex; //! index array for fModules
c4d90345 121 Long_t fNumberOfEvents; // Number of physics or calibration events in raw data file fRawDataFileName
6e7691a5 122
123 TObjArray *fStaticBadChannelsMap; // Static bad channels map read from the file
124 Int_t *fDDLModuleMap; //! DDL map
c4d90345 125
f67db810 126 UInt_t fLdcId; // LDC number, read from header
127 UInt_t fRunId; // Run number, read from header
128
be4f467e 129 Float_t fPedestalThresholdFactor; // configuration parameter: ThresholdFactor for pedestal calculation
130 Float_t fCmThresholdFactor; // configuration parameter: ThresholdFactor for CM calculation
131 Int_t fZsDefault; // default value for ZS threshold
132 Int_t fOffsetDefault; // default value for offset correction
133 Float_t fZsFactor; // zs factor 3.0
c4d90345 134
be4f467e 135 protected :
f67db810 136 Bool_t SignalOutOfRange (const Short_t signal) const { return (signal >= AliITSChannelDaSSD::GetOverflowConst()); }
be4f467e 137 string ConvBase(const unsigned long value, const long base) const;
f67db810 138
6e7691a5 139 ClassDef(AliITSHandleDaSSD, 5)
f67db810 140
141};
142
143#endif
be4f467e 144