]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New set of classes used to evaluate ITS plane efficiency. Presently the base class...
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2007 16:11:08 +0000 (16:11 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2007 16:11:08 +0000 (16:11 +0000)
12 files changed:
ITS/AliITSPlaneEff.cxx [new file with mode: 0644]
ITS/AliITSPlaneEff.h [new file with mode: 0644]
ITS/AliITSPlaneEffSPD.cxx [new file with mode: 0644]
ITS/AliITSPlaneEffSPD.h [new file with mode: 0644]
ITS/AliITSRecoParam.cxx
ITS/AliITSRecoParam.h
ITS/AliITStrackerMI.cxx
ITS/AliITStrackerMI.h
ITS/ITSbaseLinkDef.h
ITS/MakeITSPlaneEfficiencySPD.C [new file with mode: 0644]
ITS/PlaneEff/PlaneEffSPD/Run0_999999999_v0_s0.root [new file with mode: 0644]
ITS/libITSbase.pkg

diff --git a/ITS/AliITSPlaneEff.cxx b/ITS/AliITSPlaneEff.cxx
new file mode 100644 (file)
index 0000000..ae8af5b
--- /dev/null
@@ -0,0 +1,198 @@
+/**************************************************************************
+ * 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(): TObject(),
+fRunNumber(0), 
+fCDBUri(""),
+fInitCDBCalled(kFALSE)
+{
+    // Default constructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    a default constructed AliITSPlaneEff class
+ InitCDB();
+}
+//______________________________________________________________________
+AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : TObject(s),
+fRunNumber(s.fRunNumber),
+fCDBUri(s.fCDBUri),
+fInitCDBCalled(s.fInitCDBCalled)
+{
+    //     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;
+//    if(&s == this) return *this;
+//    this->fRunNumber         = s.fRunNumber;
+//    this->fCDBUri            = s.fCDBUri;
+//    this->fInitCDBCalled     = s.fInitCDBCalled;
+//    return *this;
+}
+//_____________________________________________________________
+void AliITSPlaneEff::Copy(TObject &obj) const {
+  // copy this to obj
+  ((AliITSPlaneEff& ) obj).fRunNumber          = fRunNumber;
+  ((AliITSPlaneEff& ) obj).fCDBUri             = fCDBUri;
+  ((AliITSPlaneEff& ) obj).fInitCDBCalled      = fInitCDBCalled;
+}
+//_________________________________________________________________________
+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(nf*(1.-nf/nt));
+ return err/=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";
+        AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+        AliWarning("Default CDB storage not yet set !!!!");
+        AliWarning(Form("Setting it now to: %s", fCDBUri.Data()));
+        AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+
+    }
+    man->SetDefaultStorage(fCDBUri);
+  }
+}
+//_____________________________________________________________________________
+void AliITSPlaneEff::SetDefaultStorage(const char* uri) {
+// Store the desired default CDB storage location
+// Activate it later within the Run() method
+
+  fCDBUri = uri;
+
+}
+
diff --git a/ITS/AliITSPlaneEff.h b/ITS/AliITSPlaneEff.h
new file mode 100644 (file)
index 0000000..7283e2c
--- /dev/null
@@ -0,0 +1,85 @@
+#ifndef ALIITSPLANEEFF_H
+#define ALIITSPLANEEFF_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+#include <TObject.h>
+#include <TString.h>
+#include "AliLog.h"
+
+class AliITSsegmentation;
+class TF1;
+class AliITSgeom;
+
+////////////////////////////////////////////////////
+//                                                //
+// ITS virtual base class for Plane Efficiency    //
+//                                                //
+////////////////////////////////////////////////////
+
+/* $Id$ */
+
+class AliITSPlaneEff : public TObject {
+ public:
+    AliITSPlaneEff();// Default constructor
+    // Standard constructor
+    //AliITSPlaneEff(AliITSDetTypeSim *dettyp);
+    virtual ~AliITSPlaneEff(){;};
+    // copy constructor. See detector specific implementation.
+    AliITSPlaneEff(const AliITSPlaneEff &source);
+    // Assignment operator. See detector specific implementation.
+    virtual AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
+    // Simple way to add another class (i.e. statistics). 
+    //AliITSPlaneEff& operator +=( const AliITSPlaneEff &){return *this};
+    // Average Plane efficiency (including dead/noisy)
+    Int_t   GetRunNumber() const {return fRunNumber;}
+    void    SetRunNumber(Int_t n) {fRunNumber=n;}
+    //
+    Double_t PlaneEff(Int_t nfound,Int_t ntried) const;     
+    Double_t ErrPlaneEff(Int_t nfound,Int_t ntried) const; 
+    virtual void GetPlaneEff(Int_t nfound,Int_t ntried,Double_t &eff, Double_t &err) const
+        {eff=PlaneEff(nfound,ntried); err=ErrPlaneEff(nfound,ntried); return;};
+    // Plane efficiency for active  detector (excluding dead/noisy channels)
+    virtual Double_t LivePlaneEff(UInt_t) const
+       {AliError("This method must be implemented in a derived class"); return -1.;};
+    virtual Double_t ErrLivePlaneEff(UInt_t) const
+       {AliError("This method must be implemented in a derived class"); return -1.;};
+    // Compute the fraction of Live detector
+    virtual Double_t GetFracLive(const UInt_t) const
+       {AliError("This method must be implemented in a derived class"); return -1.;}; 
+    // Compute the fraction of Bad (i.e. dead + noisy) detector 
+    virtual Double_t GetFracBad(const UInt_t) const
+       {AliError("This method must be implemented in a derived class"); return -1.;}; 
+    // Update the Counting of the plane efficiency
+    virtual Bool_t UpDatePlaneEff(const Bool_t, const UInt_t) 
+       {AliError("This method must be implemented in a derived class"); return kFALSE;};
+    // Estimate of the number of tracks needed for measuring efficiency within RelErr
+    virtual Int_t GetNTracksForGivenEff(Double_t eff, Double_t RelErr) const;
+    void SetDefaultStorage(const char* uri);
+    // Write into the data base 
+    virtual Bool_t WriteIntoCDB() const
+       {AliError("This method must be implemented in a derived class"); return kFALSE;};
+    virtual Bool_t ReadFromCDB()
+       {AliError("This method must be implemented in a derived class"); return kFALSE;};
+    virtual Bool_t AddFromCDB()
+       {AliError("This method must be implemented in a derived class"); return kFALSE;};
+
+ protected:
+
+    void InitCDB();
+    virtual void Copy(TObject &obj) const;
+    void NotImplemented(const char *method) const {if(gDebug>0)
+         Warning(method,"This method is not implemented for this sub-class");}
+    Int_t      fRunNumber;     //! run number (to access CDB)
+    TString    fCDBUri;        //! Uri of the default CDB storage
+    Bool_t     fInitCDBCalled; //! flag to check if CDB storages are already initialized
+   
+ private:
+    //Int_t*   fFound;         // number of associated clusters into a given block (e.g. SPD 1200 chip)
+    //Int_t*   fTries;         // number of exspected  clusters into a given block (e.g. SPD 1200 chip)
+    //Int_t    fRunNumber;     // run number (to access CDB)
+
+    ClassDef(AliITSPlaneEff,1) // ITS Plane Efficiency virtual base class 
+};
+#endif
diff --git a/ITS/AliITSPlaneEffSPD.cxx b/ITS/AliITSPlaneEffSPD.cxx
new file mode 100644 (file)
index 0000000..45b2408
--- /dev/null
@@ -0,0 +1,355 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+///////////////////////////////////////////////////////////////////////////
+//  Plane Efficiency class for ITS                      
+//  It is used for chip by chip efficiency of the SPD,        
+//  evaluated by tracks
+//  (Inherits from AliITSPlaneEff)
+//  Author: G.E. Bruno 
+//          giuseppe.bruno@ba.infn.it
+//
+///////////////////////////////////////////////////////////////////////////
+
+/* $Id$ */
+
+#include "AliITSPlaneEffSPD.h"
+#include "AliLog.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+//#include "AliCDBRunRange.h"
+#include "AliITSCalibrationSPD.h"
+
+ClassImp(AliITSPlaneEffSPD)    
+//______________________________________________________________________
+AliITSPlaneEffSPD::AliITSPlaneEffSPD():
+  AliITSPlaneEff(){
+//  for (UInt_t im=0; im<kNModule; im++){
+//  for (UInt_t ic=0; ic<kNChip; ic++){
+//    fFound[im][ic]=0;
+//    fTried[im][ic]=0;
+//  }}
+  for (UInt_t i=0; i<kNModule*kNChip; i++){
+    fFound[i]=0;
+    fTried[i]=0;
+  }
+  // default constructor
+  AliDebug(1,Form("Calling default constructor"));
+}
+//______________________________________________________________________
+AliITSPlaneEffSPD::~AliITSPlaneEffSPD(){
+    // destructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //     none.
+}
+//______________________________________________________________________
+AliITSPlaneEffSPD::AliITSPlaneEffSPD(const AliITSPlaneEffSPD &s) : AliITSPlaneEff(s) //,
+//fHis(s.fHis),
+{
+    //     Copy Constructor
+    // Inputs:
+    //    AliITSPlaneEffSPD &s The original class for which
+    //                                this class is a copy of
+    // Outputs:
+    //    none.
+    // Return:
+
+}
+//_________________________________________________________________________
+AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator+=(const AliITSPlaneEffSPD &add){
+    //    Add-to-me operator
+    // Inputs:
+    //    const AliITSPlaneEffSPD &add  simulation class to be added
+    // Outputs:
+    //    none.
+    // Return:
+    //    none
+    for (UInt_t i=0; i<kNModule*kNChip; i++){
+      fFound[i] += add.fFound[i];
+      fTried[i] += add.fTried[i];
+    }
+    return *this;
+}
+//______________________________________________________________________
+AliITSPlaneEffSPD&  AliITSPlaneEffSPD::operator=(const
+                                           AliITSPlaneEffSPD &s){
+    //    Assignment operator
+    // Inputs:
+    //    AliITSPlaneEffSPD &s The original class for which
+    //                                this class is a copy of
+    // Outputs:
+    //    none.
+    // Return:
+    if(this==&s) return *this;
+    s.Copy(*this);
+//    if(&s == this) return *this;
+//    for (UInt_t i=0; i<kNModule*kNChip; i++){
+//      this->fFound[i] = s.fFound[i];
+//      this->fTried[i] = s.fTried[i];
+//    }
+    return *this;
+}
+//______________________________________________________________________
+void AliITSPlaneEffSPD::Copy(TObject &obj) const {
+  // protected method. copy this to obj
+  AliITSPlaneEff::Copy(obj);
+  //((AliITSPlaneEffSPD& ) obj).fNpx  = fNpx;
+  for(Int_t i=0;i<kNModule*kNChip;i++) {
+      ((AliITSPlaneEffSPD& ) obj).fFound[i] = fFound[i];
+      ((AliITSPlaneEffSPD& ) obj).fTried[i] = fTried[i];
+  }
+}
+//______________________________________________________________________
+AliITSPlaneEff&  AliITSPlaneEffSPD::operator=(const
+                                           AliITSPlaneEff &s){
+    //    Assignment operator
+    // Inputs:
+    //    AliITSPlaneEffSPD &s The original class for which
+    //                                this class is a copy of
+    // Outputs:
+    //    none.
+    // Return:
+
+    if(&s == this) return *this;
+    Error("AliITSPlaneEffSPD","Not allowed to make a = with "
+          "AliITSPlaneEffSPD","Using default creater instead");
+
+    return *this;
+}
+//_______________________________________________________________________
+Int_t AliITSPlaneEffSPD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr,
+          UInt_t im, UInt_t ic) const {
+   
+  //   Estimate the number of tracks still to be collected to attain a 
+  //   given efficiency eff, with relative error RelErr
+  //   Inputs:
+  //         eff    -> Expected efficiency (e.g. those from actual estimate)
+  //         RelErr -> tollerance [0,1] 
+  //         im     -> module number [0,249]
+  //         ic     -> chip number [0,5]
+  //   Outputs: none
+  //   Return: the estimated n. of tracks 
+  //
+if (im>=kNModule || ic>=kNChip) 
+ {Error("AliITSPlaneEffSPD","you asked for a non existing chip");
+ return -1;}
+else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im,ic)];
+}
+//_________________________________________________________________________
+Double_t  AliITSPlaneEffSPD::PlaneEff(const UInt_t im,const UInt_t ic) const {
+// Compute the efficiency for a basic block, 
+// Inputs:
+//        number of associated cluslters (nf) 
+//        number of used tracks (nt)
+if (im>=kNModule || ic>=kNChip) 
+ {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return -1.;}
+ Int_t nf=fFound[GetKey(im,ic)];
+ Int_t nt=fTried[GetKey(im,ic)];
+return AliITSPlaneEff::PlaneEff(nf,nt);
+}
+//_________________________________________________________________________
+Double_t  AliITSPlaneEffSPD::ErrPlaneEff(const UInt_t im,const UInt_t ic) 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)
+if (im>=kNModule || ic>=kNChip) 
+ {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return -1.;}
+Int_t nf=fFound[GetKey(im,ic)];
+Int_t nt=fTried[GetKey(im,ic)];
+return AliITSPlaneEff::ErrPlaneEff(nf,nt);
+} 
+//_________________________________________________________________________
+Bool_t AliITSPlaneEffSPD::UpDatePlaneEff(const Bool_t Kfound,
+                                         const UInt_t im, const UInt_t ic) {
+  // Update efficiency for a basic block
+if (im>=kNModule || ic>=kNChip) 
+ {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return kFALSE;}
+ fTried[GetKey(im,ic)]++;
+ if(Kfound) fFound[GetKey(im,ic)]++;
+ return kTRUE;
+}
+//_________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::GetChip(const UInt_t col) const {
+  // get chip given the column
+if(col>=kNCol*kNChip) 
+ {Error("AliITSPlaneEffSPD","you asked for a non existing column"); return 10;}
+return col/kNCol;
+}
+//__________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::GetKey(const UInt_t mod, const UInt_t chip) const {
+  // get key given a basic block
+if(mod>=kNModule || chip>=kNChip)
+  {Error("AliITSPlaneEffSPD::GetKey","you asked for a non existing block"); return 99999;}
+return mod*kNChip+chip;
+}
+//__________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::GetModFromKey(const UInt_t key) const {
+  // get mod. from key
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::GetModFromKey","you asked for a non existing key"); return 9999;}
+return key/kNChip;
+}
+//__________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::GetChipFromKey(const UInt_t key) const {
+  // retrieves chip from key
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::GetChipFromKey","you asked for a non existing key"); return 999;}
+return (key%(kNModule*kNChip))%kNChip;
+}
+//__________________________________________________________________________
+void AliITSPlaneEffSPD::GetModAndChipFromKey(const UInt_t key,UInt_t& mod,UInt_t& chip) const {
+  // get module and chip from a key
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::GetModAndChipFromKey","you asked for a non existing key"); 
+  mod=9999;
+  chip=999;
+  return;}
+mod=key/kNChip;
+chip=(key%(kNModule*kNChip))%kNChip;
+return;
+}
+//____________________________________________________________________________
+Double_t AliITSPlaneEffSPD::LivePlaneEff(UInt_t key) const {
+  // returns plane efficieny multiplied by the fraction of sensor which is OK
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::LivePlaneEff","you asked for a non existing key");
+   return -1.;}
+return PlaneEff(key)*GetFracLive(key);
+}
+//____________________________________________________________________________
+Double_t AliITSPlaneEffSPD::ErrLivePlaneEff(UInt_t key) const {
+  // returns error on live plane efficiency
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::LivePlaneEff","you asked for a non existing key");
+   return -1.;}
+return ErrPlaneEff(key); // for the time being: to be checked
+}
+//_____________________________________________________________________________
+Double_t AliITSPlaneEffSPD::GetFracLive(const UInt_t key) const {
+  // returns the fraction of the sensor which is OK
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::GetRelLiveDetector","you asked for a non existing key");
+   return -1.;}
+    // Compute the fraction of bad (dead+noisy) detector 
+UInt_t dead=0,noisy=0;
+GetDeadAndNoisyInChip(key,dead,noisy);
+Double_t live=dead+noisy;
+live/=(kNRow*kNCol);
+return 1.-live;
+}
+//_____________________________________________________________________________
+void AliITSPlaneEffSPD::GetDeadAndNoisyInChip(const UInt_t key,
+      UInt_t& nrDeadInChip, UInt_t& nrNoisyInChip) const {
+  // returns the number of dead and noisy pixels
+nrDeadInChip=0;
+nrNoisyInChip=0;
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::GetRelLiveDetector","you asked for a non existing key");
+   return;}
+    // Compute the number of bad (dead+noisy) pixel in a chip
+//
+if(!fInitCDBCalled) 
+  {Error("AliITSPlaneEffSPD::GetRelLiveDetector","CDB not inizialized: call InitCDB first");
+   return;};
+AliCDBManager* man = AliCDBManager::Instance();
+// retrieve map of dead Pixel 
+AliCDBEntry *cdbSPDDead = man->Get("ITS/Calib/SPDDead", fRunNumber);
+TObjArray* spdDead;
+if(cdbSPDDead) {
+  spdDead = (TObjArray*)cdbSPDDead->GetObject();
+  if(!spdDead) 
+  {Error("AliITSPlaneEffSPD::GetRelLiveDetector"," SPDDead not found in CDB");
+   return;}
+} else {
+  Error("AliITSPlaneEffSPD::GetRelLiveDetector","Did not find Calib/SPDDead.");
+  return;
+}
+// retrieve map of noisy Pixel 
+AliCDBEntry *cdbSPDNoisy = man->Get("ITS/Calib/SPDNoisy", fRunNumber);
+TObjArray* spdNoisy;
+if(cdbSPDNoisy) {
+  spdNoisy = (TObjArray*)cdbSPDNoisy->GetObject();
+  if(!spdNoisy) 
+  {Error("AliITSPlaneEffSPD::GetRelLiveDetector"," SPDNoisy not found in CDB");
+   return;}
+} else {
+  Error("AliITSPlaneEffSPD::GetRelLiveDetector","Did not find Calib/SPDNoisy.");
+  return;
+}
+//
+UInt_t mod=GetModFromKey(key);
+UInt_t chip=GetChipFromKey(key);
+// count number of dead
+AliITSCalibrationSPD* calibSPD=(AliITSCalibrationSPD*) spdDead->At(mod);
+UInt_t nrDead = calibSPD->GetNrBad();
+for (UInt_t index=0; index<nrDead; index++) {
+  if(GetChip(calibSPD->GetBadColAt(index))==chip) nrDeadInChip++;
+}
+calibSPD=(AliITSCalibrationSPD*) spdNoisy->At(mod);
+UInt_t nrNoisy = calibSPD->GetNrBad();
+for (UInt_t index=0; index<nrNoisy; index++) {
+  if(GetChip(calibSPD->GetBadColAt(index))==chip) nrNoisyInChip++;
+}
+return;
+}
+//_____________________________________________________________________________
+Double_t AliITSPlaneEffSPD::GetFracBad(const UInt_t key) const {
+  // returns 1-fractional live
+if(key>=kNModule*kNChip)
+  {Error("AliITSPlaneEffSPD::GetRelDeadDetector","you asked for a non existing key");
+   return -1.;}
+return 1.-GetFracLive(key);
+}
+//_____________________________________________________________________________
+Bool_t AliITSPlaneEffSPD::WriteIntoCDB() const {
+// write onto CDB
+if(!fInitCDBCalled)
+  {Error("AliITSPlaneEffSPD::WriteIntoCDB","CDB not inizialized: call InitCDB first");
+   return kFALSE;}
+// to be written properly: now only for debugging 
+  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
+  md->SetObjectClassName("AliITSPlaneEff");
+  md->SetResponsible("Giuseppe Eugenio Bruno");
+  md->SetBeamPeriod(0);
+  md->SetAliRootVersion("head 19/11/07"); //root version
+  AliCDBId id("ITS/PlaneEff/PlaneEffSPD",0,AliCDBRunRange::Infinity()); 
+  AliITSPlaneEffSPD eff; 
+  eff=*this;
+  Bool_t r=AliCDBManager::Instance()->GetDefaultStorage()->Put(&eff,id,md);
+  delete md;
+  return r;
+}
+//_____________________________________________________________________________
+Bool_t AliITSPlaneEffSPD::ReadFromCDB() {
+// read from CDB
+if(!fInitCDBCalled)
+  {Error("AliITSPlaneEffSPD::ReadFromCDB","CDB not inizialized: call InitCDB first");
+   return kFALSE;}
+//if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
+//    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+//  }
+AliCDBEntry *cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSPD",fRunNumber);
+AliITSPlaneEffSPD* eff= (AliITSPlaneEffSPD*)cdbEntry->GetObject();
+if(this==eff) return kFALSE;
+eff->Copy(*this);
+return kTRUE;
+}
diff --git a/ITS/AliITSPlaneEffSPD.h b/ITS/AliITSPlaneEffSPD.h
new file mode 100644 (file)
index 0000000..ceb041b
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef ALIITSPLANEEFFSPD_H
+#define ALIITSPLANEEFFSPD_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+#include "AliITSPlaneEff.h"
+
+///////////////////////////////////////////
+//                                       //
+// ITS Plane Efficiency class            //
+//       for SPD                         //
+///////////////////////////////////////////
+
+/* $Id$ */
+  
+class AliITSPlaneEffSPD :  public AliITSPlaneEff {
+ public:
+    AliITSPlaneEffSPD(); // default constructor
+    virtual ~AliITSPlaneEffSPD(); // destructror
+    // copy constructor
+    AliITSPlaneEffSPD(const AliITSPlaneEffSPD &source);
+    // ass. operator
+    AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s);
+    virtual AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
+    // Simple way to add another class (i.e. statistics). 
+    AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
+    // Getters for average Plane efficiency (icluding dead/noisy)
+    Double_t PlaneEff(const UInt_t mod, const UInt_t chip) const;
+    Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip) const;
+    Double_t PlaneEff(const UInt_t key) const 
+        {return PlaneEff(GetModFromKey(key),GetChipFromKey(key));};
+    Double_t ErrPlaneEff(const UInt_t key) const 
+        {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key));};
+    // Methods to update the Plane efficiency (specific of the SPD segmentation) 
+    Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod, const UInt_t chip);
+    virtual Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
+        {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));};
+    //
+    enum {kNModule = 240}; // The number of modules
+    enum {kNChip = 5}; // The number of chips per module
+    enum {kNCol = 32}; // The number of columns per chip
+    enum {kNRow = 256}; // The number of rows per chip (and per module)
+//
+    UInt_t GetChip(const UInt_t col) const; // get the chip number (from 0 to kNChip)
+//  Plane efficiency for active  detector (excluding dead/noisy channels)
+//  access to DB is needed
+    virtual Double_t LivePlaneEff(UInt_t key) const;
+    Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip) const
+       {return LivePlaneEff(GetKey(mod,chip));};
+    virtual Double_t ErrLivePlaneEff(UInt_t key) const;
+    Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip) const
+       {return ErrLivePlaneEff(GetKey(mod,chip));};
+    // Compute the fraction of Live area (of the CHIP for the SPD)
+    virtual Double_t GetFracLive(const UInt_t key) const;
+    // Compute the fraction of bad (i.e. dead and noisy) area (of the CHIP for the SPD)
+    virtual Double_t GetFracBad(const UInt_t key) const;
+    virtual Bool_t WriteIntoCDB() const;
+    virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
+    virtual Bool_t AddFromCDB()   // this method updates Data Members (statistics) from DataBase
+      {AliError("AddFromCDB: Still To be implemented"); return kFALSE;}
+
+ protected:
+    virtual void Copy(TObject &obj) const;
+    Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const;
+
+// 
+    Int_t fFound[kNModule*kNChip];  // number of associated clusters in a given chip
+    Int_t fTried[kNModule*kNChip];  // number of tracks used for chip efficiency evaluation
+ private:
+    UInt_t GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic 
+                                                              // block of the SPD 
+    UInt_t GetModFromKey(const UInt_t key) const;
+    UInt_t GetChipFromKey(const UInt_t key) const;
+    UInt_t GetChipFromCol(const UInt_t col) const;
+    void GetModAndChipFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip) const;
+    void GetDeadAndNoisyInChip(const UInt_t key, UInt_t& dead, UInt_t& noisy) const;
+
+    ClassDef(AliITSPlaneEffSPD,1) // SPD Plane Efficiency class
+};
+#endif
+
index 71ac349edd3f9b160c5d06c0939255e8d32de000..ce08d1357bf0bf55916abe5630159e49d687cfa5 100644 (file)
@@ -97,6 +97,7 @@ fXPassDeadZoneHits(0),
 fUseTGeoInTracker(3),
 fAllowSharedClusters(kTRUE),
 fClusterErrorsParam(1),
