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(): TObject(),
40 fInitCDBCalled(kFALSE)
42 // Default constructor
48 // a default constructed AliITSPlaneEff class
51 //______________________________________________________________________
52 AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : TObject(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
93 // if(&s == this) return *this;
94 // this->fRunNumber = s.fRunNumber;
95 // this->fCDBUri = s.fCDBUri;
96 // this->fInitCDBCalled = s.fInitCDBCalled;
99 //_____________________________________________________________
100 void AliITSPlaneEff::Copy(TObject &obj) const {
102 ((AliITSPlaneEff& ) obj).fRunNumber = fRunNumber;
103 ((AliITSPlaneEff& ) obj).fCDBUri = fCDBUri;
104 ((AliITSPlaneEff& ) obj).fInitCDBCalled = fInitCDBCalled;
106 //_________________________________________________________________________
107 Double_t AliITSPlaneEff::PlaneEff(Int_t nf,Int_t nt) const {
108 // Compute the efficiency for a basic block,
110 // number of associated cluslters (nf)
111 // number of used tracks (nt)
116 if(nf<0 || nt<=0 || nt<nf) {
117 AliInfo(Form("AliITSPlaneEff::PlaneEff: nfound= %i, ntried= %i",nf,nt));
122 //_________________________________________________________________________
123 Double_t AliITSPlaneEff::ErrPlaneEff(Int_t nf,Int_t nt) const{
124 // Compute the statistical error on efficiency for a basic block,
125 // using binomial statistics
127 // number of associated cluslters (nf)
128 // number of used tracks (nt)
132 // the error on the efficiency
133 if(nf<0 || nt<=0 || nt<nf) {
134 AliInfo(Form("AliITSPlaneEff::ErrPlaneEff: nfound= %i, ntried= %i",nf,nt));
136 Double_t err=TMath::Sqrt(nf*(1.-nf/nt));
139 //______________________________________________________________________
140 Int_t AliITSPlaneEff::GetNTracksForGivenEff(Double_t eff, Double_t RelErr) const {
141 // Estimate of the number of tracks needed for measuring efficiency
142 // with a given relative error using binomial statistics
144 // exspected efficiency eff (e.g. from previous measurements)
145 // wished relative error RelErr
148 // Return: number of tracks given as the nearest integer
149 if(eff<=0 || eff>1 || RelErr<=0 ) {
150 AliInfo(Form("AliITSPlaneEff::GetNTracksForGivenEff: eff= %f, RelErr= %f",eff,RelErr));
152 return TMath::Nint((1-eff)/(eff*RelErr*RelErr));
154 //________________________________________________________________________
155 void AliITSPlaneEff::InitCDB()
157 // activate a default CDB storage
158 // First check if we have any CDB storage set, because it is used
159 // to retrieve the calibration and alignment constants
161 if (fInitCDBCalled) return;
162 fInitCDBCalled = kTRUE;
164 AliCDBManager* man = AliCDBManager::Instance();
165 if (man->IsDefaultStorageSet())
167 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
168 AliWarning("Default CDB storage has been already set !");
169 AliWarning(Form("Ignoring the default storage declared in AliITSPlaneEff: %s",fCDBUri.Data()));
170 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
171 fCDBUri = man->GetDefaultStorage()->GetURI();
174 if (fCDBUri.Length() > 0)
176 AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
177 AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data()));
178 AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
180 fCDBUri="local://$ALICE_ROOT";
181 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
182 AliWarning("Default CDB storage not yet set !!!!");
183 AliWarning(Form("Setting it now to: %s", fCDBUri.Data()));
184 AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
187 man->SetDefaultStorage(fCDBUri);
190 //_____________________________________________________________________________
191 void AliITSPlaneEff::SetDefaultStorage(const char* uri) {
192 // Store the desired default CDB storage location
193 // Activate it later within the Run() method