]>
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 | // // | |
20 | // class for T0 calibration TM-AC-AM_6-02-2006 // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include "AliT0CalibTimeEq.h" | |
25 | #include "AliT0LookUpValue.h" | |
26 | #include "AliLog.h" | |
27 | #include "AliRun.h" | |
28 | ||
29 | #include <TCanvas.h> | |
30 | #include <TFile.h> | |
31 | #include <TMath.h> | |
32 | #include <TF1.h> | |
33 | #include <TSystem.h> | |
34 | #include <Riostream.h> | |
35 | #include <TSpectrum.h> | |
36 | #include <TVirtualFitter.h> | |
37 | #include <TProfile.h> | |
38 | ||
39 | #include <Riostream.h> | |
40 | #include <string> | |
41 | ||
42 | ClassImp(AliT0CalibTimeEq) | |
43 | ||
44 | //________________________________________________________________ | |
45 | AliT0CalibTimeEq::AliT0CalibTimeEq(): TNamed(), | |
46 | fTimeDelayTVD(0), | |
47 | fMeanT0(0) | |
48 | { | |
49 | // | |
50 | } | |
51 | ||
52 | //________________________________________________________________ | |
53 | AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed(), | |
54 | fTimeDelayTVD(0), | |
55 | fMeanT0(0) | |
56 | { | |
57 | TString namst = "Calib_"; | |
58 | namst += name; | |
59 | SetName(namst.Data()); | |
60 | SetTitle(namst.Data()); | |
61 | } | |
62 | ||
63 | //________________________________________________________________ | |
64 | AliT0CalibTimeEq::AliT0CalibTimeEq(const AliT0CalibTimeEq& calibda) : | |
65 | TNamed(calibda), | |
66 | fTimeDelayTVD(0), | |
67 | fMeanT0(0) | |
68 | { | |
69 | // copy constructor | |
70 | SetName(calibda.GetName()); | |
71 | SetTitle(calibda.GetName()); | |
72 | ||
73 | ||
74 | } | |
75 | ||
76 | //________________________________________________________________ | |
77 | AliT0CalibTimeEq &AliT0CalibTimeEq::operator =(const AliT0CalibTimeEq& calibda) | |
78 | { | |
79 | // assignment operator | |
80 | SetName(calibda.GetName()); | |
81 | SetTitle(calibda.GetName()); | |
82 | ||
83 | return *this; | |
84 | } | |
85 | ||
86 | //________________________________________________________________ | |
87 | AliT0CalibTimeEq::~AliT0CalibTimeEq() | |
88 | { | |
89 | // | |
90 | } | |
91 | //________________________________________________________________ | |
92 | void AliT0CalibTimeEq::Reset() | |
93 | { | |
94 | memset(fCFDvalue,0,120*sizeof(Float_t)); | |
95 | memset(fTimeEq,1,24*sizeof(Float_t)); | |
96 | } | |
97 | ||
98 | ||
99 | //________________________________________________________________ | |
100 | void AliT0CalibTimeEq::Print(Option_t*) const | |
101 | { | |
102 | ||
103 | printf("\n ---- PM Arrays ----\n\n"); | |
104 | printf(" Time delay CFD \n"); | |
105 | for (Int_t i=0; i<24; i++) printf(" CFD %f ",fTimeEq[i]); | |
106 | } | |
107 | ||
108 | ||
109 | //________________________________________________________________ | |
8bfd9a3e | 110 | void AliT0CalibTimeEq::ComputeOnlineParams(char* name1, char* name2, char* canv, Int_t npeaks, Double_t sigma, const char* filePhys) |
a2ad8166 | 111 | { |
8bfd9a3e | 112 | TFile *gFile = TFile::Open(filePhys); |
a2ad8166 | 113 | gSystem->Load("libSpectrum"); |
114 | npeaks = 20; | |
115 | sigma=3.; | |
116 | Bool_t down=false; | |
117 | Int_t index[20]; | |
8bfd9a3e | 118 | TCanvas *c1 = new TCanvas(canv, canv,0,48,1280,951); |
119 | c1->Divide(4,3); | |
a2ad8166 | 120 | Char_t buf1[15]; |
121 | Char_t temp[10]; | |
122 | Float_t p[12][3]={0.,0.,0.}; | |
123 | for (Int_t i=12; i<24; i++) | |
124 | { | |
8bfd9a3e | 125 | c1->cd(i+1); |
a2ad8166 | 126 | sprintf(buf1,name1); |
127 | sprintf(temp,"%i",i+1); | |
128 | strcat (buf1,temp); | |
129 | strcat (buf1,name2); | |
130 | TH1F *cfd = (TH1F*) gFile->Get(buf1); | |
131 | TSpectrum *s = new TSpectrum(2*npeaks,1.); | |
132 | Int_t nfound = s->Search(cfd,sigma," ",0.2); | |
133 | if(nfound!=0){ | |
134 | Float_t *xpeak = s->GetPositionX(); | |
135 | TMath::Sort(nfound, xpeak, index,down); | |
136 | Float_t xp = xpeak[index[0]]; | |
137 | Float_t hmax = xp+3*sigma; | |
138 | Float_t hmin = xp-3*sigma; | |
139 | cfd->GetXaxis()->SetRange((Int_t)hmin-20,(Int_t)hmax+20); | |
140 | TF1 *g1 = new TF1("g1", "gaus", hmin, hmax); | |
141 | cfd->Fit("g1","IR"); | |
8bfd9a3e | 142 | |
143 | for(Int_t j =0; j<3; j++){ | |
a2ad8166 | 144 | p[i][j] = g1->GetParameter(j); |
145 | SetCFDvalue(i, j, p[i][j]); | |
8bfd9a3e | 146 | } |
147 | SetCFDvalue(i, 3, hmin); | |
148 | SetCFDvalue(i, 4, hmax); | |
149 | SetTimeEq(i,p[i][2]); | |
150 | // if(p[i][0]==0) | |
151 | // cfd->Draw(); | |
152 | ||
153 | // cfd->Draw(); | |
154 | } // else | |
155 | // cfd->Draw(); | |
a2ad8166 | 156 | } |
8bfd9a3e | 157 | // TFile *onl = new TFile("onl.root","RECREATE"); |
158 | // this->Write("Values"); | |
159 | // onl->Close(); | |
160 | // delete onl; | |
161 | gFile->Close(); | |
a2ad8166 | 162 | delete gFile; |
163 | } | |
164 | ||
8bfd9a3e | 165 |