Fork me on GitHub

Changes in / [9be57d9:532016b] in git


Ignore:
Files:
2 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesClasses.cc

    r9be57d9 r532016b  
    120120  PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
    121121  Charge(0), Mass(0.0),
    122   IsPU(0), IsRecoPU(0), IsConstituent(0),
     122  IsPU(0), IsConstituent(0),
    123123  BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
    124124  DeltaEta(0.0), DeltaPhi(0.0),
     
    133133  MeanSqDeltaR(0),
    134134  PTD(0),
    135   Ntimes(-1),
    136   IsolationVar(-999),
    137   IsolationVarRhoCorr(-999),
    138   SumPtCharged(-999),
    139   SumPtNeutral(-999),
    140   SumPtChargedPU(-999),
    141   SumPt(-999),
    142135  fFactory(0),
    143136  fArray(0)
     
    256249  object.MeanSqDeltaR = MeanSqDeltaR;
    257250  object.PTD = PTD;
    258   object.Ntimes = Ntimes;
    259   object.IsolationVar = IsolationVar;
    260   object.IsolationVarRhoCorr = IsolationVarRhoCorr;
    261   object.SumPtCharged = SumPtCharged;
    262   object.SumPtNeutral = SumPtNeutral;
    263   object.SumPtChargedPU = SumPtChargedPU;
    264   object.SumPt = SumPt;
    265 
    266251  object.FracPt[0] = FracPt[0];
    267252  object.FracPt[1] = FracPt[1];
     
    277262  object.fFactory = fFactory;
    278263  object.fArray = 0;
    279 
    280 
    281   // Copy cluster timing info
    282   copy(Ecal_E_t.begin(),Ecal_E_t.end(),back_inserter(object.Ecal_E_t));
    283264
    284265  if(fArray && fArray->GetEntriesFast() > 0)
     
    330311  MeanSqDeltaR = 0.0;
    331312  PTD = 0.0;
    332  
    333   Ntimes = 0;
    334   Ecal_E_t.clear();
    335  
    336   IsolationVar = -999;
    337   IsolationVarRhoCorr = -999;
    338   SumPtCharged = -999;
    339   SumPtNeutral = -999;
    340   SumPtChargedPU = -999;
    341   SumPt = -999;
    342  
    343313  FracPt[0] = 0.0;
    344314  FracPt[1] = 0.0;
  • classes/DelphesClasses.h

    r9be57d9 r532016b  
    231231  TRefArray Particles; // references to generated particles
    232232
    233   // Isolation variables
    234  
    235   Float_t IsolationVar;
    236   Float_t IsolationVarRhoCorr;
    237   Float_t SumPtCharged;
    238   Float_t SumPtNeutral;
    239   Float_t SumPtChargedPU;
    240   Float_t SumPt;
    241 
    242233  static CompBase *fgCompare; //!
    243234  const CompBase *GetCompare() const { return fgCompare; }
     
    266257  TRef Particle; // reference to generated particle
    267258
    268   // Isolation variables
    269  
    270   Float_t IsolationVar;
    271   Float_t IsolationVarRhoCorr;
    272   Float_t SumPtCharged;
    273   Float_t SumPtNeutral;
    274   Float_t SumPtChargedPU;
    275   Float_t SumPt;
    276 
    277259  static CompBase *fgCompare; //!
    278260  const CompBase *GetCompare() const { return fgCompare; }
     
    298280
    299281  TRef Particle; // reference to generated particle
    300 
    301    // Isolation variables
    302  
    303   Float_t IsolationVar;
    304   Float_t IsolationVarRhoCorr;
    305   Float_t SumPtCharged;
    306   Float_t SumPtNeutral;
    307   Float_t SumPtChargedPU;
    308   Float_t SumPt;
    309282
    310283  static CompBase *fgCompare; //!
     
    361334
    362335  TLorentzVector P4();
    363   TLorentzVector Area;
    364336
    365337  ClassDef(Jet, 2)
     
    420392  Float_t E; // calorimeter tower energy
    421393
    422   Float_t T; // ecal deposit time, averaged by sqrt(EM energy) over all particles, not smeared
    423   Int_t   Ntimes; // number of hits contributing to time measurement
    424  
     394  Float_t T; //particle arrival time of flight
     395
    425396  Float_t Eem; // calorimeter tower electromagnetic energy
    426397  Float_t Ehad; // calorimeter tower hadronic energy
     
    481452
    482453  Int_t IsPU;
    483   Int_t IsRecoPU;
    484  
    485454  Int_t IsConstituent;
    486455
     
    512481  Float_t  PTD;
    513482  Float_t  FracPt[5];
    514  
    515   //Timing information
    516  
    517   Int_t    Ntimes;
    518   std::vector<std::pair<Float_t,Float_t> > Ecal_E_t;
    519 
    520   // Isolation variables
    521  
    522   Float_t IsolationVar;
    523   Float_t IsolationVarRhoCorr;
    524   Float_t SumPtCharged;
    525   Float_t SumPtNeutral;
    526   Float_t SumPtChargedPU;
    527   Float_t SumPt;
    528483
    529484  // N-subjettiness variables
    530485
    531486  Float_t Tau[5];
    532  
    533  
    534  
    535487
    536488  static CompBase *fgCompare; //!
  • modules/Calorimeter.cc

    r9be57d9 r532016b  
    150150*/
    151151
    152   // read min E value for timing measurement in ECAL
    153   fTimingEMin = GetDouble("TimingEMin",4.);
    154   // For timing
    155   // So far this flag needs to be false
    156   // Curved extrapolation not supported
    157   fElectronsFromTrack = false;
    158 
    159  
    160152  // read min E value for towers to be saved
    161153  fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0);
     
    364356      fTrackHCalEnergy = 0.0;
    365357
     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
    366367      fTowerTrackHits = 0;
    367368      fTowerPhotonHits = 0;
     
    379380      position = track->Position;
    380381
     382
    381383      ecalEnergy = momentum.E() * fTrackECalFractions[number];
    382384      hcalEnergy = momentum.E() * fTrackHCalFractions[number];
     
    385387      fTrackHCalEnergy += hcalEnergy;
    386388
    387       bool dbg_scz = false;
    388       if (dbg_scz) {
    389         cout << "   Calorimeter input track has x y z t " << track->Position.X() << " " << track->Position.Y() << " " << track->Position.Z() << " " << track->Position.T()
    390              << endl;
    391         Candidate *prt = static_cast<Candidate*>(track->GetCandidates()->Last());
    392         const TLorentzVector &ini = prt->Position;
    393 
    394         cout << "                and parent has x y z t " << ini.X() << " " << ini.Y() << " " << ini.Z() << " " << ini.T();
    395 
    396       }
    397      
    398       if (ecalEnergy > fTimingEMin && fTower) {
    399         if (fElectronsFromTrack) {
    400           //      cout << " SCZ Debug pushing back track hit E=" << ecalEnergy << " T=" << track->Position.T() << " isPU=" << track->IsPU << " isRecoPU=" << track->IsRecoPU
    401           //           << " PID=" << track->PID << endl;
    402           fTower->Ecal_E_t.push_back(std::make_pair<float,float>(ecalEnergy,track->Position.T()));
    403         } else {
    404           //      cout << " Skipping track hit E=" << ecalEnergy << " T=" << track->Position.T() << " isPU=" << track->IsPU << " isRecoPU=" << track->IsRecoPU
    405           //           << " PID=" << track->PID << endl;
    406         }
    407       }
    408 
     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);
    409394
    410395      fTowerTrackArray->Add(track);
     
    412397      continue;
    413398    }
    414  
     399
    415400    // check for photon and electron hits in current tower
    416401    if(flags & 2) ++fTowerPhotonHits;
     
    427412    fTowerHCalEnergy += hcalEnergy;
    428413
    429     if (ecalEnergy > fTimingEMin && fTower) {
    430       if (abs(particle->PID) != 11 || !fElectronsFromTrack) {
    431         //      cout << " SCZ Debug About to push back particle hit E=" << ecalEnergy << " T=" << particle->Position.T() << " isPU=" << particle->IsPU
    432         //   << " PID=" << particle->PID << endl;
    433         fTower->Ecal_E_t.push_back(std::make_pair<Float_t,Float_t>(ecalEnergy,particle->Position.T()));
    434       } else {
    435        
    436         // N.B. Only charged particle set to leave ecal energy is the electrons
    437         //      cout << " SCZ Debug To avoid double-counting, skipping particle hit E=" << ecalEnergy << " T=" << particle->Position.T() << " isPU=" << particle->IsPU
    438         //           << " PID=" << particle->PID << endl;
    439        
    440       }
    441     }
     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
    442420
    443421    fTower->AddCandidate(particle);
     
    456434  Double_t ecalEnergy, hcalEnergy;
    457435  Double_t ecalSigma, hcalSigma;
    458  
     436  Double_t ecalTime, hcalTime, time;
     437
    459438  if(!fTower) return;
    460439
     
    465444  hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma);
    466445
     446  ecalTime = (fTowerECalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerECalTime/fTowerECalTimeWeight;
     447  hcalTime = (fTowerHCalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerHCalTime/fTowerHCalTimeWeight;
     448
    467449  ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
    468450  hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
     
    472454
    473455  energy = ecalEnergy + hcalEnergy;
    474    
     456  time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy));
     457
    475458  if(fSmearTowerCenter)
    476459  {
     
    486469  pt = energy / TMath::CosH(eta);
    487470
    488   // Time calculation for tower
    489   fTower->Ntimes = 0;
    490   Float_t tow_sumT = 0;
    491   Float_t tow_sumW = 0;
    492  
    493   for (Int_t i = 0 ; i < fTower->Ecal_E_t.size() ; i++)
    494   {
    495     Float_t w = TMath::Sqrt(fTower->Ecal_E_t[i].first);
    496     tow_sumT += w*fTower->Ecal_E_t[i].second;
    497     tow_sumW += w;
    498     fTower->Ntimes++;
    499   }
    500  
    501   if (tow_sumW > 0.) {
    502     fTower->Position.SetPtEtaPhiE(1.0, eta, phi,tow_sumT/tow_sumW);
    503   } else {
    504     fTower->Position.SetPtEtaPhiE(1.0,eta,phi,999999.);
    505   }
    506 
    507 
     471  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
    508472  fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
    509473  fTower->Eem = ecalEnergy;
  • modules/Calorimeter.h

    r9be57d9 r532016b  
    6060  Double_t fTrackECalEnergy, fTrackHCalEnergy;
    6161
    62   Double_t fTimingEMin;
    63   Bool_t fElectronsFromTrack; // for timing
    64  
     62  Double_t fTowerECalTime, fTowerHCalTime;
     63  Double_t fTrackECalTime, fTrackHCalTime;
     64
     65  Double_t fTowerECalTimeWeight, fTowerHCalTimeWeight;
     66  Double_t fTrackECalTimeWeight, fTrackHCalTimeWeight;
     67
    6568  Int_t fTowerTrackHits, fTowerPhotonHits;
    6669
  • modules/Isolation.cc

    r9be57d9 r532016b  
    2525 *  the transverse momenta fraction within (PTRatioMin, PTRatioMax].
    2626 *
    27  *  \author P. Demin, M. Selvaggi, R. Gerosa - UCL, Louvain-la-Neuve
     27 *  \author P. Demin - UCL, Louvain-la-Neuve
    2828 *
    2929 */
     
    109109  fUsePTSum = GetBool("UsePTSum", false);
    110110
    111   fVetoLeptons = GetBool("VetoLeptons", true); 
    112  
    113111  fClassifier->fPTMin = GetDouble("PTMin", 0.5);
    114 
    115112
    116113  // import input array(s)
     
    156153  Candidate *candidate, *isolation, *object;
    157154  TObjArray *isolationArray;
    158   Double_t sumCharged, sumNeutral, sumAllParticles, sumChargedPU, sumDBeta, ratioDBeta, sumRhoCorr, ratioRhoCorr;
     155  Double_t sum, ratio;
    159156  Int_t counter;
    160157  Double_t eta = 0.0;
     
    183180
    184181    // loop over all input tracks
    185    
    186     sumNeutral = 0.0;
    187     sumCharged = 0.0;
    188     sumChargedPU = 0.0;
    189     sumAllParticles = 0.0;
    190    
     182    sum = 0.0;
    191183    counter = 0;
    192184    itIsolationArray.Reset();
    193    
    194185    while((isolation = static_cast<Candidate*>(itIsolationArray.Next())))
    195186    {
     
    197188
    198189      if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax &&
    199          candidate->GetUniqueID() != isolation->GetUniqueID() &&
    200          ( !fVetoLeptons || (TMath::Abs(candidate->PID) != 11 && (TMath::Abs(candidate->PID) != 13)) ) )
     190         candidate->GetUniqueID() != isolation->GetUniqueID())
    201191      {
    202      
    203         sumAllParticles += isolationMomentum.Pt();
    204         if(isolation->Charge !=0)
    205         {
    206           sumCharged += isolationMomentum.Pt();
    207           if(isolation->IsRecoPU != 0) sumChargedPU += isolationMomentum.Pt();
    208         }
    209  
    210         else sumNeutral += isolationMomentum.Pt();
    211  
     192        sum += isolationMomentum.Pt();
    212193        ++counter;
    213194      }
     
    228209    }
    229210
    230        
    231      // correct sum for pile-up contamination
    232     sumDBeta = sumCharged + TMath::Max(sumNeutral-0.5*sumChargedPU,0.0);
    233     sumRhoCorr = sumCharged + TMath::Max(sumNeutral-TMath::Max(rho,0.0)*fDeltaRMax*fDeltaRMax*TMath::Pi(),0.0);
    234     ratioDBeta = sumDBeta/candidateMomentum.Pt();
    235     ratioRhoCorr = sumRhoCorr/candidateMomentum.Pt();
    236    
    237     candidate->IsolationVar = ratioDBeta;
    238     candidate->IsolationVarRhoCorr = ratioRhoCorr;
    239     candidate->SumPtCharged = sumCharged;
    240     candidate->SumPtNeutral = sumNeutral;
    241     candidate->SumPtChargedPU = sumChargedPU;
    242     candidate->SumPt = sumAllParticles;
    243 
    244     if((fUsePTSum && sumDBeta > fPTSumMax) || ratioDBeta > fPTRatioMax) continue;
     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
    245217    fOutputArray->Add(candidate);
    246218  }
  • modules/Isolation.h

    r9be57d9 r532016b  
    5959  Bool_t fUsePTSum;
    6060
    61   Bool_t fVetoLeptons; 
    62  
    6361  IsolationClassifier *fClassifier; //!
    6462
  • modules/ModulesLinkDef.h

    r9be57d9 r532016b  
    5050#include "modules/JetPileUpSubtractor.h"
    5151#include "modules/TrackPileUpSubtractor.h"
    52 #include "modules/TaggingParticlesSkimmer.h"
    5352#include "modules/PileUpJetID.h"
    5453#include "modules/ConstituentFilter.h"
     
    9089#pragma link C++ class JetPileUpSubtractor+;
    9190#pragma link C++ class TrackPileUpSubtractor+;
    92 #pragma link C++ class TaggingParticlesSkimmer+;
    9391#pragma link C++ class PileUpJetID+;
    9492#pragma link C++ class ConstituentFilter+;
  • modules/PileUpJetID.cc

    r9be57d9 r532016b  
     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
    119
    220/** \class PileUpJetID
    321 *
    4  *  CMS PileUp Jet ID Variables
    5  *
    6  *  \author S. Zenz
     22 *  CMS PileUp Jet ID Variables, based on http://cds.cern.ch/record/1581583
     23 *
     24 *  \author S. Zenz, December 2013
    725 *
    826 */
     
    2341#include "TRandom3.h"
    2442#include "TObjArray.h"
    25 //#include "TDatabasePDG.h"
     43#include "TDatabasePDG.h"
    2644#include "TLorentzVector.h"
    2745
     
    3654
    3755PileUpJetID::PileUpJetID() :
    38   fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0)
     56  fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0),fItVertexInputArray(0)
    3957{
    4058
     
    5270void PileUpJetID::Init()
    5371{
    54 
    5572  fJetPTMin = GetDouble("JetPTMin", 20.0);
    5673  fParameterR = GetDouble("ParameterR", 0.5);
    5774  fUseConstituents = GetInt("UseConstituents", 0);
    5875
    59 
    60   /*
    61   Double_t fMeanSqDeltaRMaxBarrel; // |eta| < 1.5
    62   Double_t fBetaMinBarrel; // |eta| < 2.5
    63   Double_t fMeanSqDeltaRMaxEndcap; // 1.5 < |eta| < 4.0
    64   Double_t fBetaMinEndcap; // 1.5 < |eta| < 4.0
    65   Double_t fMeanSqDeltaRMaxForward; // |eta| > 4.0
    66   */
    67 
    68   fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1);
    69   fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1);
    70   fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1);
    71   fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1);
    72   fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1);
    73   fJetPTMinForNeutrals = GetDouble("JetPTMinForNeutrals", 20.0);
    74   fNeutralPTMin = GetDouble("NeutralPTMin", 2.0);
    75 
    76 
    77 
    78   cout << "  set MeanSqDeltaRMaxBarrel " << fMeanSqDeltaRMaxBarrel << endl;
    79   cout << "  set BetaMinBarrel " << fBetaMinBarrel << endl;
    80   cout << "  set MeanSqDeltaRMaxEndcap " << fMeanSqDeltaRMaxEndcap << endl;
    81   cout << "  set BetaMinEndcap " << fBetaMinEndcap << endl;
    82   cout << "  set MeanSqDeltaRMaxForward " << fMeanSqDeltaRMaxForward << endl;
    83 
    84 
    85 
    8676  fAverageEachTower = false; // for timing
    8777
     
    9181  fItJetInputArray = fJetInputArray->MakeIterator();
    9282
    93 
    94   //  cout << "BeforE SCZ additions in init" << endl;
    95   //  cout << GetString("TrackInputArray", "ParticlePropagator/tracks") << endl;
    96   //  cout << GetString("EFlowTrackInputArray", "ParticlePropagator/tracks") << endl;
    97 
    98   fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
     83  fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/eflowTracks"));
    9984  fItTrackInputArray = fTrackInputArray->MakeIterator();
    10085
    101   fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "ParticlePropagator/tracks"));
     86  fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/eflowTowers"));
    10287  fItNeutralInputArray = fNeutralInputArray->MakeIterator();
    10388
     89  fVertexInputArray = ImportArray(GetString("VertexInputArray", "PileUpMerger/vertices"));
     90  fItVertexInputArray = fVertexInputArray->MakeIterator();
     91
     92  fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
    10493
    10594  // create output array(s)
    10695
    10796  fOutputArray = ExportArray(GetString("OutputArray", "jets"));
    108 
    109   fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets","eflowtowers"));
    110 
    111 
    112   //  cout << " end of INIT " << endl;
    113 
    11497}
    11598
     
    118101void PileUpJetID::Finish()
    119102{
    120   //  cout << "In finish" << endl;
    121 
    122103  if(fItJetInputArray) delete fItJetInputArray;
    123104  if(fItTrackInputArray) delete fItTrackInputArray;
    124105  if(fItNeutralInputArray) delete fItNeutralInputArray;
    125 
     106  if(fItVertexInputArray) delete fItVertexInputArray;
    126107}
    127108
     
    130111void PileUpJetID::Process()
    131112{
    132   //  cout << "start of process" << endl;
    133 
    134113  Candidate *candidate, *constituent;
    135114  TLorentzVector momentum, area;
    136 
    137   //  cout << "BeforE SCZ additions in process" << endl;
    138 
    139   // SCZ
    140   Candidate *trk;
     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  }
    141133
    142134  // loop over all input candidates
     
    147139    area = candidate->Area;
    148140
    149     float sumT0 = 0.;
    150     float sumT1 = 0.;
    151     float sumT10 = 0.;
    152     float sumT20 = 0.;
    153     float sumT30 = 0.;
    154     float sumT40 = 0.;
    155     float sumWeightsForT = 0.;
    156     candidate->Ntimes = 0;
    157 
    158     float sumpt = 0.;
    159     float sumptch = 0.;
    160     float sumptchpv = 0.;
    161     float sumptchpu = 0.;
    162     float sumdrsqptsq = 0.;
    163     float sumptsq = 0.;
    164     int nc = 0;
    165     int nn = 0;
    166     float pt_ann[5];
    167 
    168     for (int i = 0 ; i < 5 ; i++) {
    169       pt_ann[i] = 0.;
    170     }
    171 
    172     if (fUseConstituents) {
     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    {
    173157      TIter itConstituents(candidate->GetCandidates());
    174       while((constituent = static_cast<Candidate*>(itConstituents.Next()))) {
    175         float pt = constituent->Momentum.Pt();
    176         float dr = candidate->Momentum.DeltaR(constituent->Momentum);
    177         //      cout << " There exists a constituent with dr=" << dr << endl;
    178         sumpt += pt;
    179         sumdrsqptsq += dr*dr*pt*pt;
    180         sumptsq += pt*pt;
    181         if (constituent->Charge == 0) {
    182           nn++;
    183         } else {
    184           if (constituent->IsRecoPU) {
    185             sumptchpu += pt;
    186           } else {
    187             sumptchpv += pt;
    188           }
    189           sumptch += pt;
    190           nc++;
    191         }
    192         for (int i = 0 ; i < 5 ; i++) {
    193           if (dr > 0.1*i && dr < 0.1*(i+1)) {
    194             pt_ann[i] += pt;
    195           }
    196         }
    197         float tow_sumT = 0;
    198         float tow_sumW = 0;
    199         for (int i = 0 ; i < constituent->Ecal_E_t.size() ; i++) {
    200           float w = TMath::Sqrt(constituent->Ecal_E_t[i].first);
    201           if (fAverageEachTower) {
    202             tow_sumT += w*constituent->Ecal_E_t[i].second;
    203             tow_sumW += w;
    204           } else {
    205             sumT0 += w*constituent->Ecal_E_t[i].second;
    206             sumT1 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.001);
    207             sumT10 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.010);
    208             sumT20 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.020);
    209             sumT30 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.030);
    210             sumT40 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.040);
    211             sumWeightsForT += w;
    212             candidate->Ntimes++;
    213           }
    214         }
    215         if (fAverageEachTower && tow_sumW > 0.) {
    216           sumT0 += tow_sumT;
    217           sumT1 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.001);
    218           sumT10 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0010);
    219           sumT20 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0020);
    220           sumT30 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0030);
    221           sumT40 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0040);
    222           sumWeightsForT += tow_sumW;
    223           candidate->Ntimes++;
    224         }
    225       }
    226     } else {
     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    {
    227195      // Not using constituents, using dr
    228196      fItTrackInputArray->Reset();
    229       while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) {
    230         if (trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
    231           float pt = trk->Momentum.Pt();
    232           sumpt += pt;
    233           sumptch += pt;
    234           if (trk->IsRecoPU) {
    235             sumptchpu += pt;
    236           } else {
    237             sumptchpv += pt;
    238           }
    239           float dr = candidate->Momentum.DeltaR(trk->Momentum);
    240           sumdrsqptsq += dr*dr*pt*pt;
    241           sumptsq += pt*pt;
    242           nc++;
    243           for (int i = 0 ; i < 5 ; i++) {
    244             if (dr > 0.1*i && dr < 0.1*(i+1)) {
    245               pt_ann[i] += pt;
    246             }
    247           }
    248         }
    249       }
     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
    250226      fItNeutralInputArray->Reset();
    251       while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) {
    252         if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
    253           float pt = constituent->Momentum.Pt();
    254           sumpt += pt;
    255           float dr = candidate->Momentum.DeltaR(constituent->Momentum);
    256           sumdrsqptsq += dr*dr*pt*pt;
    257           sumptsq += pt*pt;
    258           nn++;
    259           for (int i = 0 ; i < 5 ; i++) {
    260             if (dr > 0.1*i && dr < 0.1*(i+1)) {
    261             pt_ann[i] += pt;
    262             }
    263           }
    264         }
    265       }
    266     }
    267 
    268     if (sumptch > 0.) {
    269       candidate->Beta = sumptchpv/sumptch;
    270       candidate->BetaStar = sumptchpu/sumptch;
    271     } else {
    272       candidate->Beta = -999.;
    273       candidate->BetaStar = -999.;
    274     }
    275     if (sumptsq > 0.) {
     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    {
    276260      candidate->MeanSqDeltaR = sumdrsqptsq/sumptsq;
    277     } else {
    278       candidate->MeanSqDeltaR = -999.;
     261    }
     262    else
     263    {
     264      candidate->MeanSqDeltaR = -999.0;
    279265    }
    280266    candidate->NCharged = nc;
    281267    candidate->NNeutrals = nn;
    282     if (sumpt > 0.) {
     268    if(sumpt > 0.0)
     269    {
    283270      candidate->PTD = TMath::Sqrt(sumptsq) / sumpt;
    284       for (int i = 0 ; i < 5 ; i++) {
     271      for(i = 0; i < 5; ++i)
     272      {
    285273        candidate->FracPt[i] = pt_ann[i]/sumpt;
    286274      }
    287     } else {
    288       candidate->PTD = -999.;
    289       for (int i = 0 ; i < 5 ; i++) {
    290         candidate->FracPt[i] = -999.;
     275    }
     276    else
     277    {
     278      candidate->PTD = -999.0;
     279      for(i = 0; i < 5; ++i)
     280      {
     281        candidate->FracPt[i] = -999.0;
    291282      }
    292283    }
    293284
    294285    fOutputArray->Add(candidate);
    295 
    296     // New stuff
    297     /*
    298     fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1);
    299     fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1);
    300     fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1);
    301     fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1);
    302     fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1);
    303     */
    304 
    305     bool passId = false;
    306     if (candidate->Momentum.Pt() > fJetPTMinForNeutrals && candidate->MeanSqDeltaR > -0.1) {
    307       if (fabs(candidate->Momentum.Eta())<1.5) {
    308         passId = ((candidate->Beta > fBetaMinBarrel) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxBarrel));
    309       } else if (fabs(candidate->Momentum.Eta())<4.0) {
    310         passId = ((candidate->Beta > fBetaMinEndcap) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxEndcap));
    311       } else {
    312         passId = (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxForward);
    313       }
    314     }
    315 
    316     //    cout << " Pt Eta MeanSqDeltaR Beta PassId " << candidate->Momentum.Pt()
    317     //   << " " << candidate->Momentum.Eta() << " " << candidate->MeanSqDeltaR << " " << candidate->Beta << " " << passId << endl;
    318 
    319     if (passId) {
    320       if (fUseConstituents) {
    321         TIter itConstituents(candidate->GetCandidates());
    322         while((constituent = static_cast<Candidate*>(itConstituents.Next()))) {
    323           if (constituent->Charge == 0 && constituent->Momentum.Pt() > fNeutralPTMin) {
    324             fNeutralsInPassingJets->Add(constituent);
    325             //      cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
    326           }
    327         }
    328       } else { // use DeltaR
    329         fItNeutralInputArray->Reset();
    330         while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) {
    331           if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR && constituent->Momentum.Pt() > fNeutralPTMin) {
    332             fNeutralsInPassingJets->Add(constituent);
    333             //            cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
    334           }
    335         }
    336       }
    337     }
    338 
    339 
    340286  }
    341287}
    342288
    343289//------------------------------------------------------------------------------
     290
  • modules/PileUpJetID.h

    r9be57d9 r532016b  
     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
    119#ifndef PileUpJetID_h
    220#define PileUpJetID_h
     
    422/** \class PileUpJetID
    523 *
    6  *  CMS PileUp Jet ID Variables
     24 *  CMS PileUp Jet ID Variables, based on http://cds.cern.ch/record/1581583
    725 *
    8  *  \author S. Zenz
     26 *  \author S. Zenz, December 2013
    927 *
    1028 */
     
    1634
    1735class TObjArray;
    18 class DelphesFormula;
    1936
    2037class PileUpJetID: public DelphesModule
     
    3451  Double_t fParameterR;
    3552
    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   /*
    46 JAY
    47 ---
    48 
    49 |Eta|<1.5
    50 
    51 meanSqDeltaR betaStar SigEff BgdEff
    52 0.13 0.92 96% 8%
    53 0.13 0.95 97% 16%
    54 0.13 0.97 98% 27%
    55 
    56 |Eta|>1.5
    57 
    58 meanSqDeltaR betaStar SigEff BgdEff
    59 0.14 0.91 95% 15%
    60 0.14 0.94 97% 19%
    61 0.14 0.97 98% 29%
    62 
    63 BRYAN
    64 -----
    65 
    66 Barrel (MeanSqDR, Beta, sig eff, bg eff):
    67 0.10, 0.08, 90%, 8%
    68 0.11, 0.12, 90%, 6%
    69 0.13, 0.16, 89%, 5%
    70 
    71 Endcap (MeanSqDR, Beta, sig eff, bg eff):
    72 0.07, 0.06, 89%, 4%
    73 0.08, 0.08, 92%, 6%
    74 0.09, 0.08, 95%, 10%
    75 0.10, 0.08, 97%, 13%
    76 
    77 SETH GUESSES FOR |eta| > 4.0
    78 ----------------------------
    79 
    80 MeanSqDeltaR
    81 0.07
    82 0.10
    83 0.14
    84 0.2
    85   */
    86 
    8753  // If set to true, may have weird results for PFCHS
    8854  // If set to false, uses everything within dR < fParameterR even if in other jets &c.
    8955  // Results should be very similar for PF
    90   Int_t fUseConstituents; 
     56  Int_t fUseConstituents;
    9157
    9258  Bool_t fAverageEachTower;
     
    9662  const TObjArray *fJetInputArray; //!
    9763
    98   const TObjArray *fTrackInputArray; // SCZ
    99   const TObjArray *fNeutralInputArray;
     64  const TObjArray *fTrackInputArray; //!
     65  const TObjArray *fNeutralInputArray; //!
    10066
    101   TIterator *fItTrackInputArray; // SCZ
    102   TIterator *fItNeutralInputArray; // SCZ
     67  TIterator *fItTrackInputArray; //!
     68  TIterator *fItNeutralInputArray; //!
    10369
    10470  TObjArray *fOutputArray; //!
    105   TObjArray *fNeutralsInPassingJets; // SCZ
    10671
     72  TIterator *fItVertexInputArray; //!
     73  const TObjArray *fVertexInputArray; //!
    10774
    108   ClassDef(PileUpJetID, 2)
     75  Double_t fZVertexResolution;
     76
     77  ClassDef(PileUpJetID, 1)
    10978};
    11079
    11180#endif
     81
  • modules/PileUpMerger.cc

    r9be57d9 r532016b  
    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 
    8782  // read vertex smearing formula
    8883
     
    116111  TParticlePDG *pdgParticle;
    117112  Int_t pid;
    118   Float_t x, y, z, t, vx, vy;
     113  Float_t x, y, z, t;
    119114  Float_t px, py, pz, e;
    120115  Double_t dz, dphi, dt;
    121   Int_t numberOfEvents, event, numberOfParticles;
     116  Int_t numberOfEvents, event;
    122117  Long64_t allEntries, entry;
    123   Candidate *candidate, *vertex;
     118  Candidate *candidate, *vertexcandidate;
    124119  DelphesFactory *factory;
    125120
     
    128123  fItInputArray->Reset();
    129124
    130   // --- Deal with primary vertex first  ------
     125  // --- Deal with Primary vertex first  ------
    131126
    132127  fFunction->GetRandom2(dz, dt);
     
    134129  dt *= c_light*1.0E3; // necessary in order to make t in mm/c
    135130  dz *= 1.0E3; // necessary in order to make z in mm
    136   vx = 0.0;
    137   vy = 0.0;
    138   numberOfParticles = fInputArray->GetEntriesFast();
     131
    139132  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    140133  {
    141     vx += candidate->Position.X();
    142     vy += candidate->Position.Y();
    143134    z = candidate->Position.Z();
    144135    t = candidate->Position.T();
     
    148139  }
    149140
    150   if(numberOfParticles > 0)
    151   {
    152     vx /= numberOfParticles;
    153     vy /= numberOfParticles;
    154   }
    155 
    156141  factory = GetFactory();
    157142
    158   vertex = factory->NewCandidate();
    159   vertex->Position.SetXYZT(vx, vy, dz, dt);
    160   fVertexOutputArray->Add(vertex);
     143  vertexcandidate = factory->NewCandidate();
     144  vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
     145  fVertexOutputArray->Add(vertexcandidate);
    161146
    162147  // --- Then with pile-up vertices  ------
     
    196181    dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
    197182
    198     vx = 0.0;
    199     vy = 0.0;
    200     numberOfParticles = 0;
     183    vertexcandidate = factory->NewCandidate();
     184    vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
     185    vertexcandidate->IsPU = 1;
     186
     187    fVertexOutputArray->Add(vertexcandidate);
     188
    201189    while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e))
    202190    {
     
    216204      candidate->Momentum.RotateZ(dphi);
    217205
    218       x -= fInputBeamSpotX;
    219       y -= fInputBeamSpotY;
    220206      candidate->Position.SetXYZT(x, y, z + dz, t + dt);
    221207      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;
    227208
    228209      fParticleOutputArray->Add(candidate);
    229210    }
    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);
    242211  }
    243212}
    244213
    245214//------------------------------------------------------------------------------
     215
  • modules/PileUpMerger.h

    r9be57d9 r532016b  
    5353  Double_t fTVertexSpread;
    5454
    55   Double_t fInputBeamSpotX;
    56   Double_t fInputBeamSpotY;
    57   Double_t fOutputBeamSpotX;
    58   Double_t fOutputBeamSpotY;
    59 
    6055  DelphesTF2 *fFunction; //!
    6156
  • modules/PileUpMergerPythia8.cc

    r9be57d9 r532016b  
    2929#include "classes/DelphesClasses.h"
    3030#include "classes/DelphesFactory.h"
    31 #include "classes/DelphesTF2.h"
     31#include "classes/DelphesFormula.h"
    3232#include "classes/DelphesPileUpReader.h"
    3333
     
    5656
    5757PileUpMergerPythia8::PileUpMergerPythia8() :
    58   fFunction(0), fPythia(0), fItInputArray(0)
     58  fPythia(0), fItInputArray(0)
    5959{
    60   fFunction = new DelphesTF2;
    6160}
    6261
     
    6564PileUpMergerPythia8::~PileUpMergerPythia8()
    6665{
    67   delete fFunction;
    6866}
    6967
     
    7472  const char *fileName;
    7573
    76   fPileUpDistribution = GetInt("PileUpDistribution", 0);
    77 
    7874  fMeanPileUp  = GetDouble("MeanPileUp", 10);
    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);
     75  fZVertexSpread = GetDouble("ZVertexSpread", 0.05)*1.0E3;
    8776
    8877  fPTMin = GetDouble("PTMin", 0.0);
    89 
    90   fFunction->Compile(GetString("VertexDistributionFormula", "0.0"));
    91   fFunction->SetRange(-fZVertexSpread, -fTVertexSpread, fZVertexSpread, fTVertexSpread);
    9278
    9379  fileName = GetString("ConfigFile", "MinBias.cmnd");
     
    10086
    10187  // create output arrays
    102   fParticleOutputArray = ExportArray(GetString("ParticleOutputArray", "stableParticles"));
    103   fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
     88  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
    10489}
    10590
     
    118103  TParticlePDG *pdgParticle;
    119104  Int_t pid, status;
    120   Float_t x, y, z, t, vx, vy;
     105  Float_t x, y, z, t;
    121106  Float_t px, py, pz, e;
    122   Double_t dz, dphi, dt;
    123   Int_t numberOfEvents, event, numberOfParticles, i;
    124   Candidate *candidate, *vertex;
     107  Double_t dz, dphi;
     108  Int_t poisson, event, i;
     109  Candidate *candidate;
    125110  DelphesFactory *factory;
    126111
    127   const Double_t c_light = 2.99792458E8;
    128 
    129112  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();
    140113  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    141114  {
    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;
     115    fOutputArray->Add(candidate);
    155116  }
    156117
    157118  factory = GetFactory();
    158119
    159   vertex = factory->NewCandidate();
    160   vertex->Position.SetXYZT(vx, vy, dz, dt);
    161   fVertexOutputArray->Add(vertex);
     120  poisson = gRandom->Poisson(fMeanPileUp);
    162121
    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)
     122  for(event = 0; event < poisson; ++event)
    179123  {
    180124    while(!fPythia->next());
    181125
    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 
     126    dz = gRandom->Gaus(0.0, fZVertexSpread);
    189127    dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
    190128
    191     vx = 0.0;
    192     vy = 0.0;
    193     numberOfParticles = fPythia->event.size();
    194     for(i = 1; i < numberOfParticles; ++i)
     129    for(i = 1; i < fPythia->event.size(); ++i)
    195130    {
    196131      Pythia8::Particle &particle = fPythia->event[i];
     
    208143      candidate->PID = pid;
    209144
    210       candidate->Status = 1;
     145      candidate->Status = status;
    211146
    212147      pdgParticle = pdg->GetParticle(pid);
     
    219154      candidate->Momentum.RotateZ(dphi);
    220155
    221       x -= fInputBeamSpotX;
    222       y -= fInputBeamSpotY;
    223       candidate->Position.SetXYZT(x, y, z + dz, t + dt);
     156      candidate->Position.SetXYZT(x, y, z + dz, t);
    224157      candidate->Position.RotateZ(dphi);
    225       candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0);
    226158
    227       vx += candidate->Position.X();
    228       vy += candidate->Position.Y();
    229 
    230       fParticleOutputArray->Add(candidate);
     159      fOutputArray->Add(candidate);
    231160    }
    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);
    244161  }
    245162}
    246163
    247164//------------------------------------------------------------------------------
     165
  • modules/PileUpMergerPythia8.h

    r9be57d9 r532016b  
    3131
    3232class TObjArray;
    33 class DelphesTF2;
    3433
    3534namespace Pythia8
     
    5150private:
    5251
    53   Int_t fPileUpDistribution;
    5452  Double_t fMeanPileUp;
    55 
    5653  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 
    6454  Double_t fPTMin;
    65 
    66   DelphesTF2 *fFunction; //!
    6755
    6856  Pythia8::Pythia *fPythia; //!
     
    7260  const TObjArray *fInputArray; //!
    7361
    74   TObjArray *fParticleOutputArray; //!
    75   TObjArray *fVertexOutputArray; //!
     62  TObjArray *fOutputArray; //!
    7663
    7764  ClassDef(PileUpMergerPythia8, 1)
  • modules/TauTagging.cc

    r9be57d9 r532016b  
    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"
    3539
    3640#include "TMath.h"
     
    4953using namespace std;
    5054
     55//------------------------------------------------------------------------------
     56
     57class TauTaggingPartonClassifier : public ExRootClassifier
     58{
     59public:
     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};
    5169
    5270//------------------------------------------------------------------------------
     
    6179{
    6280  Candidate *tau = static_cast<Candidate *>(object);
    63   Candidate *daughter1 = 0;
    64   Candidate *daughter2 = 0;
    65  
     81  Candidate *daughter = 0;
    6682  const TLorentzVector &momentum = tau->Momentum;
    67   Int_t pdgCode, i, j;
     83  Int_t pdgCode, i;
    6884
    6985  pdgCode = TMath::Abs(tau->PID);
     
    8298  for(i = tau->D1; i <= tau->D2; ++i)
    8399  {
    84     daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i));
    85     pdgCode = TMath::Abs(daughter1->PID);
    86     if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1;
    87     else if(pdgCode == 24)
    88     {
    89      if(daughter1->D1 < 0) return -1;
    90      for(j = daughter1->D1; j <= daughter1->D2; ++j)
    91      {
    92        daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j));
    93        pdgCode = TMath::Abs(daughter2->PID);
    94        if(pdgCode == 11 || pdgCode == 13) return -1;
    95      }
    96        
    97     }
     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;
    98103  }
    99104
  • modules/TauTagging.h

    r9be57d9 r532016b  
    3131
    3232#include "classes/DelphesModule.h"
    33 #include "ExRootAnalysis/ExRootResult.h"
    34 #include "ExRootAnalysis/ExRootFilter.h"
    35 #include "ExRootAnalysis/ExRootClassifier.h"
    3633
    3734#include <map>
     
    7976};
    8077
    81 
    82 //------------------------------------------------------------------------------
    83 
    84 class TauTaggingPartonClassifier : public ExRootClassifier
    85 {
    86 public:
    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 
    9878#endif
  • modules/TrackPileUpSubtractor.cc

    r9be57d9 r532016b  
    7474  fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
    7575
    76   fPTMin = GetDouble("PTMin", 0.);
    7776  // import arrays with output from other modules
    78    
     77
    7978  ExRootConfParam param = GetParam("InputArray");
    8079  Long_t i, size;
     
    148147      // assume perfect pile-up subtraction for tracks outside fZVertexResolution
    149148     
    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       }
     149      if(candidate->IsPU && TMath::Abs(z-zvtx) > fZVertexResolution) continue;
     150
     151      array->Add(candidate);
    156152    }
    157153  }
  • modules/TrackPileUpSubtractor.h

    r9be57d9 r532016b  
    5050  Double_t fZVertexResolution;
    5151
    52   Double_t fPTMin;
    53 
    5452  std::map< TIterator *, TObjArray * > fInputMap; //!
    5553
  • modules/TreeWriter.cc

    r9be57d9 r532016b  
    362362
    363363    entry->T = position.T()*1.0E-3/c_light;
    364     entry->Ntimes = candidate->Ntimes;   
    365364
    366365    FillParticles(candidate, &entry->Particles);
     
    404403    entry->T = position.T()*1.0E-3/c_light;
    405404
    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 
    415405    entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad/candidate->Eem : 999.9;
    416406
     
    452442    entry->T = position.T()*1.0E-3/c_light;
    453443
    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 
    464444    entry->Charge = candidate->Charge;
    465445
     
    507487
    508488    entry->T = position.T()*1.0E-3/c_light;
    509    
    510     // Isolation variables
    511        
    512     entry->IsolationVar = candidate->IsolationVar;
    513     entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;
    514     entry->SumPtCharged = candidate->SumPtCharged ;
    515     entry->SumPtNeutral = candidate->SumPtNeutral ;
    516     entry->SumPtChargedPU = candidate->SumPtChargedPU ;
    517     entry->SumPt = candidate->SumPt ;
    518489
    519490    entry->Charge = candidate->Charge;
     
    560531
    561532    entry->Mass = momentum.M();
    562 
    563     entry->Area = candidate->Area;
    564533
    565534    entry->DeltaEta = candidate->DeltaEta;
Note: See TracChangeset for help on using the changeset viewer.