]>
Commit | Line | Data |
---|---|---|
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" | |
e47b556f | 26 | #include "AliLog.h" |
a2ad8166 | 27 | #include <TFile.h> |
28 | #include <TMath.h> | |
29 | #include <TF1.h> | |
a2ad8166 | 30 | #include <TSpectrum.h> |
a2ad8166 | 31 | #include <TProfile.h> |
c61a7285 | 32 | #include <iostream> |
a2ad8166 | 33 | |
34 | ClassImp(AliT0CalibTimeEq) | |
35 | ||
36 | //________________________________________________________________ | |
eef60a6a | 37 | AliT0CalibTimeEq::AliT0CalibTimeEq():TNamed(), |
38 | fMeanVertex(0), | |
39 | fRmsVertex(0) | |
a2ad8166 | 40 | { |
41 | // | |
b95e8d87 | 42 | |
a2ad8166 | 43 | } |
44 | ||
45 | //________________________________________________________________ | |
eef60a6a | 46 | AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed(), |
47 | fMeanVertex(0), | |
48 | fRmsVertex(0) | |
a2ad8166 | 49 | { |
59b8a5fc | 50 | //constructor |
51 | ||
a2ad8166 | 52 | TString namst = "Calib_"; |
53 | namst += name; | |
54 | SetName(namst.Data()); | |
55 | SetTitle(namst.Data()); | |
56 | } | |
57 | ||
58 | //________________________________________________________________ | |
eef60a6a | 59 | AliT0CalibTimeEq::AliT0CalibTimeEq(const AliT0CalibTimeEq& calibda):TNamed(calibda), |
60 | fMeanVertex(0), | |
61 | fRmsVertex(0) | |
a2ad8166 | 62 | { |
63 | // copy constructor | |
64 | SetName(calibda.GetName()); | |
65 | SetTitle(calibda.GetName()); | |
66 | ||
67 | ||
68 | } | |
69 | ||
70 | //________________________________________________________________ | |
71 | AliT0CalibTimeEq &AliT0CalibTimeEq::operator =(const AliT0CalibTimeEq& calibda) | |
72 | { | |
73 | // assignment operator | |
74 | SetName(calibda.GetName()); | |
75 | SetTitle(calibda.GetName()); | |
76 | ||
77 | return *this; | |
78 | } | |
79 | ||
80 | //________________________________________________________________ | |
81 | AliT0CalibTimeEq::~AliT0CalibTimeEq() | |
82 | { | |
83 | // | |
59b8a5fc | 84 | // destrictor |
a2ad8166 | 85 | } |
86 | //________________________________________________________________ | |
87 | void AliT0CalibTimeEq::Reset() | |
88 | { | |
59b8a5fc | 89 | //reset values |
90 | ||
a2ad8166 | 91 | memset(fCFDvalue,0,120*sizeof(Float_t)); |
92 | memset(fTimeEq,1,24*sizeof(Float_t)); | |
93 | } | |
94 | ||
95 | ||
96 | //________________________________________________________________ | |
97 | void AliT0CalibTimeEq::Print(Option_t*) const | |
98 | { | |
59b8a5fc | 99 | // print time values |
a2ad8166 | 100 | |
101 | printf("\n ---- PM Arrays ----\n\n"); | |
102 | printf(" Time delay CFD \n"); | |
103 | for (Int_t i=0; i<24; i++) printf(" CFD %f ",fTimeEq[i]); | |
b95e8d87 | 104 | printf("\n Mean Vertex %f \n", fMeanVertex); |
a2ad8166 | 105 | } |
106 | ||
107 | ||
108 | //________________________________________________________________ | |
02888358 | 109 | Bool_t AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys) |
a2ad8166 | 110 | { |
59b8a5fc | 111 | // compute online equalized time |
b95e8d87 | 112 | Double_t mean=0, meanver=0; |
eef60a6a | 113 | Double_t rms=0, rmsver=0; |
02888358 | 114 | Int_t nent=0; |
115 | Bool_t ok=false; | |
370867d2 | 116 | Int_t npeaks = 20; |
f824d160 | 117 | Int_t sigma=3; |
370867d2 | 118 | Bool_t down=false; |
119 | Int_t index[20]; | |
120 | Int_t nfound=0; | |
c2337900 | 121 | gFile = TFile::Open(filePhys); |
370867d2 | 122 | if(!gFile) { |
6318dd46 | 123 | AliError("No input PHYS data found "); |
124 | } | |
125 | else | |
126 | { | |
f824d160 | 127 | // gFile->ls(); |
02888358 | 128 | ok=true; |
6318dd46 | 129 | Char_t buf1[30]; |
130 | for (Int_t i=0; i<24; i++) | |
131 | { | |
370867d2 | 132 | sprintf(buf1,"CFD1minCFD%d",i+1); |
6318dd46 | 133 | TH1F *cfd = (TH1F*) gFile->Get(buf1); |
b95e8d87 | 134 | if(!cfd) AliWarning(Form("no histograms collected by PHYS DA for channel %i", i)); |
6318dd46 | 135 | // printf(" i = %d buf1 = %s\n", i, buf1); |
eef60a6a | 136 | if(cfd) { |
370867d2 | 137 | TSpectrum *s = new TSpectrum(2*npeaks,1); |
138 | nfound = s->Search(cfd,sigma," ",0.1); | |
139 | if(nfound!=0){ | |
140 | Float_t *xpeak = s->GetPositionX(); | |
141 | TMath::Sort(nfound, xpeak, index,down); | |
142 | Float_t xp = xpeak[index[0]]; | |
143 | Double_t hmax = xp+3*sigma; | |
144 | Double_t hmin = xp-3*sigma; | |
1daa10df | 145 | cfd->GetXaxis()->SetRangeUser(hmin-20,hmax+20); |
370867d2 | 146 | mean=cfd->GetMean(); |
147 | rms=cfd->GetRMS(); | |
72ff4386 | 148 | nent=(Int_t)cfd->GetEntries(); |
3ac3264d | 149 | if(nent<500 || rms>20. ) { |
f824d160 | 150 | ok=false; |
151 | AliWarning(Form("Data is not good enouph in PMT %i - mean %f rsm %f nentries %i", i,mean, rms, nent)); | |
152 | ||
153 | } | |
370867d2 | 154 | } |
155 | else | |
f824d160 | 156 | { |
157 | ok=false; | |
158 | AliWarning(Form("Data is not good enouph in PMT %i , no clean peak", i)); | |
159 | } | |
eef60a6a | 160 | } |
370867d2 | 161 | |
162 | ||
eef60a6a | 163 | SetTimeEq(i,mean); |
164 | SetTimeEqRms(i,rms); | |
b95e8d87 | 165 | if (cfd) delete cfd; |
6318dd46 | 166 | } |
b95e8d87 | 167 | TH1F *ver = (TH1F*) gFile->Get("hVertex"); |
f824d160 | 168 | if(!ver) AliWarning("no T0 histogram collected by PHYS DA "); |
eef60a6a | 169 | if(ver) { |
170 | meanver = ver->GetMean(); | |
171 | rmsver = ver->GetRMS(); | |
172 | } | |
b95e8d87 | 173 | SetMeanVertex(meanver); |
eef60a6a | 174 | SetRmsVertex(rmsver); |
6318dd46 | 175 | |
176 | gFile->Close(); | |
177 | delete gFile; | |
02888358 | 178 | |
6318dd46 | 179 | } |
02888358 | 180 | return ok; |
181 | } | |
a2ad8166 | 182 | |
8bfd9a3e | 183 |