add protection against truncated events + coverity - Rachid
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALDigitizer.h
CommitLineData
a435f763 1#ifndef ALIEMCALDIGITIZER_H
2#define ALIEMCALDIGITIZER_H
61e0abb5 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8//_________________________________________________________________________
a435f763 9// Class that performs digitization of Summable digits from simulated data
10//
11// In addition it performs mixing of summable digits from different events.
12//
13// For each event two branches are created in TreeD:
14// "EMCAL" - list of digits
15// "AliEMCALDigitizer" - AliEMCALDigitizer with all parameters used in digitization
16//
17// Note, that one cset title for new digits branch, and repeat digitization with
18// another set of parameters.
19//
ffa6d63b 20//*-- Author: Sahal Yacoob (LBL)
21// based on : AliPHOSDigit
1963b290 22// July 2003 Yves Schutz : NewIO
23// November 2003 Aleksei Pavlinov : Shish-Kebab geometry
ffa6d63b 24//_________________________________________________________________________
61e0abb5 25
26
27// --- ROOT system ---
05a92d59 28class TClonesArray ;
1963b290 29class TBrowser;
05a92d59 30
61e0abb5 31// --- Standard library ---
32
33// --- AliRoot header files ---
814ad4bf 34#include "AliDigitizer.h"
88cb7938 35#include "AliConfig.h"
a435f763 36class AliEMCALCalibData ;
05a92d59 37class AliEMCALSDigitizer ;
38class AliRunDigitizer ;
61e0abb5 39
814ad4bf 40class AliEMCALDigitizer: public AliDigitizer {
61e0abb5 41
42public:
43 AliEMCALDigitizer() ; // ctor
e191bb57 44 AliEMCALDigitizer(TString alirunFileNameFile, TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
88cb7938 45 AliEMCALDigitizer(const AliEMCALDigitizer & dtizer) ;
46 AliEMCALDigitizer(AliRunDigitizer * manager) ;
61e0abb5 47 virtual ~AliEMCALDigitizer() ;
48
09884213 49 void Digitize(Int_t event); // Make Digits from SDigits stored in fSDigits
05a92d59 50 void Exec(Option_t *option); // Supervising method
61e0abb5 51
f0a6dc6f 52 Int_t GetDigitThreshold() const { return fDigitThreshold;}
f0a6dc6f 53 Float_t GetPinNoise() const { return fPinNoise;}
a2f8e711 54 Float_t GetTimeResolution(const Float_t energy) const;
55 Double_t GetTimeResolutionPar0() const { return fTimeResolutionPar0 ; }
56 Double_t GetTimeResolutionPar1() const { return fTimeResolutionPar1 ; }
f0a6dc6f 57 Double_t GetTimeDelay() const { return fTimeDelay ; }
58 Float_t GetECAchannel() const { return fADCchannelEC ; }
59 Float_t GetECApedestal() const { return fADCpedestalEC ; }
60 void SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
61 void SetDigitThreshold(Int_t EMCThreshold) {fDigitThreshold = EMCThreshold;}
62 void SetPinNoise(Float_t PinNoise ) {fPinNoise = PinNoise;}
61e0abb5 63
05a92d59 64 //General
7ea6391b 65 Int_t GetDigitsInRun() const { return fDigitsInRun; }
09884213 66 void MixWith(TString alirunFileName,
e191bb57 67 TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ; // Add another one file to mix
eb0b1051 68 void Print(Option_t* option="") const ;
1963b290 69 void Print1(Option_t * option); // *MENU*
814ad4bf 70
9c0a4862 71 AliEMCALDigitizer & operator = (const AliEMCALDigitizer & /*rvalue*/) {
814ad4bf 72 // assignement operator requested by coding convention but not needed
9859bfc0 73 Fatal("operator =", "not implemented") ;
74 return *this ;
814ad4bf 75 }
76
1963b290 77 virtual void Browse(TBrowser* b);
1963b290 78
61e0abb5 79private:
814ad4bf 80
d17817b7 81 Bool_t Init();
839828a6 82 void InitParameters() ;
61e0abb5 83 void PrintDigits(Option_t * option) ;
88cb7938 84 void Unload() ;
9e5d2067 85 void WriteDigits() ; // Writes Digits the current event
916f1e76 86 void WriteDigits(TClonesArray* digits, const char* branchName = "EMTRG"); //
9e5d2067 87 Float_t TimeOfNoise(void) ; // Calculate time signal generated by noise
88cb7938 88
05a92d59 89 //Calculate the time of crossing of the threshold by front edge
33a52e55 90 //Float_t FrontEdgeTime(TClonesArray * ticks) ;
91
829ba234 92 Float_t DigitizeEnergy(Float_t energy, Int_t AbsId) ;
916f1e76 93 void Digits2FastOR(TClonesArray*digitsTMP, TClonesArray* digitsTRG);
94 void DigitalFastOR(Double_t time, Double_t dE, Int_t timeSamples[], Int_t nSamples);
95
96
61e0abb5 97private:
814ad4bf 98
88cb7938 99 Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
100 Int_t fDigitsInRun ; //! Total number of digits in one run
101 Bool_t fInit ; //! To avoid overwriting existing files
102
103 Int_t fInput ; // Number of files to merge
104 TString * fInputFileNames ; //[fInput] List of file names to merge
105 TString * fEventNames ; //[fInput] List of event names to merge
106
f0a6dc6f 107 Int_t fDigitThreshold ; // Threshold for storing digits in EMC, ACD units
108 Int_t fMeanPhotonElectron ; // number of photon electrons per GeV deposited energy
f0a6dc6f 109 Float_t fPinNoise ; // Electronics noise in EMC
110 Double_t fTimeDelay; // Time delay to reproduce data delay
a2f8e711 111 Double_t fTimeResolutionPar0 ; // Time resolution of FEE electronics
112 Double_t fTimeResolutionPar1 ; // Time resolution of FEE electronics
a9485c37 113 Float_t fADCchannelEC ; // width of one ADC channel in EC section (GeV)
14ce0a6e 114 Float_t fADCpedestalEC ; // pedestal for one ADC channel
a9485c37 115 Int_t fNADCEC ; // number of channels in EC section ADC
a9485c37 116
f0a6dc6f 117 TString fEventFolderName; // skowron: name of EFN to read data from in stand alone mode
118 Int_t fFirstEvent; // first event to process
119 Int_t fLastEvent; // last event to process
120
53f1c378 121 AliEMCALCalibData * fCalibData; //Calibration data pointer
88cb7938 122
a2f8e711 123 ClassDef(AliEMCALDigitizer,10) // description
61e0abb5 124};
125
126
a435f763 127#endif // AliEMCALDIGITIZER_H