ROOT logo
/**************************************************************************
 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
///////////////////////////////////////////////////////////////////////////
//  Base Plane Efficiency class for ITS            
//  Specific subdetector implementation is done in  
//  AliITSPlaneEffSPD                               
//  AliITSPlaneEffSDD                               
//  AliITSPlaneEffSSD                               
//
//  Author: G.E. Bruno 
//          giuseppe.bruno@ba.infn.it
//
///////////////////////////////////////////////////////////////////////////

/* $Id$ */

#include <TMath.h>
#include "AliITSPlaneEff.h"
#include "AliLog.h"
#include "AliCDBManager.h"
#include "AliCDBStorage.h"

ClassImp(AliITSPlaneEff)
//______________________________________________________________________
AliITSPlaneEff::AliITSPlaneEff(): AliPlaneEff(),
fRunNumber(0), 
fCDBUri(""),
fInitCDBCalled(kFALSE),
fHis(kFALSE)
{
    // Default constructor
    // Inputs:
    //    none.
    // Outputs:
    //    none.
    // Return:
    //    a default constructed AliITSPlaneEff class
 //InitCDB();
}
//______________________________________________________________________
AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : AliPlaneEff(s),
fRunNumber(s.fRunNumber),
fCDBUri(s.fCDBUri),
fInitCDBCalled(s.fInitCDBCalled),
fHis(s.fHis)
{
    //     Copy Constructor
    // Inputs:
    //    const AliITSPlaneEff &s  simulation class to copy from
    // Outputs:
    //    none.
    // Return:
    //    a standard constructed AliITSPlaneEff class with values the same
    //    as that of s.

}
//_________________________________________________________________________
//void AliITSPlaneEff::operator+=(const AliITSPlaneEff &add){
    //    Add to me operator
    // Inputs:
    //    const AliITSPlaneEff &add  simulation class to be added 
    // Outputs:
    //    none.
    // Return:
    //    none

