Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <memory>
00011 #include "FWCore/Framework/interface/Frameworkfwd.h"
00012 #include "FWCore/Framework/interface/EDProducer.h"
00013 #include "FWCore/Framework/interface/Event.h"
00014 #include "FWCore/Framework/interface/MakerMacros.h"
00015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00018
00019 #include "TLorentzVector.h"
00020 #include "DataFormats/VertexReco/interface/Vertex.h"
00021 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00022 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
00023 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
00024 #include "DataFormats/L1Trigger/interface/L1EtMissParticle.h"
00025 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
00026 #include "SimDataFormats/SLHC/interface/L1TowerJet.h"
00027 #include "SimDataFormats/SLHC/interface/L1TowerJetFwd.h"
00028 #include "FWCore/Framework/interface/LuminosityBlock.h"
00029 #include <iostream>
00030 #include <fstream>
00031
00032
00033
00034
00035
00036
00037 using namespace l1slhc;
00038 using namespace edm;
00039 using namespace std;
00040 using namespace reco;
00041 using namespace l1extra;
00042
00043
00044 class L1TowerJetPUSubtractedProducer : public edm::EDProducer {
00045 public:
00046 explicit L1TowerJetPUSubtractedProducer(const edm::ParameterSet&);
00047 ~L1TowerJetPUSubtractedProducer();
00048
00049 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
00050
00051 private:
00052 virtual void beginJob() ;
00053 virtual void produce(edm::Event&, const edm::EventSetup&);
00054 virtual void endJob() ;
00055
00056 virtual void beginRun(edm::Run&, edm::EventSetup const&);
00057 virtual void endRun(edm::Run&, edm::EventSetup const&);
00058 virtual void beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
00059 virtual void endLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
00060
00061
00062
00063
00064 ParameterSet conf_;
00065 };
00066
00067 L1TowerJetPUSubtractedProducer::L1TowerJetPUSubtractedProducer(const edm::ParameterSet& iConfig):
00068 conf_(iConfig)
00069 {
00070 produces<L1TowerJetCollection>("PUSubCenJets");
00071 produces< L1JetParticleCollection >( "PUSubCen8x8" ) ;
00072 }
00073
00074
00075 L1TowerJetPUSubtractedProducer::~L1TowerJetPUSubtractedProducer()
00076 {
00077 }
00078
00079
00080
00081
00082
00083 void
00084 L1TowerJetPUSubtractedProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00085 {
00086
00087 bool evValid =true;
00088 auto_ptr< L1TowerJetCollection > outputCollCen(new L1TowerJetCollection());
00089 produces<L1TowerJetCollection>("CalibFwdJets");
00090 auto_ptr< L1JetParticleCollection > outputExtraCen(new L1JetParticleCollection());
00091
00092
00093 edm::Handle< double > calRho;
00094 iEvent.getByLabel(conf_.getParameter<edm::InputTag>("CalibratedL1Rho"), calRho);
00095 if(!calRho.isValid()){
00096 evValid=false;
00097 edm::LogWarning("MissingProduct") << conf_.getParameter<edm::InputTag>("CalibratedL1Rho") << std::endl;
00098 }
00099
00100 edm::Handle<L1TowerJetCollection > UnCalibCen;
00101 iEvent.getByLabel(conf_.getParameter<edm::InputTag>("FilteredCircle8"), UnCalibCen);
00102 if(!UnCalibCen.isValid()){
00103 edm::LogWarning("MissingProduct") << conf_.getParameter<edm::InputTag>("FilteredCircle8") << std::endl;
00104 evValid=false;
00105 }
00106
00107 if( evValid ) {
00108
00109
00110
00111 double cal_rhoL1 = *calRho;
00112
00114
00116
00117 math::PtEtaPhiMLorentzVector upgrade_jet;
00118
00119
00120 for (L1TowerJetCollection::const_iterator il1 = UnCalibCen->begin();
00121 il1!= UnCalibCen->end() ;
00122 ++il1 ){
00123
00124 L1TowerJet h=(*il1);
00125
00126
00127
00128 float l1Pt_ = il1->p4().Pt();
00129
00130
00131
00132 float l1wEta_ = il1->WeightedEta();
00133 float l1wPhi_ = il1->WeightedPhi() ;
00134
00135
00136
00137 double areaPerJet = 52 * (0.087 * 0.087) ;
00138
00139 float l1Pt_PUsub_ = l1Pt_ - (cal_rhoL1 * areaPerJet);
00140
00141
00142 if(l1Pt_PUsub_>0.1){
00143
00144 math::PtEtaPhiMLorentzVector p4;
00145
00146
00147 p4.SetCoordinates(l1Pt_PUsub_ , l1wEta_ , l1wPhi_ , il1->p4().M() );
00148
00149 h.setP4(p4);
00150 outputCollCen->insert( l1wEta_ , l1wPhi_ , h );
00151 upgrade_jet.SetCoordinates( l1Pt_PUsub_ , l1wEta_ , l1wPhi_ , il1->p4().M() );
00152
00153
00154 outputExtraCen->push_back( L1JetParticle( math::PtEtaPhiMLorentzVector(
00155 l1Pt_PUsub_,
00156 l1wEta_,
00157 l1wPhi_,
00158 0. ),
00159 Ref< L1GctJetCandCollection >(), 0 )
00160 );
00161 }
00162 }
00163 }
00164
00165
00166 iEvent.put(outputCollCen,"PUSubCenJets");
00167
00168 iEvent.put(outputExtraCen,"PUSubCen8x8");
00169
00170 }
00171
00172
00173
00174 void
00175 L1TowerJetPUSubtractedProducer::beginJob()
00176 {
00177
00178 }
00179
00180
00181 void
00182 L1TowerJetPUSubtractedProducer::endJob() {
00183 }
00184
00185
00186 void
00187 L1TowerJetPUSubtractedProducer::beginRun(edm::Run&, edm::EventSetup const&)
00188 {
00189
00190 }
00191
00192
00193 void
00194 L1TowerJetPUSubtractedProducer::endRun(edm::Run&, edm::EventSetup const&)
00195 {
00196 }
00197
00198
00199 void
00200 L1TowerJetPUSubtractedProducer::beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&)
00201 {
00202 }
00203
00204
00205 void
00206 L1TowerJetPUSubtractedProducer::endLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&)
00207 {
00208 }
00209
00210
00211 void
00212 L1TowerJetPUSubtractedProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00213
00214
00215 edm::ParameterSetDescription desc;
00216 desc.setUnknown();
00217 descriptions.addDefault(desc);
00218 }
00219
00220
00221
00222
00223
00224
00225 DEFINE_FWK_MODULE(L1TowerJetPUSubtractedProducer);