]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinder.cxx
Bug fix - the dep energy should be divided by the MIP energy to form the counts
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinder.cxx
index 308596d43acb702560d59be7d67f0d93ac1d1b42..8647cf73f15bc0af49dcf715f4e52156ca4fa9cb 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-//
-// Base Class used to find
-// the reconstructed points for ITS
-// See also AliITSClusterFinderSPD, AliITSClusterFinderSDD, 
-// AliITSClusterFinderSDD
-//
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+// Base Class used to find                                                //
+// the reconstructed points for ITS                                       //
+// See also AliITSClusterFinderSPD, AliITSClusterFinderSDD,               //
+// AliITSClusterFinderSDD  AliITSClusterFinderV2                          //
+////////////////////////////////////////////////////////////////////////////
 
 #include "AliITSClusterFinder.h"
-#include "AliITSdigitSPD.h"
-#include "AliITSdigitSDD.h"
-#include "AliITSdigitSSD.h"
+#include "AliITSRecPoint.h"
+#include "AliITSdigit.h"
+#include "AliITSDetTypeRec.h"
 #include "AliITSMap.h"
-#include "AliRun.h"
-#include "AliITS.h"
+#include "AliITSgeomTGeo.h"
 
 ClassImp(AliITSClusterFinder)
 
@@ -36,8 +36,7 @@ fDebug(0),
 fModule(0),
 fDigits(0),
 fNdigits(0),
-fResponse(0),
-fSegmentation(0),
+fDetTypeRec(0),
 fClusters(0),
 fNRawClusters(0),
 fMap(0),
@@ -54,15 +53,13 @@ fNPeaks(-1){
     //   A default constructed AliITSCulsterFinder
 }
 //----------------------------------------------------------------------
-AliITSClusterFinder::AliITSClusterFinder(AliITSsegmentation *seg, 
-                                         AliITSresponse *res):
+AliITSClusterFinder::AliITSClusterFinder(AliITSDetTypeRec* dettyp):
 TObject(),
 fDebug(0),
 fModule(0),
 fDigits(0),
 fNdigits(0),
-fResponse(res),
-fSegmentation(seg),
+fDetTypeRec(dettyp),
 fClusters(0),
 fNRawClusters(0),
 fMap(0),
@@ -84,16 +81,14 @@ fNPeaks(-1){
     SetDeclusterFlag();
 }
 //----------------------------------------------------------------------
-AliITSClusterFinder::AliITSClusterFinder(AliITSsegmentation *seg, 
-                                         AliITSresponse *response, 
-                                         TClonesArray *digits):
+AliITSClusterFinder::AliITSClusterFinder(AliITSDetTypeRec* dettyp,
+                                        TClonesArray *digits):
 TObject(),
 fDebug(0),
 fModule(0),
 fDigits(digits),
 fNdigits(0),
-fResponse(response),
-fSegmentation(seg),
+fDetTypeRec(dettyp),
 fClusters(0),
 fNRawClusters(0),
 fMap(0),
@@ -116,6 +111,35 @@ fNPeaks(-1){
     SetClusterSize();
     SetDeclusterFlag();
 }
