]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Plane efficiency framework (Guiseppe)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Jan 2008 08:35:52 +0000 (08:35 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Jan 2008 08:35:52 +0000 (08:35 +0000)
23 files changed:
ITS/AliITSPlaneEff.cxx
ITS/AliITSPlaneEff.h
ITS/AliITSPlaneEffSDD.cxx
ITS/AliITSPlaneEffSDD.h
ITS/AliITSPlaneEffSPD.cxx
ITS/AliITSPlaneEffSPD.h
ITS/AliITSPlaneEffSSD.cxx
ITS/AliITSPlaneEffSSD.h
ITS/AliITStrackerMI.cxx
ITS/AliITStrackerMI.h
ITS/MakeITSPlaneEfficiencySDD.C
ITS/MakeITSPlaneEfficiencySPD.C
ITS/MakeITSPlaneEfficiencySSD.C
ITS/PlaneEff/PlaneEffSDD/Run0_999999999_v0_s0.root
ITS/PlaneEff/PlaneEffSPD/Run0_999999999_v0_s0.root
ITS/PlaneEff/PlaneEffSSD/Run0_999999999_v0_s0.root
STEER/AliPlaneEff.cxx [new file with mode: 0644]
STEER/AliPlaneEff.h [new file with mode: 0644]
STEER/AliReconstruction.cxx
STEER/AliReconstruction.h
STEER/AliTracker.h
STEER/STEERLinkDef.h
STEER/libSTEER.pkg

index ae8af5b74df996e874ce1f71e529013d83f93c2a..b5bda20f9ecb7b0b1520c3a61b1d30c014b61185 100644 (file)
@@ -34,7 +34,7 @@
 
 ClassImp(AliITSPlaneEff)
 //______________________________________________________________________
-AliITSPlaneEff::AliITSPlaneEff(): TObject(),
+AliITSPlaneEff::AliITSPlaneEff(): AliPlaneEff(),
 fRunNumber(0), 
 fCDBUri(""),
 fInitCDBCalled(kFALSE)
@@ -49,7 +49,7 @@ fInitCDBCalled(kFALSE)
  InitCDB();
 }
 //______________________________________________________________________
-AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : TObject(s),
+AliITSPlaneEff::AliITSPlaneEff(const AliITSPlaneEff &s) : AliPlaneEff(s),
 fRunNumber(s.fRunNumber),
 fCDBUri(s.fCDBUri),
 fInitCDBCalled(s.fInitCDBCalled)
@@ -90,13 +90,25 @@ AliITSPlaneEff&  AliITSPlaneEff::operator=(const AliITSPlaneEff &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;
 }
-//_____________________________________________________________
+//_________________________________________________________________________
+/*
+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;
index cd69a6f797423b316dc2df416d7edf39f5e38fa5..5715c88b347ff5a2ac1285bb2524f1eef933912b 100644 (file)
@@ -3,8 +3,8 @@
 /* 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 "AliPlaneEff.h"
 #include "AliLog.h"
 
 class AliITSsegmentation;
@@ -20,12 +20,11 @@ class AliITSgeom;
 
 /* $Id$ */
 
