[64a5c3f] | 1 | /** \class BeamSpotFilter
|
---|
| 2 | *
|
---|
| 3 | * Extracts beam spot
|
---|
| 4 | *
|
---|
| 5 | * \author Michele Selvaggi
|
---|
| 6 | *
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | #include "modules/BeamSpotFilter.h"
|
---|
| 10 |
|
---|
| 11 | #include "classes/DelphesClasses.h"
|
---|
| 12 | #include "classes/DelphesFactory.h"
|
---|
| 13 | #include "classes/DelphesFormula.h"
|
---|
| 14 |
|
---|
| 15 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
[341014c] | 16 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
| 17 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
[64a5c3f] | 18 |
|
---|
| 19 | #include "TDatabasePDG.h"
|
---|
[341014c] | 20 | #include "TFormula.h"
|
---|
[64a5c3f] | 21 | #include "TLorentzVector.h"
|
---|
[341014c] | 22 | #include "TMath.h"
|
---|
| 23 | #include "TObjArray.h"
|
---|
| 24 | #include "TRandom3.h"
|
---|
| 25 | #include "TString.h"
|
---|
[64a5c3f] | 26 |
|
---|
| 27 | #include <algorithm>
|
---|
| 28 | #include <iostream>
|
---|
| 29 | #include <sstream>
|
---|
[341014c] | 30 | #include <stdexcept>
|
---|
[64a5c3f] | 31 |
|
---|
| 32 | using namespace std;
|
---|
| 33 |
|
---|
| 34 | //------------------------------------------------------------------------------
|
---|
| 35 |
|
---|
| 36 | BeamSpotFilter::BeamSpotFilter() :
|
---|
| 37 | fItInputArray(0)
|
---|
| 38 | {
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | //------------------------------------------------------------------------------
|
---|
| 42 |
|
---|
| 43 | BeamSpotFilter::~BeamSpotFilter()
|
---|
| 44 | {
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | //------------------------------------------------------------------------------
|
---|
| 48 |
|
---|
| 49 | void BeamSpotFilter::Init()
|
---|
| 50 | {
|
---|
[341014c] | 51 |
|
---|
[64a5c3f] | 52 | // import input array
|
---|
| 53 | fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
|
---|
| 54 | fItInputArray = fInputArray->MakeIterator();
|
---|
| 55 |
|
---|
| 56 | // create output array
|
---|
| 57 |
|
---|
| 58 | fOutputArray = ExportArray(GetString("OutputArray", "filteredParticles"));
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | //------------------------------------------------------------------------------
|
---|
| 62 |
|
---|
| 63 | void BeamSpotFilter::Finish()
|
---|
| 64 | {
|
---|
| 65 | if(fItInputArray) delete fItInputArray;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | //------------------------------------------------------------------------------
|
---|
| 69 |
|
---|
| 70 | void BeamSpotFilter::Process()
|
---|
| 71 | {
|
---|
| 72 | Candidate *candidate;
|
---|
| 73 | Bool_t passed = false;
|
---|
[341014c] | 74 |
|
---|
[64a5c3f] | 75 | fItInputArray->Reset();
|
---|
[341014c] | 76 | while((candidate = static_cast<Candidate *>(fItInputArray->Next())) && !passed)
|
---|
[64a5c3f] | 77 | {
|
---|
| 78 | if(candidate->IsPU == 0) passed = true;
|
---|
| 79 | fOutputArray->Add(candidate);
|
---|
| 80 | }
|
---|
| 81 | }
|
---|