Fork me on GitHub

Changeset d77b51d in git for modules


Ignore:
Timestamp:
Sep 29, 2015, 2:08:10 PM (9 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
a98c7ef
Parents:
d870fc5 (diff), 06ec139 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'upstream/master'

Location:
modules
Files:
10 added
36 edited

Legend:

Unmodified
Added
Removed
  • modules/AngularSmearing.cc

    rd870fc5 rd77b51d  
    100100{
    101101  Candidate *candidate, *mother;
    102   Double_t pt, eta, phi;
     102  Double_t pt, eta, phi, e;
    103103
    104104  fItInputArray->Reset();
     
    110110    phi = candidatePosition.Phi();
    111111    pt = candidateMomentum.Pt();
     112    e = candidateMomentum.E();
    112113
    113114    // apply smearing formula for eta,phi
    114115
    115     eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta));
    116     phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta));
     116    eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta, phi, e));
     117    phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta, phi, e));
    117118   
    118119    if(pt <= 0.0) continue;
  • modules/BTagging.cc

    rd870fc5 rd77b51d  
    2222 *  Determines origin of jet,
    2323 *  applies b-tagging efficiency (miss identification rate) formulas
    24  *  and sets b-tagging flags 
     24 *  and sets b-tagging flags
    2525 *
    2626 *  \author P. Demin - UCL, Louvain-la-Neuve
     
    3434#include "classes/DelphesFormula.h"
    3535
    36 #include "ExRootAnalysis/ExRootResult.h"
    37 #include "ExRootAnalysis/ExRootFilter.h"
    38 #include "ExRootAnalysis/ExRootClassifier.h"
    39 
    4036#include "TMath.h"
    4137#include "TString.h"
     
    4642#include "TLorentzVector.h"
    4743
    48 #include <algorithm> 
     44#include <algorithm>
    4945#include <stdexcept>
    5046#include <iostream>
     
    5551//------------------------------------------------------------------------------
    5652
    57 class BTaggingPartonClassifier : public ExRootClassifier
     53BTagging::BTagging() :
     54  fItJetInputArray(0)
    5855{
    59 public:
    60 
    61   BTaggingPartonClassifier() {}
    62 
    63   Int_t GetCategory(TObject *object);
    64  
    65   Double_t fEtaMax, fPTMin;
    66 };
    67 
    68 //------------------------------------------------------------------------------
    69 
    70 Int_t BTaggingPartonClassifier::GetCategory(TObject *object)
    71 {
    72   Candidate *parton = static_cast<Candidate*>(object);
    73   const TLorentzVector &momentum = parton->Momentum;
    74   Int_t pdgCode;
    75 
    76   if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
    77  
    78   pdgCode = TMath::Abs(parton->PID);
    79   if(pdgCode != 21 && pdgCode > 5) return -1;
    80 
    81   return 0;
    82 }
    83 
    84 //------------------------------------------------------------------------------
    85 
    86 BTagging::BTagging() :
    87   fClassifier(0), fFilter(0),
    88   fItPartonInputArray(0), fItJetInputArray(0)
    89 {
    90   fClassifier = new BTaggingPartonClassifier;
    9156}
    9257
     
    9560BTagging::~BTagging()
    9661{
    97   if(fClassifier) delete fClassifier;
    9862}
    9963
     
    10973  fBitNumber = GetInt("BitNumber", 0);
    11074
    111   fDeltaR = GetDouble("DeltaR", 0.5);
    112 
    113   fClassifier->fPTMin = GetDouble("PartonPTMin", 1.0);
    114   fClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);
    115 
    11675  // read efficiency formulas
    11776  param = GetParam("EfficiencyFormula");
    11877  size = param.GetSize();
    119  
     78
    12079  fEfficiencyMap.clear();
    12180  for(i = 0; i < size/2; ++i)
     
    13998  // import input array(s)
    14099
    141   fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));
    142   fItPartonInputArray = fPartonInputArray->MakeIterator();
    143 
    144   fFilter = new ExRootFilter(fPartonInputArray);
    145  
    146100  fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
    147101  fItJetInputArray = fJetInputArray->MakeIterator();
     
    155109  DelphesFormula *formula;
    156110
    157   if(fFilter) delete fFilter;
    158111  if(fItJetInputArray) delete fItJetInputArray;
    159   if(fItPartonInputArray) delete fItPartonInputArray;
    160112
    161113  for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap)
     
    170122void BTagging::Process()
    171123{
    172   Candidate *jet, *parton;
    173   Double_t pt, eta, phi;
    174   TObjArray *partonArray;
     124  Candidate *jet;
     125  Double_t pt, eta, phi, e;
    175126  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
    176127  DelphesFormula *formula;
    177   Int_t pdgCode, pdgCodeMax;
    178128
    179   // select quark and gluons
    180   fFilter->Reset();
    181   partonArray = fFilter->GetSubArray(fClassifier, 0);
    182  
    183   if(partonArray == 0) return;
    184 
    185   TIter itPartonArray(partonArray);
    186  
    187129  // loop over all input jets
    188130  fItJetInputArray->Reset();
     
    190132  {
    191133    const TLorentzVector &jetMomentum = jet->Momentum;
    192     pdgCodeMax = -1;
    193134    eta = jetMomentum.Eta();
    194135    phi = jetMomentum.Phi();
    195136    pt = jetMomentum.Pt();
     137    e = jetMomentum.E();
    196138
    197     // loop over all input partons
    198     itPartonArray.Reset();
    199     while((parton = static_cast<Candidate*>(itPartonArray.Next())))
    200     {
    201       pdgCode = TMath::Abs(parton->PID);
    202       if(pdgCode == 21) pdgCode = 0;
    203       if(jetMomentum.DeltaR(parton->Momentum) <= fDeltaR)
    204       {
    205         if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode;
    206       }
    207     }
    208     if(pdgCodeMax == 0) pdgCodeMax = 21;
    209     if(pdgCodeMax == -1) pdgCodeMax = 0;
    210 
    211     // find an efficency formula
    212     itEfficiencyMap = fEfficiencyMap.find(pdgCodeMax);
     139    // find an efficiency formula
     140    itEfficiencyMap = fEfficiencyMap.find(jet->Flavor);
    213141    if(itEfficiencyMap == fEfficiencyMap.end())
    214142    {
     
    217145    formula = itEfficiencyMap->second;
    218146
    219     // apply an efficency formula
    220     jet->BTag |= (gRandom->Uniform() <= formula->Eval(pt, eta)) << fBitNumber;
     147    // apply an efficiency formula
     148    jet->BTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
     149
     150    // find an efficiency formula for algo flavor definition
     151    itEfficiencyMap = fEfficiencyMap.find(jet->FlavorAlgo);
     152    if(itEfficiencyMap == fEfficiencyMap.end())
     153    {
     154      itEfficiencyMap = fEfficiencyMap.find(0);
     155    }
     156    formula = itEfficiencyMap->second;
     157
     158    // apply an efficiency formula
     159    jet->BTagAlgo |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
     160
     161    // find an efficiency formula for phys flavor definition
     162    itEfficiencyMap = fEfficiencyMap.find(jet->FlavorPhys);
     163    if(itEfficiencyMap == fEfficiencyMap.end())
     164    {
     165      itEfficiencyMap = fEfficiencyMap.find(0);
     166    }
     167    formula = itEfficiencyMap->second;
     168
     169    // apply an efficiency formula
     170    jet->BTagPhys |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
    221171  }
    222172}
  • modules/BTagging.h

    rd870fc5 rd77b51d  
    3737class DelphesFormula;
    3838
    39 class ExRootFilter;
    40 class BTaggingPartonClassifier;
    41 
    4239class BTagging: public DelphesModule
    4340{
     
    5552  Int_t fBitNumber;
    5653
    57   Double_t fDeltaR;
    58 
    5954#if !defined(__CINT__) && !defined(__CLING__)
    6055  std::map< Int_t, DelphesFormula * > fEfficiencyMap; //!
    6156#endif
    6257
    63   BTaggingPartonClassifier *fClassifier; //!
    64  
    65   ExRootFilter *fFilter;
    66 
    67   TIterator *fItPartonInputArray; //!
    68  
    6958  TIterator *fItJetInputArray; //!
    70 
    71   const TObjArray *fPartonInputArray; //!
    7259 
    7360  const TObjArray *fJetInputArray; //!
  • modules/CMakeLists.txt

    rd870fc5 rd77b51d  
    77file(GLOB sources *.cc)
    88file(GLOB headers *.h)
     9list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/FastJetLinkDef.h)
    910list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/ModulesLinkDef.h)
    1011list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/Pythia8LinkDef.h)
    1112
     13DELPHES_GENERATE_DICTIONARY(FastJetDict ${headers} LINKDEF FastJetLinkDef.h)
    1214DELPHES_GENERATE_DICTIONARY(ModulesDict ${headers} LINKDEF ModulesLinkDef.h)
    1315
     
    1517list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/PileUpMergerPythia8.cc)
    1618
    17 add_library(modules OBJECT ${sources} ModulesDict.cxx)
     19add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx)
  • modules/Calorimeter.cc

    rd870fc5 rd77b51d  
    142142  }
    143143
    144 /*
    145   TFractionMap::iterator itFractionMap;
    146   for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
    147   {
    148     cout << itFractionMap->first << "   " << itFractionMap->second.first  << "   " << itFractionMap->second.second << endl;
    149   }
    150 */
     144  // read min E value for timing measurement in ECAL
     145  fTimingEnergyMin = GetDouble("TimingEnergyMin",4.);
     146  // For timing
     147  // So far this flag needs to be false
     148  // Curved extrapolation not supported
     149  fElectronsFromTrack = false;
    151150
    152151  // read min E value for towers to be saved
     
    158157
    159158  // switch on or off the dithering of the center of calorimeter towers
    160   fDitherTowerCenter = GetBool("DitherTowerCenter", true);
     159  fSmearTowerCenter = GetBool("SmearTowerCenter", true);
    161160
    162161  // read resolution formulas
     
    356355      fTrackHCalEnergy = 0.0;
    357356
    358       fTowerECalTime = 0.0;
    359       fTowerHCalTime = 0.0;
    360 
    361       fTrackECalTime = 0.0;
    362       fTrackHCalTime = 0.0;
    363 
    364       fTowerECalTimeWeight = 0.0;
    365       fTowerHCalTimeWeight = 0.0;
    366 
    367357      fTowerTrackHits = 0;
    368358      fTowerPhotonHits = 0;
     
    380370      position = track->Position;
    381371
    382 
    383372      ecalEnergy = momentum.E() * fTrackECalFractions[number];
    384373      hcalEnergy = momentum.E() * fTrackHCalFractions[number];
     
    387376      fTrackHCalEnergy += hcalEnergy;
    388377
    389       fTrackECalTime += TMath::Sqrt(ecalEnergy)*position.T();
    390       fTrackHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
    391 
    392       fTrackECalTimeWeight += TMath::Sqrt(ecalEnergy);
    393       fTrackHCalTimeWeight += TMath::Sqrt(hcalEnergy);
     378      if(ecalEnergy > fTimingEnergyMin && fTower)
     379      {
     380        if(fElectronsFromTrack)
     381        {
     382          fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, track->Position.T()));
     383        }
     384      }
    394385
    395386      fTowerTrackArray->Add(track);
     
    412403    fTowerHCalEnergy += hcalEnergy;
    413404
    414     fTowerECalTime += TMath::Sqrt(ecalEnergy)*position.T();
    415     fTowerHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
    416 
    417     fTowerECalTimeWeight += TMath::Sqrt(ecalEnergy);
    418     fTowerHCalTimeWeight += TMath::Sqrt(hcalEnergy);
    419 
     405    if(ecalEnergy > fTimingEnergyMin && fTower)
     406    {
     407      if (abs(particle->PID) != 11 || !fElectronsFromTrack)
     408      {
     409        fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T()));
     410      }
     411    }
    420412
    421413    fTower->AddCandidate(particle);
     
    434426  Double_t ecalEnergy, hcalEnergy;
    435427  Double_t ecalSigma, hcalSigma;
    436   Double_t ecalTime, hcalTime, time;
     428  Float_t weight, sumWeightedTime, sumWeight;
    437429
    438430  if(!fTower) return;
     
    444436  hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma);
    445437
    446   ecalTime = (fTowerECalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerECalTime/fTowerECalTimeWeight;
    447   hcalTime = (fTowerHCalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerHCalTime/fTowerHCalTimeWeight;
    448 
    449438  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
    450439  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
     
    454443
    455444  energy = ecalEnergy + hcalEnergy;
    456   time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy));
    457 
    458   if(fDitherTowerCenter)
     445
     446  if(fSmearTowerCenter)
    459447  {
    460448    eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
     
    469457  pt = energy / TMath::CosH(eta);
    470458
    471   fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
     459  // Time calculation for tower
     460  fTower->NTimeHits = 0;
     461  sumWeightedTime = 0.0;
     462  sumWeight = 0.0;
     463
     464  for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i)
     465  {
     466    weight = TMath::Sqrt(fTower->ECalEnergyTimePairs[i].first);
     467    sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second;
     468    sumWeight += weight;
     469    fTower->NTimeHits++;
     470  }
     471
     472  if(sumWeight > 0.0)
     473  {
     474    fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime/sumWeight);
     475  }
     476  else
     477  {
     478    fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 999999.9);
     479  }
     480
     481
    472482  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
    473483  fTower->Eem = ecalEnergy;
  • modules/Calorimeter.h

    rd870fc5 rd77b51d  
    6060  Double_t fTrackECalEnergy, fTrackHCalEnergy;
    6161
    62   Double_t fTowerECalTime, fTowerHCalTime;
    63   Double_t fTrackECalTime, fTrackHCalTime;
    64 
    65   Double_t fTowerECalTimeWeight, fTowerHCalTimeWeight;
    66   Double_t fTrackECalTimeWeight, fTrackHCalTimeWeight;
     62  Double_t fTimingEnergyMin;
     63  Bool_t fElectronsFromTrack;
    6764
    6865  Int_t fTowerTrackHits, fTowerPhotonHits;
     
    7471  Double_t fHCalEnergySignificanceMin;
    7572
    76   Bool_t fDitherTowerCenter;
     73  Bool_t fSmearTowerCenter;
    7774
    7875  TFractionMap fFractionMap; //!
  • modules/Efficiency.cc

    rd870fc5 rd77b51d  
    9696{
    9797  Candidate *candidate;
    98   Double_t pt, eta, phi;
     98  Double_t pt, eta, phi, e;
    9999
    100100  fItInputArray->Reset();
     
    106106    phi = candidatePosition.Phi();
    107107    pt = candidateMomentum.Pt();
     108    e = candidateMomentum.E();
    108109
    109110    // apply an efficency formula
    110     if(gRandom->Uniform() > fFormula->Eval(pt, eta)) continue;
     111    if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e)) continue;
    111112   
    112113    fOutputArray->Add(candidate);
  • modules/EnergyScale.cc

    rd870fc5 rd77b51d  
    104104    momentum = candidate->Momentum;
    105105
    106     scale = fFormula->Eval(momentum.Pt(), momentum.Eta());
     106    scale = fFormula->Eval(momentum.Pt(), momentum.Eta(), momentum.Phi(), momentum.E());
    107107
    108108    if(scale > 0.0) momentum *= scale;
  • modules/EnergySmearing.cc

    rd870fc5 rd77b51d  
    9696{
    9797  Candidate *candidate, *mother;
    98   Double_t energy, eta, phi;
     98  Double_t pt, energy, eta, phi;
    9999
    100100  fItInputArray->Reset();
     
    103103    const TLorentzVector &candidatePosition = candidate->Position;
    104104    const TLorentzVector &candidateMomentum = candidate->Momentum;
     105   
     106    pt = candidatePosition.Pt();
    105107    eta = candidatePosition.Eta();
    106108    phi = candidatePosition.Phi();
     
    108110 
    109111    // apply smearing formula
    110     energy = gRandom->Gaus(energy, fFormula->Eval(0.0, eta, 0.0, energy));
     112    energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy));
    111113     
    112114    if(energy <= 0.0) continue;
  • modules/FastJetFinder.cc

    rd870fc5 rd77b51d  
    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
    6872using namespace std;
    6973using namespace fastjet;
     
    9296  JetDefinition::Plugin *plugin = 0;
    9397  JetDefinition::Recombiner *recomb = 0;
    94   NjettinessPlugin *njetPlugin = 0;
    95 
    96   // read eta ranges
    97 
    98   ExRootConfParam param = GetParam("RhoEtaRange");
     98  ExRootConfParam param;
    9999  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;
    107102
    108103  // define algorithm
     
    130125  fN = GetInt("N", 2);                  // used only if Njettiness is used as jet clustering algo (case 8)
    131126
     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
    132149  // ---  Jet Area Parameters ---
    133150  fAreaAlgorithm = GetInt("AreaAlgorithm", 0);
     
    197214      break;
    198215    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);
    201218      break;
    202219  }
     
    204221  fPlugin = plugin;
    205222  fRecomb = recomb;
    206   fNjettinessPlugin = njetPlugin;
    207223
    208224  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  }
    209244
    210245  // import input array
     
    223258void FastJetFinder::Finish()
    224259{
     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
    225267  if(fItInputArray) delete fItInputArray;
    226268  if(fDefinition) delete fDefinition;
     
    241283  Double_t time, timeWeight;
    242284  Int_t number;
     285  Int_t charge;
    243286  Double_t rho = 0.0;
    244287  PseudoJet jet, area;
    245   vector<PseudoJet> inputList, outputList;
    246288  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;
    248292
    249293  DelphesFactory *factory = GetFactory();
     
    276320  if(fComputeRho && fAreaDefinition)
    277321  {
    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();
    284326
    285327      candidate = factory->NewCandidate();
    286328      candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho);
    287       candidate->Edges[0] = itEtaRangeMap->first;
    288       candidate->Edges[1] = itEtaRangeMap->second;
     329      candidate->Edges[0] = itEstimators->etaMin;
     330      candidate->Edges[1] = itEstimators->etaMax;
    289331      fRhoOutputArray->Add(candidate);
    290332    }
     
    298340  detaMax = 0.0;
    299341  dphiMax = 0.0;
    300   vector<PseudoJet>::iterator itInputList, itOutputList;
    301342  for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList)
    302343  {
     
    314355    timeWeight = 0.0;
    315356
     357    charge = 0;
     358
    316359    inputList.clear();
    317360    inputList = sequence->constituents(*itOutputList);
     
    319362    for(itInputList = inputList.begin(); itInputList != inputList.end(); ++itInputList)
    320363    {
     364      if(itInputList->user_index() < 0) continue;
    321365      constituent = static_cast<Candidate*>(fInputArray->At(itInputList->user_index()));
    322366
     
    329373      timeWeight += TMath::Sqrt(constituent->Momentum.E());
    330374
     375      charge += constituent->Charge;
     376
    331377      candidate->AddCandidate(constituent);
    332378    }
     
    338384    candidate->DeltaEta = detaMax;
    339385    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 
    341467    // --- compute N-subjettiness with N = 1,2,3,4,5 ----
    342468
     
    377503    }
    378504
    379 
    380505    fOutputArray->Add(candidate);
    381506  }
  • modules/FastJetFinder.h

    rd870fc5 rd77b51d  
    3030#include "classes/DelphesModule.h"
    3131
    32 #include <map>
     32#include <vector>
    3333
    3434class TObjArray;
     
    3838  class JetDefinition;
    3939  class AreaDefinition;
    40   class Selector;
     40  class JetMedianBackgroundEstimator;
    4141  namespace contrib {
    4242    class NjettinessPlugin;
     
    8383  Int_t fN ;
    8484
     85  //-- Trimming parameters --
     86 
     87  Bool_t fComputeTrimming;
     88  Double_t fRTrim;
     89  Double_t fPtFracTrim;
     90 
     91  //-- Pruning parameters --
     92
     93  Bool_t fComputePruning;
     94  Double_t fZcutPrun;
     95  Double_t fRcutPrun;
     96  Double_t fRPrun;
     97
     98  //-- SoftDrop parameters --
     99
     100  Bool_t fComputeSoftDrop;
     101  Double_t fBetaSoftDrop;
     102  Double_t fSymmetryCutSoftDrop;
     103  Double_t fR0SoftDrop;
     104
    85105  // --- FastJet Area method --------
    86106
     
    100120  Double_t fEffectiveRfact;
    101121
    102   std::map< Double_t, Double_t > fEtaRangeMap; //!
     122#if !defined(__CINT__) && !defined(__CLING__)
     123  struct TEstimatorStruct
     124  {
     125    fastjet::JetMedianBackgroundEstimator *estimator;
     126    Double_t etaMin, etaMax;
     127  };
     128
     129  std::vector< TEstimatorStruct > fEstimators; //!
     130#endif
    103131
    104132  TIterator *fItInputArray; //!
  • modules/FastJetLinkDef.h

    rd870fc5 rd77b51d  
    2828#include "modules/FastJetFinder.h"
    2929#include "modules/FastJetGridMedianEstimator.h"
     30#include "modules/RunPUPPI.h"
    3031
    3132#ifdef __CINT__
     
    3738#pragma link C++ class FastJetFinder+;
    3839#pragma link C++ class FastJetGridMedianEstimator+;
     40#pragma link C++ class RunPUPPI+;
    3941
    4042#endif
  • modules/IdentificationMap.cc

    rd870fc5 rd77b51d  
    6969void IdentificationMap::Init()
    7070{
    71   // read efficiency formula
    72 
    73 
    7471  TMisIDMap::iterator itEfficiencyMap;
    7572  ExRootConfParam param;
     
    8784    formula->Compile(param[i*3 + 2].GetString());
    8885    pdg = param[i*3].GetInt();
    89     fEfficiencyMap.insert(make_pair(pdg,make_pair(param[i*3 + 1].GetInt(),formula)));
    90 
    91    // cout<<param[i*3].GetInt()<<","<<param[i*3+1].GetInt()<<","<<param[i*3 + 2].GetString()<<endl;
    92 
     86    fEfficiencyMap.insert(make_pair(pdg, make_pair(param[i*3 + 1].GetInt(), formula)));
    9387  }
    9488
     
    10094    formula->Compile("1.0");
    10195
    102     fEfficiencyMap.insert(make_pair(0,make_pair(0,formula)));
     96    fEfficiencyMap.insert(make_pair(0, make_pair(0, formula)));
    10397  }
    10498
     
    126120    if(formula) delete formula;
    127121  }
    128 
    129122}
    130123
     
    134127{
    135128  Candidate *candidate;
    136   Double_t pt, eta, phi;
     129  Double_t pt, eta, phi, e;
    137130  TMisIDMap::iterator itEfficiencyMap;
    138131  pair <TMisIDMap::iterator, TMisIDMap::iterator> range;
    139132  DelphesFormula *formula;
    140   Int_t pdgIn, pdgOut, charge;
     133  Int_t pdgCodeIn, pdgCodeOut, charge;
    141134
    142   Double_t P, Pi;
    143 
    144  // cout<<"------------ New Event ------------"<<endl;
     135  Double_t p, r, total;
    145136
    146137  fItInputArray->Reset();
     
    152143    phi = candidatePosition.Phi();
    153144    pt = candidateMomentum.Pt();
    154     pdgIn = candidate->PID;
     145    e = candidateMomentum.E();
     146   
     147    pdgCodeIn = candidate->PID;
    155148    charge = candidate->Charge;
    156149
    157    // cout<<"------------ New Candidate ------------"<<endl;
    158    // cout<<candidate->PID<<"   "<<pt<<","<<eta<<","<<phi<<endl;
     150    // first check that PID of this particle is specified in the map
     151    // otherwise, look for PID = 0
    159152
    160     P = 1.0;
     153    itEfficiencyMap = fEfficiencyMap.find(pdgCodeIn);
    161154
    162     //first check that PID of this particle is specified in cfg, if not set look for PID=0
    163 
    164     itEfficiencyMap = fEfficiencyMap.find(pdgIn);
    165 
    166     range = fEfficiencyMap.equal_range(pdgIn);
    167     if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgIn);
     155    range = fEfficiencyMap.equal_range(pdgCodeIn);
     156    if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgCodeIn);
    168157    if(range.first == range.second) range = fEfficiencyMap.equal_range(0);
    169158
    170     //loop over submap for this pid
    171     for (TMisIDMap::iterator it=range.first; it!=range.second; ++it)
     159    r = gRandom->Uniform();
     160    total = 0.0;
     161
     162    // loop over sub-map for this PID
     163    for(TMisIDMap::iterator it = range.first; it != range.second; ++it)
    172164    {
     165      formula = (it->second).second;
     166      pdgCodeOut = (it->second).first;
    173167
    174       formula = (it->second).second;
    175       pdgOut = (it->second).first;
     168      p = formula->Eval(pt, eta, phi, e);
    176169
    177       Pi = formula->Eval(pt, eta);
    178 
    179       // check that sum of probabilities does not exceed 1.
    180       P = (P - Pi)/P;
    181 
    182       if( P < 0.0 ) continue;
    183       else
     170      if(total <= r && r < total + p)
    184171      {
    185 
    186        //randomly assign a PID to particle according to map
    187        Double_t rndm = gRandom->Uniform();
    188 
    189        if(rndm > P)
    190        {
    191          //change PID of particle
    192          if(pdgOut != 0) candidate->PID = charge*pdgOut;
    193          fOutputArray->Add(candidate);
    194          break;
    195        }
     172        // change PID of particle
     173        if(pdgCodeOut != 0) candidate->PID = charge*pdgCodeOut;
     174        fOutputArray->Add(candidate);
     175        break;
    196176      }
    197177
     178      total += p;
    198179    }
    199 
    200    }
    201 
     180  }
    202181}
    203182
  • modules/IdentificationMap.h

    rd870fc5 rd77b51d  
    4949private:
    5050
    51   typedef std::multimap< Int_t, std::pair<Int_t , DelphesFormula * > > TMisIDMap; //!
     51  typedef std::multimap< Int_t, std::pair< Int_t, DelphesFormula * > > TMisIDMap; //!
    5252
    53   TMisIDMap fEfficiencyMap;
     53  TMisIDMap fEfficiencyMap; //!
    5454
    5555  TIterator *fItInputArray; //!
  • modules/ImpactParameterSmearing.cc

    rd870fc5 rd77b51d  
    9797  Candidate *candidate, *particle, *mother;
    9898  Double_t xd, yd, zd, dxy, sx, sy, sz, ddxy;
    99   Double_t pt, eta, px, py;
     99  Double_t pt, eta, px, py, phi, e;
    100100
    101101  fItInputArray->Reset();
     
    110110    eta = candidateMomentum.Eta();
    111111    pt = candidateMomentum.Pt();
     112    phi = candidateMomentum.Phi();
     113    e = candidateMomentum.E();
     114   
    112115    px = candidateMomentum.Px();
    113116    py = candidateMomentum.Py();
     
    119122
    120123    // calculate smeared values
    121     sx = gRandom->Gaus(0.0, fFormula->Eval(pt, eta));
    122     sy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta));
    123     sz = gRandom->Gaus(0.0, fFormula->Eval(pt, eta));
     124    sx = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
     125    sy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
     126    sz = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
    124127
    125128    xd += sx;
     
    130133    dxy = (xd*py - yd*px)/pt;
    131134
    132     ddxy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta));
     135    ddxy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e));
    133136
    134137    // fill smeared values in candidate
  • modules/Isolation.cc

    rd870fc5 rd77b51d  
    2525 *  the transverse momenta fraction within (PTRatioMin, PTRatioMax].
    2626 *
    27  *  \author P. Demin - UCL, Louvain-la-Neuve
     27 *  \author P. Demin, M. Selvaggi, R. Gerosa - UCL, Louvain-la-Neuve
    2828 *
    2929 */
     
    153153  Candidate *candidate, *isolation, *object;
    154154  TObjArray *isolationArray;
    155   Double_t sum, ratio;
     155  Double_t sumCharged, sumNeutral, sumAllParticles, sumChargedPU, sumDBeta, ratioDBeta, sumRhoCorr, ratioRhoCorr;
    156156  Int_t counter;
    157157  Double_t eta = 0.0;
    158158  Double_t rho = 0.0;
    159 
    160   if(fRhoInputArray && fRhoInputArray->GetEntriesFast() > 0)
    161   {
    162     candidate = static_cast<Candidate*>(fRhoInputArray->At(0));
    163     rho = candidate->Momentum.Pt();
    164   }
    165159
    166160  // select isolation objects
     
    178172    const TLorentzVector &candidateMomentum = candidate->Momentum;
    179173    eta = TMath::Abs(candidateMomentum.Eta());
    180 
    181     // loop over all input tracks
    182     sum = 0.0;
    183     counter = 0;
    184     itIsolationArray.Reset();
    185     while((isolation = static_cast<Candidate*>(itIsolationArray.Next())))
    186     {
    187       const TLorentzVector &isolationMomentum = isolation->Momentum;
    188 
    189       if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax &&
    190          candidate->GetUniqueID() != isolation->GetUniqueID())
    191       {
    192         sum += isolationMomentum.Pt();
    193         ++counter;
    194       }
    195     }
    196174
    197175    // find rho
     
    209187    }
    210188
    211     // correct sum for pile-up contamination
    212     sum = sum - rho*fDeltaRMax*fDeltaRMax*TMath::Pi();
    213 
    214     ratio = sum/candidateMomentum.Pt();
    215     if((fUsePTSum && sum > fPTSumMax) || ratio > fPTRatioMax) continue;
    216 
     189    // loop over all input tracks
     190   
     191    sumNeutral = 0.0;
     192    sumCharged = 0.0;
     193    sumChargedPU = 0.0;
     194    sumAllParticles = 0.0;
     195   
     196    counter = 0;
     197    itIsolationArray.Reset();
     198   
     199    while((isolation = static_cast<Candidate*>(itIsolationArray.Next())))
     200    {
     201      const TLorentzVector &isolationMomentum = isolation->Momentum;
     202
     203      if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax &&
     204         candidate->GetUniqueID() != isolation->GetUniqueID())
     205      {
     206        sumAllParticles += isolationMomentum.Pt();
     207        if(isolation->Charge !=0)
     208        {
     209          sumCharged += isolationMomentum.Pt();
     210          if(isolation->IsRecoPU != 0) sumChargedPU += isolationMomentum.Pt();
     211        }
     212        else
     213        {
     214          sumNeutral += isolationMomentum.Pt();
     215        }
     216        ++counter;
     217      }
     218    }
     219
     220    // find rho
     221    rho = 0.0;
     222    if(fRhoInputArray)
     223    {
     224      fItRhoInputArray->Reset();
     225      while((object = static_cast<Candidate*>(fItRhoInputArray->Next())))
     226      {
     227        if(eta >= object->Edges[0] && eta < object->Edges[1])
     228        {
     229          rho = object->Momentum.Pt();
     230        }
     231      }
     232    }
     233
     234     // correct sum for pile-up contamination
     235    sumDBeta = sumCharged + TMath::Max(sumNeutral-0.5*sumChargedPU,0.0);
     236    sumRhoCorr = sumCharged + TMath::Max(sumNeutral-TMath::Max(rho,0.0)*fDeltaRMax*fDeltaRMax*TMath::Pi(),0.0);
     237    ratioDBeta = sumDBeta/candidateMomentum.Pt();
     238    ratioRhoCorr = sumRhoCorr/candidateMomentum.Pt();
     239   
     240    candidate->IsolationVar = ratioDBeta;
     241    candidate->IsolationVarRhoCorr = ratioRhoCorr;
     242    candidate->SumPtCharged = sumCharged;
     243    candidate->SumPtNeutral = sumNeutral;
     244    candidate->SumPtChargedPU = sumChargedPU;
     245    candidate->SumPt = sumAllParticles;
     246
     247    if((fUsePTSum && sumDBeta > fPTSumMax) || (!fUsePTSum && ratioDBeta > fPTRatioMax)) continue;
    217248    fOutputArray->Add(candidate);
    218249  }
  • modules/JetPileUpSubtractor.cc

    rd870fc5 rd77b51d  
    109109    momentum = candidate->Momentum;
    110110    area = candidate->Area;
    111     eta = TMath::Abs(momentum.Eta());
     111    eta = momentum.Eta();
    112112
    113113    // find rho
  • modules/ModulesLinkDef.h

    rd870fc5 rd77b51d  
    2929
    3030#include "modules/AngularSmearing.h"
     31#include "modules/PhotonConversions.h"
    3132#include "modules/ParticlePropagator.h"
    3233#include "modules/Efficiency.h"
     
    5051#include "modules/JetPileUpSubtractor.h"
    5152#include "modules/TrackPileUpSubtractor.h"
     53#include "modules/TaggingParticlesSkimmer.h"
    5254#include "modules/PileUpJetID.h"
    5355#include "modules/ConstituentFilter.h"
     
    5759#include "modules/Weighter.h"
    5860#include "modules/Hector.h"
     61#include "modules/JetFlavorAssociation.h"
     62#include "modules/JetFakeParticle.h"
    5963#include "modules/ExampleModule.h"
    6064
     
    6872
    6973#pragma link C++ class AngularSmearing+;
     74#pragma link C++ class PhotonConversions+;
    7075#pragma link C++ class ParticlePropagator+;
    7176#pragma link C++ class Efficiency+;
     
    8994#pragma link C++ class JetPileUpSubtractor+;
    9095#pragma link C++ class TrackPileUpSubtractor+;
     96#pragma link C++ class TaggingParticlesSkimmer+;
    9197#pragma link C++ class PileUpJetID+;
    9298#pragma link C++ class ConstituentFilter+;
     
    96102#pragma link C++ class Weighter+;
    97103#pragma link C++ class Hector+;
     104#pragma link C++ class JetFlavorAssociation+;
     105#pragma link C++ class JetFakeParticle+;
    98106#pragma link C++ class ExampleModule+;
    99107
  • modules/MomentumSmearing.cc

    rd870fc5 rd77b51d  
    9696{
    9797  Candidate *candidate, *mother;
    98   Double_t pt, eta, phi;
     98  Double_t pt, eta, phi, e;
    9999
    100100  fItInputArray->Reset();
     
    106106    phi = candidatePosition.Phi();
    107107    pt = candidateMomentum.Pt();
     108    e = candidateMomentum.E();
    108109
    109110    // apply smearing formula
    110     pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta) * pt);
     111    pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt);
    111112   
    112113    if(pt <= 0.0) continue;
  • modules/PdgCodeFilter.cc

    rd870fc5 rd77b51d  
    7474  fPTMin = GetDouble("PTMin", 0.0);
    7575
     76  fInvertPdg = GetBool("InvertPdg", false);
     77
     78  fRequireStatus = GetBool("RequireStatus", false);
     79  fStatus = GetInt("Status", 1);
     80
    7681  // import input array
    7782  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
     
    109114  Double_t pt;
    110115
     116  const Bool_t requireStatus = fRequireStatus;
     117  const Bool_t invertPdg = fInvertPdg;
     118  const int reqStatus = fStatus;
     119
    111120  fItInputArray->Reset();
    112121  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     
    116125    pt = candidateMomentum.Pt();
    117126
     127    if(pt < fPTMin) continue;
     128    if(requireStatus && (candidate->Status != reqStatus)) continue;
     129
    118130    pass = kTRUE;
    119 
    120     if(pt < fPTMin) pass = kFALSE;
    121131    if(find(fPdgCodes.begin(), fPdgCodes.end(), pdgCode) != fPdgCodes.end()) pass = kFALSE;
    122132
     133    if (invertPdg) pass = !pass;
    123134    if(pass) fOutputArray->Add(candidate);
    124135  }
  • modules/PdgCodeFilter.h

    rd870fc5 rd77b51d  
    5050
    5151  Double_t fPTMin; //!
     52  Bool_t fInvertPdg; //!
     53  Bool_t fRequireStatus; //!
     54  Int_t fStatus; //!
    5255
    5356  std::vector<Int_t> fPdgCodes;
  • modules/PileUpJetID.cc

    rd870fc5 rd77b51d  
    1 /*
    2  *  Delphes: a framework for fast simulation of a generic collider experiment
    3  *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
    4  *
    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.
    9  *
    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.
    14  *
    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 
    191
    202/** \class PileUpJetID
    213 *
    22  *  CMS PileUp Jet ID Variables, based on http://cds.cern.ch/record/1581583
     4 *  CMS PileUp Jet ID Variables
    235 *
    24  *  \author S. Zenz, December 2013
     6 *  \author S. Zenz
    257 *
    268 */
     
    4123#include "TRandom3.h"
    4224#include "TObjArray.h"
    43 #include "TDatabasePDG.h"
     25//#include "TDatabasePDG.h"
    4426#include "TLorentzVector.h"
    4527
     
    5436
    5537PileUpJetID::PileUpJetID() :
    56   fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0),fItVertexInputArray(0)
     38  fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0)
    5739{
    5840
     
    7052void PileUpJetID::Init()
    7153{
     54
    7255  fJetPTMin = GetDouble("JetPTMin", 20.0);
    7356  fParameterR = GetDouble("ParameterR", 0.5);
    7457  fUseConstituents = GetInt("UseConstituents", 0);
    7558
     59  fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1);
     60  fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1);
     61  fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1);
     62  fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1);
     63  fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1);
     64  fJetPTMinForNeutrals = GetDouble("JetPTMinForNeutrals", 20.0);
     65  fNeutralPTMin = GetDouble("NeutralPTMin", 2.0);
     66
    7667  fAverageEachTower = false; // for timing
    7768
     
    8172  fItJetInputArray = fJetInputArray->MakeIterator();
    8273
    83   fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/eflowTracks"));
     74  fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
    8475  fItTrackInputArray = fTrackInputArray->MakeIterator();
    8576
    86   fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/eflowTowers"));
     77  fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "ParticlePropagator/tracks"));
    8778  fItNeutralInputArray = fNeutralInputArray->MakeIterator();
    8879
    89   fVertexInputArray = ImportArray(GetString("VertexInputArray", "PileUpMerger/vertices"));
    90   fItVertexInputArray = fVertexInputArray->MakeIterator();
    91 
    92   fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
    93 
    9480  // create output array(s)
    9581
    9682  fOutputArray = ExportArray(GetString("OutputArray", "jets"));
     83
     84  fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets","eflowtowers"));
     85
    9786}
    9887
     
    10190void PileUpJetID::Finish()
    10291{
     92  //  cout << "In finish" << endl;
     93
    10394  if(fItJetInputArray) delete fItJetInputArray;
    10495  if(fItTrackInputArray) delete fItTrackInputArray;
    10596  if(fItNeutralInputArray) delete fItNeutralInputArray;
    106   if(fItVertexInputArray) delete fItVertexInputArray;
     97
    10798}
    10899
     
    113104  Candidate *candidate, *constituent;
    114105  TLorentzVector momentum, area;
    115   Int_t i, nc, nn;
    116   Double_t sumpt, sumptch, sumptchpv, sumptchpu, sumdrsqptsq, sumptsq;
    117   Double_t dr, pt, pt_ann[5];
    118   Double_t zvtx = 0.0;
    119 
    120   Candidate *track;
    121 
    122   // find z position of primary vertex
    123 
    124   fItVertexInputArray->Reset();
    125   while((candidate = static_cast<Candidate*>(fItVertexInputArray->Next())))
    126   {
    127     if(!candidate->IsPU)
    128     {
    129       zvtx = candidate->Position.Z();
    130       break;
    131     }
    132   }
     106
     107  Candidate *trk;
    133108
    134109  // loop over all input candidates
     
    139114    area = candidate->Area;
    140115
    141     sumpt = 0.0;
    142     sumptch = 0.0;
    143     sumptchpv = 0.0;
    144     sumptchpu = 0.0;
    145     sumdrsqptsq = 0.0;
    146     sumptsq = 0.0;
    147     nc = 0;
    148     nn = 0;
    149 
    150     for(i = 0; i < 5; ++i)
    151     {
    152       pt_ann[i] = 0.0;
    153     }
    154 
    155     if(fUseConstituents)
    156     {
     116    float sumT0 = 0.;
     117    float sumT1 = 0.;
     118    float sumT10 = 0.;
     119    float sumT20 = 0.;
     120    float sumT30 = 0.;
     121    float sumT40 = 0.;
     122    float sumWeightsForT = 0.;
     123    candidate->NTimeHits = 0;
     124
     125    float sumpt = 0.;
     126    float sumptch = 0.;
     127    float sumptchpv = 0.;
     128    float sumptchpu = 0.;
     129    float sumdrsqptsq = 0.;
     130    float sumptsq = 0.;
     131    int nc = 0;
     132    int nn = 0;
     133    float pt_ann[5];
     134
     135    for (int i = 0 ; i < 5 ; i++) {
     136      pt_ann[i] = 0.;
     137    }
     138
     139    if (fUseConstituents) {
    157140      TIter itConstituents(candidate->GetCandidates());
    158       while((constituent = static_cast<Candidate*>(itConstituents.Next())))
    159       {
    160         pt = constituent->Momentum.Pt();
    161         dr = candidate->Momentum.DeltaR(constituent->Momentum);
    162         sumpt += pt;
    163         sumdrsqptsq += dr*dr*pt*pt;
    164         sumptsq += pt*pt;
    165         if(constituent->Charge == 0)
    166         {
    167           // neutrals
    168           ++nn;
    169         }
    170         else
    171         {
    172           // charged
    173           if(constituent->IsPU && TMath::Abs(constituent->Position.Z()-zvtx) > fZVertexResolution)
    174           {
    175             sumptchpu += pt;
    176           }
    177           else
    178           {
    179             sumptchpv += pt;
    180           }
    181           sumptch += pt;
    182           ++nc;
    183         }
    184         for(i = 0; i < 5; ++i)
    185         {
    186           if(dr > 0.1*i && dr < 0.1*(i + 1))
    187           {
    188             pt_ann[i] += pt;
    189           }
    190         }
    191       }
    192     }
    193     else
    194     {
     141      while((constituent = static_cast<Candidate*>(itConstituents.Next()))) {
     142        float pt = constituent->Momentum.Pt();
     143        float dr = candidate->Momentum.DeltaR(constituent->Momentum);
     144        //      cout << " There exists a constituent with dr=" << dr << endl;
     145        sumpt += pt;
     146        sumdrsqptsq += dr*dr*pt*pt;
     147        sumptsq += pt*pt;
     148        if (constituent->Charge == 0) {
     149          nn++;
     150        } else {
     151          if (constituent->IsRecoPU) {
     152            sumptchpu += pt;
     153          } else {
     154            sumptchpv += pt;
     155          }
     156          sumptch += pt;
     157          nc++;
     158        }
     159        for (int i = 0 ; i < 5 ; i++) {
     160          if (dr > 0.1*i && dr < 0.1*(i+1)) {
     161            pt_ann[i] += pt;
     162          }
     163        }
     164        float tow_sumT = 0;
     165        float tow_sumW = 0;
     166        for (int i = 0 ; i < constituent->ECalEnergyTimePairs.size() ; i++) {
     167          float w = TMath::Sqrt(constituent->ECalEnergyTimePairs[i].first);
     168          if (fAverageEachTower) {
     169            tow_sumT += w*constituent->ECalEnergyTimePairs[i].second;
     170            tow_sumW += w;
     171          } else {
     172            sumT0 += w*constituent->ECalEnergyTimePairs[i].second;
     173            sumT1 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.001);
     174            sumT10 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.010);
     175            sumT20 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.020);
     176            sumT30 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.030);
     177            sumT40 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.040);
     178            sumWeightsForT += w;
     179            candidate->NTimeHits++;
     180          }
     181        }
     182        if (fAverageEachTower && tow_sumW > 0.) {
     183          sumT0 += tow_sumT;
     184          sumT1 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.001);
     185          sumT10 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0010);
     186          sumT20 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0020);
     187          sumT30 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0030);
     188          sumT40 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0040);
     189          sumWeightsForT += tow_sumW;
     190          candidate->NTimeHits++;
     191        }
     192      }
     193    } else {
    195194      // Not using constituents, using dr
    196195      fItTrackInputArray->Reset();
    197       while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
    198       {
    199         if(track->Momentum.DeltaR(candidate->Momentum) < fParameterR)
    200         {
    201           pt = track->Momentum.Pt();
    202           sumpt += pt;
    203           sumptch += pt;
    204           if(track->IsPU && TMath::Abs(track->Position.Z()-zvtx) > fZVertexResolution)
    205           {
    206             sumptchpu += pt;
    207           }
    208           else
    209           {
    210             sumptchpv += pt;
    211           }
    212           dr = candidate->Momentum.DeltaR(track->Momentum);
    213           sumdrsqptsq += dr*dr*pt*pt;
    214           sumptsq += pt*pt;
    215           nc++;
    216           for(i = 0; i < 5; ++i)
    217           {
    218             if(dr > 0.1*i && dr < 0.1*(i + 1))
    219             {
    220               pt_ann[i] += pt;
    221             }
    222           }
    223         }
    224       }
    225 
     196      while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) {
     197        if (trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
     198          float pt = trk->Momentum.Pt();
     199          sumpt += pt;
     200          sumptch += pt;
     201          if (trk->IsRecoPU) {
     202            sumptchpu += pt;
     203          } else {
     204            sumptchpv += pt;
     205          }
     206          float dr = candidate->Momentum.DeltaR(trk->Momentum);
     207          sumdrsqptsq += dr*dr*pt*pt;
     208          sumptsq += pt*pt;
     209          nc++;
     210          for (int i = 0 ; i < 5 ; i++) {
     211            if (dr > 0.1*i && dr < 0.1*(i+1)) {
     212              pt_ann[i] += pt;
     213            }
     214          }
     215        }
     216      }
    226217      fItNeutralInputArray->Reset();
    227       while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next())))
    228       {
    229         if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR)
    230         {
    231           pt = constituent->Momentum.Pt();
    232           sumpt += pt;
    233           dr = candidate->Momentum.DeltaR(constituent->Momentum);
    234           sumdrsqptsq += dr*dr*pt*pt;
    235           sumptsq += pt*pt;
    236           nn++;
    237           for(i = 0; i < 5; ++i)
    238           {
    239             if(dr > 0.1*i && dr < 0.1*(i + 1))
    240             {
    241               pt_ann[i] += pt;
    242             }
    243           }
    244         }
    245       }
    246     }
    247 
    248     if(sumptch > 0.0)
    249     {
    250       candidate->Beta = sumptchpu/sumptch;
    251       candidate->BetaStar = sumptchpv/sumptch;
    252     }
    253     else
    254     {
    255       candidate->Beta = -999.0;
    256       candidate->BetaStar = -999.0;
    257     }
    258     if(sumptsq > 0.0)
    259     {
     218      while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) {
     219        if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
     220          float pt = constituent->Momentum.Pt();
     221          sumpt += pt;
     222          float dr = candidate->Momentum.DeltaR(constituent->Momentum);
     223          sumdrsqptsq += dr*dr*pt*pt;
     224          sumptsq += pt*pt;
     225          nn++;
     226          for (int i = 0 ; i < 5 ; i++) {
     227            if (dr > 0.1*i && dr < 0.1*(i+1)) {
     228            pt_ann[i] += pt;
     229            }
     230          }
     231        }
     232      }
     233    }
     234
     235    if (sumptch > 0.) {
     236      candidate->Beta = sumptchpv/sumptch;
     237      candidate->BetaStar = sumptchpu/sumptch;
     238    } else {
     239      candidate->Beta = -999.;
     240      candidate->BetaStar = -999.;
     241    }
     242    if (sumptsq > 0.) {
    260243      candidate->MeanSqDeltaR = sumdrsqptsq/sumptsq;
    261     }
    262     else
    263     {
    264       candidate->MeanSqDeltaR = -999.0;
     244    } else {
     245      candidate->MeanSqDeltaR = -999.;
    265246    }
    266247    candidate->NCharged = nc;
    267248    candidate->NNeutrals = nn;
    268     if(sumpt > 0.0)
    269     {
     249    if (sumpt > 0.) {
    270250      candidate->PTD = TMath::Sqrt(sumptsq) / sumpt;
    271       for(i = 0; i < 5; ++i)
    272       {
     251      for (int i = 0 ; i < 5 ; i++) {
    273252        candidate->FracPt[i] = pt_ann[i]/sumpt;
    274253      }
    275     }
    276     else
    277     {
    278       candidate->PTD = -999.0;
    279       for(i = 0; i < 5; ++i)
    280       {
    281         candidate->FracPt[i] = -999.0;
     254    } else {
     255      candidate->PTD = -999.;
     256      for (int i = 0 ; i < 5 ; i++) {
     257        candidate->FracPt[i] = -999.;
    282258      }
    283259    }
    284260
    285261    fOutputArray->Add(candidate);
     262
     263    // New stuff
     264    /*
     265    fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1);
     266    fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1);
     267    fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1);
     268    fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1);
     269    fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1);
     270    */
     271
     272    bool passId = false;
     273    if (candidate->Momentum.Pt() > fJetPTMinForNeutrals && candidate->MeanSqDeltaR > -0.1) {
     274      if (fabs(candidate->Momentum.Eta())<1.5) {
     275        passId = ((candidate->Beta > fBetaMinBarrel) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxBarrel));
     276      } else if (fabs(candidate->Momentum.Eta())<4.0) {
     277        passId = ((candidate->Beta > fBetaMinEndcap) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxEndcap));
     278      } else {
     279        passId = (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxForward);
     280      }
     281    }
     282
     283    //    cout << " Pt Eta MeanSqDeltaR Beta PassId " << candidate->Momentum.Pt()
     284    //   << " " << candidate->Momentum.Eta() << " " << candidate->MeanSqDeltaR << " " << candidate->Beta << " " << passId << endl;
     285
     286    if (passId) {
     287      if (fUseConstituents) {
     288        TIter itConstituents(candidate->GetCandidates());
     289        while((constituent = static_cast<Candidate*>(itConstituents.Next()))) {
     290          if (constituent->Charge == 0 && constituent->Momentum.Pt() > fNeutralPTMin) {
     291            fNeutralsInPassingJets->Add(constituent);
     292            //      cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
     293          }
     294        }
     295      } else { // use DeltaR
     296        fItNeutralInputArray->Reset();
     297        while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) {
     298          if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR && constituent->Momentum.Pt() > fNeutralPTMin) {
     299            fNeutralsInPassingJets->Add(constituent);
     300            //            cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
     301          }
     302        }
     303      }
     304    }
     305
     306
    286307  }
    287308}
    288309
    289310//------------------------------------------------------------------------------
    290 
  • modules/PileUpJetID.h

    rd870fc5 rd77b51d  
    1 /*
    2  *  Delphes: a framework for fast simulation of a generic collider experiment
    3  *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
    4  *
    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.
    9  *
    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.
    14  *
    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 
    191#ifndef PileUpJetID_h
    202#define PileUpJetID_h
     
    224/** \class PileUpJetID
    235 *
    24  *  CMS PileUp Jet ID Variables, based on http://cds.cern.ch/record/1581583
     6 *  CMS PileUp Jet ID Variables
    257 *
    26  *  \author S. Zenz, December 2013
     8 *  \author S. Zenz
    279 *
    2810 */
     
    3416
    3517class TObjArray;
     18class DelphesFormula;
    3619
    3720class PileUpJetID: public DelphesModule
     
    5134  Double_t fParameterR;
    5235
     36  Double_t fMeanSqDeltaRMaxBarrel; // |eta| < 1.5
     37  Double_t fBetaMinBarrel; // |eta| < 2.5
     38  Double_t fMeanSqDeltaRMaxEndcap; // 1.5 < |eta| < 4.0
     39  Double_t fBetaMinEndcap; // 1.5 < |eta| < 4.0
     40  Double_t fMeanSqDeltaRMaxForward; // |eta| > 4.0
     41
     42  Double_t fNeutralPTMin;
     43  Double_t fJetPTMinForNeutrals;
     44
     45  /*
     46JAY
     47---
     48
     49|Eta|<1.5
     50
     51meanSqDeltaR betaStar SigEff BgdEff
     520.13 0.92 96% 8%
     530.13 0.95 97% 16%
     540.13 0.97 98% 27%
     55
     56|Eta|>1.5
     57
     58meanSqDeltaR betaStar SigEff BgdEff
     590.14 0.91 95% 15%
     600.14 0.94 97% 19%
     610.14 0.97 98% 29%
     62
     63BRYAN
     64-----
     65
     66Barrel (MeanSqDR, Beta, sig eff, bg eff):
     670.10, 0.08, 90%, 8%
     680.11, 0.12, 90%, 6%
     690.13, 0.16, 89%, 5%
     70
     71Endcap (MeanSqDR, Beta, sig eff, bg eff):
     720.07, 0.06, 89%, 4%
     730.08, 0.08, 92%, 6%
     740.09, 0.08, 95%, 10%
     750.10, 0.08, 97%, 13%
     76
     77SETH GUESSES FOR |eta| > 4.0
     78----------------------------
     79
     80MeanSqDeltaR
     810.07
     820.10
     830.14
     840.2
     85  */
     86
    5387  // If set to true, may have weird results for PFCHS
    5488  // If set to false, uses everything within dR < fParameterR even if in other jets &c.
    5589  // Results should be very similar for PF
    56   Int_t fUseConstituents;
     90  Int_t fUseConstituents; 
    5791
    5892  Bool_t fAverageEachTower;
     
    6296  const TObjArray *fJetInputArray; //!
    6397
    64   const TObjArray *fTrackInputArray; //!
    65   const TObjArray *fNeutralInputArray; //!
     98  const TObjArray *fTrackInputArray; // SCZ
     99  const TObjArray *fNeutralInputArray;
    66100
    67   TIterator *fItTrackInputArray; //!
    68   TIterator *fItNeutralInputArray; //!
     101  TIterator *fItTrackInputArray; // SCZ
     102  TIterator *fItNeutralInputArray; // SCZ
    69103
    70104  TObjArray *fOutputArray; //!
     105  TObjArray *fNeutralsInPassingJets; // SCZ
    71106
    72   TIterator *fItVertexInputArray; //!
    73   const TObjArray *fVertexInputArray; //!
    74107
    75   Double_t fZVertexResolution;
    76 
    77   ClassDef(PileUpJetID, 1)
     108  ClassDef(PileUpJetID, 2)
    78109};
    79110
    80111#endif
    81 
  • modules/PileUpMerger.cc

    rd870fc5 rd77b51d  
    8080  fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09);
    8181
     82  fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0);
     83  fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0);
     84  fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0);
     85  fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0);
     86
    8287  // read vertex smearing formula
    8388
     
    111116  TParticlePDG *pdgParticle;
    112117  Int_t pid;
    113   Float_t x, y, z, t;
     118  Float_t x, y, z, t, vx, vy;
    114119  Float_t px, py, pz, e;
    115120  Double_t dz, dphi, dt;
    116   Int_t numberOfEvents, event;
     121  Int_t numberOfEvents, event, numberOfParticles;
    117122  Long64_t allEntries, entry;
    118   Candidate *candidate, *vertexcandidate;
     123  Candidate *candidate, *vertex;
    119124  DelphesFactory *factory;
    120125
     
    123128  fItInputArray->Reset();
    124129
    125   // --- Deal with Primary vertex first  ------
     130  // --- Deal with primary vertex first  ------
    126131
    127132  fFunction->GetRandom2(dz, dt);
     
    129134  dt *= c_light*1.0E3; // necessary in order to make t in mm/c
    130135  dz *= 1.0E3; // necessary in order to make z in mm
    131 
     136  vx = 0.0;
     137  vy = 0.0;
     138  numberOfParticles = fInputArray->GetEntriesFast();
    132139  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    133140  {
     141    vx += candidate->Position.X();
     142    vy += candidate->Position.Y();
    134143    z = candidate->Position.Z();
    135144    t = candidate->Position.T();
     
    139148  }
    140149
     150  if(numberOfParticles > 0)
     151  {
     152    vx /= numberOfParticles;
     153    vy /= numberOfParticles;
     154  }
     155
    141156  factory = GetFactory();
    142157
    143   vertexcandidate = factory->NewCandidate();
    144   vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
    145   fVertexOutputArray->Add(vertexcandidate);
     158  vertex = factory->NewCandidate();
     159  vertex->Position.SetXYZT(vx, vy, dz, dt);
     160  fVertexOutputArray->Add(vertex);
    146161
    147162  // --- Then with pile-up vertices  ------
     
    181196    dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
    182197
    183     vertexcandidate = factory->NewCandidate();
    184     vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
    185     vertexcandidate->IsPU = 1;
    186 
    187     fVertexOutputArray->Add(vertexcandidate);
    188 
     198    vx = 0.0;
     199    vy = 0.0;
     200    numberOfParticles = 0;
    189201    while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e))
    190202    {
     
    204216      candidate->Momentum.RotateZ(dphi);
    205217
     218      x -= fInputBeamSpotX;
     219      y -= fInputBeamSpotY;
    206220      candidate->Position.SetXYZT(x, y, z + dz, t + dt);
    207221      candidate->Position.RotateZ(dphi);
     222      candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0);
     223
     224      vx += candidate->Position.X();
     225      vy += candidate->Position.Y();
     226      ++numberOfParticles;
    208227
    209228      fParticleOutputArray->Add(candidate);
    210229    }
    211   }
    212 }
    213 
    214 //------------------------------------------------------------------------------
    215 
     230
     231    if(numberOfParticles > 0)
     232    {
     233      vx /= numberOfParticles;
     234      vy /= numberOfParticles;
     235    }
     236
     237    vertex = factory->NewCandidate();
     238    vertex->Position.SetXYZT(vx, vy, dz, dt);
     239    vertex->IsPU = 1;
     240
     241    fVertexOutputArray->Add(vertex);
     242  }
     243}
     244
     245//------------------------------------------------------------------------------
  • modules/PileUpMerger.h

    rd870fc5 rd77b51d  
    5353  Double_t fTVertexSpread;
    5454
     55  Double_t fInputBeamSpotX;
     56  Double_t fInputBeamSpotY;
     57  Double_t fOutputBeamSpotX;
     58  Double_t fOutputBeamSpotY;
     59
    5560  DelphesTF2 *fFunction; //!
    5661
  • modules/PileUpMergerPythia8.cc

    rd870fc5 rd77b51d  
    2121 *  Merges particles from pile-up sample into event
    2222 *
    23  *  \author P. Selvaggi - UCL, Louvain-la-Neuve
     23 *  \author M. Selvaggi - UCL, Louvain-la-Neuve
    2424 *
    2525 */
     
    2929#include "classes/DelphesClasses.h"
    3030#include "classes/DelphesFactory.h"
    31 #include "classes/DelphesFormula.h"
     31#include "classes/DelphesTF2.h"
    3232#include "classes/DelphesPileUpReader.h"
    3333
     
    5656
    5757PileUpMergerPythia8::PileUpMergerPythia8() :
    58   fPythia(0), fItInputArray(0)
    59 {
     58  fFunction(0), fPythia(0), fItInputArray(0)
     59{
     60  fFunction = new DelphesTF2;
    6061}
    6162
     
    6465PileUpMergerPythia8::~PileUpMergerPythia8()
    6566{
     67  delete fFunction;
    6668}
    6769
     
    7274  const char *fileName;
    7375
     76  fPileUpDistribution = GetInt("PileUpDistribution", 0);
     77
    7478  fMeanPileUp  = GetDouble("MeanPileUp", 10);
    75   fZVertexSpread = GetDouble("ZVertexSpread", 0.05)*1.0E3;
     79
     80  fZVertexSpread = GetDouble("ZVertexSpread", 0.15);
     81  fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09);
     82
     83  fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0);
     84  fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0);
     85  fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0);
     86  fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0);
    7687
    7788  fPTMin = GetDouble("PTMin", 0.0);
     89
     90  fFunction->Compile(GetString("VertexDistributionFormula", "0.0"));
     91  fFunction->SetRange(-fZVertexSpread, -fTVertexSpread, fZVertexSpread, fTVertexSpread);
    7892
    7993  fileName = GetString("ConfigFile", "MinBias.cmnd");
     
    86100
    87101  // create output arrays
    88   fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
     102  fParticleOutputArray = ExportArray(GetString("ParticleOutputArray", "stableParticles"));
     103  fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
    89104}
    90105
     
    102117  TDatabasePDG *pdg = TDatabasePDG::Instance();
    103118  TParticlePDG *pdgParticle;
    104   Int_t pid;
    105   Float_t x, y, z, t;
     119  Int_t pid, status;
     120  Float_t x, y, z, t, vx, vy;
    106121  Float_t px, py, pz, e;
    107   Double_t dz, dphi;
    108   Int_t poisson, event, i;
    109   Candidate *candidate;
     122  Double_t dz, dphi, dt;
     123  Int_t numberOfEvents, event, numberOfParticles, i;
     124  Candidate *candidate, *vertex;
    110125  DelphesFactory *factory;
    111126
     127  const Double_t c_light = 2.99792458E8;
     128
    112129  fItInputArray->Reset();
     130
     131  // --- Deal with primary vertex first  ------
     132
     133  fFunction->GetRandom2(dz, dt);
     134
     135  dt *= c_light*1.0E3; // necessary in order to make t in mm/c
     136  dz *= 1.0E3; // necessary in order to make z in mm
     137  vx = 0.0;
     138  vy = 0.0;
     139  numberOfParticles = fInputArray->GetEntriesFast();
    113140  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    114141  {
    115     fOutputArray->Add(candidate);
     142    vx += candidate->Position.X();
     143    vy += candidate->Position.Y();
     144    z = candidate->Position.Z();
     145    t = candidate->Position.T();
     146    candidate->Position.SetZ(z + dz);
     147    candidate->Position.SetT(t + dt);
     148    fParticleOutputArray->Add(candidate);
     149  }
     150
     151  if(numberOfParticles > 0)
     152  {
     153    vx /= numberOfParticles;
     154    vy /= numberOfParticles;
    116155  }
    117156
    118157  factory = GetFactory();
    119158
    120   poisson = gRandom->Poisson(fMeanPileUp);
    121 
    122   for(event = 0; event < poisson; ++event)
     159  vertex = factory->NewCandidate();
     160  vertex->Position.SetXYZT(vx, vy, dz, dt);
     161  fVertexOutputArray->Add(vertex);
     162
     163  // --- Then with pile-up vertices  ------
     164
     165  switch(fPileUpDistribution)
     166  {
     167    case 0:
     168      numberOfEvents = gRandom->Poisson(fMeanPileUp);
     169      break;
     170    case 1:
     171      numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1);
     172      break;
     173    default:
     174      numberOfEvents = gRandom->Poisson(fMeanPileUp);
     175      break;
     176  }
     177
     178  for(event = 0; event < numberOfEvents; ++event)
    123179  {
    124180    while(!fPythia->next());
    125181
    126     dz = gRandom->Gaus(0.0, fZVertexSpread);
     182   // --- Pile-up vertex smearing
     183
     184    fFunction->GetRandom2(dz, dt);
     185
     186    dt *= c_light*1.0E3; // necessary in order to make t in mm/c
     187    dz *= 1.0E3; // necessary in order to make z in mm
     188
    127189    dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
    128190
    129     for(i = 1; i < fPythia->event.size(); ++i)
     191    vx = 0.0;
     192    vy = 0.0;
     193    numberOfParticles = fPythia->event.size();
     194    for(i = 1; i < numberOfParticles; ++i)
    130195    {
    131196      Pythia8::Particle &particle = fPythia->event[i];
    132197
    133       if(particle.status() != 1 || !particle.isVisible() || particle.pT() <= fPTMin) continue;
     198      status = particle.statusHepMC();
     199
     200      if(status != 1 || !particle.isVisible() || particle.pT() <= fPTMin) continue;
    134201
    135202      pid = particle.id();
     
    152219      candidate->Momentum.RotateZ(dphi);
    153220
    154       candidate->Position.SetXYZT(x, y, z + dz, t);
     221      x -= fInputBeamSpotX;
     222      y -= fInputBeamSpotY;
     223      candidate->Position.SetXYZT(x, y, z + dz, t + dt);
    155224      candidate->Position.RotateZ(dphi);
    156 
    157       fOutputArray->Add(candidate);
     225      candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0);
     226
     227      vx += candidate->Position.X();
     228      vy += candidate->Position.Y();
     229
     230      fParticleOutputArray->Add(candidate);
    158231    }
    159   }
    160 }
    161 
    162 //------------------------------------------------------------------------------
    163 
     232
     233    if(numberOfParticles > 0)
     234    {
     235      vx /= numberOfParticles;
     236      vy /= numberOfParticles;
     237    }
     238
     239    vertex = factory->NewCandidate();
     240    vertex->Position.SetXYZT(vx, vy, dz, dt);
     241    vertex->IsPU = 1;
     242
     243    fVertexOutputArray->Add(vertex);
     244  }
     245}
     246
     247//------------------------------------------------------------------------------
  • modules/PileUpMergerPythia8.h

    rd870fc5 rd77b51d  
    3131
    3232class TObjArray;
     33class DelphesTF2;
    3334
    3435namespace Pythia8
     
    5051private:
    5152
     53  Int_t fPileUpDistribution;
    5254  Double_t fMeanPileUp;
     55
    5356  Double_t fZVertexSpread;
     57  Double_t fTVertexSpread;
     58
     59  Double_t fInputBeamSpotX;
     60  Double_t fInputBeamSpotY;
     61  Double_t fOutputBeamSpotX;
     62  Double_t fOutputBeamSpotY;
     63
    5464  Double_t fPTMin;
     65
     66  DelphesTF2 *fFunction; //!
    5567
    5668  Pythia8::Pythia *fPythia; //!
     
    6072  const TObjArray *fInputArray; //!
    6173
    62   TObjArray *fOutputArray; //!
     74  TObjArray *fParticleOutputArray; //!
     75  TObjArray *fVertexOutputArray; //!
    6376
    6477  ClassDef(PileUpMergerPythia8, 1)
  • modules/SimpleCalorimeter.cc

    rd870fc5 rd77b51d  
    150150  fEnergySignificanceMin = GetDouble("EnergySignificanceMin", 0.0);
    151151
     152  // flag that says if current calo is Ecal of Hcal (will then fill correct values of Eem and Ehad)
     153  fIsEcal = GetBool("IsEcal", false);
     154
    152155  // switch on or off the dithering of the center of calorimeter towers
    153   fDitherTowerCenter = GetBool("DitherTowerCenter", true);
     156  fSmearTowerCenter = GetBool("SmearTowerCenter", true);
    154157
    155158  // read resolution formulas
     
    409412  if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0;
    410413
    411   if(fDitherTowerCenter)
     414  if(fSmearTowerCenter)
    412415  {
    413416    eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
     
    424427  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
    425428  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
     429
     430  fTower->Eem = (!fIsEcal) ? 0 : energy;
     431  fTower->Ehad = (fIsEcal) ? 0 : energy;
    426432
    427433  fTower->Edges[0] = fTowerEdges[0];
     
    447453    pt = energy / TMath::CosH(eta);
    448454
     455    tower->Eem = (!fIsEcal) ? 0 : energy;
     456    tower->Ehad = (fIsEcal) ? 0 : energy;
     457
    449458    tower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
    450459    fEFlowTowerOutputArray->Add(tower);
  • modules/SimpleCalorimeter.h

    rd870fc5 rd77b51d  
     1
    12/*
    23 *  Delphes: a framework for fast simulation of a generic collider experiment
     
    7273  Double_t fEnergySignificanceMin;
    7374
    74   Bool_t fDitherTowerCenter;
     75  Bool_t fSmearTowerCenter;
     76
     77  Bool_t fIsEcal; //!
    7578
    7679  TFractionMap fFractionMap; //!
  • modules/TauTagging.cc

    rd870fc5 rd77b51d  
    3333#include "classes/DelphesFactory.h"
    3434#include "classes/DelphesFormula.h"
    35 
    36 #include "ExRootAnalysis/ExRootResult.h"
    37 #include "ExRootAnalysis/ExRootFilter.h"
    38 #include "ExRootAnalysis/ExRootClassifier.h"
    3935
    4036#include "TMath.h"
     
    5349using namespace std;
    5450
    55 //------------------------------------------------------------------------------
    56 
    57 class TauTaggingPartonClassifier : public ExRootClassifier
    58 {
    59 public:
    60 
    61   TauTaggingPartonClassifier(const TObjArray *array);
    62 
    63   Int_t GetCategory(TObject *object);
    64 
    65   Double_t fEtaMax, fPTMin;
    66 
    67   const TObjArray *fParticleInputArray;
    68 };
    6951
    7052//------------------------------------------------------------------------------
     
    7961{
    8062  Candidate *tau = static_cast<Candidate *>(object);
    81   Candidate *daughter = 0;
     63  Candidate *daughter1 = 0;
     64  Candidate *daughter2 = 0;
     65 
    8266  const TLorentzVector &momentum = tau->Momentum;
    83   Int_t pdgCode, i;
     67  Int_t pdgCode, i, j;
    8468
    8569  pdgCode = TMath::Abs(tau->PID);
     
    9074  if(tau->D1 < 0) return -1;
    9175
     76  if(tau->D2 < tau->D1) return -1;
     77
    9278  if(tau->D1 >= fParticleInputArray->GetEntriesFast() ||
    9379     tau->D2 >= fParticleInputArray->GetEntriesFast())
     
    9884  for(i = tau->D1; i <= tau->D2; ++i)
    9985  {
    100     daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
    101     pdgCode = TMath::Abs(daughter->PID);
    102     if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15 || pdgCode == 24) return -1;
     86    daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i));
     87    pdgCode = TMath::Abs(daughter1->PID);
     88    if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1;
     89    else if(pdgCode == 24)
     90    {
     91     if(daughter1->D1 < 0) return -1;
     92     for(j = daughter1->D1; j <= daughter1->D2; ++j)
     93     {
     94       daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j));
     95       pdgCode = TMath::Abs(daughter2->PID);
     96       if(pdgCode == 11 || pdgCode == 13) return -1;
     97     }
     98       
     99    }
    103100  }
    104101
     
    206203  tauArray = fFilter->GetSubArray(fClassifier, 0);
    207204
    208   if(tauArray == 0) return;
    209 
    210   TIter itTauArray(tauArray);
    211 
    212205  // loop over all input jets
    213206  fItJetInputArray->Reset();
     
    222215
    223216    // loop over all input taus
    224     itTauArray.Reset();
    225     while((tau = static_cast<Candidate *>(itTauArray.Next())))
    226     {
    227       if(tau->D1 < 0) continue;
    228 
    229       if(tau->D1 >= fParticleInputArray->GetEntriesFast() ||
    230          tau->D2 >= fParticleInputArray->GetEntriesFast())
     217    if(tauArray){
     218      TIter itTauArray(tauArray);
     219      while((tau = static_cast<Candidate *>(itTauArray.Next())))
    231220      {
    232         throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
    233       }
    234 
    235       tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
    236 
    237       for(i = tau->D1; i <= tau->D2; ++i)
    238       {
    239         daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
    240         if(TMath::Abs(daughter->PID) == 16) continue;
    241         tauMomentum += daughter->Momentum;
    242       }
    243 
    244       if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR)
    245       {
    246         pdgCode = 15;
    247         charge = tau->Charge;
     221        if(tau->D1 < 0) continue;
     222
     223        if(tau->D1 >= fParticleInputArray->GetEntriesFast() ||
     224           tau->D2 >= fParticleInputArray->GetEntriesFast())
     225        {
     226          throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
     227        }
     228
     229        tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
     230
     231        for(i = tau->D1; i <= tau->D2; ++i)
     232        {
     233          daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
     234          if(TMath::Abs(daughter->PID) == 16) continue;
     235          tauMomentum += daughter->Momentum;
     236        }
     237
     238        if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR)
     239        {
     240          pdgCode = 15;
     241          charge = tau->Charge;
     242        }
    248243      }
    249244    }
  • modules/TauTagging.h

    rd870fc5 rd77b51d  
    3131
    3232#include "classes/DelphesModule.h"
     33#include "ExRootAnalysis/ExRootResult.h"
     34#include "ExRootAnalysis/ExRootFilter.h"
     35#include "ExRootAnalysis/ExRootClassifier.h"
    3336
    3437#include <map>
     
    7679};
    7780
     81
     82//------------------------------------------------------------------------------
     83
     84class TauTaggingPartonClassifier : public ExRootClassifier
     85{
     86public:
     87
     88  TauTaggingPartonClassifier(const TObjArray *array);
     89
     90  Int_t GetCategory(TObject *object);
     91
     92  Double_t fEtaMax, fPTMin;
     93
     94  const TObjArray *fParticleInputArray;
     95};
     96
     97
    7898#endif
  • modules/TrackPileUpSubtractor.cc

    rd870fc5 rd77b51d  
    7474  fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
    7575
     76  fPTMin = GetDouble("PTMin", 0.);
    7677  // import arrays with output from other modules
    77 
     78   
    7879  ExRootConfParam param = GetParam("InputArray");
    7980  Long_t i, size;
     
    147148      // assume perfect pile-up subtraction for tracks outside fZVertexResolution
    148149     
    149       if(candidate->IsPU && TMath::Abs(z-zvtx) > fZVertexResolution) continue;
    150 
    151       array->Add(candidate);
     150      if(candidate->IsPU && TMath::Abs(z-zvtx) > fZVertexResolution) candidate->IsRecoPU = 1;
     151      else
     152      {
     153         candidate->IsRecoPU = 0;
     154         if( candidate->Momentum.Pt() > fPTMin) array->Add(candidate);
     155      }
    152156    }
    153157  }
  • modules/TrackPileUpSubtractor.h

    rd870fc5 rd77b51d  
    5050  Double_t fZVertexResolution;
    5151
     52  Double_t fPTMin;
     53
    5254  std::map< TIterator *, TObjArray * > fInputMap; //!
    5355
  • modules/TreeWriter.cc

    rd870fc5 rd77b51d  
    291291    entry->ZOuter = position.Z();
    292292    entry->TOuter = position.T()*1.0E-3/c_light;
    293    
     293
    294294    entry->Dxy = candidate->Dxy;
    295295    entry->SDxy = candidate->SDxy ;
     
    297297    entry->Yd = candidate->Yd;
    298298    entry->Zd = candidate->Zd;
    299    
     299
    300300    const TLorentzVector &momentum = candidate->Momentum;
    301301
     
    362362
    363363    entry->T = position.T()*1.0E-3/c_light;
     364    entry->NTimeHits = candidate->NTimeHits;
    364365
    365366    FillParticles(candidate, &entry->Particles);
     
    403404    entry->T = position.T()*1.0E-3/c_light;
    404405
     406    // Isolation variables
     407
     408    entry->IsolationVar = candidate->IsolationVar;
     409    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;
     410    entry->SumPtCharged = candidate->SumPtCharged ;
     411    entry->SumPtNeutral = candidate->SumPtNeutral ;
     412    entry->SumPtChargedPU = candidate->SumPtChargedPU ;
     413    entry->SumPt = candidate->SumPt ;
     414
    405415    entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad/candidate->Eem : 999.9;
    406416
     
    442452    entry->T = position.T()*1.0E-3/c_light;
    443453
     454    // Isolation variables
     455
     456    entry->IsolationVar = candidate->IsolationVar;
     457    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;
     458    entry->SumPtCharged = candidate->SumPtCharged ;
     459    entry->SumPtNeutral = candidate->SumPtNeutral ;
     460    entry->SumPtChargedPU = candidate->SumPtChargedPU ;
     461    entry->SumPt = candidate->SumPt ;
     462
     463
    444464    entry->Charge = candidate->Charge;
    445465
     
    469489    const TLorentzVector &momentum = candidate->Momentum;
    470490    const TLorentzVector &position = candidate->Position;
    471 
    472491
    473492    pt = momentum.Pt();
     
    488507    entry->T = position.T()*1.0E-3/c_light;
    489508
     509    // Isolation variables
     510
     511    entry->IsolationVar = candidate->IsolationVar;
     512    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;
     513    entry->SumPtCharged = candidate->SumPtCharged ;
     514    entry->SumPtNeutral = candidate->SumPtNeutral ;
     515    entry->SumPtChargedPU = candidate->SumPtChargedPU ;
     516    entry->SumPt = candidate->SumPt ;
     517
    490518    entry->Charge = candidate->Charge;
    491519
     
    504532  Double_t ecalEnergy, hcalEnergy;
    505533  const Double_t c_light = 2.99792458E8;
     534  Int_t i;
    506535
    507536  array->Sort();
     
    532561    entry->Mass = momentum.M();
    533562
     563    entry->Area = candidate->Area;
     564
    534565    entry->DeltaEta = candidate->DeltaEta;
    535566    entry->DeltaPhi = candidate->DeltaPhi;
    536567
     568    entry->Flavor = candidate->Flavor;
     569    entry->FlavorAlgo = candidate->FlavorAlgo;
     570    entry->FlavorPhys = candidate->FlavorPhys;
     571
    537572    entry->BTag = candidate->BTag;
     573
     574    entry->BTagAlgo = candidate->BTagAlgo;
     575    entry->BTagPhys = candidate->BTagPhys;
     576
    538577    entry->TauTag = candidate->TauTag;
    539578
     
    561600    entry->MeanSqDeltaR = candidate->MeanSqDeltaR;
    562601    entry->PTD = candidate->PTD;
    563     entry->FracPt[0] = candidate->FracPt[0];
    564     entry->FracPt[1] = candidate->FracPt[1];
    565     entry->FracPt[2] = candidate->FracPt[2];
    566     entry->FracPt[3] = candidate->FracPt[3];
    567     entry->FracPt[4] = candidate->FracPt[4];
    568    
    569     //--- N-subjettiness variables ----
    570    
    571     entry->Tau1 = candidate->Tau[0];
    572     entry->Tau2 = candidate->Tau[1];
    573     entry->Tau3 = candidate->Tau[2];
    574     entry->Tau4 = candidate->Tau[3];
    575     entry->Tau5 = candidate->Tau[4];
    576    
     602
     603    //--- Sub-structure variables ----
     604
     605    entry->NSubJetsTrimmed = candidate->NSubJetsTrimmed;
     606    entry->NSubJetsPruned = candidate->NSubJetsPruned;
     607    entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped;
     608
     609    for(i = 0; i < 5; i++)
     610    {
     611      entry->FracPt[i] = candidate -> FracPt[i];
     612      entry->Tau[i] = candidate -> Tau[i];
     613      entry->TrimmedP4[i] = candidate -> TrimmedP4[i];
     614      entry->PrunedP4[i] = candidate -> PrunedP4[i];
     615      entry->SoftDroppedP4[i] = candidate -> SoftDroppedP4[i];
     616    }
     617
    577618    FillParticles(candidate, &entry->Particles);
    578619  }
  • modules/UniqueObjectFinder.cc

    rd870fc5 rd77b51d  
    7474  TIterator *iterator;
    7575
     76  fInputMap.clear();
     77
    7678  size = param.GetSize();
    7779  for(i = 0; i < size/2; ++i)
     
    8082    iterator = array->MakeIterator();
    8183
    82     fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString());
     84    fInputMap.push_back(make_pair(iterator, ExportArray(param[i*2 + 1].GetString())));
    8385  }
    8486}
     
    8890void UniqueObjectFinder::Finish()
    8991{
    90   map< TIterator *, TObjArray * >::iterator itInputMap;
     92  vector< pair< TIterator *, TObjArray * > >::iterator itInputMap;
    9193  TIterator *iterator;
    9294
     
    104106{
    105107  Candidate *candidate;
    106   map< TIterator *, TObjArray * >::iterator itInputMap;
     108  vector< pair< TIterator *, TObjArray * > >::iterator itInputMap;
    107109  TIterator *iterator;
    108110  TObjArray *array;
     
    128130//------------------------------------------------------------------------------
    129131
    130 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, map< TIterator *, TObjArray * >::iterator itInputMap)
     132Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector< pair< TIterator *, TObjArray * > >::iterator itInputMap)
    131133{
    132134  Candidate *previousCandidate;
    133   map< TIterator *, TObjArray * >::iterator previousItInputMap;
     135  vector< pair< TIterator *, TObjArray * > >::iterator previousItInputMap;
    134136  TObjArray *array;
    135137
  • modules/UniqueObjectFinder.h

    rd870fc5 rd77b51d  
    3030#include "classes/DelphesModule.h"
    3131
    32 #include <map>
     32#include <vector>
     33#include <utility>
    3334
    3435class TIterator;
     
    4950private:
    5051
    51   Bool_t Unique(Candidate *candidate, std::map< TIterator *, TObjArray * >::iterator itInputMap);
     52  Bool_t Unique(Candidate *candidate, std::vector< std::pair< TIterator *, TObjArray * > >::iterator itInputMap);
    5253
    53   std::map< TIterator *, TObjArray * > fInputMap; //!
     54  std::vector< std::pair< TIterator *, TObjArray * > > fInputMap; //!
    5455
    5556  ClassDef(UniqueObjectFinder, 1)
Note: See TracChangeset for help on using the changeset viewer.