Go to the documentation of this file.00001 #include "SimDataFormats/SLHC/interface/L1CaloJet.h"
00002 #include <stdlib.h>
00003
00004 namespace l1slhc
00005 {
00006
00007 L1CaloJet::L1CaloJet( ):
00008 mIeta( 0 ),
00009 mIphi( 0 ),
00010 mE( 0 ),
00011 mCentral( true )
00012 {
00013 }
00014
00015
00016
00017 L1CaloJet::L1CaloJet( const int &iEta, const int &iPhi ):
00018 mIeta( iEta ),
00019 mIphi( iPhi ),
00020 mE( 0 ),
00021 mCentral( true )
00022 {
00023 }
00024
00025 L1CaloJet::~L1CaloJet( )
00026 {
00027
00028
00029 }
00030
00031 void L1CaloJet::setP4( const math::PtEtaPhiMLorentzVector & p4 )
00032 {
00033 mP4 = p4;
00034 }
00035
00036 void L1CaloJet::setCentral( const bool & central )
00037 {
00038 mCentral = central;
00039 }
00040
00041
00042 const int &L1CaloJet::iEta( ) const
00043 {
00044 return mIeta;
00045 }
00046
00047
00048 const int &L1CaloJet::iPhi( ) const
00049 {
00050 return mIphi;
00051 }
00052
00053
00054 const int &L1CaloJet::E( ) const
00055 {
00056 return mE;
00057 }
00058
00059 const bool & L1CaloJet::central( ) const
00060 {
00061 return mCentral;
00062 }
00063
00064
00065
00066 void L1CaloJet::setE( const int &E )
00067 {
00068 mE = E;
00069 }
00070
00071 const math::PtEtaPhiMLorentzVector & L1CaloJet::p4( ) const
00072 {
00073 return mP4;
00074 }
00075
00076
00077 void L1CaloJet::addConstituent( const L1CaloRegionRef & region )
00078 {
00079 mE += region->E( );
00080 mConstituents.push_back( region );
00081 }
00082
00083 const L1CaloRegionRefVector & L1CaloJet::getConstituents( ) const
00084 {
00085 return mConstituents;
00086 }
00087
00088 int L1CaloJet::hasConstituent( const int &eta, const int &phi )
00089 {
00090 int pos = -1;
00091 for ( unsigned int i = 0; i < mConstituents.size( ); ++i )
00092 {
00093 L1CaloRegionRef tower = mConstituents.at( i );
00094 if ( tower->iEta( ) == eta + mIeta && tower->iPhi( ) == phi + mIphi )
00095 {
00096 pos = i;
00097 break;
00098 }
00099 }
00100
00101 return pos;
00102 }
00103
00104 void L1CaloJet::removeConstituent( const int &eta, const int &phi )
00105 {
00106 int pos = hasConstituent( eta, phi );
00107 if ( pos != -1 )
00108 {
00109 mE = mE - mConstituents.at( pos )->E( );
00110 mConstituents.erase( mConstituents.begin( ) + pos );
00111 }
00112 }
00113 }
00114
00115
00116
00117
00118 namespace std
00119 {
00120 bool operator<( const l1slhc::L1CaloJet & aLeft, const l1slhc::L1CaloJet & aRight )
00121 {
00122 if ( aLeft.E( ) == aRight.E( ) )
00123 {
00124
00125 return ( abs( aLeft.iEta( ) ) > abs( aRight.iEta( ) ) );
00126 }
00127 else
00128 {
00129 return ( aLeft.E( ) < aRight.E( ) );
00130 }
00131 }
00132 }
00133
00134
00135
00136 std::ostream & operator<<( std::ostream & aStream, const l1slhc::L1CaloJet & aL1CaloJet )
00137 {
00138 aStream << "L1CaloJet"
00139 << " iEta=" << aL1CaloJet.iEta( )
00140 << " iPhi=" << aL1CaloJet.iPhi( )
00141 << "\n with constituents:\n";
00142 for ( l1slhc::L1CaloRegionRefVector::const_iterator i = aL1CaloJet.getConstituents( ).begin( ); i < aL1CaloJet.getConstituents( ).end( ); ++i )
00143 aStream << " iEta=" << ( **i ).iEta( )
00144 << " iPhi=" << ( **i ).iPhi( )
00145 << " ET=" << ( **i ).E( )
00146 << "\n";
00147 return aStream;
00148 }