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" |
28 | #include "AliMUONCalibParam.h" |
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, |
41 | AliMUONCalibrationData* calib) |
42 | : TTask("AliMUONDigitCalibrator","Subtract pedestal from digit charge"), |
43 | fData(muonData), |
44 | fCalibrationData(calib) |
45 | { |
46 | } |
47 | |
48 | //_____________________________________________________________________________ |
49 | AliMUONDigitCalibrator::~AliMUONDigitCalibrator() |
50 | { |
51 | } |
52 | |
53 | //_____________________________________________________________________________ |
54 | void |
55 | AliMUONDigitCalibrator::Exec(Option_t*) |
56 | { |
57 | for ( Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ++ch ) |
58 | { |
59 | TClonesArray* digitArray = fData->Digits(ch); |
60 | Int_t nDigits = digitArray->GetEntriesFast(); |
61 | for ( Int_t d = 0; d < nDigits; ++d ) |
62 | { |
63 | AliMUONDigit* digit = |
64 | static_cast<AliMUONDigit*>(digitArray->UncheckedAt(d)); |
65 | |
66 | AliMUONCalibParam* pedestal = static_cast<AliMUONCalibParam*> |
67 | (fCalibrationData->Pedestal(digit->DetElemId(), |
68 | digit->ManuId(),digit->ManuChannel())); |
69 | |
70 | AliMUONCalibParam* gain = static_cast<AliMUONCalibParam*> |
71 | (fCalibrationData->Gain(digit->DetElemId(), |
72 | digit->ManuId(),digit->ManuChannel())); |
73 | if (!pedestal) |
74 | { |
75 | AliFatal(Form("Got a null ped object for DE,manu,channel=%d,%d,%d", |
76 | digit->DetElemId(),digit->ManuId(),digit->ManuChannel())); |
77 | |
78 | } |
79 | if (!gain) |
80 | { |
81 | AliFatal(Form("Got a null gain object for DE,manu,channel=%d,%d,%d", |
82 | digit->DetElemId(),digit->ManuId(),digit->ManuChannel())); |
83 | |
84 | } |
85 | |
86 | Int_t adc = digit->Signal(); |
87 | Float_t padc = adc-pedestal->Mean(); |
88 | if ( padc < 3.0*pedestal->Sigma() ) |
89 | { |
90 | padc = 0.0; |
91 | } |
92 | Float_t charge = padc*gain->Mean(); |
93 | Int_t signal = TMath::Nint(charge); |
94 | digit->SetSignal(signal); |
95 | } |
96 | } |
97 | } |