FairRoot/PandaRoot
Public Types | Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
PndEvtFilter Class Referenceabstract

#include <PndEvtFilter.h>

Inheritance diagram for PndEvtFilter:
FairEvtFilter PndEvtFilterOnInvMassCounts

Public Types

enum  ChargeState {
  kNeutral =0, kPlus, kMinus, kCharged,
  kAll, kChargeLastElement
}
 
enum  MomState { kMomTotal =0, kMomTrans, kMomZ, kMomLastElement }
 
enum  GeomState {
  kTheta =0, kPhi, kVertexZ, kVertexRho,
  kVertexRadius, kGeomLastElement
}
 
enum  LogicOp { kAnd =0, kOr, kLogicOpLastElement }
 

Public Member Functions

 PndEvtFilter ()
 
 PndEvtFilter (const char *name, const char *title="PndEvtFilter")
 
virtual ~PndEvtFilter ()
 
Bool_t Init ()
 
Bool_t FillList (RhoCandList &rhoOutList, Int_t inPdgCode, Double_t pdgCodeCharge=kNoChargeSpecified)
 
virtual Bool_t EventMatches (Int_t evtNr)=0
 
virtual Bool_t FilterActive ()=0
 
Bool_t SetListOfParticles (TClonesArray *ParticleList)
 
void PrintAllTParticleInEvent ()
 
void SetVerbose (Int_t verbose=12)
 
void ShowAcceptedEventNumbers ()
 
void ShowEvtNrsToAccept ()
 
void SetTestMode (Int_t *arrayPtr, Int_t nEntries)
 
Bool_t TestPassed ()
 
Bool_t GetCharge (Int_t inPdgCode, Double_t *pdgCodeCharge)
 

Protected Attributes

TDatabasePDG * fdbPdg
 
TClonesArray * fParticleList
 
Int_t fVerbose
 
Bool_t fTestMode
 
std::set< Int_t > fAcceptedEventNumbers
 
std::set< Int_t > fEvtNrsToAccept
 
Int_t fEventNr
 

Static Protected Attributes

static const Double_t kNoChargeSpecified = -999.9
 

Private Member Functions

 PndEvtFilter (const PndEvtFilter &G)
 
PndEvtFilteroperator= (const PndEvtFilter &)
 
 ClassDef (PndEvtFilter, 1)
 

Detailed Description

Definition at line 36 of file PndEvtFilter.h.

Member Enumeration Documentation

enum FairEvtFilter::GeomState
inherited
enum FairEvtFilter::LogicOp
inherited
Enumerator
kAnd 
kOr 
kLogicOpLastElement 

Definition at line 42 of file FairEvtFilter.h.

enum FairEvtFilter::MomState
inherited
Enumerator
kMomTotal 
kMomTrans 
kMomZ 
kMomLastElement 

Definition at line 40 of file FairEvtFilter.h.

Constructor & Destructor Documentation

PndEvtFilter::PndEvtFilter ( )

Default constructor.

Definition at line 10 of file PndEvtFilter.cxx.

10  : FairEvtFilter(){
11 }
PndEvtFilter::PndEvtFilter ( const char *  name,
const char *  title = "PndEvtFilter" 
)

Constructor with name and title

Definition at line 17 of file PndEvtFilter.cxx.

18 : FairEvtFilter(name, title){
19 }
TString name
PndEvtFilter::~PndEvtFilter ( )
virtual

Destructor.

Definition at line 25 of file PndEvtFilter.cxx.

25 { }
PndEvtFilter::PndEvtFilter ( const PndEvtFilter G)
private

Member Function Documentation

PndEvtFilter::ClassDef ( PndEvtFilter  ,
 
)
private
virtual Bool_t PndEvtFilter::EventMatches ( Int_t  evtNr)
pure virtual

Implements FairEvtFilter.

Implemented in PndEvtFilterOnInvMassCounts.

Bool_t PndEvtFilter::FillList ( RhoCandList rhoOutList,
Int_t  inPdgCode,
Double_t  pdgCodeCharge = kNoChargeSpecified 
)

Definition at line 31 of file PndEvtFilter.cxx.

References RhoCandList::Add(), RhoCandList::Cleanup(), Double_t, FairEvtFilter::fdbPdg, FairEvtFilter::fParticleList, FairEvtFilter::GetCharge(), FairEvtFilter::kNoChargeSpecified, particle, RhoCandidate::SetMcTruth(), RhoCandidate::SetPos(), and RhoCandidate::SetType().

Referenced by PndEvtFilterOnInvMassCounts::EventMatches().

