1 | /** \class StatusPidFilter |
---|
2 | * |
---|
3 | * Removes all generated particles except electrons, muons, taus, |
---|
4 | * and particles with status == 3. |
---|
5 | * |
---|
6 | * $Date: 2013-05-20 22:22:07 +0200 (Mon, 20 May 2013) $ |
---|
7 | * $Revision: 1118 $ |
---|
8 | * |
---|
9 | * |
---|
10 | * \author J. Hirschauer - FNAL |
---|
11 | * |
---|
12 | */ |
---|
13 | |
---|
14 | #include "modules/StatusPidFilter.h" |
---|
15 | |
---|
16 | #include "classes/DelphesClasses.h" |
---|
17 | #include "classes/DelphesFactory.h" |
---|
18 | #include "classes/DelphesFormula.h" |
---|
19 | |
---|
20 | #include "ExRootAnalysis/ExRootResult.h" |
---|
21 | #include "ExRootAnalysis/ExRootFilter.h" |
---|
22 | #include "ExRootAnalysis/ExRootClassifier.h" |
---|
23 | |
---|
24 | #include "TMath.h" |
---|
25 | #include "TString.h" |
---|
26 | #include "TFormula.h" |
---|
27 | #include "TRandom3.h" |
---|
28 | #include "TObjArray.h" |
---|
29 | #include "TDatabasePDG.h" |
---|
30 | #include "TLorentzVector.h" |
---|
31 | |
---|
32 | #include <algorithm> |
---|
33 | #include <stdexcept> |
---|
34 | #include <iostream> |
---|
35 | #include <sstream> |
---|
36 | |
---|
37 | using namespace std; |
---|
38 | |
---|
39 | //------------------------------------------------------------------------------ |
---|
40 | |
---|
41 | StatusPidFilter::StatusPidFilter() : |
---|
42 | fItInputArray(0) |
---|
43 | { |
---|
44 | } |
---|
45 | |
---|
46 | //------------------------------------------------------------------------------ |
---|
47 | |
---|
48 | StatusPidFilter::~StatusPidFilter() |
---|
49 | { |
---|
50 | } |
---|
51 | |
---|
52 | //------------------------------------------------------------------------------ |
---|
53 | |
---|
54 | void StatusPidFilter::Init() |
---|
55 | { |
---|
56 | // PT threshold |
---|
57 | |
---|
58 | fPTMin = GetDouble("PTMin", 0.5); |
---|
59 | |
---|
60 | // import input array |
---|
61 | fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles")); |
---|
62 | fItInputArray = fInputArray->MakeIterator(); |
---|
63 | |
---|
64 | // create output array |
---|
65 | |
---|
66 | fOutputArray = ExportArray(GetString("OutputArray", "filteredParticles")); |
---|
67 | } |
---|
68 | |
---|
69 | //------------------------------------------------------------------------------ |
---|
70 | |
---|
71 | void StatusPidFilter::Finish() |
---|
72 | { |
---|
73 | if(fItInputArray) delete fItInputArray; |
---|
74 | } |
---|
75 | |
---|
76 | //------------------------------------------------------------------------------ |
---|
77 | |
---|
78 | void StatusPidFilter::Process() |
---|
79 | { |
---|
80 | Candidate *candidate; |
---|
81 | Int_t status, pdgCode; |
---|
82 | Bool_t pass; |
---|
83 | |
---|
84 | fItInputArray->Reset(); |
---|
85 | while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) |
---|
86 | { |
---|
87 | status = candidate->Status; |
---|
88 | pdgCode = TMath::Abs(candidate->PID); |
---|
89 | |
---|
90 | pass = kFALSE; |
---|
91 | |
---|
92 | // status == 3 |
---|
93 | if(status == 3) pass = kTRUE; |
---|
94 | |
---|
95 | // electrons, muons, taus and neutrinos |
---|
96 | if(pdgCode > 10 && pdgCode < 17) pass = kTRUE; |
---|
97 | |
---|
98 | // heavy quarks |
---|
99 | if(pdgCode == 5 || pdgCode == 6) pass = kTRUE; |
---|
100 | |
---|
101 | // Gauge bosons and other fundamental bosons |
---|
102 | if(pdgCode > 22 && pdgCode < 43) pass = kTRUE; |
---|
103 | |
---|
104 | if(!pass || candidate->Momentum.Pt() <= fPTMin) continue; |
---|
105 | |
---|
106 | fOutputArray->Add(candidate); |
---|
107 | } |
---|
108 | } |
---|
109 | |
---|