CMS 3D CMS Logo

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

#include <RPCRecHitProducer.h>

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

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the rechits. More...
 
 RPCRecHitProducer (const edm::ParameterSet &config)
 Constructor. More...
 
 ~RPCRecHitProducer () 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
 

Private Types

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

Private Attributes

enum RPCRecHitProducer::MaskSource deadSource_
 
std::vector< RPCDeadStrips::DeadItemDeadVec
 
enum RPCRecHitProducer::MaskSource maskSource_
 
std::vector< RPCMaskedStrips::MaskItemMaskVec
 
std::unique_ptr< RPCRecHitBaseAlgotheAlgo
 
std::unique_ptr< RPCDeadStripstheRPCDeadStripsObj
 
const edm::EDGetTokenT< RPCDigiCollectiontheRPCDigiLabel
 
std::unique_ptr< RPCMaskedStripstheRPCMaskedStripsObj
 

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 RPCRecHit production.

Author
M. Maggim – INFN Bari

Definition at line 19 of file RPCRecHitProducer.h.

Member Enumeration Documentation

◆ MaskSource

enum RPCRecHitProducer::MaskSource
strongprivate
Enumerator
File 
EventSetup 

Definition at line 47 of file RPCRecHitProducer.h.

Constructor & Destructor Documentation

◆ RPCRecHitProducer()

RPCRecHitProducer::RPCRecHitProducer ( const edm::ParameterSet config)

Constructor.

Definition at line 29 of file RPCRecHitProducer.cc.

30  : theRPCDigiLabel(consumes<RPCDigiCollection>(config.getParameter<InputTag>("rpcDigiLabel"))),
31  // Get the concrete reconstruction algo from the factory
32  theAlgo{RPCRecHitAlgoFactory::get()->create(config.getParameter<string>("recAlgo"),
33  config.getParameter<ParameterSet>("recAlgoConfig"))},
36  // Set verbose output
37  produces<RPCRecHitCollection>();
38 
39  // Get masked- and dead-strip information
40  theRPCMaskedStripsObj = std::make_unique<RPCMaskedStrips>();
41  theRPCDeadStripsObj = std::make_unique<RPCDeadStrips>();
42 
43  const string maskSource = config.getParameter<std::string>("maskSource");
44  if (maskSource == "File") {
46  edm::FileInPath fp = config.getParameter<edm::FileInPath>("maskvecfile");
47  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
48  if (!inputFile) {
49  std::cerr << "Masked Strips File cannot not be opened" << std::endl;
50  exit(1);
51  }
52  while (inputFile.good()) {
54  inputFile >> Item.rawId >> Item.strip;
55  if (inputFile.good())
56  MaskVec.push_back(Item);
57  }
58  inputFile.close();
59  }
60 
61  const string deadSource = config.getParameter<std::string>("deadSource");
62  if (deadSource == "File") {
64  edm::FileInPath fp = config.getParameter<edm::FileInPath>("deadvecfile");
65  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
66  if (!inputFile) {
67  std::cerr << "Dead Strips File cannot not be opened" << std::endl;
68  exit(1);
69  }
70  while (inputFile.good()) {
72  inputFile >> Item.rawId >> Item.strip;
73  if (inputFile.good())
74  DeadVec.push_back(Item);
75  }
76  inputFile.close();
77  }
78 }

References get.

◆ ~RPCRecHitProducer()

RPCRecHitProducer::~RPCRecHitProducer ( )
inlineoverride

Destructor.

Definition at line 25 of file RPCRecHitProducer.h.

25 {};

Member Function Documentation

◆ beginRun()

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

Definition at line 80 of file RPCRecHitProducer.cc.

80  {
81  // Getting the masked-strip information
83  edm::ESHandle<RPCMaskedStrips> readoutMaskedStrips;
84  setup.get<RPCMaskedStripsRcd>().get(readoutMaskedStrips);
85  const RPCMaskedStrips* tmp_obj = readoutMaskedStrips.product();
86  theRPCMaskedStripsObj->MaskVec = tmp_obj->MaskVec;
87  delete tmp_obj;
88  } else if (maskSource_ == MaskSource::File) {
89  std::vector<RPCMaskedStrips::MaskItem>::iterator posVec;
90  for (posVec = MaskVec.begin(); posVec != MaskVec.end(); ++posVec) {
92  Item.rawId = (*posVec).rawId;
93  Item.strip = (*posVec).strip;
94  theRPCMaskedStripsObj->MaskVec.push_back(Item);
95  }
96  }
97 
98  // Getting the dead-strip information
100  edm::ESHandle<RPCDeadStrips> readoutDeadStrips;
101  setup.get<RPCDeadStripsRcd>().get(readoutDeadStrips);
102  const RPCDeadStrips* tmp_obj = readoutDeadStrips.product();
103  theRPCDeadStripsObj->DeadVec = tmp_obj->DeadVec;
104  delete tmp_obj;
105  } else if (deadSource_ == MaskSource::File) {
106  std::vector<RPCDeadStrips::DeadItem>::iterator posVec;
107  for (posVec = DeadVec.begin(); posVec != DeadVec.end(); ++posVec) {
109  Item.rawId = (*posVec).rawId;
110  Item.strip = (*posVec).strip;
111  theRPCDeadStripsObj->DeadVec.push_back(Item);
112  }
113  }
114 }

