[01f457a] | 1 | /*
|
---|
| 2 | * Delphes: a framework for fast simulation of a generic collider experiment
|
---|
| 3 | * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
|
---|
[1fa50c2] | 4 | *
|
---|
[01f457a] | 5 | * This program is free software: you can redistribute it and/or modify
|
---|
| 6 | * it under the terms of the GNU General Public License as published by
|
---|
| 7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 8 | * (at your option) any later version.
|
---|
[1fa50c2] | 9 | *
|
---|
[01f457a] | 10 | * This program is distributed in the hope that it will be useful,
|
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | * GNU General Public License for more details.
|
---|
[1fa50c2] | 14 | *
|
---|
[01f457a] | 15 | * You should have received a copy of the GNU General Public License
|
---|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 17 | */
|
---|
| 18 |
|
---|
[d7d2da3] | 19 | /** \class FastJetFinder
|
---|
| 20 | *
|
---|
| 21 | * Finds jets using FastJet library.
|
---|
| 22 | *
|
---|
| 23 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
| 24 | *
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | #include "modules/FastJetFinder.h"
|
---|
| 28 |
|
---|
| 29 | #include "classes/DelphesClasses.h"
|
---|
| 30 | #include "classes/DelphesFactory.h"
|
---|
| 31 | #include "classes/DelphesFormula.h"
|
---|
| 32 |
|
---|
| 33 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
[341014c] | 34 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
| 35 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
[d7d2da3] | 36 |
|
---|
| 37 | #include "TDatabasePDG.h"
|
---|
[341014c] | 38 | #include "TFormula.h"
|
---|
[d7d2da3] | 39 | #include "TLorentzVector.h"
|
---|
[341014c] | 40 | #include "TMath.h"
|
---|
| 41 | #include "TObjArray.h"
|
---|
| 42 | #include "TRandom3.h"
|
---|
| 43 | #include "TString.h"
|
---|
[d7d2da3] | 44 |
|
---|
[8336b6e] | 45 | #include <algorithm>
|
---|
[d7d2da3] | 46 | #include <iostream>
|
---|
| 47 | #include <sstream>
|
---|
[341014c] | 48 | #include <stdexcept>
|
---|
[d7d2da3] | 49 | #include <vector>
|
---|
| 50 |
|
---|
| 51 | #include "fastjet/ClusterSequence.hh"
|
---|
| 52 | #include "fastjet/ClusterSequenceArea.hh"
|
---|
[341014c] | 53 | #include "fastjet/JetDefinition.hh"
|
---|
| 54 | #include "fastjet/PseudoJet.hh"
|
---|
| 55 | #include "fastjet/Selector.hh"
|
---|
[d7d2da3] | 56 | #include "fastjet/tools/JetMedianBackgroundEstimator.hh"
|
---|
| 57 |
|
---|
| 58 | #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh"
|
---|
[341014c] | 59 | #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh"
|
---|
| 60 | #include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh"
|
---|
[d7d2da3] | 61 |
|
---|
[341014c] | 62 | #include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh"
|
---|
[9687203] | 63 | #include "fastjet/contribs/Nsubjettiness/Njettiness.hh"
|
---|
| 64 | #include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh"
|
---|
[341014c] | 65 | #include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh"
|
---|
[9687203] | 66 |
|
---|
[f319c1d] | 67 | #include "fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh"
|
---|
| 68 |
|
---|
[341014c] | 69 | #include "fastjet/contribs/RecursiveTools/SoftDrop.hh"
|
---|
[de6d698] | 70 | #include "fastjet/tools/Filter.hh"
|
---|
| 71 | #include "fastjet/tools/Pruner.hh"
|
---|
| 72 |
|
---|
[d7d2da3] | 73 | using namespace std;
|
---|
| 74 | using namespace fastjet;
|
---|
[9687203] | 75 | using namespace fastjet::contrib;
|
---|
| 76 |
|
---|
[d7d2da3] | 77 | //------------------------------------------------------------------------------
|
---|
| 78 |
|
---|
| 79 | FastJetFinder::FastJetFinder() :
|
---|
[e9c0d73] | 80 | fPlugin(0), fRecomb(0), fAxesDef(0), fMeasureDef(0), fNjettinessPlugin(0), fValenciaPlugin(0),
|
---|
| 81 | fDefinition(0), fAreaDefinition(0), fItInputArray(0)
|
---|
[d7d2da3] | 82 | {
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | //------------------------------------------------------------------------------
|
---|
| 86 |
|
---|
| 87 | FastJetFinder::~FastJetFinder()
|
---|
| 88 | {
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | //------------------------------------------------------------------------------
|
---|
| 92 |
|
---|
| 93 | void FastJetFinder::Init()
|
---|
| 94 | {
|
---|
[c6321ad] | 95 | JetDefinition::Plugin *plugin = 0;
|
---|
| 96 | JetDefinition::Recombiner *recomb = 0;
|
---|
[7278220] | 97 | ExRootConfParam param;
|
---|
[8336b6e] | 98 | Long_t i, size;
|
---|
[7278220] | 99 | Double_t etaMin, etaMax;
|
---|
| 100 | TEstimatorStruct estimatorStruct;
|
---|
[8336b6e] | 101 |
|
---|
[d7d2da3] | 102 | // define algorithm
|
---|
| 103 |
|
---|
| 104 | fJetAlgorithm = GetInt("JetAlgorithm", 6);
|
---|
| 105 | fParameterR = GetDouble("ParameterR", 0.5);
|
---|
| 106 |
|
---|
| 107 | fConeRadius = GetDouble("ConeRadius", 0.5);
|
---|
| 108 | fSeedThreshold = GetDouble("SeedThreshold", 1.0);
|
---|
| 109 | fConeAreaFraction = GetDouble("ConeAreaFraction", 1.0);
|
---|
| 110 | fMaxIterations = GetInt("MaxIterations", 100);
|
---|
| 111 | fMaxPairSize = GetInt("MaxPairSize", 2);
|
---|
| 112 | fIratch = GetInt("Iratch", 1);
|
---|
[3ccc8586] | 113 | fAdjacencyCut = GetInt("AdjacencyCut", 2);
|
---|
[d7d2da3] | 114 | fOverlapThreshold = GetDouble("OverlapThreshold", 0.75);
|
---|
| 115 |
|
---|
| 116 | fJetPTMin = GetDouble("JetPTMin", 10.0);
|
---|
| 117 |
|
---|
[9687203] | 118 | //-- N(sub)jettiness parameters --
|
---|
[e4c3fef] | 119 |
|
---|
[9687203] | 120 | fComputeNsubjettiness = GetBool("ComputeNsubjettiness", false);
|
---|
| 121 | fBeta = GetDouble("Beta", 1.0);
|
---|
| 122 | fAxisMode = GetInt("AxisMode", 1);
|
---|
[e4c3fef] | 123 | fRcutOff = GetDouble("RcutOff", 0.8); // used only if Njettiness is used as jet clustering algo (case 8)
|
---|
[341014c] | 124 | fN = GetInt("N", 2); // used only if Njettiness is used as jet clustering algo (case 8)
|
---|
[f319c1d] | 125 |
|
---|
| 126 | //-- Exclusive clustering for e+e- collisions --
|
---|
[3b3d0ad] | 127 |
|
---|
[341014c] | 128 | fNJets = GetInt("NJets", 2);
|
---|
[f319c1d] | 129 | fExclusiveClustering = GetBool("ExclusiveClustering", false);
|
---|
| 130 |
|
---|
| 131 | //-- Valencia Linear Collider algorithm
|
---|
[3b3d0ad] | 132 |
|
---|
[f319c1d] | 133 | fGamma = GetDouble("Gamma", 1.0);
|
---|
| 134 | //fBeta parameter see above
|
---|
[3b3d0ad] | 135 |
|
---|
[919f6a6] | 136 | fMeasureDef = new NormalizedMeasure(fBeta, fParameterR);
|
---|
[3b3d0ad] | 137 |
|
---|
[8abab33] | 138 | switch(fAxisMode)
|
---|
| 139 | {
|
---|
[341014c] | 140 | default:
|
---|
| 141 | case 1:
|
---|
| 142 | fAxesDef = new WTA_KT_Axes();
|
---|
| 143 | break;
|
---|
| 144 | case 2:
|
---|
| 145 | fAxesDef = new OnePass_WTA_KT_Axes();
|
---|
| 146 | break;
|
---|
| 147 | case 3:
|
---|
| 148 | fAxesDef = new KT_Axes();
|
---|
| 149 | break;
|
---|
| 150 | case 4:
|
---|
| 151 | fAxesDef = new OnePass_KT_Axes();
|
---|
[3b3d0ad] | 152 | }
|
---|
[e4c3fef] | 153 |
|
---|
[de6d698] | 154 | //-- Trimming parameters --
|
---|
[3b3d0ad] | 155 |
|
---|
[de6d698] | 156 | fComputeTrimming = GetBool("ComputeTrimming", false);
|
---|
| 157 | fRTrim = GetDouble("RTrim", 0.2);
|
---|
| 158 | fPtFracTrim = GetDouble("PtFracTrim", 0.05);
|
---|
[3b3d0ad] | 159 |
|
---|
[de6d698] | 160 | //-- Pruning parameters --
|
---|
[3b3d0ad] | 161 |
|
---|
[de6d698] | 162 | fComputePruning = GetBool("ComputePruning", false);
|
---|
| 163 | fZcutPrun = GetDouble("ZcutPrun", 0.1);
|
---|
| 164 | fRcutPrun = GetDouble("RcutPrun", 0.5);
|
---|
| 165 | fRPrun = GetDouble("RPrun", 0.8);
|
---|
[3b3d0ad] | 166 |
|
---|
[de6d698] | 167 | //-- SoftDrop parameters --
|
---|
[3b3d0ad] | 168 |
|
---|
[341014c] | 169 | fComputeSoftDrop = GetBool("ComputeSoftDrop", false);
|
---|
| 170 | fBetaSoftDrop = GetDouble("BetaSoftDrop", 0.0);
|
---|
[de6d698] | 171 | fSymmetryCutSoftDrop = GetDouble("SymmetryCutSoftDrop", 0.1);
|
---|
[341014c] | 172 | fR0SoftDrop = GetDouble("R0SoftDrop=", 0.8);
|
---|
[de6d698] | 173 |
|
---|
[d7d2da3] | 174 | // --- Jet Area Parameters ---
|
---|
[3b3d0ad] | 175 |
|
---|
[d7d2da3] | 176 | fAreaAlgorithm = GetInt("AreaAlgorithm", 0);
|
---|
| 177 | fComputeRho = GetBool("ComputeRho", false);
|
---|
[e4c3fef] | 178 |
|
---|
[d7d2da3] | 179 | // - ghost based areas -
|
---|
| 180 | fGhostEtaMax = GetDouble("GhostEtaMax", 5.0);
|
---|
| 181 | fRepeat = GetInt("Repeat", 1);
|
---|
| 182 | fGhostArea = GetDouble("GhostArea", 0.01);
|
---|
| 183 | fGridScatter = GetDouble("GridScatter", 1.0);
|
---|
| 184 | fPtScatter = GetDouble("PtScatter", 0.1);
|
---|
| 185 | fMeanGhostPt = GetDouble("MeanGhostPt", 1.0E-100);
|
---|
[e4c3fef] | 186 |
|
---|
[d7d2da3] | 187 | // - voronoi based areas -
|
---|
| 188 | fEffectiveRfact = GetDouble("EffectiveRfact", 1.0);
|
---|
| 189 |
|
---|
| 190 | switch(fAreaAlgorithm)
|
---|
| 191 | {
|
---|
[341014c] | 192 | default:
|
---|
| 193 | case 0:
|
---|
| 194 | fAreaDefinition = 0;
|
---|
| 195 | break;
|
---|
| 196 | case 1:
|
---|
| 197 | fAreaDefinition = new AreaDefinition(active_area_explicit_ghosts, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
|
---|
| 198 | break;
|
---|
| 199 | case 2:
|
---|
| 200 | fAreaDefinition = new AreaDefinition(one_ghost_passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
|
---|
| 201 | break;
|
---|
| 202 | case 3:
|
---|
| 203 | fAreaDefinition = new AreaDefinition(passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
|
---|
| 204 | break;
|
---|
| 205 | case 4:
|
---|
| 206 | fAreaDefinition = new AreaDefinition(VoronoiAreaSpec(fEffectiveRfact));
|
---|
| 207 | break;
|
---|
| 208 | case 5:
|
---|
| 209 | fAreaDefinition = new AreaDefinition(active_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));
|
---|
| 210 | break;
|
---|
[d7d2da3] | 211 | }
|
---|
| 212 |
|
---|
| 213 | switch(fJetAlgorithm)
|
---|
| 214 | {
|
---|
[341014c] | 215 | case 1:
|
---|
| 216 | plugin = new CDFJetCluPlugin(fSeedThreshold, fConeRadius, fAdjacencyCut, fMaxIterations, fIratch, fOverlapThreshold);
|
---|
| 217 | fDefinition = new JetDefinition(plugin);
|
---|
| 218 | break;
|
---|
| 219 | case 2:
|
---|
| 220 | plugin = new CDFMidPointPlugin(fSeedThreshold, fConeRadius, fConeAreaFraction, fMaxPairSize, fMaxIterations, fOverlapThreshold);
|
---|
| 221 | fDefinition = new JetDefinition(plugin);
|
---|
| 222 | break;
|
---|
| 223 | case 3:
|
---|
| 224 | plugin = new SISConePlugin(fConeRadius, fOverlapThreshold, fMaxIterations, fJetPTMin);
|
---|
| 225 | fDefinition = new JetDefinition(plugin);
|
---|
| 226 | break;
|
---|
| 227 | case 4:
|
---|
| 228 | fDefinition = new JetDefinition(kt_algorithm, fParameterR);
|
---|
| 229 | break;
|
---|
| 230 | case 5:
|
---|
| 231 | fDefinition = new JetDefinition(cambridge_algorithm, fParameterR);
|
---|
| 232 | break;
|
---|
| 233 | default:
|
---|
| 234 | case 6:
|
---|
| 235 | fDefinition = new JetDefinition(antikt_algorithm, fParameterR);
|
---|
| 236 | break;
|
---|
| 237 | case 7:
|
---|
| 238 | recomb = new WinnerTakeAllRecombiner();
|
---|
| 239 | fDefinition = new JetDefinition(antikt_algorithm, fParameterR, recomb, Best);
|
---|
| 240 | break;
|
---|
| 241 | case 8:
|
---|
| 242 | fNjettinessPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);
|
---|
| 243 | fDefinition = new JetDefinition(fNjettinessPlugin);
|
---|
| 244 | break;
|
---|
| 245 | case 9:
|
---|
| 246 | fValenciaPlugin = new ValenciaPlugin(fParameterR, fBeta, fGamma);
|
---|
| 247 | fDefinition = new JetDefinition(fValenciaPlugin);
|
---|
| 248 | break;
|
---|
[d7d2da3] | 249 | }
|
---|
[8336b6e] | 250 |
|
---|
[d7d2da3] | 251 | fPlugin = plugin;
|
---|
[9687203] | 252 | fRecomb = recomb;
|
---|
[e4c3fef] | 253 |
|
---|
[d7d2da3] | 254 | ClusterSequence::print_banner();
|
---|
[8336b6e] | 255 |
|
---|
[7278220] | 256 | if(fComputeRho && fAreaDefinition)
|
---|
| 257 | {
|
---|
| 258 | // read eta ranges
|
---|
| 259 |
|
---|
| 260 | param = GetParam("RhoEtaRange");
|
---|
| 261 | size = param.GetSize();
|
---|
| 262 |
|
---|
| 263 | fEstimators.clear();
|
---|
[341014c] | 264 | for(i = 0; i < size / 2; ++i)
|
---|
[7278220] | 265 | {
|
---|
[341014c] | 266 | etaMin = param[i * 2].GetDouble();
|
---|
| 267 | etaMax = param[i * 2 + 1].GetDouble();
|
---|
[58dcd2e] | 268 | estimatorStruct.estimator = new JetMedianBackgroundEstimator(SelectorRapRange(etaMin, etaMax), *fDefinition, *fAreaDefinition);
|
---|
[7278220] | 269 | estimatorStruct.etaMin = etaMin;
|
---|
| 270 | estimatorStruct.etaMax = etaMax;
|
---|
| 271 | fEstimators.push_back(estimatorStruct);
|
---|
| 272 | }
|
---|
| 273 | }
|
---|
| 274 |
|
---|
[d7d2da3] | 275 | // import input array
|
---|
| 276 |
|
---|
| 277 | fInputArray = ImportArray(GetString("InputArray", "Calorimeter/towers"));
|
---|
| 278 | fItInputArray = fInputArray->MakeIterator();
|
---|
| 279 |
|
---|
| 280 | // create output arrays
|
---|
| 281 |
|
---|
| 282 | fOutputArray = ExportArray(GetString("OutputArray", "jets"));
|
---|
| 283 | fRhoOutputArray = ExportArray(GetString("RhoOutputArray", "rho"));
|
---|
[70bb4cb] | 284 | fConstituentsOutputArray = ExportArray(GetString("ConstituentsOutputArray", "constituents"));
|
---|
[d7d2da3] | 285 | }
|
---|
| 286 |
|
---|
| 287 | //------------------------------------------------------------------------------
|
---|
| 288 |
|
---|
| 289 | void FastJetFinder::Finish()
|
---|
| 290 | {
|
---|
[341014c] | 291 | vector<TEstimatorStruct>::iterator itEstimators;
|
---|
[7278220] | 292 |
|
---|
| 293 | for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
|
---|
| 294 | {
|
---|
| 295 | if(itEstimators->estimator) delete itEstimators->estimator;
|
---|
| 296 | }
|
---|
| 297 |
|
---|
[d7d2da3] | 298 | if(fItInputArray) delete fItInputArray;
|
---|
| 299 | if(fDefinition) delete fDefinition;
|
---|
| 300 | if(fAreaDefinition) delete fAreaDefinition;
|
---|
[341014c] | 301 | if(fPlugin) delete static_cast<JetDefinition::Plugin *>(fPlugin);
|
---|
| 302 | if(fRecomb) delete static_cast<JetDefinition::Recombiner *>(fRecomb);
|
---|
| 303 | if(fNjettinessPlugin) delete static_cast<JetDefinition::Plugin *>(fNjettinessPlugin);
|
---|
[8abab33] | 304 | if(fAxesDef) delete fAxesDef;
|
---|
| 305 | if(fMeasureDef) delete fMeasureDef;
|
---|
[341014c] | 306 | if(fValenciaPlugin) delete static_cast<JetDefinition::Plugin *>(fValenciaPlugin);
|
---|
[d7d2da3] | 307 | }
|
---|
| 308 |
|
---|
| 309 | //------------------------------------------------------------------------------
|
---|
| 310 |
|
---|
| 311 | void FastJetFinder::Process()
|
---|
| 312 | {
|
---|
| 313 | Candidate *candidate, *constituent;
|
---|
| 314 | TLorentzVector momentum;
|
---|
[df04eb1] | 315 |
|
---|
[d7d2da3] | 316 | Double_t deta, dphi, detaMax, dphiMax;
|
---|
[df04eb1] | 317 | Double_t time, timeWeight;
|
---|
[c614dd7] | 318 | Double_t neutralEnergyFraction, chargedEnergyFraction;
|
---|
| 319 |
|
---|
[ce4feac] | 320 | Int_t number, ncharged, nneutrals;
|
---|
[3b3d0ad] | 321 | Int_t charge;
|
---|
[df04eb1] | 322 | Double_t rho = 0.0;
|
---|
[d7d2da3] | 323 | PseudoJet jet, area;
|
---|
| 324 | ClusterSequence *sequence;
|
---|
[341014c] | 325 | vector<PseudoJet> inputList, outputList, subjets;
|
---|
| 326 | vector<PseudoJet>::iterator itInputList, itOutputList;
|
---|
| 327 | vector<TEstimatorStruct>::iterator itEstimators;
|
---|
[e9c0d73] | 328 | Double_t excl_ymerge23 = 0.0;
|
---|
| 329 | Double_t excl_ymerge34 = 0.0;
|
---|
| 330 | Double_t excl_ymerge45 = 0.0;
|
---|
| 331 | Double_t excl_ymerge56 = 0.0;
|
---|
[3b3d0ad] | 332 |
|
---|
[d7d2da3] | 333 | DelphesFactory *factory = GetFactory();
|
---|
| 334 |
|
---|
| 335 | inputList.clear();
|
---|
| 336 |
|
---|
| 337 | // loop over input objects
|
---|
| 338 | fItInputArray->Reset();
|
---|
| 339 | number = 0;
|
---|
[341014c] | 340 | while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
|
---|
[8336b6e] | 341 | {
|
---|
[d7d2da3] | 342 | momentum = candidate->Momentum;
|
---|
| 343 | jet = PseudoJet(momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E());
|
---|
| 344 | jet.set_user_index(number);
|
---|
| 345 | inputList.push_back(jet);
|
---|
| 346 | ++number;
|
---|
| 347 | }
|
---|
[8336b6e] | 348 |
|
---|
| 349 | // construct jets
|
---|
[d7d2da3] | 350 | if(fAreaDefinition)
|
---|
| 351 | {
|
---|
| 352 | sequence = new ClusterSequenceArea(inputList, *fDefinition, *fAreaDefinition);
|
---|
| 353 | }
|
---|
| 354 | else
|
---|
| 355 | {
|
---|
| 356 | sequence = new ClusterSequence(inputList, *fDefinition);
|
---|
[8336b6e] | 357 | }
|
---|
[d7d2da3] | 358 |
|
---|
| 359 | // compute rho and store it
|
---|
| 360 | if(fComputeRho && fAreaDefinition)
|
---|
| 361 | {
|
---|
[7278220] | 362 | for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
|
---|
[8336b6e] | 363 | {
|
---|
[7278220] | 364 | itEstimators->estimator->set_particles(inputList);
|
---|
| 365 | rho = itEstimators->estimator->rho();
|
---|
[8336b6e] | 366 |
|
---|
| 367 | candidate = factory->NewCandidate();
|
---|
| 368 | candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho);
|
---|
[7278220] | 369 | candidate->Edges[0] = itEstimators->etaMin;
|
---|
| 370 | candidate->Edges[1] = itEstimators->etaMax;
|
---|
[8336b6e] | 371 | fRhoOutputArray->Add(candidate);
|
---|
| 372 | }
|
---|
[d7d2da3] | 373 | }
|
---|
[8336b6e] | 374 |
|
---|
[d7d2da3] | 375 | outputList.clear();
|
---|
| 376 |
|
---|
[f319c1d] | 377 | if(fExclusiveClustering)
|
---|
[341014c] | 378 | {
|
---|
| 379 | try
|
---|
[f319c1d] | 380 | {
|
---|
[341014c] | 381 | outputList = sorted_by_pt(sequence->exclusive_jets(fNJets));
|
---|
[f319c1d] | 382 | }
|
---|
[341014c] | 383 | catch(fastjet::Error)
|
---|
[f319c1d] | 384 | {
|
---|
[341014c] | 385 | outputList.clear();
|
---|
[f319c1d] | 386 | }
|
---|
[9687203] | 387 |
|
---|
[341014c] | 388 | excl_ymerge23 = sequence->exclusive_ymerge(2);
|
---|
| 389 | excl_ymerge34 = sequence->exclusive_ymerge(3);
|
---|
| 390 | excl_ymerge45 = sequence->exclusive_ymerge(4);
|
---|
| 391 | excl_ymerge56 = sequence->exclusive_ymerge(5);
|
---|
| 392 | }
|
---|
| 393 | else
|
---|
| 394 | {
|
---|
| 395 | outputList = sorted_by_pt(sequence->inclusive_jets(fJetPTMin));
|
---|
| 396 | }
|
---|
| 397 |
|
---|
[d7d2da3] | 398 | // loop over all jets and export them
|
---|
| 399 | detaMax = 0.0;
|
---|
| 400 | dphiMax = 0.0;
|
---|
[3b3d0ad] | 401 |
|
---|
[d7d2da3] | 402 | for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList)
|
---|
| 403 | {
|
---|
[d244bc9] | 404 | jet = *itOutputList;
|
---|
| 405 | if(fJetAlgorithm == 7) jet = join(jet.constituents());
|
---|
[df04eb1] | 406 |
|
---|
[d244bc9] | 407 | momentum.SetPxPyPzE(jet.px(), jet.py(), jet.pz(), jet.E());
|
---|
[df04eb1] | 408 |
|
---|
[d7d2da3] | 409 | area.reset(0.0, 0.0, 0.0, 0.0);
|
---|
| 410 | if(fAreaDefinition) area = itOutputList->area_4vector();
|
---|
| 411 |
|
---|
| 412 | candidate = factory->NewCandidate();
|
---|
| 413 |
|
---|
[df04eb1] | 414 | time = 0.0;
|
---|
| 415 | timeWeight = 0.0;
|
---|
[22dc7fd] | 416 |
|
---|
[5a44a72] | 417 | charge = 0;
|
---|
| 418 |
|
---|
[ce4feac] | 419 | ncharged = 0;
|
---|
| 420 | nneutrals = 0;
|
---|
| 421 |
|
---|
[c614dd7] | 422 | neutralEnergyFraction =0.;
|
---|
| 423 | chargedEnergyFraction =0.;
|
---|
| 424 |
|
---|
[d7d2da3] | 425 | inputList.clear();
|
---|
| 426 | inputList = sequence->constituents(*itOutputList);
|
---|
[e4c3fef] | 427 |
|
---|
[d7d2da3] | 428 | for(itInputList = inputList.begin(); itInputList != inputList.end(); ++itInputList)
|
---|
| 429 | {
|
---|
[29f8a06] | 430 | if(itInputList->user_index() < 0) continue;
|
---|
[341014c] | 431 | constituent = static_cast<Candidate *>(fInputArray->At(itInputList->user_index()));
|
---|
[d7d2da3] | 432 |
|
---|
| 433 | deta = TMath::Abs(momentum.Eta() - constituent->Momentum.Eta());
|
---|
| 434 | dphi = TMath::Abs(momentum.DeltaPhi(constituent->Momentum));
|
---|
| 435 | if(deta > detaMax) detaMax = deta;
|
---|
| 436 | if(dphi > dphiMax) dphiMax = dphi;
|
---|
[e4c3fef] | 437 |
|
---|
[341014c] | 438 | if(constituent->Charge == 0)
|
---|
[c614dd7] | 439 | {
|
---|
[341014c] | 440 | nneutrals++;
|
---|
[c614dd7] | 441 | neutralEnergyFraction += constituent->Momentum.E();
|
---|
| 442 | }
|
---|
[341014c] | 443 | else
|
---|
[c614dd7] | 444 | {
|
---|
[341014c] | 445 | ncharged++;
|
---|
[c614dd7] | 446 | chargedEnergyFraction += constituent->Momentum.E();
|
---|
| 447 | }
|
---|
| 448 |
|
---|
[341014c] | 449 | time += TMath::Sqrt(constituent->Momentum.E()) * (constituent->Position.T());
|
---|
[df04eb1] | 450 | timeWeight += TMath::Sqrt(constituent->Momentum.E());
|
---|
[e4c3fef] | 451 |
|
---|
[5a44a72] | 452 | charge += constituent->Charge;
|
---|
| 453 |
|
---|
[70bb4cb] | 454 | fConstituentsOutputArray->Add(constituent);
|
---|
[d7d2da3] | 455 | candidate->AddCandidate(constituent);
|
---|
| 456 | }
|
---|
[e4c3fef] | 457 |
|
---|
[d7d2da3] | 458 | candidate->Momentum = momentum;
|
---|
[341014c] | 459 | candidate->Position.SetT(time / timeWeight);
|
---|
[d7d2da3] | 460 | candidate->Area.SetPxPyPzE(area.px(), area.py(), area.pz(), area.E());
|
---|
| 461 |
|
---|
| 462 | candidate->DeltaEta = detaMax;
|
---|
| 463 | candidate->DeltaPhi = dphiMax;
|
---|
[3b3d0ad] | 464 | candidate->Charge = charge;
|
---|
[ce4feac] | 465 | candidate->NNeutrals = nneutrals;
|
---|
| 466 | candidate->NCharged = ncharged;
|
---|
[e9c0d73] | 467 |
|
---|
[c614dd7] | 468 | candidate->NeutralEnergyFraction = (momentum.E() > 0 ) ? neutralEnergyFraction/momentum.E() : 0.0;
|
---|
| 469 | candidate->ChargedEnergyFraction = (momentum.E() > 0 ) ? chargedEnergyFraction/momentum.E() : 0.0;
|
---|
| 470 |
|
---|
[e9c0d73] | 471 | //for exclusive clustering, access y_n,n+1 as exclusive_ymerge (fNJets);
|
---|
| 472 | candidate->ExclYmerge23 = excl_ymerge23;
|
---|
| 473 | candidate->ExclYmerge34 = excl_ymerge34;
|
---|
| 474 | candidate->ExclYmerge45 = excl_ymerge45;
|
---|
| 475 | candidate->ExclYmerge56 = excl_ymerge56;
|
---|
[3b3d0ad] | 476 |
|
---|
[de6d698] | 477 | //------------------------------------
|
---|
| 478 | // Trimming
|
---|
| 479 | //------------------------------------
|
---|
[d7d2da3] | 480 |
|
---|
[8abab33] | 481 | if(fComputeTrimming)
|
---|
[de6d698] | 482 | {
|
---|
| 483 |
|
---|
[341014c] | 484 | fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm, fRTrim), fastjet::SelectorPtFractionMin(fPtFracTrim));
|
---|
[de6d698] | 485 | fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList);
|
---|
[3b3d0ad] | 486 |
|
---|
[de6d698] | 487 | trimmed_jet = join(trimmed_jet.constituents());
|
---|
[3b3d0ad] | 488 |
|
---|
[de6d698] | 489 | candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m());
|
---|
[3b3d0ad] | 490 |
|
---|
| 491 | // four hardest subjets
|
---|
[de6d698] | 492 | subjets.clear();
|
---|
| 493 | subjets = trimmed_jet.pieces();
|
---|
| 494 | subjets = sorted_by_pt(subjets);
|
---|
[3b3d0ad] | 495 |
|
---|
[de6d698] | 496 | candidate->NSubJetsTrimmed = subjets.size();
|
---|
| 497 |
|
---|
[341014c] | 498 | for(size_t i = 0; i < subjets.size() and i < 4; i++)
|
---|
[8abab33] | 499 | {
|
---|
[341014c] | 500 | if(subjets.at(i).pt() < 0) continue;
|
---|
| 501 | candidate->TrimmedP4[i + 1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
|
---|
[de6d698] | 502 | }
|
---|
| 503 | }
|
---|
[3b3d0ad] | 504 |
|
---|
[de6d698] | 505 | //------------------------------------
|
---|
| 506 | // Pruning
|
---|
| 507 | //------------------------------------
|
---|
[3b3d0ad] | 508 |
|
---|
[de6d698] | 509 | if(fComputePruning)
|
---|
| 510 | {
|
---|
| 511 |
|
---|
[341014c] | 512 | fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm, fRPrun), fZcutPrun, fRcutPrun);
|
---|
[de6d698] | 513 | fastjet::PseudoJet pruned_jet = pruner(*itOutputList);
|
---|
| 514 |
|
---|
| 515 | candidate->PrunedP4[0].SetPtEtaPhiM(pruned_jet.pt(), pruned_jet.eta(), pruned_jet.phi(), pruned_jet.m());
|
---|
[3b3d0ad] | 516 |
|
---|
| 517 | // four hardest subjet
|
---|
[de6d698] | 518 | subjets.clear();
|
---|
| 519 | subjets = pruned_jet.pieces();
|
---|
| 520 | subjets = sorted_by_pt(subjets);
|
---|
[3b3d0ad] | 521 |
|
---|
[de6d698] | 522 | candidate->NSubJetsPruned = subjets.size();
|
---|
| 523 |
|
---|
[341014c] | 524 | for(size_t i = 0; i < subjets.size() and i < 4; i++)
|
---|
[8abab33] | 525 | {
|
---|
[341014c] | 526 | if(subjets.at(i).pt() < 0) continue;
|
---|
| 527 | candidate->PrunedP4[i + 1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
|
---|
[de6d698] | 528 | }
|
---|
[3b3d0ad] | 529 | }
|
---|
| 530 |
|
---|
[de6d698] | 531 | //------------------------------------
|
---|
| 532 | // SoftDrop
|
---|
| 533 | //------------------------------------
|
---|
[3b3d0ad] | 534 |
|
---|
[de6d698] | 535 | if(fComputeSoftDrop)
|
---|
| 536 | {
|
---|
[3b3d0ad] | 537 |
|
---|
[341014c] | 538 | contrib::SoftDrop softDrop(fBetaSoftDrop, fSymmetryCutSoftDrop, fR0SoftDrop);
|
---|
[de6d698] | 539 | fastjet::PseudoJet softdrop_jet = softDrop(*itOutputList);
|
---|
[3b3d0ad] | 540 |
|
---|
[de6d698] | 541 | candidate->SoftDroppedP4[0].SetPtEtaPhiM(softdrop_jet.pt(), softdrop_jet.eta(), softdrop_jet.phi(), softdrop_jet.m());
|
---|
[3b3d0ad] | 542 |
|
---|
| 543 | // four hardest subjet
|
---|
| 544 |
|
---|
[de6d698] | 545 | subjets.clear();
|
---|
[341014c] | 546 | subjets = softdrop_jet.pieces();
|
---|
| 547 | subjets = sorted_by_pt(subjets);
|
---|
[de6d698] | 548 | candidate->NSubJetsSoftDropped = softdrop_jet.pieces().size();
|
---|
| 549 |
|
---|
[ba75867] | 550 | candidate->SoftDroppedJet = candidate->SoftDroppedP4[0];
|
---|
| 551 |
|
---|
[341014c] | 552 | for(size_t i = 0; i < subjets.size() and i < 4; i++)
|
---|
[8abab33] | 553 | {
|
---|
[341014c] | 554 | if(subjets.at(i).pt() < 0) continue;
|
---|
| 555 | candidate->SoftDroppedP4[i + 1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
|
---|
| 556 | if(i == 0) candidate->SoftDroppedSubJet1 = candidate->SoftDroppedP4[i + 1];
|
---|
| 557 | if(i == 1) candidate->SoftDroppedSubJet2 = candidate->SoftDroppedP4[i + 1];
|
---|
[de6d698] | 558 | }
|
---|
| 559 | }
|
---|
[3b3d0ad] | 560 |
|
---|
[9687203] | 561 | // --- compute N-subjettiness with N = 1,2,3,4,5 ----
|
---|
[e4c3fef] | 562 |
|
---|
[9687203] | 563 | if(fComputeNsubjettiness)
|
---|
| 564 | {
|
---|
[3b3d0ad] | 565 |
|
---|
[8abab33] | 566 | Nsubjettiness nSub1(1, *fAxesDef, *fMeasureDef);
|
---|
| 567 | Nsubjettiness nSub2(2, *fAxesDef, *fMeasureDef);
|
---|
| 568 | Nsubjettiness nSub3(3, *fAxesDef, *fMeasureDef);
|
---|
| 569 | Nsubjettiness nSub4(4, *fAxesDef, *fMeasureDef);
|
---|
| 570 | Nsubjettiness nSub5(5, *fAxesDef, *fMeasureDef);
|
---|
[3b3d0ad] | 571 |
|
---|
[e4c3fef] | 572 | candidate->Tau[0] = nSub1(*itOutputList);
|
---|
| 573 | candidate->Tau[1] = nSub2(*itOutputList);
|
---|
| 574 | candidate->Tau[2] = nSub3(*itOutputList);
|
---|
| 575 | candidate->Tau[3] = nSub4(*itOutputList);
|
---|
| 576 | candidate->Tau[4] = nSub5(*itOutputList);
|
---|
[9687203] | 577 | }
|
---|
| 578 |
|
---|
[d7d2da3] | 579 | fOutputArray->Add(candidate);
|
---|
| 580 | }
|
---|
| 581 | delete sequence;
|
---|
| 582 | }
|
---|