CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
RPCDigiMerger Class Reference

#include <RPCDigiMerger.h>

Inheritance diagram for RPCDigiMerger:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &event, edm::EventSetup const &setup) override
 
 RPCDigiMerger (edm::ParameterSet const &config)
 
 ~RPCDigiMerger () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descs)
 

Protected Attributes

int bx_maxCPPF_
 
int bx_maxOMTF_
 
int bx_maxTwinMux_
 
int bx_minCPPF_
 
int bx_minOMTF_
 
int bx_minTwinMux_
 
edm::EDGetTokenT< RPCDigiCollectioncppf_token_
 
edm::EDGetTokenT< RPCDigiCollectionomtf_token_
 
edm::EDGetTokenT< RPCDigiCollectionsimRPC_token_
 
edm::EDGetTokenT< RPCDigiCollectiontwinMux_token_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 24 of file RPCDigiMerger.h.

Constructor & Destructor Documentation

◆ RPCDigiMerger()

RPCDigiMerger::RPCDigiMerger ( edm::ParameterSet const &  config)

Definition at line 20 of file RPCDigiMerger.cc.

References cppf_token_, edm::InputTag::label(), omtf_token_, simRPC_token_, and twinMux_token_.

21  : bx_minTwinMux_(config.getParameter<int>("bxMinTwinMux")),
22  bx_maxTwinMux_(config.getParameter<int>("bxMaxTwinMux")),
23  bx_minOMTF_(config.getParameter<int>("bxMinOMTF")),
24  bx_maxOMTF_(config.getParameter<int>("bxMaxOMTF")),
25  bx_minCPPF_(config.getParameter<int>("bxMinCPPF")),
26  bx_maxCPPF_(config.getParameter<int>("bxMaxCPPF")) {
27  produces<RPCDigiCollection>();
28  simRPC_token_ = consumes<RPCDigiCollection>(config.getParameter<edm::InputTag>("inputTagSimRPCDigis"));
29  // protection against empty InputTag to allow for Data/MC compatibility
30  if (not config.getParameter<edm::InputTag>("inputTagTwinMuxDigis").label().empty()) {
31  twinMux_token_ = consumes<RPCDigiCollection>(config.getParameter<edm::InputTag>("inputTagTwinMuxDigis"));
32  }
33  if (not config.getParameter<edm::InputTag>("inputTagOMTFDigis").label().empty()) {
34  omtf_token_ = consumes<RPCDigiCollection>(config.getParameter<edm::InputTag>("inputTagOMTFDigis"));
35  }
36  if (not config.getParameter<edm::InputTag>("inputTagCPPFDigis").label().empty()) {
37  cppf_token_ = consumes<RPCDigiCollection>(config.getParameter<edm::InputTag>("inputTagCPPFDigis"));
38  }
39 }
Definition: config.py:1
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< RPCDigiCollection > omtf_token_
Definition: RPCDigiMerger.h:35
edm::EDGetTokenT< RPCDigiCollection > twinMux_token_
Definition: RPCDigiMerger.h:34
edm::EDGetTokenT< RPCDigiCollection > simRPC_token_
Definition: RPCDigiMerger.h:37
edm::EDGetTokenT< RPCDigiCollection > cppf_token_
Definition: RPCDigiMerger.h:36

◆ ~RPCDigiMerger()

RPCDigiMerger::~RPCDigiMerger ( )
override

Definition at line 41 of file RPCDigiMerger.cc.

41 {}

Member Function Documentation

◆ fillDescriptions()

void RPCDigiMerger::fillDescriptions ( edm::ConfigurationDescriptions descs)
static

Definition at line 43 of file RPCDigiMerger.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

