Included ReadFromFile and WriteToFile methods to read/write from ASCII files and...
[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
223dda26 9#include "TObject.h"
f67db810 10#include "AliITSModuleDaSSD.h"
11
223dda26 12///////////////////////////////////////////////////////////////////////////////
13///
14/// This class provides ITS SSD data handling
15/// used by DA.
2e2c6def 16// Author: Oleksandr Borysov
6e7691a5 17// Date: 19/05/2008
223dda26 18///////////////////////////////////////////////////////////////////////////////
19
20class TObjArray;
f67db810 21
22class AliITSHandleDaSSD : public TObject {
23 public :
24 AliITSHandleDaSSD();
c4d90345 25 explicit AliITSHandleDaSSD(Char_t *rdfname);
f67db810 26 AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc);
27 AliITSHandleDaSSD& operator = (const AliITSHandleDaSSD& ssdadldc);
28 virtual ~AliITSHandleDaSSD();
29
c4d90345 30 virtual Bool_t Init(Char_t *rdfname, const Char_t *configfname = NULL);
31 virtual Bool_t ReadConfigurationFile(const Char_t *configfname = NULL) const;
32 Bool_t SetRawFileName (Char_t *rdfname) {return Init(rdfname); }
f67db810 33
c4d90345 34 Int_t GetNumberOfModules() const { return fNumberOfModules; }
35 UInt_t GetLdcId() const { return fLdcId; }
36 UInt_t GetRunId() const { return fRunId; }
f67db810 37 AliITSModuleDaSSD* GetModule (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
38 AliITSModuleDaSSD* GetModule (const Int_t index) const
39 {if ((fModules) && (index < fNumberOfModules)) return fModules[index]; else return NULL;}
c4d90345 40 Int_t GetModuleIndex (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
f67db810 41 AliITSChannelDaSSD* GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const;
42 TObjArray* GetCalibrationSSDLDC() const;
c4d90345 43 Bool_t SaveCalibrationSSDLDC(Char_t*& dafname) const;
f67db810 44
c4d90345 45 void SetModIndProcessed(Int_t mi) {fModIndProcessed = mi;}
46 void SetModIndRead (Int_t mr) {fModIndRead = mr;}
f67db810 47 Bool_t SetNumberOfModules (const Int_t numberofmodules);
48 Bool_t SetModule(AliITSModuleDaSSD *const module, const Int_t index);
6e7691a5 49 virtual Bool_t ReadStaticBadChannelsMap(const Char_t *filename = NULL);
50 virtual Bool_t ReadDDLModuleMap(const Char_t *filename = NULL);
371588bb 51 Int_t ReadCalibrationDataFile (char* fileName, const Long_t eventsnumber);
c4d90345 52 Int_t ReadModuleRawData (const Int_t modulesnumber);
53
54 virtual Bool_t CalculatePedestal(AliITSModuleDaSSD *const module);
a69c8ba0 55 virtual Bool_t CalculateNoise(AliITSModuleDaSSD *const module);
c4d90345 56 virtual Bool_t CalculateNoiseCM(AliITSModuleDaSSD *const module);
57 virtual Bool_t CalculateCM(AliITSModuleDaSSD *const module);
371588bb 58 virtual Bool_t AddFeromCm(AliITSModuleDaSSD *const module);
c4d90345 59 virtual Bool_t ProcessRawData(const Int_t nmread = fgkNumberOfSSDModulesPerDdl);
60 virtual Bool_t RelocateModules();
61 virtual Bool_t AllocateSimulatedModules(const Int_t copymodind = 0);
62
63 virtual void Reset();
64 virtual Short_t RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const;
65 Bool_t DumpModInfo(const Float_t meannosethreshold) const;
66 Bool_t PrintModCalibrationData(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Char_t *fname = NULL) const;
67 void DumpInitData(const Char_t *str = "") const;
68 void DeleteSignalAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteSignal();}
69 void DeleteSignal() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteSignal();}
a69c8ba0 70 void DeleteCMAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteCM();}
71 void DeleteCM() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCM();}
371588bb 72 void DeleteCMFerom() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteCMFerom ();}
f67db810 73
74 static Int_t GetNumberOfSSDModulesConst() { return fgkNumberOfSSDModules; }
75
76 protected :
6e7691a5 77
c4d90345 78 static const Int_t fgkNumberOfSSDModules ; // Number of SSD modules in ITS
2e2c6def 79 static const Int_t fgkNumberOfSSDModulesPerDdl; // Number of SSD modules in DDL
80 static const Int_t fgkNumberOfSSDModulesPerSlot; // Number of SSD modules in Slot
6e7691a5 81 static const Int_t fgkNumberOfSSDDDLs; // Number of DDLs in SSD
c4d90345 82 static const Float_t fgkPedestalThresholdFactor; // Defalt value for fPedestalThresholdFactor
83 static const Float_t fgkCmThresholdFactor; // Defalt value for fCmThresholdFactor
6e7691a5 84
c4d90345 85 Char_t *fRawDataFileName; // Name of the file with raw data
f67db810 86 Int_t fNumberOfModules; // number of AliITSModuleDaSSD to allocate
c4d90345 87 AliITSModuleDaSSD **fModules; //[fNumberOfModules] array of pointer on AliITSModuleDaSSD objects (1698 SSD Modules)
88 Int_t fModIndProcessed; //! index of the last module in fModules array with processed data
89 Int_t fModIndRead; //! index of the last module in fModules array with adc data present (read)
2e2c6def 90 Int_t *fModIndex; //! index array for fModules
c4d90345 91 Long_t fNumberOfEvents; // Number of physics or calibration events in raw data file fRawDataFileName
6e7691a5 92
93 TObjArray *fStaticBadChannelsMap; // Static bad channels map read from the file
94 Int_t *fDDLModuleMap; //! DDL map
c4d90345 95
f67db810 96 UInt_t fLdcId; // LDC number, read from header
97 UInt_t fRunId; // Run number, read from header
98
c4d90345 99 Float_t fPedestalThresholdFactor; // configuration parameter: ThresholdFactor for pedestal calculation
100 Float_t fCmThresholdFactor; // configuration parameter: ThresholdFactor for CM calculation
101
f67db810 102 private :
f67db810 103 Bool_t SignalOutOfRange (const Short_t signal) const { return (signal >= AliITSChannelDaSSD::GetOverflowConst()); }
104
6e7691a5 105 ClassDef(AliITSHandleDaSSD, 5)
f67db810 106
107};
108
109#endif