Changes in modules/PileUpMerger.cc [3e2bb2b:2d494a6] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/PileUpMerger.cc
r3e2bb2b 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 factory = GetFactory();150 vertex = factory->NewCandidate();151 152 139 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 153 140 { … … 156 143 z = candidate->Position.Z(); 157 144 t = candidate->Position.T(); 158 pt = candidate->Momentum.Pt(); 159 160 // take postion and time from first stable particle 161 if (dz0 < -999999.0) 162 dz0 = z; 163 if (dt0 < -999999.0) 164 dt0 = t; 165 166 // cancel any possible offset in position and time the input file 167 candidate->Position.SetZ(z - dz0 + dz); 168 candidate->Position.SetT(t - dt0 + dt); 169 170 candidate->IsPU = 0; 171 145 candidate->Position.SetZ(z + dz); 146 candidate->Position.SetT(t + dt); 172 147 fParticleOutputArray->Add(candidate); 173 174 if(TMath::Abs(candidate->Charge) > 1.0E-9)175 {176 nch++;177 sumpt2 += pt*pt;178 vertex->AddCandidate(candidate);179 }180 148 } 181 149 182 150 if(numberOfParticles > 0) 183 151 { 184 vx /= sumpt2; 185 vy /= sumpt2; 186 } 187 188 nvtx++; 152 vx /= numberOfParticles; 153 vy /= numberOfParticles; 154 } 155 156 factory = GetFactory(); 157 158 vertex = factory->NewCandidate(); 189 159 vertex->Position.SetXYZT(vx, vy, dz, dt); 190 vertex->ClusterIndex = nvtx;191 vertex->ClusterNDF = nch;192 vertex->SumPT2 = sumpt2;193 vertex->GenSumPT2 = sumpt2;194 160 fVertexOutputArray->Add(vertex); 195 161 … … 204 170 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1); 205 171 break; 206 case 2:207 numberOfEvents = fMeanPileUp;208 break;209 172 default: 210 173 numberOfEvents = gRandom->Poisson(fMeanPileUp); … … 213 176 214 177 allEntries = fReader->GetEntries(); 215 216 178 217 179 for(event = 0; event < numberOfEvents; ++event) … … 236 198 vx = 0.0; 237 199 vy = 0.0; 238 239 200 numberOfParticles = 0; 240 sumpt2 = 0.0;241 242 //factory = GetFactory();243 vertex = factory->NewCandidate();244 245 201 while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) 246 202 { … … 259 215 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 260 216 candidate->Momentum.RotateZ(dphi); 261 pt = candidate->Momentum.Pt();262 217 263 218 x -= fInputBeamSpotX; … … 269 224 vx += candidate->Position.X(); 270 225 vy += candidate->Position.Y(); 271 272 226 ++numberOfParticles; 273 if(TMath::Abs(candidate->Charge) > 1.0E-9)274 {275 nch++;276 sumpt2 += pt*pt;277 vertex->AddCandidate(candidate);278 }279 227 280 228 fParticleOutputArray->Add(candidate); … … 287 235 } 288 236 289 nvtx++; 290 237 vertex = factory->NewCandidate(); 291 238 vertex->Position.SetXYZT(vx, vy, dz, dt); 292 293 vertex->ClusterIndex = nvtx;294 vertex->ClusterNDF = nch;295 vertex->SumPT2 = sumpt2;296 vertex->GenSumPT2 = sumpt2;297 298 239 vertex->IsPU = 1; 299 240 300 241 fVertexOutputArray->Add(vertex); 301 302 } 303 } 304 305 //------------------------------------------------------------------------------ 242 } 243 } 244 245 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.