//    return;
//}
//_________________________________________________________________________
AliITSPlaneEff&  AliITSPlaneEff::operator=(const AliITSPlaneEff &source){
    //    Assignment operator
    // Inputs:
    //    const AliITSPlaneEff &source  simulation class to copy from
    // Outputs:
    //    none.
    // Return:
    //    a standard constructed AliITSPlaneEff class with values the same
    //    as that of s.
    if(this != &source){
       source.Copy(*this);
    }
    return *this;
}
//_________________________________________________________________________
/*
AliPlaneEff&  AliITSPlaneEff::operator=(const
                                           AliPlaneEff &s){
    //    Assignment operator
    // Inputs:
    //    AliPlaneEff &s The original class for which
    //                          this class is a copy of
    // Outputs:
    //    none.
    // Return: 

    if(&s == this) return *this;
    AliWarning("AliITSPlaneEff Not allowed to make a = Using default creator instead");
    return *this;
}
*/
//_________________________________________________________________________
void AliITSPlaneEff::Copy(TObject &obj) const {
  // copy this to obj
  ((AliITSPlaneEff& ) obj).fRunNumber		= fRunNumber;
  ((AliITSPlaneEff& ) obj).fCDBUri		= fCDBUri;
  ((AliITSPlaneEff& ) obj).fInitCDBCalled	= fInitCDBCalled;
  ((AliITSPlaneEff& ) obj).fHis			= fHis;
}
//_________________________________________________________________________
Double_t AliITSPlaneEff::PlaneEff(Int_t nf,Int_t nt) const {
   // Compute the efficiency for a basic block, 
    // Inputs:
    //        number of associated cluslters (nf) 
    //        number of used tracks (nt)
    // Outputs:
    //    none.
    // Return:
    //        the efficiency 
if(nf<0 || nt<=0 || nt<nf) {
   AliInfo(Form("AliITSPlaneEff::PlaneEff: nfound= %i, ntried= %i",nf,nt)); 
   return -1.;}
 Double_t eff=nf;
 return eff/=nt;
}
//_________________________________________________________________________
Double_t AliITSPlaneEff::ErrPlaneEff(Int_t nf,Int_t nt) const{
    // Compute the statistical error on efficiency for a basic block,
    // using binomial statistics 
    // Inputs:
    //        number of associated cluslters (nf)
    //        number of used tracks (nt)
    // Outputs:
    //    none.
    // Return:
    //        the error on the efficiency 
if(nf<0 || nt<=0 || nt<nf) {
   AliInfo(Form("AliITSPlaneEff::ErrPlaneEff: nfound= %i, ntried= %i",nf,nt)); 
   return -1.;}
 Double_t err=TMath::Sqrt((Double_t)nf*(1.-(Double_t)nf/(Double_t)nt));
 return err/=(Double_t)nt;
}
//______________________________________________________________________
Int_t AliITSPlaneEff::GetNTracksForGivenEff(Double_t eff, Double_t RelErr) const {
    // Estimate of the number of tracks needed for measuring efficiency 
    // with a given relative error using binomial statistics
    // Inputs:
    //        exspected efficiency eff (e.g. from previous measurements)
    //        wished relative error RelErr
    // Outputs: 
    //    none.
    // Return: number of tracks given as the nearest integer 
if(eff<=0 || eff>1 || RelErr<=0 ) {
   AliInfo(Form("AliITSPlaneEff::GetNTracksForGivenEff: eff= %f, RelErr= %f",eff,RelErr));
   return -1;}
return TMath::Nint((1-eff)/(eff*RelErr*RelErr));
}
//________________________________________________________________________
void AliITSPlaneEff::InitCDB() 
{
// activate a default CDB storage
// First check if we have any CDB storage set, because it is used
// to retrieve the calibration and alignment constants

  //if (fInitCDBCalled) return;
  fInitCDBCalled = kTRUE;

  AliCDBManager* man = AliCDBManager::Instance();
  if (man->IsDefaultStorageSet())
  {
    AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    AliWarning("Default CDB storage has been already set !");
    AliWarning(Form("Ignoring the default storage declared in AliITSPlaneEff: %s",fCDBUri.Data()));
    AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    fCDBUri = man->GetDefaultStorage()->GetURI();
  }
  else {
    if (fCDBUri.Length() > 0)
    {
        AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data()));
        AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    } else {
        fCDBUri="local://$ALICE_ROOT/OCDB";
        AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        AliWarning("Default CDB storage not yet set !!!!");
        AliWarning(Form("Setting it now to: %s", fCDBUri.Data()));
        AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

    }
    man->SetDefaultStorage(fCDBUri);
    man->SetRun(fRunNumber);
  }
  return;
}
//_____________________________________________________________________________
void AliITSPlaneEff::SetDefaultStorage(const char* uri) {
// Store the desired default CDB storage location
// Activate it later within the Run() method

  fCDBUri = uri;

}

 AliITSPlaneEff.cxx:1
 AliITSPlaneEff.cxx:2
 AliITSPlaneEff.cxx:3
 AliITSPlaneEff.cxx:4
 AliITSPlaneEff.cxx:5
 AliITSPlaneEff.cxx:6
 AliITSPlaneEff.cxx:7
 AliITSPlaneEff.cxx:8
 AliITSPlaneEff.cxx:9
 AliITSPlaneEff.cxx:10
 AliITSPlaneEff.cxx:11
 AliITSPlaneEff.cxx:12
 AliITSPlaneEff.cxx:13
 AliITSPlaneEff.cxx:14
 AliITSPlaneEff.cxx:15
 AliITSPlaneEff.cxx:16
 AliITSPlaneEff.cxx:17
 AliITSPlaneEff.cxx:18
 AliITSPlaneEff.cxx:19
 AliITSPlaneEff.cxx:20
 AliITSPlaneEff.cxx:21
 AliITSPlaneEff.cxx:22
 AliITSPlaneEff.cxx:23
 AliITSPlaneEff.cxx:24
 AliITSPlaneEff.cxx:25
 AliITSPlaneEff.cxx:26
 AliITSPlaneEff.cxx:27
 AliITSPlaneEff.cxx:28
 AliITSPlaneEff.cxx:29
 AliITSPlaneEff.cxx:30
 AliITSPlaneEff.cxx:31
 AliITSPlaneEff.cxx:32
 AliITSPlaneEff.cxx:33
 AliITSPlaneEff.cxx:34
 AliITSPlaneEff.cxx:35
 AliITSPlaneEff.cxx:36
 AliITSPlaneEff.cxx:37
 AliITSPlaneEff.cxx:38
 AliITSPlaneEff.cxx:39
 AliITSPlaneEff.cxx:40
 AliITSPlaneEff.cxx:41
 AliITSPlaneEff.cxx:42
 AliITSPlaneEff.cxx:43
 AliITSPlaneEff.cxx:44
 AliITSPlaneEff.cxx:45
 AliITSPlaneEff.cxx:46
 AliITSPlaneEff.cxx:47
 AliITSPlaneEff.cxx:48
 AliITSPlaneEff.cxx:49
 AliITSPlaneEff.cxx:50
 AliITSPlaneEff.cxx:51
 AliITSPlaneEff.cxx:52
 AliITSPlaneEff.cxx:53
 AliITSPlaneEff.cxx:54
 AliITSPlaneEff.cxx:55
 AliITSPlaneEff.cxx:56
 AliITSPlaneEff.cxx:57
 AliITSPlaneEff.cxx:58
 AliITSPlaneEff.cxx:59
 AliITSPlaneEff.cxx:60
 AliITSPlaneEff.cxx:61
 AliITSPlaneEff.cxx:62
 AliITSPlaneEff.cxx:63
 AliITSPlaneEff.cxx:64
 AliITSPlaneEff.cxx:65
 AliITSPlaneEff.cxx:66
 AliITSPlaneEff.cxx:67
 AliITSPlaneEff.cxx:68
 AliITSPlaneEff.cxx:69
 AliITSPlaneEff.cxx:70
 AliITSPlaneEff.cxx:71
 AliITSPlaneEff.cxx:72
 AliITSPlaneEff.cxx:73
 AliITSPlaneEff.cxx:74
 AliITSPlaneEff.cxx:75
 AliITSPlaneEff.cxx:76
 AliITSPlaneEff.cxx:77
 AliITSPlaneEff.cxx:78
 AliITSPlaneEff.cxx:79
 AliITSPlaneEff.cxx:80
 AliITSPlaneEff.cxx:81
 AliITSPlaneEff.cxx:82
 AliITSPlaneEff.cxx:83
 AliITSPlaneEff.cxx:84
 AliITSPlaneEff.cxx:85
 AliITSPlaneEff.cxx:86
 AliITSPlaneEff.cxx:87
 AliITSPlaneEff.cxx:88
 AliITSPlaneEff.cxx:89
 AliITSPlaneEff.cxx:90
 AliITSPlaneEff.cxx:91
 AliITSPlaneEff.cxx:92
 AliITSPlaneEff.cxx:93
 AliITSPlaneEff.cxx:94
 AliITSPlaneEff.cxx:95
 AliITSPlaneEff.cxx:96
 AliITSPlaneEff.cxx:97
 AliITSPlaneEff.cxx:98
 AliITSPlaneEff.cxx:99
 AliITSPlaneEff.cxx:100
 AliITSPlaneEff.cxx:101
 AliITSPlaneEff.cxx:102
 AliITSPlaneEff.cxx:103
 AliITSPlaneEff.cxx:104
 AliITSPlaneEff.cxx:105
 AliITSPlaneEff.cxx:106
 AliITSPlaneEff.cxx:107
 AliITSPlaneEff.cxx:108
 AliITSPlaneEff.cxx:109
 AliITSPlaneEff.cxx:110
 AliITSPlaneEff.cxx:111
 AliITSPlaneEff.cxx:112
 AliITSPlaneEff.cxx:113
 AliITSPlaneEff.cxx:114
 AliITSPlaneEff.cxx:115
 AliITSPlaneEff.cxx:116
 AliITSPlaneEff.cxx:117
 AliITSPlaneEff.cxx:118
 AliITSPlaneEff.cxx:119
 AliITSPlaneEff.cxx:120
 AliITSPlaneEff.cxx:121
 AliITSPlaneEff.cxx:122
 AliITSPlaneEff.cxx:123
 AliITSPlaneEff.cxx:124
 AliITSPlaneEff.cxx:125
 AliITSPlaneEff.cxx:126
 AliITSPlaneEff.cxx:127
 AliITSPlaneEff.cxx:128
 AliITSPlaneEff.cxx:129
 AliITSPlaneEff.cxx:130
 AliITSPlaneEff.cxx:131
 AliITSPlaneEff.cxx:132
 AliITSPlaneEff.cxx:133
 AliITSPlaneEff.cxx:134
 AliITSPlaneEff.cxx:135
 AliITSPlaneEff.cxx:136
 AliITSPlaneEff.cxx:137
 AliITSPlaneEff.cxx:138
 AliITSPlaneEff.cxx:139
 AliITSPlaneEff.cxx:140
 AliITSPlaneEff.cxx:141
 AliITSPlaneEff.cxx:142
 AliITSPlaneEff.cxx:143
 AliITSPlaneEff.cxx:144
 AliITSPlaneEff.cxx:145
 AliITSPlaneEff.cxx:146
 AliITSPlaneEff.cxx:147
 AliITSPlaneEff.cxx:148
 AliITSPlaneEff.cxx:149
 AliITSPlaneEff.cxx:150
 AliITSPlaneEff.cxx:151
 AliITSPlaneEff.cxx:152
 AliITSPlaneEff.cxx:153
 AliITSPlaneEff.cxx:154
 AliITSPlaneEff.cxx:155
 AliITSPlaneEff.cxx:156
 AliITSPlaneEff.cxx:157
 AliITSPlaneEff.cxx:158
 AliITSPlaneEff.cxx:159
 AliITSPlaneEff.cxx:160
 AliITSPlaneEff.cxx:161
 AliITSPlaneEff.cxx:162
 AliITSPlaneEff.cxx:163
 AliITSPlaneEff.cxx:164
 AliITSPlaneEff.cxx:165
 AliITSPlaneEff.cxx:166
 AliITSPlaneEff.cxx:167
 AliITSPlaneEff.cxx:168
 AliITSPlaneEff.cxx:169
 AliITSPlaneEff.cxx:170
 AliITSPlaneEff.cxx:171
 AliITSPlaneEff.cxx:172
 AliITSPlaneEff.cxx:173
 AliITSPlaneEff.cxx:174
 AliITSPlaneEff.cxx:175
 AliITSPlaneEff.cxx:176
 AliITSPlaneEff.cxx:177
 AliITSPlaneEff.cxx:178
 AliITSPlaneEff.cxx:179
 AliITSPlaneEff.cxx:180
 AliITSPlaneEff.cxx:181
 AliITSPlaneEff.cxx:182
 AliITSPlaneEff.cxx:183
 AliITSPlaneEff.cxx:184
 AliITSPlaneEff.cxx:185
 AliITSPlaneEff.cxx:186
 AliITSPlaneEff.cxx:187
 AliITSPlaneEff.cxx:188
 AliITSPlaneEff.cxx:189
 AliITSPlaneEff.cxx:190
 AliITSPlaneEff.cxx:191
 AliITSPlaneEff.cxx:192
 AliITSPlaneEff.cxx:193
 AliITSPlaneEff.cxx:194
 AliITSPlaneEff.cxx:195
 AliITSPlaneEff.cxx:196
 AliITSPlaneEff.cxx:197
 AliITSPlaneEff.cxx:198
 AliITSPlaneEff.cxx:199
 AliITSPlaneEff.cxx:200
 AliITSPlaneEff.cxx:201
 AliITSPlaneEff.cxx:202
 AliITSPlaneEff.cxx:203
 AliITSPlaneEff.cxx:204
 AliITSPlaneEff.cxx:205
 AliITSPlaneEff.cxx:206
 AliITSPlaneEff.cxx:207
 AliITSPlaneEff.cxx:208
 AliITSPlaneEff.cxx:209
 AliITSPlaneEff.cxx:210
 AliITSPlaneEff.cxx:211
 AliITSPlaneEff.cxx:212
 AliITSPlaneEff.cxx:213
 AliITSPlaneEff.cxx:214
 AliITSPlaneEff.cxx:215