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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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::ESHandle< GEMGeometrygemGeom_
 
std::map< GEMDetId, EtaPartitionMaskgemMask_
 
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 23 of file GEMRecHitProducer.h.

Member Enumeration Documentation

◆ MaskSource

enum GEMRecHitProducer::MaskSource
strongprivate
Enumerator
File 
EventSetup 

Definition at line 52 of file GEMRecHitProducer.h.

Constructor & Destructor Documentation

◆ GEMRecHitProducer()

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

Constructor.

Definition at line 25 of file GEMRecHitProducer.cc.

26  : theGEMDigiToken(consumes<GEMDigiCollection>(config.getParameter<InputTag>("gemDigiLabel"))),
27  // Get the concrete reconstruction algo from the factory
28  theAlgo{GEMRecHitAlgoFactory::get()->create(config.getParameter<string>("recAlgo"),
29  config.getParameter<ParameterSet>("recAlgoConfig"))},
32  produces<GEMRecHitCollection>();
33 
34  // Get masked- and dead-strip information from file
35  applyMasking_ = config.getParameter<bool>("applyMasking");
36  if (applyMasking_) {
37  if (config.existsAs<edm::FileInPath>("maskFile")) {
39  std::ifstream inputFile(config.getParameter<edm::FileInPath>("maskFile").fullPath());
40  if (!inputFile) {
41  throw cms::Exception("GEMRecHitProducer") << "Masked Strips File cannot not be opened";
42  }
43  theGEMMaskedStripsObj = std::make_unique<GEMMaskedStrips>();
44  while (inputFile.good()) {
46  inputFile >> Item.rawId >> Item.strip;
47  if (inputFile.good())
48  theGEMMaskedStripsObj->fillMaskVec(Item);
49  }
50  inputFile.close();
51  }
52 
53  if (config.existsAs<edm::FileInPath>("deadFile")) {
55  std::ifstream inputFile(config.getParameter<edm::FileInPath>("deadFile").fullPath());
56  if (!inputFile) {
57  throw cms::Exception("GEMRecHitProducer") << "Dead Strips File cannot not be opened";
58  }
59  theGEMDeadStripsObj = std::make_unique<GEMDeadStrips>();
60  while (inputFile.good()) {
62  inputFile >> Item.rawId >> Item.strip;
63  if (inputFile.good())
64  theGEMDeadStripsObj->fillDeadVec(Item);
65  }
66  inputFile.close();
67  }
68  }
69 }

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 85 of file GEMRecHitProducer.cc.

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

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

◆ fillDescriptions()

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

Definition at line 73 of file GEMRecHitProducer.cc.

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

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), HLT_2018_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 128 of file GEMRecHitProducer.cc.

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

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 59 of file GEMRecHitProducer.h.

Referenced by beginRun(), and produce().

◆ deadSource_

enum GEMRecHitProducer::MaskSource GEMRecHitProducer::deadSource_
private

Referenced by beginRun().

◆ gemGeom_

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

Definition at line 54 of file GEMRecHitProducer.h.

Referenced by beginRun(), and produce().

◆ gemMask_

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

Definition at line 57 of file GEMRecHitProducer.h.

Referenced by beginRun(), and produce().

◆ maskSource_

enum GEMRecHitProducer::MaskSource GEMRecHitProducer::maskSource_
private

Referenced by beginRun().

◆ theAlgo

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

Definition at line 44 of file GEMRecHitProducer.h.

Referenced by produce().

◆ theGEMDeadStripsObj

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

Definition at line 50 of file GEMRecHitProducer.h.

Referenced by beginRun().

◆ theGEMDigiToken

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

Definition at line 41 of file GEMRecHitProducer.h.

Referenced by produce().

◆ theGEMMaskedStripsObj

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

Definition at line 47 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:59
GEMDeadStripsRcd
Definition: GEMDeadStripsRcd.h:6
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
GEMRecHitProducer::deadSource_
enum GEMRecHitProducer::MaskSource deadSource_
GEMMaskedStripsRcd
Definition: GEMMaskedStripsRcd.h:6
GEMMaskedStrips::MaskItem
Definition: GEMMaskedStrips.h:10
GEMEtaPartition
Definition: GEMEtaPartition.h:12
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GEMDeadStrips::DeadItem
Definition: GEMDeadStrips.h:10
GEMRecHitProducer::MaskSource::File
edm::Handle< GEMDigiCollection >
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
GEMRecHitProducer::gemGeom_
edm::ESHandle< GEMGeometry > gemGeom_
Definition: GEMRecHitProducer.h:54
EtaPartitionMask
std::bitset< maskSIZE > EtaPartitionMask
Definition: GEMEtaPartitionMask.h:8
GEMMaskedStrips::MaskItem::strip
int strip
Definition: GEMMaskedStrips.h:12
GEMDetId
Definition: GEMDetId.h:17
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:50
GEMRecHitProducer::theGEMMaskedStripsObj
std::unique_ptr< GEMMaskedStrips > theGEMMaskedStripsObj
Definition: GEMRecHitProducer.h:47
get
#define get
GEMRecHitProducer::gemMask_
std::map< GEMDetId, EtaPartitionMask > gemMask_
Definition: GEMRecHitProducer.h:57
VtxSmearedBeamProfile_cfi.File
File
Definition: VtxSmearedBeamProfile_cfi.py:30
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:246
GEMRecHitProducer::theGEMDigiToken
edm::EDGetTokenT< GEMDigiCollection > theGEMDigiToken
Definition: GEMRecHitProducer.h:41
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
GEMDeadStrips::DeadItem::rawId
int rawId
Definition: GEMDeadStrips.h:11
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
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:163
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:44