+fComputePlaneEff(kFALSE),
 fExtendedEtaAcceptance(kFALSE),
 fUseDeadZonesFromOCDB(kFALSE),
 fFactorSAWindowSizes(1.),
@@ -219,6 +220,18 @@ AliITSRecoParam *AliITSRecoParam::GetHighFluxParam()
   return param;
 }
 //_____________________________________________________________________________
+AliITSRecoParam *AliITSRecoParam::GetPlaneEffParam(Int_t i)
+{
+  //
+  // make special reconstruction parameters for Plane Efficiency study on layer i
+  //
+  AliITSRecoParam *param;
+  param = GetHighFluxParam();
+  param->SetComputePlaneEff();
+  param->SetLayerToSkip(i);
+  return param;
+}
+//_____________________________________________________________________________
 AliITSRecoParam *AliITSRecoParam::GetLowFluxParam() 
 {
   //
@@ -345,4 +358,3 @@ void AliITSRecoParam::SetLayersParameters()
 
   return;
 }
-
index ab5b678258bf0fc4669a27373bf4a056805d0eaa..f8a11e8b1b0028b1b52fb50c306bb922558b886c 100644 (file)
@@ -25,6 +25,7 @@ class AliITSRecoParam : public AliDetectorRecoParam
   static AliITSRecoParam *GetLowFluxParam();// make reco parameters for low flux env.
   static AliITSRecoParam *GetHighFluxParam();// make reco parameters for high flux env. 
   static AliITSRecoParam *GetCosmicTestParam();// special setting for cosmic  
