CMS 3D CMS Logo

L1TTwinMuxProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1TwinMuxProducer
4 //
5 // L1TwinMuxProducer EDProducer
6 //
7 //
8 // Author :
9 // G. Flouris U Ioannina Feb. 2015
10 // Mod.: g Karathanasis
11 //--------------------------------------------------
12 
13 
20 
22 
23 #include <iostream>
24 #include <iomanip>
25 #include <memory>
26 
27 using namespace std;
28 
29 //class L1TTwinMuxProducer: public edm::one::EDProducer<edm::one::SharedResources>
30 //class L1TTwinMuxProducer: public edm::EDProducer
32 {
33 public:
35  ~L1TTwinMuxProducer() override {}
36  void produce(edm::Event & e, const edm::EventSetup& c) override;
37 private:
38  //L1TTwinMuxAlgorithm * m_l1tma;
39 // std::unique_ptr<L1TTwinMuxAlgorithm> m_l1tma(new L1TTwinMuxAlgorithm());
40  edm::EDGetToken m_dtdigi, m_dtthetadigi, m_rpcsource;
43 
44 };
45 
46 
47 
48 
50 //m_l1tma = new L1TTwinMuxAlgorithm();
51 // std::unique_ptr<L1TTwinMuxAlgorithm> m_l1tma(new L1TTwinMuxAlgorithm());
52 
53 m_dtdigi = consumes<L1MuDTChambPhContainer>(pset.getParameter<edm::InputTag>("DTDigi_Source"));
54 m_dtthetadigi = consumes<L1MuDTChambThContainer>(pset.getParameter<edm::InputTag>("DTThetaDigi_Source"));
55 m_rpcsource = consumes<RPCDigiCollection>(pset.getParameter<edm::InputTag>("RPC_Source"));
56 
57 produces<L1MuDTChambPhContainer>();
58 produces<L1MuDTChambThContainer>();
59 
60 }
61 
63 
64  std::unique_ptr<L1TTwinMuxAlgorithm> m_l1tma(new L1TTwinMuxAlgorithm());
66  const L1TTwinMuxParamsRcd& tmParamsRcd = c.get<L1TTwinMuxParamsRcd>();
67  tmParamsRcd.get(tmParamsHandle);
68  const L1TTwinMuxParams& tmParams = *tmParamsHandle.product();
69 
71  bool onlyRPC = tmParams.get_UseOnlyRPC();
73  bool onlyDT = tmParams.get_UseOnlyDT();
74 
75  if(onlyDT && onlyRPC) {edm::LogWarning("Inconsistent configuration")<<"onlyRPC and onlyDT options"; return;}
77 
80  e.getByToken(m_dtdigi, phiDigis);
81  e.getByToken(m_dtthetadigi, thetaDigis);
82 
84  e.getByToken(m_rpcsource, rpcDigis);
85 
86  if (! phiDigis.isValid()){
87  edm::LogWarning("Inconsistent digis")<<"input DT phi digis not valid";
88  }
89 
90 
91 
92  //std::unique_ptr<L1MuDTChambPhContainer> l1ttmp(new L1MuDTChambPhContainer);
93  auto l1ttmp = std::make_unique<L1MuDTChambPhContainer>();
94  m_l1tma->run(phiDigis, thetaDigis, rpcDigis,c);
95  *l1ttmp = m_l1tma->get_ph_tm_output();
96  //null transfer of theta digis
97  auto l1ttmth = std::make_unique<L1MuDTChambThContainer>();
98  const std::vector< L1MuDTChambThDigi>* theta=thetaDigis->getContainer();
99  l1ttmth->setContainer(*theta);
100 
101  e.put(std::move(l1ttmp));
102  e.put(std::move(l1ttmth));
103 }
104 
105 
106 
T getParameter(std::string const &) const
The_Container const * getContainer() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
L1TTwinMuxProducer(const edm::ParameterSet &pset)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
~L1TTwinMuxProducer() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Geom::Theta< T > theta() const
void produce(edm::Event &e, const edm::EventSetup &c) override
edm::ESHandle< L1TTwinMuxParams > tmParamsHandle
Event Setup Handler.
void get(HolderT &iHolder) const
bool isValid() const
Definition: HandleBase.h:74
const T & get() const
Definition: EventSetup.h:58
int get_UseOnlyDT() const
int get_UseOnlyRPC() const
def move(src, dest)
Definition: eostools.py:510
edm::EDGetToken m_rpcsource