446d6ec4 |
1 | |
8d72d1c2 |
2 | /************************************************************************** |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * * |
5 | * Author: The ALICE Off-line Project. * |
6 | * Contributors are mentioned in the code where appropriate. * |
7 | * * |
8 | * Permission to use, copy, modify and distribute this software and its * |
9 | * documentation strictly for non-commercial purposes is hereby granted * |
10 | * without fee, provided that the above copyright notice appears in all * |
11 | * copies and that both the copyright notice and this permission notice * |
12 | * appear in the supporting documentation. The authors make no claims * |
13 | * about the suitability of this software for any purpose. It is * |
14 | * provided "as is" without express or implied warranty. * |
15 | **************************************************************************/ |
16 | |
17 | /* $Id$ */ |
94249139 |
18 | /*********************************************************************** |
19 | * this class doing calibration during reconstruction |
20 | * 2 steps: |
21 | * - equalizing channels |
22 | * - applying walk corrections |
23 | * |
24 | * Alla.Maevskaya@cern.ch |
25 | * |
26 | **********************************************************************/ |
27 | |
28 | //#include <Riostream.h> |
8d72d1c2 |
29 | |
30 | #include "AliLog.h" |
31 | #include "AliT0Parameters.h" |
32 | #include "AliT0Calibrator.h" |
539b9cb9 |
33 | #include "AliT0Reconstructor.h" |
34 | #include "AliT0RecoParam.h" |
8d72d1c2 |
35 | #include <TGraph.h> |
7d95281b |
36 | #include <TH1F.h> |
2e6a5ee0 |
37 | #include <TMath.h> |
b09247a2 |
38 | #include <Riostream.h> |
8d72d1c2 |
39 | |
40 | ClassImp(AliT0Calibrator) |
41 | |
42 | //____________________________________________________________________ |
9e1b06a2 |
43 | AliT0Calibrator::AliT0Calibrator():TNamed(), |
2e6a5ee0 |
44 | fChannelWidth(0), |
45 | fWalk(0) |
46 | |
8d72d1c2 |
47 | { |
94249139 |
48 | //constructor |
2e6a5ee0 |
49 | AliT0Parameters* param = AliT0Parameters::Instance(); |
50 | param->Init(); |
539b9cb9 |
51 | //slewing correcion and equalizing channels |
52 | |
8d72d1c2 |
53 | fChannelWidth = param->GetChannelWidth() ; |
539b9cb9 |
54 | // Double_t *grX ; |
8d72d1c2 |
55 | for (Int_t i=0; i<24; i++){ |
2e6a5ee0 |
56 | fMaxValue[i]=0; |
8d72d1c2 |
57 | fTimeDelayCFD[i] = Int_t (param->GetTimeDelayCFD(i)); |
40043664 |
58 | // TGraph* fu = param ->GetWalk(i); |
59 | // fWalk.AddAtAndExpand(fu,i); |
60 | TGraph* fu = param ->GetAmpLEDRec(i); |
539b9cb9 |
61 | fWalk.AddAtAndExpand(fu,i); |
62 | |
8d72d1c2 |
63 | } |
64 | |
8d72d1c2 |
65 | } |
66 | //_____________________________________________________________________________ |
67 | |
9e1b06a2 |
68 | AliT0Calibrator::AliT0Calibrator(const AliT0Calibrator &r): TNamed(), |
8d72d1c2 |
69 | fChannelWidth(0), |
74adb36a |
70 | fWalk(0) |
8d72d1c2 |
71 | |
72 | { |
73 | // |
74 | // AliT0calibartor copy constructor |
75 | // |
76 | |
77 | ((AliT0Calibrator &) r).Copy(*this); |
78 | |
79 | } |
80 | |
81 | //_____________________________________________________________________________ |
82 | AliT0Calibrator &AliT0Calibrator::operator=(const AliT0Calibrator &r) |
83 | { |
84 | // |
85 | // Assignment operator |
86 | // |
87 | |
88 | if (this != &r) ((AliT0Calibrator &) r).Copy(*this); |
89 | return *this; |
90 | |
91 | } |
92 | |
93 | |
8d72d1c2 |
94 | //____________________________________________________________________ |
539b9cb9 |
95 | |
96 | Int_t AliT0Calibrator::WalkCorrection(Int_t refAmp, Int_t ipmt, Int_t qt, Int_t time) |
97 | |
8d72d1c2 |
98 | { |
539b9cb9 |
99 | // |
100 | // referemce amplitude for walk correction now read from RecoParam |
101 | |
102 | Double_t *grY ; |
8d72d1c2 |
103 | |
2e6a5ee0 |
104 | Int_t walk=0; |
105 | |
106 | Int_t timeEq=0, timeWalk=0; |
d0bcd1fb |
107 | TGraph *fu1=(TGraph*) fWalk.At(ipmt); |
539b9cb9 |
108 | if(fu1 && fu1->GetN()>0) { |
109 | grY = fu1->GetY(); |
110 | fMaxValue[ipmt]=grY[refAmp-1]; |
111 | // TGraph* fu = param ->GetAmpLEDRec(i); |
f6acc4a5 |
112 | walk = Int_t (fMaxValue[ipmt]) + Int_t(fu1->Eval(Double_t(qt))); |
539b9cb9 |
113 | } |
d0bcd1fb |
114 | |
f6acc4a5 |
115 | timeWalk = time - walk ; |
d0bcd1fb |
116 | timeEq= timeWalk - fTimeDelayCFD[ipmt]; |
40043664 |
117 | // printf(" ipmt %i time before %i timeWalk %i , walk %i qt %i fTimeDelayCFD[ipmt] %i timeEq %i \n ", |
118 | // ipmt, time,timeWalk, walk, qt,fTimeDelayCFD[ipmt], timeEq ); |
119 | // AliDebug(10,Form(" ipmt %i time before %i timeWalk %i , walk %i qt %i timeEq %i \n ", |
120 | // ipmt, time,timeWalk, walk, qt, timeEq )); |
d0bcd1fb |
121 | |
1ca3f118 |
122 | return timeEq; |
8d72d1c2 |
123 | } |
124 | |
125 | |
126 | |