+  static AliITSRecoParam *GetPlaneEffParam(Int_t i);// special setting for Plane Efficiency studies
 
   static Int_t GetLayersNotToSkip(Int_t i) { return fgkLayersNotToSkip[i]; }
   static Int_t GetLastLayerToTrackTo() { return fgkLastLayerToTrackTo; }
@@ -123,6 +124,10 @@ class AliITSRecoParam : public AliDetectorRecoParam
   void   SetUseAmplitudeInfo(Bool_t use=kTRUE) { for(Int_t i=0;i<AliITSgeomTGeo::kNLayers;i++) fUseAmplitudeInfo[i]=use; return; }
   void   SetUseAmplitudeInfo(Int_t ilay,Bool_t use) { fUseAmplitudeInfo[ilay]=use; return; }
   Bool_t GetUseAmplitudeInfo(Int_t ilay) const { return fUseAmplitudeInfo[ilay]; }
+//
+  void   SetComputePlaneEff(Bool_t ext=kTRUE) { fComputePlaneEff=ext; return; }
+  Bool_t GetComputePlaneEff() const { return fComputePlaneEff; }
+//
   void   SetExtendedEtaAcceptance(Bool_t ext=kTRUE) { fExtendedEtaAcceptance=ext; return; }
   Bool_t GetExtendedEtaAcceptance() const { return fExtendedEtaAcceptance; }
   void   SetUseDeadZonesFromOCDB(Bool_t use=kTRUE) { fUseDeadZonesFromOCDB=use; return; }
