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"
|
---|
16 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
17 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
18 |
|
---|
19 | #include "TDatabasePDG.h"
|
---|
20 | #include "TFormula.h"
|
---|
21 | #include "TLorentzVector.h"
|
---|
22 | #include "TMath.h"
|
---|
23 | #include "TObjArray.h"
|
---|
24 | #include "TRandom3.h"
|
---|
25 | #include "TString.h"
|
---|
26 |
|
---|
27 | #include <algorithm>
|
---|
28 | #include <iostream>
|
---|
29 | #include <sstream>
|
---|
30 | #include <stdexcept>
|
---|
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 | {
|
---|
51 |
|
---|
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;
|
---|
74 |
|
---|
75 | fItInputArray->Reset();
|
---|
76 | while((candidate = static_cast<Candidate *>(fItInputArray->Next())) && !passed)
|
---|
77 | {
|
---|
78 | if(candidate->IsPU == 0) passed = true;
|
---|
79 | fOutputArray->Add(candidate);
|
---|
80 | }
|
---|
81 | }
|
---|