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