Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/TreeWriter.cc

    rcc8716b rb750b0a  
    4545#include "TString.h"
    4646
    47 #include <set>
    4847#include <algorithm>
    4948#include <iostream>
     
    7776  fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons;
    7877  fClassMap[Muon::Class()] = &TreeWriter::ProcessMuons;
    79   fClassMap[CscCluster::Class()] = &TreeWriter::ProcessCscCluster;
    8078  fClassMap[Jet::Class()] = &TreeWriter::ProcessJets;
    8179  fClassMap[MissingET::Class()] = &TreeWriter::ProcessMissingET;
     
    151149{
    152150  TIter it1(candidate->GetCandidates());
    153   set<Candidate *> s;
    154   set<Candidate *>::iterator it3;
    155151  it1.Reset();
    156   s.clear();
    157152  array->Clear();
    158153
     
    164159    if(candidate->GetCandidates()->GetEntriesFast() == 0)
    165160    {
    166       s.insert(candidate);
     161      array->Add(candidate);
    167162      continue;
    168163    }
     
    172167    if(candidate->GetCandidates()->GetEntriesFast() == 0)
    173168    {
    174       s.insert(candidate);
     169      array->Add(candidate);
    175170      continue;
    176171    }
     
    180175    while((candidate = static_cast<Candidate *>(it2.Next())))
    181176    {
    182       candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
    183       if(candidate->GetCandidates()->GetEntriesFast() == 0)
    184       {
    185         s.insert(candidate);
    186       }
     177      array->Add(candidate->GetCandidates()->At(0));
    187178    }
    188   }
    189 
    190   for(it3 = s.begin(); it3 != s.end(); ++it3)
    191   {
    192     array->Add(*it3);
    193179  }
    194180}
     
    252238    entry->Z = position.Z();
    253239    entry->T = position.T() * 1.0E-3 / c_light;
    254 
    255240  }
    256241}
     
    399384    entry->Zd = candidate->Zd;
    400385
    401     entry->XFirstHit = candidate->XFirstHit;
    402     entry->YFirstHit = candidate->YFirstHit;
    403     entry->ZFirstHit = candidate->ZFirstHit;
    404 
    405386    const TLorentzVector &momentum = candidate->Momentum;
    406387
     
    563544    entry->Zd = candidate->Zd;
    564545
    565     entry->XFirstHit = candidate->XFirstHit;
    566     entry->YFirstHit = candidate->YFirstHit;
    567     entry->ZFirstHit = candidate->ZFirstHit;
    568 
    569546    const TLorentzVector &momentum = candidate->Momentum;
    570547
     
    909886  }
    910887}
    911 //------------------------------------------------------------------------------
    912 
    913 void TreeWriter::ProcessCscCluster(ExRootTreeBranch *branch, TObjArray *array)
    914 {
    915   TIter iterator(array);
    916   Candidate *candidate = 0;
    917   CscCluster *entry = 0;
    918   Double_t pt, signPz, cosTheta, eta, rapidity;
    919 
    920   const Double_t c_light = 2.99792458E8; // in unit of m/s
    921 
    922   array->Sort();
    923 
    924 
    925   // loop over all clusters
    926   iterator.Reset();
    927   while((candidate = static_cast<Candidate *>(iterator.Next())))
    928   {
    929     const TLorentzVector &momentum = candidate->Momentum;
    930     const TLorentzVector &position = candidate->DecayPosition;
    931 
    932     pt = momentum.Pt();
    933     cosTheta = TMath::Abs(momentum.CosTheta());
    934     signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
    935     eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
    936 
    937     entry = static_cast<CscCluster *>(branch->NewEntry());
    938 
    939     entry->SetBit(kIsReferenced);
    940     entry->SetUniqueID(candidate->GetUniqueID());
    941 
    942     entry->Eta = eta;
    943     entry->Phi = momentum.Phi();
    944 
    945     entry->PT = momentum.Pt(); // pt of LLP
    946     entry->Px = momentum.Px();// px of LLP
    947     entry->Py = momentum.Py();// py of LLP
    948     entry->Pz = momentum.Pz();// pz of LLP
    949     entry->E = momentum.E(); // E of LLP
    950     entry->pid = candidate->PID; // LLP pid
    951     entry->Eem = candidate->Eem; // LLP Eem
    952     entry->Ehad = candidate->Ehad; // LLP Ehad
    953     Double_t beta = momentum.P()/momentum.E();
    954     Double_t gamma = 1.0/sqrt(1-beta*beta);
    955     Double_t decayDistance = sqrt(pow(position.X(),2)+pow(position.Y(),2)+pow(position.Z(),2)); // mm
    956     entry->beta = beta; // LLP pid
    957     entry->ctau = decayDistance/(beta * gamma); // LLP travel time in its rest frame
    958     entry->T = decayDistance*(1./beta-1)* 1.0E-3/c_light*1e9; // ns
    959     entry->X = position.X(); // LLP decay x
    960     entry->Y = position.Y(); //  LLP decay y
    961     entry->Z = position.Z(); //  LLP decay z
    962   }
    963 }
    964888
    965889//------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.