Go to the documentation of this file.00001 #include "SLHCUpgradeSimulations/L1CaloTrigger/interface/L1CaloAlgoBase.h"
00002
00003 #include "SimDataFormats/SLHC/interface/L1TowerJet.h"
00004 #include "SimDataFormats/SLHC/interface/L1TowerJetFwd.h"
00005 #include "SimDataFormats/SLHC/interface/L1CaloTower.h"
00006 #include "SimDataFormats/SLHC/interface/L1CaloTowerFwd.h"
00007
00008 #include <algorithm>
00009 #include <string>
00010 #include <vector>
00011
00012
00013 class L1TowerFwdJetProducer:public L1CaloAlgoBase < l1slhc::L1CaloTowerCollection, l1slhc::L1TowerJetCollection >
00014 {
00015 public:
00016 L1TowerFwdJetProducer( const edm::ParameterSet & );
00017 ~L1TowerFwdJetProducer( );
00018
00019
00020
00021 void algorithm( const int &, const int & );
00022
00023 private:
00024 void calculateFwdJetPosition( l1slhc::L1TowerJet & lJet );
00025
00026 int mJetDiameter;
00027 l1slhc::L1TowerJet::tJetShape mJetShape;
00028
00029 std::vector< std::pair< int , int > > mHFJetShapeMap;
00030 };
00031
00032 L1TowerFwdJetProducer::L1TowerFwdJetProducer( const edm::ParameterSet & aConfig ):
00033 L1CaloAlgoBase < l1slhc::L1CaloTowerCollection, l1slhc::L1TowerJetCollection > ( aConfig )
00034
00035 {
00036 mJetDiameter = aConfig.getParameter<unsigned>("JetDiameter");
00037 mPhiOffset = 0;
00038
00039 mEtaOffset = 0;
00040
00041
00042
00043 mHFJetShapeMap.reserve(256);
00044
00045 std::string lJetShape = aConfig.getParameter< std::string >("JetShape");
00046 std::transform( lJetShape.begin() , lJetShape.end() , lJetShape.begin() , ::toupper );
00047
00048 std::cout<<" Creating HF jet map." <<std::endl;
00049
00050 for( int x = 0 ; x != mJetDiameter/4 ; ++x ){
00051 for( int y = 0 ; y != mJetDiameter ; ++y ){
00052 mHFJetShapeMap.push_back( std::make_pair( x , y ) );
00053 }
00054 }
00055
00056
00057 }
00058
00059 L1TowerFwdJetProducer::~L1TowerFwdJetProducer( )
00060 {
00061 }
00062
00063
00064
00065
00066
00067
00068
00069 void L1TowerFwdJetProducer::algorithm( const int &aEta, const int &aPhi )
00070 {
00071
00072 int lTowerIndex = mCaloTriggerSetup->getBin( aEta, aPhi );
00073 std::pair < int, int > lTowerEtaPhi = mCaloTriggerSetup->getTowerEtaPhi( lTowerIndex );
00074
00075 l1slhc::L1TowerJet lJet( mJetDiameter, mJetShape , mHFJetShapeMap.size() , lTowerEtaPhi.first , lTowerEtaPhi.second );
00076
00077
00078 if(aEta>=60 || aEta<4){
00079 for ( std::vector< std::pair< int , int > >::const_iterator lHFJetShapeMapIt = mHFJetShapeMap.begin() ; lHFJetShapeMapIt != mHFJetShapeMap.end() ; ++lHFJetShapeMapIt )
00080 {
00081 int lPhi = aPhi+(lHFJetShapeMapIt->second);
00082 if ( lPhi > mCaloTriggerSetup->phiMax( ) ) lPhi -= 72;
00083 l1slhc::L1CaloTowerCollection::const_iterator lTowerItr = fetch( aEta+(lHFJetShapeMapIt->first) , lPhi );
00084
00085
00086 if ( lTowerItr != mInputCollection->end( ) )
00087 {
00088 l1slhc::L1CaloTowerRef lRef( mInputCollection, lTowerItr - mInputCollection->begin( ) );
00089 lJet.addConstituent( lRef );
00090 }
00091 }
00092 }
00093
00094
00095
00096
00097
00098 if ( lJet.E( ) > 0 )
00099 {
00100 calculateFwdJetPosition( lJet );
00101 mOutputCollection->insert( lTowerEtaPhi.first, lTowerEtaPhi.second, lJet );
00102
00103
00104 }
00105
00106 }
00107
00108
00109
00110 void L1TowerFwdJetProducer::calculateFwdJetPosition( l1slhc::L1TowerJet & lJet )
00111 {
00112
00113 double eta;
00114
00115
00116 double JetSize = double(lJet.JetSize()) / 2.0;
00117
00118 if( abs( lJet.iEta() ) == 29 ) eta = 3.5;
00119 if( abs( lJet.iEta() ) == 30 ) eta = 4.0;
00120 if( abs( lJet.iEta() ) == 31 ) eta = 4.5;
00121 if( abs( lJet.iEta() ) == 32 ) eta = 5.0;
00122
00123 if(lJet.iEta()<0) eta = -eta;
00124
00125 double phi = ( ( lJet.iPhi( ) + JetSize ) * 0.0873 );
00126
00127 phi -= 0.0873;
00128 double pi=(72*0.0873)/2;
00129 if(phi>pi) phi-=2*pi;
00130 double Et = double( lJet.E( ) ) / 2.;
00131
00132 lJet.setP4( math::PtEtaPhiMLorentzVector( Et, eta, phi, 0. ) );
00133
00134 }
00135
00136
00137 DEFINE_EDM_PLUGIN (edm::MakerPluginFactory,edm::WorkerMaker<L1TowerFwdJetProducer>,"L1TowerFwdJetProducer");
00138 DEFINE_FWK_PSET_DESC_FILLER(L1TowerFwdJetProducer);
00139