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