]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONCluster.cxx
Removing obsolete files from build system
[u/mrichter/AliRoot.git] / MUON / AliMUONCluster.cxx
CommitLineData
99ccb7f7 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
9edefa04 18#include <Riostream.h>
19#include <TMath.h>
20#include <TObjArray.h>
21#include <TVirtualPad.h>
22#include <TVirtualX.h>
23
99ccb7f7 24#include "AliMUONCluster.h"
25
26#include "AliLog.h"
27#include "AliMUONPad.h"
99ccb7f7 28
3d1463c8 29//-----------------------------------------------------------------------------
99ccb7f7 30/// \class AliMUONCluster
31///
32/// A group of adjacent pads
33///
34/// Besides holding an internal array of AliMUONPads, this object
35/// also computes some global characteristics for that pad sets.
36///
37/// \author Laurent Aphecetche
38///
3d1463c8 39//-----------------------------------------------------------------------------
99ccb7f7 40
41/// \cond CLASSIMP
42ClassImp(AliMUONCluster)
43/// \endcond
44
45namespace
46{
47 //___________________________________________________________________________
48 Bool_t
49 ShouldUsePad(const AliMUONPad& pad,
50 Int_t cathode, Int_t statusMask, Bool_t matchMask)
51 {
52
53 // FIXME : we should only use >=0 status, so we can fully
54 // use masking possibility ?
55 if ( pad.Status() < 0 ) return kFALSE;
56
57 if ( pad.Cathode() == cathode && pad.IsReal() && !pad.IsSaturated() )
58 {
59 Bool_t test = ( ( pad.Status() & statusMask ) != 0 );
60 if ( !statusMask )
61 {
62 test = ( pad.Status() == 0 );
63 }
64 if ( ( test && matchMask ) || ( !test && !matchMask ) )
65 {
66 return kTRUE;
67 }
68 }
69 return kFALSE;
70 }
71
72 //___________________________________________________________________________
73 Int_t Unique(Int_t n, Double_t* array, Double_t precision)
74 {
75 /// Return the number of *different* elements in array
76 /// where different is up to precision
77 /// Note that we assume that n is >= 1
78
79 Int_t count(1);
80
81 Int_t* index = new Int_t[n];
82
83 TMath::Sort(n,array,index);
84
85 for ( Int_t i = 1; i < n; ++i )
86 {
87 if ( array[index[i]] - array[index[i-1]] < -precision ) ++count;
88 }
89
90 delete[] index;
91
92 return count;
93 }
94}
95
96//_____________________________________________________________________________
97AliMUONCluster::AliMUONCluster()
98: TObject(),
99fPads(0x0),
100fHasPosition(kFALSE),
101fPosition(1E9,1E9),
102fPositionError(1E9,1E9),
103fHasCharge(kFALSE),
00de388f 104fChi2(0)
99ccb7f7 105{
106 /// ctor
107 fMultiplicity[0]=fMultiplicity[1]=0;
108 fRawCharge[0]=fRawCharge[1]=0;
109 fCharge[0]=fCharge[1]=0;
110 fIsSaturated[0]=fIsSaturated[1]=kFALSE;
111}
112
113//_____________________________________________________________________________
114AliMUONCluster::AliMUONCluster(const AliMUONCluster& src)
115: TObject(src),
116fPads(0x0),
117fHasPosition(kFALSE),
118fPosition(1E9,1E9),
119fPositionError(1E9,1E9),
120fHasCharge(kFALSE),
00de388f 121fChi2(0)
99ccb7f7 122{
123 /// copy ctor
124 src.Copy(*this);
125}
126
127//_____________________________________________________________________________
128AliMUONCluster&
129AliMUONCluster::operator=(const AliMUONCluster& src)
130{
131 /// assignement operator
132 AliMUONCluster c(src);
133 c.Copy(*this);
134 return *this;
135}
136
137//_____________________________________________________________________________
138AliMUONCluster::~AliMUONCluster()
139{
140 /// dtor : note that we're owner of our pads
141 delete fPads;
142}
143
144//_____________________________________________________________________________
145void
00de388f 146AliMUONCluster::Clear(Option_t*)
147{
148 /// Clear our pad array
149 if (fPads) fPads->Clear("C");
150}
151
152//_____________________________________________________________________________
153Bool_t
154AliMUONCluster::Contains(const AliMUONPad& pad) const
155{
156 /// Whether this cluster contains the pad
157 if (!fPads) return kFALSE;
158 for ( Int_t i = 0; i < Multiplicity(); ++i )
159 {
160 AliMUONPad* p = Pad(i);
161 if ( pad.Compare(p) == 0 ) return kTRUE;
162 }
163 return kFALSE;
164}
165
166//_____________________________________________________________________________
167void
168AliMUONCluster::AddCluster(const AliMUONCluster& cluster)
169{
170 /// Add all the pads for cluster to this one
171 for ( Int_t i = 0; i < cluster.Multiplicity(); ++i )
172 {
173 AliMUONPad* p = cluster.Pad(i);
174 if ( Contains(*p) )
175 {
176 AliError("I already got this pad : ");
177 StdoutToAliError(p->Print(););
178 AliFatal("");
179 }
180 AddPad(*p);
181 }
182
183}
184
185//_____________________________________________________________________________
186AliMUONPad*
99ccb7f7 187AliMUONCluster::AddPad(const AliMUONPad& pad)
188{
189 /// Add a pad to our pad array, and update some internal information
190 /// accordingly.
99ccb7f7 191
192 if (!fPads)
193 {
194 fPads = new TObjArray(10);
195 fPads->SetOwner(kTRUE);
196 }
197 AliMUONPad* p = new AliMUONPad(pad);
198 fPads->AddLast(p);
199 p->SetClusterId(GetUniqueID());
200 Int_t cathode = p->Cathode();
201 ++(fMultiplicity[cathode]);
202 fRawCharge[cathode] += p->Charge();
203 if ( p->IsSaturated() )
204 {
205 fIsSaturated[p->Cathode()]=kTRUE;
206 }
00de388f 207 return p;
208}
209
210//___________________________________________________________________________
211TString
212AliMUONCluster::AsString() const
213{
214 /// Return a string containing a compact form of the pad list
215 TString s(Form("NPADS(%d,%d)",Multiplicity(0),Multiplicity(1)));
216
217 for (Int_t i = 0; i < Multiplicity(); ++i )
218 {
219 AliMUONPad* p = Pad(i);
220 s += Form(" (%d,%d,%d) ",p->Cathode(),p->Ix(),p->Iy());
221 }
222 return s;
223}
224
225
226//___________________________________________________________________________
227Bool_t
228AliMUONCluster::AreOverlapping(const AliMUONCluster& c1, const AliMUONCluster& c2)
229{
230 /// Whether the two clusters overlap
231
232 static Double_t precision = 1E-4; // cm
233 static TVector2 precisionAdjustment(precision,precision);
234
235 for ( Int_t i1 = 0; i1 < c1.Multiplicity(); ++i1 )
236 {
237 AliMUONPad* p1 = c1.Pad(i1);
238
239 for ( Int_t i2 = 0; i2 < c2.Multiplicity(); ++i2 )
240 {
241 AliMUONPad* p2 = c2.Pad(i2);
242 // Note: we use negative precision numbers, meaning
243 // the area of the pads will be *increased* by these small numbers
244 // prior to check the overlap by the AreOverlapping method,
245 // so pads touching only by the corners will be considered as
246 // overlapping.
247 if ( AliMUONPad::AreOverlapping(*p1,*p2,precisionAdjustment) )
248 {
249 return kTRUE;
250 }
251 }
252 }
253 return kFALSE;
99ccb7f7 254}
255
256//_____________________________________________________________________________
257AliMpArea
258AliMUONCluster::Area() const
259{
260 /// Return the geometrical area covered by this cluster
261
262 // Start by finding the (x,y) limits of this cluster
263 TVector2 lowerLeft(1E9,1E9);
264 TVector2 upperRight(-1E9,-1E9);
265
266 for ( Int_t i = 0; i < Multiplicity(); ++i )
267 {
268 AliMUONPad* pad = Pad(i);
269 TVector2 ll = pad->Position() - pad->Dimensions();
270 TVector2 ur = pad->Position() + pad->Dimensions();
271 lowerLeft.Set( TMath::Min(ll.X(),lowerLeft.X()),
272 TMath::Min(ll.Y(),lowerLeft.Y()) );
273 upperRight.Set( TMath::Max(ur.X(),upperRight.X()),
274 TMath::Max(ur.Y(),upperRight.Y()) );
275 }
276
277 // then construct the area from those limits
278 return AliMpArea((lowerLeft+upperRight)/2,
279 (upperRight-lowerLeft)/2);
280}
281
00de388f 282//_____________________________________________________________________________
283AliMpArea
284AliMUONCluster::Area(Int_t cathode) const
285{
286 /// Return the geometrical area covered by this cluster's pads on
287 /// a given cathode
288
289 // Start by finding the (x,y) limits of this cluster
290 TVector2 lowerLeft(1E9,1E9);
291 TVector2 upperRight(-1E9,-1E9);
292
293 for ( Int_t i = 0; i < Multiplicity(cathode); ++i )
294 {
295 AliMUONPad* pad = Pad(i);
296 TVector2 ll = pad->Position() - pad->Dimensions();
297 TVector2 ur = pad->Position() + pad->Dimensions();
298 lowerLeft.Set( TMath::Min(ll.X(),lowerLeft.X()),
299 TMath::Min(ll.Y(),lowerLeft.Y()) );
300 upperRight.Set( TMath::Max(ur.X(),upperRight.X()),
301 TMath::Max(ur.Y(),upperRight.Y()) );
302 }
303
304 // then construct the area from those limits
305 return AliMpArea((lowerLeft+upperRight)/2,
306 (upperRight-lowerLeft)/2);
307}
308
309//_____________________________________________________________________________
310Int_t
311AliMUONCluster::Cathode() const
312{
313 /// Return the cathode "number" of this cluster :
314 /// 0 if all its pads are on cathode 0
315 /// 1 if all its pads are on cathode 1
316 /// 2 if some pads on cath 0 and some on cath 1
317
318 Int_t cathode(-1);
319 if (Multiplicity(0)>0 && Multiplicity(1)>0)
320 {
321 cathode=2;
322 }
323 else if (Multiplicity(0)>0)
324 {
325 cathode=0;
326 }
327 else if (Multiplicity(1)>0)
328 {
329 cathode=1;
330 }
331
332 return cathode;
333}
334
99ccb7f7 335//_____________________________________________________________________________
336void
337AliMUONCluster::Copy(TObject& obj) const
338{
71a2d3aa 339 ///
340 /// Copy this cluster to (cluster&)obj
341 ///
99ccb7f7 342 TObject::Copy(obj);
343 AliMUONCluster& dest = static_cast<AliMUONCluster&>(obj);
76305a4a 344 dest.fPads = 0x0;
345 if ( fPads )
346 {
347 dest.fPads = static_cast<TObjArray*>(fPads->Clone());
348 }
99ccb7f7 349 dest.fHasPosition = fHasPosition;
350 dest.fPosition = fPosition;
351 dest.fPositionError = fPositionError;
352 dest.fHasCharge = fHasCharge;
99ccb7f7 353 dest.fChi2 = fChi2;
354 for ( Int_t i = 0; i < 2; ++i )
355 {
356 dest.fRawCharge[i] = fRawCharge[i];
357 dest.fCharge[i] = fCharge[i];
358 dest.fMultiplicity[i] = fMultiplicity[i];
359 dest.fIsSaturated[i] = fIsSaturated[i];
360 }
361}
362
363//_____________________________________________________________________________
364Float_t
365AliMUONCluster::Charge() const
366{
367 /// Return the average charge over both cathodes
368 return (Charge(0)+Charge(1))/2.0;
369}
370
371//_____________________________________________________________________________
372Float_t
373AliMUONCluster::Charge(Int_t cathode) const
374{
375 /// Returns the charge of a given cathode
376 if ( !fHasCharge ) return RawCharge(cathode);
377
378 if ( cathode == 0 || cathode == 1 )
379 {
380 return fCharge[cathode];
381 }
382 return 0;
383}
384
385//_____________________________________________________________________________
386Float_t
387AliMUONCluster::ChargeAsymmetry() const
388{
389 /// Returns the charge asymmetry
390 if ( Charge() > 0 )
391 {
392 return TMath::Abs(Charge(0)-Charge(1))/Charge();
393 }
394 return 0;
395}
396
00de388f 397//_____________________________________________________________________________
398TVector2
399AliMUONCluster::MaxPadDimensions(Int_t statusMask, Bool_t matchMask) const
400{
401 /// Returns the maximum pad dimensions (half sizes), only considering
402 /// pads matching (or not, depending matchMask) a given mask
403
404 TVector2 cath0(MaxPadDimensions(0,statusMask,matchMask));
405 TVector2 cath1(MaxPadDimensions(1,statusMask,matchMask));
406
407 return TVector2( TMath::Max(cath0.X(),cath1.X()),
408 TMath::Max(cath0.Y(),cath1.Y()) );
409}
410
411//_____________________________________________________________________________
412TVector2
413AliMUONCluster::MaxPadDimensions(Int_t cathode,
414 Int_t statusMask, Bool_t matchMask) const
415{
416 /// Returns the maximum pad dimensions (half sizes), only considering
417 /// pads matching (or not, depending matchMask) a given mask, within a
418 /// given cathode
419
420 Double_t xmax(0);
421 Double_t ymax(0);
422
423 for ( Int_t i = 0; i < Multiplicity(); ++i )
424 {
425 AliMUONPad* pad = Pad(i);
426 if ( ShouldUsePad(*pad,cathode,statusMask,matchMask) )
427 {
428 xmax = TMath::Max(xmax,pad->DX());
429 ymax = TMath::Max(ymax,pad->DY());
430 }
431 }
432 return TVector2(xmax,ymax);
433}
434
99ccb7f7 435//_____________________________________________________________________________
436TVector2
437AliMUONCluster::MinPadDimensions(Int_t statusMask, Bool_t matchMask) const
438{
439 /// Returns the minimum pad dimensions (half sizes), only considering
440 /// pads matching (or not, depending matchMask) a given mask
441
442 TVector2 cath0(MinPadDimensions(0,statusMask,matchMask));
443 TVector2 cath1(MinPadDimensions(1,statusMask,matchMask));
444
445 return TVector2( TMath::Min(cath0.X(),cath1.X()),
446 TMath::Min(cath0.Y(),cath1.Y()) );
447}
448
449//_____________________________________________________________________________
450TVector2
451AliMUONCluster::MinPadDimensions(Int_t cathode,
452 Int_t statusMask, Bool_t matchMask) const
453{
454 /// Returns the minimum pad dimensions (half sizes), only considering
455 /// pads matching (or not, depending matchMask) a given mask, within a
456 /// given cathode
457
458 Double_t xmin(1E9);
459 Double_t ymin(1E9);
460
461 for ( Int_t i = 0; i < Multiplicity(); ++i )
462 {
463 AliMUONPad* pad = Pad(i);
464 if ( ShouldUsePad(*pad,cathode,statusMask,matchMask) )
465 {
466 xmin = TMath::Min(xmin,pad->DX());
467 ymin = TMath::Min(ymin,pad->DY());
468 }
469 }
470 return TVector2(xmin,ymin);
471}
472
473//_____________________________________________________________________________
474Int_t
475AliMUONCluster::Multiplicity() const
476{
477 /// Returns the total number of pads in this cluster
478 return Multiplicity(0)+Multiplicity(1);
479}
480
481//_____________________________________________________________________________
482Int_t
483AliMUONCluster::Multiplicity(Int_t cathode) const
484{
485 /// Returns the number of pads in this cluster, in the given cathode
486 if ( cathode == 0 || cathode == 1 )
487 {
488 return fMultiplicity[cathode];
489 }
490 return 0;
491}
492
493//_____________________________________________________________________________
494AliMpIntPair
495AliMUONCluster::NofPads(Int_t statusMask, Bool_t matchMask) const
496{
497 /// Number of pads satisfying (or not, depending matchMask) a
498 /// given mask
499
500 Int_t nx, ny;
501
502 TVector2 dim0(MinPadDimensions(0,statusMask,matchMask));
503 TVector2 dim1(MinPadDimensions(1,statusMask,matchMask));
504
505 AliMpIntPair npad0(NofPads(0,statusMask,matchMask));
506 AliMpIntPair npad1(NofPads(1,statusMask,matchMask));
507
508 if ( TMath::Abs( (dim0-dim1).X() ) < 1E-3 )
509 {
510 nx = TMath::Max( npad0.GetFirst(), npad1.GetFirst() );
511 }
512 else
513 {
514 nx = dim0.X() < dim1.X() ? npad0.GetFirst() : npad1.GetFirst();
515 }
516
517 if ( TMath::Abs( (dim0-dim1).Y() ) < 1E-3 )
518 {
519 ny = TMath::Max( npad0.GetSecond(), npad1.GetSecond() );
520 }
521 else
522 {
523 ny = dim0.Y() < dim1.Y() ? npad0.GetSecond() : npad1.GetSecond();
524 }
525
526 return AliMpIntPair(nx,ny);
527}
528
529//_____________________________________________________________________________
530AliMpIntPair
531AliMUONCluster::NofPads(Int_t cathode,
532 Int_t statusMask, Bool_t matchMask) const
533{
534 /// Number of pads of a given cathode, satisfying (or not,
535 /// depending matchMask) a given mask
536
537 Int_t n = Multiplicity(cathode);
538 if (!n)
539 {
540 return AliMpIntPair(0,0);
541 }
542 Double_t* x = new Double_t[n];
543 Double_t* y = new Double_t[n];
544 Int_t np(0);
545
546 for ( Int_t i = 0; i < Multiplicity(); ++i )
547 {
548 AliMUONPad* pad = Pad(i);
549 if ( ShouldUsePad(*pad,cathode,statusMask,matchMask) )
550 {
551 x[np] = pad->X();
552 y[np] = pad->Y();
553 ++np;
554 }
555 }
556
557 Int_t cx = Unique(np,x,0.01);
558 Int_t cy = Unique(np,y,0.01);
559
560 delete[] x;
561 delete[] y;
562
563 return AliMpIntPair(cx,cy);
564}
565
566//_____________________________________________________________________________
567AliMUONPad*
568AliMUONCluster::Pad(Int_t index) const
569{
570 /// Returns the index-th pad
571
572 if (!fPads) return 0x0;
573 if ( index < fPads->GetLast()+1 )
574 {
575 return static_cast<AliMUONPad*>(fPads->At(index));
576 }
577 else
578 {
00de388f 579 AliError(Form("Requested index %d out of bounds (%d) Mult is %d",index,
580 fPads->GetLast(),Multiplicity()));
581 DumpMe();
99ccb7f7 582 }
583 return 0x0;
584}
585
586
587//_____________________________________________________________________________
588void
589AliMUONCluster::Paint(Option_t*)
590{
591 /// Paint this cluster
592 if (!Multiplicity()) return;
593
594 AliMpArea area(Area());
595
596 gPad->Range(area.LeftBorder(),area.DownBorder(),area.RightBorder(),area.UpBorder());
597
598 gVirtualX->SetFillStyle(0);
599
600 gVirtualX->SetLineColor(2);
601 gVirtualX->SetLineWidth(4);
602 for ( Int_t i = 0; i < Multiplicity(); ++i)
603 {
604 AliMUONPad* pad = Pad(i);
605 if ( pad->Cathode() == 0 ) pad->Paint();
606 }
607
608 gVirtualX->SetLineColor(4);
609 gVirtualX->SetLineWidth(2);
610 for ( Int_t i = 0; i < Multiplicity(); ++i)
611 {
612 AliMUONPad* pad = Pad(i);
613 if ( pad->Cathode() == 1 ) pad->Paint();
614 }
615
616}
617
00de388f 618//_____________________________________________________________________________
619void
620AliMUONCluster::DumpMe() const
621{
622 /// printout
623 cout << "Cluster Id " << GetUniqueID() << " npads=" << Multiplicity()
624 << "(" << Multiplicity(0) << "," << Multiplicity(1) << ") RawCharge="
625 << RawCharge() << " (" << RawCharge(0) << "," << RawCharge(1)
626 << ") Charge=(" << Charge(0) << "," << Charge(1) <<")";
627 if ( HasPosition() )
628 {
629 cout << " (x,y)=(" << Position().X() << "," << Position().Y() << ")";
630 cout << " (errX,errY)=(" << PositionError().X() << "," << PositionError().Y() << ")";
631 }
632 cout << endl;
633// cout << " " << Area() << endl;
634 if (fPads)
635 {
636 for (Int_t i = 0; i < fPads->GetSize(); ++i)
637 {
638 cout << Form("fPads[%d]=%x",i,fPads->At(i)) << endl;
639 if ( fPads->At(i) ) fPads->At(i)->Print();
640 }
641 }
642}
643
644
99ccb7f7 645//_____________________________________________________________________________
646void
647AliMUONCluster::Print(Option_t* opt) const
648{
649 /// printout
650 cout << "Cluster Id " << GetUniqueID() << " npads=" << Multiplicity()
651 << "(" << Multiplicity(0) << "," << Multiplicity(1) << ") RawCharge="
652 << RawCharge() << " (" << RawCharge(0) << "," << RawCharge(1)
97d5019e 653 << ") Charge=(" << Charge(0) << "," << Charge(1) <<")";
99ccb7f7 654 if ( HasPosition() )
655 {
656 cout << " (x,y)=(" << Position().X() << "," << Position().Y() << ")";
657 cout << " (errX,errY)=(" << PositionError().X() << "," << PositionError().Y() << ")";
658 }
00de388f 659 cout << " " << Area();
99ccb7f7 660 if (fPads)
661 {
00de388f 662 TObjArray* a = static_cast<TObjArray*>(fPads->Clone());
663 a->Sort();
664 a->Print("",opt);
665 delete a;
99ccb7f7 666 }
667}
668
669//_____________________________________________________________________________
00de388f 670//Bool_t
671//AliMUONCluster::IsEqual(const TObject* obj) const
672//{
673// const AliMUONCluster* c = static_cast<const AliMUONCluster*>(obj);
674// if ( c->Multiplicity() != Multiplicity() ) return kFALSE;
675//
676// for ( Int_t i = 0; i < c->Multiplicity(); ++i )
677// {
678// AliMUONPad* p = c->Pad(i);
679// if ( p->Compare(Pad(i)) ) return kFALSE;
680// }
681// return kTRUE;
682//}
683
684//_____________________________________________________________________________
685Int_t
686AliMUONCluster::Compare(const TObject* obj) const
99ccb7f7 687{
00de388f 688 /// Compare two clusters. Comparison is made on position and rawcharge only.
689
690 const AliMUONCluster* cluster = static_cast<const AliMUONCluster*>(obj);
691
692 AliMpArea carea(cluster->Area());
693 AliMpArea area(Area());
694
695 if ( carea.Position().X() > area.Position().X() )
696 {
697 return 1;
698 }
699 else if ( carea.Position().X() < area.Position().X() )
700 {
701 return -1;
702 }
703 else
704 {
705 if ( carea.Position().Y() > area.Position().Y() )
706 {
707 return 1;
708 }
709 else if ( carea.Position().Y() < area.Position().Y() )
710 {
711 return -1;
712 }
713 else
714 {
715 if ( cluster->RawCharge() > RawCharge() )
716 {
717 return 1;
718 }
719 else if ( cluster->RawCharge() < RawCharge() )
720 {
721 return -1;
722 }
723 }
724 }
725 return 0;
99ccb7f7 726}
727
728//_____________________________________________________________________________
729void
730AliMUONCluster::RemovePad(AliMUONPad* pad)
731{
732 /// Remove a pad.
733 /// As a consequence, some internal information must be updated
734
735 fPads->Remove(pad);
736 fPads->Compress();
737 // update cluster's data
738 fIsSaturated[0]=fIsSaturated[1]=kFALSE;
739 fMultiplicity[0]=fMultiplicity[1]=0;
740 fRawCharge[0]=fRawCharge[1]=0;
741 for ( Int_t i = 0; i <= fPads->GetLast(); ++i )
742 {
743 AliMUONPad* p = Pad(i);
744 if ( p->IsSaturated() )
745 {
746 fIsSaturated[p->Cathode()] = kTRUE;
747 }
748 ++fMultiplicity[p->Cathode()];
749 fRawCharge[p->Cathode()] += p->Charge();
750 }
99ccb7f7 751}
752
753//_____________________________________________________________________________
754Float_t
755AliMUONCluster::RawCharge() const
756{
757 /// Returns the raw average charge
758 return (RawCharge(0)+RawCharge(1))/2.0;
759}
760
761//_____________________________________________________________________________
762Float_t
763AliMUONCluster::RawCharge(Int_t cathode) const
764{
765 /// Returns the average charge of a given cathode
766 if ( cathode == 0 || cathode == 1 )
767 {
768 return fRawCharge[cathode];
769 }
770 return 0;
771}
772
773//_____________________________________________________________________________
774Float_t
775AliMUONCluster::RawChargeAsymmetry() const
776{
777 /// Returns the raw charge asymmetry
778 if ( RawCharge() > 0 )
779 {
780 return TMath::Abs(RawCharge(0)-RawCharge(1))/RawCharge();
781 }
782 return 0;
783}