1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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
23 // giuseppe.bruno@ba.infn.it
25 ///////////////////////////////////////////////////////////////////////////
30 #include "AliITSPlaneEff.h"
32 #include "AliCDBManager.h"
33 #include "AliCDBStorage.h"
35 ClassImp(AliITSPlaneEff)
36 //______________________________________________________________________
37 AliITSPlaneEff::AliITSPlaneEff(): AliPlaneEff(),
40 fInitCDBCalled(kFALSE)
42 // Default constructor
48 // a default constructed AliITSPlaneEff class
51 //______________________________________________________________________
52 AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : AliPlaneEff(s),
53 fRunNumber(s.fRunNumber),
55 fInitCDBCalled(s.fInitCDBCalled)
59 // const AliITSPlaneEff &s simulation class to copy from
63 // a standard constructed AliITSPlaneEff class with values the same
67 //_________________________________________________________________________
68 //void AliITSPlaneEff::operator+=(const AliITSPlaneEff &add){
71 // const AliITSPlaneEff &add simulation class to be added
79 //_________________________________________________________________________
80 AliITSPlaneEff& AliITSPlaneEff::operator=(const AliITSPlaneEff &source){
81 // Assignment operator
83 // const AliITSPlaneEff &source simulation class to copy from
87 // a standard constructed AliITSPlaneEff class with values the same
94 //_________________________________________________________________________
96 AliPlaneEff& AliITSPlaneEff::operator=(const
98 // Assignment operator
100 // AliPlaneEff &s The original class for which
101 // this class is a copy of
106 if(&s == this) return *this;
107 AliWarning("AliITSPlaneEff Not allowed to make a = Using default creator instead");
111 //_________________________________________________________________________
112 void AliITSPlaneEff::Copy(TObject &obj) const {
114 ((AliITSPlaneEff& ) obj).fRunNumber = fRunNumber;
115 ((AliITSPlaneEff& ) obj).fCDBUri = fCDBUri;
116 ((AliITSPlaneEff& ) obj).fInitCDBCalled = fInitCDBCalled;
118 //_________________________________________________________________________
119 Double_t AliITSPlaneEff::PlaneEff(Int_t nf,Int_t nt) const {
120 // Compute the efficiency for a basic block,
122 // number of associated cluslters (nf)
123 // number of used tracks (nt)
128 if(nf<0 || nt<=0 || nt<nf) {
129 AliInfo(Form("AliITSPlaneEff::PlaneEff: nfound= %i, ntried= %i",nf,nt));
134 //_________________________________________________________________________
135 Double_t AliITSPlaneEff::ErrPlaneEff(Int_t nf,Int_t nt) const{
136 // Compute the statistical error on efficiency for a basic block,
137 // using binomial statistics
139 // number of associated cluslters (nf)
140 // number of used tracks (nt)
144 // the error on the efficiency
145 if(nf<0 || nt<=0 || nt<nf) {
146 AliInfo(Form("AliITSPlaneEff::ErrPlaneEff: nfound= %i, ntried= %i",nf,nt));
148 Double_t err=TMath::Sqrt(nf*(1.-nf/nt));
151 //______________________________________________________________________
152 Int_t AliITSPlaneEff::GetNTracksForGivenEff(Double_t eff, Double_t RelErr) const {
153 // Estimate of the number of tracks needed for measuring efficiency
154 // with a given relative error using binomial statistics
156 // exspected efficiency eff (e.g. from previous measurements)
157 // wished relative error RelErr
160 // Return: number of tracks given as the nearest integer
161 if(eff<=0 || eff>1 || RelErr<=0 ) {
162 AliInfo(Form("AliITSPlaneEff::GetNTracksForGivenEff: eff= %f, RelErr= %f",eff,RelErr));
164 return TMath::Nint((1-eff)/(eff*RelErr*RelErr));
166 //________________________________________________________________________
167 void AliITSPlaneEff::InitCDB()
169 // activate a default CDB storage
170 // First check if we have any CDB storage set, because it is used
171 // to retrieve the calibration and alignment constants
173 if (fInitCDBCalled) return;
174 fInitCDBCalled = kTRUE;
176 AliCDBManager* man = AliCDBManager::Instance();
177 if (man->IsDefaultStorageSet())
179 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
180 AliWarning("Default CDB storage has been already set !");
181 AliWarning(Form("Ignoring the default storage declared in AliITSPlaneEff: %s",fCDBUri.Data()));
182 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
183 fCDBUri = man->GetDefaultStorage()->GetURI();
186 if (fCDBUri.Length() > 0)
188 AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
189 AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data()));
190 AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
192 fCDBUri="local://$ALICE_ROOT";
193 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
194 AliWarning("Default CDB storage not yet set !!!!");
195 AliWarning(Form("Setting it now to: %s", fCDBUri.Data()));
196 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
199 man->SetDefaultStorage(fCDBUri);
202 //_____________________________________________________________________________
203 void AliITSPlaneEff::SetDefaultStorage(const char* uri) {
204 // Store the desired default CDB storage location
205 // Activate it later within the Run() method