Changeset 28027d5 in git for modules/PileUpMerger.cc
- Timestamp:
- Jun 26, 2015, 3:13:55 PM (9 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- f3c4047
- Parents:
- f53a4d2 (diff), fe0273c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/PileUpMerger.cc
rf53a4d2 r28027d5 80 80 fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09); 81 81 82 fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0); 83 fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0); 84 fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0); 85 fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0); 86 82 87 // read vertex smearing formula 83 88 … … 111 116 TParticlePDG *pdgParticle; 112 117 Int_t pid; 113 Float_t x, y, z, t ;118 Float_t x, y, z, t, vx, vy; 114 119 Float_t px, py, pz, e; 115 120 Double_t dz, dphi, dt; 116 Int_t numberOfEvents, event ;121 Int_t numberOfEvents, event, numberOfParticles; 117 122 Long64_t allEntries, entry; 118 Candidate *candidate, *vertex candidate;123 Candidate *candidate, *vertex; 119 124 DelphesFactory *factory; 120 125 … … 123 128 fItInputArray->Reset(); 124 129 125 // --- Deal with Primary vertex first ------130 // --- Deal with primary vertex first ------ 126 131 127 132 fFunction->GetRandom2(dz, dt); … … 129 134 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 130 135 dz *= 1.0E3; // necessary in order to make z in mm 131 136 vx = 0.0; 137 vy = 0.0; 138 numberOfParticles = fInputArray->GetEntriesFast(); 132 139 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 133 140 { 141 vx += candidate->Position.X(); 142 vy += candidate->Position.Y(); 134 143 z = candidate->Position.Z(); 135 144 t = candidate->Position.T(); … … 139 148 } 140 149 150 if(numberOfParticles > 0) 151 { 152 vx /= numberOfParticles; 153 vy /= numberOfParticles; 154 } 155 141 156 factory = GetFactory(); 142 157 143 vertex candidate= factory->NewCandidate();144 vertex candidate->Position.SetXYZT(0.0, 0.0, dz, dt);145 fVertexOutputArray->Add(vertex candidate);158 vertex = factory->NewCandidate(); 159 vertex->Position.SetXYZT(vx, vy, dz, dt); 160 fVertexOutputArray->Add(vertex); 146 161 147 162 // --- Then with pile-up vertices ------ … … 181 196 dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi()); 182 197 183 vertexcandidate = factory->NewCandidate(); 184 vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt); 185 vertexcandidate->IsPU = 1; 186 187 fVertexOutputArray->Add(vertexcandidate); 188 198 vx = 0.0; 199 vy = 0.0; 200 numberOfParticles = 0; 189 201 while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) 190 202 { … … 204 216 candidate->Momentum.RotateZ(dphi); 205 217 218 x -= fInputBeamSpotX; 219 y -= fInputBeamSpotY; 206 220 candidate->Position.SetXYZT(x, y, z + dz, t + dt); 207 221 candidate->Position.RotateZ(dphi); 222 candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0); 223 224 vx += candidate->Position.X(); 225 vy += candidate->Position.Y(); 226 ++numberOfParticles; 208 227 209 228 fParticleOutputArray->Add(candidate); 210 229 } 211 } 212 } 213 214 //------------------------------------------------------------------------------ 215 230 231 if(numberOfParticles > 0) 232 { 233 vx /= numberOfParticles; 234 vy /= numberOfParticles; 235 } 236 237 vertex = factory->NewCandidate(); 238 vertex->Position.SetXYZT(vx, vy, dz, dt); 239 vertex->IsPU = 1; 240 241 fVertexOutputArray->Add(vertex); 242 } 243 } 244 245 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.