]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTReader.cxx
This commit was generated by cvs2svn to compensate for changes in r4472,
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReader.cxx
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
22   fCuts->SetOwner();
23   delete fCuts;
24 }
25
26 /*************************************************************************************/
27
28 void AliHBTReader::AddParticleCut(AliHBTParticleCut* cut)
29 {
30  //sets the new cut 
31  
32   if (!cut) //if cut is NULL return with error
33    {
34     Error("AddParticleType","NULL pointers are not accepted any more.\nIf You want to accept all particles of this type, set an empty cut ");
35     return;
36    }
37   AliHBTParticleCut *c = (AliHBTParticleCut*)cut->Clone();
38   fCuts->Add(c);
39 }
40
41 /*************************************************************************************/
42
43 Bool_t AliHBTReader::Pass(AliHBTParticle* p)
44  {
45  //Method examines whether particle meets all cut and particle type criteria
46   
47    if(p==0x0)//of corse we not pass NULL pointers
48     {
49      Warning("Pass()","No Pasaran! We never accept NULL pointers");
50      return kTRUE;
51     }
52    //if no particle is specified, we pass all particles
53    //excluding NULL pointers, of course
54    
55   for(Int_t i=0; i<fCuts->GetEntriesFast(); i++)   
56    {
57      AliHBTParticleCut &cut = *((AliHBTParticleCut*)fCuts->At(i));
58      if(!cut.Pass(p)) return kFALSE;  //accepted
59    }
60    
61   return kTRUE;//not accepted
62
63  }
64 /*************************************************************************************/
65
66 Bool_t  AliHBTReader::Pass(Int_t pid)
67 {
68 //this method checks if any of existing cuts accepts this pid particles
69 //or any cuts accepts all particles
70
71  if(pid == 0)
72   return kTRUE;
73   
74  for(Int_t i=0; i<fCuts->GetEntriesFast(); i++)   
75    {
76      AliHBTParticleCut &cut = *((AliHBTParticleCut*)fCuts->At(i));
77      //if some of cuts accepts all particles or some accepts particles of this type, accept
78      if ( (cut.GetPID() == 0) || (cut.GetPID() == pid) ) return kFALSE; 
79    }
80  return kTRUE;
81 }
82 /*************************************************************************************/