Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/TreeWriter.cc

    r341014c r84a097e  
    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  {
     
    358360    entry->Yd = candidate->Yd;
    359361    entry->Zd = candidate->Zd;
     362    entry->Td = candidate->Td*1.0E-3/c_light;
     363
     364    if(candidate->ClusterIndex != -1)
     365    {
     366      entry->TOFreco = 1E-3*(candidate->Position.T() - candidate->InitialPosition.T())/c_light;
     367    }
     368    else
     369    {
     370      entry->TOFreco =-1E6;
     371    }
    360372
    361373    const TLorentzVector &momentum = candidate->Momentum;
     
    378390
    379391    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
     392    entry->TOFgen  = 1E-3*particle->L/(c_light*particle->Momentum.P()/particle->Momentum.E());
     393   
    380394    const TLorentzVector &initialPosition = particle->Position;
    381395
     
    439453//------------------------------------------------------------------------------
    440454
     455void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array)
     456{
     457
     458  TIter iterator(array);
     459  Candidate *candidate = 0;
     460  Candidate *particle = 0;
     461  ParticleFlowCandidate *entry = 0;
     462  Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi;
     463  const Double_t c_light = 2.99792458E8;
     464
     465  // loop over all tracks
     466  iterator.Reset();
     467  while((candidate = static_cast<Candidate *>(iterator.Next())))
     468  {
     469    const TLorentzVector &position = candidate->Position;
     470
     471    cosTheta = TMath::Abs(position.CosTheta());
     472    signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
     473    eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
     474    rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
     475
     476    entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry());
     477
     478    entry->SetBit(kIsReferenced);
     479    entry->SetUniqueID(candidate->GetUniqueID());
     480
     481    entry->PID = candidate->PID;
     482
     483    entry->Charge = candidate->Charge;
     484
     485    entry->EtaOuter = eta;
     486    entry->PhiOuter = position.Phi();
     487
     488    entry->XOuter = position.X();
     489    entry->YOuter = position.Y();
     490    entry->ZOuter = position.Z();
     491    entry->TOuter = position.T() * 1.0E-3 / c_light;
     492
     493    entry->L = candidate->L;
     494
     495    entry->D0 = candidate->D0;
     496    entry->ErrorD0 = candidate->ErrorD0;
     497    entry->DZ = candidate->DZ;
     498    entry->ErrorDZ = candidate->ErrorDZ;
     499
     500    entry->ErrorP = candidate->ErrorP;
     501    entry->ErrorPT = candidate->ErrorPT;
     502    entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
     503    entry->ErrorPhi = candidate->ErrorPhi;
     504
     505    entry->Xd = candidate->Xd;
     506    entry->Yd = candidate->Yd;
     507    entry->Zd = candidate->Zd;
     508
     509    const TLorentzVector &momentum = candidate->Momentum;
     510
     511    e = momentum.E();
     512    pt = momentum.Pt();
     513    p = momentum.P();
     514    phi = momentum.Phi();
     515    ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
     516
     517    entry->E = e;
     518    entry->P = p;
     519    entry->PT = pt;
     520    entry->Eta = eta;
     521    entry->Phi = phi;
     522    entry->CtgTheta = ctgTheta;
     523
     524    particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
     525    const TLorentzVector &initialPosition = particle->Position;
     526
     527    entry->X = initialPosition.X();
     528    entry->Y = initialPosition.Y();
     529    entry->Z = initialPosition.Z();
     530    entry->T = initialPosition.T() * 1.0E-3 / c_light;
     531
     532    entry->VertexIndex = candidate->ClusterIndex;
     533
     534    entry->Eem = candidate->Eem;
     535    entry->Ehad = candidate->Ehad;
     536    entry->Edges[0] = candidate->Edges[0];
     537    entry->Edges[1] = candidate->Edges[1];
     538    entry->Edges[2] = candidate->Edges[2];
     539    entry->Edges[3] = candidate->Edges[3];
     540
     541    entry->T = position.T() * 1.0E-3 / c_light;
     542    entry->NTimeHits = candidate->NTimeHits;
     543
     544    FillParticles(candidate, &entry->Particles);
     545
     546  }
     547}
     548
     549//------------------------------------------------------------------------------
     550
    441551void TreeWriter::ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array)
    442552{
     
    677787    entry->NCharged = candidate->NCharged;
    678788    entry->NNeutrals = candidate->NNeutrals;
     789
     790    entry->NeutralEnergyFraction = candidate->NeutralEnergyFraction;
     791    entry->ChargedEnergyFraction = candidate->ChargedEnergyFraction;
    679792    entry->Beta = candidate->Beta;
    680793    entry->BetaStar = candidate->BetaStar;
Note: See TracChangeset for help on using the changeset viewer.