]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0Calibrator.cxx
move printout from AliWarning to AliDebug
[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"
8d72d1c2 33#include <TGraph.h>
7d95281b 34#include <TH1F.h>
2e6a5ee0 35#include <TMath.h>
b09247a2 36#include <Riostream.h>
8d72d1c2 37
38ClassImp(AliT0Calibrator)
39
40//____________________________________________________________________
9e1b06a2 41 AliT0Calibrator::AliT0Calibrator():TNamed(),
2e6a5ee0 42 fChannelWidth(0),
43 fWalk(0)
44
8d72d1c2 45{
94249139 46 //constructor
47
2e6a5ee0 48 AliT0Parameters* param = AliT0Parameters::Instance();
49 param->Init();
8d72d1c2 50
51 fChannelWidth = param->GetChannelWidth() ;
12e9daf9 52 Double_t *grY ; //= new grY[2500] ;
53 // Double_t *grX ;
54 Int_t index[25000];
2e6a5ee0 55 Bool_t down=true;
8d72d1c2 56 for (Int_t i=0; i<24; i++){
2e6a5ee0 57 fMaxValue[i]=0;
8d72d1c2 58 fTimeDelayCFD[i] = Int_t (param->GetTimeDelayCFD(i));
446d6ec4 59
60 TGraph* fu = param ->GetWalk(i);
12e9daf9 61 // TGraph* fu = param ->GetAmpLEDRec(i);
62 fWalk.AddAtAndExpand(fu,i);
63
64 if(fu) {
2e6a5ee0 65 Int_t np=fu->GetN();
66 if(np>0) {
67 grY = fu->GetY();
12e9daf9 68 // grX[i] = fu->GetX();
2e6a5ee0 69 TMath::Sort(np, grY, index,down);
70 fMaxValue[i]=Int_t(grY[index[0]]);
12e9daf9 71
2e6a5ee0 72 }
73 }
12e9daf9 74
8d72d1c2 75 }
12e9daf9 76
2e6a5ee0 77 // delete [] grY;
78 // delete [] grX;
8d72d1c2 79
80 //
81}
82//_____________________________________________________________________________
83
9e1b06a2 84AliT0Calibrator::AliT0Calibrator(const AliT0Calibrator &r): TNamed(),
8d72d1c2 85 fChannelWidth(0),
74adb36a 86 fWalk(0)
8d72d1c2 87
88{
89 //
90 // AliT0calibartor copy constructor
91 //
92
93 ((AliT0Calibrator &) r).Copy(*this);
94
95}
96
97//_____________________________________________________________________________
98AliT0Calibrator &AliT0Calibrator::operator=(const AliT0Calibrator &r)
99{
100 //
101 // Assignment operator
102 //
103
104 if (this != &r) ((AliT0Calibrator &) r).Copy(*this);
105 return *this;
106
107}
108
109
110
111//____________________________________________________________________
aaa0a98f 112Int_t AliT0Calibrator::WalkCorrection(Int_t ipmt, Int_t qt, Int_t time, TString option)
8d72d1c2 113{
114 //slewing correcion and equalizing channels
115
2e6a5ee0 116 Int_t walk=0;
117
118 Int_t timeEq=0, timeWalk=0;
119 // TGraph* fu1 = param ->GetWalk(ipmt);
120 // TGraph* fu1 = param ->GetAmpLEDRec(ipmt);
121 TGraph *fu1=(TGraph*) fWalk.At(ipmt);
122 if(fu1 && fu1->GetN()>0) {
123 walk=Int_t(fu1->Eval(Double_t(qt)));
e8ed1cd0 124 }
125 if (option == "pdc") {
12e9daf9 126 timeWalk = time + Int_t(fMaxValue[ipmt]-walk) ;
446d6ec4 127 // timeEq= timeWalk - fTimeDelayCFD[ipmt];
128 timeEq= timeWalk - fTimeDelayCFD[ipmt]; //for the same as cosmic
29ed1d0e 129 AliDebug(10,Form(" ipmt %i time before %i timeWalk %i , qt %i timeEq %i \n ",
130 ipmt, time,timeWalk, qt, timeEq ));
e8ed1cd0 131 }
132 if (option == "cosmic") {
2e6a5ee0 133 timeWalk = time + Int_t((fMaxValue[ipmt]-walk)) ;
134 if(walk <1 ) timeWalk = time ;
135 timeEq= timeWalk - fTimeDelayCFD[ipmt];
136 AliDebug(10,Form(" ipmt %i time before %i timeWalk %i , qt %i timeEq %i \n ",
e8ed1cd0 137 ipmt, time,timeWalk, qt, timeEq ));
2e6a5ee0 138 }
139
8d72d1c2 140 return timeEq;
141}
142
143
144