-class AliITSPlaneEff : public TObject {
+class AliITSPlaneEff : public AliPlaneEff {
  public:
  
     AliITSPlaneEff();// Default constructor
     // Standard constructor
-    //AliITSPlaneEff(AliITSDetTypeSim *dettyp);
     virtual ~AliITSPlaneEff(){;};
     // copy constructor. See detector specific implementation.
     AliITSPlaneEff(const AliITSPlaneEff &source);
@@ -41,6 +40,8 @@ class AliITSPlaneEff : public TObject {
     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;};
+    //
+    virtual Double_t PlaneEff(const UInt_t key) const=0;
     // Plane efficiency for active  detector (excluding dead/noisy channels)
     virtual Double_t LivePlaneEff(UInt_t) const
        {AliWarning("This method gives just a rough estimate of the live-Det Efficiency!"); 
@@ -66,6 +67,11 @@ class AliITSPlaneEff : public TObject {
        {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;};
+    // method to locate a basic block from Detector Local coordinate 
+    virtual UInt_t GetKeyFromDetLocCoord(Int_t, Int_t, Float_t, Float_t) const
+      {AliError("This method must be implemented in a derived class"); return 999999;};
+    virtual UInt_t Nblock() const // return the number of basic blocks
+      {AliError("This method must be implemented in a derived class"); return 999999;};
 
  protected:
 
index 93acd530ceb41a1580340754999f3968f149ba3e..20424b1e219ebb2c0ee24fce72030e050dca1024 100644 (file)
@@ -14,8 +14,8 @@
  **************************************************************************/
 ///////////////////////////////////////////////////////////////////////////
 //  Plane Efficiency class for ITS                      
-//  It is used for chip by chip efficiency (eventually with subwing division 
-//  along the drift direction ) of the SDD,        
+//  It is used for chip by chip efficiency (eventually with sui-bwing division 
+//  along the drift direction) of the SDD,        
 //  evaluated by tracks
 //  (Inherits from AliITSPlaneEff)
 //  Author: G.E. Bruno 
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
 //#include "AliCDBRunRange.h"
+#include "AliITSgeom.h"
 #include "AliITSCalibrationSDD.h"
+#include "AliITSsegmentationSDD.h"
 
 ClassImp(AliITSPlaneEffSDD)    
 //______________________________________________________________________
 AliITSPlaneEffSDD::AliITSPlaneEffSDD():
   AliITSPlaneEff(){
-  // Default constructor
   for (UInt_t i=0; i<kNModule*kNChip*kNWing*kNSubWing; i++){
     fFound[i]=0;
     fTried[i]=0;
@@ -125,9 +126,7 @@ AliITSPlaneEff&  AliITSPlaneEffSDD::operator=(const
     // Return:
 
     if(&s == this) return *this;
-    Error("AliITSPlaneEffSDD","Not allowed to make a = with "
-          "AliITSPlaneEffSDD","Using default creater instead");
-
+    AliError("operator=: Not allowed to make a =, use default creater instead");
     return *this;
 }
 //_______________________________________________________________________
@@ -147,7 +146,7 @@ Int_t AliITSPlaneEffSDD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelE
   //   Return: the estimated n. of tracks 
   //
 if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing) 
- {Error("AliITSPlaneEffSDD","you asked for a non existing block");
+ {AliError("GetMissingTracksForGivenEff: you asked for a non existing block");
  return -1;}
 else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im,ic,iw,is)];
 }
@@ -161,7 +160,7 @@ Double_t  AliITSPlaneEffSDD::PlaneEff(const UInt_t im,const UInt_t ic,
 //        iw     -> wing number [0,1]
 //        is     -> chip number [0,kNSubWing-1]
 if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing) 
- {Error("AliITSPlaneEffSDD","you asked for a non existing block"); return -1.;}
+ {AliError("PlaneEff(UInt_t,UInt_t,UInt_t,UInt_t): you asked for a non existing block"); return -1.;}
  Int_t nf=fFound[GetKey(im,ic,iw,is)];
  Int_t nt=fTried[GetKey(im,ic,iw,is)];
 return AliITSPlaneEff::PlaneEff(nf,nt);
@@ -177,7 +176,7 @@ Double_t  AliITSPlaneEffSDD::ErrPlaneEff(const UInt_t im,const UInt_t ic,
     //        iw     -> wing number [0,1]
     //        is     -> chip number [0,kNSubWing-1]
 if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing) 
- {Error("AliITSPlaneEffSDD","you asked for a non existing block"); return -1.;}
+ {AliError("ErrPlaneEff(UInt_t,UInt_t,UInt_t,UInt_t): you asked for a non existing block"); return -1.;}
 Int_t nf=fFound[GetKey(im,ic,iw,is)];
 Int_t nt=fTried[GetKey(im,ic,iw,is)];
 return AliITSPlaneEff::ErrPlaneEff(nf,nt);
@@ -188,7 +187,7 @@ Bool_t AliITSPlaneEffSDD::UpDatePlaneEff(const Bool_t Kfound,
                                          const UInt_t iw, const UInt_t is) {
   // Update efficiency for a basic block
 if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing) 
- {Error("AliITSPlaneEffSDD","you asked for a non existing block"); return kFALSE;}
+ {AliError("UpDatePlaneEff: you asked for a non existing block"); return kFALSE;}
  fTried[GetKey(im,ic,iw,is)]++;
  if(Kfound) fFound[GetKey(im,ic,iw,is)]++;
  return kTRUE;
@@ -199,7 +198,7 @@ void AliITSPlaneEffSDD::ChipAndWingFromAnode(const UInt_t anode, UInt_t& chip,
   // Retun the chip number [0,3] and the wing number [0,1] given the anode number
   // input: anode number [0,511]
 if(anode>=kNAnode*kNChip*kNWing)
- {Error("AliITSPlaneEffSDD::ChipAndWingFromAnode","you asked for a non existing anode"); 
+ {AliError("ChipAndWingFromAnode: you asked for a non existing anode"); 
   chip=999;
   wing=99;
   return;}
@@ -214,7 +213,7 @@ UInt_t AliITSPlaneEffSDD::ChipFromAnode(const UInt_t anode) const {
   // Retun the chip number [0,3] given the anode number 
   // input: anode number [0,511]
 if(anode>=kNAnode*kNChip*kNWing) 
- {Error("AliITSPlaneEffSDD::ChipFromAnode","you asked for a non existing anode"); return 999;}
+ {AliError("ChipFromAnode: you asked for a non existing anode"); return 999;}
 Int_t wing=0;
 Int_t chip=anode/kNAnode;
 if(anode>=kNChip*kNAnode) wing=1;
@@ -226,7 +225,7 @@ UInt_t AliITSPlaneEffSDD::WingFromAnode(const UInt_t anode) const {
   // return the wing number [0,1] given the anode number 
   // input: anode number [0,511]
 if(anode>=kNAnode*kNChip*kNWing) 
- {Error("AliITSPlaneEffSDD::GetWingFromAnode","you asked for a non existing anode"); return 99;}
+ {AliError("WingFromAnode: you asked for a non existing anode"); return 99;}
 Int_t wing=0;
 if(anode>=kNChip*kNAnode) wing=1;
 return wing;
@@ -236,35 +235,35 @@ UInt_t AliITSPlaneEffSDD::GetKey(const UInt_t mod, const UInt_t chip,
                                  const UInt_t wing, const UInt_t subw) const {
   // get key given a basic block
 if(mod>=kNModule || chip>=kNChip || wing>= kNWing || subw>=kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetKey","you asked for a non existing block"); return 99999;}
+  {AliError("GetKey: you asked for a non existing block"); return 99999;}
 return mod*kNChip*kNWing*kNSubWing+chip*kNWing*kNSubWing+wing*kNSubWing+subw;
 }
 //__________________________________________________________________________
 UInt_t AliITSPlaneEffSDD::GetModFromKey(const UInt_t key) const {
   // get mod. from key
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetModFromKey","you asked for a non existing key"); return 9999;}
+  {AliError("GetModFromKey: you asked for a non existing key"); return 9999;}
 return key/(kNChip*kNWing*kNSubWing);
 }
 //__________________________________________________________________________
 UInt_t AliITSPlaneEffSDD::GetChipFromKey(const UInt_t key) const {
   // retrieves chip from key
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetChipFromKey","you asked for a non existing key"); return 999;}
+  {AliError("GetChipFromKey: you asked for a non existing key"); return 999;}
 return (key%(kNChip*kNWing*kNSubWing))/(kNWing*kNSubWing);
 }
 //__________________________________________________________________________
 UInt_t AliITSPlaneEffSDD::GetWingFromKey(const UInt_t key) const {
   // retrieves wing from key
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetWingFromKey","you asked for a non existing key"); return 99;}
+  {AliError("GetWingFromKey: you asked for a non existing key"); return 99;}
 return ((key%(kNChip*kNWing*kNSubWing))%(kNWing*kNSubWing))/(kNSubWing);
 }
 //__________________________________________________________________________
 UInt_t AliITSPlaneEffSDD::GetSubWingFromKey(const UInt_t key) const {
   // retrieves sub-wing from key
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetSubWingFromKey","you asked for a non existing key"); return 9;}
+  {AliError("GetSubWingFromKey: you asked for a non existing key"); return 9;}
 return ((key%(kNChip*kNWing*kNSubWing))%(kNWing*kNSubWing))%(kNSubWing);
 }
 //__________________________________________________________________________
@@ -272,7 +271,7 @@ void AliITSPlaneEffSDD::GetAllFromKey(const UInt_t key,UInt_t& mod,UInt_t& chip,
                                       UInt_t& wing,UInt_t& subw) const {
   // get module, chip, wing and subwing from a key
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetAllFromKey","you asked for a non existing key"); 
+  {AliError("GetAllFromKey: you asked for a non existing key"); 
   mod=9999;
   chip=999;
   wing=99;
@@ -288,7 +287,7 @@ return;
 Double_t AliITSPlaneEffSDD::LivePlaneEff(UInt_t key) const {
   // returns plane efficieny after adding the fraction of sensor which is bad
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::LivePlaneEff","you asked for a non existing key");
+  {AliError("LivePlaneEff: you asked for a non existing key");
    return -1.;}
 Double_t leff=AliITSPlaneEff::LivePlaneEff(0); // this just for the Warning
 leff=PlaneEff(key)+GetFracBad(key);
@@ -298,7 +297,7 @@ return leff>1?1:leff;
 Double_t AliITSPlaneEffSDD::ErrLivePlaneEff(UInt_t key) const {
   // returns error on live plane efficiency
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::ErrLivePlaneEff","you asked for a non existing key");
+  {AliError("ErrLivePlaneEff: you asked for a non existing key");
    return -1.;}
 Int_t nf=fFound[key];
 Double_t triedInLive=GetFracLive(key)*fTried[key];
@@ -309,7 +308,7 @@ return AliITSPlaneEff::ErrPlaneEff(nf,nt); // for the time being: to be checked
 Double_t AliITSPlaneEffSDD::GetFracLive(const UInt_t key) const {
   // returns the fraction of the sensor which is OK
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetFracLive","you asked for a non existing key");
+  {AliError("GetFracLive: you asked for a non existing key");
    return -1.;}
     // Compute the fraction of bad (dead+noisy) detector 
 UInt_t bad=0;
@@ -324,11 +323,11 @@ void AliITSPlaneEffSDD::GetBadInBlock(const UInt_t key, UInt_t& nrBadInBlock) co
   // (it depends on the chip, not on the sub-wing)
 nrBadInBlock=0;
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetBadInBlock","you asked for a non existing key");
+  {AliError("GetBadInBlock: you asked for a non existing key");
    return;}
 //
 if(!fInitCDBCalled) 
-  {Error("AliITSPlaneEffSDD::GetBadInBlock","CDB not inizialized: call InitCDB first");
+  {AliError("GetBadInBlock: CDB not inizialized: call InitCDB first");
    return;};
 AliCDBManager* man = AliCDBManager::Instance();
 // retrieve map of dead Pixel 
@@ -337,10 +336,10 @@ TObjArray* sddEntry;
 if(cdbSDD) {
   sddEntry = (TObjArray*)cdbSDD->GetObject();
   if(!sddEntry) 
-  {Error("AliITSPlaneEffSDD::GetBadInBlock"," SDDEntry not found in CDB");
+  {AliError("GetBadInBlock: SDDEntry not found in CDB");
    return;}
 } else {
-  Error("AliITSPlaneEffSDD::GetBadInBlock","Did not find Calib/CalibSDD");
+  AliError("GetBadInBlock: Did not find Calib/CalibSDD");
   return;
 }
 //
@@ -360,7 +359,7 @@ return;
 Double_t AliITSPlaneEffSDD::GetFracBad(const UInt_t key) const {
   // returns 1-fractional live
 if(key>=kNModule*kNChip*kNWing*kNSubWing)
-  {Error("AliITSPlaneEffSDD::GetFracBad","you asked for a non existing key");
+  {AliError("GetFracBad: you asked for a non existing key");
    return -1.;}
 return 1.-GetFracLive(key);
 }
@@ -368,7 +367,7 @@ return 1.-GetFracLive(key);
 Bool_t AliITSPlaneEffSDD::WriteIntoCDB() const {
 // write onto CDB
 if(!fInitCDBCalled)
-  {Error("AliITSPlaneEffSDD::WriteIntoCDB","CDB not inizialized: call InitCDB first");
+  {AliError("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
@@ -387,7 +386,7 @@ if(!fInitCDBCalled)
 Bool_t AliITSPlaneEffSDD::ReadFromCDB() {
 // read from CDB
 if(!fInitCDBCalled)
-  {Error("AliITSPlaneEffSDD::ReadFromCDB","CDB not inizialized: call InitCDB first");
+  {AliError("ReadFromCDB: CDB not inizialized: call InitCDB first");
    return kFALSE;}
 //if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
 //    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
@@ -398,3 +397,122 @@ if(this==eff) return kFALSE;
 eff->Copy(*this);
 return kTRUE;
 }
+//_____________________________________________________________________________
+UInt_t AliITSPlaneEffSDD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet,
+                                                Float_t locx, Float_t locz) const {
+// method to locate a basic block from Detector Local coordinate (to be used in tracking)
+//
+// If kNSubWing = 1, i.e. no sub-wing subdivision, then the numbering scheme of the 
+// unique key is the following, e.g. for the first detector (idet=0,  ilayer=2)
+//
+//                           ^x_loc (cm)
+//                           |
+//   _________________________|__________________________ 3.5085
+//  |            |            |            |            |
+//  |            |            |            |            |
+//  |            |            |            |            |
+//  |   key=1    |   key=3    |   key=5    |   key=7    |
+//  |            |            |            |            |
+//  |____________|____________|____________|____________|_0_____\  local z (cm)
+//  |            |            |            |            |       /
+//  |            |            |            |            |
+//  |   key=0    |   key=2    |   key=4    |   key=6    |
+//  |            |            |            |            |
+//  |            |            |            |            |
+//  |____________|____________|____________|____________| -3.5085
+//-3.7632     -1.8816         0          1.1186      3.7632 
+//
+// for the second detector (idet=2, ilay=2), first key is 8 (bottom-left), 
+// last one is 15 (upper-right), and so on. 
+//
+// If subwing division has been applied, then you count in each wing, starting from 
+// the one with negative local ,  from the anode side (outer part) towards the 
+// cathod strip (center). 
+//                    first column: 
+//                      bottom wing   (from below): 0,1,..,kNSubWing-1, 
+//                      upper wing    (from up):    kNSubWing, ... , 2*kNSubWing-1
+//                    2nd column  
+//                      bottom wing   (from below): 2*kNSubWing, .. , 3*kNSubWing-1
+//                      upper wing    (from up):    3*kNSubWing, ... ,4*kNSubWing-1
+//                      ... 
+//                    4nd (last) column :   
+//                      bottom wing   (from below): 6*kNSubWing, .. , 7*kNSubWing-1
+//                      upper wing    (from up):    7*kNSubWing, ... ,8*kNSubWing-1
+//
+// E.g. kNSubWing=2.
+//
+//                           ^x_loc (cm)
+//                           |   
+//   _________________________|__________________________ 3.5085
+//  |            |            |            |            |
+//  |   key=2    |   key=6    |   key=10   |   key=14   |
+//  |____________|____________|____________|____________|
+//  |            |            |            |            |
+//  |   key=3    |   key=7    |   key=11   |   key=15   |
+//  |____________|____________|____________|____________|_0_____\  local z (cm)
+//  |            |            |            |            |       /
+//  |   key=1    |   key=5    |   key=9    |   key=13   |
+//  |____________|____________|____________|____________|
+//  |            |            |            |            |
+//  |   key=0    |   key=4    |   key=8    |   key=12   |
+//  |____________|____________|____________|____________| -3.5085
+//-3.7632     -1.8816         0          1.1186      3.7632 
+//
+//___________________________________________________________________________
+//
+UInt_t key=999999;
+if(ilay<2 || ilay>3)
+  {AliError("GetKeyFromDetLocCoord: you asked for a non existing layer");
+   return key;}
+if(ilay==2 && (idet<0 || idet>83))
+ {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
+   return key;}
+if(ilay==3 && (idet<0 || idet>175))
+ {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
+   return key;}
+UInt_t mod=idet;
+if(ilay==3) mod+=84;
+UInt_t chip=0,wing=0,subw=0;
+ChipAndWingAndSubWingFromLocCoor(locx,locz,chip,wing,subw);
+key=GetKey(mod,chip,wing,subw);
+return key;
+}
+//_____________________________________________________________________________
+void AliITSPlaneEffSDD::ChipAndWingAndSubWingFromLocCoor(Float_t xloc, Float_t zloc, 
+                                UInt_t& chip, UInt_t& wing, UInt_t& subw) const {
+AliITSgeom* geom=NULL;
+//AliITSsegmentationSDD* sdd=new AliITSsegmentationSDD(geom);
+AliITSsegmentationSDD sdd=AliITSsegmentationSDD(geom);
+sdd.SetDriftSpeed(sdd.GetDriftSpeed()); // this only for setting fSetDriftSpeed=kTRUE !!!
+Int_t ix,iz;
+Int_t ntb;
+UInt_t anode=0;
+if(sdd.LocalToDet(xloc,zloc,ix,iz)) {  
+  anode+=iz; 
+  ChipAndWingFromAnode(anode,chip,wing);
+  if(sdd.LocalToDet(0.,0.,ntb,iz)) {  // in this way the sub-division along time coordinate
+    subw=SubWingFromTimeBin(ix,ntb); }  // is purely geometrical one and it does not 
+  else {                               // depen on the drift-velocity. 
+    AliError("ChipAndWingAndSubWingFromLocCoor: cannot calculate n. of time bins for SubWing.");
+    subw=9;
+  }
+} else {
+  AliError("ChipAndWingAndSubWingFromLocCoor: cannot calculate anode number and time bin."); 
+  chip=999; 
+  wing=99; 
+  subw=9;
+}
+delete geom;
+}
+//__________________________________________________________________________________
+UInt_t AliITSPlaneEffSDD::SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const {
+if(tb<0 || tb>ntb || ntb<0) {
+ AliError(Form("SubWingFromTimeBin: you asked time bin = %d with %d n. of bins",tb,ntb));
+ return 9;
+}
+//AliDebug(Form("tb = %d, ntb= %d , NSubWing = %d",tb,ntb,kNSubWing));
+Float_t h=tb;
+ h/=ntb;
+ h*=(kNSubWing-1);
+return TMath::Nint(h);
+}
index fb78544341605273e02e81ffbd0a1a071cd24196..ef78465116f58b0f6409d62e047cf3fa97faba31 100644 (file)
@@ -50,7 +50,7 @@ class AliITSPlaneEffSDD :  public AliITSPlaneEff {
     enum {kNSubWing = 1}; // Eventually sub-divide each wing (by 2 ?) to account for different 
                           // efficiencies due to different drift times.  
     enum {kNAnode = 64};   // Number of channels/chip (i.e. anodes per chip)
-    enum {kNTimeBin = 72};   // granularity along drift direction (i.e. segmentation in r-phi)
+    //enum {kNTimeBin = 174};   // granularity along drift direction (i.e. segmentation in r-phi)
 //
 //  Plane efficiency for active  detector (excluding dead/noisy channels)
 //  access to DB is needed
@@ -70,6 +70,11 @@ class AliITSPlaneEffSDD :  public AliITSPlaneEff {
     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;}
+    // method to locate a basic block from Detector Local coordinate (to be used in tracking)
+    // see file cxx for numbering convention.
+    // here idet runs from 0 to 83 for layer 2 and from 0 to 175 for layer 3
+    UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t locx, Float_t locz) const;
+    UInt_t Nblock() const; // return the number of basic blocks
 
  protected:
     virtual void Copy(TObject &obj) const;
@@ -89,6 +94,12 @@ class AliITSPlaneEffSDD :  public AliITSPlaneEff {
     UInt_t ChipFromAnode(const UInt_t anode) const; // return the chip number (from 0 to kNChip-1)
     UInt_t WingFromAnode(const UInt_t anode) const; // return the wing number (from 0 to kNWing-1)
     void   ChipAndWingFromAnode(const UInt_t anode,UInt_t& chip,UInt_t& wing) const; 
+    // return the Subwing  (from 0 to kNSubWing-1) from the cell time bin in the range 
+    // [0,ntb] and from the number of time bins 
+    UInt_t SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const; 
+                                                  
+    void   ChipAndWingAndSubWingFromLocCoor(Float_t locx, Float_t locz, 
+                                 UInt_t& chip, UInt_t& wing, UInt_t& subw) const; 
     //
     void GetAllFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip, 
                        UInt_t& wing, UInt_t& subw) const;
@@ -96,5 +107,8 @@ class AliITSPlaneEffSDD :  public AliITSPlaneEff {
 
     ClassDef(AliITSPlaneEffSDD,1) // SDD Plane Efficiency class
 };
+//
+inline UInt_t AliITSPlaneEffSDD::Nblock() const {return kNModule*kNChip*kNWing*kNSubWing;}
+//
 #endif
 
index f41c9b5e8307dcaa7c309701eb76d69e2750c270..26eca728b126aca87feb60cb5538d1169ec1759c 100644 (file)
@@ -31,6 +31,7 @@
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
 //#include "AliCDBRunRange.h"
+//#include "AliITSsegmentationSPD.h"
 #include "AliITSCalibrationSPD.h"
 
 ClassImp(AliITSPlaneEffSPD)    
@@ -129,9 +130,7 @@ AliITSPlaneEff&  AliITSPlaneEffSPD::operator=(const
     // Return:
 
     if(&s == this) return *this;
-    Error("AliITSPlaneEffSPD","Not allowed to make a = with "
-          "AliITSPlaneEffSPD","Using default creater instead");
-
+    AliError("operator=: Not allowed to make a =, use default creater instead");
     return *this;
 }
 //_______________________________________________________________________
@@ -149,7 +148,7 @@ Int_t AliITSPlaneEffSPD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelE
   //   Return: the estimated n. of tracks 
   //
 if (im>=kNModule || ic>=kNChip) 
- {Error("AliITSPlaneEffSPD","you asked for a non existing chip");
+ {AliError("GetMissingTracksForGivenEff: you asked for a non existing chip");
  return -1;}
 else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im,ic)];
 }
@@ -160,7 +159,7 @@ Double_t  AliITSPlaneEffSPD::PlaneEff(const UInt_t im,const UInt_t ic) const {
 //        im     -> module number [0,249]
 //        ic     -> chip number [0,4] 
 if (im>=kNModule || ic>=kNChip) 
- {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return -1.;}
+ {AliError("PlaneEff(Uint_t,Uint_t): 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);
@@ -173,7 +172,7 @@ Double_t  AliITSPlaneEffSPD::ErrPlaneEff(const UInt_t im,const UInt_t ic) const
     //        im     -> module number [0,249]
     //        ic     -> chip number [0,4] 
 if (im>=kNModule || ic>=kNChip) 
- {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return -1.;}
+ {AliError("ErrPlaneEff(Uint_t,Uint_t): 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);
@@ -183,7 +182,7 @@ 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;}
+ {AliError("UpDatePlaneEff: you asked for a non existing chip"); return kFALSE;}
  fTried[GetKey(im,ic)]++;
  if(Kfound) fFound[GetKey(im,ic)]++;
  return kTRUE;
@@ -192,35 +191,35 @@ if (im>=kNModule || ic>=kNChip)
 UInt_t AliITSPlaneEffSPD::GetChipFromCol(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;}
+ {AliDebug(1,Form("GetChipFromCol: you asked for a non existing column %d",col)); 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;}
+  {AliWarning("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;}
+  {AliError("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;}
+  {AliError("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"); 
+  {AliError("GetModAndChipFromKey: you asked for a non existing key"); 
   mod=9999;
   chip=999;
   return;}
@@ -232,7 +231,7 @@ return;
 Double_t AliITSPlaneEffSPD::LivePlaneEff(UInt_t key) const {
   // returns plane efficieny after adding the fraction of sensor which is bad
 if(key>=kNModule*kNChip)
-  {Error("AliITSPlaneEffSPD::LivePlaneEff","you asked for a non existing key");
+  {AliError("LivePlaneEff: you asked for a non existing key");
    return -1.;}
 Double_t leff=AliITSPlaneEff::LivePlaneEff(0); // this just for the Warning
 leff=PlaneEff(key)+GetFracBad(key);
@@ -242,7 +241,7 @@ return leff>1?1:leff;
 Double_t AliITSPlaneEffSPD::ErrLivePlaneEff(UInt_t key) const {
   // returns error on live plane efficiency
 if(key>=kNModule*kNChip)
-  {Error("AliITSPlaneEffSPD::ErrLivePlaneEff","you asked for a non existing key");
+  {AliError("ErrLivePlaneEff: you asked for a non existing key");
    return -1.;}
 Int_t nf=fFound[key];
 Double_t triedInLive=GetFracLive(key)*fTried[key];
@@ -253,7 +252,7 @@ return AliITSPlaneEff::ErrPlaneEff(nf,nt); // 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::GetFracLive","you asked for a non existing key");
+  {AliError("GetFracLive: you asked for a non existing key");
    return -1.;}
     // Compute the fraction of bad (dead+noisy) detector 
 UInt_t dead=0,noisy=0;
@@ -269,12 +268,12 @@ void AliITSPlaneEffSPD::GetDeadAndNoisyInChip(const UInt_t key,
 nrDeadInChip=0;
 nrNoisyInChip=0;
 if(key>=kNModule*kNChip)
-  {Error("AliITSPlaneEffSPD::GetDeadAndNoisyInChip","you asked for a non existing key");
+  {AliError("GetDeadAndNoisyInChip: you asked for a non existing key");
    return;}
     // Compute the number of bad (dead+noisy) pixel in a chip
 //
 if(!fInitCDBCalled) 
-  {Error("AliITSPlaneEffSPD::GetDeadAndNoisyInChip","CDB not inizialized: call InitCDB first");
+  {AliError("GetDeadAndNoisyInChip: CDB not inizialized: call InitCDB first");
    return;};
 AliCDBManager* man = AliCDBManager::Instance();
 // retrieve map of dead Pixel 
@@ -283,10 +282,10 @@ TObjArray* spdDead;
 if(cdbSPDDead) {
   spdDead = (TObjArray*)cdbSPDDead->GetObject();
   if(!spdDead) 
-  {Error("AliITSPlaneEffSPD::GetDeadAndNoisyInChip"," SPDDead not found in CDB");
+  {AliError("GetDeadAndNoisyInChip: SPDDead not found in CDB");
    return;}
 } else {
-  Error("AliITSPlaneEffSPD::GetDeadAndNoisyInChip","Did not find Calib/SPDDead.");
+  AliError("GetDeadAndNoisyInChip: did not find Calib/SPDDead.");
   return;
 }
 // retrieve map of noisy Pixel 
@@ -295,10 +294,10 @@ TObjArray* spdNoisy;
 if(cdbSPDNoisy) {
   spdNoisy = (TObjArray*)cdbSPDNoisy->GetObject();
   if(!spdNoisy) 
-  {Error("AliITSPlaneEffSPD::GetDeadAndNoisyInChip"," SPDNoisy not found in CDB");
+  {AliError("GetDeadAndNoisyInChip: SPDNoisy not found in CDB");
    return;}
 } else {
-  Error("AliITSPlaneEffSPD::GetDeadAndNoisyInChip","Did not find Calib/SPDNoisy.");
+  AliError("GetDeadAndNoisyInChip: did not find Calib/SPDNoisy.");
   return;
 }
 //
@@ -321,7 +320,7 @@ return;
 Double_t AliITSPlaneEffSPD::GetFracBad(const UInt_t key) const {
   // returns 1-fractional live
 if(key>=kNModule*kNChip)
-  {Error("AliITSPlaneEffSPD::GetFracBad","you asked for a non existing key");
+  {AliError("GetFracBad: you asked for a non existing key");
    return -1.;}
 return 1.-GetFracLive(key);
 }
@@ -329,7 +328,7 @@ return 1.-GetFracLive(key);
 Bool_t AliITSPlaneEffSPD::WriteIntoCDB() const {
 // write onto CDB
 if(!fInitCDBCalled)
-  {Error("AliITSPlaneEffSPD::WriteIntoCDB","CDB not inizialized: call InitCDB first");
+  {AliError("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
@@ -348,7 +347,7 @@ if(!fInitCDBCalled)
 Bool_t AliITSPlaneEffSPD::ReadFromCDB() {
 // read from CDB
 if(!fInitCDBCalled)
-  {Error("AliITSPlaneEffSPD::ReadFromCDB","CDB not inizialized: call InitCDB first");
+  {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first");
    return kFALSE;}
 //if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
 //    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
@@ -359,3 +358,60 @@ if(this==eff) return kFALSE;
 eff->Copy(*this);
 return kTRUE;
 }
+//_____________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet, 
+                                               Float_t, Float_t locz) const {
+// method to locate a basic block from Detector Local coordinate (to be used in tracking)
+UInt_t key=999999;
+if(ilay<0 || ilay>1) 
+  {AliError("GetKeyFromDetLocCoord: you asked for a non existing layer");
+   return key;}
+if(ilay==0 && (idet<0 || idet>79))
+ {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
+   return key;}
+if(ilay==1 && (idet<0 || idet>159))
+ {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
+   return key;}
+
+UInt_t mod=idet;
+if(ilay==1) mod+=80;
+key=GetKey(mod,GetChipFromCol(GetColFromLocZ(locz)));
+return key;
+}
+//_____________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::GetColFromLocZ(Float_t zloc) const {
+UInt_t col=0;
+/* note: as it is now, the AliITSsegmentationSPD::Init() does not properly initialize (6 chips !!!)
+AliITSsegmentationSPD spd;
+spd.Init();
+Int_t ix,iz;
+if(spd.LocalToDet(0,zloc,ix,iz)) col+=iz;
+else {
+  AliError("GetColFromLocZ: cannot compute column number from local z");
+  col=99999;}
+return col;
+*/
+const Float_t kconv = 1.0E-04; // converts microns to cm.
+Float_t bz[160];
+for(Int_t i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
+bz[ 31] = bz[ 32] = 625.0; // first chip boundry
+bz[ 63] = bz[ 64] = 625.0; // first chip boundry
+bz[ 95] = bz[ 96] = 625.0; // first chip boundry
+bz[127] = bz[128] = 625.0; // first chip boundry
+//
+Int_t j=-1;
+Float_t dz=0;
+for(Int_t i=000;i<160;i++) dz+=bz[i];
+dz = -0.5*kconv*dz;
+if(zloc<dz || zloc>-1*dz) { // outside z range
+  AliDebug(1,Form("GetColFromLocZ: cannot compute column number from local z=%f",zloc));
+  return 99999;}
+for(j=0;j<160;j++){
+  dz += kconv*bz[j];
+  if(zloc<dz) break;
+} // end for j
+col+=j;
+//
+return col;
+}
+//________________________________________________________
index e4a10ec001bf79d0822aeabf5a7566390964c601..1b5fdad366deee62a33a25278fd82d3d3c7f8241 100644 (file)
@@ -23,7 +23,8 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
     AliITSPlaneEffSPD(const AliITSPlaneEffSPD &source);
     // ass. operator
     AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s);
-    virtual AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
+    AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
+    //AliPlaneEff& operator=(const AliPlaneEff &source);
     // Simple way to add another class (i.e. statistics). 
     AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
     // Getters for average Plane efficiency (icluding dead/noisy)
@@ -60,6 +61,11 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
     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;}
+   // method to locate a basic block from Detector Local coordinate (to be used in tracking)
+   // see file cxx for numbering convention.
+   // here idet runs from 0 to 79 for layer 0 and from 0 to 159 for layer 1
+    UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t, Float_t locz) const;
+    UInt_t Nblock() const; // return the number of basic blocks
 
  protected:
     virtual void Copy(TObject &obj) const;
@@ -74,10 +80,14 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
     UInt_t GetModFromKey(const UInt_t key) const;
     UInt_t GetChipFromKey(const UInt_t key) const;
     UInt_t GetChipFromCol(const UInt_t col) const;  // get the chip number (from 0 to kNChip)
+    UInt_t GetColFromLocZ(Float_t zloc) const;      // get the Column from the local z
     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
 };
+//
+inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
+//
 #endif
 
index 52f14d3a6dd8d0638da5070c0ff849f5ff3a87ca..a43e10a4e231c74eac832b126128379b0c50fa19 100644 (file)
@@ -22,7 +22,7 @@
 //
 ///////////////////////////////////////////////////////////////////////////
 
-/* $Id$ */
+/*  $Id$ */
 
 #include <TMath.h>
 #include "AliITSPlaneEffSSD.h"
@@ -37,7 +37,6 @@ ClassImp(AliITSPlaneEffSSD)
 //______________________________________________________________________
 AliITSPlaneEffSSD::AliITSPlaneEffSSD():
   AliITSPlaneEff(){
-  // Default constructor
   for (UInt_t i=0; i<kNModule; i++){
     fFound[i]=0;
     fTried[i]=0;
@@ -118,9 +117,7 @@ AliITSPlaneEff&  AliITSPlaneEffSSD::operator=(const
     // Return:
 
     if(&s == this) return *this;
-    Error("AliITSPlaneEffSSD","Not allowed to make a = with "
-          "AliITSPlaneEffSSD","Using default creater instead");
-
+    AliError("operator=: Not allowed to make a =, use default creater instead");
     return *this;
 }
 //_______________________________________________________________________
@@ -137,7 +134,7 @@ Int_t AliITSPlaneEffSSD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelE
   //   Return: the estimated n. of tracks 
   //
 if (im>=kNModule) 
- {Error("AliITSPlaneEffSSD","you asked for a non existing module");
+ {AliError("GetMissingTracksForGivenEff: you asked for a non existing module");
  return -1;}
 else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im)];
 }
@@ -147,7 +144,7 @@ Double_t  AliITSPlaneEffSSD::PlaneEff(const UInt_t im) const {
 // Inputs:
 //        im     -> module number [0,1697]
 if (im>=kNModule) 
- {Error("AliITSPlaneEffSSD","you asked for a non existing module"); return -1.;}
+ {AliError("PlaneEff(UInt_t): you asked for a non existing module"); return -1.;}
  Int_t nf=fFound[GetKey(im)];
  Int_t nt=fTried[GetKey(im)];
 return AliITSPlaneEff::PlaneEff(nf,nt);
@@ -159,7 +156,7 @@ Double_t  AliITSPlaneEffSSD::ErrPlaneEff(const UInt_t im) const {
     // Inputs:
     //        im     -> module number [0,1697]
 if (im>=kNModule) 
- {Error("AliITSPlaneEffSSD","you asked for a non existing module"); return -1.;}
+ {AliError("ErrPlaneEff(UInt_t): you asked for a non existing module"); return -1.;}
 Int_t nf=fFound[GetKey(im)];
 Int_t nt=fTried[GetKey(im)];
 return AliITSPlaneEff::ErrPlaneEff(nf,nt);
@@ -168,7 +165,7 @@ return AliITSPlaneEff::ErrPlaneEff(nf,nt);
 Bool_t AliITSPlaneEffSSD::UpDatePlaneEff(const Bool_t Kfound, const UInt_t im) {
   // Update efficiency for a basic block
 if (im>=kNModule) 
- {Error("AliITSPlaneEffSSD","you asked for a non existing module"); return kFALSE;}
+ {AliError("UpDatePlaneEff: you asked for a non existing module"); return kFALSE;}
  fTried[GetKey(im)]++;
  if(Kfound) fFound[GetKey(im)]++;
  return kTRUE;
@@ -177,21 +174,21 @@ if (im>=kNModule)
 UInt_t AliITSPlaneEffSSD::GetKey(const UInt_t mod) const {
   // get key given a basic block
 if(mod>=kNModule)
-  {Error("AliITSPlaneEffSSD::GetKey","you asked for a non existing block"); return 99999;}
+  {AliError("GetKey: you asked for a non existing block"); return 99999;}
 return mod;
 }
 //__________________________________________________________________________
 UInt_t AliITSPlaneEffSSD::GetModFromKey(const UInt_t key) const {
   // get mod. from key
 if(key>=kNModule)
-  {Error("AliITSPlaneEffSSD::GetModFromKey","you asked for a non existing key"); return 9999;}
+  {AliError("GetModFromKey: you asked for a non existing key"); return 9999;}
 return key;
 }
 //__________________________________________________________________________
 Double_t AliITSPlaneEffSSD::LivePlaneEff(UInt_t key) const {
   // returns plane efficieny after adding the fraction of sensor which is bad
 if(key>=kNModule)
-  {Error("AliITSPlaneEffSSD::LivePlaneEff","you asked for a non existing key");
+  {AliError("LivePlaneEff: you asked for a non existing key");
    return -1.;}
 Double_t leff=AliITSPlaneEff::LivePlaneEff(0); // this just for the Warning
 leff=PlaneEff(key)+GetFracBad(key);
@@ -201,7 +198,7 @@ return leff>1?1:leff;
 Double_t AliITSPlaneEffSSD::ErrLivePlaneEff(UInt_t key) const {
   // returns error on live plane efficiency
 if(key>=kNModule)
-  {Error("AliITSPlaneEffSSD::ErrLivePlaneEff","you asked for a non existing key");
+  {AliError("ErrLivePlaneEff: you asked for a non existing key");
    return -1.;}
 Int_t nf=fFound[key];
 Double_t triedInLive=GetFracLive(key)*fTried[key];
@@ -212,7 +209,7 @@ return AliITSPlaneEff::ErrPlaneEff(nf,nt); // for the time being: to be checked
 Double_t AliITSPlaneEffSSD::GetFracLive(const UInt_t key) const {
   // returns the fraction of the sensor which is OK
 if(key>=kNModule)
-  {Error("AliITSPlaneEffSSD::GetFracLive","you asked for a non existing key");
+  {AliError("GetFracLive: you asked for a non existing key");
    return -1.;}
     // Compute the fraction of bad (dead+noisy) detector 
 UInt_t bad=0;
@@ -226,12 +223,12 @@ void AliITSPlaneEffSSD::GetBadInModule(const UInt_t key, UInt_t& nrBadInMod) con
   // returns the number of dead and noisy pixels
 nrBadInMod=0;
 if(key>=kNModule)
-  {Error("AliITSPlaneEffSSD::GetDeadAndNoisyInModule","you asked for a non existing key");
+  {AliError("GetBadInModule: you asked for a non existing key");
    return;}
     // Compute the number of bad (dead+noisy) pixel in a module
 //
 if(!fInitCDBCalled) 
-  {Error("AliITSPlaneEffSSD::GetDeadAndNoisyInModule","CDB not inizialized: call InitCDB first");
+  {AliError("GetBadInModule: CDB not inizialized: call InitCDB first");
    return;};
 AliCDBManager* man = AliCDBManager::Instance();
 // retrieve map of dead Pixel 
@@ -240,10 +237,10 @@ TObjArray* ssdEntry;
 if(cdbSSD) {
   ssdEntry = (TObjArray*)cdbSSD->GetObject();
   if(!ssdEntry) 
-  {Error("AliITSPlaneEffSSD::GetDeadAndNoisyInChip"," SSDEntry not found in CDB");
+  {AliError("GetBadInChip: SSDEntry not found in CDB");
    return;}
 } else {
-  Error("AliITSPlaneEffSSD::GetDeadAndNoisyInChip","Did not find Calib/BadChannelsSSD");
+  AliError("GetBadInChip: did not find Calib/BadChannelsSSD");
   return;
 }
 //
@@ -260,7 +257,7 @@ return;
 Double_t AliITSPlaneEffSSD::GetFracBad(const UInt_t key) const {
   // returns 1-fractional live
 if(key>=kNModule)
-  {Error("AliITSPlaneEffSSD::GetFracBad","you asked for a non existing key");
+  {AliError("GetFracBad: you asked for a non existing key");
    return -1.;}
 return 1.-GetFracLive(key);
 }
@@ -268,7 +265,7 @@ return 1.-GetFracLive(key);
 Bool_t AliITSPlaneEffSSD::WriteIntoCDB() const {
 // write onto CDB
 if(!fInitCDBCalled)
-  {Error("AliITSPlaneEffSSD::WriteIntoCDB","CDB not inizialized: call InitCDB first");
+  {AliError("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
@@ -287,7 +284,7 @@ if(!fInitCDBCalled)
 Bool_t AliITSPlaneEffSSD::ReadFromCDB() {
 // read from CDB
 if(!fInitCDBCalled)
-  {Error("AliITSPlaneEffSSD::ReadFromCDB","CDB not inizialized: call InitCDB first");
+  {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first");
    return kFALSE;}
 //if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
 //    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
@@ -298,3 +295,23 @@ if(this==eff) return kFALSE;
 eff->Copy(*this);
 return kTRUE;
 }
+//_____________________________________________________________________________
+UInt_t AliITSPlaneEffSSD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet,
+                                                Float_t, Float_t) const {
+// method to locate a basic block from Detector Local coordinate (to be used in tracking)
+UInt_t key=999999;
+if(ilay<4 || ilay>5)
+  {AliError("GetKeyFromDetLocCoord: you asked for a non existing layer");
+   return key;}
+if(ilay==4 && (idet<0 || idet>747))
+ {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
+   return key;}
+if(ilay==5 && (idet<0 || idet>949))
+ {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
+   return key;}
+
+UInt_t mod=idet;
+if(ilay==1) mod+=748;
+key=GetKey(mod);
+return key;
+}
index 4eba70b425ea79c5f86b72b96f7758d8fa058d9a..91a97afe0d3be86c2e7097342e203741734c211f 100644 (file)
@@ -50,6 +50,11 @@ class AliITSPlaneEffSSD :  public AliITSPlaneEff {
     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;}
+   // method to locate a basic block from Detector Local coordinate (to be used in tracking)
+   // see file cxx for numbering convention.
+   // here idet runs from 0 to 747 for layer 4 and from 0 to 949 for layer 5
+    UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t, Float_t locz) const;
+    UInt_t Nblock() const; // return the number of basic blocks
 
  protected:
     virtual void Copy(TObject &obj) const;
@@ -66,5 +71,8 @@ class AliITSPlaneEffSSD :  public AliITSPlaneEff {
 
     ClassDef(AliITSPlaneEffSSD,1) // SSD Plane Efficiency class
 };
+//
+inline UInt_t AliITSPlaneEffSSD::Nblock() const {return kNModule;}
+//
 #endif
 
index 7756b16b118605fff66ab220baac5944729914c4..15997d22599b7daee7618b07ec468576274bef53 100644 (file)
 #include "AliTrackPointArray.h"
 #include "AliAlignObj.h"
 #include "AliITSClusterParam.h"
-#include "AliITSPlaneEff.h"
 #include "AliCDBManager.h"
 #include "AliCDBEntry.h"
 #include "AliITSCalibrationSPD.h"
 #include "AliITSCalibrationSDD.h"
 #include "AliITSCalibrationSSD.h"
+#include "AliITSPlaneEff.h"
+#include "AliITSPlaneEffSPD.h"
+#include "AliITSPlaneEffSDD.h"
+#include "AliITSPlaneEffSSD.h"
 #include "AliITStrackerMI.h"
 
 ClassImp(AliITStrackerMI)
@@ -205,6 +208,19 @@ fPlaneEff(0) {
   
   fDebugStreamer = new TTreeSRedirector("ITSdebug.root");
 
+  // only for plane efficiency evaluation
+  if (AliITSReconstructor::GetRecoParam()->GetComputePlaneEff()) {
+    for(Int_t ilay=0;ilay<6;ilay++) { 
+      if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(ilay)) {
+        if (ilay<2) fPlaneEff = new AliITSPlaneEffSPD();
+        else if (ilay<4) fPlaneEff = new AliITSPlaneEffSDD();
+        else fPlaneEff = new AliITSPlaneEffSSD();
+        break; // only one layer type to skip at once
+      }
+    }
+    if(!fPlaneEff->ReadFromCDB()) 
+      {AliWarning("AliITStrackerMI reading of AliITSPlaneEff from OCDB failed") ;}
+  }
 }
 //------------------------------------------------------------------------
 AliITStrackerMI::AliITStrackerMI(const AliITStrackerMI &tracker):AliTracker(tracker),
@@ -632,7 +648,8 @@ Int_t AliITStrackerMI::RefitInward(AliESDEvent *event) {
       fTrackToFollow.ResetCovariance(10.);
 
     //Refitting...
-    if (RefitAt(AliITSRecoParam::GetrInsideSPD1(),&fTrackToFollow,t,kTRUE)) {
+    Bool_t pe=AliITSReconstructor::GetRecoParam()->GetComputePlaneEff();
+    if (RefitAt(AliITSRecoParam::GetrInsideSPD1(),&fTrackToFollow,t,kTRUE,pe)) {
        fTrackToFollow.SetLabel(t->GetLabel());
        //       fTrackToFollow.CookdEdx();
        CookdEdx(&fTrackToFollow);
@@ -1890,13 +1907,15 @@ Int_t AliITStrackerMI::AliITSlayer::InRoad() const {
 }
 //------------------------------------------------------------------------
 Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
-                               const AliITStrackMI *clusters,Bool_t extra) 
+                               const AliITStrackMI *clusters,Bool_t extra, Bool_t planeeff
 {
   //--------------------------------------------------------------------
   // This function refits the track "track" at the position "x" using
   // the clusters from "clusters"
   // If "extra"==kTRUE, 
   //    the clusters from overlapped modules get attached to "track" 
+  // If "planeff"==kTRUE,
+  //    special approach for plane efficiency evaluation is applyed
   //--------------------------------------------------------------------
 
   Int_t index[AliITSgeomTGeo::kNLayers];
@@ -1909,17 +1928,19 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
     index[ilayer]=idx; 
   }
 
-  return RefitAt(xx,track,index,extra); // call the method below
+  return RefitAt(xx,track,index,extra,planeeff); // call the method below
 }
 //------------------------------------------------------------------------
 Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
-                               const Int_t *clusters,Bool_t extra) 
+                               const Int_t *clusters,Bool_t extra, Bool_t planeeff
 {
   //--------------------------------------------------------------------
   // This function refits the track "track" at the position "x" using
   // the clusters from array
   // If "extra"==kTRUE, 
   //    the clusters from overlapped modules get attached to "track" 
+  // If "planeff"==kTRUE,
+  //    special approach for plane efficiency evaluation is applyed
   //--------------------------------------------------------------------
   Int_t index[AliITSgeomTGeo::kNLayers];
   Int_t k;
@@ -2032,12 +2053,16 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
           maxchi2=chi2; 
           modstatus = 1; // found
         } else {
-          return kFALSE;
+           return kFALSE; //
         }
        }
      } else { // no cluster in this layer
        if (skip==1) {
         modstatus = 3; // skipped
+         if (planeeff) {  // Plane Eff determination: 
+           if (IsOKForPlaneEff(track,ilayer))  // only adequate track for plane eff. evaluation
+              UseTrackForPlaneEff(track,ilayer); 
+         }
        } else {
         modstatus = 5; // no cls in road
         // check dead
@@ -4901,3 +4926,133 @@ Bool_t AliITStrackerMI::LocalModuleCoord(Int_t ilayer,Int_t idet,
   return kTRUE;
 }
 //------------------------------------------------------------------------
+Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) const {
+// Method still to be implemented: 
+//
+// it will apply a pre-selection to obtain good quality tracks.  
+// Here also  you will have the possibility to put a control on the 
+// impact point of the track on the basic block, in order to exclude border regions 
+// this will be done by calling a proper method of the AliITSPlaneEff class.  
+//
+// input: AliITStrackMI* track, ilayer= layer number [0,5]
+// output: Bool_t   -> kTRUE if usable track, kFALSE if not usable. 
+return kTRUE;
+}
+//------------------------------------------------------------------------
+void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
+//
+// This Method has to be optimized! For the time-being it uses the same criteria
+// as those used in the search of extra clusters for overlapping modules.
+//
+// Method Purpose: estabilish whether a track has produced a recpoint or not
+//                 in the layer under study (For Plane efficiency)
+//
+// inputs: AliITStrackMI* track  (pointer to a usable track)
+// outputs: none
+// side effects: update (by 1 count) the Plane Efficiency statistics of the basic block
+//               traversed by this very track. In details:
+//               - if a cluster can be associated to the track then call
+//                  AliITSPlaneEff::UpDatePlaneEff(key,kTRUE);
+//               - if not, the AliITSPlaneEff::UpDatePlaneEff(key,kFALSE) is called
+//
+  AliITSlayer &layer=fgLayers[ilayer];
+  Double_t r=layer.GetR();
+  //AliITStrackV2 tmp(*track);
+  AliITStrackMI tmp(*track);
+
+// detector number
+  Double_t phi,z;
+  if (!tmp.GetPhiZat(r,phi,z)) return;
+  Int_t idet=layer.FindDetectorIndex(phi,z);
+
+  if(idet<0) return;
+
+  Double_t trackGlobXYZ1[3];
+  tmp.GetXYZ(trackGlobXYZ1);
+
+// Get the budget to the primary vertex for the current track being prolonged
+  Double_t budgetToPrimVertex = GetEffectiveThickness();
+
+//propagate to the intersection with the detector plane
+  const AliITSdetector &det=layer.GetDetector(idet);
+  if (!tmp.Propagate(det.GetPhi(),det.GetR())) return;
+  
+  //Float_t xloc,zloc;
+
+//***************
+// DEFINITION OF SEARCH ROAD FOR CLUSTERS SELECTION
+//
+  Double_t dz=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadZ()*
+                    TMath::Sqrt(tmp.GetSigmaZ2() +
+                    AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
+                    AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
+                    AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer));
+  Double_t dy=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadY()*
+                    TMath::Sqrt(tmp.GetSigmaY2() +
+                    AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
+                    AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
+                    AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer));
+
+// road in global (rphi,z) [i.e. in tracking ref. system]
+  Double_t zmin = tmp.GetZ() - dz;
+  Double_t zmax = tmp.GetZ() + dz;
+  Double_t ymin = tmp.GetY() + r*det.GetPhi() - dy;
+  Double_t ymax = tmp.GetY() + r*det.GetPhi() + dy;
+
+// select clusters in road
+  layer.SelectClusters(zmin,zmax,ymin,ymax);
+
+// Define criteria for track-cluster association
+  Double_t msz = tmp.GetSigmaZ2() +
+  AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
+  AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
+  AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer);
+  Double_t msy = tmp.GetSigmaY2() +
+  AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
+  AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
+  AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer);
+ // if (constrain) {
+    msz *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadZC();
+    msy *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadYC();
+ // }  else {
+ //   msz *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadZNonC();
+ //   msy *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadYNonC();
+ // }
+  msz = 1./msz; // 1/RoadZ^2
+  msy = 1./msy; // 1/RoadY^2
+//
+
+  const AliITSRecPoint *cl=0; Int_t clidx=-1, ci=-1;
+  Int_t idetc=-1;
+  Double_t maxchi2=1000.*AliITSReconstructor::GetRecoParam()->GetMaxChi2(), tolerance=0.1;
+  while ((cl=layer.GetNextCluster(clidx))!=0) {
+    idetc = cl->GetDetectorIndex();
+    if(idet!=idetc) continue;
+    //Int_t ilay = cl->GetLayer();
+
+    if (TMath::Abs(tmp.GetZ() - cl->GetZ()) > tolerance) continue;
+    if (TMath::Abs(tmp.GetY() - cl->GetY()) > tolerance) continue;
+
+    Double_t chi2=tmp.GetPredictedChi2(cl);
+    if (chi2<maxchi2) { maxchi2=chi2; ci=clidx; }
+  }
+  Float_t locx; // to be changed (if no cluster)
+  Float_t locz; // to be changed (if no cluster)
+  LocalModuleCoord(ilayer,idet,&tmp,locx,locz);
+//
+  AliDebug(2,Form("ilayer= %d, idet=%d, x= %f, z=%f",ilayer,idet,locx,locz));
+  UInt_t key=fPlaneEff->GetKeyFromDetLocCoord(ilayer,idet,locx,locz);
+  if(key>fPlaneEff->Nblock()) return;
+  Bool_t found=kFALSE;
+  if (ci>=0) {
+    cl=layer.GetCluster(ci);
+    // here real control to see whether the cluster can be associated to the track.  
+    // if() ....
+    found=kTRUE;
+   // track->SetExtraCluster(ilayer,(ilayer<<28)+ci);
+   // track->SetExtraModule(ilayer,idetExtra);
+  }
+  if(!fPlaneEff->UpDatePlaneEff(found,key))
+       AliError(Form("UseTrackForPlaneEff: cannot UpDate PlaneEff for key=%d",key));
+return;
+}
index 33dbc3703f8719e7c87cc43173076dec737f76b3..db9e904f4b36ef9b949235f00abd569a7be0e76a 100644 (file)
@@ -19,6 +19,7 @@ class AliESDEvent;
 #include "AliITSRecPoint.h"
 #include "AliITStrackMI.h"
 #include "AliITSPlaneEff.h"
+#include "AliPlaneEff.h"
 #include "AliTracker.h"
 
 //-------------------------------------------------------------------------
@@ -41,9 +42,9 @@ public:
   Int_t PropagateBack(AliESDEvent *event);
   Int_t RefitInward(AliESDEvent *event);
   Bool_t RefitAt(Double_t x, AliITStrackMI *track, 
-                const AliITStrackMI *clusters, Bool_t extra=kFALSE);
+                const AliITStrackMI *clusters, Bool_t extra=kFALSE, Bool_t planeeff=kFALSE);
   Bool_t RefitAt(Double_t x, AliITStrackMI *track, 
-                const Int_t *clusters, Bool_t extra=kFALSE);
+                const Int_t *clusters, Bool_t extra=kFALSE, Bool_t planeeff=kFALSE);
   void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
   void SetupSecondPass(Int_t *flags, Double_t *cuts=0);
 
@@ -54,6 +55,7 @@ public:
   void  GetDCASigma(AliITStrackMI* track, Float_t & sigmarfi, Float_t &sigmaz);
   Double_t GetPredictedChi2MI(AliITStrackMI* track, const AliITSRecPoint *cluster,Int_t layer);
   Int_t UpdateMI(AliITStrackMI* track, const AliITSRecPoint* cl,Double_t chi2,Int_t layer) const;
+  AliPlaneEff *GetPlaneEff() {return (AliPlaneEff*)fPlaneEff;}   // return the pointer to AliPlaneEff
   class AliITSdetector { 
   public:
     AliITSdetector():fR(0),fPhi(0),fSinPhi(0),fCosPhi(0),fYmin(0),fYmax(0),fZmin(0),fZmax(0){}
@@ -225,6 +227,11 @@ protected:
   Int_t CheckDeadZone(/*AliITStrackMI *track,*/Int_t ilayer,Int_t idet,Double_t zmin,Double_t zmax/*,Double_t ymin,Double_t ymax*/) const;
   Bool_t LocalModuleCoord(Int_t ilayer,Int_t idet,AliITStrackMI *track,
                          Float_t &xloc,Float_t &zloc) const;
+// method to be used for Plane Efficiency evaluation
+  Bool_t IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) const; // Check if a track is usable 
+                                                                    // for Plane Eff evaluation
+  void UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer);     // Use this track for Plane Eff 
+// 
   Int_t fI;                              // index of the current layer
   static AliITSlayer fgLayers[AliITSgeomTGeo::kNLayers];// ITS layers
   AliITStrackMI fTracks[AliITSgeomTGeo::kNLayers];      // track estimations at the ITS layers
index a0053af12f02504a03979174f5a580abe94dc2d9..60ab1b7ff9b54f82acaf8b4c797b7f7d3e81c721 100644 (file)
@@ -1,3 +1,12 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TRandom3.h>
+#include "AliCDBManager.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBStorage.h"
+#include "AliCDBRunRange.h"
+#include "AliCDBId.h"
+#include "AliITSPlaneEffSDD.h"
+#endif
 void MakeITSPlaneEfficiencySDD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::Infinity()){
   
   if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
@@ -8,11 +17,12 @@ void MakeITSPlaneEfficiencySDD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::In
   md1->SetObjectClassName("AliITSPlaneEff");
   md1->SetResponsible("Giuseppe Bruno");
   md1->SetBeamPeriod(0);
-  md1->SetAliRootVersion("head 02/01/08"); //root version
+  md1->SetAliRootVersion("head 16/01/08"); //root version
 
   AliCDBId idplaneeffSDD("ITS/PlaneEff/PlaneEffSDD",firstRun, lastRun);
   
   AliITSPlaneEffSDD* planeeffSDD = new AliITSPlaneEffSDD();
+  TRandom3 *gran = new TRandom3();
 
 //  planeeffSDD->SetOwner(kFALSE);
   
@@ -27,10 +37,14 @@ void MakeITSPlaneEfficiencySDD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::In
   // suppose to have 1000 tracks in each block and an average efficiency of 99%
     for(Int_t j=0; j<1000; j++) {
       BFound=kFALSE;
-      if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
+      //if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
+      if (1000*gran->Uniform()>10) BFound=kTRUE;
       planeeffSDD->UpDatePlaneEff(BFound,mod,chip,wing,subw);
     }
   }}}}
   if(AliCDBManager::Instance()->GetDefaultStorage()->Put(planeeffSDD, idplaneeffSDD, md1))
-  {cout << "Riuscito " << endl;}
+  printf("Local CDB file with random SDD plane efficiencies written \n");
+  delete gran;
+  delete planeeffSDD;
+  delete md1;
 }
index 9508d097bf8bed8db58318ba286951b700934caf..68d21cc4d01a39f8432271a0063290c813598b59 100644 (file)
@@ -1,5 +1,19 @@
-void MakeITSPlaneEfficiencySPD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::Infinity()){
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TRandom3.h>
+#include "AliCDBManager.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBStorage.h"
+#include "AliCDBRunRange.h"
+#include "AliCDBId.h"
+#include "AliITSPlaneEffSPD.h"
+#endif
+
+void MakeITSPlaneEfficiencySPD(Int_t firstRun=0, Int_t lastRun=AliCDBRunRange::Infinity(), 
+ Double_t eff=0.99, Int_t nTried=1000){
   
+  if(eff<0 || eff > 1) {
+   printf("Efficiency must be in the range [0,1]: nothing done");
+  }
   if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
     AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
   }
@@ -8,27 +22,37 @@ void MakeITSPlaneEfficiencySPD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::In
   md1->SetObjectClassName("AliITSPlaneEff");
   md1->SetResponsible("Giuseppe Bruno");
   md1->SetBeamPeriod(0);
-  md1->SetAliRootVersion("head 19/11/07"); //root version
+  md1->SetAliRootVersion("head 16/02/08"); //root version
 
   AliCDBId idplaneeffSPD("ITS/PlaneEff/PlaneEffSPD",firstRun, lastRun);
   
   AliITSPlaneEffSPD* planeeffSPD = new AliITSPlaneEffSPD();
+  TRandom3 *gran = new TRandom3();
 
 //  planeeffSPD->SetOwner(kFALSE);
   
-
+//  Int_t nTried=1000;
+  Double_t limit=nTried;
+  limit*=(1-eff);
+  printf("limit = %f",limit);
   // 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++){
+  for(UInt_t key=0;key<planeeffSPD->Nblock();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++) {
+    for(Int_t j=0; j<nTried; j++) {
       BFound=kFALSE;
-      if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
-      planeeffSPD->UpDatePlaneEff(BFound,mod,chip);
+      //if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
+      if (nTried*gran->Uniform()>limit) BFound=kTRUE;
+      //planeeffSPD->UpDatePlaneEff(BFound,mod,chip);
+      planeeffSPD->UpDatePlaneEff(BFound,key);
     }
-  }}
+  //}}
+  }
   if(AliCDBManager::Instance()->GetDefaultStorage()->Put(planeeffSPD, idplaneeffSPD, md1))
-  {cout << "Riuscito " << endl;}
-}
\ No newline at end of file
+  printf("Local CDB file with random SPD plane efficiencies written \n");
+ delete gran;
+ delete planeeffSPD;
+ delete md1;
+}
index a992aadb67f8481ee695285491744717a71eb00a..6ec4f965688d95eeae6156081f95851077fd65b8 100644 (file)
@@ -1,3 +1,13 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TRandom3.h>
+#include "AliCDBManager.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBStorage.h"
+#include "AliCDBRunRange.h"
+#include "AliCDBId.h"
+#include "AliITSPlaneEffSSD.h"
+#endif
+
 void MakeITSPlaneEfficiencySSD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::Infinity()){
   
   if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
@@ -13,6 +23,7 @@ void MakeITSPlaneEfficiencySSD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::In
   AliCDBId idplaneeffSSD("ITS/PlaneEff/PlaneEffSSD",firstRun, lastRun);
   
   AliITSPlaneEffSSD* planeeffSSD = new AliITSPlaneEffSSD();
+  TRandom3 *gran = new TRandom3();
 
 //  planeeffSSD->SetOwner(kFALSE);
 
@@ -22,10 +33,14 @@ void MakeITSPlaneEfficiencySSD(Int_t firstRun=0,Int_t lastRun=AliCDBRunRange::In
   // suppose to have 1000 tracks in each module and an average efficiency of 99%
     for(Int_t j=0; j<1000; j++) {
       BFound=kFALSE;
-      if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
+      //if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
+      if (1000*gran->Uniform()>10) BFound=kTRUE;
       planeeffSSD->UpDatePlaneEff(BFound,mod);
     }
   }
   if(AliCDBManager::Instance()->GetDefaultStorage()->Put(planeeffSSD, idplaneeffSSD, md1))
-  {cout << "Riuscito " << endl;}
+  printf("Local CDB file with random SSD plane efficiencies written \n");
+ delete gran;
+ delete planeeffSSD;
+ delete md1;
 }
index 67ca24464f541488da2a3f8c695344f3a6a0a587..193eee2c8c042fba443bce8ae7b8e4ba37fb08d5 100644 (file)
Binary files a/ITS/PlaneEff/PlaneEffSDD/Run0_999999999_v0_s0.root and b/ITS/PlaneEff/PlaneEffSDD/Run0_999999999_v0_s0.root differ
index e2ef344707ff8fd6d55f87b30dbc4a7826504c44..8171e984bc422f93c491edd7a159e1f631f3002c 100644 (file)
Binary files a/ITS/PlaneEff/PlaneEffSPD/Run0_999999999_v0_s0.root and b/ITS/PlaneEff/PlaneEffSPD/Run0_999999999_v0_s0.root differ
index 7d5e6ac3068b531b5bbcb5283ae6e90d1c431800..c56973f3657187b4ec2d5eb31cd68a44aa76a5f7 100644 (file)
Binary files a/ITS/PlaneEff/PlaneEffSSD/Run0_999999999_v0_s0.root and b/ITS/PlaneEff/PlaneEffSSD/Run0_999999999_v0_s0.root differ
diff --git a/STEER/AliPlaneEff.cxx b/STEER/AliPlaneEff.cxx
new file mode 100644 (file)
index 0000000..3fd1d08
--- /dev/null
@@ -0,0 +1,89 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+///////////////////////////////////////////////////////////////////////////
+//  Virtual base Plane Efficiency class           
+//  Specific detector implementation is done in  
+//  AliITSPlaneEff                           
+//  AliTRDPlaneEff                               
+//  AliTOFPlaneEff                               
+//
+//  Author: G.E. Bruno 
+//          giuseppe.bruno@ba.infn.it
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+#include <TMath.h>
+#include "AliPlaneEff.h"
+#include "AliLog.h"
+//#include "AliCDBManager.h"
+//#include "AliCDBStorage.h"
+
+ClassImp(AliPlaneEff)
+//______________________________________________________________________
+AliPlaneEff::AliPlaneEff(): TObject()/*,
+fRunNumber(0), 
+fCDBUri(""),
+fInitCDBCalled(kFALSE)*/
+{
+    // Default constructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    a default constructed AliPlaneEff class
+ //InitCDB();
+}
+//______________________________________________________________________
+AliPlaneEff::AliPlaneEff(const AliPlaneEff &s) : TObject(s)/*,
+fRunNumber(s.fRunNumber),
+fCDBUri(s.fCDBUri),
+fInitCDBCalled(s.fInitCDBCalled)*/
+{
+    //     Copy Constructor
+    // Inputs:
+    //    const AliPlaneEff &s  simulation class to copy from
+    // Outputs:
+    //    none.
+    // Return:
+    //    a standard constructed AliPlaneEff class with values the same
+    //    as that of s.
+
+}
+//_________________________________________________________________________
+AliPlaneEff&  AliPlaneEff::operator=(const AliPlaneEff &source){
+    //    Assignment operator
+    // Inputs:
+    //    const AliPlaneEff &source  simulation class to copy from
+    // Outputs:
+    //    none.
+    // Return:
+    //    a standard constructed AliPlaneEff class with values the same
+    //    as that of s.
+    if(this != &source){
+       source.Copy(*this);
+    }
+    return *this;
+}
+//_____________________________________________________________
+void AliPlaneEff::Copy(TObject &obj) const {
+  // copy this to obj
+/*  ((AliPlaneEff& ) obj).fRunNumber           = fRunNumber;
+  ((AliPlaneEff& ) obj).fCDBUri                = fCDBUri;
+  ((AliPlaneEff& ) obj).fInitCDBCalled = fInitCDBCalled;
+*/
+}
+//_________________________________________________________________________
diff --git a/STEER/AliPlaneEff.h b/STEER/AliPlaneEff.h
new file mode 100644 (file)
index 0000000..fe5187e
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef ALIPLANEEFF_H
+#define ALIPLANEEFF_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 Alisegmentation;
+//class Aligeom;
+
+////////////////////////////////////////////////////
+//                                                //
+// Virtual base class for Plane Efficiency        //
+// Origin: Giuseppe.Bruno@ba.infn.it              //
+//                                                //
+////////////////////////////////////////////////////
+
+class AliPlaneEff : public TObject {
+ public:
+    AliPlaneEff();// Default constructor
+    virtual ~AliPlaneEff(){;}; 
+    // copy constructor. See detector specific implementation.
+    AliPlaneEff(const AliPlaneEff &source);
+    // Assignment operator. See detector specific implementation.
+    AliPlaneEff& operator=(const AliPlaneEff &source);
+    // Average Plane efficiency (including dead/noisy)
+    //Int_t   GetRunNumber() const {return fRunNumber;}
+    //void    SetRunNumber(Int_t n) {fRunNumber=n;}
+    //
+    // 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:
+
+    virtual void InitCDB(){;};
+    virtual void Copy(TObject &obj) const;
+    //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    fRunNumber;     // run number (to access CDB)
+
+    ClassDef(AliPlaneEff,1) // Plane Efficiency virtual base class 
+};
+#endif
index 77df274d9751d5dd711c448dee5d7714e30cbfd6..8c98ad405f53336c3133d265872a3698292e0d7c 100644 (file)
 #include "AliQA.h"
 #include "AliQADataMakerSteer.h"
 
+#include "AliPlaneEff.h"
+
 #include "AliSysInfo.h" // memory snapshots
 
 
@@ -251,7 +253,9 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename,
   fSetRunNumberFromDataCalled(kFALSE),
   fRunQA(kTRUE),  
   fRunGlobalQA(kFALSE),
-  fInLoopQA(kFALSE)
+  fInLoopQA(kFALSE),
+
+  fRunPlaneEff(kFALSE)
 {
 // create reconstruction object with default parameters
   
@@ -320,7 +324,8 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled),
   fRunQA(rec.fRunQA),  
   fRunGlobalQA(rec.fRunGlobalQA),
-  fInLoopQA(rec.fInLoopQA)
+  fInLoopQA(rec.fInLoopQA),
+  fRunPlaneEff(rec.fRunPlaneEff)
 {
 // copy constructor
 
@@ -780,6 +785,10 @@ Bool_t AliReconstruction::Run(const char* input, Bool_t IsOnline)
      }
   }
 
+  //Initialize the Plane Efficiency framework
+  if (fRunPlaneEff && !InitPlaneEff()) {
+    if(fStopOnError) {CleanUp(file, fileOld); return kFALSE;}
+  }
 
   //******* The loop over events
   for (Int_t iEvent = 0; iEvent < fRunLoader->GetNumberOfEvents(); iEvent++) {
@@ -1056,6 +1065,14 @@ Bool_t AliReconstruction::Run(const char* input, Bool_t IsOnline)
     esdFile->Close();
   }
 
+// Finish with Plane Efficiency evaluation
+  if (fRunPlaneEff && !FinishPlaneEff()) {
+   AliWarning("Finish PlaneEff evaluation failed");
+  }
+
+  gROOT->cd();
+  CleanUp(file, fileOld);
+    
   // Create tags for the events in the ESD tree (the ESD tree is always present)
   // In case of empty events the tags will contain dummy values
   AliESDTagCreator *esdtagCreator = new AliESDTagCreator();
@@ -3046,3 +3063,42 @@ Int_t AliReconstruction::GetDetIndex(const char* detector)
   }    
   return index ; 
 }
+//_____________________________________________________________________________
+Bool_t AliReconstruction::FinishPlaneEff() {
+ //
+ // Here execute all the necessary operationis, at the end of the tracking phase,
+ // in case that evaluation of PlaneEfficiencies was required for some detector. 
+ // E.g., write into a DataBase file the PlaneEfficiency which have been evaluated. 
+ //
+ // This Preliminary version works only FOR ITS !!!!!
+ // other detectors (TOF,TRD, etc. have to develop their specific codes)
+ //
+ //  Input: none
+ //  Return: kTRUE if all operations have been done properly, kFALSE otherwise 
+ //
+ Bool_t ret=kFALSE;
+ //for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
+ for (Int_t iDet = 0; iDet < 1; iDet++) { // for the time being only ITS  
+   //if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
+   //if(fReconstructor[iDet]->GetRecoParam()->GetComputePlaneEff()) continue;
+   ret=fTracker[iDet]->GetPlaneEff()->WriteIntoCDB();
+ }
+ return ret;
+}
+//_____________________________________________________________________________
+Bool_t AliReconstruction::InitPlaneEff() {
+//
+ // Here execute all the necessary operations, before of the tracking phase,
+ // for the evaluation of PlaneEfficiencies, in case required for some detectors.
+ // E.g., read from a DataBase file a first evaluation of the PlaneEfficiency 
+ // which should be updated/recalculated.
+ //
+ // This Preliminary version will work only FOR ITS !!!!!
+ // other detectors (TOF,TRD, etc. have to develop their specific codes)
+ //
+ //  Input: none
+ //  Return: kTRUE if all operations have been done properly, kFALSE otherwise
+ //
+ AliWarning(Form("Implementation of this method not yet done !! Method return kTRUE"));
+ return kTRUE;
+}
index 047eb24b89858da108dc9df870f6384eb137a948..aa6b015738b439229b59369057ef05320596d9a0 100644 (file)
@@ -119,6 +119,9 @@ public:
   void    SetRunGlobalQA(Bool_t flag=kTRUE){fRunGlobalQA = flag;}
   void    SetInLoopQA(Bool_t flag=kTRUE)   {fInLoopQA    = flag;} 
 
+  // Plane Efficiency Evaluation
+  void    SetRunPlaneEff(Bool_t flag=kFALSE)  {fRunPlaneEff = flag;}
+
 private:
   void                  InitCDB();
   void                  SetCDBLock();
@@ -155,6 +158,10 @@ private:
   const Int_t          GetQACycles(const char * detector) { return fQACycles[GetDetIndex(detector)] ; }
   void                 CheckQA() ;
 
+  // Plane Efficiency evaluation
+  Bool_t  FinishPlaneEff(); //ultimate tasks related to Plane Eff. evaluation 
+  Bool_t  InitPlaneEff();   // initialize what is needed for Plane Eff. evaluation
+
   //*** Global reconstruction flags *******************
   Bool_t         fUniformField;       // uniform field tracking flag
   Bool_t         fRunVertexFinder;    // run the vertex finder
@@ -219,6 +226,8 @@ private:
   Bool_t             fRunQA ;        // Run QA flag
   Bool_t             fRunGlobalQA;   // Run global QA flag
   Bool_t             fInLoopQA;      // In-loop QA flag
+  // Plane Efficiency Evaluation
+  Bool_t         fRunPlaneEff ;      // Evaluate Plane Efficiency
 
   ClassDef(AliReconstruction, 19)      // class for running the reconstruction
 };
index 5c32f706e389a50466893eefbdaeb00e0429ab5d..a8cfb738f1506bf97002f3ca1bf3e8fe7ade64db 100644 (file)
@@ -11,6 +11,7 @@
 //       Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
 //-------------------------------------------------------------------------
 #include <TObject.h>
+#include <AliPlaneEff.h>
 
 class TTree;
 class AliMagF;
@@ -38,6 +39,7 @@ public:
   virtual Int_t LoadClusters(TTree *)=0;
   virtual void UnloadClusters()=0;
   virtual AliCluster *GetCluster(Int_t index) const=0;
+  virtual AliPlaneEff *GetPlaneEff() {return NULL;}
   virtual Bool_t GetTrackPoint(Int_t /* index */ , AliTrackPoint& /* p */) const { return kFALSE;}
   virtual Bool_t GetTrackPointTrackingError(Int_t /* index */, 
           AliTrackPoint& /* p */, const AliESDtrack* /* t */) { return kFALSE;}
index 3068c209c658cb874473db831283cabed61c4eef..9ee73a3f2b3f038671c3dd4cd4e7f2a36e654615 100644 (file)
 #pragma link C++ class AliSurveyObj+;
 #pragma link C++ class AliSurveyPoint+;
 
+#pragma link C++ class AliCodeTimer+;
+#pragma link C++ class AliCodeTimer::AliPair+;
+
 #pragma link C++ class AliFstream+;
 #pragma link C++ class AliCTPRawData+;
 
 
 #pragma link C++ class AliDetectorRecoParam+;
 #pragma link C++ class AliRecoParam+;
+#pragma link C++ class AliPlaneEff+;
 
 #endif
index 950d36fc2f0969648b7e09172fb68f2d9de98000..a7c227dabea3bf4caf9e7f706bfc444a55078008 100644 (file)
@@ -45,6 +45,7 @@ AliHelix.cxx AliV0.cxx AliKink.cxx \
 AliSelectorRL.cxx \
 AliMagFMapsV1.cxx \
 AliSurveyObj.cxx AliSurveyPoint.cxx \
+AliCodeTimer.cxx \
 AliFstream.cxx \
 AliCTPRawData.cxx \
 AliQADataMaker.cxx \
@@ -56,8 +57,8 @@ AliQAChecker.cxx \
 AliQACheckerBase.cxx \
 AliMillepede.cxx \
 AliRecoParam.cxx \
-AliDetectorRecoParam.cxx 
-
+AliDetectorRecoParam.cxx \
+AliPlaneEff.cxx
 
 
 HDRS:= $(SRCS:.cxx=.h)