Fork me on GitHub

source: git/modules/BeamSpotFilter.cc@ ea3ff35

ImprovedOutputFile Timing dual_readout llp
Last change on this file since ea3ff35 was 64a5c3f, checked in by Michele Selvaggi <michele.selvaggi@…>, 9 years ago

added BeamSpotFilter module

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