]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0CalibTimeEq.cxx
Reconstruction with measused calibration
[u/mrichter/AliRoot.git] / T0 / AliT0CalibTimeEq.cxx
CommitLineData
a2ad8166 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$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
59b8a5fc 20// class for T0 calibration TM-AC-AM_6-02-2006
21// equalize time shift for each time CFD channel
a2ad8166 22// //
23///////////////////////////////////////////////////////////////////////////////
24
25#include "AliT0CalibTimeEq.h"
a2ad8166 26
a2ad8166 27#include <TFile.h>
28#include <TMath.h>
29#include <TF1.h>
a2ad8166 30#include <TSpectrum.h>
a2ad8166 31#include <TProfile.h>
700e6b36 32#include "iostream.h"
a2ad8166 33
34ClassImp(AliT0CalibTimeEq)
35
36//________________________________________________________________
6b7d32f7 37 AliT0CalibTimeEq::AliT0CalibTimeEq():TNamed()
a2ad8166 38{
39 //
40}
41
42//________________________________________________________________
6b7d32f7 43AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed()
a2ad8166 44{
59b8a5fc 45 //constructor
46
a2ad8166 47 TString namst = "Calib_";
48 namst += name;
49 SetName(namst.Data());
50 SetTitle(namst.Data());
51}
52
53//________________________________________________________________
6b7d32f7 54AliT0CalibTimeEq::AliT0CalibTimeEq(const AliT0CalibTimeEq& calibda):TNamed(calibda)
a2ad8166 55{
56// copy constructor
57 SetName(calibda.GetName());
58 SetTitle(calibda.GetName());
59
60
61}
62
63//________________________________________________________________
64AliT0CalibTimeEq &AliT0CalibTimeEq::operator =(const AliT0CalibTimeEq& calibda)
65{
66// assignment operator
67 SetName(calibda.GetName());
68 SetTitle(calibda.GetName());
69
70 return *this;
71}
72
73//________________________________________________________________
74AliT0CalibTimeEq::~AliT0CalibTimeEq()
75{
76 //
59b8a5fc 77 // destrictor
a2ad8166 78}
79//________________________________________________________________
80void AliT0CalibTimeEq::Reset()
81{
59b8a5fc 82 //reset values
83
a2ad8166 84 memset(fCFDvalue,0,120*sizeof(Float_t));
85 memset(fTimeEq,1,24*sizeof(Float_t));
86}
87
88
89//________________________________________________________________
90void AliT0CalibTimeEq::Print(Option_t*) const
91{
59b8a5fc 92 // print time values
a2ad8166 93
94 printf("\n ---- PM Arrays ----\n\n");
95 printf(" Time delay CFD \n");
96 for (Int_t i=0; i<24; i++) printf(" CFD %f ",fTimeEq[i]);
97}
98
99
100//________________________________________________________________
700e6b36 101void AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys)
a2ad8166 102{
59b8a5fc 103 // compute online equalized time
700e6b36 104 Int_t npeaks = 20;
105 Double_t sigma = 4.;
59b8a5fc 106
8bfd9a3e 107 TFile *gFile = TFile::Open(filePhys);
a2ad8166 108 Bool_t down=false;
109 Int_t index[20];
110 Char_t buf1[15];
111 Char_t temp[10];
6b7d32f7 112 Float_t p[24][3]={0.,0.,0.};
113 for (Int_t i=0; i<24; i++)
114 {
700e6b36 115 sprintf(buf1,"CFD1-CFD%i",i+1);
6b7d32f7 116 TH1F *cfd = (TH1F*) gFile->Get(buf1);
117 printf(" i = %d buf1 = %s\n", i, buf1);
700e6b36 118 Double_t mean=cfd->GetMean();
119 SetTimeEq(i,mean);
120 }
121 /*
122
6b7d32f7 123 TSpectrum *s = new TSpectrum(2*npeaks,1.);
124 printf(" buf1 = %s cfd = %x\n", buf1, cfd);
125 Int_t nfound = s->Search(cfd,sigma,"goff",0.2);
126 printf(" nfound = %d\n", nfound);
127 if(nfound!=0)
a2ad8166 128 {
6b7d32f7 129 Float_t *xpeak = s->GetPositionX();
130 TMath::Sort(nfound, xpeak, index,down);
131 Float_t xp = xpeak[index[0]];
132 Float_t hmax = xp+3*sigma;
133 Float_t hmin = xp-3*sigma;
134 cfd->GetXaxis()->SetRange((Int_t)hmin-20,(Int_t)hmax+20);
135 TF1 *g1 = new TF1("g1", "gaus", hmin, hmax);
136 cfd->Fit("g1","IRQN");
137 for(Int_t j =0; j<3; j++)
138 {
139 p[i][j] = g1->GetParameter(j);
700e6b36 140 // SetCFDvalue(i, j, p[i][j]);
6b7d32f7 141 }
700e6b36 142 SetTimeEq(i,(p[i][2]));
143 cout<<" mean "<<p[i][2]<<endl;
144 */
145 /*
6b7d32f7 146 SetCFDvalue(i, 3, hmin);
147 SetCFDvalue(i, 4, hmax);
148
149 if (i<12)
150 {
151 SetTimeEq(i,(p[i][2]-p[0][2]));
152 }
153 else
154 {
155 SetTimeEq(i,(p[i][2]-p[12][2]));
156 }
700e6b36 157
6b7d32f7 158 }
159 }
700e6b36 160 */
6b7d32f7 161 gFile->Close();
162 delete gFile;
6b7d32f7 163 printf("\n\n");
164 for(int j=0;j<24;j++)
165 {
166 printf("fTimeEq[%d]=%f\n",j,fTimeEq[j]);
167 }
a2ad8166 168}
169
8bfd9a3e 170