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),
43 // Default constructor
49 // a default constructed AliITSPlaneEff class
52 //______________________________________________________________________
53 AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : AliPlaneEff(s),
54 fRunNumber(s.fRunNumber),
56 fInitCDBCalled(s.fInitCDBCalled),
61 // const AliITSPlaneEff &s simulation class to copy from
65 // a standard constructed AliITSPlaneEff class with values the same
69 //_________________________________________________________________________
70 //void AliITSPlaneEff::operator+=(const AliITSPlaneEff &add){
73 // const AliITSPlaneEff &add simulation class to be added
81 //_________________________________________________________________________
82 AliITSPlaneEff& AliITSPlaneEff::operator=(const AliITSPlaneEff &source){
83 // Assignment operator
85 // const AliITSPlaneEff &source simulation class to copy from
89 // a standard constructed AliITSPlaneEff class with values the same
96 //_________________________________________________________________________
98 AliPlaneEff& AliITSPlaneEff::operator=(const
100 // Assignment operator
102 // AliPlaneEff &s The original class for which
103 // this class is a copy of
108 if(&s == this) return *this;
109 AliWarning("AliITSPlaneEff Not allowed to make a = Using default creator instead");
113 //_________________________________________________________________________
114 void AliITSPlaneEff::Copy(TObject &obj) const {
116 ((AliITSPlaneEff& ) obj).fRunNumber = fRunNumber;
117 ((AliITSPlaneEff& ) obj).fCDBUri = fCDBUri;
118 ((AliITSPlaneEff& ) obj).fInitCDBCalled = fInitCDBCalled;
119 ((AliITSPlaneEff& ) obj).fHis = fHis;
121 //_________________________________________________________________________
122 Double_t AliITSPlaneEff::PlaneEff(Int_t nf,Int_t nt) const {
123 // Compute the efficiency for a basic block,
125 // number of associated cluslters (nf)
126 // number of used tracks (nt)
131 if(nf<0 || nt<=0 || nt<nf) {
132 AliInfo(Form("AliITSPlaneEff::PlaneEff: nfound= %i, ntried= %i",nf,nt));
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
142 // number of associated cluslters (nf)
143 // number of used tracks (nt)
147 // the error on the efficiency
148 if(nf<0 || nt<=0 || nt<nf) {
149 AliInfo(Form("AliITSPlaneEff::ErrPlaneEff: nfound= %i, ntried= %i",nf,nt));
151 Double_t err=TMath::Sqrt(nf*(1.-nf/nt));
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
159 // exspected efficiency eff (e.g. from previous measurements)
160 // wished relative error RelErr
163 // Return: number of tracks given as the nearest integer
164 if(eff<=0 || eff>1 || RelErr<=0 ) {
165 AliInfo(Form("AliITSPlaneEff::GetNTracksForGivenEff: eff= %f, RelErr= %f",eff,RelErr));
167 return TMath::Nint((1-eff)/(eff*RelErr*RelErr));
169 //________________________________________________________________________
170 void AliITSPlaneEff::InitCDB()
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
176 if (fInitCDBCalled) return;
177 fInitCDBCalled = kTRUE;
179 AliCDBManager* man = AliCDBManager::Instance();
180 if (man->IsDefaultStorageSet())
182 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
183 AliWarning("Default CDB storage has been already set !");
184 AliWarning(Form("Ignoring the default storage declared in AliITSPlaneEff: %s",fCDBUri.Data()));
185 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
186 fCDBUri = man->GetDefaultStorage()->GetURI();
189 if (fCDBUri.Length() > 0)
191 AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
192 AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data()));
193 AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
195 fCDBUri="local://$ALICE_ROOT";
196 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
197 AliWarning("Default CDB storage not yet set !!!!");
198 AliWarning(Form("Setting it now to: %s", fCDBUri.Data()));
199 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
202 man->SetDefaultStorage(fCDBUri);
205 //_____________________________________________________________________________
206 void AliITSPlaneEff::SetDefaultStorage(const char* uri) {
207 // Store the desired default CDB storage location
208 // Activate it later within the Run() method