1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for T0 calibration TM-AC-AM_6-02-2006 //
22 ///////////////////////////////////////////////////////////////////////////////
30 #include "AliT0CalibData.h"
31 #include "TObjArray.h"
35 #include "TObjString.h"
42 ClassImp(AliT0CalibData)
44 //________________________________________________________________
45 AliT0CalibData::AliT0CalibData(): TNamed()
51 //________________________________________________________________
52 AliT0CalibData::AliT0CalibData(const char* name):TNamed(),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec()
54 TString namst = "Calib_";
56 SetName(namst.Data());
57 SetTitle(namst.Data());
61 //________________________________________________________________
62 AliT0CalibData::AliT0CalibData(const AliT0CalibData& calibda) :
63 TNamed(calibda),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec()
66 SetName(calibda.GetName());
67 SetTitle(calibda.GetName());
72 //________________________________________________________________
73 AliT0CalibData &AliT0CalibData::operator =(const AliT0CalibData& calibda)
75 // assignment operator
76 SetName(calibda.GetName());
77 SetTitle(calibda.GetName());
82 //________________________________________________________________
83 AliT0CalibData::~AliT0CalibData()
87 //________________________________________________________________
88 void AliT0CalibData::Reset()
90 memset(fTimeDelayCFD,1,24*sizeof(Float_t));
91 memset(fTimeDelayLED,1,24*sizeof(Float_t));
92 memset(fGain,1,24*sizeof(Float_t));
96 //________________________________________________________________
97 void AliT0CalibData::Print(Option_t*) const
100 printf("\n ---- PM Arrays ----\n\n");
101 printf(" Time delay CFD \n");
102 for (Int_t i=0; i<24; i++) printf(" %f",fTimeDelayCFD[i]);
103 printf(" \n LED \n");
104 for (Int_t i=0; i<24; i++) printf(" %f",fTimeDelayLED[i]);
105 printf(" \n Gain \n");
106 for (Int_t i=0; i<24; i++) printf(" %f",fGain[i]);
112 //________________________________________________________________
113 void AliT0CalibData::SetTimeDelayCFD(Float_t* TimeDelay)
115 if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayCFD[t] = TimeDelay[t];
116 // else for(int t=0; t<24; t++) fTimeDelay[t] = 0.;
118 //________________________________________________________________
119 void AliT0CalibData::SetTimeDelayLED(Float_t* TimeDelay)
121 if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayLED[t] = TimeDelay[t];
122 // else for(int t=0; t<24; t++) fTimeDelay[t] = 0.;
125 //________________________________________________________________
126 void AliT0CalibData::SetGain(Float_t* Gain)
128 if(Gain) for(int t=0; t<24; t++) fGain[t] = Gain[t];
129 // else for(int t=0; t<24; t++) fGain[t] = 0.;
133 //________________________________________________________________
134 void AliT0CalibData::SetWalk(Int_t ipmt, const Char_t *filename)
137 TFile *file = new TFile(filename);
139 sprintf(funcname,"CFD%i",ipmt+1);
140 TF1* gr = (TF1*)file->Get(funcname);
141 fWalk.AddAtAndExpand(gr,ipmt);
146 //________________________________________________________________
148 void AliT0CalibData::SetSlewingLED(Int_t ipmt,const Char_t *filename)
151 Float_t x[100], y[100];
154 ifstream inFile(filename);
155 if(!inFile) {AliError(Form("Cannot open file %s !",filename));}
160 while(getline(inFile,buffer)){
166 TGraph* gr = new TGraph(i,x,y);
167 fSlewingLED.AddAtAndExpand(gr,ipmt);
171 //________________________________________________________________
173 void AliT0CalibData::SetSlewingRec(Int_t ipmt,const Char_t *filename)
176 Float_t x[100], y[100];
179 ifstream inFile(filename);
180 if(!inFile) {AliError(Form("Cannot open file %s !",filename));}
185 while(getline(inFile,buffer)){
191 Float_t y1[100], x1[100];
192 for (Int_t ir=0; ir<i; ir++){
193 y1[ir]=y[i-ir]; x1[ir]=x[i-ir];}
194 TGraph* gr = new TGraph(i,y1,x1);
195 fSlewingRec.AddAtAndExpand(gr,ipmt);