]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDParameters.cxx
Additional protection and warning message.
[u/mrichter/AliRoot.git] / FMD / AliFMDParameters.cxx
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 //                                                                          
20 // Forward Multiplicity Detector based on Silicon wafers. 
21 //
22 // This class is a singleton that handles various parameters of
23 // the FMD detectors.  
24 // Eventually, this class will use the Conditions DB to get the
25 // various parameters, which code can then request from here.
26 //                                                       
27 #include "AliLog.h"                // ALILOG_H
28 #include "AliFMDParameters.h"      // ALIFMDPARAMETERS_H
29 #include "AliFMDGeometry.h"        // ALIFMDGEOMETRY_H
30 #include "AliFMDRing.h"            // ALIFMDRING_H
31 #include "AliFMDCalibGain.h"       // ALIFMDCALIBGAIN_H
32 #include "AliFMDCalibPedestal.h"   // ALIFMDCALIBPEDESTAL_H
33 #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBPEDESTAL_H
34 #include <Riostream.h>
35
36 //====================================================================
37 ClassImp(AliFMDParameters)
38 #if 0
39   ; // This is here to keep Emacs for indenting the next line
40 #endif
41
42 //____________________________________________________________________
43 AliFMDParameters* AliFMDParameters::fgInstance = 0;
44
45 //____________________________________________________________________
46 AliFMDParameters* 
47 AliFMDParameters::Instance() 
48 {
49   // Get static instance 
50   if (!fgInstance) fgInstance = new AliFMDParameters;
51   return fgInstance;
52 }
53
54 //____________________________________________________________________
55 AliFMDParameters::AliFMDParameters() 
56   : fSiDeDxMip(1.664), 
57     fFixedPulseGain(0), 
58     fEdepMip(0),
59     fZeroSuppression(0), 
60     fSampleRate(0), 
61     fPedestal(0), 
62     fPulseGain(0), 
63     fDeadMap(0)
64 {
65   // Default constructor 
66   SetVA1MipRange();
67   SetAltroChannelSize();
68   SetChannelsPerAltro();
69   SetZeroSuppression();
70   SetSampleRate();
71   SetPedestal();
72   SetPedestalWidth();
73   SetPedestalFactor();
74   SetThreshold();
75 }
76
77 //__________________________________________________________________
78 Float_t
79 AliFMDParameters::GetThreshold() const
80 {
81   if (!fPulseGain) return fFixedThreshold;
82   return fPulseGain->Threshold();
83 }
84
85 //__________________________________________________________________
86 Float_t
87 AliFMDParameters::GetPulseGain(UShort_t detector, Char_t ring, 
88                                UShort_t sector, UShort_t strip) const
89 {
90   // Returns the pulser calibrated gain for strip # strip in sector #
91   // sector or ring id ring of detector # detector. 
92   // 
93   // For simulation, this is normally set to 
94   // 
95   //       VA1_MIP_Range 
96   //    ------------------ * MIP_Energy_Loss
97   //    ALTRO_channel_size
98   // 
99   if (!fPulseGain) { 
100     if (fFixedPulseGain <= 0)
101       fFixedPulseGain = fVA1MipRange * GetEdepMip() / fAltroChannelSize;
102     return fFixedPulseGain;
103   }  
104   return fPulseGain->Value(detector, ring, sector, strip);
105 }
106
107 //__________________________________________________________________
108 Bool_t
109 AliFMDParameters::IsDead(UShort_t detector, Char_t ring, 
110                          UShort_t sector, UShort_t strip) const
111 {
112   if (!fDeadMap) return kFALSE;
113   return fDeadMap->operator()(detector, ring, sector, strip);
114 }
115
116 //__________________________________________________________________
117 UShort_t
118 AliFMDParameters::GetZeroSuppression(UShort_t detector, Char_t ring, 
119                                      UShort_t sector, UShort_t strip) const
120 {
121   if (!fZeroSuppression) return fFixedZeroSuppression;
122   // Need to map strip to ALTRO chip. 
123   return fZeroSuppression->operator()(detector, ring, sector, strip/128);
124 }
125
126 //__________________________________________________________________
127 UShort_t
128 AliFMDParameters::GetSampleRate(UShort_t ddl) const
129 {
130   if (!fSampleRate) return fFixedSampleRate;
131   // Need to map sector to digitizier card. 
132   return fSampleRate->Rate(ddl);
133 }
134
135 //__________________________________________________________________
136 Float_t
137 AliFMDParameters::GetPedestal(UShort_t detector, Char_t ring, 
138                               UShort_t sector, UShort_t strip) const
139 {
140   if (!fPedestal) return fFixedPedestal;
141   return fPedestal->Value(detector, ring, sector, strip);
142 }
143
144 //__________________________________________________________________
145 Float_t
146 AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring, 
147                                    UShort_t sector, UShort_t strip) const
148 {
149   if (!fPedestal) return fFixedPedestalWidth;
150   return fPedestal->Width(detector, ring, sector, strip);
151 }
152   
153                               
154
155 //__________________________________________________________________
156 Float_t
157 AliFMDParameters::GetEdepMip() const 
158
159   // Get energy deposited by a MIP in the silicon sensors
160   if (fEdepMip <= 0){
161     AliFMDGeometry* fmd = AliFMDGeometry::Instance();
162     fEdepMip = (fSiDeDxMip 
163                 * fmd->GetRing('I')->GetSiThickness() 
164                 * fmd->GetSiDensity());
165   }
166   return fEdepMip;
167 }
168
169 //____________________________________________________________________
170 //
171 // EOF
172 //