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 beginRun (edm::Run const &run, edm::EventSetup const &setup) override
 
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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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.

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 }

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

◆ ~RPCDigiMerger()

RPCDigiMerger::~RPCDigiMerger ( )
override

Definition at line 41 of file RPCDigiMerger.cc.

41 {}

Member Function Documentation

◆ beginRun()

void RPCDigiMerger::beginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
override

Definition at line 60 of file RPCDigiMerger.cc.

60 {}

◆ fillDescriptions()

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

Definition at line 43 of file RPCDigiMerger.cc.

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 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

◆ produce()

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

Definition at line 62 of file RPCDigiMerger.cc.

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

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_, FastTimerService_cff::range, RPCDetId::region(), RPCDetId::ring(), simRPC_token_, RPCDetId::station(), and twinMux_token_.

Member Data Documentation

◆ bx_maxCPPF_

int RPCDigiMerger::bx_maxCPPF_
protected

Definition at line 42 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_maxOMTF_

int RPCDigiMerger::bx_maxOMTF_
protected

Definition at line 41 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_maxTwinMux_

int RPCDigiMerger::bx_maxTwinMux_
protected

Definition at line 40 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_minCPPF_

int RPCDigiMerger::bx_minCPPF_
protected

Definition at line 42 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_minOMTF_

int RPCDigiMerger::bx_minOMTF_
protected

Definition at line 41 of file RPCDigiMerger.h.

Referenced by produce().

◆ bx_minTwinMux_

int RPCDigiMerger::bx_minTwinMux_
protected

Definition at line 40 of file RPCDigiMerger.h.

Referenced by produce().

◆ cppf_token_

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

Definition at line 37 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().

◆ omtf_token_

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

Definition at line 36 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().

◆ simRPC_token_

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

Definition at line 38 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().

◆ twinMux_token_

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

Definition at line 35 of file RPCDigiMerger.h.

Referenced by produce(), and RPCDigiMerger().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
RPCDetId::station
int station() const
Definition: RPCDetId.h:78
RPCDetId::region
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
RPCDigiMerger::omtf_token_
edm::EDGetTokenT< RPCDigiCollection > omtf_token_
Definition: RPCDigiMerger.h:36
RPCDetId
Definition: RPCDetId.h:16
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
RPCDigiMerger::bx_minCPPF_
int bx_minCPPF_
Definition: RPCDigiMerger.h:42
edm::Handle< RPCDigiCollection >
RPCDigi::bx
int bx() const
Definition: RPCDigi.h:28
config
Definition: config.py:1
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
RPCDigiMerger::twinMux_token_
edm::EDGetTokenT< RPCDigiCollection > twinMux_token_
Definition: RPCDigiMerger.h:35
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::EDGetTokenT::isUninitialized
bool isUninitialized() const
Definition: EDGetToken.h:70
RPCDigiMerger::bx_minOMTF_
int bx_minOMTF_
Definition: RPCDigiMerger.h:41
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
RPCDigiMerger::bx_maxTwinMux_
int bx_maxTwinMux_
Definition: RPCDigiMerger.h:40
RPCDigiCollection
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
Definition: RPCDigiCollection.h:13
RPCDigiMerger::simRPC_token_
edm::EDGetTokenT< RPCDigiCollection > simRPC_token_
Definition: RPCDigiMerger.h:38
RPCDigiMerger::bx_maxOMTF_
int bx_maxOMTF_
Definition: RPCDigiMerger.h:41
RPCDigiMerger::cppf_token_
edm::EDGetTokenT< RPCDigiCollection > cppf_token_
Definition: RPCDigiMerger.h:37
RPCDetId::ring
int ring() const
Definition: RPCDetId.h:59
RPCDigiMerger::bx_maxCPPF_
int bx_maxCPPF_
Definition: RPCDigiMerger.h:42
eostools.move
def move(src, dest)
Definition: eostools.py:511
RPCDigi
Definition: RPCDigi.h:19
RPCDigiMerger::bx_minTwinMux_
int bx_minTwinMux_
Definition: RPCDigiMerger.h:40
MuonDigiCollection< RPCDetId, RPCDigi >::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
edm::InputTag
Definition: InputTag.h:15