Added vertex distribution histos
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRawUtils.h
CommitLineData
ee299369 1#ifndef ALIEMCALRAWUTILS_H
2#define ALIEMCALRAWUTILS_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
e5bbbc4e 7
ee299369 8//_________________________________________________________________________
9// Utility Class for handling Raw data
10// Does all transitions from Digits to Raw and vice versa,
11// for simu and reconstruction
12//
13// Note: the current version is still simplified. Only
14// one raw signal per digit is generated; either high-gain or low-gain
15// Need to add concurrent high and low-gain info in the future
16// No pedestal is added to the raw signal.
17//
18//*-- Author: Marco van Leeuwen (LBL)
19//
20#include "TObject.h" // for ROOT types
feedcab9 21#include <TString.h>
32cd4c24 22//#include "AliCaloRawStreamV3.h"
23class AliCaloRawStreamV3;
e5bbbc4e 24class AliAltroMapping;
ee299369 25class TGraph;
26class TF1;
27class AliRawReader;
65bdc82f 28class AliEMCALGeometry;
ee299369 29
30class AliEMCALRawUtils : public TObject {
31 public:
32 AliEMCALRawUtils();
5544799a 33 AliEMCALRawUtils(AliEMCALGeometry *pGeometry);
ee299369 34 virtual ~AliEMCALRawUtils();
35
65bdc82f 36 AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils); //copy ctor
37 AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils);
38
39 void Digits2Raw();
40 void Raw2Digits(AliRawReader *reader,TClonesArray *digitsArr);
41
82cbdfca 42 void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Int_t amp, Float_t time);
ee299369 43
44 // Signal shape parameters
b4133f05 45 Double_t GetRawFormatHighLowGainFactor() const { return fHighLowGainFactor ;}
09974781 46 Int_t GetRawFormatOrder() const { return fOrder ; }
b4133f05 47 Double_t GetRawFormatTau() const { return fTau ; }
09974781 48 Int_t GetNoiseThreshold() const { return fNoiseThreshold; }
49 Int_t GetNPedSamples() const { return fNPedSamples; }
e2c2134b 50 // get methods for fast fit simulation
51 Double_t GetPedestalValue() const {return fgPedestalValue;}
52 Double_t GetFEENoise() const {return fgFEENoise;}
b4133f05 53
54 void SetRawFormatHighLowGainFactor(Double_t val) {fHighLowGainFactor=val;}
55 void SetRawFormatOrder(Int_t val) {fOrder=val; }
56 void SetRawFormatTau(Double_t val) {fTau=val; }
57 void SetNoiseThreshold(Int_t val) {fNoiseThreshold=val; }
58 void SetNPedSamples(Int_t val) {fNPedSamples=val; }
e2c2134b 59 // set methods for fast fit simulation
60 void SetFEENoise(Double_t val) {fgFEENoise = val;}
61 void SetRawFormatTimeBins(Int_t val) {fgTimeBins = val;}
62
63 static Int_t GetRawFormatTimeBins() { return fgTimeBins ; }
64 static Double_t GetRawFormatTimeMax() { return fgTimeBins*fgTimeBinWidth; }
82cbdfca 65 static Double_t GetRawFormatTimeBinWidth() { return fgTimeBinWidth; }
85c25c2e 66 static Double_t GetRawFormatTimeBin()
67 { return GetRawFormatTimeMax() / GetRawFormatTimeBins(); }
ee299369 68 Double_t GetRawFormatTimeTrigger() const { return fgTimeTrigger ; }
69 Int_t GetRawFormatThreshold() const { return fgThreshold ; }
70 Int_t GetRawFormatDDLPerSuperModule() const { return fgDDLPerSuperModule ; }
71
feedcab9 72 virtual Option_t* GetOption() const { return fOption.Data(); }
73 void SetOption(Option_t* opt) { fOption = opt; }
74
ee299369 75 // Signal shape functions
e5bbbc4e 76 void FitRaw(TGraph * gSig, TF1* signalF, Float_t & amp, Float_t & time) const ;
ee299369 77 static Double_t RawResponseFunction(Double_t *x, Double_t *par);
78 Bool_t RawSampledResponse(Double_t dtime, Double_t damp, Int_t * adcH, Int_t * adcL) const;
79
ee299369 80
81 private:
82 Double_t fHighLowGainFactor ; // high to low gain factor for the raw RO signal
b4133f05 83 Int_t fOrder ; // order of the gamma function for the RO signal
84 Double_t fTau ; // tau parameter of gamma function for the RO signal
85 Int_t fNoiseThreshold; // threshold to consider signal or noise
86 Int_t fNPedSamples; // number of samples to use in pedestal calculation
ee299369 87
b4133f05 88 static const Int_t fgkOverflowCut = 950; // cut to discriminate overflowed channels
b4133f05 89 static const Int_t fgkRawSignalOverflow = 0x3FF; // maximum signal (10 bits)
e2c2134b 90 static Int_t fgTimeBins; // number of sampling bins of the raw RO signal
b4133f05 91
92 static Double_t fgTimeTrigger ; // time of the trigger for the RO signal
82cbdfca 93 static Double_t fgTimeBinWidth; // maximum sampled time of the raw RO signal
ee299369 94 static Int_t fgThreshold; // threshold
95 static Int_t fgDDLPerSuperModule; // number of DDL per SuperModule
fe93d365 96 static Int_t fgPedestalValue; // pedestal value for Digits2Raw
97 static Double_t fgFEENoise; // electronics noise in ADC units
feedcab9 98
65bdc82f 99 AliEMCALGeometry* fGeom; //geometry
21cad85c 100 AliAltroMapping* fMapping[4]; //only two for now
65bdc82f 101
feedcab9 102 TString fOption; //! option passed from Reconstructor
b4133f05 103
fe93d365 104 ClassDef(AliEMCALRawUtils,3) // utilities for raw signal fitting
ee299369 105};
106
107#endif