]>
Commit | Line | Data |
---|---|---|
d99769c3 | 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 | #include "AliMUONDigitCalibrator.h" | |
19 | ||
d99769c3 | 20 | #include "AliLog.h" |
21 | #include "AliMUONCalibrationData.h" | |
22 | #include "AliMUONConstants.h" | |
23 | #include "AliMUONData.h" | |
24 | #include "AliMUONDigit.h" | |
c795d086 | 25 | #include "AliMUONVCalibParam.h" |
d99769c3 | 26 | #include "TClonesArray.h" |
27 | ||
1171bb0a | 28 | /// |
29 | /// Class used to calibrate digits (either real or simulated ones). | |
30 | /// | |
31 | /// The calibration consists of subtracting the pedestal | |
32 | /// and multiplying by a gain, so that | |
33 | /// Signal = (ADC-pedestal)*gain | |
34 | /// | |
35 | /// Please note also that for the moment, if a digit lies on a dead channel | |
36 | /// we remove this digit from the list of digits. | |
37 | /// FIXME: this has to be revisited. By using the AliMUONDigit::fFlags we | |
38 | /// should in principle flag a digit as bad w/o removing it, but this | |
39 | /// then requires some changes in the cluster finder to deal with this extra | |
40 | /// information correctly (e.g. to set a quality for the cluster if it contains | |
41 | /// bad digits). | |
42 | /// | |
43 | ||
d99769c3 | 44 | ClassImp(AliMUONDigitCalibrator) |
45 | ||
46 | //_____________________________________________________________________________ | |
47 | AliMUONDigitCalibrator::AliMUONDigitCalibrator(AliMUONData* muonData, | |
c795d086 | 48 | AliMUONCalibrationData* calib) |
d99769c3 | 49 | : TTask("AliMUONDigitCalibrator","Subtract pedestal from digit charge"), |
50 | fData(muonData), | |
51 | fCalibrationData(calib) | |
52 | { | |
c795d086 | 53 | // |
54 | // ctor. This class need the muonData to get access to the digit, | |
55 | // and the calibrationData to get access to calibration parameters. | |
56 | // | |
d99769c3 | 57 | } |
58 | ||
1171bb0a | 59 | //_____________________________________________________________________________ |
60 | AliMUONDigitCalibrator::AliMUONDigitCalibrator(const AliMUONDigitCalibrator&) | |
61 | : TTask() | |
62 | { | |
63 | AliFatal("Implement me if needed"); | |
64 | } | |
884a73f1 | 65 | |
1171bb0a | 66 | //_____________________________________________________________________________ |
67 | AliMUONDigitCalibrator& | |
68 | AliMUONDigitCalibrator::operator=(const AliMUONDigitCalibrator&) | |
69 | { | |
70 | AliFatal("Implement me if needed"); | |
71 | return *this; | |
884a73f1 | 72 | } |
73 | ||
d99769c3 | 74 | //_____________________________________________________________________________ |
75 | AliMUONDigitCalibrator::~AliMUONDigitCalibrator() | |
76 | { | |
c795d086 | 77 | // |
78 | // empty dtor. | |
79 | // | |
d99769c3 | 80 | } |
81 | ||
82 | //_____________________________________________________________________________ | |
83 | void | |
84 | AliMUONDigitCalibrator::Exec(Option_t*) | |
85 | { | |
c795d086 | 86 | // |
87 | // Main method. | |
88 | // We loop on tracking chambers (i.e. we do nothing for trigger) | |
89 | // and for each digit in that chamber, we calibrate it : | |
90 | // a) if the corresponding channel is known to be bad, we set the signal to 0 | |
91 | // (so that digit can be suppressed later on) | |
92 | // b) we then apply pedestal and gain corrections. | |
93 | ||
d99769c3 | 94 | for ( Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ++ch ) |
95 | { | |
96 | TClonesArray* digitArray = fData->Digits(ch); | |
97 | Int_t nDigits = digitArray->GetEntriesFast(); | |
98 | for ( Int_t d = 0; d < nDigits; ++d ) | |
99 | { | |
100 | AliMUONDigit* digit = | |
101 | static_cast<AliMUONDigit*>(digitArray->UncheckedAt(d)); | |
102 | ||
c795d086 | 103 | // Very first check is whether this channel is known to be bad, |
104 | // in which case we set the signal to zero. | |
105 | AliMUONVCalibParam* dead = static_cast<AliMUONVCalibParam*> | |
1171bb0a | 106 | (fCalibrationData->DeadChannels(digit->DetElemId(),digit->ManuId())); |
c795d086 | 107 | if ( dead && dead->ValueAsInt(digit->ManuChannel()) ) |
108 | { | |
1171bb0a | 109 | AliWarning(Form("Removing dead channel detElemId %d manuId %d " |
c795d086 | 110 | "manuChannel %d",digit->DetElemId(),digit->ManuId(), |
111 | digit->ManuChannel())); | |
112 | digit->SetSignal(0); | |
113 | continue; | |
114 | } | |
115 | ||
116 | // If the channel is good, go on with the calibration itself. | |
117 | ||
118 | AliMUONVCalibParam* pedestal = static_cast<AliMUONVCalibParam*> | |
1171bb0a | 119 | (fCalibrationData->Pedestals(digit->DetElemId(),digit->ManuId())); |
c795d086 | 120 | |
121 | AliMUONVCalibParam* gain = static_cast<AliMUONVCalibParam*> | |
1171bb0a | 122 | (fCalibrationData->Gains(digit->DetElemId(),digit->ManuId())); |
d99769c3 | 123 | |
d99769c3 | 124 | if (!pedestal) |
125 | { | |
c795d086 | 126 | AliFatal(Form("Got a null ped object for DE,manu=%d,%d", |
127 | digit->DetElemId(),digit->ManuId())); | |
d99769c3 | 128 | |
129 | } | |
130 | if (!gain) | |
131 | { | |
c795d086 | 132 | AliFatal(Form("Got a null gain object for DE,manu=%d,%d", |
133 | digit->DetElemId(),digit->ManuId())); | |
d99769c3 | 134 | } |
135 | ||
c795d086 | 136 | Int_t manuChannel = digit->ManuChannel(); |
d99769c3 | 137 | Int_t adc = digit->Signal(); |
c795d086 | 138 | Float_t padc = adc-pedestal->ValueAsFloat(manuChannel,0); |
139 | if ( padc < 3.0*pedestal->ValueAsFloat(manuChannel,1) ) | |
d99769c3 | 140 | { |
141 | padc = 0.0; | |
142 | } | |
c795d086 | 143 | Float_t charge = padc*gain->ValueAsFloat(manuChannel,0); |
d99769c3 | 144 | Int_t signal = TMath::Nint(charge); |
145 | digit->SetSignal(signal); | |
c795d086 | 146 | Int_t saturation = gain->ValueAsInt(manuChannel,1); |
147 | if ( signal >= saturation ) | |
148 | { | |
149 | digit->Saturated(kTRUE); | |
150 | } | |
d99769c3 | 151 | } |
152 | } | |
153 | } |