Added event cut set for MC
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniEvent.cxx
CommitLineData
03d23846 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//__________________________________________________________________________________________________
61f275d1 28AliRsnMiniParticle *AliRsnMiniEvent::GetParticle(Int_t i)
17392566 29{
30//
4fb0dfa3 31// Return the particle
17392566 32//
33
34 if (i < 0 || i > fParticles.GetEntriesFast()) return 0x0;
61f275d1 35
36 return (AliRsnMiniParticle *)fParticles[i];
17392566 37}
38
39//__________________________________________________________________________________________________
61f275d1 40AliRsnMiniParticle *AliRsnMiniEvent::LeadingParticle()
03d23846 41{
42//
43// Return the leading particle
44//
45
46 if (fLeading < 0) return 0x0;
47 if (fLeading >= fParticles.GetEntriesFast()) return 0x0;
61f275d1 48
49 return (AliRsnMiniParticle *)fParticles[fLeading];
03d23846 50}
17392566 51
52//__________________________________________________________________________________________________
a2455d2a 53Int_t AliRsnMiniEvent::CountParticles(TArrayI &found, Char_t charge, Int_t cutID)
17392566 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
9e3a9020 61 Int_t i, npart = fParticles.GetEntriesFast();
62 Int_t count = 0;
17392566 63 AliRsnMiniParticle *part = 0x0;
61f275d1 64
a2455d2a 65 found.Set(npart);
61f275d1 66
9e3a9020 67 for (i = 0; i < npart; i++) {
61f275d1 68 part = (AliRsnMiniParticle *)fParticles[i];
17392566 69 if (charge == '+' || charge == '-' || charge == '0') {
70 if (part->Charge() != charge) continue;
71 }
a2455d2a 72 if (cutID >= 0) {
17392566 73 if (!part->HasCutBit(cutID)) continue;
74 }
9e3a9020 75 found[count] = i;
17392566 76 count++;
77 }
61f275d1 78
9e3a9020 79 found.Set(count);
a2455d2a 80 return count;
17392566 81}