* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.21 2001/05/18 08:54:59 morsch
-Bug in decision on splitting corrected.
-
-Revision 1.20 2001/04/12 12:22:26 morsch
-- some numerical problems caused by pad staggering cured.
-- treatment of 1-2 and 2-1 ghosts
-- debuglevel > 1 prints introduced
-
-Revision 1.19 2001/03/20 13:32:10 egangler
-Code introduced to remove ghosts with the charge correlation between the 2
-cathods. A chi2 is performed for the 2 possibilities.
-If one gets good chi2 (with respect to the fGhostChi2Cut parameter) and the
-other wrong chi2, the ambiguity is solved
-If both gets good or both bad chi2, no choice is made
-By default the fGhostChi2Cut parameter is set to solve about 70% of ghost
-problems with about 2% errors, with the current version of the code.
-
-Implementation :
-fGhostChi2Cut is in AliMUONClusterFinderVS, with setters and getters.
-a fDebugLevel was also introduced to switch off some of the output.
-When an ambiguity is detected and not solved, the fGhost word in
-AliMUONRawCluster is set to 1 or 2, depending whether both charge chi2 are
-good or bad.
-a DumpIndex method was also added in AliMUONRawCluster to produce a printout
-of digit indexes.
-
-User incidences :
-By default, the code makes ghost check. If you want previous behaviour,
-put in MUONrawclusters the value of SetGhostChi2Cut to infinity (1e.6) is
-sufficient.
-
-Revision 1.18 2001/01/26 21:37:53 morsch
-Use access functions to AliMUONDigit member data.
-
-Revision 1.17 2001/01/23 18:58:19 hristov
-Initialisation of some pointers
-
-Revision 1.16 2000/12/21 23:27:30 morsch
-Error in argument list of AddRawCluster corrected.
-
-Revision 1.15 2000/12/21 22:14:38 morsch
-Clean-up of coding rule violations.
-
-Revision 1.14 2000/10/23 16:03:45 morsch
-Correct z-position of all clusters created "on the flight".
-
-Revision 1.13 2000/10/23 13:38:23 morsch
-Set correct z-coordinate when cluster is split.
-
-Revision 1.12 2000/10/18 11:42:06 morsch
-- AliMUONRawCluster contains z-position.
-- Some clean-up of useless print statements during initialisations.
-
-Revision 1.11 2000/10/06 09:04:05 morsch
-- Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate
- to make code work with slat chambers (AM)
-- Replace GetPadI calls with unchecked x,y coordinates by pad iterator calls wherever possible.
-
-Revision 1.10 2000/10/03 13:51:57 egangler
-Removal of useless dependencies via forward declarations
-
-Revision 1.9 2000/10/02 16:58:29 egangler
-Cleaning of the code :
--> coding conventions
--> void Streamers
--> some useless includes removed or replaced by "class" statement
-
-Revision 1.8 2000/07/03 11:54:57 morsch
-AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
-The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
-
-Revision 1.7 2000/06/28 15:16:35 morsch
-(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
-to allow development of slat-muon chamber simulation and reconstruction code in the MUON
-framework. The changes should have no side effects (mostly dummy arguments).
-(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
-of chambers with overlapping modules (MakePadHits, Disintegration).
-
-Revision 1.6 2000/06/28 12:19:18 morsch
-More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
-cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
-AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
-It requires two cathode planes. Small modifications in the code will make it usable for
-one cathode plane and, hence, more general (for test beam data).
-AliMUONClusterFinder is now obsolete.
-
-Revision 1.5 2000/06/28 08:06:10 morsch
-Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
-algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
-It also naturally takes care of the TMinuit instance.
-
-Revision 1.4 2000/06/27 16:18:47 gosset
-Finally correct implementation of xm, ym, ixm, iym sizes
-when at least three local maxima on cathode 1 or on cathode 2
-
-Revision 1.3 2000/06/22 14:02:45 morsch
-Parameterised size of xm[], ym[], ixm[], iym[] correctly implemented (PH)
-Some HP scope problems corrected (PH)
-
-Revision 1.2 2000/06/15 07:58:48 morsch
-Code from MUON-dev joined
-
-Revision 1.1.2.3 2000/06/09 21:58:33 morsch
-Most coding rule violations corrected.
-
-Revision 1.1.2.2 2000/02/15 08:33:52 morsch
-Error in calculation of contribution map for double clusters (Split method) corrected (A.M.)
-Error in determination of track list for double cluster (FillCluster method) corrected (A.M.)
-Revised and extended SplitByLocalMaxima method (Isabelle Chevrot):
- - For clusters with more than 2 maxima on one of the cathode planes all valid
- combinations of maxima on the two cathodes are preserved. The position of the maxima is
- taken as the hit position.
- - New FillCluster method with 2 arguments to find tracks associated to the clusters
- defined above added. (Method destinction by argument list not very elegant in this case,
- should be revides (A.M.)
- - Bug in if-statement to handle maximum 1 maximum per plane corrected
- - Two cluster per cathode but only 1 combination valid is handled.
- - More rigerous treatment of 1-2 and 2-1 combinations of maxima.
-*/
+/* $Id$ */
#include "AliMUONClusterFinderVS.h"
#include "AliMUONDigit.h"
ClassImp(AliMUONClusterFinderVS)
- AliMUONClusterFinderVS::AliMUONClusterFinderVS()
+AliMUONClusterFinderVS::AliMUONClusterFinderVS()
{
// Default constructor
fInput=AliMUONClusterInput::Instance();
for (Int_t j=0; j<2; j++) {
fDig[i][j] = 0;
}
- }
+ }
+ fRawClusters = new TClonesArray("AliMUONRawCluster",1000);
+ fNRawClusters = 0;
+
+
+}
+ //____________________________________________________________________________
+AliMUONClusterFinderVS::~AliMUONClusterFinderVS()
+{
+ // Reset tracks information
+ fNRawClusters = 0;
+ if (fRawClusters) {
+ fRawClusters->Delete();
+ delete fRawClusters;
+ }
}
-AliMUONClusterFinderVS::AliMUONClusterFinderVS(
- const AliMUONClusterFinderVS & clusterFinder)
+AliMUONClusterFinderVS::AliMUONClusterFinderVS(const AliMUONClusterFinderVS & clusterFinder):TObject(clusterFinder)
{
// Dummy copy Constructor
;
}
-
+//____________________________________________________________________________
+void AliMUONClusterFinderVS::ResetRawClusters()
+{
+ // Reset tracks information
+ fNRawClusters = 0;
+ if (fRawClusters) fRawClusters->Clear();
+}
+//____________________________________________________________________________
void AliMUONClusterFinderVS::Decluster(AliMUONRawCluster *cluster)
{
// Decluster by local maxima
SplitByLocalMaxima(cluster);
}
-
+//____________________________________________________________________________
void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c)
{
// Split complex cluster by local maxima
AddRawCluster(*c);
// If not try combined double Mathieson Fit
} else {
+ if (fDebugLevel)
fprintf(stderr," MAUVAIS CHI2 !!!\n");
if (fNLocal[0]==1 && fNLocal[1]==1) {
fXInit[0]=fX[fIndLocal[0][1]][1];
// chi2_2->Fill(chi2);
// Was this any better ??
- fprintf(stderr," Old and new chi2 %f %f ", oldchi2, chi2);
+ if (fDebugLevel)
+ fprintf(stderr," Old and new chi2 %f %f ", oldchi2, chi2);
if (fFitStat!=0 && chi2>0 && (2.*chi2 < oldchi2)) {
+ if (fDebugLevel)
fprintf(stderr," Split\n");
// Split cluster into two according to fit result
Split(c);
} else {
+ if (fDebugLevel)
fprintf(stderr," Don't Split\n");
// Don't split
AddRawCluster(*c);
accepted[ico]=kFALSE;
}
}
- printf("\n iacc= %d:\n", iacc);
+ if (fDebugLevel)
+ printf("\n iacc= %d:\n", iacc);
if (iacc == 3) {
if (accepted[0] && accepted[1]) {
if (dr[0] >= dr[1]) {
}
- printf("\n iacc= %d:\n", iacc);
if (fDebugLevel) {
+ printf("\n iacc= %d:\n", iacc);
if (iacc==2) {
fprintf(stderr,"\n iacc=2: No problem ! \n");
} else if (iacc==4) {
}
}
-void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* c)
+void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/)
{
// Find all local maxima of a cluster
if (fDebugLevel)
// fills the tree with raw clusters
//
+ ResetRawClusters();
// Return if no input datad available
if (!fInput->NDigits(0) && !fInput->NDigits(1)) return;
fSector= fSeg[cath]->Sector(i,j)/100;
if (fDebugLevel)
printf("\n New Seed %d %d ", i,j);
-
+
+
FindCluster(i,j,cath,c);
// ^^^^^^^^^^^^^^^^^^^^^^^^
// center of gravity
- c.fX[0] /= c.fQ[0];
+ if (c.fX[0]!=0.) c.fX[0] /= c.fQ[0];
// Force on anod
c.fX[0]=fSeg[0]->GetAnod(c.fX[0]);
- c.fY[0] /= c.fQ[0];
- c.fX[1] /= c.fQ[1];
-// Force on anod
+ if (c.fY[0]!=0.) c.fY[0] /= c.fQ[0];
+
+ if(c.fQ[1]!=0.) c.fX[1] /= c.fQ[1];
+
+ // Force on anod
c.fX[1]=fSeg[0]->GetAnod(c.fX[1]);
- c.fY[1] /= c.fQ[1];
+ if(c.fQ[1]!=0.) c.fY[1] /= c.fQ[1];
c.fZ[0] = fZPlane;
c.fZ[1] = fZPlane;
{
// 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);
- Double_t arglist[20];
- Int_t ierflag=0;
- arglist[0]=1;
+ clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+ arglist[0]=-1;
+ clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
// Set starting values
static Double_t vstart[2];
vstart[0]=c->fX[1];
clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag);
clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag);
// ready for minimisation
- clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
- if (fDebugLevel==0)
- clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
arglist[0]= -1;
arglist[1]= 0;
clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+ // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
Double_t fmin, fedm, errdef;
Int_t npari, nparx, istat;
return fmin;
}
-Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster *c)
+Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster * /*c*/)
{
// 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);
- Double_t arglist[20];
- Int_t ierflag=0;
- arglist[0]=1;
+ clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+ arglist[0]=-1;
+ clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
static Double_t vstart[2];
vstart[0]=fXInit[0];
vstart[1]=fYInit[0];
clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag);
clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag);
// ready for minimisation
- clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
- if (fDebugLevel==0)
- clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
arglist[0]= -1;
arglist[1]= 0;
clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+ // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
Double_t fmin, fedm, errdef;
Int_t npari, nparx, istat;
return fmin;
}
-Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster *c, Int_t cath)
+Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster * /*c*/, Int_t cath)
{
// Performs a double Mathieson fit on one cathode
//
//
// Initialise global variables for fit
+ Double_t arglist[20];
+ Int_t ierflag=0;
AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
clusterInput.Fitter()->SetFCN(fcnS2);
clusterInput.Fitter()->mninit(5,10,7);
- Double_t arglist[20];
- Int_t ierflag=0;
- arglist[0]=1;
+ clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+ arglist[0]=-1;
+ clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
// Set starting values
static Double_t vstart[5];
vstart[0]=fX[fIndLocal[0][cath]][cath];
clusterInput.Fitter()->mnparm(3,"y2",vstart[3],step[3],lower[3],upper[3],ierflag);
clusterInput.Fitter()->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag);
// ready for minimisation
- clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
- if (fDebugLevel==0)
- clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
arglist[0]= -1;
arglist[1]= 0;
clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+ // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
// Get fitted parameters
Double_t xrec[2], yrec[2], qfrac;
TString chname;
return kTRUE;
}
-Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster *c)
+Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*/)
{
//
// 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);
- Double_t arglist[20];
- Int_t ierflag=0;
- arglist[0]=1;
+ clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
+ arglist[0]=-1;
+ clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
// Set starting values
static Double_t vstart[6];
vstart[0]=fXInit[0];
clusterInput.Fitter()->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag);
clusterInput.Fitter()->mnparm(5,"a1",vstart[5],step[5],lower[5],upper[5],ierflag);
// ready for minimisation
- clusterInput.Fitter()->SetPrintLevel(-1+fDebugLevel);
- if (fDebugLevel)
- clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("SET OUT", arglist, 0, ierflag);
arglist[0]= -1;
arglist[1]= 0;
clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag);
clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag);
- clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
+ // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag);
// Get fitted parameters
TString chname;
Double_t epxz, b1, b2;
//
// Minimisation functions
// Single Mathieson
-void fcnS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnS1(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
{
AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
Int_t i;
f=chisq;
}
-void fcnCombiS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnCombiS1(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
{
AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
Int_t i, cath;
}
// Double Mathieson
-void fcnS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnS2(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
{
AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
Int_t i;
}
// Double Mathieson
-void fcnCombiS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
+void fcnCombiS2(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/)
{
AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance());
Int_t i, cath;
f=chisq;
}
-void AliMUONClusterFinderVS::AddRawCluster(const AliMUONRawCluster c)
+void AliMUONClusterFinderVS::AddRawCluster(const AliMUONRawCluster& c)
{
//
// Add a raw cluster copy to the list
//
- AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON");
- pMUON->AddRawCluster(fInput->Chamber(),c);
- fNRawClusters++;
-// if (fDebugLevel)
+
+// AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON");
+// pMUON->GetMUONData()->AddRawCluster(fInput->Chamber(),c);
+// fNRawClusters++;
+
+
+ TClonesArray &lrawcl = *fRawClusters;
+ new(lrawcl[fNRawClusters++]) AliMUONRawCluster(c);
+ if (fDebugLevel)
fprintf(stderr,"\nfNRawClusters %d\n",fNRawClusters);
}
}
AliMUONClusterFinderVS& AliMUONClusterFinderVS
-::operator = (const AliMUONClusterFinderVS& rhs)
+::operator = (const AliMUONClusterFinderVS& /*rhs*/)
{
// Dummy assignment operator
return *this;