]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0Calibrator.cxx
Calibration class
[u/mrichter/AliRoot.git] / T0 / AliT0Calibrator.cxx
CommitLineData
8d72d1c2 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 <Riostream.h>
19
20#include "AliLog.h"
21#include "AliT0Parameters.h"
22#include "AliT0Calibrator.h"
23#include <TArrayI.h>
24#include <TGraph.h>
25
26ClassImp(AliT0Calibrator)
27
28//____________________________________________________________________
29 AliT0Calibrator::AliT0Calibrator():
30 fChannelWidth(0),
31 fWalk(0),
32 fSlewingRec(0)
33{
34 AliT0Parameters* param = AliT0Parameters::Instance();
35 param->Init();
36
37 fChannelWidth = param->GetChannelWidth() ;
38
39 for (Int_t i=0; i<24; i++){
40 fTimeDelayCFD[i] = Int_t (param->GetTimeDelayCFD(i));
41 TGraph* gr = param ->GetSlewRec(i);
42 fSlewingRec.AddAtAndExpand(gr,i) ;
43 TGraph* fu = param ->GetWalk(i);
44 fWalk.AddAtAndExpand(fu,i);
45 }
46
47 //
48}
49//_____________________________________________________________________________
50
51AliT0Calibrator::AliT0Calibrator(const AliT0Calibrator &r):
52 fChannelWidth(0),
53 fWalk(0),
54 fSlewingRec(0)
55
56{
57 //
58 // AliT0calibartor copy constructor
59 //
60
61 ((AliT0Calibrator &) r).Copy(*this);
62
63}
64
65//_____________________________________________________________________________
66AliT0Calibrator &AliT0Calibrator::operator=(const AliT0Calibrator &r)
67{
68 //
69 // Assignment operator
70 //
71
72 if (this != &r) ((AliT0Calibrator &) r).Copy(*this);
73 return *this;
74
75}
76
77
78
79//____________________________________________________________________
80Int_t AliT0Calibrator::WalkCorrection(Int_t ipmt, Int_t qt, Int_t time)
81{
82 //slewing correcion and equalizing channels
83
84 Int_t timeEq=0, timeWalk=0;
85 TGraph *fu1=(TGraph*) fWalk.At(ipmt);
86 Float_t walk=fu1->Eval(Float_t(qt));
87 TH1F*hr=fu1->GetHistogram();
88 Float_t maxValue=hr->GetMaximum(50);
89 timeWalk = time + Int_t(maxValue-walk)/fChannelWidth ;
90
91 timeEq= timeWalk - (fTimeDelayCFD[ipmt]-fTimeDelayCFD[0]);
92 AliDebug(2,Form(" timeWalk %i , qt %i timeEq %i \n ",
93 timeWalk, qt, timeEq ));
94 return timeEq;
95}
96
97
98