]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterFinderVS.cxx
Formatting changes.
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderVS.cxx
index f122500d70954d4bb4d37244737a56bd1adaf6bf..b1e1748658993969b9efb70063329fa607fb1b2e 100644 (file)
 
 /* $Id$ */
 
-#include <TMinuit.h> 
-#include <TF1.h>
-#include <TMinuit.h> 
-#include <Riostream.h>
+// -------------------------------
+// Class AliMUONClusterFinderVS
+// -------------------------------
+// Class for clustering and reconstruction of space points
+// (Not used by default)
 
 #include "AliMUONClusterFinderVS.h"
 #include "AliMUONDigit.h"
 #include "AliMUONGeometrySegmentation.h"
 #include "AliMUONMathieson.h"
 #include "AliMUONClusterInput.h"
-#include "AliMUONHitMapA1.h"
+#include "AliMUONDigitMapA1.h"
+
 #include "AliLog.h"
 
+#include <TMinuit.h> 
+#include <TF1.h>
+#include <TMinuit.h> 
+#include <Riostream.h>
+
+
 //_____________________________________________________________________
 // This function is minimized in the double-Mathieson fit
 void fcnS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
@@ -41,13 +49,11 @@ ClassImp(AliMUONClusterFinderVS)
 AliMUONClusterFinderVS::AliMUONClusterFinderVS()
   : TObject()
 {
-// Default constructor
+/// Default constructor
     fInput=AliMUONClusterInput::Instance();
-//     cout <<  " TYPE" << fSegmentationType << endl;
-    fHitMap[0] = 0;
-    fHitMap[1] = 0;
+    fDigitMap[0] = 0;
+    fDigitMap[1] = 0;
     fTrack[0]=fTrack[1]=-1;
-    fDebugLevel = 0; // make silent default
     fGhostChi2Cut = 1e6; // nothing done by default
     fSeg2[0]    = 0;
     fSeg2[1]    = 0;
@@ -63,6 +69,8 @@ AliMUONClusterFinderVS::AliMUONClusterFinderVS()
  //____________________________________________________________________________
 AliMUONClusterFinderVS::~AliMUONClusterFinderVS()
 {
+/// Destructor
+
   // Reset tracks information
    fNRawClusters = 0;
    if (fRawClusters) {
@@ -73,27 +81,27 @@ AliMUONClusterFinderVS::~AliMUONClusterFinderVS()
 
 AliMUONClusterFinderVS::AliMUONClusterFinderVS(const AliMUONClusterFinderVS & clusterFinder):TObject(clusterFinder)
 {
-// Protected copy constructor
+/// Protected copy constructor
 
   AliFatal("Not implemented.");
 }
 //____________________________________________________________________________
 void AliMUONClusterFinderVS::ResetRawClusters()
 {
-  // Reset tracks information
+/// Reset tracks information
   fNRawClusters = 0;
   if (fRawClusters) fRawClusters->Clear();
 }
 //____________________________________________________________________________
 void AliMUONClusterFinderVS::Decluster(AliMUONRawCluster *cluster)
 {
-// Decluster by local maxima
+/// Decluster by local maxima
     SplitByLocalMaxima(cluster);
 }
 //____________________________________________________________________________
 void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
 {
-  // Split complex cluster by local maxima 
+/// Split complex cluster by local maxima 
     Int_t cath, i;
 
     fInput->SetCluster(c);
@@ -948,7 +956,7 @@ void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
 
 void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/)
 {
-// Find all local maxima of a cluster
+/// Find all local maxima of a cluster
     AliDebug(1,"\n Find Local maxima  !");
     
     AliMUONDigit* digt;
@@ -986,8 +994,8 @@ void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/)
        // loop over next neighbours, if at least one neighbour has higher charger assumption
        // digit is not local maximum 
        for (j=0; j<nn; j++) {
-         if (fHitMap[cath]->TestHit(x[j], y[j])==kEmpty) continue;
-         digt=(AliMUONDigit*) fHitMap[cath]->GetHit(x[j], y[j]);
+         if (fDigitMap[cath]->TestHit(x[j], y[j])==kEmpty) continue;
+         digt=(AliMUONDigit*) fDigitMap[cath]->GetHit(x[j], y[j]);
          Float_t a1;
          isec=fSeg2[cath]->Sector(fInput->DetElemId(), x[j], y[j]);
          a1 = fSeg2[cath]->Dpx(fInput->DetElemId(),isec)*fSeg2[cath]->Dpy(fInput->DetElemId(), isec);
@@ -1061,9 +1069,9 @@ void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/)
                  // skip the current pad
                  if (iy == fIy[i][cath]) continue;
                
-                 if (fHitMap[cath]->TestHit(ix, iy)!=kEmpty) {
+                 if (fDigitMap[cath]->TestHit(ix, iy)!=kEmpty) {
                    iNN++;
-                   digt=(AliMUONDigit*) fHitMap[cath]->GetHit(ix,iy);
+                   digt=(AliMUONDigit*) fDigitMap[cath]->GetHit(ix,iy);
                    if (digt->Signal() > fQ[i][cath]) isLocal[i][cath]=kFALSE;
                  }
                } // Loop over pad neighbours in y
@@ -1126,9 +1134,9 @@ void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/)
                  // skip the current pad
                  if (ix == fIx[i][cath]) continue;
                
-                 if (fHitMap[cath]->TestHit(ix, iy)!=kEmpty) {
+                 if (fDigitMap[cath]->TestHit(ix, iy)!=kEmpty) {
                    iNN++;
-                   digt=(AliMUONDigit*) fHitMap[cath]->GetHit(ix,iy);
+                   digt=(AliMUONDigit*) fDigitMap[cath]->GetHit(ix,iy);
                    if (digt->Signal() > fQ[i][cath]) isLocal[i][cath]=kFALSE;
                  }
                } // Loop over pad neighbours in x
@@ -1152,9 +1160,8 @@ void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/)
 
 void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t flag, Int_t cath) 
 {
-  //
-  //  Completes cluster information starting from list of digits
-  //
+///  Completes cluster information starting from list of digits
+
   AliMUONDigit* dig;
   Float_t x, y, z;
   Int_t  ix, iy;
@@ -1240,9 +1247,8 @@ void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t flag, Int_
 
 void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t cath) 
 {
-  //
-  //  Completes cluster information starting from list of digits
-  //
+///  Completes cluster information starting from list of digits
+
   static Float_t dr0;
   
   AliMUONDigit* dig;
@@ -1289,18 +1295,13 @@ void  AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t cath)
     c->SetX(cath,fSeg2[cath]->GetAnod(fInput->DetElemId(), c->GetX(cath)));
 }
 
