source: trunk/modules/MadGraphSISConeJetFinder.cc@ 17

Last change on this file since 17 was 14, checked in by Pavel Demin, 16 years ago

add JetPTMin parameter

  • Property svn:executable set to *
File size: 2.8 KB
RevLine 
[11]1
2#include "modules/MadGraphSISConeJetFinder.h"
3
4#include "ExRootAnalysis/ExRootClasses.h"
5#include "ExRootAnalysis/ExRootFactory.h"
6#include "ExRootAnalysis/ExRootCandidate.h"
7
8#include "SISCone/momentum.h"
9#include "SISCone/siscone.h"
10
11#include "TString.h"
12#include "TLorentzVector.h"
13
14#include <iostream>
15#include <vector>
16
17using namespace std;
18using namespace siscone;
19
20//------------------------------------------------------------------------------
21
22MadGraphSISConeJetFinder::MadGraphSISConeJetFinder() :
23 fJetAlgo(0), fItInputArray(0)
24{
25
26}
27
28//------------------------------------------------------------------------------
29
30MadGraphSISConeJetFinder::~MadGraphSISConeJetFinder()
31{
32
33}
34
35//------------------------------------------------------------------------------
36
37void MadGraphSISConeJetFinder::Init()
38{
39
40 // define MidPoint algorithm
41
42 fConeRadius = GetDouble("ConeRadius", 0.5);
43 fConeAreaFraction = GetDouble("ConeAreaFraction", 1.0);
44 fMaxIterations = GetInt("MaxIterations", 100);
[14]45 fJetPTMin = GetDouble("JetPTMin", 20.0);
[11]46
47 fJetAlgo = new Csiscone;
48
49 // import array with output from filter/classifier module
50
51 fInputArray = ImportArray(GetString("InputArray", "selection/candidates"));
52 fItInputArray = fInputArray->MakeIterator();
53
54 // create output arrays
55
56 fOutputArray = ExportArray("candidates");
57
58}
59
60//------------------------------------------------------------------------------
61
62void MadGraphSISConeJetFinder::Finish()
63{
64 if(fJetAlgo) delete fJetAlgo;
65 if(fItInputArray) delete fItInputArray;
66}
67
68//------------------------------------------------------------------------------
69
70void MadGraphSISConeJetFinder::Process()
71{
72 ExRootCandidate *candidate;
73 TLorentzVector momentum;
74 Cmomentum jetMomentum;
75 Int_t entry;
76
77 ExRootFactory *factory = GetFactory();
78
79 fParticlesList.clear();
80
81 // loop over all particles in event and select stable ones
82 fItInputArray->Reset();
83 while((candidate = static_cast<ExRootCandidate*>(fItInputArray->Next())))
84 {
85 momentum = candidate->GetP4();
86 fParticlesList.push_back(Cmomentum(momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E()));
87 }
88
89 // construct jets from a list of stable particles
[14]90 fJetAlgo->compute_jets(fParticlesList, fConeRadius, fConeAreaFraction, fMaxIterations, fJetPTMin);
[11]91
92 // loop over all jets and export them
93 vector<Cjet>::iterator itJet;
94 for(itJet = fJetAlgo->jets.begin(), entry = 1; itJet != fJetAlgo->jets.end(); ++itJet, ++entry)
95 {
96 jetMomentum = itJet->v;
97
98 momentum.SetPxPyPzE(jetMomentum.px, jetMomentum.py, jetMomentum.pz, jetMomentum.E);
99
100 candidate = factory->NewCandidate();
101
102 candidate->SetP4(momentum);
103 candidate->SetName(Form("jet_{%d}", entry ));
104
105 fOutputArray->Add(candidate);
106 }
107}
Note: See TracBrowser for help on using the repository browser.