]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Upgrades to allow the study of the SPD Fast OR efficiency (V. Altini)
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 May 2011 07:16:55 +0000 (07:16 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 May 2011 07:16:55 +0000 (07:16 +0000)
ITS/AliITSPlaneEffSPD.cxx
ITS/AliITSPlaneEffSPD.h
ITS/AliITStrackerMI.cxx
ITS/AliITStrackerMI.h

index c453b8ddd3048ef2f49b1f94b8f3453211716afe..eeb6637ac85c9bcb3a2f1201cc6b99d8262d3197 100644 (file)
@@ -57,14 +57,18 @@ AliITSPlaneEffSPD::AliITSPlaneEffSPD():
   fHisTrackErrX(0),
   fHisTrackErrZ(0),
   fHisClusErrX(0),
-  fHisClusErrZ(0){
-  for (UInt_t i=0; i<kNModule*kNChip; i++){
-  //  
-  // default constructor
-  //
+  fHisClusErrZ(0),
+  fHisTrackXFOtrue(0),
+  fHisTrackZFOtrue(0),
+  fHisTrackXFOfalse(0),
+  fHisTrackZFOfalse(0),
+  fHisTrackXZFOtrue(0),
+  fHisTrackXZFOfalse(0){
+  for (UInt_t i=0; i<kNModule*kNChip*(kNClockPhase+1); i++){
     fFound[i]=0;
     fTried[i]=0;
   }
+  // default constructor
   AliDebug(1,Form("Calling default constructor"));
 }
 //______________________________________________________________________
@@ -96,7 +100,13 @@ fProfResZvsDipclu(0),
 fHisTrackErrX(0),
 fHisTrackErrZ(0),
 fHisClusErrX(0),
-fHisClusErrZ(0)
+fHisClusErrZ(0),
+fHisTrackXFOtrue(0),
+fHisTrackZFOtrue(0),
+fHisTrackXFOfalse(0),
+fHisTrackZFOfalse(0),
+fHisTrackXZFOtrue(0),
+fHisTrackXZFOfalse(0)
 {
     //     Copy Constructor
     // Inputs:
@@ -106,7 +116,7 @@ fHisClusErrZ(0)
     //    none.
     // Return:
 
- for (UInt_t i=0; i<kNModule*kNChip; i++){
+ for (UInt_t i=0; i<kNModule*kNChip*(kNClockPhase+1); i++){
     fFound[i]=s.fFound[i];
     fTried[i]=s.fTried[i];
  }
@@ -133,6 +143,14 @@ fHisClusErrZ(0)
       s.fHisTrackErrZ[i]->Copy(*fHisTrackErrZ[i]);
       s.fHisClusErrX[i]->Copy(*fHisClusErrX[i]);
       s.fHisClusErrZ[i]->Copy(*fHisClusErrZ[i]);
+      for(Int_t phas=0; phas<kNClockPhase;phas++){
+        s.fHisTrackXFOtrue[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]);
+        s.fHisTrackZFOtrue[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]);
+        s.fHisTrackXFOfalse[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]);
+        s.fHisTrackZFOfalse[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]);
+        s.fHisTrackXZFOtrue[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]);
+        s.fHisTrackXZFOfalse[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]);
+      }
    }
  }
 }
@@ -145,7 +163,7 @@ AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator+=(const AliITSPlaneEffSPD &add){
     //    none.
     // Return:
     //    none
-    for (UInt_t i=0; i<kNModule*kNChip; i++){
+    for (UInt_t i=0; i<kNModule*kNChip*(kNClockPhase+1); i++){
       fFound[i] += add.fFound[i];
       fTried[i] += add.fTried[i];
     }
@@ -171,6 +189,14 @@ AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator+=(const AliITSPlaneEffSPD &add){
         fHisTrackErrZ[i]->Add(add.fHisTrackErrZ[i]);
         fHisClusErrX[i]->Add(add.fHisClusErrX[i]);
         fHisClusErrZ[i]->Add(add.fHisClusErrZ[i]);
+        for(Int_t phas=0; phas<kNClockPhase;phas++){
+          fHisTrackXFOtrue[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]);
+          fHisTrackZFOtrue[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]);
+          fHisTrackXFOfalse[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]);
+          fHisTrackZFOfalse[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]);
+          fHisTrackXZFOtrue[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]);
+          fHisTrackXZFOfalse[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]);
+        }
       }
     }
     return *this;
