new option for tests in alifakedisplay
[u/mrichter/AliRoot.git] / T0 / AliT0Calibrator.cxx
CommitLineData
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"
e5835843 35#include "AliCDBEntry.h"
36#include "AliCDBManager.h"
37
8d72d1c2 38#include <TGraph.h>
7d95281b 39#include <TH1F.h>
2e6a5ee0 40#include <TMath.h>
b09247a2 41#include <Riostream.h>
8d72d1c2 42
43ClassImp(AliT0Calibrator)
44
45//____________________________________________________________________
9e1b06a2 46 AliT0Calibrator::AliT0Calibrator():TNamed(),
2e6a5ee0 47 fChannelWidth(0),
e5835843 48 fWalk(0),
49 fEqualized(0)
2e6a5ee0 50
8d72d1c2 51{
94249139 52 //constructor
e5835843 53 printf(" AliT0Calibrator ::: AliT0RecoParam GetEq() %i\n", fEqualized);
2e6a5ee0 54 AliT0Parameters* param = AliT0Parameters::Instance();
55 param->Init();
539b9cb9 56 //slewing correcion and equalizing channels
57
8d72d1c2 58 fChannelWidth = param->GetChannelWidth() ;
539b9cb9 59 // Double_t *grX ;
8d72d1c2 60 for (Int_t i=0; i<24; i++){
2e6a5ee0 61 fMaxValue[i]=0;
8d72d1c2 62 fTimeDelayCFD[i] = Int_t (param->GetTimeDelayCFD(i));
8f620945 63 TGraph* fu = param ->GetWalk(i);
40043664 64 // fWalk.AddAtAndExpand(fu,i);
8f620945 65 //TGraph* fu = param ->GetAmpLEDRec(i);
539b9cb9 66 fWalk.AddAtAndExpand(fu,i);
8d72d1c2 67 }
68
8d72d1c2 69}
70//_____________________________________________________________________________
71
9e1b06a2 72AliT0Calibrator::AliT0Calibrator(const AliT0Calibrator &r): TNamed(),
e5835843 73 fChannelWidth(0),
74 fWalk(0),
75 fEqualized(0)
8d72d1c2 76
77{
78 //
79 // AliT0calibartor copy constructor
80 //
81
82 ((AliT0Calibrator &) r).Copy(*this);
83
84}
85
86//_____________________________________________________________________________
87AliT0Calibrator &AliT0Calibrator::operator=(const AliT0Calibrator &r)
88{
89 //
90 // Assignment operator
91 //
92
93 if (this != &r) ((AliT0Calibrator &) r).Copy(*this);
94 return *this;
95
96}
97
98
8d72d1c2 99//____________________________________________________________________
539b9cb9 100
101Int_t AliT0Calibrator::WalkCorrection(Int_t refAmp, Int_t ipmt, Int_t qt, Int_t time)
102
8d72d1c2 103{
539b9cb9 104 //
105 // referemce amplitude for walk correction now read from RecoParam
2e6a5ee0 106
c5a6dbee 107 Int_t walk=0;
2e6a5ee0 108 Int_t timeEq=0, timeWalk=0;
d0bcd1fb 109 TGraph *fu1=(TGraph*) fWalk.At(ipmt);
539b9cb9 110 if(fu1 && fu1->GetN()>0) {
8f620945 111 walk = Int_t(fu1->Eval(Double_t(qt)));
539b9cb9 112 }
d0bcd1fb 113
e5835843 114 if (fEqualized == 0)
115 timeEq= time - fTimeDelayCFD[ipmt]-walk;
116 else
117 timeEq = time - walk - refAmp;
118
8f620945 119 // printf(" ipmt %i time before %i timeWalk %i , walk %i qt %i fTimeDelayCFD[ipmt] %i timeEq %i \n ",
40043664 120 // ipmt, time,timeWalk, walk, qt,fTimeDelayCFD[ipmt], timeEq );
c5a24053 121 AliDebug(2,Form(" fEqualized %i ipmt %i refAmp %i time before %i timeWalk %i , walk %i qt %i timeEq %i, diff %i \n ",
122 fEqualized, ipmt, refAmp, time,timeWalk, walk, qt, timeEq , fTimeDelayCFD[ipmt]));
d0bcd1fb 123
1ca3f118 124 return timeEq;
8d72d1c2 125}
126
127
128