43  {
45  desc.add<edm::InputTag>("inputTagSimRPCDigis", edm::InputTag("simMuonRPCDigis", ""));
46  desc.add<edm::InputTag>("inputTagTwinMuxDigis", edm::InputTag("", ""));
47  desc.add<edm::InputTag>("inputTagOMTFDigis", edm::InputTag("", ""));
48  desc.add<edm::InputTag>("inputTagCPPFDigis", edm::InputTag("", ""));
49  desc.add<edm::InputTag>("InputLabel", edm::InputTag(" "));
50  desc.add<int>("bxMinTwinMux", -2);
51  desc.add<int>("bxMaxTwinMux", 2);
52  desc.add<int>("bxMinOMTF", -3);
53  desc.add<int>("bxMaxOMTF", 4);
54  desc.add<int>("bxMinCPPF", -2);
55  desc.add<int>("bxMaxCPPF", 2);
56 
57  descs.add("rpcDigiMerger", desc);
58 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void RPCDigiMerger::produce ( edm::Event event,
edm::EventSetup const &  setup 
)
override

Definition at line 60 of file RPCDigiMerger.cc.

References RPCDigi::bx(), bx_maxCPPF_, bx_maxOMTF_, bx_maxTwinMux_, bx_minCPPF_, bx_minOMTF_, bx_minTwinMux_, cppf_token_, edm::EDGetTokenT< T >::isUninitialized(), eostools::move(), omtf_token_, isotrackApplyRegressor::range, RPCDetId::region(), RPCDetId::ring(), simRPC_token_, RPCDetId::station(), and twinMux_token_.

60  {
61  // Get the digis
62  // new RPCDigiCollection
63  std::unique_ptr<RPCDigiCollection> rpc_digi_collection(new RPCDigiCollection());
64 
65  //Check if its Data
67  // loop over TwinMux digis
68  // protection against empty InputTag to allow for Data/MC compatibility
69  if (not twinMux_token_.isUninitialized()) {
70  Handle<RPCDigiCollection> TwinMux_digis;
71  event.getByToken(twinMux_token_, TwinMux_digis);
72  for (const auto&& rpcdgIt : (*TwinMux_digis)) {
73  // The layerId
74  const RPCDetId& rpcId = rpcdgIt.first;
75  // Get the iterators over the digis associated with this LayerId
76  const RPCDigiCollection::Range& range = rpcdgIt.second;
77  rpc_digi_collection->put(range, rpcId);
78  }
79  }
80  // loop over CPPF digis
81  // protection against empty InputTag to allow for Data/MC compatibility
82  if (not cppf_token_.isUninitialized()) {
83  Handle<RPCDigiCollection> CPPF_digis;
84  event.getByToken(cppf_token_, CPPF_digis);
85  for (const auto&& rpcdgIt : (*CPPF_digis)) {
86  // The layerId
87  const RPCDetId& rpcId = rpcdgIt.first;
88  // Get the iterators over the digis associated with this LayerId
89  const RPCDigiCollection::Range& range = rpcdgIt.second;
90  rpc_digi_collection->put(range, rpcId);
91  }
92  }
93  // loop over OMTF digis
94  // protection against empty InputTag to allow for Data/MC compatibility
95  if (not omtf_token_.isUninitialized()) {
96  Handle<RPCDigiCollection> OMTF_digis;
97  event.getByToken(omtf_token_, OMTF_digis);
98  for (const auto& rpcdgIt : (*OMTF_digis)) {
99  // The layerId
100  const RPCDetId& rpcId = rpcdgIt.first;
101  // Get the iterators over the digis associated with this LayerId
102  const RPCDigiCollection::Range& range = rpcdgIt.second;
103  // accepts only rings: RE-2_R3 ; RE-1_R3 ; RE+1_R3 ; RE+2_R3 ;
104  if (((rpcId.region() == -1 || rpcId.region() == 1) && (rpcId.ring() == 3) &&
105  (rpcId.station() == 1 || rpcId.station() == 2))) {
106  rpc_digi_collection->put(range, rpcId);
107  }
108  }
109  }
110  } else { //its MC
111  // SimRPCDigis collection
112  Handle<RPCDigiCollection> SimRPC_digis;
113  event.getByToken(simRPC_token_, SimRPC_digis);
114 
115  RPCDetId rpc_det_id;
116  std::vector<RPCDigi> local_rpc_digis;
117 
118  // loop over SimRPC digis
119  for (const auto& rpc_digi : (*SimRPC_digis)) {
120  // The layerId
121  const RPCDetId& rpcId = rpc_digi.first;
122  // Get the iterators over the digis associated with this LayerId
123  const RPCDigiCollection::Range& range = rpc_digi.second;
124 
125  if (rpcId != rpc_det_id) {
126  if (!local_rpc_digis.empty()) {
127  rpc_digi_collection->put(RPCDigiCollection::Range(local_rpc_digis.begin(), local_rpc_digis.end()),
128  rpc_det_id);
129  local_rpc_digis.clear();
130  }
131  rpc_det_id = rpcId;
132  }
133  for (std::vector<RPCDigi>::const_iterator id = range.first; id != range.second; id++) {
134  const RPCDigi& dit = (*id);
135  //Barrel
136  if (rpcId.region() == 0) {
137  //TwinMux
138  if (dit.bx() >= bx_minTwinMux_ && dit.bx() <= bx_maxTwinMux_) {
139  local_rpc_digis.push_back(dit);
140  }
141  }
142  //EndCap
143  if (rpcId.region() == -1 || rpcId.region() == 1) {
144  //OMTF
145  if (rpcId.ring() == 3 && (rpcId.station() == 1 || rpcId.station() == 2) && dit.bx() >= bx_minOMTF_ &&
146  dit.bx() <= bx_maxOMTF_) {
147  local_rpc_digis.push_back(dit);
148  }
149  //CPPF
150  if (((rpcId.ring() == 2) || (rpcId.ring() == 3 && (rpcId.station() == 3 || rpcId.station() == 4))) &&
151  (dit.bx() >= bx_minCPPF_ && dit.bx() <= bx_maxCPPF_)) {
152  local_rpc_digis.push_back(dit);
153  }
154  }
155  }
156  }
157  if (!local_rpc_digis.empty()) {
158  rpc_digi_collection->put(RPCDigiCollection::Range(local_rpc_digis.begin(), local_rpc_digis.end()), rpc_det_id);
159  }
160  }
161  // "put" into the event
162  event.put(std::move(rpc_digi_collection));
163 }
int bx() const
Definition: RPCDigi.h:28
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
int ring() const
Definition: RPCDetId.h:59
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
std::pair< const_iterator, const_iterator > Range
int station() const
Definition: RPCDetId.h:78
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
edm::EDGetTokenT< RPCDigiCollection > omtf_token_
Definition: RPCDigiMerger.h:35
edm::EDGetTokenT< RPCDigiCollection > twinMux_token_
Definition: RPCDigiMerger.h:34
edm::EDGetTokenT< RPCDigiCollection > simRPC_token_
Definition: RPCDigiMerger.h:37
edm::EDGetTokenT< RPCDigiCollection > cppf_token_
Definition: RPCDigiMerger.h:36
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ bx_maxCPPF_

