#include <L1TowerJet.h>
Public Types | |
enum | tJetShape { square, circle } |
Public Member Functions | |
void | addConstituent (const L1CaloTowerRef &Tower) |
const int & | AsymEta () const |
const int & | AsymPhi () const |
void | calculateWeightedEta () |
void | calculateWeightedPhi () |
void | CalcWeightediEta () |
void | CalcWeightediPhi () |
const bool & | central () const |
const int & | E () const |
double | EcalMAD () const |
double | EnergyMAD () const |
L1CaloTowerRefVector::iterator | getConstituent (const int &eta, const int &phi) |
const L1CaloTowerRefVector & | getConstituents () const |
double | HcalMAD () const |
const int & | iEta () const |
const int & | iPhi () const |
const double & | iWeightedEta () const |
const double & | iWeightedPhi () const |
const int & | JetArea () const |
const L1TowerJet::tJetShape & | JetShape () const |
const int & | JetSize () const |
L1TowerJet (const int &aJetSize, const L1TowerJet::tJetShape &aJetShapeType, const int &aJetArea, const int &iEta, const int &iPhi) | |
L1TowerJet (const int &aJetSize, const L1TowerJet::tJetShape &aJetShapeType, const int &aJetArea) | |
L1TowerJet () | |
const math::PtEtaPhiMLorentzVector & | p4 () const |
void | removeConstituent (const int &eta, const int &phi) |
void | setCentral (const bool &) |
void | setP4 (const math::PtEtaPhiMLorentzVector &p4) |
const double & | WeightedEta () const |
const double & | WeightedPhi () const |
~L1TowerJet () | |
Private Member Functions | |
double | MAD (std::deque< int > &aDataSet) const |
Private Attributes | |
int | mAsymEta |
int | mAsymPhi |
bool | mCentral |
L1CaloTowerRefVector | mConstituents |
int | mE |
int | mIeta |
int | mIphi |
int | mJetArea |
L1TowerJet::tJetShape | mJetShapeType |
int | mJetSize |
math::PtEtaPhiMLorentzVector | mP4 |
double | mWeightedEta |
double | mWeightedIeta |
double | mWeightedIphi |
double | mWeightedPhi |
Definition at line 16 of file L1TowerJet.h.
l1slhc::L1TowerJet::L1TowerJet | ( | ) |
Definition at line 7 of file L1TowerJet.cc.
: mIeta( 0 ), mIphi( 0 ), mE( 0 ), mCentral( true ), mAsymEta(0), mAsymPhi(0), mWeightedIeta( 0 ), mWeightedIphi( 0 ), mJetSize( 12 ), mJetShapeType( square ), mJetArea( 144 ) { }
l1slhc::L1TowerJet::L1TowerJet | ( | const int & | aJetSize, |
const L1TowerJet::tJetShape & | aJetShapeType, | ||
const int & | aJetArea | ||
) |
Definition at line 23 of file L1TowerJet.cc.
: mIeta( 0 ), mIphi( 0 ), mE( 0 ), mCentral( true ), mAsymEta(0), mAsymPhi(0), mWeightedIeta( 0 ), mWeightedIphi( 0 ), mJetSize( aJetSize ), mJetShapeType( aJetShapeType ), mJetArea( aJetArea ) { }
l1slhc::L1TowerJet::L1TowerJet | ( | const int & | aJetSize, |
const L1TowerJet::tJetShape & | aJetShapeType, | ||
const int & | aJetArea, | ||
const int & | iEta, | ||
const int & | iPhi | ||
) |
Definition at line 40 of file L1TowerJet.cc.
: mIeta( iEta ), mIphi( iPhi ), mE( 0 ), mCentral( true ), mAsymEta(0), mAsymPhi(0), mWeightedIeta( 0 ), mWeightedIphi( 0 ), mJetSize( aJetSize ), mJetShapeType( aJetShapeType ), mJetArea( aJetArea ) { }
l1slhc::L1TowerJet::~L1TowerJet | ( | ) |
Definition at line 58 of file L1TowerJet.cc.
{ }
void l1slhc::L1TowerJet::addConstituent | ( | const L1CaloTowerRef & | Tower | ) |
Definition at line 433 of file L1TowerJet.cc.
References abs, iEta(), iPhi(), mAsymEta, mAsymPhi, mConstituents, mE, and mJetSize.
{ int lHalfJetSizeEta( mJetSize >> 1 ); int lHalfJetSizePhi( mJetSize >> 1 ); int lTowerEnergy( Tower->E( ) + Tower->H( ) ); //slightly different sizes for HF jets if( abs( iEta() ) > 28 ){ lHalfJetSizeEta =1; //ie mJetSize/4 as in HF jets 2 in eta } //if iPhi at the edge of the calo wrap round in phi int ToweriPhi = Tower->iPhi( ); if(iPhi() > (72 - mJetSize)) { if(ToweriPhi>=1 && ToweriPhi<mJetSize) ToweriPhi+=72; } mE += lTowerEnergy; mConstituents.push_back( Tower ); /* if( (Tower->iPhi())<4){ std::cout<<"JET: ("<<iEta()<<","<<iPhi()<<")"<<std::endl; std::cout<<"TOWER = ( " <<Tower->iEta()<< " , " <<Tower->iPhi()<<" ), energy = " <<Tower->E()+Tower->H()<<std::endl; }*/ //when add a tower, also add the asymmetry terms //positive asym: top RH corner of jet if( mJetSize % 2 == 0 ){ //even jet size //if(Tower->iEta( ) == iEta() ) mAsymEta += 0; //do nothing if( Tower->iEta( ) >= (iEta() + lHalfJetSizeEta) ) { mAsymEta += lTowerEnergy; } else{ /*if( Tower->iEta( ) < iEta() + lHalfJetSize )*/ mAsymEta -= lTowerEnergy; } //if( Tower->iPhi( ) == iPhi() ) mAsymEta += 0; //do nothing if( ToweriPhi < (iPhi() + lHalfJetSizePhi) ){ mAsymPhi += lTowerEnergy; } else{ /*if( Tower->iPhi( ) > iPhi() + lHalfJetSize )*/ mAsymPhi -= lTowerEnergy; } }else{ //odd jet size: miss out central towers if( Tower->iEta( ) == (lHalfJetSizeEta + iEta()) ) { mAsymEta += 0; //do nothing } else if( Tower->iEta( ) > (iEta() + lHalfJetSizeEta) ) { mAsymEta += lTowerEnergy; }else /*if( Tower->iEta( ) < iEta() + lHalfJetSize )*/ { mAsymEta -= lTowerEnergy; } // else it is in the middle so does not contribute to the asymmetry if( ToweriPhi == (lHalfJetSizePhi + iPhi()) ) { mAsymPhi += 0; //do nothing } else if( ToweriPhi < (iPhi() + lHalfJetSizePhi) ) { mAsymPhi += lTowerEnergy; }else /*if( Tower->iPhi( ) > iPhi() + lHalfJetSize )*/ { mAsymPhi -= lTowerEnergy; } // else it is in the middle so does not contribute to the asymmetry } }
const int & l1slhc::L1TowerJet::AsymEta | ( | ) | const |
Definition at line 131 of file L1TowerJet.cc.
References mAsymEta.
Referenced by operator>().
{ return mAsymEta; }
const int & l1slhc::L1TowerJet::AsymPhi | ( | ) | const |
Definition at line 136 of file L1TowerJet.cc.
References mAsymPhi.
Referenced by operator>().
{ return mAsymPhi; }
void l1slhc::L1TowerJet::calculateWeightedEta | ( | ) |
Definition at line 277 of file L1TowerJet.cc.
References i, mConstituents, mJetSize, and mWeightedEta.
{ const double endcapEta[8] = { 0.09, 0.1, 0.113, 0.129, 0.15, 0.178, 0.15, 0.35 }; double etaSumEt(0); double sumEt(0); double tmpEta(9999); double abs_eta(9999); for (L1CaloTowerRefVector::const_iterator lConstituentIt = mConstituents.begin() ; lConstituentIt != mConstituents.end(); ++lConstituentIt ) { abs_eta = fabs((**lConstituentIt).iEta()); if (abs_eta < 21) tmpEta = (0.087*abs_eta - 0.0435); else { abs_eta -= 21; tmpEta = 1.74; for (int i=0; i!=int(abs_eta); ++i) tmpEta += endcapEta[i]; if (mJetSize % 2 == 0) tmpEta += endcapEta[int(abs_eta)] / 2.; else tmpEta += endcapEta[int(abs_eta)]; } if ((**lConstituentIt).iEta()<0) tmpEta = (-1)*tmpEta; etaSumEt += ( (**lConstituentIt).E() + (**lConstituentIt).H() ) * ( tmpEta ); sumEt += ( (**lConstituentIt).E() + (**lConstituentIt).H() ) ; } mWeightedEta = etaSumEt/sumEt ; }
void l1slhc::L1TowerJet::calculateWeightedPhi | ( | ) |
Definition at line 375 of file L1TowerJet.cc.
References mWeightedIphi, mWeightedPhi, pi, and WeightedPhi().
{ // double JetSize = double(mJetSize) / 2.0; double WeightedPhi = ( ( mWeightedIphi-0.5 ) * 0.087 ); //Need this because 72*0.087 != 2pi: else get uneven phi dist double pi=(72*0.087)/2; if(WeightedPhi > pi) WeightedPhi -=2*pi; mWeightedPhi=WeightedPhi; // std::cout<<"weighted IPhi: "<<mWeightedIphi<<" weighted phi: "<<WeightedPhi<<std::endl; }
void l1slhc::L1TowerJet::CalcWeightediEta | ( | ) |
Definition at line 243 of file L1TowerJet.cc.
References mConstituents, and mWeightedIeta.
{ double etaSumEt(0); double sumEt (0); for ( L1CaloTowerRefVector::const_iterator lConstituentIt = mConstituents.begin() ; lConstituentIt != mConstituents.end(); ++lConstituentIt ){ etaSumEt += ( (**lConstituentIt).E() + (**lConstituentIt).H() ) * ( (**lConstituentIt).iEta() ); sumEt += ( (**lConstituentIt).E() + (**lConstituentIt).H() ) ; } // std::cout<<" eta* energy = "<<etaSumEt<<" sum energy: "<<sumEt<<std::endl; //discretize weighted Ieta: run from |1-28| (no HF) mWeightedIeta = etaSumEt/sumEt ; //discrete-ize and account for the fact there is no zero int discrete_iEta(999); //add 0.5 so that we get rounding up as well as down if( mWeightedIeta>=0 ) discrete_iEta=int(mWeightedIeta+0.5); else discrete_iEta=int(mWeightedIeta-0.5); //account for the fact there is no 0 if(mWeightedIeta>=0 && mWeightedIeta<1) discrete_iEta=1; if(mWeightedIeta<0 && mWeightedIeta>(-1)) discrete_iEta=-1; //std::cout<<"weighted ieta: "<<mWeightedIeta <<" discrete ieta: "<< discrete_iEta<<std::endl; mWeightedIeta = double(discrete_iEta); }
void l1slhc::L1TowerJet::CalcWeightediPhi | ( | ) |
Definition at line 349 of file L1TowerJet.cc.
References iPhi(), JetSize(), mConstituents, and mWeightedIphi.
{ double phiSumEt(0); double sumEt (0); for ( L1CaloTowerRefVector::const_iterator lConstituentIt = mConstituents.begin() ; lConstituentIt != mConstituents.end(); ++lConstituentIt ){ double tower_iPhi =(**lConstituentIt).iPhi(); if( iPhi() >= (72-JetSize()) ) { //constituents may go over edge, iPhi>66 for 8x8 jet if( tower_iPhi < (72 - JetSize()) ){//if constituent tower is over edge, ie. iPhi>1 tower_iPhi+=72; //iPhi=1 -> iPhi=73 } } //calculate weighted phi using corrected iPhi value phiSumEt += ( (**lConstituentIt).E() + (**lConstituentIt).H() ) * (tower_iPhi ); sumEt += ( (**lConstituentIt).E() + (**lConstituentIt).H() ) ; } // std::cout<<"phi sum et: "<<phiSumEt<<"sum Et: "<<sumEt<<std::endl; mWeightedIphi = phiSumEt/sumEt ; // take weighted Iphi back to 1-72 range if(mWeightedIphi>72) mWeightedIphi-=72; }
const bool & l1slhc::L1TowerJet::central | ( | ) | const |
Definition at line 142 of file L1TowerJet.cc.
References mCentral.
Referenced by setCentral().
{ return mCentral; }
const int & l1slhc::L1TowerJet::E | ( | ) | const |
Definition at line 126 of file L1TowerJet.cc.
References mE.
Referenced by L1TowerFwdJetProducer::calculateFwdJetPosition(), L1TowerJetProducer::calculateJetPosition(), std::operator<(), and operator>().
{ return mE; }
double l1slhc::L1TowerJet::EcalMAD | ( | ) | const |
Definition at line 220 of file L1TowerJet.cc.
References MAD(), mConstituents, and mJetArea.
{ std::deque< int > lEnergy; for ( L1CaloTowerRefVector::const_iterator lConstituentIt = mConstituents.begin() ; lConstituentIt != mConstituents.end(); ++lConstituentIt ){ lEnergy.push_back( (**lConstituentIt).E() ); } lEnergy.resize( mJetArea , 0 ); return MAD( lEnergy ); }
double l1slhc::L1TowerJet::EnergyMAD | ( | ) | const |
Definition at line 391 of file L1TowerJet.cc.
References MAD(), mConstituents, and mJetArea.
{ std::deque< int > lEnergy; for ( L1CaloTowerRefVector::const_iterator lConstituentIt = mConstituents.begin() ; lConstituentIt != mConstituents.end(); ++lConstituentIt ){ lEnergy.push_back( (**lConstituentIt).E() + (**lConstituentIt).H() ); } lEnergy.resize( mJetArea , 0 ); return MAD( lEnergy ); }
L1CaloTowerRefVector::iterator l1slhc::L1TowerJet::getConstituent | ( | const int & | eta, |
const int & | phi | ||
) |
Definition at line 590 of file L1TowerJet.cc.
References mConstituents, mIeta, and mIphi.
Referenced by removeConstituent().
{ for ( L1CaloTowerRefVector::iterator lConstituentIt = mConstituents.begin() ; lConstituentIt != mConstituents.end(); ++lConstituentIt ) if ( (**lConstituentIt).iEta( ) == eta + mIeta && (**lConstituentIt).iPhi( ) == phi + mIphi ) return lConstituentIt; return mConstituents.end(); }
const L1CaloTowerRefVector & l1slhc::L1TowerJet::getConstituents | ( | ) | const |
Definition at line 477 of file VirtualJetProducer.cc.
References i, getHLTprescales::index, VirtualJetProducer::inputs_, and query::result.
Referenced by operator<<().
{ vector<reco::CandidatePtr> result; for (unsigned int i=0;i<fjConstituents.size();i++) { int index = fjConstituents[i].user_index(); if ( index >= 0 && static_cast<unsigned int>(index) < inputs_.size() ) { reco::CandidatePtr candidate = inputs_[index]; result.push_back(candidate); } } return result; }
double l1slhc::L1TowerJet::HcalMAD | ( | ) | const |
Definition at line 231 of file L1TowerJet.cc.
References MAD(), mConstituents, and mJetArea.
{ std::deque< int > lEnergy; for ( L1CaloTowerRefVector::const_iterator lConstituentIt = mConstituents.begin() ; lConstituentIt != mConstituents.end(); ++lConstituentIt ){ lEnergy.push_back( (**lConstituentIt).H() ); } lEnergy.resize( mJetArea , 0 ); return MAD( lEnergy ); }
const int & l1slhc::L1TowerJet::iEta | ( | ) | const |
Definition at line 82 of file L1TowerJet.cc.
References mIeta.
Referenced by addConstituent(), L1TowerFwdJetProducer::calculateFwdJetPosition(), L1TowerJetProducer::calculateJetPosition(), std::operator<(), operator<<(), and removeConstituent().
{ return mIeta; }
const int & l1slhc::L1TowerJet::iPhi | ( | ) | const |
Definition at line 87 of file L1TowerJet.cc.
References mIphi.
Referenced by addConstituent(), L1TowerFwdJetProducer::calculateFwdJetPosition(), L1TowerJetProducer::calculateJetPosition(), CalcWeightediPhi(), operator<<(), and removeConstituent().
{ return mIphi; }
const double & l1slhc::L1TowerJet::iWeightedEta | ( | ) | const |
const double & l1slhc::L1TowerJet::iWeightedPhi | ( | ) | const |
const int & l1slhc::L1TowerJet::JetArea | ( | ) | const |
const L1TowerJet::tJetShape & l1slhc::L1TowerJet::JetShape | ( | ) | const |
const int & l1slhc::L1TowerJet::JetSize | ( | ) | const |
Definition at line 152 of file L1TowerJet.cc.
References mJetSize.
Referenced by L1TowerFwdJetProducer::calculateFwdJetPosition(), L1TowerJetProducer::calculateJetPosition(), and CalcWeightediPhi().
{ return mJetSize; }
double l1slhc::L1TowerJet::MAD | ( | std::deque< int > & | aDataSet | ) | const [private] |
Definition at line 403 of file L1TowerJet.cc.
References python::multivaluedict::sort().
Referenced by EcalMAD(), EnergyMAD(), and HcalMAD().
{ std::sort( aDataSet.begin() , aDataSet.end() ); std::size_t lDataSetSize( aDataSet.size() ); double lMedian(0); if( lDataSetSize%2 == 0 ){ lMedian = double ( aDataSet[ (lDataSetSize/2) - 1 ] + aDataSet[ lDataSetSize/2 ] ) / 2.0 ; }else{ lMedian = double( aDataSet[ (lDataSetSize-1)/2 ] ); } std::deque< double > lMedianSubtractedDataSet; for ( std::deque< int >::const_iterator lIt = aDataSet.begin() ; lIt != aDataSet.end(); ++lIt ){ lMedianSubtractedDataSet.push_back( fabs( double(*lIt) - lMedian ) ); } std::sort( lMedianSubtractedDataSet.begin() , lMedianSubtractedDataSet.end() ); if( lDataSetSize%2 == 0 ){ return double ( lMedianSubtractedDataSet[ (lDataSetSize/2) - 1 ] + lMedianSubtractedDataSet[ lDataSetSize/2 ] ) / 2.0 ; }else{ return double( lMedianSubtractedDataSet[ (lDataSetSize-1)/2 ] ); } }
const math::PtEtaPhiMLorentzVector & l1slhc::L1TowerJet::p4 | ( | ) | const |
Definition at line 147 of file L1TowerJet.cc.
References mP4.
Referenced by setP4().
{ return mP4; }
void l1slhc::L1TowerJet::removeConstituent | ( | const int & | eta, |
const int & | phi | ||
) |
Definition at line 515 of file L1TowerJet.cc.
References abs, getConstituent(), iEta(), iPhi(), mAsymEta, mAsymPhi, mConstituents, mE, mJetSize, and phi.
{ L1CaloTowerRefVector::iterator lConstituent = getConstituent( eta, phi ); if ( lConstituent != mConstituents.end() ) { int lHalfJetSizeEta( mJetSize >> 1 ); int lHalfJetSizePhi( mJetSize >> 1 ); int lTowerEnergy( (**lConstituent).E( ) + (**lConstituent).H( ) ); mE -= lTowerEnergy; mConstituents.erase( lConstituent ); if( abs( iEta() ) > 28 ){ lHalfJetSizeEta =1; //ie mJetSize/4 as in HF jets 2 in eta } int ToweriPhi = phi; //if iPhi at the edge of the calo wrap round in phi if(iPhi() > (72 - mJetSize)) { if(ToweriPhi>=1 && ToweriPhi < mJetSize) ToweriPhi+=72; } if( mJetSize % 2 == 0 ){ //even jet size if( eta >= (iEta() + lHalfJetSizeEta) ) { mAsymEta -= lTowerEnergy; } else{ /*if( Tower->iEta( ) < iEta() + lHalfJetSize )*/ mAsymEta += lTowerEnergy; } if( ToweriPhi < (iPhi() + lHalfJetSizePhi) ){ mAsymPhi -= lTowerEnergy; }else{ /*if( Tower->iPhi( ) > iPhi() + lHalfJetSize )*/ mAsymPhi += lTowerEnergy; } }else{ //odd jet size: miss out central towers if( eta == (lHalfJetSizeEta + iEta()) ) { mAsymEta += 0; //do nothing } else if( eta > (iEta() + lHalfJetSizeEta) ) { mAsymEta -= lTowerEnergy; }else /*if( Tower->iEta( ) < iEta() + lHalfJetSize )*/ { mAsymEta += lTowerEnergy; } if( ToweriPhi == (lHalfJetSizePhi + iPhi()) ) { mAsymEta -= 0; //do nothing } else if( ToweriPhi < (iPhi() + lHalfJetSizePhi) ) { mAsymPhi -= lTowerEnergy; }else /*if( Tower->iPhi( ) > iPhi() + lHalfJetSize )*/ { mAsymPhi += lTowerEnergy; } } } }
void l1slhc::L1TowerJet::setCentral | ( | const bool & | central | ) |
void l1slhc::L1TowerJet::setP4 | ( | const math::PtEtaPhiMLorentzVector & | p4 | ) |
Definition at line 65 of file L1TowerJet.cc.
Referenced by L1TowerFwdJetProducer::calculateFwdJetPosition(), L1TowerJetProducer::calculateJetPosition(), L1CalibFilterTowerJetProducer::produce(), and L1TowerJetPUSubtractedProducer::produce().
const double & l1slhc::L1TowerJet::WeightedEta | ( | ) | const |
const double & l1slhc::L1TowerJet::WeightedPhi | ( | ) | const |
Definition at line 116 of file L1TowerJet.cc.
References mWeightedPhi.
Referenced by calculateWeightedPhi().
{ return mWeightedPhi; }
int l1slhc::L1TowerJet::mAsymEta [private] |
Definition at line 96 of file L1TowerJet.h.
Referenced by addConstituent(), AsymEta(), and removeConstituent().
int l1slhc::L1TowerJet::mAsymPhi [private] |
Definition at line 97 of file L1TowerJet.h.
Referenced by addConstituent(), AsymPhi(), and removeConstituent().
bool l1slhc::L1TowerJet::mCentral [private] |
Definition at line 93 of file L1TowerJet.h.
Referenced by central(), and setCentral().
Definition at line 111 of file L1TowerJet.h.
Referenced by addConstituent(), calculateWeightedEta(), CalcWeightediEta(), CalcWeightediPhi(), EcalMAD(), EnergyMAD(), getConstituent(), HcalMAD(), and removeConstituent().
int l1slhc::L1TowerJet::mE [private] |
Definition at line 92 of file L1TowerJet.h.
Referenced by addConstituent(), E(), and removeConstituent().
int l1slhc::L1TowerJet::mIeta [private] |
Definition at line 90 of file L1TowerJet.h.
Referenced by getConstituent(), and iEta().
int l1slhc::L1TowerJet::mIphi [private] |
Definition at line 91 of file L1TowerJet.h.
Referenced by getConstituent(), and iPhi().
int l1slhc::L1TowerJet::mJetArea [private] |
Definition at line 108 of file L1TowerJet.h.
Referenced by EcalMAD(), EnergyMAD(), HcalMAD(), and JetArea().
Definition at line 107 of file L1TowerJet.h.
Referenced by JetShape().
int l1slhc::L1TowerJet::mJetSize [private] |
Definition at line 106 of file L1TowerJet.h.
Referenced by addConstituent(), calculateWeightedEta(), JetSize(), and removeConstituent().
Definition at line 112 of file L1TowerJet.h.
double l1slhc::L1TowerJet::mWeightedEta [private] |
Definition at line 102 of file L1TowerJet.h.
Referenced by calculateWeightedEta(), and WeightedEta().
double l1slhc::L1TowerJet::mWeightedIeta [private] |
Definition at line 100 of file L1TowerJet.h.
Referenced by CalcWeightediEta(), and iWeightedEta().
double l1slhc::L1TowerJet::mWeightedIphi [private] |
Definition at line 101 of file L1TowerJet.h.
Referenced by calculateWeightedPhi(), CalcWeightediPhi(), and iWeightedPhi().
double l1slhc::L1TowerJet::mWeightedPhi [private] |
Definition at line 103 of file L1TowerJet.h.
Referenced by calculateWeightedPhi(), and WeightedPhi().