]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSTrackleterSPDEff.cxx
Coding rules
[u/mrichter/AliRoot.git] / ITS / AliITSTrackleterSPDEff.cxx
index 637ab2fc96a20a1f785b834c2e17c21c0a4fe62b..873b2d54e708ad4297afcc45a88c3bc0138e6fd4 100644 (file)
@@ -63,8 +63,8 @@ fNClustersLay1(0),
 fNClustersLay2(0),
 fNTracklets(0),
 fOnlyOneTrackletPerC2(0),
-fPhiWindow(0),
-fZetaWindow(0),
+fPhiWindowL2(0),
+fZetaWindowL2(0),
 fPhiOverlapCut(0),
 fZetaOverlapCut(0),
 fHistOn(0),
@@ -124,12 +124,15 @@ fhDPhiVsDThetaInterpAcc(0),
 fhDPhiVsDZetaInterpAll(0),
 fhDPhiVsDZetaInterpAcc(0),
 fhetaClustersLay2(0),
-fhphiClustersLay2(0)
+fhphiClustersLay2(0),
+fhClustersInChip(0),
+fhClustersInModuleLay1(0),
+fhClustersInModuleLay2(0)
 {
    // default constructor
 // from AliITSMultReconstructor
-  SetPhiWindow();
-  SetZetaWindow();
+  SetPhiWindowL2();
+  SetZetaWindowL2();
   SetOnlyOneTrackletPerC2();
   fClustersLay1       = new Float_t*[300000];
   fClustersLay2       = new Float_t*[300000];
@@ -172,8 +175,8 @@ fNClustersLay1(mr.fNClustersLay1),
 fNClustersLay2(mr.fNClustersLay2),
 fNTracklets(mr.fNTracklets),
 fOnlyOneTrackletPerC2(mr.fOnlyOneTrackletPerC2),
-fPhiWindow(mr.fPhiWindow),
-fZetaWindow(mr.fZetaWindow),
+fPhiWindowL2(mr.fPhiWindowL2),
+fZetaWindowL2(mr.fZetaWindowL2),
 fPhiOverlapCut(mr.fPhiOverlapCut),
 fZetaOverlapCut(mr.fZetaOverlapCut),
 fHistOn(mr.fHistOn),
@@ -233,7 +236,10 @@ fhDPhiVsDThetaInterpAcc(mr.fhDPhiVsDThetaInterpAcc),
 fhDPhiVsDZetaInterpAll(mr.fhDPhiVsDZetaInterpAll),
 fhDPhiVsDZetaInterpAcc(mr.fhDPhiVsDZetaInterpAcc),
 fhetaClustersLay2(mr.fhetaClustersLay2),
-fhphiClustersLay2(mr.fhphiClustersLay2)
+fhphiClustersLay2(mr.fhphiClustersLay2),
+fhClustersInChip(mr.fhClustersInChip),
+fhClustersInModuleLay1(mr.fhClustersInModuleLay1),
+fhClustersInModuleLay2(mr.fhClustersInModuleLay2)
 {
   // Copy constructor
 }
@@ -357,8 +363,9 @@ AliITSTrackleterSPDEff::Reconstruct(AliStack *pStack, TTree *tRef) {
       Float_t eta=fClustersLay1[iC1][0];
       eta= TMath::Tan(eta/2.);
       eta=-TMath::Log(eta);
-      fhetaClustersLay1->Fill(eta);    
+      fhetaClustersLay1->Fill(eta);
       fhphiClustersLay1->Fill(fClustersLay1[iC1][1]);
+      fhClustersInChip->Fill(fhClustersInChip->GetBinCenter(key+1)); // if found=kFALSE -> overflow
     }      
   }
   // Loop on layer 2 : finding theta, phi and r   
@@ -391,6 +398,7 @@ AliITSTrackleterSPDEff::Reconstruct(AliStack *pStack, TTree *tRef) {
       eta=-TMath::Log(eta);
       fhetaClustersLay2->Fill(eta);
       fhphiClustersLay2->Fill(fClustersLay2[iC2][1]);
+      fhClustersInChip->Fill(fhClustersInChip->GetBinCenter(key+1)); // if found=kFALSE -> overflow
     }
   }  
   
@@ -476,8 +484,8 @@ AliITSTrackleterSPDEff::Reconstruct(AliStack *pStack, TTree *tRef) {
        }
 
        // make "elliptical" cut in Phi and Zeta! 
-       Float_t d = TMath::Sqrt(dPhi*dPhi/fPhiWindow/fPhiWindow + 
-                                dZeta*dZeta/fZetaWindow/fZetaWindow);
+       Float_t d = TMath::Sqrt(dPhi*dPhi/fPhiWindowL2/fPhiWindowL2 + 
+                                dZeta*dZeta/fZetaWindowL2/fZetaWindowL2);
 
        if (d>1) continue;      
        