32 {
33  rhoOutList.Cleanup();
34 
35 
36  // Get charge corresponding to pdgCode if it has not been passed as an argument by the user
37  if ( kNoChargeSpecified == pdgCodeCharge ){
38  if ( kFALSE == GetCharge( inPdgCode, &pdgCodeCharge ) ) {
39  return kFALSE;
40  }
41  }
42 
43 
44 
45  // find all TParticle on stack with a charge(particle) == charge(pdgCode)
46  for (Int_t iPart=0; iPart<fParticleList->GetEntries(); ++iPart) {
47  TParticle *particle = (TParticle*)fParticleList->At(iPart);
48 
49  // get charge for particle
50  TParticlePDG* pdt = particle->GetPDG();
51  if (0==pdt) continue; // unknown particle type (KG, 10/2015)
52 
53  Double_t pCharge = pdt->Charge()/3.; // TParticlePDG contains charge in units of |e|/3
54 
55  if ( pdgCodeCharge != pCharge ){ continue; } // skip all particles with different charge
56 
57 
58  // // mark stable particles
59  // Bool_t isStable = kFALSE;
60  // switch(abs(particle->GetPdgCode())) {
61  // case 22: isStable = true; break;
62  // case 11: isStable = true; break;
63  // case 13: isStable = true; break;
64  // case 211: isStable = true; break;
65  // case 321: isStable = true; break;
66  // case 2212: isStable = true; break;
67  // }
68  //
69  // if (kFALSE == isStable) { continue; } // skip all particles which are not considered stable
70 
71 
72  // store TParticle as RhoCandidate in output TCA and modify 4 momentum to match particle hypothesis
73  TVector3 pVertex(particle->Vx(),particle->Vy(),particle->Vz());
74  TLorentzVector p4(particle->Px(),particle->Py(),particle->Pz(),particle->Energy());
75  // assign mass hypothesis according to pdgCode
76  p4.SetVectM(p4.Vect(),fdbPdg->GetParticle(inPdgCode)->Mass());
77  // construct RhoCandidate
78  RhoCandidate rhoCand(p4,pCharge);
79  rhoCand.SetMcTruth(&rhoCand);
80  rhoCand.SetPos(pVertex);
81  rhoCand.SetType(inPdgCode);
82  // save to output
83  rhoOutList.Add(&rhoCand);
84  }//trackloop
85 
86 
87  return kTRUE;
88 }
void Add(const RhoCandidate *c)
Definition: RhoCandList.h:49
void Cleanup()
Definition: RhoCandList.cxx:62
Bool_t GetCharge(Int_t inPdgCode, Double_t *pdgCodeCharge)
const int particle
Double_t
TClonesArray * fParticleList
static const Double_t kNoChargeSpecified
TDatabasePDG * fdbPdg
virtual Bool_t PndEvtFilter::FilterActive ( )
pure virtual

Implements FairEvtFilter.

Implemented in PndEvtFilterOnInvMassCounts.

Bool_t FairEvtFilter::GetCharge ( Int_t  inPdgCode,
Double_t pdgCodeCharge 
)
inherited

Definition at line 62 of file FairEvtFilter.cxx.

References FairEvtFilter::fdbPdg, FairEvtFilter::fVerbose, and FairEvtFilter::kNoChargeSpecified.

Referenced by FairEvtFilterOnSingleParticleCounts::CountCharge(), FillList(), and PndEvtFilterOnInvMassCounts::SetPdgCodesToCombine().

63 {
64  // Try to find the pdg code
65  TParticlePDG *ptrToPdg = fdbPdg->GetParticle(inPdgCode);
66  if ( 0 == ptrToPdg) {
67  // ignore particles with unknown charges
68  std::cout << "WARNING from FairEvtFilter::GetCharge Charge of pdgCode " << inPdgCode << " is unknown and will be ignored!\n";
69  *pdgCodeCharge = kNoChargeSpecified;
70  return kFALSE;
71  }
72  *pdgCodeCharge = ptrToPdg->Charge()/3.; // TParticlePDG contains charge in units of |e|/3
73  if ( fVerbose > 1 ) std::cout << "Found pdgCodeCharge = " << *pdgCodeCharge << " for inPdgCode " << inPdgCode << '\n';
74  return kTRUE;
75 }
static const Double_t kNoChargeSpecified
TDatabasePDG * fdbPdg
Bool_t PndEvtFilter::Init ( )
inline

Definition at line 54 of file PndEvtFilter.h.

54 { return kTRUE;}
PndEvtFilter& PndEvtFilter::operator= ( const PndEvtFilter )
inlineprivate

Definition at line 74 of file PndEvtFilter.h.

74 {return *this;}
void FairEvtFilter::PrintAllTParticleInEvent ( )
inherited

Definition at line 52 of file FairEvtFilter.cxx.

References FairEvtFilter::fParticleList, and particle.

Referenced by PndEvtFilterOnInvMassCounts::EventMatches(), and FairEvtFilterOnSingleParticleCounts::EventMatches().

