Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/PileUpMerger.cc

    r099becf r2d494a6  
    115115  TDatabasePDG *pdg = TDatabasePDG::Instance();
    116116  TParticlePDG *pdgParticle;
    117   Int_t pid, nch, nvtx = -1;
     117  Int_t pid;
    118118  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;
    121121  Int_t numberOfEvents, event, numberOfParticles;
    122122  Long64_t allEntries, entry;
     
    132132  fFunction->GetRandom2(dz, dt);
    133133
    134   dz0 = -1.0e6;
    135   dt0 = -1.0e6;
    136  
    137134  dt *= c_light*1.0E3; // necessary in order to make t in mm/c
    138135  dz *= 1.0E3; // necessary in order to make z in mm
    139  
    140   //cout<<dz<<","<<dt<<endl;
    141  
    142136  vx = 0.0;
    143137  vy = 0.0;
    144  
    145138  numberOfParticles = fInputArray->GetEntriesFast();
    146   nch = 0;
    147   sumpt2 = 0.0;
    148    
    149139  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    150140  {
     
    153143    z = candidate->Position.Z();
    154144    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);
    167147    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
    176150  if(numberOfParticles > 0)
    177151  {
    178     vx /= sumpt2;
    179     vy /= sumpt2;
    180   }
    181  
    182   nvtx++;
     152    vx /= numberOfParticles;
     153    vy /= numberOfParticles;
     154  }
     155
    183156  factory = GetFactory();
    184157
    185158  vertex = factory->NewCandidate();
    186159  vertex->Position.SetXYZT(vx, vy, dz, dt);
    187   vertex->ClusterIndex = nvtx;
    188   vertex->ClusterNDF = nch;
    189   vertex->SumPT2 = sumpt2;
    190   vertex->GenSumPT2 = sumpt2;
    191  
    192160  fVertexOutputArray->Add(vertex);
    193161
     
    202170      numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1);
    203171      break;
    204     case 2:
    205       numberOfEvents = fMeanPileUp;
    206       break;   
    207172    default:
    208173      numberOfEvents = gRandom->Poisson(fMeanPileUp);
     
    233198    vx = 0.0;
    234199    vy = 0.0;
    235    
    236200    numberOfParticles = 0;
    237     sumpt2 = 0.0;
    238    
    239201    while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e))
    240202    {
     
    262224      vx += candidate->Position.X();
    263225      vy += candidate->Position.Y();
    264      
    265226      ++numberOfParticles;
    266       if(TMath::Abs(candidate->Charge) >  1.0E-9)
    267       {
    268         nch++;   
    269         sumpt2 += pt*pt;
    270       }
    271        
     227
    272228      fParticleOutputArray->Add(candidate);
    273229    }
     
    278234      vy /= numberOfParticles;
    279235    }
    280    
    281     nvtx++;
    282236
    283237    vertex = factory->NewCandidate();
    284238    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    
    291239    vertex->IsPU = 1;
    292240
    293241    fVertexOutputArray->Add(vertex);
    294    
    295   }
    296 }
    297 
    298 //------------------------------------------------------------------------------
     242  }
     243}
     244
     245//------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.