Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:12:29

0001 // -*- C++ -*-
0002 //
0003 // Package:    L1TBMTFConverter
0004 // Class:      L1TBMTFConverter
0005 //
0006 /**\class L1TBMTFConverter L1TBMTFConverter.cc L1Trigger/L1TGlobalMuon/plugins/L1TBMTFConverter.cc
0007 
0008  Description: Takes txt-file input and produces barrel- / overlap- / forward TF muons
0009 
0010  Implementation:
0011      [Notes on implementation]
0012 */
0013 //
0014 // Original Author:  Joschka Philip Lingemann,40 3-B01,+41227671598,
0015 //         Created:  Thu Oct  3 10:12:30 CEST 2013
0016 // $Id$
0017 //
0018 //
0019 
0020 // system include files
0021 #include <memory>
0022 #include <fstream>
0023 
0024 // user include files
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/stream/EDProducer.h"
0027 
0028 #include "FWCore/Framework/interface/Event.h"
0029 #include "FWCore/Framework/interface/MakerMacros.h"
0030 
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032 #include "FWCore/Utilities/interface/Exception.h"
0033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0034 
0035 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0036 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0037 
0038 #include <iostream>
0039 //
0040 // class declaration
0041 //
0042 using namespace l1t;
0043 
0044 class L1TBMTFConverter : public edm::stream::EDProducer<> {
0045 public:
0046   explicit L1TBMTFConverter(const edm::ParameterSet&);
0047   ~L1TBMTFConverter() override;
0048 
0049   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0050 
0051 private:
0052   void produce(edm::Event&, const edm::EventSetup&) override;
0053 
0054   void beginRun(const edm::Run&, edm::EventSetup const&) override;
0055   void endRun(const edm::Run&, edm::EventSetup const&) override;
0056   void beginLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override;
0057   void endLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override;
0058   // ----------member data ---------------------------
0059   edm::EDGetTokenT<RegionalMuonCandBxCollection> m_barrelTfInputToken;
0060   edm::InputTag m_barrelTfInputTag;
0061   std::map<int, int> ptMap_;
0062 };
0063 
0064 //
0065 // constants, enums and typedefs
0066 //
0067 
0068 //
0069 // static data member definitions
0070 //
0071 
0072 //
0073 // constructors and destructor
0074 //
0075 L1TBMTFConverter::L1TBMTFConverter(const edm::ParameterSet& iConfig) {
0076   m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
0077   m_barrelTfInputToken = consumes<RegionalMuonCandBxCollection>(m_barrelTfInputTag);
0078   //register your products
0079   produces<RegionalMuonCandBxCollection>("ConvBMTFMuons");
0080   ptMap_[0] = 0;
0081   ptMap_[1] = 0;
0082   ptMap_[2] = 3;
0083   ptMap_[3] = 4;
0084   ptMap_[4] = 5;
0085   ptMap_[5] = 6;
0086   ptMap_[6] = 7;
0087   ptMap_[7] = 8;
0088   ptMap_[8] = 9;
0089   ptMap_[9] = 10;
0090   ptMap_[10] = 12;
0091   ptMap_[11] = 14;
0092   ptMap_[12] = 16;
0093   ptMap_[13] = 20;
0094   ptMap_[14] = 24;
0095   ptMap_[15] = 28;
0096   ptMap_[16] = 32;
0097   ptMap_[17] = 36;
0098   ptMap_[18] = 40;
0099   ptMap_[19] = 50;
0100   ptMap_[20] = 60;
0101   ptMap_[21] = 70;
0102   ptMap_[22] = 80;
0103   ptMap_[23] = 90;
0104   ptMap_[24] = 100;
0105   ptMap_[25] = 120;
0106   ptMap_[26] = 140;
0107   ptMap_[27] = 160;
0108   ptMap_[28] = 180;
0109   ptMap_[29] = 200;
0110   ptMap_[30] = 240;
0111   ptMap_[31] = 280;
0112 }
0113 
0114 L1TBMTFConverter::~L1TBMTFConverter() {
0115   // do anything here that needs to be done at desctruction time
0116   // (e.g. close files, deallocate resources etc.)
0117 }
0118 
0119 //
0120 // member functions
0121 //
0122 
0123 // ------------ method called to produce the data  ------------
0124 void L1TBMTFConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0125   using namespace edm;
0126 
0127   std::unique_ptr<RegionalMuonCandBxCollection> convMuons(new RegionalMuonCandBxCollection());
0128 
0129   Handle<RegionalMuonCandBxCollection> bmtfMuons;
0130   iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
0131   for (auto mu = bmtfMuons->begin(0); mu != bmtfMuons->end(0); ++mu) {
0132     RegionalMuonCand convMu((*mu));
0133     // int convPt = ptMap_.at(mu->hwPt());
0134     // int convPhi = (mu->hwPhi() * 4) - (mu->processor() * 48);
0135     // int convEta = getSigned(mu->hwEta())*3.54;
0136     int convEta = (mu->hwEta() - 32) * 3.54;
0137     // convMu.setHwPt(convPt);
0138     // convMu.setHwPhi(convPhi);
0139     convMu.setHwEta(convEta);
0140     // convMu.setTFIdentifiers(mu->processor()+1, mu->trackFinderType());
0141     convMuons->push_back(0, convMu);
0142   }
0143 
0144   iEvent.put(std::move(convMuons), "ConvBMTFMuons");
0145 }
0146 
0147 // ------------ method called when starting to processes a run  ------------
0148 void L1TBMTFConverter::beginRun(const edm::Run&, edm::EventSetup const&) {}
0149 
0150 // ------------ method called when ending the processing of a run  ------------
0151 void L1TBMTFConverter::endRun(const edm::Run&, edm::EventSetup const&) {}
0152 
0153 // ------------ method called when starting to processes a luminosity block  ------------
0154 void L1TBMTFConverter::beginLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) {}
0155 
0156 // ------------ method called when ending the processing of a luminosity block  ------------
0157 void L1TBMTFConverter::endLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) {}
0158 
0159 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
0160 void L1TBMTFConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0161   //The following says we do not know what parameters are allowed so do no validation
0162   // Please change this to state exactly what you do use, even if it is no parameters
0163   edm::ParameterSetDescription desc;
0164   desc.setUnknown();
0165   descriptions.addDefault(desc);
0166 }
0167 
0168 //define this as a plug-in
0169 DEFINE_FWK_MODULE(L1TBMTFConverter);