Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/FastJetFinder.cc

    r5a44a72 rdf04eb1  
    6666#include "fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh"
    6767
    68 #include "fastjet/tools/Filter.hh"
    69 #include "fastjet/tools/Pruner.hh"
    70 #include "fastjet/contribs/RecursiveTools/SoftDrop.hh"
    71 
    7268using namespace std;
    7369using namespace fastjet;
     
    9692  JetDefinition::Plugin *plugin = 0;
    9793  JetDefinition::Recombiner *recomb = 0;
    98   ExRootConfParam param;
     94  NjettinessPlugin *njetPlugin = 0;
     95
     96  // read eta ranges
     97
     98  ExRootConfParam param = GetParam("RhoEtaRange");
    9999  Long_t i, size;
    100   Double_t etaMin, etaMax;
    101   TEstimatorStruct estimatorStruct;
     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  }
    102107
    103108  // define algorithm
     
    125130  fN = GetInt("N", 2);                  // used only if Njettiness is used as jet clustering algo (case 8)
    126131
    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 
    149132  // ---  Jet Area Parameters ---
    150133  fAreaAlgorithm = GetInt("AreaAlgorithm", 0);
     
    214197      break;
    215198    case 8:
    216       fNjettinessPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);
    217       fDefinition = new JetDefinition(fNjettinessPlugin);
     199      njetPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);
     200      fDefinition = new JetDefinition(njetPlugin);
    218201      break;
    219202  }
     
    221204  fPlugin = plugin;
    222205  fRecomb = recomb;
     206  fNjettinessPlugin = njetPlugin;
    223207
    224208  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   }
    244209
    245210  // import input array
     
    258223void FastJetFinder::Finish()
    259224{
    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 
    267225  if(fItInputArray) delete fItInputArray;
    268226  if(fDefinition) delete fDefinition;
     
    283241  Double_t time, timeWeight;
    284242  Int_t number;
    285   Int_t charge;
    286243  Double_t rho = 0.0;
    287244  PseudoJet jet, area;
     245  vector<PseudoJet> inputList, outputList;
    288246  ClusterSequence *sequence;
    289   vector< PseudoJet > inputList, outputList, subjets;
    290   vector< PseudoJet >::iterator itInputList, itOutputList;
    291   vector< TEstimatorStruct >::iterator itEstimators;
     247  map< Double_t, Double_t >::iterator itEtaRangeMap;
    292248
    293249  DelphesFactory *factory = GetFactory();
     
    320276  if(fComputeRho && fAreaDefinition)
    321277  {
    322     for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators)
     278    for(itEtaRangeMap = fEtaRangeMap.begin(); itEtaRangeMap != fEtaRangeMap.end(); ++itEtaRangeMap)
    323279    {
    324       itEstimators->estimator->set_particles(inputList);
    325       rho = itEstimators->estimator->rho();
     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();
    326284
    327285      candidate = factory->NewCandidate();
    328286      candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho);
    329       candidate->Edges[0] = itEstimators->etaMin;
    330       candidate->Edges[1] = itEstimators->etaMax;
     287      candidate->Edges[0] = itEtaRangeMap->first;
     288      candidate->Edges[1] = itEtaRangeMap->second;
    331289      fRhoOutputArray->Add(candidate);
    332290    }
     
    340298  detaMax = 0.0;
    341299  dphiMax = 0.0;
     300  vector<PseudoJet>::iterator itInputList, itOutputList;
    342301  for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList)
    343302  {
     
    355314    timeWeight = 0.0;
    356315
    357     charge = 0;
    358 
    359316    inputList.clear();
    360317    inputList = sequence->constituents(*itOutputList);
     
    362319    for(itInputList = inputList.begin(); itInputList != inputList.end(); ++itInputList)
    363320    {
    364       if(itInputList->user_index() < 0) continue;
    365321      constituent = static_cast<Candidate*>(fInputArray->At(itInputList->user_index()));
    366322
     
    373329      timeWeight += TMath::Sqrt(constituent->Momentum.E());
    374330
    375       charge += constituent->Charge;
    376 
    377331      candidate->AddCandidate(constituent);
    378332    }
     
    384338    candidate->DeltaEta = detaMax;
    385339    candidate->DeltaPhi = dphiMax;
    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  
     340
    467341    // --- compute N-subjettiness with N = 1,2,3,4,5 ----
    468342
     
    503377    }
    504378
     379
    505380    fOutputArray->Add(candidate);
    506381  }
Note: See TracChangeset for help on using the changeset viewer.