]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSPlaneEff.cxx
Changing default for raw data layout
[u/mrichter/AliRoot.git] / ITS / AliITSPlaneEff.cxx
CommitLineData
4a66240a 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
35ClassImp(AliITSPlaneEff)
36//______________________________________________________________________
7167ae53 37AliITSPlaneEff::AliITSPlaneEff(): AliPlaneEff(),
4a66240a 38fRunNumber(0),
39fCDBUri(""),
40fInitCDBCalled(kFALSE)
41{
42 // Default constructor
43 // Inputs:
44 // none.
45 // Outputs:
46 // none.
47 // Return:
48 // a default constructed AliITSPlaneEff class
49 InitCDB();
50}
51//______________________________________________________________________
7167ae53 52AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : AliPlaneEff(s),
4a66240a 53fRunNumber(s.fRunNumber),
54fCDBUri(s.fCDBUri),
55fInitCDBCalled(s.fInitCDBCalled)
56{
57 // Copy Constructor
58 // Inputs:
59 // const AliITSPlaneEff &s simulation class to copy from
60 // Outputs:
61 // none.
62 // Return:
63 // a standard constructed AliITSPlaneEff class with values the same
64 // as that of s.
65
66}
67//_________________________________________________________________________
68//void AliITSPlaneEff::operator+=(const AliITSPlaneEff &add){
69 // Add to me operator
70 // Inputs:
71 // const AliITSPlaneEff &add simulation class to be added
72 // Outputs:
73 // none.
74 // Return:
75 // none
76
77// return;
78//}
79//_________________________________________________________________________
80AliITSPlaneEff& AliITSPlaneEff::operator=(const AliITSPlaneEff &source){
81 // Assignment operator
82 // Inputs:
83 // const AliITSPlaneEff &source simulation class to copy from
84 // Outputs:
85 // none.
86 // Return:
87 // a standard constructed AliITSPlaneEff class with values the same
88 // as that of s.
89 if(this != &source){
90 source.Copy(*this);
91 }
92 return *this;
4a66240a 93}
7167ae53 94//_________________________________________________________________________
95/*
96AliPlaneEff& AliITSPlaneEff::operator=(const
97 AliPlaneEff &s){
98 // Assignment operator
99 // Inputs:
100 // AliPlaneEff &s The original class for which
101 // this class is a copy of
102 // Outputs:
103 // none.
104 // Return:
105
106 if(&s == this) return *this;
107 AliWarning("AliITSPlaneEff Not allowed to make a = Using default creator instead");
108 return *this;
109}
110*/
111//_________________________________________________________________________
4a66240a 112void AliITSPlaneEff::Copy(TObject &obj) const {
113 // copy this to obj
114 ((AliITSPlaneEff& ) obj).fRunNumber = fRunNumber;
115 ((AliITSPlaneEff& ) obj).fCDBUri = fCDBUri;
116 ((AliITSPlaneEff& ) obj).fInitCDBCalled = fInitCDBCalled;
117}
118//_________________________________________________________________________
119Double_t AliITSPlaneEff::PlaneEff(Int_t nf,Int_t nt) const {
120 // Compute the efficiency for a basic block,
121 // Inputs:
122 // number of associated cluslters (nf)
123 // number of used tracks (nt)
124 // Outputs:
125 // none.
126 // Return:
127 // the efficiency
128if(nf<0 || nt<=0 || nt<nf) {
129 AliInfo(Form("AliITSPlaneEff::PlaneEff: nfound= %i, ntried= %i",nf,nt));
130 return -1.;}
131 Double_t eff=nf;
132 return eff/=nt;
133}
134//_________________________________________________________________________
135Double_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
138 // Inputs:
139 // number of associated cluslters (nf)
140 // number of used tracks (nt)
141 // Outputs:
142 // none.
143 // Return:
144 // the error on the efficiency
145if(nf<0 || nt<=0 || nt<nf) {
146 AliInfo(Form("AliITSPlaneEff::ErrPlaneEff: nfound= %i, ntried= %i",nf,nt));
147 return -1.;}
148 Double_t err=TMath::Sqrt(nf*(1.-nf/nt));
149 return err/=nt;
150}
151//______________________________________________________________________
152Int_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
155 // Inputs:
156 // exspected efficiency eff (e.g. from previous measurements)
157 // wished relative error RelErr
158 // Outputs:
159 // none.
160 // Return: number of tracks given as the nearest integer
161if(eff<=0 || eff>1 || RelErr<=0 ) {
162 AliInfo(Form("AliITSPlaneEff::GetNTracksForGivenEff: eff= %f, RelErr= %f",eff,RelErr));
163 return -1;}
164return TMath::Nint((1-eff)/(eff*RelErr*RelErr));
165}
166//________________________________________________________________________
167void AliITSPlaneEff::InitCDB()
168{
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
172
173 if (fInitCDBCalled) return;
174 fInitCDBCalled = kTRUE;
175
176 AliCDBManager* man = AliCDBManager::Instance();
177 if (man->IsDefaultStorageSet())
178 {
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();
184 }
185 else {
186 if (fCDBUri.Length() > 0)
187 {
188 AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
189 AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data()));
190 AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
191 } else {
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("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
197
198 }
199 man->SetDefaultStorage(fCDBUri);
200 }
201}
202//_____________________________________________________________________________
203void AliITSPlaneEff::SetDefaultStorage(const char* uri) {
204// Store the desired default CDB storage location
205// Activate it later within the Run() method
206
207 fCDBUri = uri;
208
209}
210