Changes in modules/PileUpMerger.cc [2d494a6:099becf] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/PileUpMerger.cc
r2d494a6 r099becf 115 115 TDatabasePDG *pdg = TDatabasePDG::Instance(); 116 116 TParticlePDG *pdgParticle; 117 Int_t pid ;117 Int_t pid, nch, nvtx = -1; 118 118 Float_t x, y, z, t, vx, vy; 119 Float_t px, py, pz, e ;120 Double_t dz, dphi, dt ;119 Float_t px, py, pz, e, pt; 120 Double_t dz, dphi, dt, sumpt2, dz0, dt0; 121 121 Int_t numberOfEvents, event, numberOfParticles; 122 122 Long64_t allEntries, entry; … … 132 132 fFunction->GetRandom2(dz, dt); 133 133 134 dz0 = -1.0e6; 135 dt0 = -1.0e6; 136 134 137 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 135 138 dz *= 1.0E3; // necessary in order to make z in mm 139 140 //cout<<dz<<","<<dt<<endl; 141 136 142 vx = 0.0; 137 143 vy = 0.0; 144 138 145 numberOfParticles = fInputArray->GetEntriesFast(); 146 nch = 0; 147 sumpt2 = 0.0; 148 139 149 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 140 150 { … … 143 153 z = candidate->Position.Z(); 144 154 t = candidate->Position.T(); 145 candidate->Position.SetZ(z + dz); 146 candidate->Position.SetT(t + dt); 155 pt = candidate->Momentum.Pt(); 156 157 // take postion and time from first stable particle 158 if (dz0 < -999999.0) 159 dz0 = z; 160 if (dt0 < -999999.0) 161 dt0 = t; 162 163 // cancel any possible offset in position and time the input file 164 candidate->Position.SetZ(z - dz0 + dz); 165 candidate->Position.SetT(t - dt0 + dt); 166 147 167 fParticleOutputArray->Add(candidate); 148 } 149 168 169 if(TMath::Abs(candidate->Charge) > 1.0E-9) 170 { 171 nch++; 172 sumpt2 += pt*pt; 173 } 174 } 175 150 176 if(numberOfParticles > 0) 151 177 { 152 vx /= numberOfParticles; 153 vy /= numberOfParticles; 154 } 155 178 vx /= sumpt2; 179 vy /= sumpt2; 180 } 181 182 nvtx++; 156 183 factory = GetFactory(); 157 184 158 185 vertex = factory->NewCandidate(); 159 186 vertex->Position.SetXYZT(vx, vy, dz, dt); 187 vertex->ClusterIndex = nvtx; 188 vertex->ClusterNDF = nch; 189 vertex->SumPT2 = sumpt2; 190 vertex->GenSumPT2 = sumpt2; 191 160 192 fVertexOutputArray->Add(vertex); 161 193 … … 170 202 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1); 171 203 break; 204 case 2: 205 numberOfEvents = fMeanPileUp; 206 break; 172 207 default: 173 208 numberOfEvents = gRandom->Poisson(fMeanPileUp); … … 198 233 vx = 0.0; 199 234 vy = 0.0; 235 200 236 numberOfParticles = 0; 237 sumpt2 = 0.0; 238 201 239 while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) 202 240 { … … 224 262 vx += candidate->Position.X(); 225 263 vy += candidate->Position.Y(); 264 226 265 ++numberOfParticles; 227 266 if(TMath::Abs(candidate->Charge) > 1.0E-9) 267 { 268 nch++; 269 sumpt2 += pt*pt; 270 } 271 228 272 fParticleOutputArray->Add(candidate); 229 273 } … … 234 278 vy /= numberOfParticles; 235 279 } 280 281 nvtx++; 236 282 237 283 vertex = factory->NewCandidate(); 238 284 vertex->Position.SetXYZT(vx, vy, dz, dt); 285 286 vertex->ClusterIndex = nvtx; 287 vertex->ClusterNDF = nch; 288 vertex->SumPT2 = sumpt2; 289 vertex->GenSumPT2 = sumpt2; 290 239 291 vertex->IsPU = 1; 240 292 241 293 fVertexOutputArray->Add(vertex); 242 } 243 } 244 245 //------------------------------------------------------------------------------ 294 295 } 296 } 297 298 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.