Changes in modules/PileUpMerger.cc [3e2bb2b:341014c] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/PileUpMerger.cc
r3e2bb2b r341014c 29 29 #include "classes/DelphesClasses.h" 30 30 #include "classes/DelphesFactory.h" 31 #include "classes/DelphesPileUpReader.h" 31 32 #include "classes/DelphesTF2.h" 32 #include "classes/DelphesPileUpReader.h" 33 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #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" 38 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 39 44 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 45 46 46 #include <algorithm> 47 #include <stdexcept>48 47 #include <iostream> 49 48 #include <sstream> 49 #include <stdexcept> 50 50 51 51 using namespace std; … … 59 59 } 60 60 61 62 61 //------------------------------------------------------------------------------ 63 62 … … 75 74 fPileUpDistribution = GetInt("PileUpDistribution", 0); 76 75 77 fMeanPileUp 76 fMeanPileUp = GetDouble("MeanPileUp", 10); 78 77 79 78 fZVertexSpread = GetDouble("ZVertexSpread", 0.15); … … 135 134 dt0 = -1.0e6; 136 135 137 dt *= c_light *1.0E3; // necessary in order to make t in mm/c136 dt *= c_light * 1.0E3; // necessary in order to make t in mm/c 138 137 dz *= 1.0E3; // necessary in order to make z in mm 139 138 … … 150 149 vertex = factory->NewCandidate(); 151 150 152 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))151 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 153 152 { 154 153 vx += candidate->Position.X(); … … 159 158 160 159 // take postion and time from first stable particle 161 if 160 if(dz0 < -999999.0) 162 161 dz0 = z; 163 if 162 if(dt0 < -999999.0) 164 163 dt0 = t; 165 164 … … 172 171 fParticleOutputArray->Add(candidate); 173 172 174 if(TMath::Abs(candidate->Charge) > 173 if(TMath::Abs(candidate->Charge) > 1.0E-9) 175 174 { 176 175 nch++; 177 sumpt2 += pt *pt;176 sumpt2 += pt * pt; 178 177 vertex->AddCandidate(candidate); 179 178 } … … 198 197 switch(fPileUpDistribution) 199 198 { 200 201 202 203 204 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1);205 206 207 208 209 210 211 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; 212 211 } 213 212 214 213 allEntries = fReader->GetEntries(); 215 216 214 217 215 for(event = 0; event < numberOfEvents; ++event) … … 219 217 do 220 218 { 221 entry = TMath::Nint(gRandom->Rndm()*allEntries); 222 } 223 while(entry >= allEntries); 219 entry = TMath::Nint(gRandom->Rndm() * allEntries); 220 } while(entry >= allEntries); 224 221 225 222 fReader->ReadEntry(entry); 226 223 227 // --- Pile-up vertex smearing224 // --- Pile-up vertex smearing 228 225 229 226 fFunction->GetRandom2(dz, dt); 230 227 231 dt *= c_light *1.0E3; // necessary in order to make t in mm/c228 dt *= c_light * 1.0E3; // necessary in order to make t in mm/c 232 229 dz *= 1.0E3; // necessary in order to make z in mm 233 230 … … 252 249 253 250 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; 255 252 candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; 256 253 … … 271 268 272 269 ++numberOfParticles; 273 if(TMath::Abs(candidate->Charge) > 270 if(TMath::Abs(candidate->Charge) > 1.0E-9) 274 271 { 275 272 nch++; 276 sumpt2 += pt *pt;273 sumpt2 += pt * pt; 277 274 vertex->AddCandidate(candidate); 278 275 } … … 299 296 300 297 fVertexOutputArray->Add(vertex); 301 302 298 } 303 299 }
Note:
See TracChangeset
for help on using the changeset viewer.