AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONClusterFinderCOG.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 
16 // $Id$
17 
19 
20 #include "AliLog.h"
21 #include "AliMUONCluster.h"
22 #include "AliMUONVDigit.h"
23 #include "AliMUONPad.h"
24 #include "AliMpArea.h"
25 #include "TVector2.h"
26 #include "AliMUONVDigitStore.h"
27 
28 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
42 
46 
47 //_____________________________________________________________________________
50 fPreClusterFinder(clusterFinder)
51 {
53 }
54 
55 //_____________________________________________________________________________
57 {
59  delete fPreClusterFinder;
60 }
61 
62 //_____________________________________________________________________________
63 Bool_t
65  TObjArray* pads[2],
66  const AliMpArea& area)
67 {
69 
70  return fPreClusterFinder->Prepare(detElemId,pads,area);
71 }
72 
73 //_____________________________________________________________________________
76 {
78 
79  if ( !fPreClusterFinder ) return 0x0;
81  if ( cluster )
82  {
83  ComputePosition(*cluster);
84 
85  if ( cluster->Charge() < 1.0675 ) // JC: adc -> fc
86  {
87  // skip that one
88  return NextCluster();
89  }
90  }
91  return cluster;
92 }
93 
94 //_____________________________________________________________________________
95 void
97 {
99 
100  Double_t xmin = 1E9;
101  Double_t ymin = 1E9;
102  Double_t xmax = -1E9;
103  Double_t ymax = -1E9;
104 
105  Double_t x[] = { 0.0, 0.0 };
106  Double_t y[] = { 0.0, 0.0 };
107 
108  Double_t xsize[] = { 0.0, 0.0 } ;
109  Double_t ysize[] = { 0.0, 0.0 } ;
110 
111  for ( Int_t cathode = 0; cathode < 2; ++cathode )
112  {
113  for ( Int_t i = 0; i < cluster.Multiplicity(); ++i )
114  {
115  AliMUONPad* pad = cluster.Pad(i);
116  TVector2 padPosition = pad->Position();
117  AliMpArea area(pad->X(), pad->Y(), pad->DX(), pad->DY());
118  xmin = TMath::Min(area.LeftBorder(),xmin);
119  xmax = TMath::Max(area.RightBorder(),xmax);
120  ymin = TMath::Min(area.DownBorder(),ymin);
121  ymax = TMath::Max(area.UpBorder(),ymax);
122  if ( cathode == pad->Cathode() )
123  {
124  x[cathode] += padPosition.X()*pad->Charge();
125  y[cathode] += padPosition.Y()*pad->Charge();
126  xsize[cathode] += pad->Dimensions().X();
127  ysize[cathode] += pad->Dimensions().Y();
128  }
129  }
130  if ( cluster.Charge(cathode) )
131  {
132  x[cathode] /= cluster.Charge(cathode);
133  y[cathode] /= cluster.Charge(cathode);
134  }
135  if ( cluster.Multiplicity(cathode) )
136  {
137  xsize[cathode] /= cluster.Multiplicity(cathode);
138  ysize[cathode] /= cluster.Multiplicity(cathode);
139  }
140  }
141 
142  Double_t xCOG = 0;
143  Double_t yCOG = 0;
144 
145  // take the positions from the direction with the better resolution
146  xCOG = ( xsize[0] < xsize[1] ) ? x[0] : x[1];
147  yCOG = ( ysize[0] < ysize[1] ) ? y[0] : y[1];
148 
149  AliDebug(1,Form("Cluster mult %d (x,y)=(%e,%e) boundaries=(xmin,ymin,xmax,ymax)=(%e,%e,%e,%e)"
150  " (x0,y0,x1,y1)=(%e,%e,%e,%e) ",
151  cluster.Multiplicity(),xCOG,yCOG,xmin,ymin,xmax,ymax,
152  x[0],y[0],x[1],y[1]));
153 
154  cluster.SetPosition(TVector2(xCOG,yCOG),cluster.Pad(0)->Dimensions()); // FIXME: what to put as an error here ?
155 }
156 
157 
158 
Interface of a cluster finder.
void ComputePosition(AliMUONCluster &cluster)
#define TObjArray
A group of adjacent pads.
TVector2 Dimensions() const
Return half dimensions in x and y (cm)
Definition: AliMUONPad.h:56
A rectangle area positioned in plane..
Definition: AliMpArea.h:20
Double_t DY() const
Return half dimensions in y (cm)
Definition: AliMUONPad.h:61
Int_t Multiplicity() const
virtual Bool_t Prepare(Int_t detElemId, TObjArray *pads[2], const AliMpArea &area)
void SetPosition(const TVector2 &pos, const TVector2 &errorOnPos)
Set (x,y) of that cluster and errors.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Double_t Y() const
Return position in y (cm)
Definition: AliMUONPad.h:128
return clusterFinder
Double_t X() const
Return position in x (cm)
Definition: AliMUONPad.h:126
A very basic (and mostly useless, probably) cluster finder.
Int_t Cathode() const
Return cathode number.
Definition: AliMUONPad.h:43
virtual Bool_t Prepare(Int_t detElemId, TObjArray *pads[2], const AliMpArea &area)
TVector2 Position() const
Return positions in x and y (cm)
Definition: AliMUONPad.h:85
Float_t Charge() const
virtual AliMUONCluster * NextCluster()=0
AliMUONVClusterFinder * fPreClusterFinder
the preclustering we use
Double_t Charge() const
Return pad charge.
Definition: AliMUONPad.h:48
virtual AliMUONCluster * NextCluster()
AliMUONPad * Pad(Int_t index) const
Combination of digit and mppad informations.
Definition: AliMUONPad.h:25
Double_t DX() const
Return half dimensions in x (cm)
Definition: AliMUONPad.h:59