]> 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 152b98cc72a340b3f71f00a5887fdfda1a7fe68c..8647cf73f15bc0af49dcf715f4e52156ca4fa9cb 100644 (file)
 ////////////////////////////////////////////////////////////////////////////
 
 #include "AliITSClusterFinder.h"
-#include "AliITSclusterV2.h"
 #include "AliITSRecPoint.h"
-#include "AliITSdigitSPD.h"
-#include "AliITSdigitSDD.h"
-#include "AliITSdigitSSD.h"
-#include "AliITSgeom.h"
+#include "AliITSdigit.h"
+#include "AliITSDetTypeRec.h"
 #include "AliITSMap.h"
-#include "AliRun.h"
-#include "AliMC.h"
-#include "AliITS.h"
-#include "TParticle.h"
+#include "AliITSgeomTGeo.h"
 
 ClassImp(AliITSClusterFinder)
 
@@ -42,8 +36,7 @@ fDebug(0),
 fModule(0),
 fDigits(0),
 fNdigits(0),
-fResponse(0),
-fSegmentation(0),
+fDetTypeRec(0),
 fClusters(0),
 fNRawClusters(0),
 fMap(0),
@@ -58,18 +51,15 @@ fNPeaks(-1){
     //   none.
     // Return:
     //   A default constructed AliITSCulsterFinder
-  Init();
 }
 //----------------------------------------------------------------------
-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),
@@ -89,19 +79,16 @@ fNPeaks(-1){
     SetNperMax();
     SetClusterSize();
     SetDeclusterFlag();
-    Init();
 }
 //----------------------------------------------------------------------
-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),
@@ -123,22 +110,35 @@ fNPeaks(-1){
     SetNperMax();
     SetClusterSize();
     SetDeclusterFlag();
-    Init();
 }
+
 //______________________________________________________________________
-AliITSClusterFinder::AliITSClusterFinder(const AliITSClusterFinder &source) : TObject(source) {
+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.
-  Fatal("AliITSClusterFinder","Copy constructor not allowed\n");
+  AliError("Copy constructor not allowed\n");
 }
 
+
 //______________________________________________________________________
-AliITSClusterFinder& AliITSClusterFinder::operator=(const AliITSClusterFinder& /* source */){
+//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;
-}
+//  Fatal("= operator","Assignment operator not allowed\n");
+//  return *this;
+//}
 
 //----------------------------------------------------------------------
 AliITSClusterFinder::~AliITSClusterFinder(){
@@ -152,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;
@@ -162,37 +160,24 @@ AliITSClusterFinder::~AliITSClusterFinder(){
     fDeclusterFlag= 0;
     fClusterSize  = 0;
     fNPeaks       = 0;
-    fITS          = 0;
-}
+    fDetTypeRec   = 0;
 
+}
 //__________________________________________________________________________
-void AliITSClusterFinder::Init(){
-
-  //Initialisation of ITS geometry
-
-  fITS = (AliITS*)gAlice->GetModule("ITS");
-  AliITSgeom *geom=(AliITSgeom*)fITS->GetITSgeom();
-
-  Int_t mmax=geom->GetIndexMax();
-  if (mmax>2200) {
-    Fatal("AliITSClusterFinder","Too many ITS subdetectors !"); 
-  }
-  Int_t m;
-  for (m=0; m<mmax; m++) {
-    Int_t lay,lad,det; geom->GetModuleId(m,lay,lad,det);
-    Float_t x,y,z;     geom->GetTrans(lay,lad,det,x,y,z); 
-    Double_t rot[9];   geom->GetRotMatrix(lay,lad,det,rot);
-    Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi();
-    Double_t ca=TMath::Cos(alpha), sa=TMath::Sin(alpha);
-    fYshift[m] = x*ca + y*sa;
-    fZshift[m] = (Double_t)z;
-    fNdet[m] = (lad-1)*geom->GetNdetectors(lay) + (det-1);
+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;
   }
-
 }
 
 
+
 //----------------------------------------------------------------------
 void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c){
     // Add a raw cluster copy to the list
@@ -204,8 +189,12 @@ void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c){
     // Return:
     //   none.
 
-    fITS->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, 
@@ -219,12 +208,17 @@ void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c,
     //   none.
     // Return:
     //   none.
+  if(!fDetTypeRec) {
+    Error("AddCluster","fDetTypeRec is null!");
+    return;
+  }
 
-    fITS->AddCluster(branch,c); 
-    fNRawClusters++;
-    fITS->AddRecPoint(rp); 
-}
+  fDetTypeRec->AddCluster(branch,c); 
+  fNRawClusters++;
+  fDetTypeRec->AddRecPoint(rp); 
 
