]>
Commit | Line | Data |
---|---|---|
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 | // equalize time shift for each time CFD channel | |
22 | // // | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include "AliT0CalibTimeEq.h" | |
26 | #include "AliLog.h" | |
27 | #include <TFile.h> | |
28 | #include <TMath.h> | |
29 | #include <TF1.h> | |
30 | #include <TSpectrum.h> | |
31 | #include <TProfile.h> | |
32 | #include <iostream> | |
33 | ||
34 | ClassImp(AliT0CalibTimeEq) | |
35 | ||
36 | //________________________________________________________________ | |
37 | AliT0CalibTimeEq::AliT0CalibTimeEq():TNamed(), | |
38 | fMeanVertex(0), | |
39 | fRmsVertex(0) | |
40 | { | |
41 | // | |
42 | ||
43 | } | |
44 | ||
45 | //________________________________________________________________ | |
46 | AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed(), | |
47 | fMeanVertex(0), | |
48 | fRmsVertex(0) | |
49 | { | |
50 | //constructor | |
51 | ||
52 | TString namst = "Calib_"; | |
53 | namst += name; | |
54 | SetName(namst.Data()); | |
55 | SetTitle(namst.Data()); | |
56 | } | |
57 | ||
58 | //________________________________________________________________ | |
59 | AliT0CalibTimeEq::AliT0CalibTimeEq(const AliT0CalibTimeEq& calibda):TNamed(calibda), | |
60 | fMeanVertex(0), | |
61 | fRmsVertex(0) | |
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 | // | |
84 | // destrictor | |
85 | } | |
86 | //________________________________________________________________ | |
87 | void AliT0CalibTimeEq::Reset() | |
88 | { | |
89 | //reset values | |
90 | ||
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 | { | |
99 | // print time values | |
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]); | |
104 | printf("\n Mean Vertex %f \n", fMeanVertex); | |
105 | } | |
106 | ||
107 | ||
108 | //________________________________________________________________ | |
109 | Bool_t AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys) | |
110 | { | |
111 | // compute online equalized time | |
112 | Double_t mean=0, meanver=0; | |
113 | Double_t rms=0, rmsver=0; | |
114 | Int_t nent=0; | |
115 | Bool_t ok=false; | |
116 | gFile = TFile::Open(filePhys); | |
117 | if(!gFile) { | |
118 | AliError("No input PHYS data found "); | |
119 | } | |
120 | else | |
121 | { | |
122 | ok=true; | |
123 | Char_t buf1[30]; | |
124 | for (Int_t i=0; i<24; i++) | |
125 | { | |
126 | sprintf(buf1,"CFD1-CFD%d",i+1); | |
127 | TH1F *cfd = (TH1F*) gFile->Get(buf1); | |
128 | if(!cfd) AliWarning(Form("no histograms collected by PHYS DA for channel %i", i)); | |
129 | // printf(" i = %d buf1 = %s\n", i, buf1); | |
130 | if(cfd) { | |
131 | mean=cfd->GetMean(); | |
132 | rms=cfd->GetRMS(); | |
133 | nent=cfd->GetEntries(); | |
134 | // printf ("%f %f %i \n",mean,rms,nent); | |
135 | if(nent<500 || rms>5 ) ok=false; | |
136 | } | |
137 | SetTimeEq(i,mean); | |
138 | SetTimeEqRms(i,rms); | |
139 | if (cfd) delete cfd; | |
140 | } | |
141 | TH1F *ver = (TH1F*) gFile->Get("hVertex"); | |
142 | if(!ver) AliWarning("no Vertex histograms collected by PHYS DA for Zvertex"); | |
143 | if(ver) { | |
144 | meanver = ver->GetMean(); | |
145 | rmsver = ver->GetRMS(); | |
146 | } | |
147 | SetMeanVertex(meanver); | |
148 | SetRmsVertex(rmsver); | |
149 | ||
150 | gFile->Close(); | |
151 | delete gFile; | |
152 | ||
153 | } | |
154 | return ok; | |
155 | } | |
156 | ||
157 |