Fork me on GitHub

Changeset 4d7014e in git for modules


Ignore:
Timestamp:
Sep 23, 2019, 12:10:46 PM (5 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, master
Children:
ededa33
Parents:
9160765
Message:

added PFcandidate class

Location:
modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/TreeWriter.cc

    r9160765 r4d7014e  
    7272  fClassMap[Track::Class()] = &TreeWriter::ProcessTracks;
    7373  fClassMap[Tower::Class()] = &TreeWriter::ProcessTowers;
     74  fClassMap[ParticleFlowCandidate::Class()] = &TreeWriter::ProcessParticleFlowCandidates;
    7475  fClassMap[Photon::Class()] = &TreeWriter::ProcessPhotons;
    7576  fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons;
     
    137138  it1.Reset();
    138139  array->Clear();
     140 
    139141  while((candidate = static_cast<Candidate *>(it1.Next())))
    140142  {
     
    439441//------------------------------------------------------------------------------
    440442
     443void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array)
     444{
     445
     446  TIter iterator(array);
     447  Candidate *candidate = 0;
     448  Candidate *particle = 0;
     449  ParticleFlowCandidate *entry = 0;
     450  Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi;
     451  const Double_t c_light = 2.99792458E8;
     452
     453  // loop over all tracks
     454  iterator.Reset();
     455  while((candidate = static_cast<Candidate *>(iterator.Next())))
     456  {
     457    const TLorentzVector &position = candidate->Position;
     458
     459    cosTheta = TMath::Abs(position.CosTheta());
     460    signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
     461    eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
     462    rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
     463
     464    entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry());
     465
     466    entry->SetBit(kIsReferenced);
     467    entry->SetUniqueID(candidate->GetUniqueID());
     468
     469    entry->PID = candidate->PID;
     470
     471    entry->Charge = candidate->Charge;
     472
     473    entry->EtaOuter = eta;
     474    entry->PhiOuter = position.Phi();
     475
     476    entry->XOuter = position.X();
     477    entry->YOuter = position.Y();
     478    entry->ZOuter = position.Z();
     479    entry->TOuter = position.T() * 1.0E-3 / c_light;
     480
     481    entry->L = candidate->L;
     482
     483    entry->D0 = candidate->D0;
     484    entry->ErrorD0 = candidate->ErrorD0;
     485    entry->DZ = candidate->DZ;
     486    entry->ErrorDZ = candidate->ErrorDZ;
     487
     488    entry->ErrorP = candidate->ErrorP;
     489    entry->ErrorPT = candidate->ErrorPT;
     490    entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
     491    entry->ErrorPhi = candidate->ErrorPhi;
     492
     493    entry->Xd = candidate->Xd;
     494    entry->Yd = candidate->Yd;
     495    entry->Zd = candidate->Zd;
     496
     497    const TLorentzVector &momentum = candidate->Momentum;
     498
     499    e = momentum.E();
     500    pt = momentum.Pt();
     501    p = momentum.P();
     502    phi = momentum.Phi();
     503    ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
     504
     505    entry->E = e;
     506    entry->P = p;
     507    entry->PT = pt;
     508    entry->Eta = eta;
     509    entry->Phi = phi;
     510    entry->CtgTheta = ctgTheta;
     511
     512    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
     513    const TLorentzVector &initialPosition = particle->Position;
     514
     515    entry->X = initialPosition.X();
     516    entry->Y = initialPosition.Y();
     517    entry->Z = initialPosition.Z();
     518    entry->T = initialPosition.T() * 1.0E-3 / c_light;
     519
     520    entry->VertexIndex = candidate->ClusterIndex;
     521
     522    entry->Eem = candidate->Eem;
     523    entry->Ehad = candidate->Ehad;
     524    entry->Edges[0] = candidate->Edges[0];
     525    entry->Edges[1] = candidate->Edges[1];
     526    entry->Edges[2] = candidate->Edges[2];
     527    entry->Edges[3] = candidate->Edges[3];
     528
     529    entry->T = position.T() * 1.0E-3 / c_light;
     530    entry->NTimeHits = candidate->NTimeHits;
     531
     532    FillParticles(candidate, &entry->Particles);
     533
     534  }
     535}
     536
     537//------------------------------------------------------------------------------
     538
    441539void TreeWriter::ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array)
    442540{
  • modules/TreeWriter.h

    r9160765 r4d7014e  
    5656  void ProcessTracks(ExRootTreeBranch *branch, TObjArray *array);
    5757  void ProcessTowers(ExRootTreeBranch *branch, TObjArray *array);
     58  void ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array);
    5859  void ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array);
    5960  void ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array);
     
    7778#endif
    7879
    79   ClassDef(TreeWriter, 1)
     80  ClassDef(TreeWriter, 2)
    8081};
    8182
Note: See TracChangeset for help on using the changeset viewer.