Changes to take into account cases where the version of the file
[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$ */
7/* History of cvs commits:
8 *
9 * $Log$
feedcab9 10 * Revision 1.3 2007/10/31 17:15:24 mvl
11 * Fixed bug in raw data unpacking; Added pedestal to signal fit; Added logic to deal with high/low gain
12 *
82cbdfca 13 * Revision 1.2 2007/09/03 20:55:35 jklay
14 * EMCAL e-by-e reconstruction methods from Cvetan
15 *
c47157cd 16 * Revision 1.1 2007/03/17 19:56:38 mvl
17 * Moved signal shape routines from AliEMCAL to separate class AliEMCALRawUtils to streamline raw data reconstruction code.
18 *
ee299369 19 *
20 */
21//_________________________________________________________________________
22// Utility Class for handling Raw data
23// Does all transitions from Digits to Raw and vice versa,
24// for simu and reconstruction
25//
26// Note: the current version is still simplified. Only
27// one raw signal per digit is generated; either high-gain or low-gain
28// Need to add concurrent high and low-gain info in the future
29// No pedestal is added to the raw signal.
30//
31//*-- Author: Marco van Leeuwen (LBL)
32//
33#include "TObject.h" // for ROOT types
feedcab9 34#include <TString.h>
35#include "AliCaloRawStream.h"
ee299369 36
37class TGraph;
38class TF1;
39class AliRawReader;
65bdc82f 40class AliEMCALGeometry;
ee299369 41
42class AliEMCALRawUtils : public TObject {
43 public:
44 AliEMCALRawUtils();
5544799a 45 AliEMCALRawUtils(AliEMCALGeometry *pGeometry);
ee299369 46 virtual ~AliEMCALRawUtils();
47
65bdc82f 48 AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils); //copy ctor
49 AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils);
50
51 void Digits2Raw();
52 void Raw2Digits(AliRawReader *reader,TClonesArray *digitsArr);
53
82cbdfca 54 void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Int_t amp, Float_t time);
ee299369 55
56 // Signal shape parameters
b4133f05 57 Double_t GetRawFormatHighLowGainFactor() const { return fHighLowGainFactor ;}
58 Int_t GetRawFormatOrder() const { return fOrder ; }
59 Double_t GetRawFormatTau() const { return fTau ; }
60 Int_t GetNoiseThreshold() const { return fNoiseThreshold; }
61 Int_t GetNPedSamples() const { return fNPedSamples; }
62
63 void SetRawFormatHighLowGainFactor(Double_t val) {fHighLowGainFactor=val;}
64 void SetRawFormatOrder(Int_t val) {fOrder=val; }
65 void SetRawFormatTau(Double_t val) {fTau=val; }
66 void SetNoiseThreshold(Int_t val) {fNoiseThreshold=val; }
67 void SetNPedSamples(Int_t val) {fNPedSamples=val; }
68
ee299369 69 static Int_t GetRawFormatTimeBins() { return fgkTimeBins ; }
82cbdfca 70 static Double_t GetRawFormatTimeMax() { return fgkTimeBins*fgTimeBinWidth; }
71 static Double_t GetRawFormatTimeBinWidth() { return fgTimeBinWidth; }
85c25c2e 72 static Double_t GetRawFormatTimeBin()
73 { return GetRawFormatTimeMax() / GetRawFormatTimeBins(); }
ee299369 74 Double_t GetRawFormatTimeTrigger() const { return fgTimeTrigger ; }
75 Int_t GetRawFormatThreshold() const { return fgThreshold ; }
76 Int_t GetRawFormatDDLPerSuperModule() const { return fgDDLPerSuperModule ; }
77
feedcab9 78 virtual Option_t* GetOption() const { return fOption.Data(); }
79 void SetOption(Option_t* opt) { fOption = opt; }
80
ee299369 81 // Signal shape functions
82cbdfca 82 void FitRaw(TGraph * gSig, TF1* signalF, Float_t & amp, Float_t & time);
ee299369 83 static Double_t RawResponseFunction(Double_t *x, Double_t *par);
84 Bool_t RawSampledResponse(Double_t dtime, Double_t damp, Int_t * adcH, Int_t * adcL) const;
85
ee299369 86
87 private:
88 Double_t fHighLowGainFactor ; // high to low gain factor for the raw RO signal
b4133f05 89 Int_t fOrder ; // order of the gamma function for the RO signal
90 Double_t fTau ; // tau parameter of gamma function for the RO signal
91 Int_t fNoiseThreshold; // threshold to consider signal or noise
92 Int_t fNPedSamples; // number of samples to use in pedestal calculation
ee299369 93
b4133f05 94 static const Int_t fgkOverflowCut = 950; // cut to discriminate overflowed channels
ee299369 95 static const Int_t fgkTimeBins = 256 ; // number of sampling bins of the raw RO signal
b4133f05 96 static const Int_t fgkRawSignalOverflow = 0x3FF; // maximum signal (10 bits)
97
98 static Double_t fgTimeTrigger ; // time of the trigger for the RO signal
82cbdfca 99 static Double_t fgTimeBinWidth; // maximum sampled time of the raw RO signal
ee299369 100 static Int_t fgThreshold; // threshold
101 static Int_t fgDDLPerSuperModule; // number of DDL per SuperModule
fe93d365 102 static Int_t fgPedestalValue; // pedestal value for Digits2Raw
103 static Double_t fgFEENoise; // electronics noise in ADC units
feedcab9 104
65bdc82f 105 AliEMCALGeometry* fGeom; //geometry
21cad85c 106 AliAltroMapping* fMapping[4]; //only two for now
65bdc82f 107
feedcab9 108 TString fOption; //! option passed from Reconstructor
b4133f05 109
fe93d365 110 ClassDef(AliEMCALRawUtils,3) // utilities for raw signal fitting
ee299369 111};
112
113#endif