@@ -250,6 +255,7 @@ class AliITSRecoParam : public AliDetectorRecoParam
   Bool_t fAllowSharedClusters; // if kFALSE don't set to kITSin tracks with shared clusters (MI)
   Int_t fClusterErrorsParam; // parametrization for cluster errors (MI), see AliITSRecoParam::GetError()
   Bool_t fUseAmplitudeInfo[AliITSgeomTGeo::kNLayers]; // use cluster charge in cluster-track matching (SDD,SSD) (MI)
+  Bool_t fComputePlaneEff;  // flag to enable Computation of PlaneEfficiency
   Bool_t fExtendedEtaAcceptance;  // enable jumping from TPC to SPD at large eta (MI)
   Bool_t fUseDeadZonesFromOCDB; // enable using OCDB info on dead modules.. (MI)
   Double_t fFactorSAWindowSizes; // larger window sizes in SA
index 589c783055d4e1fcdbd42164a6ed786898d7a344..c604384ee54c7cb61437f82428ade1b602bed30e 100644 (file)
@@ -44,6 +44,7 @@
 #include "AliTrackPointArray.h"
 #include "AliAlignObj.h"
 #include "AliITSClusterParam.h"
+#include "AliITSPlaneEff.h"
 
 ClassImp(AliITStrackerMI)
 
