]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONCluster.cxx
Added method GetDeltaForBranch getting the delta transformation, for a sensitive...
[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
cd1f0e79 293 for ( Int_t i = 0; i < Multiplicity(); ++i )
00de388f 294 {
295 AliMUONPad* pad = Pad(i);
cd1f0e79 296 if ( pad->Cathode() == cathode )
297 {
298 TVector2 ll = pad->Position() - pad->Dimensions();
299 TVector2 ur = pad->Position() + pad->Dimensions();
300 lowerLeft.Set( TMath::Min(ll.X(),lowerLeft.X()),
301 TMath::Min(ll.Y(),lowerLeft.Y()) );
302 upperRight.Set( TMath::Max(ur.X(),upperRight.X()),
303 TMath::Max(ur.Y(),upperRight.Y()) );
304 }
00de388f 305 }
306
307 // then construct the area from those limits
308 return AliMpArea((lowerLeft+upperRight)/2,
309 (upperRight-lowerLeft)/2);
310}
311
312//_____________________________________________________________________________
313Int_t
314AliMUONCluster::Cathode() const
315{
316 /// Return the cathode "number" of this cluster :
317 /// 0 if all its pads are on cathode 0
318 /// 1 if all its pads are on cathode 1
319 /// 2 if some pads on cath 0 and some on cath 1
320
321 Int_t cathode(-1);
322 if (Multiplicity(0)>0 && Multiplicity(1)>0)
323 {
324 cathode=2;
325 }
326 else if (Multiplicity(0)>0)
327 {
328 cathode=0;
329 }
330 else if (Multiplicity(1)>0)
331 {
332 cathode=1;
333 }
334
335 return cathode;
336}
337
99ccb7f7 338//_____________________________________________________________________________
339void
340AliMUONCluster::Copy(TObject& obj) const
341{
71a2d3aa 342 ///
343 /// Copy this cluster to (cluster&)obj
344 ///
99ccb7f7 345 TObject::Copy(obj);
346 AliMUONCluster& dest = static_cast<AliMUONCluster&>(obj);
76305a4a 347 dest.fPads = 0x0;
348 if ( fPads )
349 {
350 dest.fPads = static_cast<TObjArray*>(fPads->Clone());
351 }
99ccb7f7 352 dest.fHasPosition = fHasPosition;
353 dest.fPosition = fPosition;
354 dest.fPositionError = fPositionError;
355 dest.fHasCharge = fHasCharge;
99ccb7f7 356 dest.fChi2 = fChi2;
357 for ( Int_t i = 0; i < 2; ++i )
358 {
359 dest.fRawCharge[i] = fRawCharge[i];
360 dest.fCharge[i] = fCharge[i];
361 dest.fMultiplicity[i] = fMultiplicity[i];
362 dest.fIsSaturated[i] = fIsSaturated[i];
363 }
364}
365
366//_____________________________________________________________________________
367Float_t
368AliMUONCluster::Charge() const
369{
370 /// Return the average charge over both cathodes
371 return (Charge(0)+Charge(1))/2.0;
372}
373
374//_____________________________________________________________________________
375Float_t
376AliMUONCluster::Charge(Int_t cathode) const
377{
378 /// Returns the charge of a given cathode
379 if ( !fHasCharge ) return RawCharge(cathode);
380
381 if ( cathode == 0 || cathode == 1 )
382 {
383 return fCharge[cathode];
384 }
385 return 0;
386}
387
388//_____________________________________________________________________________
389Float_t
390AliMUONCluster::ChargeAsymmetry() const
391{
392 /// Returns the charge asymmetry
393 if ( Charge() > 0 )
394 {
395 return TMath::Abs(Charge(0)-Charge(1))/Charge();
396 }
397 return 0;
398}
399
00de388f 400//_____________________________________________________________________________
401TVector2
402AliMUONCluster::MaxPadDimensions(Int_t statusMask, Bool_t matchMask) const
403{
404 /// Returns the maximum pad dimensions (half sizes), only considering
405 /// pads matching (or not, depending matchMask) a given mask
406
407 TVector2 cath0(MaxPadDimensions(0,statusMask,matchMask));
408 TVector2 cath1(MaxPadDimensions(1,statusMask,matchMask));
409
410 return TVector2( TMath::Max(cath0.X(),cath1.X()),
411 TMath::Max(cath0.Y(),cath1.Y()) );
412}
413
414//_____________________________________________________________________________
415TVector2
416AliMUONCluster::MaxPadDimensions(Int_t cathode,
417 Int_t statusMask, Bool_t matchMask) const
418{
419 /// Returns the maximum pad dimensions (half sizes), only considering
420 /// pads matching (or not, depending matchMask) a given mask, within a
421 /// given cathode
422
423 Double_t xmax(0);
424 Double_t ymax(0);
425
426 for ( Int_t i = 0; i < Multiplicity(); ++i )
427 {
428 AliMUONPad* pad = Pad(i);
429 if ( ShouldUsePad(*pad,cathode,statusMask,matchMask) )
430 {
431 xmax = TMath::Max(xmax,pad->DX());
432 ymax = TMath::Max(ymax,pad->DY());
433 }
434 }
435 return TVector2(xmax,ymax);
436}
437
99ccb7f7 438//_____________________________________________________________________________
439TVector2
440AliMUONCluster::MinPadDimensions(Int_t statusMask, Bool_t matchMask) const
441{
442 /// Returns the minimum pad dimensions (half sizes), only considering
443 /// pads matching (or not, depending matchMask) a given mask
444
445 TVector2 cath0(MinPadDimensions(0,statusMask,matchMask));
446 TVector2 cath1(MinPadDimensions(1,statusMask,matchMask));
447
448 return TVector2( TMath::Min(cath0.X(),cath1.X()),
449 TMath::Min(cath0.Y(),cath1.Y()) );
450}
451
452//_____________________________________________________________________________
453TVector2
454AliMUONCluster::MinPadDimensions(Int_t cathode,
455 Int_t statusMask, Bool_t matchMask) const
456{
457 /// Returns the minimum pad dimensions (half sizes), only considering
458 /// pads matching (or not, depending matchMask) a given mask, within a
459 /// given cathode
460
461 Double_t xmin(1E9);
462 Double_t ymin(1E9);
463
464 for ( Int_t i = 0; i < Multiplicity(); ++i )
465 {
466 AliMUONPad* pad = Pad(i);
467 if ( ShouldUsePad(*pad,cathode,statusMask,matchMask) )
468 {
469 xmin = TMath::Min(xmin,pad->DX());
470 ymin = TMath::Min(ymin,pad->DY());
471 }
472 }
473 return TVector2(xmin,ymin);
474}
475
476//_____________________________________________________________________________
477Int_t
478AliMUONCluster::Multiplicity() const
479{
480 /// Returns the total number of pads in this cluster
481 return Multiplicity(0)+Multiplicity(1);
482}
483
484//_____________________________________________________________________________
485Int_t
486AliMUONCluster::Multiplicity(Int_t cathode) const
487{
488 /// Returns the number of pads in this cluster, in the given cathode
489 if ( cathode == 0 || cathode == 1 )
490 {
491 return fMultiplicity[cathode];
492 }
493 return 0;
494}
495
496//_____________________________________________________________________________
497AliMpIntPair
498AliMUONCluster::NofPads(Int_t statusMask, Bool_t matchMask) const
499{
500 /// Number of pads satisfying (or not, depending matchMask) a
501 /// given mask
502
503 Int_t nx, ny;
504
505 TVector2 dim0(MinPadDimensions(0,statusMask,matchMask));
506 TVector2 dim1(MinPadDimensions(1,statusMask,matchMask));
507
508 AliMpIntPair npad0(NofPads(0,statusMask,matchMask));
509 AliMpIntPair npad1(NofPads(1,statusMask,matchMask));
510
511 if ( TMath::Abs( (dim0-dim1).X() ) < 1E-3 )
512 {
513 nx = TMath::Max( npad0.GetFirst(), npad1.GetFirst() );
514 }
515 else
516 {
517 nx = dim0.X() < dim1.X() ? npad0.GetFirst() : npad1.GetFirst();
518 }
519
520 if ( TMath::Abs( (dim0-dim1).Y() ) < 1E-3 )
521 {
522 ny = TMath::Max( npad0.GetSecond(), npad1.GetSecond() );
523 }
524 else
525 {
526 ny = dim0.Y() < dim1.Y() ? npad0.GetSecond() : npad1.GetSecond();
527 }
528
529 return AliMpIntPair(nx,ny);
530}
531
532//_____________________________________________________________________________
533AliMpIntPair
534AliMUONCluster::NofPads(Int_t cathode,
535 Int_t statusMask, Bool_t matchMask) const
536{
537 /// Number of pads of a given cathode, satisfying (or not,
538 /// depending matchMask) a given mask
539
540 Int_t n = Multiplicity(cathode);
541 if (!n)
542 {
543 return AliMpIntPair(0,0);
544 }
545 Double_t* x = new Double_t[n];
546 Double_t* y = new Double_t[n];
547 Int_t np(0);
548
549 for ( Int_t i = 0; i < Multiplicity(); ++i )
550 {
551 AliMUONPad* pad = Pad(i);
552 if ( ShouldUsePad(*pad,cathode,statusMask,matchMask) )
553 {
554 x[np] = pad->X();
555 y[np] = pad->Y();
556 ++np;
557 }
558 }
559
560 Int_t cx = Unique(np,x,0.01);
561 Int_t cy = Unique(np,y,0.01);
562
563 delete[] x;
564 delete[] y;
565
566 return AliMpIntPair(cx,cy);
567}
568
569//_____________________________________________________________________________
570AliMUONPad*
571AliMUONCluster::Pad(Int_t index) const
572{
573 /// Returns the index-th pad
574
575 if (!fPads) return 0x0;
576 if ( index < fPads->GetLast()+1 )
577 {
578 return static_cast<AliMUONPad*>(fPads->At(index));
579 }
580 else
581 {
00de388f 582 AliError(Form("Requested index %d out of bounds (%d) Mult is %d",index,
583 fPads->GetLast(),Multiplicity()));
584 DumpMe();
99ccb7f7 585 }
586 return 0x0;
587}
588
589
590//_____________________________________________________________________________
591void
592AliMUONCluster::Paint(Option_t*)
593{
594 /// Paint this cluster
595 if (!Multiplicity()) return;
596
597 AliMpArea area(Area());
598
599 gPad->Range(area.LeftBorder(),area.DownBorder(),area.RightBorder(),area.UpBorder());
600
601 gVirtualX->SetFillStyle(0);
602
603 gVirtualX->SetLineColor(2);
604 gVirtualX->SetLineWidth(4);
605 for ( Int_t i = 0; i < Multiplicity(); ++i)
606 {
607 AliMUONPad* pad = Pad(i);
608 if ( pad->Cathode() == 0 ) pad->Paint();
609 }
610
611 gVirtualX->SetLineColor(4);
612 gVirtualX->SetLineWidth(2);
613 for ( Int_t i = 0; i < Multiplicity(); ++i)
614 {
615 AliMUONPad* pad = Pad(i);
616 if ( pad->Cathode() == 1 ) pad->Paint();
617 }
618
619}
620
00de388f 621//_____________________________________________________________________________
622void
623AliMUONCluster::DumpMe() const
624{
625 /// printout
626 cout << "Cluster Id " << GetUniqueID() << " npads=" << Multiplicity()
627 << "(" << Multiplicity(0) << "," << Multiplicity(1) << ") RawCharge="
628 << RawCharge() << " (" << RawCharge(0) << "," << RawCharge(1)
629 << ") Charge=(" << Charge(0) << "," << Charge(1) <<")";
630 if ( HasPosition() )
631 {
632 cout << " (x,y)=(" << Position().X() << "," << Position().Y() << ")";
633 cout << " (errX,errY)=(" << PositionError().X() << "," << PositionError().Y() << ")";
634 }
635 cout << endl;
636// cout << " " << Area() << endl;
637 if (fPads)
638 {
639 for (Int_t i = 0; i < fPads->GetSize(); ++i)
640 {
641 cout << Form("fPads[%d]=%x",i,fPads->At(i)) << endl;
642 if ( fPads->At(i) ) fPads->At(i)->Print();
643 }
644 }
645}
646
647
99ccb7f7 648//_____________________________________________________________________________
649void
650AliMUONCluster::Print(Option_t* opt) const
651{
652 /// printout
653 cout << "Cluster Id " << GetUniqueID() << " npads=" << Multiplicity()
654 << "(" << Multiplicity(0) << "," << Multiplicity(1) << ") RawCharge="
655 << RawCharge() << " (" << RawCharge(0) << "," << RawCharge(1)
97d5019e 656 << ") Charge=(" << Charge(0) << "," << Charge(1) <<")";
99ccb7f7 657 if ( HasPosition() )
658 {
659 cout << " (x,y)=(" << Position().X() << "," << Position().Y() << ")";
660 cout << " (errX,errY)=(" << PositionError().X() << "," << PositionError().Y() << ")";
661 }
00de388f 662 cout << " " << Area();
99ccb7f7 663 if (fPads)
664 {
00de388f 665 TObjArray* a = static_cast<TObjArray*>(fPads->Clone());
666 a->Sort();
667 a->Print("",opt);
668 delete a;
99ccb7f7 669 }
670}
671
672//_____________________________________________________________________________
00de388f 673//Bool_t
674//AliMUONCluster::IsEqual(const TObject* obj) const
675//{
676// const AliMUONCluster* c = static_cast<const AliMUONCluster*>(obj);
677// if ( c->Multiplicity() != Multiplicity() ) return kFALSE;
678//
679// for ( Int_t i = 0; i < c->Multiplicity(); ++i )
680// {
681// AliMUONPad* p = c->Pad(i);
682// if ( p->Compare(Pad(i)) ) return kFALSE;
683// }
684// return kTRUE;
685//}
686
687//_____________________________________________________________________________
688Int_t
689AliMUONCluster::Compare(const TObject* obj) const
99ccb7f7 690{
00de388f 691 /// Compare two clusters. Comparison is made on position and rawcharge only.
692
693 const AliMUONCluster* cluster = static_cast<const AliMUONCluster*>(obj);
694
695 AliMpArea carea(cluster->Area());
696 AliMpArea area(Area());
697
698 if ( carea.Position().X() > area.Position().X() )
699 {
700 return 1;
701 }
702 else if ( carea.Position().X() < area.Position().X() )
703 {
704 return -1;
705 }
706 else
707 {
708 if ( carea.Position().Y() > area.Position().Y() )
709 {
710 return 1;
711 }
712 else if ( carea.Position().Y() < area.Position().Y() )
713 {
714 return -1;
715 }
716 else
717 {
718 if ( cluster->RawCharge() > RawCharge() )
719 {
720 return 1;
721 }
722 else if ( cluster->RawCharge() < RawCharge() )
723 {
724 return -1;
725 }
726 }
727 }
728 return 0;
99ccb7f7 729}
730
731//_____________________________________________________________________________
732void
733AliMUONCluster::RemovePad(AliMUONPad* pad)
734{
735 /// Remove a pad.
736 /// As a consequence, some internal information must be updated
737
738 fPads->Remove(pad);
739 fPads->Compress();
740 // update cluster's data
741 fIsSaturated[0]=fIsSaturated[1]=kFALSE;
742 fMultiplicity[0]=fMultiplicity[1]=0;
743 fRawCharge[0]=fRawCharge[1]=0;
744 for ( Int_t i = 0; i <= fPads->GetLast(); ++i )
745 {
746 AliMUONPad* p = Pad(i);
747 if ( p->IsSaturated() )
748 {
749 fIsSaturated[p->Cathode()] = kTRUE;
750 }
751 ++fMultiplicity[p->Cathode()];
752 fRawCharge[p->Cathode()] += p->Charge();
753 }
99ccb7f7 754}
755
756//_____________________________________________________________________________
757Float_t
758AliMUONCluster::RawCharge() const
759{
760 /// Returns the raw average charge
761 return (RawCharge(0)+RawCharge(1))/2.0;
762}
763
764//_____________________________________________________________________________
765Float_t
766AliMUONCluster::RawCharge(Int_t cathode) const
767{
768 /// Returns the average charge of a given cathode
769 if ( cathode == 0 || cathode == 1 )
770 {
771 return fRawCharge[cathode];
772 }
773 return 0;
774}
775
776//_____________________________________________________________________________
777Float_t
778AliMUONCluster::RawChargeAsymmetry() const
779{
780 /// Returns the raw charge asymmetry
781 if ( RawCharge() > 0 )
782 {
783 return TMath::Abs(RawCharge(0)-RawCharge(1))/RawCharge();
784 }
785 return 0;
786}