References deadSource_, RPCDeadStrips::DeadVec, DeadVec, EventSetup, File, get, maskSource_, RPCMaskedStrips::MaskVec, MaskVec, edm::ESHandle< T >::product(), RPCMaskedStrips::MaskItem::rawId, RPCDeadStrips::DeadItem::rawId, singleTopDQM_cfi::setup, RPCDeadStrips::DeadItem::strip, RPCMaskedStrips::MaskItem::strip, theRPCDeadStripsObj, and theRPCMaskedStripsObj.

◆ produce()

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

The method which produces the rechits.

Definition at line 116 of file RPCRecHitProducer.cc.

116  {
117  // Get the RPC Geometry
118  ESHandle<RPCGeometry> rpcGeom;
119  setup.get<MuonGeometryRecord>().get(rpcGeom);
120 
121  // Get the digis from the event
123  event.getByToken(theRPCDigiLabel, digis);
124 
125  // Pass the EventSetup to the algo
126  theAlgo->setES(setup);
127 
128  // Create the pointer to the collection which will store the rechits
129  auto recHitCollection = std::make_unique<RPCRecHitCollection>();
130 
131  // Iterate through all digi collections ordered by LayerId
132 
133  for (auto rpcdgIt = digis->begin(); rpcdgIt != digis->end(); ++rpcdgIt) {
134  // The layerId
135  const RPCDetId& rpcId = (*rpcdgIt).first;
136 
137  // Get the GeomDet from the setup
138  const RPCRoll* roll = rpcGeom->roll(rpcId);
139  if (roll == nullptr) {
140  edm::LogError("BadDigiInput") << "Failed to find RPCRoll for ID " << rpcId;
141  continue;
142  }
143 
144  // Get the iterators over the digis associated with this LayerId
145  const RPCDigiCollection::Range& range = (*rpcdgIt).second;
146 
147  // Getting the roll mask, that includes dead strips, for the given RPCDet
148  RollMask mask;
149  const int rawId = rpcId.rawId();
150  for (const auto& tomask : theRPCMaskedStripsObj->MaskVec) {
151  if (tomask.rawId == rawId) {
152  const int bit = tomask.strip;
153  mask.set(bit - 1);
154  }
155  }
156 
157  for (const auto& tomask : theRPCDeadStripsObj->DeadVec) {
158  if (tomask.rawId == rawId) {
159  const int bit = tomask.strip;
160  mask.set(bit - 1);
161  }
162  }
163 
164  // Call the reconstruction algorithm
165  OwnVector<RPCRecHit> recHits = theAlgo->reconstruct(*roll, rpcId, range, mask);
166 
167  if (!recHits.empty()) //FIXME: is it really needed?
168  recHitCollection->put(rpcId, recHits.begin(), recHits.end());
169  }
170 
171  event.put(std::move(recHitCollection));
172 }

References get, eostools::move(), FastTimerService_cff::range, DetId::rawId(), FastTrackerRecHitMaskProducer_cfi::recHits, RPCGeometry::roll(), singleTopDQM_cfi::setup, theAlgo, theRPCDeadStripsObj, theRPCDigiLabel, and theRPCMaskedStripsObj.

Member Data Documentation

◆ deadSource_

enum RPCRecHitProducer::MaskSource RPCRecHitProducer::deadSource_
private

Referenced by beginRun().

◆ DeadVec

std::vector<RPCDeadStrips::DeadItem> RPCRecHitProducer::DeadVec
private

Definition at line 50 of file RPCRecHitProducer.h.

Referenced by beginRun().

◆ maskSource_

enum RPCRecHitProducer::MaskSource RPCRecHitProducer::maskSource_
private

Referenced by beginRun().

◆ MaskVec

std::vector<RPCMaskedStrips::MaskItem> RPCRecHitProducer::MaskVec
private

Definition at line 49 of file RPCRecHitProducer.h.