@@ -195,7 +221,7 @@ void AliITSPlaneEffSPD::Copy(TObject &obj) const {
   // protected method. copy this to obj
   AliITSPlaneEff::Copy(obj);
   AliITSPlaneEffSPD& target = (AliITSPlaneEffSPD &) obj;
-  for(Int_t i=0;i<kNModule*kNChip;i++) {
+  for(Int_t i=0;i<kNModule*kNChip*(kNClockPhase+1);i++) {
       target.fFound[i] = fFound[i];
       target.fTried[i] = fTried[i];
   }
@@ -223,6 +249,12 @@ void AliITSPlaneEffSPD::CopyHistos(AliITSPlaneEffSPD &target) const {
     target.fHisTrackErrZ=new TH1F*[kNHisto];
     target.fHisClusErrX=new TH1F*[kNHisto];
     target.fHisClusErrZ=new TH1F*[kNHisto];
+    target.fHisTrackXFOtrue=new TH1F**[kNHisto];
+    target.fHisTrackZFOtrue=new TH1F**[kNHisto];
+    target.fHisTrackXFOfalse=new TH1F**[kNHisto];
+    target.fHisTrackZFOfalse=new TH1F**[kNHisto];
+    target.fHisTrackXZFOtrue=new TH2F**[kNHisto];
+    target.fHisTrackXZFOfalse=new TH2F**[kNHisto];
     for(Int_t i=0; i<kNHisto; i++) {
       target.fHisResX[i] = new TH1F(*fHisResX[i]);
       target.fHisResZ[i] = new TH1F(*fHisResZ[i]);
@@ -250,6 +282,21 @@ void AliITSPlaneEffSPD::CopyHistos(AliITSPlaneEffSPD &target) const {
       target.fHisTrackErrZ[i] = new TH1F(*fHisTrackErrZ[i]);
       target.fHisClusErrX[i] = new TH1F(*fHisClusErrX[i]);
       target.fHisClusErrZ[i] = new TH1F(*fHisClusErrZ[i]);
+
+      target.fHisTrackXFOtrue[i]=new TH1F*[kNClockPhase];
+      target.fHisTrackZFOtrue[i]=new TH1F*[kNClockPhase];
+      target.fHisTrackXFOfalse[i]=new TH1F*[kNClockPhase];
+      target.fHisTrackZFOfalse[i]=new TH1F*[kNClockPhase];
+      target.fHisTrackXZFOtrue[i]=new TH2F*[kNClockPhase];
+      target.fHisTrackXZFOfalse[i]=new TH2F*[kNClockPhase];
+      for(Int_t phas=0; phas<kNClockPhase;phas++){
+      target.fHisTrackXFOtrue[i][phas]=new TH1F(*fHisTrackXFOtrue[i][phas]);
+      target.fHisTrackZFOtrue[i][phas]=new TH1F(*fHisTrackZFOtrue[i][phas]);
+      target.fHisTrackXFOfalse[i][phas]=new TH1F(*fHisTrackXFOfalse[i][phas]);
+      target.fHisTrackZFOfalse[i][phas]=new TH1F(*fHisTrackZFOfalse[i][phas]);
+      target.fHisTrackXZFOtrue[i][phas]=new TH2F(*fHisTrackXZFOtrue[i][phas]);
+      target.fHisTrackXZFOfalse[i][phas]=new TH2F(*fHisTrackXZFOfalse[i][phas]);
+      }
     }
   }
 return;
@@ -264,7 +311,7 @@ Int_t AliITSPlaneEffSPD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelE
   //   Inputs:
   //         eff    -> Expected efficiency (e.g. those from actual estimate)
   //         RelErr -> tollerance [0,1] 
-  //         im     -> module number [0,249]
+  //         im     -> module number [0,239]
   //         ic     -> chip number [0,4]
   //   Outputs: none
   //   Return: the estimated n. of tracks 
@@ -279,53 +326,73 @@ else {
 }
 }
 //_________________________________________________________________________
-Double_t  AliITSPlaneEffSPD::PlaneEff(const UInt_t im,const UInt_t ic) const {
+Double_t  AliITSPlaneEffSPD::PlaneEff(const UInt_t im,const UInt_t ic, const Bool_t fo, const UInt_t bcm4) const {
 // Compute the efficiency for a basic block, 
 // Inputs:
-//        im     -> module number [0,249]
+//        im     -> module number [0,239]
 //        ic     -> chip number [0,4] 
+//        fo     -> boolean, true in case of Fast Or studies
+//        bcm4   -> for Fast Or: bunch crossing % 4
 if (im>=kNModule || ic>=kNChip) 
  {AliError("PlaneEff(Uint_t,Uint_t): you asked for a non existing chip"); return -1.;}
-UInt_t key=GetKey(im,ic);
+if(fo && bcm4>=kNClockPhase)
+ {AliError("PlaneEff(Uint_t,Uint_t): you asked for Fast Or in a wrong phase"); return -1.;}
 Int_t nf=-1;
 Int_t nt=-1;
-if(key<kNModule*kNChip) {
-  nf=fFound[key];
-  nt=fTried[key];
+if(fo) {
+ AliWarning("PlaneEff: you asked for FO efficiency");
+ nf=fFound[GetKey(im,ic,fo,bcm4)];
+ nt=fTried[GetKey(im,ic,fo,bcm4)];
+} else {
+ nf=fFound[GetKey(im,ic)];
+ nt=fTried[GetKey(im,ic)];
 }
 return AliITSPlaneEff::PlaneEff(nf,nt);
 }
 //_________________________________________________________________________
-Double_t  AliITSPlaneEffSPD::ErrPlaneEff(const UInt_t im,const UInt_t ic) const {
+Double_t  AliITSPlaneEffSPD::ErrPlaneEff(const UInt_t im,const UInt_t ic, const Bool_t fo, const UInt_t bcm4) const {
     // Compute the statistical error on efficiency for a basic block,
     // using binomial statistics 
     // Inputs:
-    //        im     -> module number [0,249]
+    //        im     -> module number [0,239]
     //        ic     -> chip number [0,4] 
+//        fo     -> boolean, true in case of Fast Or studies
+//        bcm4   -> for Fast Or: bunch crossing % 4
 if (im>=kNModule || ic>=kNChip) 
  {AliError("ErrPlaneEff(Uint_t,Uint_t): you asked for a non existing chip"); return -1.;}
-UInt_t key=GetKey(im,ic);
+if(fo && bcm4>=kNClockPhase)
+ {AliError("PlaneEff(Uint_t,Uint_t): you asked for Fast Or in a wrong phase"); return -1.;}
 Int_t nf=-1;
 Int_t nt=-1;
-if(key<kNModule*kNChip) {
-  nf=fFound[key];
-  nt=fTried[key];
+if(fo) {
+ AliWarning("ErrPlaneEff: you asked for FO efficiency");
+ nf=fFound[GetKey(im,ic,fo,bcm4)];
+ nt=fTried[GetKey(im,ic,fo,bcm4)];
+} else {
+ nf=fFound[GetKey(im,ic)];
+ 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) {
+                                         const UInt_t im, const UInt_t ic, const Bool_t fo, const UInt_t bcm4) {
   // Update efficiency for a basic block
 if (im>=kNModule || ic>=kNChip) 
  {AliError("UpDatePlaneEff: you asked for a non existing chip"); return kFALSE;}
- UInt_t key=GetKey(im,ic);
- if(key<kNModule*kNChip) {
-   fTried[key]++;
-   if(Kfound) fFound[key]++;
-   return kTRUE;
- }
- return kFALSE;
+if(fo && bcm4>=kNClockPhase)
+ {AliError("UpDatePlaneEff: you asked for Fast Or in a wrong phase"); return kFALSE;}
+if (!fo) {
+ fTried[GetKey(im,ic)]++;
+ if(Kfound) fFound[GetKey(im,ic)]++;
+ return kTRUE;
+}
+else {
+ fTried[GetKey(im,ic,fo,bcm4)]++;
+ if(Kfound) fFound[GetKey(im,ic,fo,bcm4)]++;
+ return kTRUE;
+}
+return kFALSE;
 }
 //_________________________________________________________________________
 UInt_t AliITSPlaneEffSPD::GetChipFromCol(const UInt_t col) const {
@@ -335,36 +402,75 @@ if(col>=kNCol*kNChip)
 return col/kNCol;
 }
 //__________________________________________________________________________
-UInt_t AliITSPlaneEffSPD::GetKey(const UInt_t mod, const UInt_t chip) const {
+UInt_t AliITSPlaneEffSPD::GetKey(const UInt_t mod, const UInt_t chip, const Bool_t FO, const UInt_t BCm4) const {
   // get key given a basic block
+UInt_t key=99999;
 if(mod>=kNModule || chip>=kNChip)
   {AliWarning("GetKey: you asked for a non existing block"); return 99999;}
-return mod*kNChip+chip;
+key = mod*kNChip+chip;
+if(FO) { 
+  if(BCm4>= kNClockPhase) {AliWarning("GetKey: you have asked Fast OR and a non exisiting BC modulo 4"); return 99999;}
+  key += kNModule*kNChip*(BCm4+1);
+}
+return key;
+}
+//__________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::SwitchChipKeyNumbering(UInt_t key) const {
+
+// methods to switch from offline chip key numbering 
+// to online Raw Stream chip numbering and viceversa. 
+// Used for Fast-Or studies.
+// Implemented by valerio.altini@ba.infn.it
+
+if(key>=kNModule*kNChip*(kNClockPhase+1))
+  {AliWarning("SwitchChipKeyNumbering: you asked for a non existing key"); return 99999;}
+UInt_t mod=9999,chip=9999,phase=9999;
+GetModAndChipFromKey(key,mod,chip);
+if(mod<kNModuleLy1) chip = kNChip-(chip+1);
+if(IsForFO(key))phase = GetBCm4FromKey(key);
+
+return GetKey(mod,chip,IsForFO(key),phase);
+
 }
 //__________________________________________________________________________
 UInt_t AliITSPlaneEffSPD::GetModFromKey(const UInt_t key) const {
   // get mod. from key
-if(key>=kNModule*kNChip)
+if(key>=kNModule*kNChip*(kNClockPhase+1))
   {AliError("GetModFromKey: you asked for a non existing key"); return 9999;}
-return key/kNChip;
+return (key%(kNModule*kNChip))/kNChip;
 }
 //__________________________________________________________________________
 UInt_t AliITSPlaneEffSPD::GetChipFromKey(const UInt_t key) const {
   // retrieves chip from key
-if(key>=kNModule*kNChip)
+if(key>=kNModule*kNChip*(kNClockPhase+1))
   {AliError("GetChipFromKey: you asked for a non existing key"); return 999;}
-return (key%(kNModule*kNChip))%kNChip;
+return ((key%(kNModule*kNChip))%(kNModule*kNChip))%kNChip;
+}
+//__________________________________________________________________________
+UInt_t AliITSPlaneEffSPD::GetBCm4FromKey(const UInt_t key) const {
+  // retrieves the "Bunch Crossing modulo 4" (for Fast Or studies)
+if(key>=kNModule*kNChip*(kNClockPhase+1))
+  {AliError("GetBCm4FromKey: you asked for a non existing key"); return 999;}
+if(key<kNModule*kNChip) 
+  {AliWarning("GetBCm4FromKey: key is below 1200, why are you asking for FO related stuff"); return 999;}
+
+return key/(kNModule*kNChip) - 1 ;
+}
+//__________________________________________________________________________
+Bool_t AliITSPlaneEffSPD::IsForFO(const UInt_t key) const {
+if(key>=kNModule*kNChip) return kTRUE;
+else return kFALSE;
 }
 //__________________________________________________________________________
 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)
+if(key>=kNModule*kNChip*(kNClockPhase+1))
   {AliError("GetModAndChipFromKey: you asked for a non existing key"); 
   mod=9999;
   chip=999;
   return;}
-mod=key/kNChip;
-chip=(key%(kNModule*kNChip))%kNChip;
+mod=GetModFromKey(key);
+chip=GetChipFromKey(key);
 return;
 }
 //____________________________________________________________________________
@@ -519,7 +625,6 @@ return kTRUE;
 //_____________________________________________________________________________
 Bool_t AliITSPlaneEffSPD::AddFromCDB(AliCDBId *cdbId) {
 AliCDBEntry *cdbEntry=0;
-// read efficiency values from CDB
 if (!cdbId) {
   if(!fInitCDBCalled)  
     {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;}
@@ -673,6 +778,12 @@ void AliITSPlaneEffSPD::InitHistos() {
   TString histnameTrackErrZ="HistTrackErrZ_mod_";
   TString histnameClusErrX="HistClusErrX_mod_";
   TString histnameClusErrZ="HistClusErrZ_mod_";
+  TString histnameTrackXFOtrue="HistTrackXFOok_mod_";
+  TString histnameTrackZFOtrue="HistTrackZFOok_mod_";
+  TString histnameTrackXFOfalse="HistTrackXFOko_mod_";
+  TString histnameTrackZFOfalse="HistTrackZFOko_mod_";
+  TString histnameTrackXZFOtrue="HistTrackZvsXFOok_mod_";
+  TString histnameTrackXZFOfalse="HistTrackZvsXFOko_mod_";
 //
 
   TH1::AddDirectory(kFALSE);
@@ -693,6 +804,12 @@ void AliITSPlaneEffSPD::InitHistos() {
   fHisTrackErrZ=new TH1F*[kNHisto];
   fHisClusErrX=new TH1F*[kNHisto];
   fHisClusErrZ=new TH1F*[kNHisto];
+  fHisTrackXFOtrue=new TH1F**[kNHisto];
+  fHisTrackZFOtrue=new TH1F**[kNHisto];
+  fHisTrackXFOfalse=new TH1F**[kNHisto];
+  fHisTrackZFOfalse=new TH1F**[kNHisto];
+  fHisTrackXZFOtrue=new TH2F**[kNHisto];
+  fHisTrackXZFOfalse=new TH2F**[kNHisto];
 
   for (Int_t nhist=0;nhist<kNHisto;nhist++){
     aux=histnameResX;
@@ -721,6 +838,13 @@ void AliITSPlaneEffSPD::InitHistos() {
 
     fHisResXclu[nhist]=new TH1F*[kNclu];
     fHisResZclu[nhist]=new TH1F*[kNclu];
+    fHisTrackXFOtrue[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackZFOtrue[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackXFOfalse[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackZFOfalse[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackXZFOtrue[nhist]=new TH2F*[kNClockPhase];
+    fHisTrackXZFOfalse[nhist]=new TH2F*[kNClockPhase];
+
     for(Int_t clu=0; clu<kNclu; clu++) {  // clu=0 --> cluster size 1
       aux=histnameResXclu;
       aux+=nhist;
@@ -803,7 +927,7 @@ void AliITSPlaneEffSPD::InitHistos() {
       aux+="_clu_";
       aux+=clu+1; // clu=0 --> cluster size 1
       fProfResXvsPhiclu[nhist][clu]=new TProfile("histname","histname",40,-40.,40.0); // binning: range:  -40°- 40
-      fProfResXvsPhiclu[nhist][clu]->SetName(aux.Data());                            //          bin width: 2°
+      fProfResXvsPhiclu[nhist][clu]->SetName(aux.Data());                             //          bin width: 2°
       fProfResXvsPhiclu[nhist][clu]->SetTitle(aux.Data());
 
       aux=profnameResZvsDipclu;
@@ -815,6 +939,61 @@ void AliITSPlaneEffSPD::InitHistos() {
       fProfResZvsDipclu[nhist][clu]->SetTitle(aux.Data());
     }
 
+    fHisTrackXFOtrue[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackZFOtrue[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackXFOfalse[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackZFOfalse[nhist]=new TH1F*[kNClockPhase];
+    fHisTrackXZFOtrue[nhist]=new TH2F*[kNClockPhase];
+    fHisTrackXZFOfalse[nhist]=new TH2F*[kNClockPhase];
+    for(Int_t phas=0; phas<kNClockPhase;phas++){
+      aux=histnameTrackXFOtrue;
+      aux+=nhist;
+      aux+="_BCmod4_";
+      aux+=phas;
+      fHisTrackXFOtrue[nhist][phas]=new TH1F("histname","histname",128,-0.64,0.64); // +- 6.4 mm; 1 bin=0.1 mm
+      fHisTrackXFOtrue[nhist][phas]->SetName(aux.Data());
+      fHisTrackXFOtrue[nhist][phas]->SetTitle(aux.Data());
+      
+      aux=histnameTrackZFOtrue;
+      aux+=nhist;
+      aux+="_BCmod4_";
+      aux+=phas;
+      fHisTrackZFOtrue[nhist][phas]=new TH1F("histname","histname",350,-3.5,3.5); // +- 35. mm; 1 bin=0.2 mm
+      fHisTrackZFOtrue[nhist][phas]->SetName(aux.Data());
+      fHisTrackZFOtrue[nhist][phas]->SetTitle(aux.Data());
+      
+      aux=histnameTrackXFOfalse;
+      aux+=nhist;
+      aux+="_BCmod4_";
+      aux+=phas;
+      fHisTrackXFOfalse[nhist][phas]=new TH1F("histname","histname",128,-0.64,0.64); // +- 6.4 mm; 1 bin=0.1 mm
+      fHisTrackXFOfalse[nhist][phas]->SetName(aux.Data());
+      fHisTrackXFOfalse[nhist][phas]->SetTitle(aux.Data());
+
+      aux=histnameTrackZFOfalse;
+      aux+=nhist;
+      aux+="_BCmod4_";
+      aux+=phas;
+      fHisTrackZFOfalse[nhist][phas]=new TH1F("histname","histname",350,-3.5,3.5); // +- 35. mm; 1 bin=0.2 mm
+      fHisTrackZFOfalse[nhist][phas]->SetName(aux.Data());
+      fHisTrackZFOfalse[nhist][phas]->SetTitle(aux.Data());
+    
+      aux=histnameTrackXZFOtrue;
+      aux+=nhist;
+      aux+="_BCmod4_";
+      aux+=phas;
+      fHisTrackXZFOtrue[nhist][phas]=new TH2F("histname","histname",22,-3.5,3.5,32,-0.64,0.64); //  localZ +- 35. mm; 1 bin=3.2 mm
+      fHisTrackXZFOtrue[nhist][phas]->SetName(aux.Data());                                      //  localX +- 6.4 mm; 1 bin=0.4 mm
+      fHisTrackXZFOtrue[nhist][phas]->SetTitle(aux.Data());
+
+      aux=histnameTrackXZFOfalse;
+      aux+=nhist;
+      aux+="_BCmod4_";
+      aux+=phas;
+      fHisTrackXZFOfalse[nhist][phas]=new TH2F("histname","histname",22,-3.5,3.5,32,-0.64,0.64); //  localZ +- 35. mm; 1 bin=3.2 mm
+      fHisTrackXZFOfalse[nhist][phas]->SetName(aux.Data());                                      //  localX +- 6.4 mm; 1 bin=0.4 mm
+      fHisTrackXZFOfalse[nhist][phas]->SetTitle(aux.Data());
+      } 
   } // end loop on module
 
   TH1::AddDirectory(kTRUE);
@@ -823,7 +1002,6 @@ return;
 }
 //__________________________________________________________
 void AliITSPlaneEffSPD::DeleteHistos() {
-// Delete the histograms and clean the memory 
   if(fHisResX) {
     for (Int_t i=0; i<kNHisto; i++ ) delete fHisResX[i];
     delete [] fHisResX; fHisResX=0;
@@ -912,11 +1090,90 @@ void AliITSPlaneEffSPD::DeleteHistos() {
     delete [] fProfResZvsDipclu;
     fProfResZvsDipclu = 0;
   }
-
+  if(fHisTrackXFOtrue) {
+    for (Int_t i=0; i<kNHisto; i++ ) {
+      for (Int_t phas=0; phas<kNClockPhase; phas++) if (fHisTrackXFOtrue[i][phas]) delete fHisTrackXFOtrue[i][phas];
+      delete [] fHisTrackXFOtrue[i];
+    }
+    delete [] fHisTrackXFOtrue;
+    fHisTrackXFOtrue = 0;
+  }
+  if(fHisTrackZFOtrue) {
+    for (Int_t i=0; i<kNHisto; i++ ) {
+      for (Int_t phas=0; phas<kNClockPhase; phas++) if (fHisTrackZFOtrue[i][phas]) delete fHisTrackZFOtrue[i][phas];
+      delete [] fHisTrackZFOtrue[i];
+    }
+    delete [] fHisTrackZFOtrue;
+    fHisTrackZFOtrue = 0;
+  }
+  if(fHisTrackXFOfalse) {
+    for (Int_t i=0; i<kNHisto; i++ ) {
+      for (Int_t phas=0; phas<kNClockPhase; phas++) if (fHisTrackXFOfalse[i][phas]) delete fHisTrackXFOfalse[i][phas];
+      delete [] fHisTrackXFOfalse[i];
+    }
+    delete [] fHisTrackXFOfalse;
+    fHisTrackXFOfalse = 0;
+  }
+  if(fHisTrackZFOfalse) {
+    for (Int_t i=0; i<kNHisto; i++ ) {
+      for (Int_t phas=0; phas<kNClockPhase; phas++) if (fHisTrackZFOfalse[i][phas]) delete fHisTrackZFOfalse[i][phas];
+      delete [] fHisTrackZFOfalse[i];
+    }
+    delete [] fHisTrackZFOfalse;
+    fHisTrackZFOfalse = 0;
+  }
 return;
 }
 //__________________________________________________________
-Bool_t AliITSPlaneEffSPD::FillHistos(UInt_t key, Bool_t found, 
+Bool_t AliITSPlaneEffSPD::FillHistos(UInt_t key, Bool_t found,
+                                     Float_t *tr, Float_t *clu, Int_t *csize, Float_t *angtrkmod) {
+//
+// depending on the value of key this method
+// either call the standard one for clusters 
+// or the one for FO studies
+// if key <  1200 --> call FillHistosST
+// if key >= 1200 --> call FillHistosFO
+if(key>=kNModule*kNChip*(kNClockPhase+1))
+  {AliError("GetChipFromKey: you asked for a non existing key"); return kFALSE;}
+if(key<kNModule*kNChip) return FillHistosStd(key,found,tr,clu,csize,angtrkmod);
+else return FillHistosFO(key,found,tr);
+return kFALSE;
+}
+//__________________________________________________________
+Bool_t AliITSPlaneEffSPD::FillHistosFO(UInt_t key, Bool_t found, Float_t *tr) {
+// this method fill the histograms for FastOr studies
+// input: - key: unique key of the basic block 
+//        - found: Boolean to asses whether a FastOr bit has been associated to the track or not 
+//        - tr[0],tr[1] local X and Z coordinates of the track prediction, respectively
+//        - tr[2],tr[3] error on local X and Z coordinates of the track prediction, respectively
+// output: kTRUE if filling was succesfull kFALSE otherwise
+// side effects: updating of the histograms.
+  if (!fHis) {
+    AliWarning("FillHistos: histograms do not exist! Call SetCreateHistos(kTRUE) first");
+    return kFALSE;
+  }
+  if(key>=kNModule*kNChip*(kNClockPhase+1))
+    {AliWarning("FillHistos: you asked for a non existing key"); return kFALSE;}
+  if(key<kNModule*kNChip)
+    {AliWarning("FillHistos: you asked for a key which is not for FO studies"); return kFALSE;}
+  Int_t id=GetModFromKey(key);
+  Int_t BCm4=GetBCm4FromKey(key);
+  if(id>=kNHisto)
+    {AliWarning("FillHistos: you want to fill a non-existing histos"); return kFALSE;}
+  if(found) {
+    fHisTrackXFOtrue[id][BCm4]->Fill(tr[0]);
+    fHisTrackZFOtrue[id][BCm4]->Fill(tr[1]);
+    fHisTrackXZFOtrue[id][BCm4]->Fill(tr[1],tr[0]);
+  }
+  else {
+    fHisTrackXFOfalse[id][BCm4]->Fill(tr[0]);
+    fHisTrackZFOfalse[id][BCm4]->Fill(tr[1]);
+    fHisTrackXZFOfalse[id][BCm4]->Fill(tr[1],tr[0]);
+  }
+return kTRUE;
+}
+//__________________________________________________________
+Bool_t AliITSPlaneEffSPD::FillHistosStd(UInt_t key, Bool_t found, 
                                      Float_t *tr, Float_t *clu, Int_t *csize, Float_t *angtrkmod) {
 // this method fill the histograms
 // input: - key: unique key of the basic block 
@@ -987,6 +1244,12 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option)
   TH1F *histClErrZ,*histClErrX;
   TProfile *profXvsPhi,*profZvsDip;
   TProfile *profXvsPhiclu[kNclu],*profZvsDipclu[kNclu];
+  TH1F *histXtrkFOtrue[kNClockPhase];
+  TH1F *histZtrkFOtrue[kNClockPhase];
+  TH1F *histXtrkFOfalse[kNClockPhase];
+  TH1F *histZtrkFOfalse[kNClockPhase];
+  TH2F *histXZtrkFOtrue[kNClockPhase];
+  TH2F *histXZtrkFOfalse[kNClockPhase];
 
   histZ=new TH1F();
   histX=new TH1F();
@@ -1000,6 +1263,7 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option)
     histXchip[chip]=new TH1F();
     histZchip[chip]=new TH1F();
   }
+
   histTrErrX=new TH1F();
   histTrErrZ=new TH1F();
   histClErrX=new TH1F();
@@ -1011,6 +1275,14 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option)
     profZvsDipclu[clu]=new TProfile();
   }
 
+  for(Int_t phas=0; phas<kNClockPhase;phas++){
+    histXtrkFOtrue[phas]=new TH1F();
+    histZtrkFOtrue[phas]=new TH1F();
+    histXtrkFOfalse[phas]=new TH1F();
+    histZtrkFOfalse[phas]=new TH1F();
+    histXZtrkFOtrue[phas]=new TH2F();
+    histXZtrkFOfalse[phas]=new TH2F();
+  }
 
   SPDTree->Branch("histX","TH1F",&histX,128000,0);
   SPDTree->Branch("histZ","TH1F",&histZ,128000,0);
@@ -1040,6 +1312,20 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option)
     snprintf(branchname,50,"profZvsDipclu_%d",clu+1);
     SPDTree->Branch(branchname,"TProfile",&profZvsDipclu[clu],128000,0);
   }
+  for(Int_t phas=0; phas<kNClockPhase;phas++){
+    snprintf(branchname,50,"histTrXFOokBCmod4_%d",phas);
+    SPDTree->Branch(branchname,"TH1F",&histXtrkFOtrue[phas],128000,0);
+    snprintf(branchname,50,"histTrZFOokBCmod4_%d",phas);
+    SPDTree->Branch(branchname,"TH1F",&histZtrkFOtrue[phas],128000,0);
+    snprintf(branchname,50,"histTrXFOkoBCmod4_%d",phas);
+    SPDTree->Branch(branchname,"TH1F",&histXtrkFOfalse[phas],128000,0);
+    snprintf(branchname,50,"histTrZFOkoBCmod4_%d",phas);
+    SPDTree->Branch(branchname,"TH1F",&histZtrkFOfalse[phas],128000,0);
+    snprintf(branchname,50,"histTrXZFOokBCmod4_%d",phas);
+    SPDTree->Branch(branchname,"TH2F",&histXZtrkFOtrue[phas],128000,0);
+    snprintf(branchname,50,"histTrXZFOkoBCmod4_%d",phas);
+    SPDTree->Branch(branchname,"TH2F",&histXZtrkFOfalse[phas],128000,0);
+  }
 
   for(Int_t j=0;j<kNHisto;j++){
     histX=fHisResX[j];
@@ -1064,6 +1350,14 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option)
       profXvsPhiclu[clu]=fProfResXvsPhiclu[j][clu];
       profZvsDipclu[clu]=fProfResZvsDipclu[j][clu];
     }
+    for(Int_t phas=0; phas<kNClockPhase;phas++){
+      histXtrkFOtrue[phas]=fHisTrackXFOtrue[j][phas];
+      histZtrkFOtrue[phas]=fHisTrackZFOtrue[j][phas];
+      histXtrkFOfalse[phas]=fHisTrackXFOfalse[j][phas];
+      histZtrkFOfalse[phas]=fHisTrackZFOfalse[j][phas];
+      histXZtrkFOtrue[phas]=fHisTrackXZFOtrue[j][phas];
+      histXZtrkFOfalse[phas]=fHisTrackXZFOfalse[j][phas];
+    }
 
     SPDTree->Fill();
   }
@@ -1133,6 +1427,24 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) {
     profZvsDipclu[clu]= (TBranch*) tree->GetBranch(branchname);
   }
 
+  TBranch *histXtrkFOtrue[kNClockPhase], *histZtrkFOtrue[kNClockPhase],
+          *histXtrkFOfalse[kNClockPhase], *histZtrkFOfalse[kNClockPhase],
+          *histXZtrkFOtrue[kNClockPhase], *histXZtrkFOfalse[kNClockPhase];
+  for(Int_t phas=0; phas<kNClockPhase;phas++){
+    snprintf(branchname,50,"histTrXFOokBCmod4_%d",phas);
+    histXtrkFOtrue[phas] = (TBranch*) tree->GetBranch(branchname);
+    snprintf(branchname,50,"histTrZFOokBCmod4_%d",phas);
+    histZtrkFOtrue[phas] = (TBranch*) tree->GetBranch(branchname);
+    snprintf(branchname,50,"histTrXFOkoBCmod4_%d",phas);
+    histXtrkFOfalse[phas] = (TBranch*) tree->GetBranch(branchname);
+    snprintf(branchname,50,"histTrZFOkoBCmod4_%d",phas);
+    histZtrkFOfalse[phas] = (TBranch*) tree->GetBranch(branchname);
+    snprintf(branchname,50,"histTrXZFOokBCmod4_%d",phas);
+    histXZtrkFOtrue[phas] = (TBranch*) tree->GetBranch(branchname);
+    snprintf(branchname,50,"histTrXZFOkoBCmod4_%d",phas);
+    histXZtrkFOfalse[phas] = (TBranch*) tree->GetBranch(branchname);
+  }
+
   gROOT->cd();
 
   Int_t nevent = (Int_t)histX->GetEntries();
@@ -1249,7 +1561,6 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) {
     histClErrZ->GetEntry(j);
     fHisClusErrZ[j]->Add(h);
   }
-
   nevent = (Int_t)profXvsPhi->GetEntries();
   if(nevent!=kNHisto)
     {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
@@ -1289,6 +1600,63 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) {
     }
   }
 
+    for(Int_t phas=0; phas<kNClockPhase;phas++){
+
+    nevent = (Int_t)histXtrkFOtrue[phas]->GetEntries();
+    if(nevent!=kNHisto)
+       {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
+    histXtrkFOtrue[phas]->SetAddress(&h);
+    for(Int_t j=0;j<kNHisto;j++){
+      histXtrkFOtrue[phas]->GetEntry(j);
+      fHisTrackXFOtrue[j][phas]->Add(h);
+    }
+
+    nevent = (Int_t)histZtrkFOtrue[phas]->GetEntries();
+    if(nevent!=kNHisto)
+       {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
+    histZtrkFOtrue[phas]->SetAddress(&h);
+    for(Int_t j=0;j<kNHisto;j++){
+      histZtrkFOtrue[phas]->GetEntry(j);
+      fHisTrackZFOtrue[j][phas]->Add(h);
+    }
+
+    nevent = (Int_t)histXtrkFOfalse[phas]->GetEntries();
+    if(nevent!=kNHisto)
+       {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
+    histXtrkFOfalse[phas]->SetAddress(&h);
+    for(Int_t j=0;j<kNHisto;j++){
+      histXtrkFOfalse[phas]->GetEntry(j);
+      fHisTrackXFOfalse[j][phas]->Add(h);
+    }
+
+    nevent = (Int_t)histZtrkFOfalse[phas]->GetEntries();
+    if(nevent!=kNHisto)
+       {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
+    histZtrkFOfalse[phas]->SetAddress(&h);
+    for(Int_t j=0;j<kNHisto;j++){
+      histZtrkFOfalse[phas]->GetEntry(j);
+      fHisTrackZFOfalse[j][phas]->Add(h);
+    }
+
+    nevent = (Int_t)histXZtrkFOtrue[phas]->GetEntries();
+    if(nevent!=kNHisto)
+       {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
+    histXZtrkFOtrue[phas]->SetAddress(&h2);
+    for(Int_t j=0;j<kNHisto;j++){
+      histXZtrkFOtrue[phas]->GetEntry(j);
+      fHisTrackXZFOtrue[j][phas]->Add(h2);
+    }
+
+    nevent = (Int_t)histXZtrkFOfalse[phas]->GetEntries();
+    if(nevent!=kNHisto)
+       {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
+    histXZtrkFOfalse[phas]->SetAddress(&h2);
+    for(Int_t j=0;j<kNHisto;j++){
+      histXZtrkFOfalse[phas]->GetEntry(j);
+      fHisTrackXZFOfalse[j][phas]->Add(h2);
+    }
+
+   }
 
   delete h;   
   delete h2;  
index 9f2e19661ca081892ad91f62f9e596e8791daf40..c8183f5580b0cca20f84ed30c9df10dbbbd500cd 100644 (file)
@@ -30,24 +30,26 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
     // Simple way to add another class (i.e. statistics). 
     AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
     // Getters for average Plane efficiency (including 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 mod, const UInt_t chip, Bool_t FO=kFALSE, const UInt_t BCm4=0) const;
+    Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip, Bool_t FO=kFALSE, const UInt_t BCm4=0) const;
     Double_t PlaneEff(const UInt_t key) const 
-        {return PlaneEff(GetModFromKey(key),GetChipFromKey(key));};
+        {return PlaneEff(GetModFromKey(key),GetChipFromKey(key),IsForFO(key),GetBCm4FromKey(key));};
     Double_t ErrPlaneEff(const UInt_t key) const 
-        {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key));};
+        {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key),IsForFO(key),GetBCm4FromKey(key));};
     // Getters for fFound[] and fTried[]
     Int_t GetFound(const UInt_t key) const; 
     Int_t GetTried(const UInt_t key) const; 
     // 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);
+    Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod, const UInt_t chip, Bool_t FO=kFALSE, const UInt_t BCm4=0);
     Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
-        {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));};
+        {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key),IsForFO(key),GetBCm4FromKey(key));};
     //
     enum {kNModule = 240}; // The number of modules
+    enum {kNModuleLy1 = 80}; // The number of modules in Inner Layer
     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)
+    enum {kNClockPhase = 4}; // The number of clock phases between LHC (40 MHz clock) and SPD (10 MHz clock), for FO studies
 
     virtual Double_t LivePlaneEff(UInt_t key) const;
     Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip) const
@@ -66,8 +68,10 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
    // 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 GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic
-                                                              // block of the SPD
+    UInt_t GetKey(const UInt_t mod, const UInt_t chip, const Bool_t FO=kFALSE, const UInt_t BCm4=0) const; // unique key to locate the basic
+                                                                                                           // block of the SPD for detector and FO efficiency
+    UInt_t SwitchChipKeyNumbering(UInt_t key) const; //  method to switch from offline chip key numbering to online Raw Stream chip numbering 
+                                                     // and viceversa. Used for Fast-Or studies.
     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
     // compute the geometrical limit of a basic block (chip) in detector local coordinate system 
@@ -89,6 +93,8 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
     Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const;
     UInt_t GetModFromKey(const UInt_t key) const;
     UInt_t GetChipFromKey(const UInt_t key) const;
+    Bool_t IsForFO(const UInt_t key) const;
+    UInt_t GetBCm4FromKey(const UInt_t key) const;  // return the "Bunch Crossing modulo 4" (for Fast Or studies)
     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
     Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number,
@@ -98,8 +104,12 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
     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;
 // 
-    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
+    Int_t fFound[kNModule*kNChip*(kNClockPhase+1)];  // if(<kNModule*kNChip) is the number of associated clusters in a given chip
+    Int_t fTried[kNModule*kNChip*(kNClockPhase+1)];  // if(<kNModule*kNChip) is the number of tracks used for chip efficiency evaluation
+                                                     // if(>=kNModule*kNChip) Same tale but for Fast-Or
+                                                     // studies (in the 4 phase relationship between LHC and SPD clocks)
+    Bool_t FillHistosStd(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype, Float_t *angtrkmod);
+    Bool_t FillHistosFO(UInt_t key, Bool_t found, Float_t *track);
 
  private:
     enum {kNHisto = kNModule}; // The number of histograms: module by module.
@@ -129,18 +139,26 @@ class AliITSPlaneEffSPD :  public AliITSPlaneEff {
     TH1F **fHisTrackErrZ; //! histos with track prediction error on Local Z
     TH1F **fHisClusErrX; //! histos with Local_X cluster error
     TH1F **fHisClusErrZ; //! histos with Local_Z cluster error
-
-    ClassDef(AliITSPlaneEffSPD,3) // SPD Plane Efficiency class
+    TH1F ***fHisTrackXFOtrue; //! histos with track prediction along local X (r-phi) if FastOr bit is found
+    TH1F ***fHisTrackZFOtrue; //! histos with track prediction along local Z if FastOr bit is found
+    TH1F ***fHisTrackXFOfalse; //! histos with track prediction along local X (r-phi) if FastOr bit is not found
+    TH1F ***fHisTrackZFOfalse; //! histos with track prediction along local Z if FastOr bit is not found
+    TH2F ***fHisTrackXZFOtrue; //! histos with track prediction along local X (r-phi) and Z if FastOr bit is found
+    TH2F ***fHisTrackXZFOfalse; //! histos with track prediction along local X (r-phi) and Z if FastOr bit is not found
+    
+    ClassDef(AliITSPlaneEffSPD,4) // SPD Plane Efficiency class
 };
 //
 inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
 
 inline Int_t AliITSPlaneEffSPD::GetFound(const UInt_t key) const {
- if(key>=kNModule*kNChip) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
+ if(key>=kNModule*kNChip*(kNClockPhase+1)) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
+ if(key>=kNModule*kNChip)AliWarning("GetFound: you asked for FO efficiency studies");
  return fFound[key];
 }
 inline Int_t AliITSPlaneEffSPD::GetTried(const UInt_t key) const {
- if(key>=kNModule*kNChip) {AliWarning("GetTried: you asked for a non existing key"); return -1;}
+ if(key>=kNModule*kNChip*(kNClockPhase+1)) {AliWarning("GetTried: you asked for a non existing key"); return -1;}
+ if(key>=kNModule*kNChip)AliWarning("GetTried: you asked for FO efficiency studies");
  return fTried[key];
 }
 //
index c6e1f169314605b6f5a6a840260d82889182e871..bc883034b7f38f9bed949458a29ea4b3604bfdc4 100644 (file)
@@ -33,6 +33,7 @@
 #include <TRandom.h>
 #include <TTreeStream.h>
 #include <TVector3.h>
+#include <TBits.h>
 
 #include "AliLog.h"
 #include "AliGeomManager.h"
@@ -94,6 +95,7 @@ fDebugStreamer(0),
 fITSChannelStatus(0),
 fkDetTypeRec(0),
 fPlaneEff(0),
+fSPDChipIntPlaneEff(0),
 fITSPid(0)
 
  {
@@ -144,6 +146,7 @@ fDebugStreamer(0),
 fITSChannelStatus(0),
 fkDetTypeRec(0),
 fPlaneEff(0),
+fSPDChipIntPlaneEff(0),
 fITSPid(0) {
   //--------------------------------------------------------------------
   //This is the AliITStrackerMI constructor
@@ -268,7 +271,11 @@ fITSPid(0) {
     Int_t iplane=AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff();
     if(!AliITSReconstructor::GetRecoParam()->GetLayersToSkip(iplane)==1)
       AliWarning(Form("Evaluation of Plane Eff for layer %d will be attempted without removing it from tracker",iplane));
-    if (iplane<2) fPlaneEff = new AliITSPlaneEffSPD();
+    if (iplane<2) {
+      fPlaneEff = new AliITSPlaneEffSPD();
+      fSPDChipIntPlaneEff = new Bool_t[AliITSPlaneEffSPD::kNModule*AliITSPlaneEffSPD::kNChip];
+      for (UInt_t i=0; i<AliITSPlaneEffSPD::kNModule*AliITSPlaneEffSPD::kNChip; i++) fSPDChipIntPlaneEff[i]=kFALSE;
+    }
     else if (iplane<4) fPlaneEff = new AliITSPlaneEffSDD();
     else fPlaneEff = new AliITSPlaneEffSSD();
     if(AliITSReconstructor::GetRecoParam()->GetReadPlaneEffFromOCDB())
@@ -354,6 +361,7 @@ AliITStrackerMI::~AliITStrackerMI()
   if(fITSChannelStatus) delete fITSChannelStatus;
   if(fPlaneEff) delete fPlaneEff;
   if(fITSPid) delete fITSPid;
+  if (fSPDChipIntPlaneEff) delete [] fSPDChipIntPlaneEff;
 
 }
 //------------------------------------------------------------------------
@@ -772,6 +780,13 @@ Int_t AliITStrackerMI::RefitInward(AliESDEvent *event) {
   Int_t nentr=event->GetNumberOfTracks();
   //  Info("RefitInward", "Number of ESD tracks: %d\n", nentr);
 
+  // only for PlaneEff and in case of SPD (for FO studies)
+  if( AliITSReconstructor::GetRecoParam()->GetComputePlaneEff() &&
+      AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff()>=0 && 
+      AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff()<2) {
+      for (UInt_t i=0; i<AliITSPlaneEffSPD::kNModule*AliITSPlaneEffSPD::kNChip; i++) fSPDChipIntPlaneEff[i]=kFALSE;     
+  }
+
   Int_t ntrk=0;
   for (Int_t i=0; i<nentr; i++) {
     AliESDtrack *esd=event->GetTrack(i);
@@ -5099,6 +5114,29 @@ void AliITStrackerMI::UseTrackForPlaneEff(const AliITStrackMI* track, Int_t ilay
   }
   if(!fPlaneEff->UpDatePlaneEff(found,key))
        AliWarning(Form("UseTrackForPlaneEff: cannot UpDate PlaneEff for key=%d",key));
+
+// this for FO efficiency studies (only for SPD) // 
+   UInt_t keyFO=999999;
+   Bool_t foundFO=kFALSE;
+   if(ilayer<2){ //ONLY SPD layers for FastOr studies
+    TBits mapFO = fkDetTypeRec->GetFastOrFiredMap();
+    Int_t phase = (fEsd->GetBunchCrossNumber())%4;
+    if(!fSPDChipIntPlaneEff[key]){
+      AliITSPlaneEffSPD spd; 
+      keyFO = spd.SwitchChipKeyNumbering(key);
+      if(mapFO.TestBitNumber(keyFO))foundFO=kTRUE;
+       keyFO = key + (AliITSPlaneEffSPD::kNModule*AliITSPlaneEffSPD::kNChip)*(phase+1);
+       if(keyFO<AliITSPlaneEffSPD::kNModule*AliITSPlaneEffSPD::kNChip) {
+         AliWarning(Form("UseTrackForPlaneEff: too small keyF0 (= %d), setting it to 999999",keyFO));
+         keyFO=999999;
+       }
+       if(!fPlaneEff->UpDatePlaneEff(foundFO,keyFO))
+          AliWarning(Form("UseTrackForPlaneEff: cannot UpDate PlaneEff for FastOR for key=%d",keyFO));
+     }
+  }
+  
+
+
   if(fPlaneEff->GetCreateHistos()&&  AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) {
     Float_t tr[4]={99999.,99999.,9999.,9999.};    // initialize to high values 
     Float_t clu[4]={-99999.,-99999.,9999.,9999.}; // (in some cases GetCov fails) 
@@ -5182,8 +5220,12 @@ Float_t AngleModTrack[3]={99999.,99999.,99999.}; // angles (phi, z and "absolute
     AngleModTrack[1]-=TMath::Pi()/2.; // range of angle is -pi/2 , pi/2
     AngleModTrack[1]*=180./TMath::Pi(); // in degree
 
-      fPlaneEff->FillHistos(key,found,tr,clu,cltype,AngleModTrack);
+    fPlaneEff->FillHistos(key,found,tr,clu,cltype,AngleModTrack);
+
+    // For FO efficiency studies of SPD 
+    if(ilayer<2 && !fSPDChipIntPlaneEff[key]) fPlaneEff->FillHistos(keyFO,foundFO,tr,clu,cltype,AngleModTrack);
   }
+  if(ilayer<2) fSPDChipIntPlaneEff[key]=kTRUE;
 return;
 }
 
index ca07d789d5ac8615bc5ae65bebbf35315a1c6fa3..b84db3b55f217266854b104687fc44b6b683f8a4 100644 (file)
@@ -331,12 +331,13 @@ protected:
   AliITSChannelStatus *fITSChannelStatus;//! bitmaps with channel status for SPD and SDD
   const AliITSDetTypeRec *fkDetTypeRec;         //! ITS det type rec, from AliITSReconstructor
   AliITSPlaneEff *fPlaneEff;             //! Pointer to the ITS plane efficicency
+  Bool_t* fSPDChipIntPlaneEff;      //! Map of the SPD chips already intersected by a track (for FO studies)
   AliITSPIDResponse *fITSPid;            //! parameters for ITS pid 
   //
 private:
   AliITStrackerMI(const AliITStrackerMI &tracker);
   AliITStrackerMI & operator=(const AliITStrackerMI &tracker);
-  ClassDef(AliITStrackerMI,10)   //ITS tracker MI
+  ClassDef(AliITStrackerMI,11)   //ITS tracker MI
 };