- Timestamp:
- Apr 24, 2017, 12:21:09 PM (8 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- d108fdc
- Parents:
- 534d945
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
readers/DelphesPythia8.cpp
r534d945 r78d1846 146 146 } 147 147 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 /* 151 Single-particle gun. The particle must be a colour singlet. 152 Input: flavour, energy, direction (theta, phi). 153 If theta < 0 then random choice over solid angle. 154 Optional final argument to put particle at rest => E = m. 155 from pythia8 example 21 156 */ 157 158 void fillParticle(int id, double pMax, double etaMax, 156 159 Pythia8::Event &event, Pythia8::ParticleData &pdt, Pythia8::Rndm &rndm) 157 160 { … … 161 164 // Generate uniform pt and eta. 162 165 double pt, eta, phi, pp, ee, mm; 163 164 // pmin = 0.1 GeV for single particles165 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; 167 170 phi = 2.0 * M_PI * rndm.flat(); 168 171 mm = pdt.mSel(id); … … 174 177 } 175 178 176 void fillPartons(int id, double p_max, double eta_max, 179 //--------------------------------------------------------------------------- 180 181 void fillPartons(int id, double pMax, double etaMax, 177 182 Pythia8::Event &event, Pythia8::ParticleData &pdt, Pythia8::Rndm &rndm) 178 183 { 179 180 184 // Reset event record to allow for new event. 181 185 event.reset(); … … 184 188 double pt, eta, phi, pp, ee, mm; 185 189 186 // pmin = 1 GeV for jets187 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; 189 193 phi = 2.0 * M_PI * rndm.flat(); 190 194 mm = pdt.mSel(id); … … 193 197 194 198 if( (id == 4 || id == 5) && pt < 10.0) return; 195 199 196 200 if(id == 21) 197 201 { … … 205 209 } 206 210 } 207 208 211 209 212 //--------------------------------------------------------------------------- … … 227 230 Long64_t eventCounter, errorCounter; 228 231 Long64_t numberOfEvents, timesAllowErrors; 232 Bool_t spareFlag1; 233 Int_t spareMode1; 234 Double_t spareParm1, spareParm2; 229 235 230 236 Pythia8::Pythia *pythia = 0; 231 237 232 238 // for matching 233 239 Pythia8::CombineMatchingInput *combined = 0; … … 279 285 // Initialize Pythia 280 286 pythia = new Pythia8::Pythia; 281 287 282 288 // jet matching 283 289 matching = combined->getHook(*pythia); 284 if 290 if(!matching) 285 291 { 286 292 throw runtime_error("can't do matching"); 287 293 } 288 294 pythia->setUserHooksPtr(matching); 289 295 290 296 291 297 if(pythia == NULL) … … 305 311 timesAllowErrors = pythia->mode("Main:timesAllowErrors"); 306 312 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 307 318 // Check if particle gun 308 if (!pythia->flag("Main:spareFlag1"))319 if(!spareFlag1) 309 320 { 310 321 inputFile = fopen(pythia->word("Beams:LHEF").c_str(), "r"); … … 340 351 stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady()); 341 352 342 if (pythia->flag("Main:spareFlag1"))353 if(spareFlag1) 343 354 { 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 fillPart icle(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); 347 358 } 348 359 else 349 360 { 350 fillPart ons(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); 351 362 } 352 363 }
Note:
See TracChangeset
for help on using the changeset viewer.