Referenced by beginRun().

◆ theAlgo

std::unique_ptr<RPCRecHitBaseAlgo> RPCRecHitProducer::theAlgo
private

Definition at line 39 of file RPCRecHitProducer.h.

Referenced by produce().

◆ theRPCDeadStripsObj

std::unique_ptr<RPCDeadStrips> RPCRecHitProducer::theRPCDeadStripsObj
private

Definition at line 44 of file RPCRecHitProducer.h.

Referenced by beginRun(), and produce().

◆ theRPCDigiLabel

const edm::EDGetTokenT<RPCDigiCollection> RPCRecHitProducer::theRPCDigiLabel
private

Definition at line 35 of file RPCRecHitProducer.h.

Referenced by produce().

◆ theRPCMaskedStripsObj

std::unique_ptr<RPCMaskedStrips> RPCRecHitProducer::theRPCMaskedStripsObj
private

Definition at line 41 of file RPCRecHitProducer.h.

Referenced by beginRun(), and produce().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
RPCRecHitProducer::deadSource_
enum RPCRecHitProducer::MaskSource deadSource_
RPCRoll
Definition: RPCRoll.h:12
RollMask
std::bitset< maskSIZE > RollMask
Definition: RPCRollMask.h:7
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
RPCMaskedStrips::MaskItem::strip
int strip
Definition: RPCMaskedStrips.h:13
RPCDeadStripsRcd
Definition: RPCDeadStripsRcd.h:24
RPCDeadStrips::DeadItem
Definition: RPCDeadStrips.h:11
RPCRecHitProducer::maskSource_
enum RPCRecHitProducer::MaskSource maskSource_
RPCDetId
Definition: RPCDetId.h:16
RPCRecHitProducer::theAlgo
std::unique_ptr< RPCRecHitBaseAlgo > theAlgo
Definition: RPCRecHitProducer.h:39
RPCDeadStrips::DeadItem::strip
int strip
Definition: RPCDeadStrips.h:13
RPCGeometry::roll
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
personalPlayback.fp
fp
Definition: personalPlayback.py:523
RPCDeadStrips
Definition: RPCDeadStrips.h:9
edm::Handle< RPCDigiCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
RPCRecHitProducer::DeadVec
std::vector< RPCDeadStrips::DeadItem > DeadVec
Definition: RPCRecHitProducer.h:50
RPCRecHitProducer::theRPCDeadStripsObj
std::unique_ptr< RPCDeadStrips > theRPCDeadStripsObj
Definition: RPCRecHitProducer.h:44
config
Definition: config.py:1
RPCMaskedStrips
Definition: RPCMaskedStrips.h:9
edm::FileInPath
Definition: FileInPath.h:64
File
Definition: File.h:11
RPCRecHitProducer::theRPCMaskedStripsObj
std::unique_ptr< RPCMaskedStrips > theRPCMaskedStripsObj
Definition: RPCRecHitProducer.h:41
edm::ESHandle
Definition: DTSurvey.h:22
RPCRecHitProducer::MaskSource::File
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
RPCDeadStrips::DeadVec
std::vector< DeadItem > DeadVec
Definition: RPCDeadStrips.h:24
edm::ParameterSet
Definition: ParameterSet.h:47
RPCDeadStrips::DeadItem::rawId
int rawId
Definition: RPCDeadStrips.h:12
HLT_FULL_cff.maskSource
maskSource
Definition: HLT_FULL_cff.py:9281
recoMuon::in
Definition: RecoMuonEnumerators.h:6
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
RPCRecHitProducer::MaskVec
std::vector< RPCMaskedStrips::MaskItem > MaskVec
Definition: RPCRecHitProducer.h:49
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
RPCRecHitProducer::MaskSource::EventSetup
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
RPCMaskedStrips::MaskVec
std::vector< MaskItem > MaskVec
Definition: RPCMaskedStrips.h:24
HLT_FULL_cff.deadSource
deadSource
Definition: HLT_FULL_cff.py:9280
MuonDigiCollection< RPCDetId, RPCDigi >::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
RPCMaskedStrips::MaskItem
Definition: RPCMaskedStrips.h:11
RPCMaskedStrips::MaskItem::rawId
int rawId
Definition: RPCMaskedStrips.h:12
RPCRecHitProducer::theRPCDigiLabel
const edm::EDGetTokenT< RPCDigiCollection > theRPCDigiLabel
Definition: RPCRecHitProducer.h:35
EventSetup
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
RPCMaskedStripsRcd
Definition: RPCMaskedStripsRcd.h:24
edm::OwnVector
Definition: OwnVector.h:24