CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
GEMPadDigiProducer Class Reference
Inheritance diagram for GEMPadDigiProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 GEMPadDigiProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~GEMPadDigiProducer () 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 &descriptions)
 

Private Member Functions

void buildPads (const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const
 
void buildPads16GE21 (const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const
 
void checkGeometry () const
 
void checkValid (const GEMPadDigi &pad, const GEMDetId &id) const
 

Private Attributes

edm::EDGetTokenT< GEMDigiCollectiondigi_token_
 Name of input digi Collection. More...
 
edm::InputTag digis_
 
edm::ESGetToken< GEMGeometry, MuonGeometryRecordgeom_token_
 
const GEMGeometrygeometry_
 
bool use16GE21_
 

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 33 of file GEMPadDigiProducer.cc.

Constructor & Destructor Documentation

◆ GEMPadDigiProducer()

GEMPadDigiProducer::GEMPadDigiProducer ( const edm::ParameterSet ps)
explicit

Definition at line 60 of file GEMPadDigiProducer.cc.

References digi_token_, digis_, geom_token_, and edm::ParameterSet::getParameter().

60  : use16GE21_(false), geometry_(nullptr) {
61  digis_ = ps.getParameter<edm::InputTag>("InputCollection");
62 
63  digi_token_ = consumes<GEMDigiCollection>(digis_);
64  geom_token_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
65 
66  produces<GEMPadDigiCollection>();
67  consumes<GEMDigiCollection>(digis_);
68 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const GEMGeometry * geometry_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geom_token_
edm::EDGetTokenT< GEMDigiCollection > digi_token_
Name of input digi Collection.

◆ ~GEMPadDigiProducer()

GEMPadDigiProducer::~GEMPadDigiProducer ( )
override

Definition at line 70 of file GEMPadDigiProducer.cc.

70 {}

Member Function Documentation

◆ beginRun()

void GEMPadDigiProducer::beginRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
override

Definition at line 79 of file GEMPadDigiProducer.cc.

References GEMGeometry::chamber(), checkGeometry(), options_cfi::eventSetup, geom_token_, geometry_, GEMGeometry::hasGE21(), GEMChamber::nEtaPartitions(), and use16GE21_.

79  {
81  geometry_ = &*hGeom;
82  // check the number of parititions
83  if (geometry_->hasGE21()) {
84  use16GE21_ = (geometry_->chamber(GEMDetId(1, 1, 2, 2, 16, 0))->nEtaPartitions() ==
85  GEMPadDigi::NumberPartitions::GE21SplitStrip);
86  }
87 
88  checkGeometry();
89 }
const GEMGeometry * geometry_
int nEtaPartitions() const
Retunr numbers of eta partitions.
Definition: GEMChamber.cc:31
bool hasGE21() const
Definition: GEMGeometry.cc:115
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geom_token_
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73

◆ buildPads()

void GEMPadDigiProducer::buildPads ( const GEMDigiCollection digis,
GEMPadDigiCollection out_pads 
) const
private

Definition at line 107 of file GEMPadDigiProducer.cc.

References checkValid(), ztail::d, GEMGeometry::etaPartitions(), GEMPadDigi::GE11InValid, GEMPadDigi::GE21InValid, geometry_, l1t::mtf7::ME0, GEMPadDigi::ME0InValid, nPart(), or, AlCaHLTBitMon_ParallelJobs::p, and use16GE21_.

Referenced by produce().

107  {
108  for (const auto& p : geometry_->etaPartitions()) {
109  // when using the GE2/1 geometry with 16 eta partitions
110  // ->ignore GE2/1
111  if (use16GE21_ and p->isGE21())
112  continue;
113 
114  // set of <pad, bx, part> pairs, sorted first by pad then by bx
115  std::set<std::tuple<int, int, unsigned> > proto_pads;
116 
117  // walk over digis in this partition,
118  // and stuff them into a set of unique pads (equivalent of OR operation)
119  auto digis = det_digis.get(p->id());
120  for (auto d = digis.first; d != digis.second; ++d) {
121  unsigned pad_num = static_cast<unsigned>(p->padOfStrip(d->strip()));
122 
123  auto nPart = GEMPadDigi::NumberPartitions::GE11;
124  if (p->isME0()) {
126  } else if (p->isGE21()) {
127  nPart = GEMPadDigi::NumberPartitions::GE21;
128  }
129  // check that the input digi is valid
130  if ((p->isGE11() and pad_num == GEMPadDigi::GE11InValid) or
131  (p->isGE21() and pad_num == GEMPadDigi::GE21InValid) or (p->isME0() and pad_num == GEMPadDigi::ME0InValid)) {
132  edm::LogWarning("GEMPadDigiProducer") << "Invalid " << pad_num << " from " << *d << " in " << p->id();
133  }
134  proto_pads.emplace(pad_num, d->bx(), nPart);
135  }
136 
137  // fill the output collections
138  for (const auto& d : proto_pads) {
139  GEMPadDigi pad_digi(std::get<0>(d), std::get<1>(d), p->subsystem(), std::get<2>(d));
140  checkValid(pad_digi, p->id());
141  out_pads.insertDigi(p->id(), pad_digi);
142  }
143  }
144 }
const GEMGeometry * geometry_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
d
Definition: ztail.py:151
TString nPart(Int_t part, TString string, TString delimit=";", Bool_t removerest=true)
ME0 Data Record : block->header().getID() = 6.
Definition: Block.h:23
Log< level::Warning, false > LogWarning
void checkValid(const GEMPadDigi &pad, const GEMDetId &id) const
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40

◆ buildPads16GE21()

void GEMPadDigiProducer::buildPads16GE21 ( const GEMDigiCollection digis,
GEMPadDigiCollection out_pads 
) const
private

Definition at line 146 of file GEMPadDigiProducer.cc.

References checkValid(), ztail::d, GEMGeometry::etaPartitions(), geometry_, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by produce().

146  {
147  for (const auto& p : geometry_->etaPartitions()) {
148  // when using the GE2/1 geometry with 16 eta partitions
149  // ->ignore GE1/1
150  if (!p->isGE21())
151  continue;
152 
153  // ignore eta partition with even numbers
154  // these are included in the odd numbered pads
155  if (p->id().roll() % 2 == 0)
156  continue;
157 
158  // set of <pad, bx> pairs, sorted first by pad then by bx
159  std::set<std::pair<int, int> > proto_pads;
160 
161  // walk over digis in the first partition,
162  // and stuff them into a set of unique pads (equivalent of OR operation)
163  auto digis = det_digis.get(p->id());
164 
165  // proto pads for the odd partitions
166  for (auto d = digis.first; d != digis.second; ++d) {
167  proto_pads.emplace(d->strip(), d->bx());
168  }
169 
170  GEMDetId gemId2(
171  p->id().region(), p->id().ring(), p->id().station(), p->id().layer(), p->id().chamber(), p->id().roll() + 1);
172  auto digis2 = det_digis.get(gemId2);
173 
174  // proto pads for the even partitions
175  for (auto d = digis2.first; d != digis2.second; ++d) {
176  proto_pads.emplace(d->strip(), d->bx());
177  }
178 
179  // fill the output collections
180  for (const auto& d : proto_pads) {
181  GEMPadDigi pad_digi(d.first, d.second, p->subsystem(), GEMPadDigi::NumberPartitions::GE21SplitStrip);
182  checkValid(pad_digi, p->id());
183  out_pads.insertDigi(p->id(), pad_digi);
184  }
185  }
186 }
const GEMGeometry * geometry_
d
Definition: ztail.py:151
void checkValid(const GEMPadDigi &pad, const GEMDetId &id) const
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40

◆ checkGeometry()

void GEMPadDigiProducer::checkGeometry ( ) const
private

Definition at line 196 of file GEMPadDigiProducer.cc.

References GEMGeometry::chamber(), geometry_, GEMGeometry::hasGE11(), GEMGeometry::hasGE21(), GEMGeometry::hasME0(), l1t::mtf7::ME0, GEMChamber::nEtaPartitions(), and use16GE21_.

Referenced by beginRun().

196  {
197  // check that ME0 has 8-eta partitions
198  if (geometry_->hasME0()) {
200  edm::LogError("GEMPadDigiProducer") << "ME0 geometry appears corrupted";
201  }
202  }
203 
204  // check that GE1/1 has 8-eta partitions
205  if (geometry_->hasGE11()) {
206  if (geometry_->chamber(GEMDetId(1, 1, 1, 1, 1, 0))->nEtaPartitions() != GEMPadDigi::NumberPartitions::GE11) {
207  edm::LogError("GEMPadDigiProducer") << "GE1/1 geometry appears corrupted";
208  }
209  }
210 
211  if (geometry_->hasGE21()) {
212  if (!use16GE21_) {
213  // check that GE2/1 has 8-eta partitions
214  if (geometry_->chamber(GEMDetId(1, 1, 2, 2, 16, 0))->nEtaPartitions() != GEMPadDigi::NumberPartitions::GE21) {
215  edm::LogError("GEMPadDigiProducer") << "GE2/1 geometry (8 partition) appears corrupted";
216  }
217  } else {
218  // check that GE2/1 has 16-eta partitions
219  if (geometry_->chamber(GEMDetId(1, 1, 2, 2, 16, 0))->nEtaPartitions() !=
220  GEMPadDigi::NumberPartitions::GE21SplitStrip) {
221  edm::LogError("GEMPadDigiProducer") << "GE2/1 geometry (16 partition) appears corrupted";
222  }
223  }
224  }
225 }
const GEMGeometry * geometry_
int nEtaPartitions() const
Retunr numbers of eta partitions.
Definition: GEMChamber.cc:31
Log< level::Error, false > LogError
bool hasME0() const
Definition: GEMGeometry.cc:111
bool hasGE11() const
Definition: GEMGeometry.cc:113
bool hasGE21() const
Definition: GEMGeometry.cc:115
ME0 Data Record : block->header().getID() = 6.
Definition: Block.h:23
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73

◆ checkValid()

void GEMPadDigiProducer::checkValid ( const GEMPadDigi pad,
const GEMDetId id 
) const
private

Definition at line 188 of file GEMPadDigiProducer.cc.

References EcalPhiSymFlatTableProducers_cfi::id, and GEMPadDigi::isValid().

Referenced by buildPads(), and buildPads16GE21().

188  {
189  // check if the pad is valid
190  // in principle, invalid pads can appear in the CMS raw data
191  if (!pad.isValid()) {
192  edm::LogWarning("GEMPadDigiProducer") << "Invalid " << pad << " in " << id;
193  }
194 }
bool isValid() const
Definition: GEMPadDigi.cc:26
Log< level::Warning, false > LogWarning

◆ fillDescriptions()

void GEMPadDigiProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 72 of file GEMPadDigiProducer.cc.

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

72  {
74  desc.add<edm::InputTag>("InputCollection", edm::InputTag("simMuonGEMDigis"));
75 
76  descriptions.add("simMuonGEMPadDigisDef", desc);
77 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void GEMPadDigiProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 91 of file GEMPadDigiProducer.cc.

References buildPads(), buildPads16GE21(), digi_token_, MillePedeFileConverter_cfg::e, eostools::move(), edm::Handle< T >::product(), and use16GE21_.

91  {
93  e.getByToken(digi_token_, hdigis);
94 
95  // Create empty output
96  std::unique_ptr<GEMPadDigiCollection> pPads(new GEMPadDigiCollection());
97 
98  // build the pads
99  buildPads(*(hdigis.product()), *pPads);
100  if (use16GE21_)
101  buildPads16GE21(*(hdigis.product()), *pPads);
102 
103  // store them in the event
104  e.put(std::move(pPads));
105 }
void buildPads16GE21(const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const
T const * product() const
Definition: Handle.h:70
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
edm::EDGetTokenT< GEMDigiCollection > digi_token_
Name of input digi Collection.
def move(src, dest)
Definition: eostools.py:511
void buildPads(const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const

Member Data Documentation

◆ digi_token_

edm::EDGetTokenT<GEMDigiCollection> GEMPadDigiProducer::digi_token_
private

Name of input digi Collection.

Definition at line 52 of file GEMPadDigiProducer.cc.

Referenced by GEMPadDigiProducer(), and produce().

◆ digis_

edm::InputTag GEMPadDigiProducer::digis_
private

Definition at line 54 of file GEMPadDigiProducer.cc.

Referenced by GEMPadDigiProducer().

◆ geom_token_

edm::ESGetToken<GEMGeometry, MuonGeometryRecord> GEMPadDigiProducer::geom_token_
private

Definition at line 53 of file GEMPadDigiProducer.cc.

Referenced by beginRun(), and GEMPadDigiProducer().

◆ geometry_

const GEMGeometry* GEMPadDigiProducer::geometry_
private

Definition at line 57 of file GEMPadDigiProducer.cc.

Referenced by beginRun(), buildPads(), buildPads16GE21(), and checkGeometry().

◆ use16GE21_

bool GEMPadDigiProducer::use16GE21_
private

Definition at line 55 of file GEMPadDigiProducer.cc.

Referenced by beginRun(), buildPads(), checkGeometry(), and produce().