13 #include "fastjet/PseudoJet.hh"
14 #include "fastjet/ClusterSequence.hh"
15 #include "fastjet/ClusterSequenceActiveArea.hh"
17 #include "fastjet/ClusterSequence.hh"
18 #include "fastjet/ClusterSequenceActiveArea.hh"
34 delete mJetDefinition;
48 string JetFinder=
"kt_algorithm";;
50 string Strategy=
"Best";
69 fastjet::JetFinder jet_finder;
70 if (JetFinder==
"cambridge_algorithm") jet_finder=fastjet::cambridge_algorithm;
71 else jet_finder=fastjet::kt_algorithm;
75 fastjet::Strategy strategy;
76 if (Strategy==
"N2Plain") strategy=fastjet::N2Plain;
78 else if (Strategy==
"N2Tiled") strategy=fastjet::N2Tiled;
80 else if (Strategy==
"N2MinHeapTiled") strategy=fastjet::N2MinHeapTiled;
82 else if (Strategy==
"NlnN") strategy=fastjet::NlnN;
84 else if (Strategy==
"NlnNCam") strategy=fastjet::NlnNCam;
86 else strategy=fastjet::Best;
104 cout <<
"[FastJetWrapper] `njets` and `dcut` set!=-1! - running inclusive Mode"<<endl;
112 cout <<
"*******************************************"<<endl;
113 cout <<
"* Configuration of FastJet "<<endl;
117 cout <<
"* Mode : inclusive"<<endl;
121 cout <<
"* [WARNING] Mode : inclusive - dcut and njets set!"<<endl;
125 cout <<
"* Mode : exclusive"<<endl;
129 cout <<
"* Mode : exclusive"<<endl;
134 cout <<
"* JetFinder: "<<JetFinder<<endl;
135 cout <<
"* Strategy : "<<Strategy<<endl;
136 cout <<
"*******************************************"<<endl;
141 if (!fOutput)
return;
145 std::vector<fastjet::PseudoJet> fjInputs;
146 fjInputs.reserve (fInput.size());
148 JetReco::InputCollection::const_iterator
input = fInput.begin();
149 for (
unsigned i = 0;
i < fInput.size(); ++
i) {
151 fjInputs.push_back (fastjet::PseudoJet (c->
px(),c->
py(),c->
pz(),c->
energy()));
152 fjInputs.back().set_user_index(
i);
160 fastjet::ClusterSequenceActiveArea* clusterSequenceWithArea = 0;
161 fastjet::ClusterSequenceWithArea* clusterSequence = 0;
167 clusterSequence =
new fastjet::ClusterSequenceWithArea (fjInputs, *
mJetDefinition);
170 std::vector<fastjet::PseudoJet>
jets = clusterSequence->inclusive_jets (
thePtMin_);
173 double median_Pt_Per_Area = clusterSequenceWithArea ? clusterSequenceWithArea->pt_per_unit_area() : 0.;
176 for (std::vector<fastjet::PseudoJet>::const_iterator
jet=jets.begin();
jet!=jets.end();++
jet) {
182 double jetArea=clusterSequence->area(*
jet);
185 if (clusterSequenceWithArea) {
186 fastjet::PseudoJet pu_p4 = median_Pt_Per_Area * clusterSequenceWithArea->area_4vector(*
jet);
188 if (pu_p4.perp2() >=
jet->perp2() || pu_p4.E() >=
jet->E()) {
189 px = py = pz = E = 0.;
200 std::vector<fastjet::PseudoJet> fastjet_constituents = clusterSequence->constituents(*
jet);
202 jetConstituents.reserve (fastjet_constituents.size());
203 for (std::vector<fastjet::PseudoJet>::const_iterator itConst=fastjet_constituents.begin();
204 itConst!=fastjet_constituents.end();itConst++){
205 jetConstituents.push_back(fInput[(*itConst).user_index()]);
208 fOutput->push_back(
ProtoJet(p4,jetConstituents));
209 fOutput->back().setJetArea (jetArea);
210 fOutput->back().setPileup (pu);
213 if (clusterSequenceWithArea)
delete clusterSequenceWithArea;
214 else delete clusterSequence;
int theActive_Area_Repeats_
virtual double energy() const =0
energy
std::vector< ProtoJet > OutputCollection
void run(const JetReco::InputCollection &fInput, JetReco::OutputCollection *fOutput)
std::vector< InputItem > InputCollection
virtual double pz() const =0
z coordinate of momentum vector
Transient Jet class used by the reconstruction algorithms.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual double py() const =0
y coordinate of momentum vector
virtual double px() const =0
x coordinate of momentum vector
fastjet::JetDefinition * mJetDefinition
fastjet::ActiveAreaSpec * mActiveArea