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