[d7d2da3] | 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 |
|
---|
| 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 |
|
---|
| 83 | fItInputArray->Reset();
|
---|
| 84 | while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
|
---|
| 85 | {
|
---|
| 86 | status = candidate->Status;
|
---|
| 87 | pdgCode = TMath::Abs(candidate->PID);
|
---|
| 88 |
|
---|
| 89 | // Write all electrons, muons, taus and status == 3;
|
---|
| 90 | if(pdgCode != 11 && pdgCode != 13 && pdgCode != 15 && status != 3) continue;
|
---|
| 91 |
|
---|
| 92 | if(candidate->Momentum.Pt() <= fPTMin) continue;
|
---|
| 93 |
|
---|
| 94 | fOutputArray->Add(candidate);
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 |
|
---|