diff --git a/[refs] b/[refs] index 04fc68e4664bf..ac959eff0c839 100644 --- a/[refs] +++ b/[refs] @@ -2,4 +2,4 @@ "refs/heads/hi_d20131223": d7335b053d7fe03e98f9f59af6a20004362628e8 refs/heads/gh-pages: a3d9046c56a3ca3dc64ad63f7295276c81ac876a "refs/heads/analysis_53X_01": 3019419e9784b2b092fc6b5c503b2e0177cbe926 -"refs/heads/CMSSW_7_0_X": 12b62293edbfaf76c8834be0b49f7acc2af313d4 +"refs/heads/CMSSW_7_0_X": e3ccbef71c13a71b9b111bc87f24793e7d519b7b diff --git a/trunk/SLHCUpgradeSimulations/L1CaloTrigger/plugins/L1TowerJetProducer.cc b/trunk/SLHCUpgradeSimulations/L1CaloTrigger/plugins/L1TowerJetProducer.cc index 6c970d7ecc217..2364914a90ad2 100644 --- a/trunk/SLHCUpgradeSimulations/L1CaloTrigger/plugins/L1TowerJetProducer.cc +++ b/trunk/SLHCUpgradeSimulations/L1CaloTrigger/plugins/L1TowerJetProducer.cc @@ -103,101 +103,90 @@ L1TowerJetProducer::~L1TowerJetProducer( ) void L1TowerJetProducer::algorithm( const int &aEta, const int &aPhi ) { - - int lTowerIndex = mCaloTriggerSetup->getBin( aEta, aPhi ); - std::pair < int, int > lTowerEtaPhi = mCaloTriggerSetup->getTowerEtaPhi( lTowerIndex ); - - - l1slhc::L1TowerJet lJet( mJetDiameter, mJetShape , mJetShapeMap.size() , lTowerEtaPhi.first , lTowerEtaPhi.second ); - - for ( std::vector< std::pair< int , int > >::const_iterator lJetShapeMapIt = mJetShapeMap.begin() ; lJetShapeMapIt != mJetShapeMap.end() ; ++lJetShapeMapIt ) - { - int lPhi = aPhi+(lJetShapeMapIt->second); - if ( lPhi > mCaloTriggerSetup->phiMax( ) ) lPhi -= 72; //mCaloTriggerSetup->phiMax( ); - - l1slhc::L1CaloTowerCollection::const_iterator lTowerItr = fetch( aEta+(lJetShapeMapIt->first) , lPhi ); - if ( lTowerItr != mInputCollection->end( ) ) - { - l1slhc::L1CaloTowerRef lRef( mInputCollection, lTowerItr - mInputCollection->begin( ) ); - lJet.addConstituent( lRef ); - } - } - - if ( lJet.E( ) > 0 ) - { - calculateJetPosition( lJet ); - mOutputCollection->insert( lTowerEtaPhi.first, lTowerEtaPhi.second, lJet ); - //std::cout << "towerjet " << lJet.p4( ) << std::endl; - } + int lTowerIndex = mCaloTriggerSetup->getBin( aEta, aPhi ); + std::pair < int, int > lTowerEtaPhi = mCaloTriggerSetup->getTowerEtaPhi( lTowerIndex ); + + l1slhc::L1TowerJet lJet( mJetDiameter, mJetShape , mJetShapeMap.size() , lTowerEtaPhi.first , lTowerEtaPhi.second ); + + for ( std::vector< std::pair< int , int > >::const_iterator lJetShapeMapIt = mJetShapeMap.begin() ; lJetShapeMapIt != mJetShapeMap.end() ; ++lJetShapeMapIt ) + { + int lPhi = aPhi+(lJetShapeMapIt->second); + if ( lPhi > mCaloTriggerSetup->phiMax( ) ) lPhi -= 72; //mCaloTriggerSetup->phiMax( ); + + l1slhc::L1CaloTowerCollection::const_iterator lTowerItr = fetch( aEta+(lJetShapeMapIt->first) , lPhi ); + + if ( lTowerItr != mInputCollection->end( ) ) + { + l1slhc::L1CaloTowerRef lRef( mInputCollection, lTowerItr - mInputCollection->begin( ) ); + lJet.addConstituent( lRef ); + } + } + + if ( lJet.E( ) > 0 ) + { + calculateJetPosition( lJet ); + mOutputCollection->insert( lTowerEtaPhi.first, lTowerEtaPhi.second, lJet ); + + } } - - -// This function needs validating!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! void L1TowerJetProducer::calculateJetPosition( l1slhc::L1TowerJet & lJet ) { - double eta; - double halfTowerOffset = 0.0435; + double eta; + double halfTowerOffset = 0.0435; - double JetSize = double(lJet.JetSize()) / 2.0; + double JetSize = double(lJet.JetSize()) / 2.0; - int abs_eta = abs( lJet.iEta( ) + int(JetSize) ); + int abs_eta =lJet.iEta( ) + int(JetSize); + if ( abs_eta < 21 ) + { - if ( abs_eta < 21 ) - { -// eta = ( abs_eta * 0.0870 ) - halfTowerOffset; -// if( lJet.JetSize() % 2 == 1 ){ -// eta += halfTowerOffset; -// } + eta = ( abs_eta * 0.0870 ); + + if( lJet.JetSize() % 2 == 1 ){ + eta += halfTowerOffset; + } - eta = ( abs_eta * 0.0870 ); - if( lJet.JetSize() % 2 == 0 ){ - eta -= halfTowerOffset; - } + } + else + { + const double endcapEta[8] = { 0.09, 0.1, 0.113, 0.129, 0.15, 0.178, 0.15, 0.35 }; + abs_eta -= 21; - } - else - { - const double endcapEta[8] = { 0.09, 0.1, 0.113, 0.129, 0.15, 0.178, 0.15, 0.35 }; - abs_eta -= 21; - - eta = 1.74; - -// for ( int i = 0; i <= abs_eta; ++i ) -// { -// eta += endcapEta[i]; -// } -// eta -= endcapEta[abs_eta] / 2.; -// if( lJet.JetSize() % 2 == 1 ){ -// eta += endcapEta[i] / 2.; -// } - - for ( int i = 0; i != abs_eta; ++i ) - { - eta += endcapEta[i]; - } + eta = 1.74; - if( lJet.JetSize() % 2 == 0 ){ - eta += endcapEta[abs_eta] / 2.; - }else{ - eta += endcapEta[abs_eta]; - } + for ( int i = 0; i != abs_eta; ++i ) + { + eta += endcapEta[i]; + } + if( lJet.JetSize() % 2 == 0 ){ + eta += endcapEta[abs_eta] / 2.; + }else{ + eta += endcapEta[abs_eta]; + } - } + } - if ( lJet.iEta( ) < -JetSize ) - eta = -eta; + if (lJet.iEta()>0) eta-=0.087; - double phi = ( ( lJet.iPhi( ) + JetSize ) * 0.087 ) - halfTowerOffset; - double Et = double( lJet.E( ) ) / 2.; - lJet.setP4( math::PtEtaPhiMLorentzVector( Et, eta, phi, 0. ) ); -} + double phi = ( ( lJet.iPhi( ) + JetSize ) * 0.087 ); + //Need this because 72*0.087 != 2pi: else get uneven phi dist + phi -= 0.087; + double pi=(72*0.087)/2; + if(phi>pi) phi-=2*pi; + + double Et = double( lJet.E( ) ) / 2.; + + lJet.setP4( math::PtEtaPhiMLorentzVector( Et, eta, phi, 0. ) ); + +} +