int RPCDigiMerger::bx_maxCPPF_
protected

Definition at line 41 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_maxOMTF_

int RPCDigiMerger::bx_maxOMTF_
protected

Definition at line 40 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_maxTwinMux_

int RPCDigiMerger::bx_maxTwinMux_
protected

Definition at line 39 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_minCPPF_

int RPCDigiMerger::bx_minCPPF_
protected

Definition at line 41 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_minOMTF_

int RPCDigiMerger::bx_minOMTF_
protected

Definition at line 40 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_minTwinMux_

int RPCDigiMerger::bx_minTwinMux_
protected

Definition at line 39 of file RPCDigiMerger.h.

Referenced by produce().

◆ cppf_token_

edm::EDGetTokenT<RPCDigiCollection> RPCDigiMerger::cppf_token_
protected

Definition at line 36 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().

◆ omtf_token_

edm::EDGetTokenT<RPCDigiCollection> RPCDigiMerger::omtf_token_
protected

Definition at line 35 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().

◆ simRPC_token_

edm::EDGetTokenT<RPCDigiCollection> RPCDigiMerger::simRPC_token_
protected

Definition at line 37 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().

◆ twinMux_token_

edm::EDGetTokenT<RPCDigiCollection> RPCDigiMerger::twinMux_token_
protected

Definition at line 34 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().