/* $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);
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;
//____________________________________________________________________________
AliMUONClusterFinderVS::~AliMUONClusterFinderVS()
{
+/// Destructor
+
// Reset tracks information
fNRawClusters = 0;
if (fRawClusters) {
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);
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;
// 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);
// 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
// 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
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;
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;
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();
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
//
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);
}
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));
//
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);
}
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;
}
} // 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
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];
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
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
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
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++;
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++;
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++;
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];
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++) {
}
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++;