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