Changes in modules/FastJetFinder.cc [df04eb1:5a44a72] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/FastJetFinder.cc
rdf04eb1 r5a44a72 66 66 #include "fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh" 67 67 68 #include "fastjet/tools/Filter.hh" 69 #include "fastjet/tools/Pruner.hh" 70 #include "fastjet/contribs/RecursiveTools/SoftDrop.hh" 71 68 72 using namespace std; 69 73 using namespace fastjet; … … 92 96 JetDefinition::Plugin *plugin = 0; 93 97 JetDefinition::Recombiner *recomb = 0; 94 NjettinessPlugin *njetPlugin = 0; 95 96 // read eta ranges 97 98 ExRootConfParam param = GetParam("RhoEtaRange"); 98 ExRootConfParam param; 99 99 Long_t i, size; 100 101 fEtaRangeMap.clear(); 102 size = param.GetSize(); 103 for(i = 0; i < size/2; ++i) 104 { 105 fEtaRangeMap[param[i*2].GetDouble()] = param[i*2 + 1].GetDouble(); 106 } 100 Double_t etaMin, etaMax; 101 TEstimatorStruct estimatorStruct; 107 102 108 103 // define algorithm … … 130 125 fN = GetInt("N", 2); // used only if Njettiness is used as jet clustering algo (case 8) 131 126 127 //-- Trimming parameters -- 128 129 fComputeTrimming = GetBool("ComputeTrimming", false); 130 fRTrim = GetDouble("RTrim", 0.2); 131 fPtFracTrim = GetDouble("PtFracTrim", 0.05); 132 133 134 //-- Pruning parameters -- 135 136 fComputePruning = GetBool("ComputePruning", false); 137 fZcutPrun = GetDouble("ZcutPrun", 0.1); 138 fRcutPrun = GetDouble("RcutPrun", 0.5); 139 fRPrun = GetDouble("RPrun", 0.8); 140 141 //-- SoftDrop parameters -- 142 143 fComputeSoftDrop = GetBool("ComputeSoftDrop", false); 144 fBetaSoftDrop = GetDouble("BetaSoftDrop", 0.0); 145 fSymmetryCutSoftDrop = GetDouble("SymmetryCutSoftDrop", 0.1); 146 fR0SoftDrop= GetDouble("R0SoftDrop=", 0.8); 147 148 132 149 // --- Jet Area Parameters --- 133 150 fAreaAlgorithm = GetInt("AreaAlgorithm", 0); … … 197 214 break; 198 215 case 8: 199 njetPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);200 fDefinition = new JetDefinition( njetPlugin);216 fNjettinessPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff); 217 fDefinition = new JetDefinition(fNjettinessPlugin); 201 218 break; 202 219 } … … 204 221 fPlugin = plugin; 205 222 fRecomb = recomb; 206 fNjettinessPlugin = njetPlugin;207 223 208 224 ClusterSequence::print_banner(); 225 226 if(fComputeRho && fAreaDefinition) 227 { 228 // read eta ranges 229 230 param = GetParam("RhoEtaRange"); 231 size = param.GetSize(); 232 233 fEstimators.clear(); 234 for(i = 0; i < size/2; ++i) 235 { 236 etaMin = param[i*2].GetDouble(); 237 etaMax = param[i*2 + 1].GetDouble(); 238 estimatorStruct.estimator = new JetMedianBackgroundEstimator(SelectorEtaRange(etaMin, etaMax), *fDefinition, *fAreaDefinition); 239 estimatorStruct.etaMin = etaMin; 240 estimatorStruct.etaMax = etaMax; 241 fEstimators.push_back(estimatorStruct); 242 } 243 } 209 244 210 245 // import input array … … 223 258 void FastJetFinder::Finish() 224 259 { 260 vector< TEstimatorStruct >::iterator itEstimators; 261 262 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) 263 { 264 if(itEstimators->estimator) delete itEstimators->estimator; 265 } 266 225 267 if(fItInputArray) delete fItInputArray; 226 268 if(fDefinition) delete fDefinition; … … 241 283 Double_t time, timeWeight; 242 284 Int_t number; 285 Int_t charge; 243 286 Double_t rho = 0.0; 244 287 PseudoJet jet, area; 245 vector<PseudoJet> inputList, outputList;246 288 ClusterSequence *sequence; 247 map< Double_t, Double_t >::iterator itEtaRangeMap; 289 vector< PseudoJet > inputList, outputList, subjets; 290 vector< PseudoJet >::iterator itInputList, itOutputList; 291 vector< TEstimatorStruct >::iterator itEstimators; 248 292 249 293 DelphesFactory *factory = GetFactory(); … … 276 320 if(fComputeRho && fAreaDefinition) 277 321 { 278 for(itEtaRangeMap = fEtaRangeMap.begin(); itEtaRangeMap != fEtaRangeMap.end(); ++itEtaRangeMap) 279 { 280 Selector select_rapidity = SelectorAbsRapRange(itEtaRangeMap->first, itEtaRangeMap->second); 281 JetMedianBackgroundEstimator estimator(select_rapidity, *fDefinition, *fAreaDefinition); 282 estimator.set_particles(inputList); 283 rho = estimator.rho(); 322 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) 323 { 324 itEstimators->estimator->set_particles(inputList); 325 rho = itEstimators->estimator->rho(); 284 326 285 327 candidate = factory->NewCandidate(); 286 328 candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho); 287 candidate->Edges[0] = itE taRangeMap->first;288 candidate->Edges[1] = itE taRangeMap->second;329 candidate->Edges[0] = itEstimators->etaMin; 330 candidate->Edges[1] = itEstimators->etaMax; 289 331 fRhoOutputArray->Add(candidate); 290 332 } … … 298 340 detaMax = 0.0; 299 341 dphiMax = 0.0; 300 vector<PseudoJet>::iterator itInputList, itOutputList;301 342 for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList) 302 343 { … … 314 355 timeWeight = 0.0; 315 356 357 charge = 0; 358 316 359 inputList.clear(); 317 360 inputList = sequence->constituents(*itOutputList); … … 319 362 for(itInputList = inputList.begin(); itInputList != inputList.end(); ++itInputList) 320 363 { 364 if(itInputList->user_index() < 0) continue; 321 365 constituent = static_cast<Candidate*>(fInputArray->At(itInputList->user_index())); 322 366 … … 329 373 timeWeight += TMath::Sqrt(constituent->Momentum.E()); 330 374 375 charge += constituent->Charge; 376 331 377 candidate->AddCandidate(constituent); 332 378 } … … 338 384 candidate->DeltaEta = detaMax; 339 385 candidate->DeltaPhi = dphiMax; 340 386 candidate->Charge = charge; 387 //------------------------------------ 388 // Trimming 389 //------------------------------------ 390 391 if(fComputeTrimming) 392 { 393 394 fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm,fRTrim),fastjet::SelectorPtFractionMin(fPtFracTrim)); 395 fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList); 396 397 trimmed_jet = join(trimmed_jet.constituents()); 398 399 candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m()); 400 401 // four hardest subjets 402 subjets.clear(); 403 subjets = trimmed_jet.pieces(); 404 subjets = sorted_by_pt(subjets); 405 406 candidate->NSubJetsTrimmed = subjets.size(); 407 408 for (size_t i = 0; i < subjets.size() and i < 4; i++){ 409 if(subjets.at(i).pt() < 0) continue ; 410 candidate->TrimmedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 411 } 412 } 413 414 415 //------------------------------------ 416 // Pruning 417 //------------------------------------ 418 419 420 if(fComputePruning) 421 { 422 423 fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm,fRPrun),fZcutPrun,fRcutPrun); 424 fastjet::PseudoJet pruned_jet = pruner(*itOutputList); 425 426 candidate->PrunedP4[0].SetPtEtaPhiM(pruned_jet.pt(), pruned_jet.eta(), pruned_jet.phi(), pruned_jet.m()); 427 428 // four hardest subjet 429 subjets.clear(); 430 subjets = pruned_jet.pieces(); 431 subjets = sorted_by_pt(subjets); 432 433 candidate->NSubJetsPruned = subjets.size(); 434 435 for (size_t i = 0; i < subjets.size() and i < 4; i++){ 436 if(subjets.at(i).pt() < 0) continue ; 437 candidate->PrunedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 438 } 439 440 } 441 442 //------------------------------------ 443 // SoftDrop 444 //------------------------------------ 445 446 if(fComputeSoftDrop) 447 { 448 449 contrib::SoftDrop softDrop(fBetaSoftDrop,fSymmetryCutSoftDrop,fR0SoftDrop); 450 fastjet::PseudoJet softdrop_jet = softDrop(*itOutputList); 451 452 candidate->SoftDroppedP4[0].SetPtEtaPhiM(softdrop_jet.pt(), softdrop_jet.eta(), softdrop_jet.phi(), softdrop_jet.m()); 453 454 // four hardest subjet 455 456 subjets.clear(); 457 subjets = softdrop_jet.pieces(); 458 subjets = sorted_by_pt(subjets); 459 candidate->NSubJetsSoftDropped = softdrop_jet.pieces().size(); 460 461 for (size_t i = 0; i < subjets.size() and i < 4; i++){ 462 if(subjets.at(i).pt() < 0) continue ; 463 candidate->SoftDroppedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 464 } 465 } 466 341 467 // --- compute N-subjettiness with N = 1,2,3,4,5 ---- 342 468 … … 377 503 } 378 504 379 380 505 fOutputArray->Add(candidate); 381 506 }
Note:
See TracChangeset
for help on using the changeset viewer.