-void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONRawCluster &c){
-
-
-//
-//  Find a super cluster on both cathodes
-//
-//
-//  Add i,j as element of the cluster
-//
+void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONRawCluster &c)
+{
+///  Find a super cluster on both cathodes
+///  Add i,j as element of the cluster
     
-    Int_t idx = fHitMap[cath]->GetHitIndex(i,j);
-    AliMUONDigit* dig = (AliMUONDigit*) fHitMap[cath]->GetHit(i,j);
+    Int_t idx = fDigitMap[cath]->GetHitIndex(i,j);
+    AliMUONDigit* dig = (AliMUONDigit*) fDigitMap[cath]->GetHit(i,j);
     Int_t q=dig->Signal();
     Int_t theX=dig->PadX();
     Int_t theY=dig->PadY(); 
@@ -1356,7 +1357,7 @@ void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONR
     c.AddCharge(cath,q);
 //
 // Flag hit as "taken"  
-    fHitMap[cath]->FlagHit(i,j);
+    fDigitMap[cath]->FlagHit(i,j);
 //
 //  Now look recursively for all neighbours and pad hit on opposite cathode
 //
@@ -1370,7 +1371,7 @@ void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONR
        ix=xList[in];
        iy=yList[in];
        
-       if (fHitMap[cath]->TestHit(ix,iy)==kUnused) {
+       if (fDigitMap[cath]->TestHit(ix,iy)==kUnused) {
            AliDebug(2,Form("\n Neighbours %d %d %d", cath, ix, iy));
            FindCluster(ix, iy, cath, c);
        }
@@ -1407,7 +1408,7 @@ void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONR
        
        ix = fSeg2[iop]->Ix(); iy = fSeg2[iop]->Iy();
        AliDebug(2,Form("\n ix, iy: %f %f %f %d %d %d", x,y,z,ix, iy, fSector));
-       if (fHitMap[iop]->TestHit(ix,iy)==kUnused){
+       if (fDigitMap[iop]->TestHit(ix,iy)==kUnused){
          iXopp[nOpp]=ix;
          iYopp[nOpp++]=iy;
          AliDebug(2,Form("\n Opposite %d %d %d", iop, ix, iy));
@@ -1418,7 +1419,7 @@ void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONR
     //
     Int_t jopp;
     for (jopp=0; jopp<nOpp; jopp++) {
-      if (fHitMap[iop]->TestHit(iXopp[jopp],iYopp[jopp]) == kUnused) 
+      if (fDigitMap[iop]->TestHit(iXopp[jopp],iYopp[jopp]) == kUnused) 
        FindCluster(iXopp[jopp], iYopp[jopp], iop, c);
     }
 
@@ -1428,40 +1429,43 @@ void  AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONR
 
 void AliMUONClusterFinderVS::FindRawClusters()
 {
-  //
-  // MUON cluster finder from digits -- finds neighbours on both cathodes and 
-  // fills the tree with raw clusters
-  //
+/// MUON cluster finder from digits -- finds neighbours on both cathodes and 
+/// fills the tree with raw clusters
 
     ResetRawClusters();
 //  Return if no input datad available
     if (!fInput->NDigits(0) && !fInput->NDigits(1)) return;
 
-    if(fInput->GetSegmentationType() == 1)
-      AliFatal("Old Segmentation no more supported.");
-
     fSeg2[0] = fInput->Segmentation2(0);
     fSeg2[1] = fInput->Segmentation2(1);
     
-    fHitMap[0]  = new AliMUONHitMapA1(fInput->DetElemId(), fSeg2[0], fInput->Digits(0));
-    fHitMap[1]  = new AliMUONHitMapA1(fInput->DetElemId(), fSeg2[1], fInput->Digits(1));
+    Int_t detElemId = fInput->DetElemId();
+    
+    Int_t npx0  = fSeg2[0]->Npx(detElemId)+1;
+    Int_t npy0  = fSeg2[0]->Npy(detElemId)+1;
+    fDigitMap[0]  = new AliMUONDigitMapA1(detElemId, npx0, npy0);
+
+    Int_t npx1  = fSeg2[0]->Npx(detElemId)+1;
+    Int_t npy1  = fSeg2[0]->Npy(detElemId)+1;
+    fDigitMap[1]  = new AliMUONDigitMapA1(detElemId, npx1, npy1);
     
     AliMUONDigit *dig;
 
     Int_t ndig, cath;
     Int_t nskip=0;
     Int_t ncls=0;
-    fHitMap[0]->FillHits();
-    fHitMap[1]->FillHits();
+
+    fDigitMap[0]->FillHits(fInput->Digits(0));
+    fDigitMap[1]->FillHits(fInput->Digits(1));
 //
 //  Outer Loop over Cathodes
-    for (cath=0; cath<2; cath++) {
+    for (cath = 0; cath < 2; cath++) {
       
        for (ndig=0; ndig<fInput->NDigits(cath); ndig++) {
          dig = fInput->Digit(cath, ndig);
          Int_t padx = dig->PadX();
          Int_t pady = dig->PadY();
-         if (fHitMap[cath]->TestHit(padx,pady)==kUsed ||fHitMap[0]->TestHit(padx,pady)==kEmpty) {
+         if (fDigitMap[cath]->TestHit(padx,pady)==kUsed ||fDigitMap[0]->TestHit(padx,pady)==kEmpty) {
            nskip++;
            continue;
          }
@@ -1533,21 +1537,21 @@ void AliMUONClusterFinderVS::FindRawClusters()
        
        } // end loop ndig
     } // end loop cathodes
-    delete fHitMap[0];
-    delete fHitMap[1];
+    delete fDigitMap[0];
+    delete fDigitMap[1];
 }
 
 Float_t AliMUONClusterFinderVS::SingleMathiesonFit(AliMUONRawCluster *c, Int_t cath)
 {
-// Performs a single Mathieson fit on one cathode
-// 
+/// Performs a single Mathieson fit on one cathode
+
     Double_t arglist[20];
     Int_t ierflag=0;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     
     clusterInput.Fitter()->SetFCN(fcnS1);
     clusterInput.Fitter()->mninit(2,10,7);
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel());
     arglist[0]=-1;
     clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
 // Set starting values 
@@ -1602,14 +1606,14 @@ Float_t AliMUONClusterFinderVS::SingleMathiesonFit(AliMUONRawCluster *c, Int_t c
 
 Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster * /*c*/)
 {
-// Perform combined Mathieson fit on both cathode planes
-//
+/// Perform combined Mathieson fit on both cathode planes
+
     Double_t arglist[20];
     Int_t ierflag=0;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     clusterInput.Fitter()->SetFCN(fcnCombiS1);
     clusterInput.Fitter()->mninit(2,10,7);
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel());
     arglist[0]=-1;
     clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
     static Double_t vstart[2];
@@ -1696,8 +1700,7 @@ Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster * /*c*
 
 Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster * /*c*/, Int_t cath)
 {
-// Performs a double Mathieson fit on one cathode
-// 
+/// Performs a double Mathieson fit on one cathode 
 
 //
 //  Initialise global variables for fit
@@ -1706,7 +1709,7 @@ Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster * /*c*/, Int
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     clusterInput.Fitter()->SetFCN(fcnS2);
     clusterInput.Fitter()->mninit(5,10,7);
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel());
     arglist[0]=-1;
     clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
 // Set starting values 
@@ -1777,15 +1780,14 @@ Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster * /*c*/, Int
 
 Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*/)
 {
-//
-// Perform combined double Mathieson fit on both cathode planes
-//
+/// Perform combined double Mathieson fit on both cathode planes
+
     Double_t arglist[20];
     Int_t ierflag=0;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     clusterInput.Fitter()->SetFCN(fcnCombiS2);
     clusterInput.Fitter()->mninit(6,10,7);
-    clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+    clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel());
     arglist[0]=-1;
     clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
 // Set starting values 
@@ -1823,7 +1825,7 @@ Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*
         fSeg2[1]->NextPad(fInput->DetElemId()))
       {
        ix=fSeg2[1]->Ix(); iy=fSeg2[1]->Iy();
-       //      if (fHitMap[1]->TestHit(ix, iy) == kEmpty) continue;
+       //      if (fDigitMap[1]->TestHit(ix, iy) == kEmpty) continue;
        fSeg2[1]->GetPadC(fInput->DetElemId(),ix,iy,upper[0],ydum,zdum);        
        if (icount ==0) lower[0]=upper[0];
        icount++;
@@ -1839,7 +1841,7 @@ Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*
         fSeg2[0]->NextPad(fInput->DetElemId()))
       {
        ix=fSeg2[0]->Ix(); iy=fSeg2[0]->Iy();
-       //      if (fHitMap[0]->TestHit(ix, iy) == kEmpty) continue;
+       //      if (fDigitMap[0]->TestHit(ix, iy) == kEmpty) continue;
        fSeg2[0]->GetPadC(fInput->DetElemId(),ix,iy,xdum,upper[1],zdum);        
        if (icount ==0) lower[1]=upper[1];
        icount++;
@@ -1866,7 +1868,7 @@ Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*
         fSeg2[1]->NextPad(fInput->DetElemId()))
       {
        ix=fSeg2[1]->Ix(); iy=fSeg2[1]->Iy();
-       //      if (fHitMap[1]->TestHit(ix, iy) == kEmpty) continue;
+       //      if (fDigitMap[1]->TestHit(ix, iy) == kEmpty) continue;
        fSeg2[1]->GetPadC(fInput->DetElemId(),ix,iy,upper[2],ydum,zdum);        
        if (icount ==0) lower[2]=upper[2];
        icount++;
@@ -1881,7 +1883,7 @@ Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*
         fSeg2[0]->NextPad(fInput->DetElemId()))
       {
        ix=fSeg2[0]->Ix(); iy=fSeg2[0]->Iy();
-       //      if (fHitMap[0]->TestHit(ix, iy) != kEmpty) continue;
+       //      if (fDigitMap[0]->TestHit(ix, iy) != kEmpty) continue;
        
        fSeg2[0]->GetPadC(fInput->DetElemId(),ix,iy,xdum,upper[3],zdum);        
        if (icount ==0) lower[3]=upper[3];
@@ -1934,9 +1936,8 @@ Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*
 
 void AliMUONClusterFinderVS::Split(AliMUONRawCluster* c)
 {
-//
-// One cluster for each maximum
-//
+/// One cluster for each maximum
+
     Int_t i, j, cath;
     AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
     for (j=0; j<2; j++) {
@@ -1983,9 +1984,8 @@ void AliMUONClusterFinderVS::Split(AliMUONRawCluster* c)
 }
 void AliMUONClusterFinderVS::AddRawCluster(AliMUONRawCluster& c)
 {
-  //
-  // Add a raw cluster copy to the list
-  //
+/// Add a raw cluster copy to the list
+
   //     AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON");
   //     pMUON->GetMUONData()->AddRawCluster(fInput->Chamber(),c); 
   //     fNRawClusters++;