.. _program_listing_file_xAODAnaHelpers_L1JetContainer.h: Program Listing for File L1JetContainer.h ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``xAODAnaHelpers/L1JetContainer.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef xAODAnaHelpers_L1JetContainer_H #define xAODAnaHelpers_L1JetContainer_H #include #include #include #include #include #include #include #include #include #include #include #include namespace xAH { class L1JetContainer : public ParticleContainer { public: L1JetContainer(const std::string& name = "L1Jet", float units = 1e3, bool mc = false); virtual ~L1JetContainer(); virtual void setTree (TTree *tree); virtual void setBranches(TTree *tree); virtual void clear(); virtual void FillLegacyL1Jets( const xAOD::JetRoIContainer* jets, bool sort); virtual void updateParticle(uint idx, Jet& jet); // access to et, eta and phi is the same for all the Phase1 L1 jet collections template void FillPhase1L1Jets(T*& jets, bool sort){ if(!sort) { for( auto jet_itr : *jets ) { m_l1Jet_et->push_back ( static_cast(jet_itr->et()) / m_units ); m_l1Jet_eta->push_back( jet_itr->eta() ); m_l1Jet_phi->push_back( jet_itr->phi() ); } } else { std::vector< std::vector > vec; for( auto jet_itr : *jets ) { std::vector row; row.clear(); row.push_back ( static_cast(jet_itr->et()) / m_units ); row.push_back(jet_itr->eta()); row.push_back(jet_itr->phi()); vec.push_back(row); } std::sort(vec.begin(), vec.end(), [&](const std::vector a, const std::vector b) { return a.at(0) < b.at(0);}); for (int i = int(vec.size())-1; i >= 0; i--) { m_l1Jet_et->push_back((vec.at(i)).at(0) / m_units); m_l1Jet_eta->push_back((vec.at(i)).at(1)); m_l1Jet_phi->push_back((vec.at(i)).at(2)); } vec.clear(); } } private: // Vector branches std::vector* m_l1Jet_et; std::vector* m_l1Jet_eta; std::vector* m_l1Jet_phi; }; } #endif // xAODAnaHelpers_L1JetContainer_H