]>
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 | ||
20 | #include "AliCDBEntry.h" | |
21 | #include "AliCDBManager.h" | |
22 | #include "AliCDBStorage.h" | |
23 | #include "AliLog.h" | |
24 | #include "AliMUONCalibrationData.h" | |
25 | #include "AliMUONConstants.h" | |
26 | #include "AliMUONData.h" | |
27 | #include "AliMUONDigit.h" | |
c795d086 | 28 | #include "AliMUONVCalibParam.h" |
d99769c3 | 29 | #include "AliMpDEManager.h" |
30 | #include "AliMpPad.h" | |
31 | #include "AliMpPlaneType.h" | |
32 | #include "AliMpStationType.h" | |
33 | #include "AliMpVSegmentation.h" | |
34 | #include "Riostream.h" | |
35 | #include "TClonesArray.h" | |
36 | ||
37 | ClassImp(AliMUONDigitCalibrator) | |
38 | ||
39 | //_____________________________________________________________________________ | |
40 | AliMUONDigitCalibrator::AliMUONDigitCalibrator(AliMUONData* muonData, | |
c795d086 | 41 | AliMUONCalibrationData* calib) |
d99769c3 | 42 | : TTask("AliMUONDigitCalibrator","Subtract pedestal from digit charge"), |
43 | fData(muonData), | |
44 | fCalibrationData(calib) | |
45 | { | |
c795d086 | 46 | // |
47 | // ctor. This class need the muonData to get access to the digit, | |
48 | // and the calibrationData to get access to calibration parameters. | |
49 | // | |
d99769c3 | 50 | } |
51 | ||
52 | //_____________________________________________________________________________ | |
53 | AliMUONDigitCalibrator::~AliMUONDigitCalibrator() | |
54 | { | |
c795d086 | 55 | // |
56 | // empty dtor. | |
57 | // | |
d99769c3 | 58 | } |
59 | ||
60 | //_____________________________________________________________________________ | |
61 | void | |
62 | AliMUONDigitCalibrator::Exec(Option_t*) | |
63 | { | |
c795d086 | 64 | // |
65 | // Main method. | |
66 | // We loop on tracking chambers (i.e. we do nothing for trigger) | |
67 | // and for each digit in that chamber, we calibrate it : | |
68 | // a) if the corresponding channel is known to be bad, we set the signal to 0 | |
69 | // (so that digit can be suppressed later on) | |
70 | // b) we then apply pedestal and gain corrections. | |
71 | ||
d99769c3 | 72 | for ( Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ++ch ) |
73 | { | |
74 | TClonesArray* digitArray = fData->Digits(ch); | |
75 | Int_t nDigits = digitArray->GetEntriesFast(); | |
76 | for ( Int_t d = 0; d < nDigits; ++d ) | |
77 | { | |
78 | AliMUONDigit* digit = | |
79 | static_cast<AliMUONDigit*>(digitArray->UncheckedAt(d)); | |
80 | ||
c795d086 | 81 | // Very first check is whether this channel is known to be bad, |
82 | // in which case we set the signal to zero. | |
83 | AliMUONVCalibParam* dead = static_cast<AliMUONVCalibParam*> | |
84 | (fCalibrationData->DeadChannel(digit->DetElemId(),digit->ManuId())); | |
85 | if ( dead && dead->ValueAsInt(digit->ManuChannel()) ) | |
86 | { | |
87 | AliDebug(10,Form("Removing dead channel detElemId %d manuId %d " | |
88 | "manuChannel %d",digit->DetElemId(),digit->ManuId(), | |
89 | digit->ManuChannel())); | |
90 | digit->SetSignal(0); | |
91 | continue; | |
92 | } | |
93 | ||
94 | // If the channel is good, go on with the calibration itself. | |
95 | ||
96 | AliMUONVCalibParam* pedestal = static_cast<AliMUONVCalibParam*> | |
97 | (fCalibrationData->Pedestal(digit->DetElemId(),digit->ManuId())); | |
98 | ||
99 | AliMUONVCalibParam* gain = static_cast<AliMUONVCalibParam*> | |
100 | (fCalibrationData->Gain(digit->DetElemId(),digit->ManuId())); | |
d99769c3 | 101 | |
d99769c3 | 102 | if (!pedestal) |
103 | { | |
c795d086 | 104 | AliFatal(Form("Got a null ped object for DE,manu=%d,%d", |
105 | digit->DetElemId(),digit->ManuId())); | |
d99769c3 | 106 | |
107 | } | |
108 | if (!gain) | |
109 | { | |
c795d086 | 110 | AliFatal(Form("Got a null gain object for DE,manu=%d,%d", |
111 | digit->DetElemId(),digit->ManuId())); | |
d99769c3 | 112 | } |
113 | ||
c795d086 | 114 | Int_t manuChannel = digit->ManuChannel(); |
d99769c3 | 115 | Int_t adc = digit->Signal(); |
c795d086 | 116 | Float_t padc = adc-pedestal->ValueAsFloat(manuChannel,0); |
117 | if ( padc < 3.0*pedestal->ValueAsFloat(manuChannel,1) ) | |
d99769c3 | 118 | { |
119 | padc = 0.0; | |
120 | } | |
c795d086 | 121 | Float_t charge = padc*gain->ValueAsFloat(manuChannel,0); |
d99769c3 | 122 | Int_t signal = TMath::Nint(charge); |
123 | digit->SetSignal(signal); | |
c795d086 | 124 | Int_t saturation = gain->ValueAsInt(manuChannel,1); |
125 | if ( signal >= saturation ) | |
126 | { | |
127 | digit->Saturated(kTRUE); | |
128 | } | |
d99769c3 | 129 | } |
130 | } | |
131 | } |