]>
Commit | Line | Data |
---|---|---|
1b446896 | 1 | #include "AliHBTReader.h" |
2 | ||
3 | #include "AliHBTParticleCut.h" | |
4 | ||
5 | ||
6 | ClassImp(AliHBTReader) | |
7 | //pure virtual | |
8 | ||
9 | /*************************************************************************************/ | |
10 | ||
11 | AliHBTReader::AliHBTReader() | |
12 | { | |
13 | //constructor | |
14 | fCuts = new TObjArray(); | |
15 | } | |
16 | ||
17 | /*************************************************************************************/ | |
18 | ||
19 | AliHBTReader::~AliHBTReader() | |
20 | { | |
21 | //destructor | |
36ee4bd5 | 22 | if(fCuts) |
23 | { | |
24 | fCuts->SetOwner(); | |
25 | delete fCuts; | |
26 | } | |
1b446896 | 27 | } |
28 | ||
29 | /*************************************************************************************/ | |
30 | ||
31 | void AliHBTReader::AddParticleCut(AliHBTParticleCut* cut) | |
32 | { | |
33 | //sets the new cut | |
34 | ||
35 | if (!cut) //if cut is NULL return with error | |
36 | { | |
37 | Error("AddParticleType","NULL pointers are not accepted any more.\nIf You want to accept all particles of this type, set an empty cut "); | |
38 | return; | |
39 | } | |
40 | AliHBTParticleCut *c = (AliHBTParticleCut*)cut->Clone(); | |
41 | fCuts->Add(c); | |
42 | } | |
43 | ||
44 | /*************************************************************************************/ | |
45 | ||
46 | Bool_t AliHBTReader::Pass(AliHBTParticle* p) | |
47 | { | |
48 | //Method examines whether particle meets all cut and particle type criteria | |
49 | ||
50 | if(p==0x0)//of corse we not pass NULL pointers | |
51 | { | |
52 | Warning("Pass()","No Pasaran! We never accept NULL pointers"); | |
53 | return kTRUE; | |
54 | } | |
55 | //if no particle is specified, we pass all particles | |
56 | //excluding NULL pointers, of course | |
57 | ||
58 | for(Int_t i=0; i<fCuts->GetEntriesFast(); i++) | |
59 | { | |
60 | AliHBTParticleCut &cut = *((AliHBTParticleCut*)fCuts->At(i)); | |
61 | if(!cut.Pass(p)) return kFALSE; //accepted | |
62 | } | |
63 | ||
64 | return kTRUE;//not accepted | |
65 | ||
66 | } | |
67 | /*************************************************************************************/ | |
68 | ||
69 | Bool_t AliHBTReader::Pass(Int_t pid) | |
70 | { | |
71 | //this method checks if any of existing cuts accepts this pid particles | |
72 | //or any cuts accepts all particles | |
73 | ||
74 | if(pid == 0) | |
75 | return kTRUE; | |
76 | ||
77 | for(Int_t i=0; i<fCuts->GetEntriesFast(); i++) | |
78 | { | |
79 | AliHBTParticleCut &cut = *((AliHBTParticleCut*)fCuts->At(i)); | |
80 | //if some of cuts accepts all particles or some accepts particles of this type, accept | |
81 | if ( (cut.GetPID() == 0) || (cut.GetPID() == pid) ) return kFALSE; | |
82 | } | |
83 | return kTRUE; | |
84 | } | |
85 | /*************************************************************************************/ |