Go to the documentation of this file.00001
00002 #include "SLHCUpgradeSimulations/L1CaloTrigger/interface/L1CaloAlgoBase.h"
00003
00004 #include "SimDataFormats/SLHC/interface/L1CaloJet.h"
00005 #include "SimDataFormats/SLHC/interface/L1CaloJetFwd.h"
00006 #include "SimDataFormats/SLHC/interface/L1CaloRegion.h"
00007 #include "SimDataFormats/SLHC/interface/L1CaloRegionFwd.h"
00008
00009 class L1CaloJetProducer:
00010 public L1CaloAlgoBase < l1slhc::L1CaloRegionCollection, l1slhc::L1CaloJetCollection >
00011 {
00012 public:
00013 L1CaloJetProducer( const edm::ParameterSet & );
00014 ~L1CaloJetProducer( );
00015
00016
00017
00018 void algorithm( const int &, const int & );
00019
00020 private:
00021 void calculateJetPosition( l1slhc::L1CaloJet & lJet );
00022
00023 };
00024
00025 L1CaloJetProducer::L1CaloJetProducer( const edm::ParameterSet & aConfig ):L1CaloAlgoBase < l1slhc::L1CaloRegionCollection, l1slhc::L1CaloJetCollection > ( aConfig )
00026 {
00027 mPhiOffset = -7;
00028 mEtaOffset = -7;
00029 mPhiIncrement = 4;
00030 mEtaIncrement = 4;
00031 }
00032
00033 L1CaloJetProducer::~L1CaloJetProducer( )
00034 {
00035 }
00036
00037
00038
00039
00040
00041 void L1CaloJetProducer::algorithm( const int &aEta, const int &aPhi )
00042 {
00043
00044
00045 int lRegionIndex = mCaloTriggerSetup->getBin( aEta, aPhi );
00046 std::pair < int, int > lRegionEtaPhi = mCaloTriggerSetup->getTowerEtaPhi( lRegionIndex );
00047
00048
00049 l1slhc::L1CaloJet lJet( lRegionEtaPhi.first, lRegionEtaPhi.second );
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 for ( int lRegionEta = 0; lRegionEta != 2; ++lRegionEta )
00061 {
00062 for ( int lRegionPhi = 0; lRegionPhi != 2; ++lRegionPhi )
00063 {
00064 l1slhc::L1CaloRegionCollection::const_iterator lRegionItr = fetch( aEta+(lRegionEta<<2) , aPhi+(lRegionPhi<<2) );
00065 if ( lRegionItr != mInputCollection->end( ) )
00066 {
00067 l1slhc::L1CaloRegionRef lRef( mInputCollection, lRegionItr - mInputCollection->begin( ) );
00068 lJet.addConstituent( lRef );
00069 }
00070 }
00071 }
00072
00073 if ( lJet.E( ) > 0 )
00074 {
00075 calculateJetPosition( lJet );
00076 mOutputCollection->insert( lRegionEtaPhi.first, lRegionEtaPhi.second, lJet );
00077 }
00078
00079 }
00080
00081
00082
00083
00084
00085
00086 void L1CaloJetProducer::calculateJetPosition( l1slhc::L1CaloJet & lJet )
00087 {
00088
00089
00090 double eta = -1982.;
00091 double etaOffset = 0.0435;
00092 int abs_eta = abs( lJet.iEta( ) + 4 );
00093
00094 if ( abs_eta <= 20 )
00095 {
00096 eta = ( abs_eta * 0.0870 ) - etaOffset;
00097 }
00098 else
00099 {
00100 const double endcapEta[8] = { 0.09, 0.1, 0.113, 0.129, 0.15, 0.178, 0.15, 0.35 };
00101
00102 abs_eta -= 21;
00103
00104 eta = 1.74;
00105
00106 for ( int i = 0; i <= abs_eta; ++i )
00107 {
00108 eta += endcapEta[i];
00109 }
00110
00111 eta -= endcapEta[abs_eta] / 2.;
00112 }
00113
00114
00115 if ( lJet.iEta( ) < -4 )
00116 eta = -eta;
00117
00118
00119 double phi = ( lJet.iPhi( ) * 0.087 ) + 0.3045;
00120 double Et = double( lJet.E( ) ) / 2.;
00121
00122 lJet.setP4( math::PtEtaPhiMLorentzVector( Et, eta, phi, 0. ) );
00123 }
00124
00125
00126
00127 DEFINE_EDM_PLUGIN( edm::MakerPluginFactory, edm::WorkerMaker < L1CaloJetProducer >, "L1CaloJetProducer" );
00128 DEFINE_FWK_PSET_DESC_FILLER( L1CaloJetProducer );