Fork me on GitHub

Changeset 8f7db23 in git for modules/TreeWriter.cc


Ignore:
Timestamp:
Apr 8, 2014, 6:43:52 PM (10 years ago)
Author:
pavel <pavel@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
b67be31
Parents:
5b822e5
Message:

add HectorHit class and corresponding ROOT tree branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/TreeWriter.cc

    r5b822e5 r8f7db23  
    6767  fClassMap[Rho::Class()] = &TreeWriter::ProcessRho;
    6868  fClassMap[Weight::Class()] = &TreeWriter::ProcessWeight;
     69  fClassMap[HectorHit::Class()] = &TreeWriter::ProcessHectorHit;
    6970
    7071  TBranchMap::iterator itBranchMap;
     
    9596      continue;
    9697    }
    97    
     98
    9899    itClassMap = fClassMap.find(branchClass);
    99100    if(itClassMap == fClassMap.end())
     
    160161  GenParticle *entry = 0;
    161162  Double_t pt, signPz, cosTheta, eta, rapidity;
    162  
    163   const Double_t c_light = 2.99792458E8;
    164  
     163
     164  const Double_t c_light = 2.99792458E8;
     165
    165166  // loop over all particles
    166167  iterator.Reset();
     
    220221  Candidate *candidate = 0;
    221222  Vertex *entry = 0;
    222  
     223
    223224  const Double_t c_light = 2.99792458E8;
    224225
     
    248249  Double_t pt, signz, cosTheta, eta, rapidity;
    249250  const Double_t c_light = 2.99792458E8;
    250  
     251
    251252  // loop over all tracks
    252253  iterator.Reset();
     
    310311  Double_t pt, signPz, cosTheta, eta, rapidity;
    311312  const Double_t c_light = 2.99792458E8;
    312  
     313
    313314  // loop over all towers
    314315  iterator.Reset();
     
    317318    const TLorentzVector &momentum = candidate->Momentum;
    318319    const TLorentzVector &position = candidate->Position;
    319    
     320
    320321    pt = momentum.Pt();
    321322    cosTheta = TMath::Abs(momentum.CosTheta());
     
    339340    entry->Edges[2] = candidate->Edges[2];
    340341    entry->Edges[3] = candidate->Edges[3];
    341    
     342
    342343    entry->T = position.T()*1.0E-3/c_light;
    343    
     344
    344345    FillParticles(candidate, &entry->Particles);
    345346  }
     
    355356  Double_t pt, signPz, cosTheta, eta, rapidity;
    356357  const Double_t c_light = 2.99792458E8;
    357  
     358
    358359  array->Sort();
    359360
     
    365366    const TLorentzVector &momentum = candidate->Momentum;
    366367    const TLorentzVector &position = candidate->Position;
    367    
     368
    368369
    369370    pt = momentum.Pt();
     
    379380    entry->PT = pt;
    380381    entry->E = momentum.E();
    381    
     382
    382383    entry->T = position.T()*1.0E-3/c_light;
    383    
     384
    384385    entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad/candidate->Eem : 999.9;
    385386
     
    397398  Double_t pt, signPz, cosTheta, eta, rapidity;
    398399  const Double_t c_light = 2.99792458E8;
    399  
     400
    400401  array->Sort();
    401402
     
    406407    const TLorentzVector &momentum = candidate->Momentum;
    407408    const TLorentzVector &position = candidate->Position;
    408    
     409
    409410    pt = momentum.Pt();
    410411    cosTheta = TMath::Abs(momentum.CosTheta());
     
    418419    entry->Phi = momentum.Phi();
    419420    entry->PT = pt;
    420    
     421
    421422    entry->T = position.T()*1.0E-3/c_light;
    422    
     423
    423424    entry->Charge = candidate->Charge;
    424425
     
    437438  Muon *entry = 0;
    438439  Double_t pt, signPz, cosTheta, eta, rapidity;
    439  
    440   const Double_t c_light = 2.99792458E8;
    441  
     440
     441  const Double_t c_light = 2.99792458E8;
     442
    442443  array->Sort();
    443444
     
    448449    const TLorentzVector &momentum = candidate->Momentum;
    449450    const TLorentzVector &position = candidate->Position;
    450    
     451
    451452
    452453    pt = momentum.Pt();
     
    466467
    467468    entry->T = position.T()*1.0E-3/c_light;
    468    
     469
    469470   // cout<<entry->PT<<","<<entry->T<<endl;
    470471
     
    485486  Double_t ecalEnergy, hcalEnergy;
    486487  const Double_t c_light = 2.99792458E8;
    487  
     488
    488489  array->Sort();
    489490
     
    493494  {
    494495    TIter itConstituents(candidate->GetCandidates());
    495    
    496     const TLorentzVector &momentum = candidate->Momentum;
    497     const TLorentzVector &position = candidate->Position;
    498    
     496
     497    const TLorentzVector &momentum = candidate->Momentum;
     498    const TLorentzVector &position = candidate->Position;
     499
    499500    pt = momentum.Pt();
    500501    cosTheta = TMath::Abs(momentum.CosTheta());
     
    510511
    511512    entry->T = position.T()*1.0E-3/c_light;
    512    
     513
    513514    entry->Mass = momentum.M();
    514515
     
    533534
    534535    entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy/ecalEnergy : 999.9;
    535  
     536
    536537    //---   Pile-Up Jet ID variables ----
    537538
     
    632633//------------------------------------------------------------------------------
    633634
     635void TreeWriter::ProcessHectorHit(ExRootTreeBranch *branch, TObjArray *array)
     636{
     637  TIter iterator(array);
     638  Candidate *candidate = 0;
     639  HectorHit *entry = 0;
     640
     641  // loop over all roman pot hits
     642  iterator.Reset();
     643  while((candidate = static_cast<Candidate*>(iterator.Next())))
     644  {
     645    const TLorentzVector &position = candidate->Position;
     646    const TLorentzVector &momentum = candidate->Momentum;
     647
     648    entry = static_cast<HectorHit*>(branch->NewEntry());
     649
     650    entry->E = momentum.E();
     651
     652    entry->Tx = momentum.Px();
     653    entry->Ty = momentum.Py();
     654
     655    entry->T = position.T();
     656
     657    entry->X = position.X();
     658    entry->Y = position.Y();
     659    entry->S = position.Z();
     660  }
     661}
     662
     663//------------------------------------------------------------------------------
     664
    634665void TreeWriter::Process()
    635666{
Note: See TracChangeset for help on using the changeset viewer.