Fixed some coding style violations.
[u/mrichter/AliRoot.git] / FMD / AliFMDMultNaiive.cxx
CommitLineData
56b1929b 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18//____________________________________________________________________
19//
7684b53c 20// Reconstruct charged particle multiplicity in the FMD
21//
22// [See also the AliFMDReconstructor class]
23//
24// This class reconstructs the multiplicity based on the assumption
088f8e79 25// that all particles are minimum ionizing.
26// Hence, the name `naiive'
56b1929b 27//
28#include "AliFMD.h" // ALIFMD_H
29#include "AliFMDMultNaiive.h" // ALIFMDMULTNAIIVE_H
1a1fdef7 30#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
56b1929b 31#include "AliFMDMultStrip.h" // ALIFMDMULTNAIIVE_H
32#include "AliFMDDigit.h" // ALIFMDDIGIT_H
33#include <TClonesArray.h> // ROOT_TClonesArray
34#include <TTree.h> // ROOT_TTree
35
36//____________________________________________________________________
925e6570 37ClassImp(AliFMDMultNaiive)
1a1fdef7 38#if 0
39 ; // This is here to keep Emacs for indenting the next line
40#endif
56b1929b 41
42//____________________________________________________________________
43AliFMDMultNaiive::AliFMDMultNaiive()
44 : AliFMDMultAlgorithm("Naiive", "Naiive")
45{
46 // Default CTOR
47 fMult = new TClonesArray("AliFMDMultStrip", 1000);
48}
49
50//____________________________________________________________________
51void
52AliFMDMultNaiive::PreRun(AliFMD* fmd)
53{
54 // Initialise before a run
55 AliFMDMultAlgorithm::PreRun(fmd);
1a1fdef7 56 AliFMDParameters* pars = AliFMDParameters::Instance();
57 fEdepMip = pars->GetEdepMip();
58 fGain = (Float_t(pars->GetVA1MipRange()) / pars->GetAltroChannelSize()
56b1929b 59 * fEdepMip);
60}
61
62//____________________________________________________________________
63void
64AliFMDMultNaiive::PreEvent(TTree* treeR, Float_t ipZ)
65{
66 // Reset internal data
67 AliFMDMultAlgorithm::PreEvent(treeR, ipZ);
68 fTreeR->Branch("FMDNaiive", &fMult);
69}
70
71//____________________________________________________________________
72void
73AliFMDMultNaiive::ProcessDigit(AliFMDDigit* digit,
74 Float_t eta,
75 Float_t phi,
76 UShort_t count)
77{
78 // Process one digit.
79 //
80 // Parameters:
81 //
82 // digit Digit to process
83 // eta Pseudo-rapidity of digit
84 // phi Azimuthal angle of digit
85 // count ADC (corrected for the pedestal)
86 //
87 // This calculates the energy deposited and the number of MIPs that
88 // this energy deposition corresponds to
89 //
90 // EnergyDeposited = cos(theta) * gain * count
91 // Multiplicity = EnergyDeposited / EnergyDepositedPerMIP
92 //
93 // where gain is a conversion factor from number of counts to an
94 // energy:
95 // Pre_Amp_MIP_Range 1
96 // gain = ----------------- * ---------------------
97 // ADC_channel_size EnergyDepositedPerMip
98 //
99 // and theta is the particles incident angle on the strip, given by
100 //
101 // theta = 2 * atan(exp(-eta))
102 //
103 // The cos(theta) factor corrects for the fact that the particle may
104 // traverse the strip at an angle, and therefor have a longer flight
105 // length, leading to a larger energy deposition.
106 //
107 if (!digit) return;
108 Double_t edep = Adc2Energy(digit, eta, count);
109 Double_t mult = Energy2Multiplicity(digit, edep);
7684b53c 110
111 AliFMDMultStrip* m =
112 new ((*fMult)[fNMult]) AliFMDMultStrip(digit->Detector(),
113 digit->Ring(),
114 digit->Sector(),
115 digit->Strip(),
116 eta, phi,
117 edep, mult,
118 AliFMDMult::kNaiive);
119 (void)m;
56b1929b 120 fNMult++;
121}
122//____________________________________________________________________
123Float_t
124AliFMDMultNaiive::Adc2Energy(AliFMDDigit* /* digit */,
125 Float_t eta,
126 UShort_t count)
127{
128 // Converts number of ADC counts to energy deposited.
129 // Note, that this member function can be overloaded by derived
130 // classes to do strip-specific look-ups in databases or the like,
131 // to find the proper gain for a strip.
132 //
133 // In this simple version, we calculate the energy deposited as
134 //
135 // EnergyDeposited = cos(theta) * gain * count
136 //
137 // where
138 //
139 // Pre_amp_MIP_Range
140 // gain = ----------------- * Energy_deposited_per_MIP
141 // ADC_channel_size
142 //
143 // is constant and the same for all strips.
21888c5f 144 Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta));
c263f0ab 145 Double_t edep = TMath::Abs(TMath::Cos(theta)) * fGain * count;
56b1929b 146 return edep;
147}
148
149//____________________________________________________________________
150Float_t
151AliFMDMultNaiive::Energy2Multiplicity(AliFMDDigit* /* digit */,
152 Float_t edep)
153{
154 // Converts an energy signal to number of particles.
155 // Note, that this member function can be overloaded by derived
156 // classes to do strip-specific look-ups in databases or the like,
157 // to find the proper gain for a strip.
158 //
159 // In this simple version, we calculate the multiplicity as
160 //
161 // multiplicity = Energy_deposited / Energy_deposited_per_MIP
162 //
163 // where
164 //
165 // Energy_deposited_per_MIP = 1.664 * SI_density * SI_thickness
166 //
167 // is constant and the same for all strips
168 return edep / fEdepMip;
169}
170
171
172
173//____________________________________________________________________
174//
175// EOF
176//