CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
GEMRecHitProducer Class Reference

#include <GEMRecHitProducer.h>

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

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 GEMRecHitProducer (const edm::ParameterSet &config)
 Constructor. More...
 
void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the rechits. More...
 
 ~GEMRecHitProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

enum  MaskSource { MaskSource::File, MaskSource::EventSetup }
 

Private Attributes

bool applyMasking_
 
enum GEMRecHitProducer::MaskSource deadSource_
 
edm::ESGetToken< GEMDeadStrips, GEMDeadStripsRcddeadStripsToken_
 
edm::ESHandle< GEMGeometrygemGeom_
 
edm::ESGetToken< GEMGeometry, MuonGeometryRecordgemGeomToken_
 
std::map< GEMDetId, EtaPartitionMaskgemMask_
 
edm::ESGetToken< GEMMaskedStrips, GEMMaskedStripsRcdmaskedStripsToken_
 
enum GEMRecHitProducer::MaskSource maskSource_
 
std::unique_ptr< GEMRecHitBaseAlgotheAlgo
 
std::unique_ptr< GEMDeadStripstheGEMDeadStripsObj
 
edm::EDGetTokenT< GEMDigiCollectiontheGEMDigiToken
 
std::unique_ptr< GEMMaskedStripstheGEMMaskedStripsObj
 

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

Module for GEMRecHit production.

Author
M. Maggim – INFN Bari

Definition at line 27 of file GEMRecHitProducer.h.

Member Enumeration Documentation

◆ MaskSource

enum GEMRecHitProducer::MaskSource
strongprivate
Enumerator
File 
EventSetup 

Definition at line 56 of file GEMRecHitProducer.h.

Constructor & Destructor Documentation

◆ GEMRecHitProducer()

GEMRecHitProducer::GEMRecHitProducer ( const edm::ParameterSet config)

Constructor.

Definition at line 22 of file GEMRecHitProducer.cc.

23  : theGEMDigiToken(consumes<GEMDigiCollection>(config.getParameter<InputTag>("gemDigiLabel"))),
24  // Get the concrete reconstruction algo from the factory
25  theAlgo{GEMRecHitAlgoFactory::get()->create(config.getParameter<string>("recAlgo"),
26  config.getParameter<ParameterSet>("recAlgoConfig"))},
29  gemGeomToken_(esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>()) {
30  produces<GEMRecHitCollection>();
31 
32  // Get masked- and dead-strip information from file
33  applyMasking_ = config.getParameter<bool>("applyMasking");
34  if (applyMasking_) {
35  if (config.existsAs<edm::FileInPath>("maskFile")) {
37  std::ifstream inputFile(config.getParameter<edm::FileInPath>("maskFile").fullPath());
38  if (!inputFile) {
39  throw cms::Exception("GEMRecHitProducer") << "Masked Strips File cannot not be opened";
40  }
41  theGEMMaskedStripsObj = std::make_unique<GEMMaskedStrips>();
42  while (inputFile.good()) {
44  inputFile >> Item.rawId >> Item.strip;
45  if (inputFile.good())
46  theGEMMaskedStripsObj->fillMaskVec(Item);
47  }
48  inputFile.close();
49  }
50 
51  if (config.existsAs<edm::FileInPath>("deadFile")) {
53  std::ifstream inputFile(config.getParameter<edm::FileInPath>("deadFile").fullPath());
54  if (!inputFile) {
55  throw cms::Exception("GEMRecHitProducer") << "Dead Strips File cannot not be opened";
56  }
57  theGEMDeadStripsObj = std::make_unique<GEMDeadStrips>();
58  while (inputFile.good()) {
60  inputFile >> Item.rawId >> Item.strip;
61  if (inputFile.good())
62  theGEMDeadStripsObj->fillDeadVec(Item);
63  }
64  inputFile.close();
65  }
67  maskedStripsToken_ = esConsumes<GEMMaskedStrips, GEMMaskedStripsRcd, edm::Transition::BeginRun>();
68  }
70  deadStripsToken_ = esConsumes<GEMDeadStrips, GEMDeadStripsRcd, edm::Transition::BeginRun>();
71  }
72  }
73 }

