2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /***********************************************************************
19 * this class doing calibration during reconstruction
21 * - equalizing channels
22 * - applying walk corrections
24 * Alla.Maevskaya@cern.ch
26 **********************************************************************/
28 //#include <Riostream.h>
31 #include "AliT0Parameters.h"
32 #include "AliT0Calibrator.h"
36 #include <Riostream.h>
38 ClassImp(AliT0Calibrator)
40 //____________________________________________________________________
41 AliT0Calibrator::AliT0Calibrator():TNamed(),
48 AliT0Parameters* param = AliT0Parameters::Instance();
51 fChannelWidth = param->GetChannelWidth() ;
52 Double_t *grY ; //= new grY[2500] ;
56 for (Int_t i=0; i<24; i++){
58 fTimeDelayCFD[i] = Int_t (param->GetTimeDelayCFD(i));
60 TGraph* fu = param ->GetWalk(i);
61 // TGraph* fu = param ->GetAmpLEDRec(i);
62 fWalk.AddAtAndExpand(fu,i);
68 // grX[i] = fu->GetX();
69 TMath::Sort(np, grY, index,down);
70 fMaxValue[i]=Int_t(grY[index[0]]);
82 //_____________________________________________________________________________
84 AliT0Calibrator::AliT0Calibrator(const AliT0Calibrator &r): TNamed(),
90 // AliT0calibartor copy constructor
93 ((AliT0Calibrator &) r).Copy(*this);
97 //_____________________________________________________________________________
98 AliT0Calibrator &AliT0Calibrator::operator=(const AliT0Calibrator &r)
101 // Assignment operator
104 if (this != &r) ((AliT0Calibrator &) r).Copy(*this);
111 //____________________________________________________________________
112 Int_t AliT0Calibrator::WalkCorrection(Int_t ipmt, Int_t qt, Int_t time, TString option)
114 //slewing correcion and equalizing channels
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)));
125 if (option == "pdc") {
126 timeWalk = time + Int_t(fMaxValue[ipmt]-walk) ;
127 // timeEq= timeWalk - fTimeDelayCFD[ipmt];
128 timeEq= timeWalk - fTimeDelayCFD[ipmt]; //for the same as cosmic
129 AliDebug(10,Form(" ipmt %i time before %i timeWalk %i , qt %i timeEq %i \n ",
130 ipmt, time,timeWalk, qt, timeEq ));
132 if (option == "cosmic") {
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 ",
137 ipmt, time,timeWalk, qt, timeEq ));