source: trunk/modules/MadGraphSISConeJetFinder.cc@ 11

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

add SISCone jet algorithm and update names for ConeJetFinder modules

  • Property svn:executable set to *
File size: 2.7 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);
45
46 fJetAlgo = new Csiscone;
47
48 // import array with output from filter/classifier module
49
50 fInputArray = ImportArray(GetString("InputArray", "selection/candidates"));
51 fItInputArray = fInputArray->MakeIterator();
52
53 // create output arrays
54
55 fOutputArray = ExportArray("candidates");
56
57}
58
59//------------------------------------------------------------------------------
60
61void MadGraphSISConeJetFinder::Finish()
62{
63 if(fJetAlgo) delete fJetAlgo;
64 if(fItInputArray) delete fItInputArray;
65}
66
67//------------------------------------------------------------------------------
68
69void MadGraphSISConeJetFinder::Process()
70{
71 ExRootCandidate *candidate;
72 TLorentzVector momentum;
73 Cmomentum jetMomentum;
74 Int_t entry;
75
76 ExRootFactory *factory = GetFactory();
77
78 fParticlesList.clear();
79
80 // loop over all particles in event and select stable ones
81 fItInputArray->Reset();
82 while((candidate = static_cast<ExRootCandidate*>(fItInputArray->Next())))
83 {
84 momentum = candidate->GetP4();
85 fParticlesList.push_back(Cmomentum(momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E()));
86 }
87
88 // construct jets from a list of stable particles
89 fJetAlgo->compute_jets(fParticlesList, fConeRadius, fConeAreaFraction, fMaxIterations);
90
91 // loop over all jets and export them
92 vector<Cjet>::iterator itJet;
93 for(itJet = fJetAlgo->jets.begin(), entry = 1; itJet != fJetAlgo->jets.end(); ++itJet, ++entry)
94 {
95 jetMomentum = itJet->v;
96
97 momentum.SetPxPyPzE(jetMomentum.px, jetMomentum.py, jetMomentum.pz, jetMomentum.E);
98
99 candidate = factory->NewCandidate();
100
101 candidate->SetP4(momentum);
102 candidate->SetName(Form("jet_{%d}", entry ));
103
104 fOutputArray->Add(candidate);
105 }
106}
Note: See TracBrowser for help on using the repository browser.