Some bugs fixed
[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
25// that all particles are minimum ionizing.
56b1929b 26//
27#include "AliFMD.h" // ALIFMD_H
28#include "AliFMDMultNaiive.h" // ALIFMDMULTNAIIVE_H
1a1fdef7 29#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
56b1929b 30#include "AliFMDMultStrip.h" // ALIFMDMULTNAIIVE_H
31#include "AliFMDDigit.h" // ALIFMDDIGIT_H
32#include <TClonesArray.h> // ROOT_TClonesArray
33#include <TTree.h> // ROOT_TTree
34
35//____________________________________________________________________
925e6570 36ClassImp(AliFMDMultNaiive)
1a1fdef7 37#if 0
38 ; // This is here to keep Emacs for indenting the next line
39#endif
56b1929b 40
41//____________________________________________________________________
42AliFMDMultNaiive::AliFMDMultNaiive()
43 : AliFMDMultAlgorithm("Naiive", "Naiive")
44{
45 // Default CTOR
46 fMult = new TClonesArray("AliFMDMultStrip", 1000);
47}
48
49//____________________________________________________________________
50void
51AliFMDMultNaiive::PreRun(AliFMD* fmd)
52{
53 // Initialise before a run
54 AliFMDMultAlgorithm::PreRun(fmd);
1a1fdef7 55 AliFMDParameters* pars = AliFMDParameters::Instance();
56 fEdepMip = pars->GetEdepMip();
57 fGain = (Float_t(pars->GetVA1MipRange()) / pars->GetAltroChannelSize()
56b1929b 58 * fEdepMip);
59}
60
61//____________________________________________________________________
62void
63AliFMDMultNaiive::PreEvent(TTree* treeR, Float_t ipZ)
64{
65 // Reset internal data
66 AliFMDMultAlgorithm::PreEvent(treeR, ipZ);
67 fTreeR->Branch("FMDNaiive", &fMult);
68}
69
70//____________________________________________________________________
71void
72AliFMDMultNaiive::ProcessDigit(AliFMDDigit* digit,
73 Float_t eta,
74 Float_t phi,
75 UShort_t count)
76{
77 // Process one digit.
78 //
79 // Parameters:
80 //
81 // digit Digit to process
82 // eta Pseudo-rapidity of digit
83 // phi Azimuthal angle of digit
84 // count ADC (corrected for the pedestal)
85 //
86 // This calculates the energy deposited and the number of MIPs that
87 // this energy deposition corresponds to
88 //
89 // EnergyDeposited = cos(theta) * gain * count
90 // Multiplicity = EnergyDeposited / EnergyDepositedPerMIP
91 //
92 // where gain is a conversion factor from number of counts to an
93 // energy:
94 // Pre_Amp_MIP_Range 1
95 // gain = ----------------- * ---------------------
96 // ADC_channel_size EnergyDepositedPerMip
97 //
98 // and theta is the particles incident angle on the strip, given by
99 //
100 // theta = 2 * atan(exp(-eta))
101 //
102 // The cos(theta) factor corrects for the fact that the particle may
103 // traverse the strip at an angle, and therefor have a longer flight
104 // length, leading to a larger energy deposition.
105 //
106 if (!digit) return;
107 Double_t edep = Adc2Energy(digit, eta, count);
108 Double_t mult = Energy2Multiplicity(digit, edep);
7684b53c 109
110 AliFMDMultStrip* m =
111 new ((*fMult)[fNMult]) AliFMDMultStrip(digit->Detector(),
112 digit->Ring(),
113 digit->Sector(),
114 digit->Strip(),
115 eta, phi,
116 edep, mult,
117 AliFMDMult::kNaiive);
118 (void)m;
56b1929b 119 fNMult++;
120}
121//____________________________________________________________________
122Float_t
123AliFMDMultNaiive::Adc2Energy(AliFMDDigit* /* digit */,
124 Float_t eta,
125 UShort_t count)
126{
127 // Converts number of ADC counts to energy deposited.
128 // Note, that this member function can be overloaded by derived
129 // classes to do strip-specific look-ups in databases or the like,
130 // to find the proper gain for a strip.
131 //
132 // In this simple version, we calculate the energy deposited as
133 //
134 // EnergyDeposited = cos(theta) * gain * count
135 //
136 // where
137 //
138 // Pre_amp_MIP_Range
139 // gain = ----------------- * Energy_deposited_per_MIP
140 // ADC_channel_size
141 //
142 // is constant and the same for all strips.
143 Double_t theta = 2 * TMath::Tan(TMath::Exp(-eta));
c263f0ab 144 Double_t edep = TMath::Abs(TMath::Cos(theta)) * fGain * count;
56b1929b 145 return edep;
146}
147
148//____________________________________________________________________
149Float_t
150AliFMDMultNaiive::Energy2Multiplicity(AliFMDDigit* /* digit */,
151 Float_t edep)
152{
153 // Converts an energy signal to number of particles.
154 // Note, that this member function can be overloaded by derived
155 // classes to do strip-specific look-ups in databases or the like,
156 // to find the proper gain for a strip.
157 //
158 // In this simple version, we calculate the multiplicity as
159 //
160 // multiplicity = Energy_deposited / Energy_deposited_per_MIP
161 //
162 // where
163 //
164 // Energy_deposited_per_MIP = 1.664 * SI_density * SI_thickness
165 //
166 // is constant and the same for all strips
167 return edep / fEdepMip;
168}
169
170
171
172//____________________________________________________________________
173//
174// EOF
175//