Fork me on GitHub

source: git/modules/StatusPidFilter.cc@ 2dab783

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 2dab783 was d5104a4, checked in by pavel <pavel@…>, 12 years ago

simplify lepton selection

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/** \class StatusPidFilter
2 *
3 * Removes all generated particles except electrons, muons, taus,
4 * and particles with status == 3.
5 *
6 * $Date$
7 * $Revision$
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
37using namespace std;
38
39//------------------------------------------------------------------------------
40
41StatusPidFilter::StatusPidFilter() :
42 fItInputArray(0)
43{
44}
45
46//------------------------------------------------------------------------------
47
48StatusPidFilter::~StatusPidFilter()
49{
50}
51
52//------------------------------------------------------------------------------
53
54void 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
71void StatusPidFilter::Finish()
72{
73 if(fItInputArray) delete fItInputArray;
74}
75
76//------------------------------------------------------------------------------
77
78void 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
Note: See TracBrowser for help on using the repository browser.