Fork me on GitHub

Changeset 78d1846 in git


Ignore:
Timestamp:
Apr 24, 2017, 12:21:09 PM (8 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
d108fdc
Parents:
534d945
Message:

use fillParticle for all particles that aren't partons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • readers/DelphesPythia8.cpp

    r534d945 r78d1846  
    146146}
    147147
    148 
    149 // Single-particle gun. The particle must be a colour singlet.
    150 // Input: flavour, energy, direction (theta, phi).
    151 // If theta < 0 then random choice over solid angle.
    152 // Optional final argument to put particle at rest => E = m.
    153 // from pythia8 example 21
    154 
    155 void fillParticle(int id, double p_max, double eta_max,
     148//---------------------------------------------------------------------------
     149
     150/*
     151Single-particle gun. The particle must be a colour singlet.
     152Input: flavour, energy, direction (theta, phi).
     153If theta < 0 then random choice over solid angle.
     154Optional final argument to put particle at rest => E = m.
     155from pythia8 example 21
     156*/
     157
     158void fillParticle(int id, double pMax, double etaMax,
    156159  Pythia8::Event &event, Pythia8::ParticleData &pdt, Pythia8::Rndm &rndm)
    157160{
     
    161164  // Generate uniform pt and eta.
    162165  double pt, eta, phi, pp, ee, mm;
    163  
    164   //pmin = 0.1 GeV for single particles
    165   pp = pow(10, - 1.0 + (log10(p_max) + 1.0) * rndm.flat());
    166   eta = (2.0 * rndm.flat() - 1.0) * eta_max;
     166
     167  // pMin = 0.1 GeV for single particles
     168  pp = pow(10, - 1.0 + (log10(pMax) + 1.0) * rndm.flat());
     169  eta = (2.0 * rndm.flat() - 1.0) * etaMax;
    167170  phi = 2.0 * M_PI * rndm.flat();
    168171  mm = pdt.mSel(id);
     
    174177}
    175178
    176 void fillPartons(int id, double p_max, double eta_max,
     179//---------------------------------------------------------------------------
     180
     181void fillPartons(int id, double pMax, double etaMax,
    177182  Pythia8::Event &event, Pythia8::ParticleData &pdt, Pythia8::Rndm &rndm)
    178183{
    179 
    180184  // Reset event record to allow for new event.
    181185  event.reset();
     
    184188  double pt, eta, phi, pp, ee, mm;
    185189
    186   //pmin = 1 GeV for jets
    187   pp = pow(10, log10(p_max) * rndm.flat()); 
    188   eta = (2.0 * rndm.flat() - 1.0) * eta_max;
     190  // pMin = 1 GeV for jets
     191  pp = pow(10, log10(pMax) * rndm.flat());
     192  eta = (2.0 * rndm.flat() - 1.0) * etaMax;
    189193  phi = 2.0 * M_PI * rndm.flat();
    190194  mm = pdt.mSel(id);
     
    193197
    194198  if( (id == 4 || id == 5) && pt < 10.0) return;
    195  
     199
    196200  if(id == 21)
    197201  {
     
    205209  }
    206210}
    207 
    208211
    209212//---------------------------------------------------------------------------
     
    227230  Long64_t eventCounter, errorCounter;
    228231  Long64_t numberOfEvents, timesAllowErrors;
     232  Bool_t spareFlag1;
     233  Int_t spareMode1;
     234  Double_t spareParm1, spareParm2;
    229235
    230236  Pythia8::Pythia *pythia = 0;
    231  
     237
    232238  // for matching
    233239  Pythia8::CombineMatchingInput *combined = 0;
     
    279285    // Initialize Pythia
    280286    pythia = new Pythia8::Pythia;
    281  
     287
    282288    // jet matching
    283289    matching = combined->getHook(*pythia);
    284     if (!matching)
     290    if(!matching)
    285291    {
    286292      throw runtime_error("can't do matching");
    287293    }
    288294    pythia->setUserHooksPtr(matching);
    289  
     295
    290296
    291297    if(pythia == NULL)
     
    305311    timesAllowErrors = pythia->mode("Main:timesAllowErrors");
    306312
     313    spareFlag1 = pythia->flag("Main:spareFlag1");
     314    spareMode1 = pythia->mode("Main:spareMode1");
     315    spareParm1 = pythia->parm("Main:spareParm1");
     316    spareParm2 = pythia->parm("Main:spareParm2");
     317
    307318    // Check if particle gun
    308     if (!pythia->flag("Main:spareFlag1"))
     319    if(!spareFlag1)
    309320    {
    310321      inputFile = fopen(pythia->word("Beams:LHEF").c_str(), "r");
     
    340351        stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady());
    341352
    342       if (pythia->flag("Main:spareFlag1"))
     353      if(spareFlag1)
    343354      {
    344         if (pythia->mode("Main:spareMode1") == 11 || pythia->mode("Main:spareMode1") == 13 || pythia->mode("Main:spareMode1") == 15 || pythia->mode("Main:spareMode1") == 22 || pythia->mode("Main:spareMode1") == 211 || pythia->mode("Main:spareMode1") == 2112)
    345         { 
    346           fillParticle(pythia->mode("Main:spareMode1"), pythia->parm("Main:spareParm1"), pythia->parm("Main:spareParm2"), pythia->event, pythia->particleData, pythia->rndm);
     355        if((spareMode1 >= 1 && spareMode1 <= 5) || spareMode1 == 21)
     356        {
     357          fillPartons(spareMode1, spareParm1, spareParm2, pythia->event, pythia->particleData, pythia->rndm);
    347358        }
    348359        else
    349360        {
    350           fillPartons(pythia->mode("Main:spareMode1"), pythia->parm("Main:spareParm1"), pythia->parm("Main:spareParm2"), pythia->event, pythia->particleData, pythia->rndm);
     361          fillParticle(spareMode1, spareParm1, spareParm2, pythia->event, pythia->particleData, pythia->rndm);
    351362        }
    352363      }
Note: See TracChangeset for help on using the changeset viewer.