Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 2007-2009, 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 : // Base Plane Efficiency class for ITS
17 : // Specific subdetector implementation is done in
18 : // AliITSPlaneEffSPD
19 : // AliITSPlaneEffSDD
20 : // AliITSPlaneEffSSD
21 : //
22 : // Author: G.E. Bruno
23 : // giuseppe.bruno@ba.infn.it
24 : //
25 : ///////////////////////////////////////////////////////////////////////////
26 :
27 : /* $Id$ */
28 :
29 : #include <TMath.h>
30 : #include "AliITSPlaneEff.h"
31 : #include "AliLog.h"
32 : #include "AliCDBManager.h"
33 : #include "AliCDBStorage.h"
34 :
35 118 : ClassImp(AliITSPlaneEff)
36 : //______________________________________________________________________
37 0 : AliITSPlaneEff::AliITSPlaneEff(): AliPlaneEff(),
38 0 : fRunNumber(0),
39 0 : fCDBUri(""),
40 0 : fInitCDBCalled(kFALSE),
41 0 : fHis(kFALSE)
42 0 : {
43 : // Default constructor
44 : // Inputs:
45 : // none.
46 : // Outputs:
47 : // none.
48 : // Return:
49 : // a default constructed AliITSPlaneEff class
50 : //InitCDB();
51 0 : }
52 : //______________________________________________________________________
53 0 : AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : AliPlaneEff(s),
54 0 : fRunNumber(s.fRunNumber),
55 0 : fCDBUri(s.fCDBUri),
56 0 : fInitCDBCalled(s.fInitCDBCalled),
57 0 : fHis(s.fHis)
58 0 : {
59 : // Copy Constructor
60 : // Inputs:
61 : // const AliITSPlaneEff &s simulation class to copy from
62 : // Outputs:
63 : // none.
64 : // Return:
65 : // a standard constructed AliITSPlaneEff class with values the same
66 : // as that of s.
67 :
68 0 : }
69 : //_________________________________________________________________________
70 : //void AliITSPlaneEff::operator+=(const AliITSPlaneEff &add){
71 : // Add to me operator
72 : // Inputs:
73 : // const AliITSPlaneEff &add simulation class to be added
74 : // Outputs:
75 : // none.
76 : // Return:
77 : // none
78 :
79 : // return;
80 : //}
81 : //_________________________________________________________________________
82 : AliITSPlaneEff& AliITSPlaneEff::operator=(const AliITSPlaneEff &source){
83 : // Assignment operator
84 : // Inputs:
85 : // const AliITSPlaneEff &source simulation class to copy from
86 : // Outputs:
87 : // none.
88 : // Return:
89 : // a standard constructed AliITSPlaneEff class with values the same
90 : // as that of s.
91 0 : if(this != &source){
92 0 : source.Copy(*this);
93 0 : }
94 0 : return *this;
95 : }
96 : //_________________________________________________________________________
97 : /*
98 : AliPlaneEff& AliITSPlaneEff::operator=(const
99 : AliPlaneEff &s){
100 : // Assignment operator
101 : // Inputs:
102 : // AliPlaneEff &s The original class for which
103 : // this class is a copy of
104 : // Outputs:
105 : // none.
106 : // Return:
107 :
108 : if(&s == this) return *this;
109 : AliWarning("AliITSPlaneEff Not allowed to make a = Using default creator instead");
110 : return *this;
111 : }
112 : */
113 : //_________________________________________________________________________
114 : void AliITSPlaneEff::Copy(TObject &obj) const {
115 : // copy this to obj
116 0 : ((AliITSPlaneEff& ) obj).fRunNumber = fRunNumber;
117 0 : ((AliITSPlaneEff& ) obj).fCDBUri = fCDBUri;
118 0 : ((AliITSPlaneEff& ) obj).fInitCDBCalled = fInitCDBCalled;
119 0 : ((AliITSPlaneEff& ) obj).fHis = fHis;
120 0 : }
121 : //_________________________________________________________________________
122 : Double_t AliITSPlaneEff::PlaneEff(Int_t nf,Int_t nt) const {
123 : // Compute the efficiency for a basic block,
124 : // Inputs:
125 : // number of associated cluslters (nf)
126 : // number of used tracks (nt)
127 : // Outputs:
128 : // none.
129 : // Return:
130 : // the efficiency
131 0 : if(nf<0 || nt<=0 || nt<nf) {
132 0 : AliInfo(Form("AliITSPlaneEff::PlaneEff: nfound= %i, ntried= %i",nf,nt));
133 0 : return -1.;}
134 0 : Double_t eff=nf;
135 0 : return eff/=nt;
136 0 : }
137 : //_________________________________________________________________________
138 : Double_t AliITSPlaneEff::ErrPlaneEff(Int_t nf,Int_t nt) const{
139 : // Compute the statistical error on efficiency for a basic block,
140 : // using binomial statistics
141 : // Inputs:
142 : // number of associated cluslters (nf)
143 : // number of used tracks (nt)
144 : // Outputs:
145 : // none.
146 : // Return:
147 : // the error on the efficiency
148 0 : if(nf<0 || nt<=0 || nt<nf) {
149 0 : AliInfo(Form("AliITSPlaneEff::ErrPlaneEff: nfound= %i, ntried= %i",nf,nt));
150 0 : return -1.;}
151 0 : Double_t err=TMath::Sqrt((Double_t)nf*(1.-(Double_t)nf/(Double_t)nt));
152 0 : return err/=(Double_t)nt;
153 0 : }
154 : //______________________________________________________________________
155 : Int_t AliITSPlaneEff::GetNTracksForGivenEff(Double_t eff, Double_t RelErr) const {
156 : // Estimate of the number of tracks needed for measuring efficiency
157 : // with a given relative error using binomial statistics
158 : // Inputs:
159 : // exspected efficiency eff (e.g. from previous measurements)
160 : // wished relative error RelErr
161 : // Outputs:
162 : // none.
163 : // Return: number of tracks given as the nearest integer
164 0 : if(eff<=0 || eff>1 || RelErr<=0 ) {
165 0 : AliInfo(Form("AliITSPlaneEff::GetNTracksForGivenEff: eff= %f, RelErr= %f",eff,RelErr));
166 0 : return -1;}
167 0 : return TMath::Nint((1-eff)/(eff*RelErr*RelErr));
168 0 : }
169 : //________________________________________________________________________
170 : void AliITSPlaneEff::InitCDB()
171 : {
172 : // activate a default CDB storage
173 : // First check if we have any CDB storage set, because it is used
174 : // to retrieve the calibration and alignment constants
175 :
176 : //if (fInitCDBCalled) return;
177 0 : fInitCDBCalled = kTRUE;
178 :
179 0 : AliCDBManager* man = AliCDBManager::Instance();
180 0 : if (man->IsDefaultStorageSet())
181 : {
182 0 : AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
183 0 : AliWarning("Default CDB storage has been already set !");
184 0 : AliWarning(Form("Ignoring the default storage declared in AliITSPlaneEff: %s",fCDBUri.Data()));
185 0 : AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
186 0 : fCDBUri = man->GetDefaultStorage()->GetURI();
187 0 : }
188 : else {
189 0 : if (fCDBUri.Length() > 0)
190 : {
191 0 : AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
192 0 : AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data()));
193 0 : AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
194 : } else {
195 0 : fCDBUri="local://$ALICE_ROOT/OCDB";
196 0 : AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
197 0 : AliWarning("Default CDB storage not yet set !!!!");
198 0 : AliWarning(Form("Setting it now to: %s", fCDBUri.Data()));
199 0 : AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
200 :
201 : }
202 0 : man->SetDefaultStorage(fCDBUri);
203 0 : man->SetRun(fRunNumber);
204 : }
205 : return;
206 0 : }
207 : //_____________________________________________________________________________
208 : void AliITSPlaneEff::SetDefaultStorage(const char* uri) {
209 : // Store the desired default CDB storage location
210 : // Activate it later within the Run() method
211 :
212 0 : fCDBUri = uri;
213 :
214 0 : }
215 :
|