Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/PileUpMerger.cc

    r2d494a6 rcab38f6  
    8080  fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09);
    8181
    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 
    8782  // read vertex smearing formula
    8883
     
    116111  TParticlePDG *pdgParticle;
    117112  Int_t pid;
    118   Float_t x, y, z, t, vx, vy;
     113  Float_t x, y, z, t;
    119114  Float_t px, py, pz, e;
    120115  Double_t dz, dphi, dt;
    121   Int_t numberOfEvents, event, numberOfParticles;
     116  Int_t numberOfEvents, event;
    122117  Long64_t allEntries, entry;
    123   Candidate *candidate, *vertex;
     118  Candidate *candidate, *vertexcandidate;
    124119  DelphesFactory *factory;
    125120
     
    128123  fItInputArray->Reset();
    129124
    130   // --- Deal with primary vertex first  ------
     125  // --- Deal with Primary vertex first  ------
    131126
    132127  fFunction->GetRandom2(dz, dt);
     
    134129  dt *= c_light*1.0E3; // necessary in order to make t in mm/c
    135130  dz *= 1.0E3; // necessary in order to make z in mm
    136   vx = 0.0;
    137   vy = 0.0;
    138   numberOfParticles = fInputArray->GetEntriesFast();
     131
    139132  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    140133  {
    141     vx += candidate->Position.X();
    142     vy += candidate->Position.Y();
    143134    z = candidate->Position.Z();
    144135    t = candidate->Position.T();
     
    148139  }
    149140
    150   if(numberOfParticles > 0)
    151   {
    152     vx /= numberOfParticles;
    153     vy /= numberOfParticles;
    154   }
    155 
    156141  factory = GetFactory();
    157142
    158   vertex = factory->NewCandidate();
    159   vertex->Position.SetXYZT(vx, vy, dz, dt);
    160   fVertexOutputArray->Add(vertex);
     143  vertexcandidate = factory->NewCandidate();
     144  vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
     145  fVertexOutputArray->Add(vertexcandidate);
    161146
    162147  // --- Then with pile-up vertices  ------
     
    196181    dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
    197182
    198     vx = 0.0;
    199     vy = 0.0;
    200     numberOfParticles = 0;
     183    vertexcandidate = factory->NewCandidate();
     184    vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
     185    vertexcandidate->IsPU = 1;
     186
     187    fVertexOutputArray->Add(vertexcandidate);
     188
    201189    while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e))
    202190    {
     
    216204      candidate->Momentum.RotateZ(dphi);
    217205
    218       x -= fInputBeamSpotX;
    219       y -= fInputBeamSpotY;
    220206      candidate->Position.SetXYZT(x, y, z + dz, t + dt);
    221207      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;
    227208
    228209      fParticleOutputArray->Add(candidate);
    229210    }
    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);
    242211  }
    243212}
    244213
    245214//------------------------------------------------------------------------------
     215
Note: See TracChangeset for help on using the changeset viewer.