@@ -1336,7 +1344,7 @@ void AliITSTrackleterSPDEff::PrintAscii(ostream *os)const{
     //   none.
     // Return:
     //   none.
-    *os << fPhiWindowL1 <<" "<< fZetaWindowL1 << " " << fPhiWindow <<" "<< fZetaWindow 
+    *os << fPhiWindowL1 <<" "<< fZetaWindowL1 << " " << fPhiWindowL2 <<" "<< fZetaWindowL2 
         << " " << fOnlyOneTrackletPerC1 << " " << fOnlyOneTrackletPerC2 
         << " " << fUpdateOncePerEventPlaneEff << " " << fReflectClusterAroundZAxisForLayer0
         << " " << fReflectClusterAroundZAxisForLayer1;
@@ -1370,7 +1378,7 @@ void AliITSTrackleterSPDEff::ReadAscii(istream *is){
     //   none.
 
     Bool_t tmp= fMC;
-    *is >> fPhiWindowL1 >> fZetaWindowL1 >> fPhiWindow >> fZetaWindow 
+    *is >> fPhiWindowL1 >> fZetaWindowL1 >> fPhiWindowL2 >> fZetaWindowL2 
         >> fOnlyOneTrackletPerC1 >> fOnlyOneTrackletPerC2  
         >> fUpdateOncePerEventPlaneEff >> fReflectClusterAroundZAxisForLayer0
         >> fReflectClusterAroundZAxisForLayer1;
@@ -1449,8 +1457,8 @@ void AliITSTrackleterSPDEff::SavePredictionMC(TString filename) const {
     TH1F* cuts = new TH1F("cuts", "list of cuts", 10, 0, 10); // TH1I containing cuts 
     cuts->SetBinContent(1,fPhiWindowL1);
     cuts->SetBinContent(2,fZetaWindowL1);
-    cuts->SetBinContent(3,fPhiWindow);
-    cuts->SetBinContent(4,fZetaWindow);
+    cuts->SetBinContent(3,fPhiWindowL2);
+    cuts->SetBinContent(4,fZetaWindowL2);
     cuts->SetBinContent(5,fOnlyOneTrackletPerC1);
     cuts->SetBinContent(6,fOnlyOneTrackletPerC2);
     cuts->SetBinContent(7,fUpdateOncePerEventPlaneEff);
@@ -1540,8 +1548,8 @@ void AliITSTrackleterSPDEff::ReadPredictionMC(TString filename) {
     TH1F *cuts = (TH1F*)mcfile->Get("cuts"); 
     fPhiWindowL1=(Float_t)cuts->GetBinContent(1);
     fZetaWindowL1=(Float_t)cuts->GetBinContent(2);
-    fPhiWindow=(Float_t)cuts->GetBinContent(3);
-    fZetaWindow=(Float_t)cuts->GetBinContent(4);
+    fPhiWindowL2=(Float_t)cuts->GetBinContent(3);
+    fZetaWindowL2=(Float_t)cuts->GetBinContent(4);
     fOnlyOneTrackletPerC1=(Bool_t)cuts->GetBinContent(5);
     fOnlyOneTrackletPerC2=(Bool_t)cuts->GetBinContent(6);
     fUpdateOncePerEventPlaneEff=(Bool_t)cuts->GetBinContent(7);
@@ -1628,6 +1636,13 @@ Bool_t AliITSTrackleterSPDEff::SaveHists() {
 
   fhetaClustersLay2->Write();
   fhphiClustersLay2->Write();
+  fhClustersInChip->Write();
+  for (Int_t nhist=0;nhist<80;nhist++){
+    fhClustersInModuleLay1[nhist]->Write(); 
+  }
+  for (Int_t nhist=0;nhist<160;nhist++){
+    fhClustersInModuleLay2[nhist]->Write(); 
+  }
   return kTRUE;
 }
 //__________________________________________________________
@@ -1719,6 +1734,45 @@ void AliITSTrackleterSPDEff::BookHistos() {
   fhetaClustersLay2->SetDirectory(0);
   fhphiClustersLay2  = new TH1F("phiClustersLay2", "phiCl2", 100, 0., 2*TMath::Pi());
   fhphiClustersLay2->SetDirectory(0);
+  fhClustersInChip = new TH1F("fhClustersInChip", "ClustersPerChip", 1200, -0.5, 1199.5);
+  fhClustersInChip->SetDirectory(0);
+// each chip is divided 8(z) x 4(y), i.e. in 32 squares, each containing 4 columns and 64 rows.
+  Float_t bz[160]; const Float_t kconv = 1.0E-04; // converts microns to cm.
+  for(Int_t i=0;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
+  Double_t xbins[41]; // each bin in x (Z loc coordinate) includes 4 columns
+  //xbins[0]=0;
+  Float_t xmn,xmx,zmn,zmx;
+  if(!fPlaneEffSPD->GetBlockBoundaries(0,xmn,xmx,zmn,zmx)) AliWarning("Could not book histo properly");
+  xbins[0]=(Double_t)zmn;
+  for(Int_t i=0;i<40;i++) {
+   xbins[i+1]=xbins[i] + (bz[4*i]+bz[4*i+1]+bz[4*i+2]+bz[4*i+3])*kconv; 
+  }
+  TString histname="ClustersLay1_mod_",aux;
+  fhClustersInModuleLay1 =new TH2F*[80];
+  for (Int_t nhist=0;nhist<80;nhist++){
+    aux=histname;
+    aux+=nhist;
+    //  
+    fhClustersInModuleLay1[nhist]=new TH2F("histname","histname",40,xbins,4,(Double_t)xmn,(Double_t)xmx); 
+    fhClustersInModuleLay1[nhist]->SetName(aux.Data());
+    fhClustersInModuleLay1[nhist]->SetTitle(aux.Data());
+    fhClustersInModuleLay1[nhist]->SetDirectory(0);
+  }
+  histname="ClustersLay2_mod_";
+  fhClustersInModuleLay2 =new TH2F*[160];
+  for (Int_t nhist=0;nhist<160;nhist++){
+    aux=histname;
+    aux+=nhist;
+    fhClustersInModuleLay2[nhist]=new TH2F("histname","histname",40,xbins,4,(Double_t)xmn,(Double_t)xmx);
+    fhClustersInModuleLay2[nhist]->SetName(aux.Data());
+    fhClustersInModuleLay2[nhist]->SetTitle(aux.Data());
+    fhClustersInModuleLay2[nhist]->SetDirectory(0);
+  }
+//
   return;
 }
 //____________________________________________________________
@@ -1755,6 +1809,15 @@ void AliITSTrackleterSPDEff::DeleteHistos() {
     if(fhDPhiVsDZetaInterpAcc) {delete fhDPhiVsDZetaInterpAcc; fhDPhiVsDZetaInterpAcc=0;}
     if(fhetaClustersLay2) {delete fhetaClustersLay2; fhetaClustersLay2=0;}
     if(fhphiClustersLay2) {delete fhphiClustersLay2; fhphiClustersLay2=0;}
+    if(fhClustersInChip) {delete fhClustersInChip; fhClustersInChip=0;}
+    if(fhClustersInModuleLay1) {
+      for (Int_t i=0; i<80; i++ ) delete fhClustersInModuleLay1[i];
+      delete [] fhClustersInModuleLay1; fhClustersInModuleLay1=0;
+    }
+    if(fhClustersInModuleLay2) {
+      for (Int_t i=0; i<160; i++ ) delete fhClustersInModuleLay2[i];
+      delete [] fhClustersInModuleLay2; fhClustersInModuleLay2=0;
+    }
 }
 //_______________________________________________________________
 Bool_t AliITSTrackleterSPDEff::IsReconstructableAt(Int_t layer,Int_t iC,Int_t ipart,
@@ -1824,8 +1887,8 @@ for(Int_t iref=0;iref<nref;iref++) { // loop over all the refs of the matching t
     Float_t dZeta = TMath::Cos(fClustersLay1[iC][0])*r2 - trefLayExtr[2];
 
     // make "elliptical" cut in Phi and Zeta!
-    Float_t d = TMath::Sqrt(dPhi*dPhi/fPhiWindow/fPhiWindow +
-                              dZeta*dZeta/fZetaWindow/fZetaWindow);
+    Float_t d = TMath::Sqrt(dPhi*dPhi/fPhiWindowL2/fPhiWindowL2 +
+                              dZeta*dZeta/fZetaWindowL2/fZetaWindowL2);
     if (d<1) {ret=kTRUE; break;}
   }
   if(layer==0) { // try to see if it is reconstructable at the inner layer
@@ -1965,6 +2028,11 @@ AliITSTrackleterSPDEff::LoadClusterArrays(TTree* itsClusterTree) {
         for (Int_t i=0; i<3; i++)
                 fClustersLay1[fNClustersLay1][3+i] = cluster->GetLabel(i);
         fNClustersLay1++;
+        if(fHistOn) { 
+          Int_t det=cluster->GetDetectorIndex();
+          if(det<0 || det>79) {AliError("Cluster with det. index out of boundaries"); return;}
+          fhClustersInModuleLay1[det]->Fill((Double_t)cluster->GetDetLocalZ(),(Double_t)cluster->GetDetLocalX());
+        }
       }
       if (layer==1) {
         fClustersLay2[fNClustersLay2][0] = x;
@@ -1974,6 +2042,11 @@ AliITSTrackleterSPDEff::LoadClusterArrays(TTree* itsClusterTree) {
         for (Int_t i=0; i<3; i++)
                 fClustersLay2[fNClustersLay2][3+i] = cluster->GetLabel(i);
         fNClustersLay2++;
+        if(fHistOn) {
+          Int_t det=cluster->GetDetectorIndex();
+          if(det<0 || det>159) {AliError("Cluster with det. index out of boundaries"); return;}
+          fhClustersInModuleLay2[det]->Fill((Double_t)cluster->GetDetLocalZ(),(Double_t)cluster->GetDetLocalX());
+        }
       }
 
     }// end of cluster loop