Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/PileUpMerger.cc

    r3e2bb2b r341014c  
    2929#include "classes/DelphesClasses.h"
    3030#include "classes/DelphesFactory.h"
     31#include "classes/DelphesPileUpReader.h"
    3132#include "classes/DelphesTF2.h"
    32 #include "classes/DelphesPileUpReader.h"
    33 
     33
     34#include "ExRootAnalysis/ExRootClassifier.h"
     35#include "ExRootAnalysis/ExRootFilter.h"
    3436#include "ExRootAnalysis/ExRootResult.h"
    35 #include "ExRootAnalysis/ExRootFilter.h"
    36 #include "ExRootAnalysis/ExRootClassifier.h"
    37 
     37
     38#include "TDatabasePDG.h"
     39#include "TFormula.h"
     40#include "TLorentzVector.h"
    3841#include "TMath.h"
     42#include "TObjArray.h"
     43#include "TRandom3.h"
    3944#include "TString.h"
    40 #include "TFormula.h"
    41 #include "TRandom3.h"
    42 #include "TObjArray.h"
    43 #include "TDatabasePDG.h"
    44 #include "TLorentzVector.h"
    4545
    4646#include <algorithm>
    47 #include <stdexcept>
    4847#include <iostream>
    4948#include <sstream>
     49#include <stdexcept>
    5050
    5151using namespace std;
     
    5959}
    6060
    61 
    6261//------------------------------------------------------------------------------
    6362
     
    7574  fPileUpDistribution = GetInt("PileUpDistribution", 0);
    7675
    77   fMeanPileUp  = GetDouble("MeanPileUp", 10);
     76  fMeanPileUp = GetDouble("MeanPileUp", 10);
    7877
    7978  fZVertexSpread = GetDouble("ZVertexSpread", 0.15);
     
    135134  dt0 = -1.0e6;
    136135
    137   dt *= c_light*1.0E3; // necessary in order to make t in mm/c
     136  dt *= c_light * 1.0E3; // necessary in order to make t in mm/c
    138137  dz *= 1.0E3; // necessary in order to make z in mm
    139138
     
    150149  vertex = factory->NewCandidate();
    151150
    152   while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     151  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
    153152  {
    154153    vx += candidate->Position.X();
     
    159158
    160159    // take postion and time from first stable particle
    161     if (dz0 < -999999.0)
     160    if(dz0 < -999999.0)
    162161      dz0 = z;
    163     if (dt0 < -999999.0)
     162    if(dt0 < -999999.0)
    164163      dt0 = t;
    165164
     
    172171    fParticleOutputArray->Add(candidate);
    173172
    174     if(TMath::Abs(candidate->Charge) >  1.0E-9)
     173    if(TMath::Abs(candidate->Charge) > 1.0E-9)
    175174    {
    176175      nch++;
    177       sumpt2 += pt*pt;
     176      sumpt2 += pt * pt;
    178177      vertex->AddCandidate(candidate);
    179178    }
     
    198197  switch(fPileUpDistribution)
    199198  {
    200     case 0:
    201       numberOfEvents = gRandom->Poisson(fMeanPileUp);
    202       break;
    203     case 1:
    204       numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1);
    205       break;
    206     case 2:
    207       numberOfEvents = fMeanPileUp;
    208       break;
    209     default:
    210       numberOfEvents = gRandom->Poisson(fMeanPileUp);
    211       break;
     199  case 0:
     200    numberOfEvents = gRandom->Poisson(fMeanPileUp);
     201    break;
     202  case 1:
     203    numberOfEvents = gRandom->Integer(2 * fMeanPileUp + 1);
     204    break;
     205  case 2:
     206    numberOfEvents = fMeanPileUp;
     207    break;
     208  default:
     209    numberOfEvents = gRandom->Poisson(fMeanPileUp);
     210    break;
    212211  }
    213212
    214213  allEntries = fReader->GetEntries();
    215 
    216214
    217215  for(event = 0; event < numberOfEvents; ++event)
     
    219217    do
    220218    {
    221       entry = TMath::Nint(gRandom->Rndm()*allEntries);
    222     }
    223     while(entry >= allEntries);
     219      entry = TMath::Nint(gRandom->Rndm() * allEntries);
     220    } while(entry >= allEntries);
    224221
    225222    fReader->ReadEntry(entry);
    226223
    227    // --- Pile-up vertex smearing
     224    // --- Pile-up vertex smearing
    228225
    229226    fFunction->GetRandom2(dz, dt);
    230227
    231     dt *= c_light*1.0E3; // necessary in order to make t in mm/c
     228    dt *= c_light * 1.0E3; // necessary in order to make t in mm/c
    232229    dz *= 1.0E3; // necessary in order to make z in mm
    233230
     
    252249
    253250      pdgParticle = pdg->GetParticle(pid);
    254       candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
     251      candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
    255252      candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9;
    256253
     
    271268
    272269      ++numberOfParticles;
    273       if(TMath::Abs(candidate->Charge) >  1.0E-9)
     270      if(TMath::Abs(candidate->Charge) > 1.0E-9)
    274271      {
    275272        nch++;
    276         sumpt2 += pt*pt;
     273        sumpt2 += pt * pt;
    277274        vertex->AddCandidate(candidate);
    278275      }
     
    299296
    300297    fVertexOutputArray->Add(vertex);
    301 
    302298  }
    303299}
Note: See TracChangeset for help on using the changeset viewer.