Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/Example3.C

    rfc4e460 rf2d7d0c  
    11/*
    2 
    3 This macro shows how to access the particle-level reference for reconstructed objects.
    4 It is also shown how to loop over the jet constituents.
    5 
    62root -l examples/Example3.C\(\"delphes_output.root\"\)
    73*/
     
    4036
    4137  plots->fElectronDeltaPT = result->AddHist1D(
    42     "electron_delta_pt", "(p_{T}^{particle} - p_{T}^{electron})/p_{T}^{particle}",
     38    "electron delta pt", "(p_{T}^{particle} - p_{T}^{electron})/p_{T}^{particle}",
    4339    "(p_{T}^{particle} - p_{T}^{electron})/p_{T}^{particle}", "number of electrons",
    4440    100, -0.1, 0.1);
    4541
    4642  plots->fElectronDeltaEta = result->AddHist1D(
    47     "electron_delta_eta", "(#eta^{particle} - #eta^{electron})/#eta^{particle}",
     43    "electron delta eta", "(#eta^{particle} - #eta^{electron})/#eta^{particle}",
    4844    "(#eta^{particle} - #eta^{electron})/#eta^{particle}", "number of electrons",
    4945    100, -0.1, 0.1);
    5046
    5147  plots->fPhotonDeltaPT = result->AddHist1D(
    52     "photon_delta_pt", "(p_{T}^{particle} - p_{T}^{photon})/p_{T}^{particle}",
     48    "photon delta pt", "(p_{T}^{particle} - p_{T}^{photon})/p_{T}^{particle}",
    5349    "(p_{T}^{particle} - p_{T}^{photon})/p_{T}^{particle}", "number of photons",
    5450    100, -0.1, 0.1);
    5551
    5652  plots->fPhotonDeltaEta = result->AddHist1D(
    57     "photon_delta_eta", "(#eta^{particle} - #eta^{photon})/#eta^{particle}",
     53    "photon delta eta", "(#eta^{particle} - #eta^{photon})/#eta^{particle}",
    5854    "(#eta^{particle} - #eta^{photon})/#eta^{particle}", "number of photons",
    5955    100, -0.1, 0.1);
    6056
    6157  plots->fPhotonDeltaE = result->AddHist1D(
    62     "photon_delta_energy", "(E^{particle} - E^{photon})/E^{particle}",
     58    "photon delta energy", "(E^{particle} - E^{photon})/E^{particle}",
    6359    "(E^{particle} - E^{photon})/E^{particle}", "number of photons",
    6460    100, -0.1, 0.1);
    6561
    6662  plots->fMuonDeltaPT = result->AddHist1D(
    67     "muon_delta_pt", "(p_{T}^{particle} - p_{T}^{muon})/p_{T}^{particle}",
     63    "muon delta pt", "(p_{T}^{particle} - p_{T}^{muon})/p_{T}^{particle}",
    6864    "(p_{T}^{particle} - p_{T}^{muon})/p_{T}^{particle}", "number of muons",
    6965    100, -0.1, 0.1);
    7066
    7167  plots->fMuonDeltaEta = result->AddHist1D(
    72     "muon_delta_eta", "(#eta^{particle} - #eta^{muon})/#eta^{particle}",
     68    "muon delta eta", "(#eta^{particle} - #eta^{muon})/#eta^{particle}",
    7369    "(#eta^{particle} - #eta^{muon})/#eta^{particle}", "number of muons",
    7470    100, -0.1, 0.1);
    7571
    7672  plots->fTrackDeltaPT = result->AddHist1D(
    77     "track_delta_pt", "(p_{T}^{particle} - p_{T}^{track})/p_{T}^{particle}",
     73    "track delta pt", "(p_{T}^{particle} - p_{T}^{track})/p_{T}^{particle}",
    7874    "(p_{T}^{particle} - p_{T}^{track})/p_{T}^{particle}", "number of tracks",
    7975    100, -0.1, 0.1);
    8076
    8177  plots->fTrackDeltaEta = result->AddHist1D(
    82     "track_delta_eta", "(#eta^{particle} - #eta^{track})/#eta^{particle}",
     78    "track delta eta", "(#eta^{particle} - #eta^{track})/#eta^{particle}",
    8379    "(#eta^{particle} - #eta^{track})/#eta^{particle}", "number of tracks",
    8480    100, -0.1, 0.1);
    8581
    8682  plots->fJetDeltaPT = result->AddHist1D(
    87     "jet_delta_pt", "(p_{T}^{jet} - p_{T}^{constituents})/p_{T}^{jet}",
     83    "jet delta pt", "(p_{T}^{jet} - p_{T}^{constituents})/p_{T}^{jet}",
    8884    "(p_{T}^{jet} - p_{T}^{constituents})/p_{T}^{jet}", "number of jets",
    8985    100, -1.0e-1, 1.0e-1);
     
    183179    }
    184180
    185   //  cout<<"--  New event -- "<<endl;
     181    cout<<"--  New event -- "<<endl;
    186182
    187183    // Loop over all jets in event
     
    192188      momentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
    193189
    194       //cout<<"Looping over jet constituents. Jet pt: "<<jet->PT<<", eta: "<<jet->Eta<<", phi: "<<jet->Phi<<endl;     
     190      cout<<"Looping over jet constituents. Jet pt: "<<jet->PT<<", eta: "<<jet->Eta<<", phi: "<<jet->Phi<<endl;     
    195191
    196192      // Loop over all jet's constituents
     
    205201        {
    206202          particle = (GenParticle*) object;
    207           //cout << "    GenPart pt: " << particle->PT << ", eta: " << particle->Eta << ", phi: " << particle->Phi << endl;
     203          cout << "    GenPart pt: " << particle->PT << ", eta: " << particle->Eta << ", phi: " << particle->Phi << endl;
    208204          momentum += particle->P4();
    209205        }
     
    211207        {
    212208          track = (Track*) object;
    213           //cout << "    Track pt: " << track->PT << ", eta: " << track->Eta << ", phi: " << track->Phi << endl;
     209          cout << "    Track pt: " << track->PT << ", eta: " << track->Eta << ", phi: " << track->Phi << endl;
    214210          momentum += track->P4();
    215211        }
     
    217213        {
    218214          tower = (Tower*) object;
    219           //cout << "    Tower pt: " << tower->ET << ", eta: " << tower->Eta << ", phi: " << tower->Phi << endl;
     215          cout << "    Tower pt: " << tower->ET << ", eta: " << tower->Eta << ", phi: " << tower->Phi << endl;
    220216          momentum += tower->P4();
     217        }
     218        else if(object->IsA() == Muon::Class())
     219        {
     220          muon = (Muon*) object;
     221          cout << "    Muon pt: " << muon->PT << ", eta: " << muon->Eta << ", phi: " << muon->Phi << endl;
     222          momentum += muon->P4();
    221223        }
    222224      }
Note: See TracChangeset for help on using the changeset viewer.