52  {
53  // sanity checks
54  if (0==fParticleList){ return; }
55  for (Int_t iPart=0; iPart<fParticleList->GetEntries(); ++iPart) {
56  TParticle *particle = (TParticle*)fParticleList->At(iPart);
57  particle->Print();
58  }
59 }
const int particle
TClonesArray * fParticleList
Bool_t FairEvtFilter::SetListOfParticles ( TClonesArray *  ParticleList)
inlineinherited

Definition at line 57 of file FairEvtFilter.h.

References FairEvtFilter::fParticleList.

Referenced by FairFilteredPrimaryGenerator::GenerateEvent().

57 {fParticleList=ParticleList; return kTRUE;};
TClonesArray * fParticleList
void FairEvtFilter::SetTestMode ( Int_t *  arrayPtr,
Int_t  nEntries 
)
inlineinherited

Definition at line 91 of file FairEvtFilter.h.

References FairEvtFilter::fEvtNrsToAccept, and FairEvtFilter::fTestMode.

91  {
92  //turns on the test mode with the declared fEvtNrsToAccept
93  fTestMode=kTRUE;
94  std::set<Int_t> evtNrsToAccept (arrayPtr,arrayPtr+nEntries);
95  fEvtNrsToAccept=evtNrsToAccept;
96  }
std::set< Int_t > fEvtNrsToAccept
void FairEvtFilter::SetVerbose ( Int_t  verbose = 12)
inlineinherited

Definition at line 67 of file FairEvtFilter.h.

References FairEvtFilter::fVerbose, and verbose.

Referenced by sim_filter_inv_mass().

67  {
68  if ( verbose >= 0 ){
69  fVerbose = verbose;
70  std::cout << "FairEvtFilter: fVerbose is now set to " << verbose << "\n";
71  } else {
72  std::cout << "\n\n\n -WARNING from FairEvtFilter: verbose must be a positive number! Check your SetVerbose call!\n\n\n";
73  }
74  }
#define verbose
void FairEvtFilter::ShowAcceptedEventNumbers ( )
inlineinherited

Definition at line 77 of file FairEvtFilter.h.

References FairEvtFilter::fAcceptedEventNumbers.

77  {
78  // for QA
79  // shows fAcceptedEventNumbers that is filled after running a simulation
80  std::cout << "\n fAcceptedEventNumbers" << " = " << fAcceptedEventNumbers;
81  }
std::set< Int_t > fAcceptedEventNumbers
void FairEvtFilter::ShowEvtNrsToAccept ( )
inlineinherited

Definition at line 84 of file FairEvtFilter.h.

References FairEvtFilter::fEvtNrsToAccept.

84  {
85  // for QA
86  //shows fEvtNrsToAccept that has to be set if you want to run your simulation in test mode
87  std::cout << "\n fEvtNrsToAccept" << " = " << fEvtNrsToAccept;
88  }
std::set< Int_t > fEvtNrsToAccept
Bool_t FairEvtFilter::TestPassed ( )
inlineinherited

Definition at line 99 of file FairEvtFilter.h.

References FairEvtFilter::fAcceptedEventNumbers, FairEvtFilter::fEvtNrsToAccept, and FairEvtFilter::fTestMode.

99  {
100  if(kFALSE==fTestMode){
101  std::cout << "\n\n\n WARNING from FairEvtFilter: Test mode not set.\n\n\n";
102  return kFALSE;
103  }
105  //std::cout << "\n\n\n FairEvtFilter: Test passed.\n\n\n";
106  return kTRUE;
107  }else{
108  //std::cout << "\n\n\n FairEvtFilter: Test failed. Check your SetTestMode calls. \n\n\n";
109  return kFALSE;
110  }
111  }
std::set< Int_t > fAcceptedEventNumbers
std::set< Int_t > fEvtNrsToAccept

Member Data Documentation

std::set<Int_t> FairEvtFilter::fAcceptedEventNumbers
protectedinherited
TDatabasePDG* FairEvtFilter::fdbPdg
protectedinherited
Int_t FairEvtFilter::fEventNr
protectedinherited

Definition at line 136 of file FairEvtFilter.h.

std::set<Int_t> FairEvtFilter::fEvtNrsToAccept
protectedinherited
TClonesArray* FairEvtFilter::fParticleList
protectedinherited
Bool_t FairEvtFilter::fTestMode
protectedinherited

Definition at line 133 of file FairEvtFilter.h.

Referenced by FairEvtFilter::SetTestMode(), and FairEvtFilter::TestPassed().

Int_t FairEvtFilter::fVerbose
protectedinherited
const Double_t FairEvtFilter::kNoChargeSpecified = -999.9
staticprotectedinherited

The documentation for this class was generated from the following files: