]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSMultReconstructor.cxx
In Open() and GotoEvent() try the ESD operations first, fallback to run-loader.
[u/mrichter/AliRoot.git] / ITS / AliITSMultReconstructor.cxx
index e903078a5ad441b29d2eed4cd8af0ae23d3c9d3d..cb876016f076a0aa7ac8ec1c40024e444125b80e 100644 (file)
@@ -46,8 +46,9 @@
 //     - multiple association forbidden (fOnlyOneTrackletPerC2 = kTRUE) 
 //     - phi definition changed to ALICE convention (0,2*TMath::pi()) 
 //     - cluster coordinates taken with GetGlobalXYZ()
+//     - fGeometry removed
+//     - number of fired chips on the two layers
 //
-//  fGeometry removed
 //____________________________________________________________________
 
 #include <TClonesArray.h>
@@ -56,6 +57,7 @@
 #include <TTree.h>
 
 #include "AliITSMultReconstructor.h"
+#include "AliITSsegmentationSPD.h"
 #include "AliITSRecPoint.h"
 #include "AliITSgeom.h"
 #include "AliLog.h"
@@ -93,6 +95,10 @@ fhetaTracklets(0),
 fhphiTracklets(0),
 fhetaClustersLay1(0),
 fhphiClustersLay1(0){
+
+  fNFiredChips[0] = 0;
+  fNFiredChips[1] = 0;
+
   // Method to reconstruct the charged particles multiplicity with the 
   // SPD (tracklets).
 
@@ -111,7 +117,7 @@ fhphiClustersLay1(0){
   for(Int_t i=0; i<300000; i++) {
     fClustersLay1[i]       = new Float_t[6];
     fClustersLay2[i]       = new Float_t[6];
-    fTracklets[i]          = new Float_t[4];
+    fTracklets[i]          = new Float_t[5];
     fSClusters[i]           = new Float_t[2];
     fAssociationFlag[i]    = kFALSE;
   }
@@ -361,10 +367,18 @@ AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*
       fTracklets[fNTracklets][0] = fClustersLay1[iC1][0];
       // use the phi from the clusters in the first layer
       fTracklets[fNTracklets][1] = fClustersLay1[iC1][1];
-      // Store the difference between phi1 and phi2
+      // store the difference between phi1 and phi2
       fTracklets[fNTracklets][2] = fClustersLay1[iC1][1] - fClustersLay2[iC2WithBestDist][1];
 
+      // define dphi in the range [0,pi] with proper sign (track charge correlated)
+      if (fTracklets[fNTracklets][2] > TMath::Pi()) 
+          fTracklets[fNTracklets][2] = fTracklets[fNTracklets][2]-2.*TMath::Pi();
+      if (fTracklets[fNTracklets][2] < -TMath::Pi()) 
+          fTracklets[fNTracklets][2] = fTracklets[fNTracklets][2]+2.*TMath::Pi();
+
       // find label
+      // if equal label in both clusters found this label is assigned
+      // if no equal label can be found the first labels of the L1 AND L2 cluster are assigned
       Int_t label1 = 0;
       Int_t label2 = 0;
       while (label2 < 3)
@@ -383,11 +397,13 @@ AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*
       {
         AliDebug(AliLog::kDebug, Form("Found label %d == %d for tracklet candidate %d\n", (Int_t) fClustersLay1[iC1][3+label1], (Int_t) fClustersLay2[iC2WithBestDist][3+label2], fNTracklets));
         fTracklets[fNTracklets][3] = fClustersLay1[iC1][3+label1];
+        fTracklets[fNTracklets][4] = fClustersLay2[iC2WithBestDist][3+label2];
       }
       else
       {
         AliDebug(AliLog::kDebug, Form("Did not find label %d %d %d %d %d %d for tracklet candidate %d\n", (Int_t) fClustersLay1[iC1][3], (Int_t) fClustersLay1[iC1][4], (Int_t) fClustersLay1[iC1][5], (Int_t) fClustersLay2[iC2WithBestDist][3], (Int_t) fClustersLay2[iC2WithBestDist][4], (Int_t) fClustersLay2[iC2WithBestDist][5], fNTracklets));
-        fTracklets[fNTracklets][3] = -2;
+        fTracklets[fNTracklets][3] = fClustersLay1[iC1][3];
+        fTracklets[fNTracklets][4] = fClustersLay2[iC2WithBestDist][3];
       }
 
       if (fHistOn) {
@@ -429,12 +445,17 @@ AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) {
   // - gets the clusters from the cluster tree 
   // - convert them into global coordinates 
   // - store them in the internal arrays
+  // - count the number of cluster-fired chips
   
-  AliDebug(1,"Loading clusters ...");
+  AliDebug(1,"Loading clusters and cluster-fired chips ...");
   
   fNClustersLay1 = 0;
   fNClustersLay2 = 0;
+  fNFiredChips[0] = 0;
+  fNFiredChips[1] = 0;
   
+  AliITSsegmentationSPD *seg = new AliITSsegmentationSPD();
+
   TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint");
   TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints");
 
@@ -450,20 +471,29 @@ AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) {
       continue;
     
     Int_t nClusters = itsClusters->GetEntriesFast();
+
+    // number of clusters in each chip of the current module
+    Int_t nClustersInChip[5] = {0,0,0,0,0};
+    Int_t layer = 0;
     
     // loop over clusters
     while(nClusters--) {
       AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);
       
-      if (cluster->GetLayer()>1) 
-       continue;            
+      layer = cluster->GetLayer();
+      if (layer>1) continue;            
       
       cluster->GetGlobalXYZ(cluGlo);
       Float_t x = cluGlo[0];
       Float_t y = cluGlo[1];
       Float_t z = cluGlo[2];      
+
+      // find the chip for the current cluster
+      Float_t locz = cluster->GetDetLocalZ();
+      Int_t iChip = seg->GetChipFromLocal(0,locz);
+      nClustersInChip[iChip]++; 
       
-      if (cluster->GetLayer()==0) {
+      if (layer==0) {
        fClustersLay1[fNClustersLay1][0] = x;
        fClustersLay1[fNClustersLay1][1] = y;
        fClustersLay1[fNClustersLay1][2] = z;
@@ -471,7 +501,7 @@ AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) {
                fClustersLay1[fNClustersLay1][3+i] = cluster->GetLabel(i);
        fNClustersLay1++;
       }
-      if (cluster->GetLayer()==1) {
+      if (layer==1) {
        fClustersLay2[fNClustersLay2][0] = x;
        fClustersLay2[fNClustersLay2][1] = y;
        fClustersLay2[fNClustersLay2][2] = z;
@@ -481,14 +511,86 @@ AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) {
       }
       
     }// end of cluster loop
+
+    // get number of fired chips in the current module
+    if(layer<2)
+    for(Int_t ifChip=0; ifChip<5; ifChip++) {
+      if(nClustersInChip[ifChip] >= 1)  fNFiredChips[layer]++;
+    }
+
   } // end of its "subdetector" loop  
-  
+
   if (itsClusters) {
     itsClusters->Delete();
     delete itsClusters;
+    delete seg;
     itsClusters = 0;
   }
   AliDebug(1,Form("(clusters in layer 1 : %d,  layer 2: %d)",fNClustersLay1,fNClustersLay2));
+  AliDebug(1,Form("(cluster-fired chips in layer 1 : %d,  layer 2: %d)",fNFiredChips[0],fNFiredChips[1]));
+}
+//____________________________________________________________________
+void
+AliITSMultReconstructor::LoadClusterFiredChips(TTree* itsClusterTree) {
+  // This method
+  // - gets the clusters from the cluster tree 
+  // - counts the number of (cluster)fired chips
+  
+  AliDebug(1,"Loading cluster-fired chips ...");
+  
+  fNFiredChips[0] = 0;
+  fNFiredChips[1] = 0;
+  
+  AliITSsegmentationSPD *seg = new AliITSsegmentationSPD();
+
+  TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint");
+  TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints");
+
+  itsClusterBranch->SetAddress(&itsClusters);
+
+  Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries();  
+  // loop over the its subdetectors
+  for (Int_t iIts=0; iIts < nItsSubs; iIts++) {
+    
+    if (!itsClusterTree->GetEvent(iIts)) 
+      continue;
+    
+    Int_t nClusters = itsClusters->GetEntriesFast();
+
+    // number of clusters in each chip of the current module
+    Int_t nClustersInChip[5] = {0,0,0,0,0};
+    Int_t layer = 0;
+    
+    // loop over clusters
+    while(nClusters--) {
+      AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);
+      
+      layer = cluster->GetLayer();
+      if (layer>1) continue;            
+
+      // find the chip for the current cluster
+      Float_t locz = cluster->GetDetLocalZ();
+      Int_t iChip = seg->GetChipFromLocal(0,locz);
+      nClustersInChip[iChip]++; 
+      
+    }// end of cluster loop
+
+    // get number of fired chips in the current module
+    if(layer<2)
+    for(Int_t ifChip=0; ifChip<5; ifChip++) {
+      if(nClustersInChip[ifChip] >= 1)  fNFiredChips[layer]++;
+    }
+
+  } // end of its "subdetector" loop  
+  
+  if (itsClusters) {
+    itsClusters->Delete();
+    delete itsClusters;
+    delete seg;
+    itsClusters = 0;
+  }
+  AliDebug(1,Form("(cluster-fired chips in layer 1 : %d,  layer 2: %d)",fNFiredChips[0],fNFiredChips[1]));
 }
 //____________________________________________________________________
 void
@@ -516,5 +618,3 @@ AliITSMultReconstructor::SaveHists() {
   fhetaClustersLay1->Write();
   fhphiClustersLay1->Write();
 }
-
-