Changeset 22dc7fd in git for modules/PileUpMerger.cc
- Timestamp:
- Dec 21, 2013, 3:00:11 PM (11 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 24d005f
- Parents:
- af88093
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/PileUpMerger.cc
raf88093 r22dc7fd 16 16 #include "classes/DelphesClasses.h" 17 17 #include "classes/DelphesFactory.h" 18 #include "classes/Delphes Formula.h"18 #include "classes/DelphesTF2.h" 19 19 #include "classes/DelphesPileUpReader.h" 20 20 … … 41 41 42 42 PileUpMerger::PileUpMerger() : 43 fReader(0), fItInputArray(0) 44 { 45 } 43 fFunction(0), fReader(0), fItInputArray(0) 44 { 45 fFunction = new DelphesTF2; 46 } 47 46 48 47 49 //------------------------------------------------------------------------------ … … 49 51 PileUpMerger::~PileUpMerger() 50 52 { 53 delete fFunction; 51 54 } 52 55 … … 60 63 61 64 fMeanPileUp = GetDouble("MeanPileUp", 10); 62 fZVertexSpread = GetDouble("ZVertexSpread", 0.05)*1.0E3; 63 65 66 fZVertexSpread = GetDouble("ZVertexSpread", 0.15); 67 fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09); 68 69 // read vertex smearing formula 70 71 fFunction->Compile(GetString("VertexDistributionFormula", "0.0")); 72 fFunction->SetRange(-fZVertexSpread,-fTVertexSpread,fZVertexSpread,fTVertexSpread); 73 64 74 fileName = GetString("PileUpFile", "MinBias.pileup"); 65 75 fReader = new DelphesPileUpReader(fileName); … … 90 100 Float_t x, y, z, t; 91 101 Float_t px, py, pz, e; 92 Double_t dz, dphi ;102 Double_t dz, dphi, dt; 93 103 Int_t numberOfEvents, event; 94 104 Long64_t allEntries, entry; 95 Candidate *candidate ;105 Candidate *candidate, *vertexcandidate; 96 106 DelphesFactory *factory; 107 108 const Double_t c_light = 2.99792458E8; 97 109 98 110 fItInputArray->Reset(); 111 112 // --- Deal with Primary vertex first ------ 113 114 fFunction->GetRandom2(dz,dt); 115 116 dt *= c_light*1.0E3; //necessary in order to make t in mm/c 117 dz *= 1.0E3; //necessary in order to make z in mm 118 99 119 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 100 120 { 121 candidate->Position.SetXYZT(x, y, z+dz, t+dt); 101 122 fParticleOutputArray->Add(candidate); 102 123 } 103 124 104 125 factory = GetFactory(); 105 126 127 vertexcandidate = factory->NewCandidate(); 128 vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt); 129 fVertexOutputArray->Add(vertexcandidate); 130 131 132 // --- Then with pile-up vertices ------ 133 106 134 switch(fPileUpDistribution) 107 135 { … … 118 146 119 147 allEntries = fReader->GetEntries(); 120 148 121 149 for(event = 0; event < numberOfEvents; ++event) 122 150 { … … 128 156 129 157 fReader->ReadEntry(entry); 130 131 dz = gRandom->Gaus(0.0, fZVertexSpread); 158 159 // --- Pile-up vertex smearing 160 161 fFunction->GetRandom2(dz,dt); 162 163 dt *= c_light*1.0E3; //necessary in order to make t in mm/c 164 dz *= 1.0E3; //necessary in order to make z in mm 165 132 166 dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi()); 133 167 134 candidate = factory->NewCandidate(); 135 candidate->Position.SetXYZT(0.0, 0.0, dz, 0.0); 136 fVertexOutputArray->Add(candidate); 168 vertexcandidate = factory->NewCandidate(); 169 vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt); 170 vertexcandidate->IsPU = 1; 171 172 fVertexOutputArray->Add(vertexcandidate); 137 173 138 174 while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) … … 149 185 150 186 candidate->IsPU = 1; 151 187 152 188 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 153 189 candidate->Momentum.RotateZ(dphi); 154 190 155 candidate->Position.SetXYZT(x, y, z + dz,t);191 candidate->Position.SetXYZT(x, y, z+dz, t+dt); 156 192 candidate->Position.RotateZ(dphi); 157 193 158 194 fParticleOutputArray->Add(candidate); 159 195 }
Note:
See TracChangeset
for help on using the changeset viewer.