@@ -73,7 +74,8 @@ fxOverX0ShieldTrks(0),
 fxTimesRhoShieldTrks(0),
 fxOverX0LayerTrks(0),
 fxTimesRhoLayerTrks(0),
-fDebugStreamer(0){
+fDebugStreamer(0),
+fPlaneEff(0){
   //Default constructor
   Int_t i;
   for(i=0;i<4;i++) fSPDdetzcentre[i]=0.;
@@ -105,7 +107,8 @@ fxOverX0ShieldTrks(0),
 fxTimesRhoShieldTrks(0),
 fxOverX0LayerTrks(0),
 fxTimesRhoLayerTrks(0),
-fDebugStreamer(0){
+fDebugStreamer(0),
+fPlaneEff(0){
   //--------------------------------------------------------------------
   //This is the AliITStrackerMI constructor
   //--------------------------------------------------------------------
@@ -223,7 +226,8 @@ fxOverX0ShieldTrks(0),
 fxTimesRhoShieldTrks(0),
 fxOverX0LayerTrks(0),
 fxTimesRhoLayerTrks(0),
-fDebugStreamer(tracker.fDebugStreamer){
+fDebugStreamer(tracker.fDebugStreamer),
+fPlaneEff(tracker.fPlaneEff){
   //Copy constructor
   Int_t i;
   for(i=0;i<4;i++) {
@@ -4854,3 +4858,4 @@ Int_t AliITStrackerMI::CheckDeadZone(/*AliITStrackMI *track,*/
   return 0;
 }
 //------------------------------------------------------------------------
+
index 6f5eed6dc6beecb4f1c27122e8502d74107aaa18..9c9ab1b3f56a7f3b5bb9c13701a06c31bb815432 100644 (file)
@@ -19,6 +19,7 @@ class AliESDEvent;
 #include "AliITSRecPoint.h"
 #include "AliITStrackMI.h"
 #include "AliTracker.h"
+#include "AliITSPlaneEff.h"
 
 //-------------------------------------------------------------------------
 class AliITStrackerMI : public AliTracker {
@@ -255,6 +256,8 @@ protected:
   Float_t *fxOverX0LayerTrks;            //! material budget
   Float_t *fxTimesRhoLayerTrks;          //! material budget
   TTreeSRedirector *fDebugStreamer;      //!debug streamer
+//
+  AliITSPlaneEff *fPlaneEff;             //| Pointer to the ITS plane efficicency
 private:
   AliITStrackerMI(const AliITStrackerMI &tracker);
   AliITStrackerMI & operator=(const AliITStrackerMI &tracker);
@@ -264,6 +267,8 @@ private:
 
 
 
+
+
 /////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////
index f38a4ec79efefccaf3f19b087063c3a8b6be882c..d9215eee91306e0c847bf81e5f0f1dcdba0663aa 100644 (file)
@@ -64,6 +64,8 @@
 #pragma link C++ class  AliITSChannelDaSSD+;
 #pragma link C++ class  AliITSpList+;
 #pragma link C++ class  AliITSpListItem+;
+#pragma link C++ class  AliITSPlaneEff+;
+#pragma link C++ class  AliITSPlaneEffSPD+;
 
 #pragma link C++ class  AliITSRawData+;
 // These streamers must be formatted according to the raw data fromat
diff --git a/ITS/MakeITSPlaneEfficiencySPD.C b/ITS/MakeITSPlaneEfficiencySPD.C
new file mode 100644 (file)
index 0000000..9508d09
--- /dev/null
@@ -0,0 +1,34 @@
+void MakeITSPlaneEfficiencySPD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::Infinity()){
+  
+  if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
+    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+  }
+  
+  AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
+  md1->SetObjectClassName("AliITSPlaneEff");
+  md1->SetResponsible("Giuseppe Bruno");
+  md1->SetBeamPeriod(0);
+  md1->SetAliRootVersion("head 19/11/07"); //root version
+
+  AliCDBId idplaneeffSPD("ITS/PlaneEff/PlaneEffSPD",firstRun, lastRun);
+  
+  AliITSPlaneEffSPD* planeeffSPD = new AliITSPlaneEffSPD();
+
+//  planeeffSPD->SetOwner(kFALSE);
+  
+
+  // loop over SPD chip
+  Bool_t BFound=kFALSE;
+  //for(Int_t key=0;key<1200;key++){
+  for(UInt_t mod=0;mod<240;mod++){
+  for(UInt_t chip=0;chip<5;chip++){
+  // suppose to have 1000 tracks in each chip and an average efficiency of 99%
+    for(Int_t j=0; j<1000; j++) {
+      BFound=kFALSE;
+      if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
+      planeeffSPD->UpDatePlaneEff(BFound,mod,chip);
+    }
+  }}
+  if(AliCDBManager::Instance()->GetDefaultStorage()->Put(planeeffSPD, idplaneeffSPD, md1))
+  {cout << "Riuscito " << endl;}
+}
\ No newline at end of file
diff --git a/ITS/PlaneEff/PlaneEffSPD/Run0_999999999_v0_s0.root b/ITS/PlaneEff/PlaneEffSPD/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..e2ef344
Binary files /dev/null and b/ITS/PlaneEff/PlaneEffSPD/Run0_999999999_v0_s0.root differ
index 0f4b34b986c75453734c5a3171128e3a84e26d2f..d6a927d6218b764e3163a6eec0c632deb142b6bf 100644 (file)
@@ -49,7 +49,9 @@ SRCS =        AliITSgeom.cxx \
                AliITSEventHeader.cxx \
                AliITSRawStreamSSDv1.cxx \
                AliITSRawData.cxx \
-               AliITSgeomTGeo.cxx
+               AliITSgeomTGeo.cxx \
+               AliITSPlaneEff.cxx \
+               AliITSPlaneEffSPD.cxx \
 
 HDRS:=  $(SRCS:.cxx=.h)