+
+//______________________________________________________________________
+AliITSClusterFinder::AliITSClusterFinder(const AliITSClusterFinder &source) : TObject(source),
+fDebug(source.fDebug),
+fModule(source.fModule),
+fDigits(),
+fNdigits(source.fNdigits),
+fDetTypeRec(),
+fClusters(),
+fNRawClusters(source.fNRawClusters),
+fMap(),
+fNperMax(source.fNperMax),
+fDeclusterFlag(source.fDeclusterFlag),
+fClusterSize(source.fClusterSize),
+fNPeaks(source.fNPeaks) {
+  // Copy constructor
+  // Copies are not allowed. The method is protected to avoid misuse.
+  AliError("Copy constructor not allowed\n");
+}
+
+
+//______________________________________________________________________
+//AliITSClusterFinder& AliITSClusterFinder::operator=(const AliITSClusterFinder& /* source */){
+  // Assignment operator
+  // Assignment is not allowed. The method is protected to avoid misuse.
+//  Fatal("= operator","Assignment operator not allowed\n");
+//  return *this;
+//}
+
 //----------------------------------------------------------------------
 AliITSClusterFinder::~AliITSClusterFinder(){
     // destructor cluster finder
@@ -128,8 +152,6 @@ AliITSClusterFinder::~AliITSClusterFinder(){
 
     if(fMap) {delete fMap;}
     // Zero local pointers. Other classes own these pointers.
-    fSegmentation = 0;
-    fResponse     = 0;
     fMap          = 0;
     fDigits       = 0;
     fNdigits      = 0;
@@ -138,48 +160,24 @@ AliITSClusterFinder::~AliITSClusterFinder(){
     fDeclusterFlag= 0;
     fClusterSize  = 0;
     fNPeaks       = 0;
+    fDetTypeRec   = 0;
+
 }
 //__________________________________________________________________________
-AliITSClusterFinder::AliITSClusterFinder(const AliITSClusterFinder &source) :
-    TObject(source){
-    //     Copy Constructor
-    // Input:
-    //   AliITSClusterFinder &source  The class which will become a copy of 
-    //                                this class
-    // Output:
-    //   none.
-    // Return:
-    //   A copy of this class
-
-    if(&source == this) return;
-    *this = source;
-    return;
+void AliITSClusterFinder::InitGeometry(){
+ //
+ // Initialisation of ITS geometry
+ //
+  Int_t mmax=AliITSgeomTGeo::GetNModules();
+  for (Int_t m=0; m<mmax; m++) {
+    Int_t lay,lad,det; AliITSgeomTGeo::GetModuleId(m,lay,lad,det);
+    fNdet[m] = (lad-1)*AliITSgeomTGeo::GetNDetectors(lay) + (det-1);
+    fNlayer[m] = lay-1;
+  }
 }
-//______________________________________________________________________
-AliITSClusterFinder& AliITSClusterFinder::operator=(const AliITSClusterFinder 
-                                                    &source) {
-    //    Assignment operator
-    // Input:
-    //   AliITSClusterFinder &source  The class which will become a copy of 
-    //                                this class
-    // Output:
-    //   none.
-    // Return:
-    //   A copy of this class
 
-    if(&source == this) return *this;
-    this->fDigits = source.fDigits;
-    this->fNdigits = source.fNdigits;
-    this->fResponse = source.fResponse;
-    this->fSegmentation = source.fSegmentation;
-    this->fNRawClusters = source.fNRawClusters;
-    this->fMap = source.fMap;
-    this->fNperMax = source.fNperMax;
-    this->fDeclusterFlag = source.fDeclusterFlag;
-    this->fClusterSize = source.fClusterSize;
-    this->fNPeaks = source.fNPeaks;
-    return *this;
-}
+
+
 //----------------------------------------------------------------------
 void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c){
     // Add a raw cluster copy to the list
@@ -191,9 +189,12 @@ void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c){
     // Return:
     //   none.
 
-    AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
-    iTS->AddCluster(branch,c); 
-    fNRawClusters++;
+   if(!fDetTypeRec) {
+    Error("AddCluster","fDetTypeRec is null!");
+    return;
+  }
+  fDetTypeRec->AddCluster(branch,c); 
+  fNRawClusters++;
 }
 //----------------------------------------------------------------------
 void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c, 
@@ -207,12 +208,48 @@ void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c,
     //   none.
     // Return:
     //   none.
+  if(!fDetTypeRec) {
+    Error("AddCluster","fDetTypeRec is null!");
+    return;
+  }
+
+  fDetTypeRec->AddCluster(branch,c); 
+  fNRawClusters++;
+  fDetTypeRec->AddRecPoint(rp); 
+
+}
+/*
+//______________________________________________________________________
+void AliITSClusterFinder::CheckLabels(Int_t lab[3]) {
+  //------------------------------------------------------------
+  // Tries to find mother's labels
+  //------------------------------------------------------------
+
+  if(lab[0]<0 && lab[1]<0 && lab[2]<0) return; // In case of no labels just exit
+  // Check if simulation
+  AliMC* mc = gAlice->GetMCApp();
+  if(!mc)return;
 
-    AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
-    iTS->AddCluster(branch,c); 
-    fNRawClusters++;
-    iTS->AddRecPoint(rp); 
+  Int_t ntracks = mc->GetNtrack();
+  for (Int_t i=0;i<3;i++){
+    Int_t label = lab[i];
+    if (label>=0 && label<ntracks) {
+      TParticle *part=(TParticle*)mc->Particle(label);
+      if (part->P() < 0.005) {
+       Int_t m=part->GetFirstMother();
+       if (m<0) {      
+         continue;
+       }
+       if (part->GetStatusCode()>0) {
+         continue;
+       }
+       lab[i]=m;       
+      }
+    }    
+  }
+  
 }
+*/
 //______________________________________________________________________
 void AliITSClusterFinder::FindRawClusters(Int_t module){
     // Default Cluster finder.
@@ -354,7 +391,7 @@ Bool_t AliITSClusterFinder::IsNeighbor(TObjArray *digs,Int_t i,Int_t n[])const{
 }
 
 //______________________________________________________________________
-void AliITSClusterFinder::Print(ostream *os){
+void AliITSClusterFinder::Print(ostream *os) const{
     //Standard output format for this class
     // Inputs:
     //    ostream *os   Output stream
@@ -373,7 +410,7 @@ void AliITSClusterFinder::Print(ostream *os){
     *os << fNPeaks<<endl;
 }
 //______________________________________________________________________
-void AliITSClusterFinder::Read(istream *is){
+void AliITSClusterFinder::Read(istream *is)  {
     //Standard input for this class
     // Inputs:
     //    istream *is   Input stream