References get.

◆ ~GEMRecHitProducer()

GEMRecHitProducer::~GEMRecHitProducer ( )
overridedefault

Destructor.

Member Function Documentation

◆ beginRun()

void GEMRecHitProducer::beginRun ( const edm::Run r,
const edm::EventSetup setup 
)
override

Definition at line 89 of file GEMRecHitProducer.cc.

89  {
90  // Get the GEM Geometry
91  gemGeom_ = setup.getHandle(gemGeomToken_);
92 
93  if (applyMasking_) {
94  // Getting the masked-strip information
96  edm::ESHandle<GEMMaskedStrips> readoutMaskedStrips = setup.getHandle(maskedStripsToken_);
97  theGEMMaskedStripsObj = std::make_unique<GEMMaskedStrips>(*readoutMaskedStrips.product());
98  }
99  // Getting the dead-strip information
101  edm::ESHandle<GEMDeadStrips> readoutDeadStrips = setup.getHandle(deadStripsToken_);
102  theGEMDeadStripsObj = std::make_unique<GEMDeadStrips>(*readoutDeadStrips.product());
103  }
104 
105  for (auto gems : gemGeom_->etaPartitions()) {
106  // Getting the EtaPartitionMask mask, that includes dead strips, for the given GEMDet
107  GEMDetId gemId = gems->id();
108  EtaPartitionMask mask;
109  const int rawId = gemId.rawId();
110  for (const auto& tomask : theGEMMaskedStripsObj->getMaskVec()) {
111  if (tomask.rawId == rawId) {
112  const int bit = tomask.strip;
113  mask.set(bit);
114  }
115  }
116  for (const auto& tomask : theGEMDeadStripsObj->getDeadVec()) {
117  if (tomask.rawId == rawId) {
118  const int bit = tomask.strip;
119  mask.set(bit);
120  }
121  }
122  // add to masking map if masking present in etaPartition
123  if (mask.any()) {
124  gemMask_.emplace(gemId, mask);
125  }
126  }
127  }
128 }

References applyMasking_, deadSource_, deadStripsToken_, GEMGeometry::etaPartitions(), EventSetup, gemGeom_, gemGeomToken_, gemMask_, maskedStripsToken_, maskSource_, edm::ESHandle< T >::product(), DetId::rawId(), singleTopDQM_cfi::setup, theGEMDeadStripsObj, and theGEMMaskedStripsObj.

◆ fillDescriptions()

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

Definition at line 77 of file GEMRecHitProducer.cc.

