source: trunk/modules/MadGraphCDFConeJetFinder.cc@ 21

Last change on this file since 21 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: 3.1 KB
RevLine 
[11]1
2#include "modules/MadGraphCDFConeJetFinder.h"
3
4#include "ExRootAnalysis/ExRootClasses.h"
5#include "ExRootAnalysis/ExRootFactory.h"
6#include "ExRootAnalysis/ExRootCandidate.h"
7
8#include "CDFCones/JetCluAlgorithm.hh"
9#include "CDFCones/MidPointAlgorithm.hh"
10
11#include "TString.h"
12#include "TLorentzVector.h"
13
14#include <iostream>
15#include <vector>
16
17using namespace std;
18
19//------------------------------------------------------------------------------
20
21MadGraphCDFConeJetFinder::MadGraphCDFConeJetFinder() :
22 fJetAlgo(0), fItInputArray(0)
23{
24
25}
26
27//------------------------------------------------------------------------------
28
29MadGraphCDFConeJetFinder::~MadGraphCDFConeJetFinder()
30{
31
32}
33
34//------------------------------------------------------------------------------
35
36void MadGraphCDFConeJetFinder::Init()
37{
38
39 // define MidPoint algorithm
40
41 double seedThreshold = GetDouble("SeedThreshold", 1.0);
42 double coneRadius = GetDouble("ConeRadius", 0.5);
43 double coneAreaFraction = GetDouble("ConeAreaFraction", 1.0);
44 int maxPairSize = GetInt("MaxPairSize", 2);
45 int maxIterations = GetInt("MaxIterations", 100);
46 double overlapThreshold = GetDouble("OverlapThreshold", 0.75);
47
48 fJetAlgo = new MidPointAlgorithm(seedThreshold, coneRadius, coneAreaFraction,
49 maxPairSize, maxIterations, overlapThreshold);
50
51 // import array with output from filter/classifier module
52
53 fInputArray = ImportArray(GetString("InputArray", "selection/candidates"));
54 fItInputArray = fInputArray->MakeIterator();
55
56 // create output arrays
57
58 fOutputArray = ExportArray("candidates");
59
60}
61
62//------------------------------------------------------------------------------
63
64void MadGraphCDFConeJetFinder::Finish()
65{
66 if(fJetAlgo) delete fJetAlgo;
67 if(fItInputArray) delete fItInputArray;
68}
69
70//------------------------------------------------------------------------------
71
72void MadGraphCDFConeJetFinder::Process()
73{
74 ExRootCandidate *candidate;
75 TLorentzVector momentum;
76 LorentzVector jetMomentum;
77 Int_t entry;
78
79 ExRootFactory *factory = GetFactory();
80
81 fTowersList.clear();
82
83 // loop over all particles in event and select stable ones
84 fItInputArray->Reset();
85 while((candidate = static_cast<ExRootCandidate*>(fItInputArray->Next())))
86 {
87 momentum = candidate->GetP4();
88 fTowersList.push_back(PhysicsTower(LorentzVector(momentum.Px(), momentum.Py(),
89 momentum.Pz(), momentum.E())));
90 }
91
92 // construct jets from a list of stable particles
93 fJetsList.clear();
94 fJetAlgo->run(fTowersList, fJetsList);
95
96 // loop over all jets and export them
97 vector<Cluster>::iterator itJet;
98 for(itJet = fJetsList.begin(), entry = 1; itJet != fJetsList.end(); ++itJet, ++entry)
99 {
100 jetMomentum = itJet->fourVector;
101
102 momentum.SetPxPyPzE(jetMomentum.px, jetMomentum.py, jetMomentum.pz, jetMomentum.E);
103
104 candidate = factory->NewCandidate();
105
106 candidate->SetP4(momentum);
107 candidate->SetName(Form("jet_{%d}", entry ));
108
109 fOutputArray->Add(candidate);
110 }
111}
Note: See TracBrowser for help on using the repository browser.