+}
+/*
 //______________________________________________________________________
 void AliITSClusterFinder::CheckLabels(Int_t lab[3]) {
   //------------------------------------------------------------
@@ -255,7 +249,7 @@ void AliITSClusterFinder::CheckLabels(Int_t lab[3]) {
   }
   
 }
-
+*/
 //______________________________________________________________________
 void AliITSClusterFinder::FindRawClusters(Int_t module){
     // Default Cluster finder.
@@ -397,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
@@ -416,35 +410,7 @@ void AliITSClusterFinder::Print(ostream *os){
     *os << fNPeaks<<endl;
 }
 //______________________________________________________________________
-void AliITSClusterFinder::RecPoints2Clusters
-(const TClonesArray *points, Int_t idx, TClonesArray *clusters) {
-  //------------------------------------------------------------
-  // Conversion AliITSRecPoint -> AliITSclusterV2 for the ITS 
-  // subdetector indexed by idx 
-  //------------------------------------------------------------
-  AliITSgeom* geom = (AliITSgeom*)fITS->GetITSgeom();
-  Int_t lastSPD1=geom->GetModuleIndex(2,1,1)-1;
-  TClonesArray &cl=*clusters;
-  Int_t ncl=points->GetEntriesFast();
-  for (Int_t i=0; i<ncl; i++) {
-    AliITSRecPoint *p = (AliITSRecPoint *)points->UncheckedAt(i);
-    Float_t lp[5];
-    lp[0]=-(-p->GetX()+fYshift[idx]); if (idx<=lastSPD1) lp[0]*=-1; //SPD1
-    lp[1]=  -p->GetZ()+fZshift[idx];
-    lp[2]=p->GetSigmaX2();
-    lp[3]=p->GetSigmaZ2();
-    lp[4]=p->GetQ()*36./23333.;  //electrons -> ADC
-    Int_t lab[4]; 
-    lab[0]=p->GetLabel(0); lab[1]=p->GetLabel(1); lab[2]=p->GetLabel(2);
-    lab[3]=fNdet[idx];
-    CheckLabels(lab);
-    Int_t dummy[3]={0,0,0};
-    new (cl[i]) AliITSclusterV2(lab,lp, dummy);
-  }  
-} 
-
-//______________________________________________________________________
-void AliITSClusterFinder::Read(istream *is){
+void AliITSClusterFinder::Read(istream *is)  {
     //Standard input for this class
     // Inputs:
     //    istream *is   Input stream
@@ -490,29 +456,3 @@ istream &operator>>(istream &is,AliITSClusterFinder &source){
     source.Read(&is);
     return is;
 }
-/*
-void AliITSClusterFinder::RecPoints2Clusters
-(const TClonesArray *points, Int_t idx, TClonesArray *clusters) {
-  //------------------------------------------------------------
-  // Conversion AliITSRecPoint -> AliITSclusterV2 for the ITS 
-  // subdetector indexed by idx 
-  //------------------------------------------------------------
-  TClonesArray &cl=*clusters;
-  Int_t ncl=points->GetEntriesFast();
-  for (Int_t i=0; i<ncl; i++) {
-    AliITSRecPoint *p = (AliITSRecPoint *)points->UncheckedAt(i);
-    Float_t lp[5];
-    lp[0]=-(-p->GetX()+fYshift[idx]); if (idx<=fLastSPD1) lp[0]*=-1; //SPD1
-    lp[1]=  -p->GetZ()+fZshift[idx];
-    lp[2]=p->GetSigmaX2();
-    lp[3]=p->GetSigmaZ2();
-    lp[4]=p->GetQ()*36./23333.;  //electrons -> ADC
-    Int_t lab[4]; 
-    lab[0]=p->GetLabel(0); lab[1]=p->GetLabel(1); lab[2]=p->GetLabel(2);
-    lab[3]=fNdet[idx];
-    CheckLabels(lab);
-    Int_t dummy[3]={0,0,0};
-    new (cl[i]) AliITSclusterV2(lab,lp, dummy);
-  }  
-} 
-*/