CMS 3D CMS Logo

RPCDigiMerger.cc
Go to the documentation of this file.
2 
3 #include <memory>
4 
14 
16 
17 using namespace edm;
18 using namespace std;
19 
20 
22 {
23  produces<RPCDigiCollection>();
24  twinMux_token_ = consumes<RPCDigiCollection>(config.getParameter<edm::InputTag>("inputTagTwinMuxDigis"));
25  omtf_token_ = consumes<RPCDigiCollection>(config.getParameter<edm::InputTag>("inputTagOMTFDigis"));
26  cppf_token_ = consumes<RPCDigiCollection>(config.getParameter<edm::InputTag>("inputTagCPPFDigis"));
27 }
28 
30 {}
31 
33 {
35  desc.add<edm::InputTag>("inputTagTwinMuxDigis", edm::InputTag("rpcTwinMuxRawToDigi", ""));
36  desc.add<edm::InputTag>("inputTagOMTFDigis", edm::InputTag("omtfStage2Digis", ""));
37  desc.add<edm::InputTag>("inputTagCPPFDigis", edm::InputTag("rpcCPPFRawToDigi", ""));
38 
39  descs.add("rpcDigiMerger", desc);
40 }
41 
43 {}
44 
46 {
47 
48  // Get the digis
49  // TwinMux
50  Handle<RPCDigiCollection> TwinMux_digis;
51  event.getByToken(twinMux_token_,TwinMux_digis);
52  // OMTF
53  Handle<RPCDigiCollection> OMTF_digis;
54  event.getByToken(omtf_token_,OMTF_digis);
55  // CPFF
56  Handle<RPCDigiCollection> CPPF_digis;
57  event.getByToken(cppf_token_,CPPF_digis);
58 
59  // new RPCDigiCollection
60  std::unique_ptr<RPCDigiCollection> rpc_digi_collection(new RPCDigiCollection());
61 
62 
63  // loop over TwinMux digis
64  for (const auto & rpcdgIt : (*TwinMux_digis) ) {
65  // The layerId
66  const RPCDetId& rpcId = rpcdgIt.first;
67  // Get the iterators over the digis associated with this LayerId
68  const RPCDigiCollection::Range& range = rpcdgIt.second;
69 
70  rpc_digi_collection->put(range, rpcId);
71  }
72 
73  // loop over CPPF digis
74  for (const auto && rpcdgIt : (*CPPF_digis) ) {
75  // The layerId
76  const RPCDetId& rpcId = rpcdgIt.first;
77  // Get the iterators over the digis associated with this LayerId
78  const RPCDigiCollection::Range& range = rpcdgIt.second;
79 
80  rpc_digi_collection->put(range, rpcId);
81  }
82 
83  // loop over OMTF digis
84  for (const auto & rpcdgIt : (*OMTF_digis) ) {
85  // The layerId
86  const RPCDetId& rpcId = rpcdgIt.first;
87  // Get the iterators over the digis associated with this LayerId
88  const RPCDigiCollection::Range& range = rpcdgIt.second;
89 
90  // accepts only rings: RE-2_R3 ; RE-1_R3 ; RE+1_R3 ; RE+2_R3 ;
91  if ( ((rpcId.region() == -1 || rpcId.region() == 1) && (rpcId.ring() == 3) && (rpcId.station() == 1 || rpcId.station() == 2)) ) {
92  rpc_digi_collection->put(range, rpcId);
93  }
94  }
95 
96  // "put" into the event
97  event.put(std::move(rpc_digi_collection));
98 }
99 
T getParameter(std::string const &) const
RPCDigiMerger(edm::ParameterSet const &config)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
~RPCDigiMerger() override
Definition: config.py:1
void beginRun(edm::Run const &run, edm::EventSetup const &setup) override
int ring() const
Definition: RPCDetId.h:72
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
static void fillDescriptions(edm::ConfigurationDescriptions &descs)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
std::pair< const_iterator, const_iterator > Range
void produce(edm::Event &event, edm::EventSetup const &setup) override
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
Definition: Run.h:44
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96