Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:47

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 
0048   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0049 
0050 private:
0051   void produce(edm::Event&, const edm::EventSetup&) override;
0052 
0053   // ----------member data ---------------------------
0054   edm::EDGetTokenT<RegionalMuonCandBxCollection> m_barrelTfInputToken;
0055   edm::InputTag m_barrelTfInputTag;
0056   std::map<int, int> ptMap_;
0057 };
0058 
0059 //
0060 // constants, enums and typedefs
0061 //
0062 
0063 //
0064 // static data member definitions
0065 //
0066 
0067 //
0068 // constructors and destructor
0069 //
0070 L1TBMTFConverter::L1TBMTFConverter(const edm::ParameterSet& iConfig) {
0071   m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
0072   m_barrelTfInputToken = consumes<RegionalMuonCandBxCollection>(m_barrelTfInputTag);
0073   //register your products
0074   produces<RegionalMuonCandBxCollection>("ConvBMTFMuons");
0075   ptMap_[0] = 0;
0076   ptMap_[1] = 0;
0077   ptMap_[2] = 3;
0078   ptMap_[3] = 4;
0079   ptMap_[4] = 5;
0080   ptMap_[5] = 6;
0081   ptMap_[6] = 7;
0082   ptMap_[7] = 8;
0083   ptMap_[8] = 9;
0084   ptMap_[9] = 10;
0085   ptMap_[10] = 12;
0086   ptMap_[11] = 14;
0087   ptMap_[12] = 16;
0088   ptMap_[13] = 20;
0089   ptMap_[14] = 24;
0090   ptMap_[15] = 28;
0091   ptMap_[16] = 32;
0092   ptMap_[17] = 36;
0093   ptMap_[18] = 40;
0094   ptMap_[19] = 50;
0095   ptMap_[20] = 60;
0096   ptMap_[21] = 70;
0097   ptMap_[22] = 80;
0098   ptMap_[23] = 90;
0099   ptMap_[24] = 100;
0100   ptMap_[25] = 120;
0101   ptMap_[26] = 140;
0102   ptMap_[27] = 160;
0103   ptMap_[28] = 180;
0104   ptMap_[29] = 200;
0105   ptMap_[30] = 240;
0106   ptMap_[31] = 280;
0107 }
0108 
0109 //
0110 // member functions
0111 //
0112 
0113 // ------------ method called to produce the data  ------------
0114 void L1TBMTFConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0115   using namespace edm;
0116 
0117   std::unique_ptr<RegionalMuonCandBxCollection> convMuons(new RegionalMuonCandBxCollection());
0118 
0119   Handle<RegionalMuonCandBxCollection> bmtfMuons;
0120   iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
0121   for (auto mu = bmtfMuons->begin(0); mu != bmtfMuons->end(0); ++mu) {
0122     RegionalMuonCand convMu((*mu));
0123     // int convPt = ptMap_.at(mu->hwPt());
0124     // int convPhi = (mu->hwPhi() * 4) - (mu->processor() * 48);
0125     // int convEta = getSigned(mu->hwEta())*3.54;
0126     int convEta = (mu->hwEta() - 32) * 3.54;
0127     // convMu.setHwPt(convPt);
0128     // convMu.setHwPhi(convPhi);
0129     convMu.setHwEta(convEta);
0130     // convMu.setTFIdentifiers(mu->processor()+1, mu->trackFinderType());
0131     convMuons->push_back(0, convMu);
0132   }
0133 
0134   iEvent.put(std::move(convMuons), "ConvBMTFMuons");
0135 }
0136 
0137 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
0138 void L1TBMTFConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0139   //The following says we do not know what parameters are allowed so do no validation
0140   // Please change this to state exactly what you do use, even if it is no parameters
0141   edm::ParameterSetDescription desc;
0142   desc.setUnknown();
0143   descriptions.addDefault(desc);
0144 }
0145 
0146 //define this as a plug-in
0147 DEFINE_FWK_MODULE(L1TBMTFConverter);