]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG2/RESONANCES/AliRsnMiniEvent.cxx
Coverity fix
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnMiniEvent.cxx
... / ...
CommitLineData
1//
2// Mini-Event
3// Contains only the useful quantities computed on the event
4// which can be used for event mixing, or for direct output
5// when doing analysis w.r. to multiplicity or event plane, for example.
6//
7// Author: A. Pulvirenti
8//
9
10#include "AliRsnMiniParticle.h"
11#include "AliRsnMiniEvent.h"
12
13ClassImp(AliRsnMiniEvent)
14
15//__________________________________________________________________________________________________
16void AliRsnMiniEvent::AddParticle(AliRsnMiniParticle copy)
17{
18//
19// Add a new particle to the list and returns a pointer to it,
20// in order to allow to se its parameters.
21//
22
23 Int_t n = fParticles.GetEntries();
24 new (fParticles[n]) AliRsnMiniParticle(copy);
25}
26
27//__________________________________________________________________________________________________
28AliRsnMiniParticle* AliRsnMiniEvent::GetParticle(Int_t i)
29{
30//
31// Return the leading particle
32//
33
34 if (i < 0 || i > fParticles.GetEntriesFast()) return 0x0;
35
36 return (AliRsnMiniParticle*)fParticles[i];
37}
38
39//__________________________________________________________________________________________________
40AliRsnMiniParticle* AliRsnMiniEvent::LeadingParticle()
41{
42//
43// Return the leading particle
44//
45
46 if (fLeading < 0) return 0x0;
47 if (fLeading >= fParticles.GetEntriesFast()) return 0x0;
48
49 return (AliRsnMiniParticle*)fParticles[fLeading];
50}
51
52//__________________________________________________________________________________________________
53Int_t AliRsnMiniEvent::CountParticles(Char_t charge, Int_t cutID)
54{
55//
56// Counts how many particles have the specified charge and cut bit
57// if charge is not '+', '-' or '0', all charges are considered
58// if cut bit is < 0, it is not checked
59//
60
61 Int_t count = 0;
62 TObjArrayIter next(&fParticles);
63 AliRsnMiniParticle *part = 0x0;
64
65 while ( (part = (AliRsnMiniParticle*)next()) ) {
66 if (charge == '+' || charge == '-' || charge == '0') {
67 if (part->Charge() != charge) continue;
68 }
69 if (cutID > 0) {
70 if (!part->HasCutBit(cutID)) continue;
71 }
72 count++;
73 }
74
75 return count;
76}
77