77  {
79  edm::ParameterSetDescription recAlgoConfigDesc;
80  desc.add<edm::ParameterSetDescription>("recAlgoConfig", recAlgoConfigDesc);
81  desc.add<std::string>("recAlgo", "GEMRecHitStandardAlgo");
82  desc.add<edm::InputTag>("gemDigiLabel", edm::InputTag("muonGEMDigis"));
83  desc.add<bool>("applyMasking", false);
84  desc.addOptional<edm::FileInPath>("maskFile");
85  desc.addOptional<edm::FileInPath>("deadFile");
86  descriptions.add("gemRecHitsDef", desc);
87 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

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

The method which produces the rechits.

Definition at line 130 of file GEMRecHitProducer.cc.

130  {
131  // Get the digis from the event
133  event.getByToken(theGEMDigiToken, digis);
134 
135  // Pass the EventSetup to the algo
136  theAlgo->setES(setup);
137 
138  // Create the pointer to the collection which will store the rechits
139  auto recHitCollection = std::make_unique<GEMRecHitCollection>();
140 
141  // Iterate through all digi collections ordered by LayerId
142  for (auto gemdgIt = digis->begin(); gemdgIt != digis->end(); ++gemdgIt) {
143  // The layerId
144  const GEMDetId& gemId = (*gemdgIt).first;
145 
146  // Get the GeomDet from the setup
147  const GEMEtaPartition* roll = gemGeom_->etaPartition(gemId);
148  if (roll == nullptr) {
149  edm::LogError("BadDigiInput") << "Failed to find GEMEtaPartition for ID " << gemId;
150  continue;
151  }
152 
153  // Get the iterators over the digis associated with this LayerId
154  const GEMDigiCollection::Range& range = (*gemdgIt).second;
155 
156  // get mask from map
157  EtaPartitionMask mask;
158  if (applyMasking_) {
159  auto gemmaskIt = gemMask_.find(gemId);
160  if (gemmaskIt != gemMask_.end())
161  mask = gemmaskIt->second;
162  }
163 
164  // Call the reconstruction algorithm
165  OwnVector<GEMRecHit> recHits = theAlgo->reconstruct(*roll, gemId, range, mask);
166 
167  if (!recHits.empty()) //FIXME: is it really needed?
168  recHitCollection->put(gemId, recHits.begin(), recHits.end());
169  }
170 
171  event.put(std::move(recHitCollection));
172 }

References applyMasking_, GEMGeometry::etaPartition(), gemGeom_, gemMask_, eostools::move(), FastTimerService_cff::range, FastTrackerRecHitMaskProducer_cfi::recHits, singleTopDQM_cfi::setup, theAlgo, and theGEMDigiToken.

Member Data Documentation

◆ applyMasking_

bool GEMRecHitProducer::applyMasking_
private

Definition at line 67 of file GEMRecHitProducer.h.

Referenced by beginRun(), and produce().

◆ deadSource_

enum GEMRecHitProducer::MaskSource GEMRecHitProducer::deadSource_
private

Referenced by beginRun().

◆ deadStripsToken_

edm::ESGetToken<GEMDeadStrips, GEMDeadStripsRcd> GEMRecHitProducer::deadStripsToken_
private

Definition at line 62 of file GEMRecHitProducer.h.

Referenced by beginRun().

◆ gemGeom_

edm::ESHandle<GEMGeometry> GEMRecHitProducer::gemGeom_
private

Definition at line 58 of file GEMRecHitProducer.h.

Referenced by beginRun(), and produce().

◆ gemGeomToken_

edm::ESGetToken<GEMGeometry, MuonGeometryRecord> GEMRecHitProducer::gemGeomToken_
private

Definition at line 60 of file GEMRecHitProducer.h.

Referenced by beginRun().

◆ gemMask_

std::map<GEMDetId, EtaPartitionMask> GEMRecHitProducer::gemMask_
private

Definition at line 65 of file GEMRecHitProducer.h.

Referenced by beginRun(), and produce().

◆ maskedStripsToken_

edm::ESGetToken<GEMMaskedStrips, GEMMaskedStripsRcd> GEMRecHitProducer::maskedStripsToken_
private

Definition at line 61 of file GEMRecHitProducer.h.

Referenced by beginRun().

◆ maskSource_

enum GEMRecHitProducer::MaskSource GEMRecHitProducer::maskSource_
private

Referenced by beginRun().

◆ theAlgo

std::unique_ptr<GEMRecHitBaseAlgo> GEMRecHitProducer::theAlgo
private

Definition at line 48 of file GEMRecHitProducer.h.

Referenced by produce().

◆ theGEMDeadStripsObj

std::unique_ptr<GEMDeadStrips> GEMRecHitProducer::theGEMDeadStripsObj
private

Definition at line 54 of file GEMRecHitProducer.h.

Referenced by beginRun().

◆ theGEMDigiToken

edm::EDGetTokenT<GEMDigiCollection> GEMRecHitProducer::theGEMDigiToken
private

Definition at line 45 of file GEMRecHitProducer.h.

Referenced by produce().

◆ theGEMMaskedStripsObj

std::unique_ptr<GEMMaskedStrips> GEMRecHitProducer::theGEMMaskedStripsObj
private

Definition at line 51 of file GEMRecHitProducer.h.

Referenced by beginRun().

GEMRecHitProducer::MaskSource::EventSetup
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
GEMRecHitProducer::applyMasking_
bool applyMasking_
Definition: GEMRecHitProducer.h:67
GEMRecHitProducer::deadSource_
enum GEMRecHitProducer::MaskSource deadSource_
GEMMaskedStrips::MaskItem
Definition: GEMMaskedStrips.h:10
GEMEtaPartition
Definition: GEMEtaPartition.h:12
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GEMDeadStrips::DeadItem
Definition: GEMDeadStrips.h:10
GEMRecHitProducer::MaskSource::File
edm::Handle< GEMDigiCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
config
Definition: config.py:1
edm::FileInPath
Definition: FileInPath.h:64
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ESHandle
Definition: DTSurvey.h:22
GEMRecHitProducer::gemGeomToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemGeomToken_
Definition: GEMRecHitProducer.h:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
edm::ParameterSet
Definition: ParameterSet.h:47
GEMRecHitProducer::gemGeom_
edm::ESHandle< GEMGeometry > gemGeom_
Definition: GEMRecHitProducer.h:58
GEMRecHitProducer::deadStripsToken_
edm::ESGetToken< GEMDeadStrips, GEMDeadStripsRcd > deadStripsToken_
Definition: GEMRecHitProducer.h:62
EtaPartitionMask
std::bitset< maskSIZE > EtaPartitionMask
Definition: GEMEtaPartitionMask.h:8
GEMMaskedStrips::MaskItem::strip
int strip
Definition: GEMMaskedStrips.h:12
GEMDetId
Definition: GEMDetId.h:18
GEMRecHitProducer::maskSource_
enum GEMRecHitProducer::MaskSource maskSource_
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
GEMRecHitProducer::theGEMDeadStripsObj
std::unique_ptr< GEMDeadStrips > theGEMDeadStripsObj
Definition: GEMRecHitProducer.h:54
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
GEMRecHitProducer::theGEMMaskedStripsObj
std::unique_ptr< GEMMaskedStrips > theGEMMaskedStripsObj
Definition: GEMRecHitProducer.h:51
get
#define get
GEMRecHitProducer::gemMask_
std::map< GEMDetId, EtaPartitionMask > gemMask_
Definition: GEMRecHitProducer.h:65
VtxSmearedBeamProfile_cfi.File
File
Definition: VtxSmearedBeamProfile_cfi.py:30
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Exception
Definition: hltDiff.cc:245
GEMRecHitProducer::theGEMDigiToken
edm::EDGetTokenT< GEMDigiCollection > theGEMDigiToken
Definition: GEMRecHitProducer.h:45
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
GEMGeometry::etaPartitions
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40
EventSetup
GEMRecHitProducer::maskedStripsToken_
edm::ESGetToken< GEMMaskedStrips, GEMMaskedStripsRcd > maskedStripsToken_
Definition: GEMRecHitProducer.h:61
GEMDeadStrips::DeadItem::rawId
int rawId
Definition: GEMDeadStrips.h:11
edm::InputTag
Definition: InputTag.h:15
GEMDeadStrips::DeadItem::strip
int strip
Definition: GEMDeadStrips.h:12
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
edm::OwnVector
Definition: OwnVector.h:24
GEMMaskedStrips::MaskItem::rawId
int rawId
Definition: GEMMaskedStrips.h:11
GEMGeometry::etaPartition
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:77
GEMRecHitProducer::theAlgo
std::unique_ptr< GEMRecHitBaseAlgo > theAlgo
Definition: GEMRecHitProducer.h:48