CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RPCRecHitProducer Class Reference

#include <RPCRecHitProducer.h>

Inheritance diagram for RPCRecHitProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void produce (edm::Event &event, const edm::EventSetup &setup) override
 The method which produces the rechits. More...
 
 RPCRecHitProducer (const edm::ParameterSet &config)
 Constructor. More...
 
virtual ~RPCRecHitProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string deadSource
 
std::vector
< RPCDeadStrips::DeadItem
DeadVec
 
std::string maskSource
 
std::vector
< RPCMaskedStrips::MaskItem
MaskVec
 
RPCDeadStripsRPCDeadStripsObj
 
RPCMaskedStripsRPCMaskedStripsObj
 
RPCRecHitBaseAlgotheAlgo
 
edm::EDGetTokenT
< RPCDigiCollection
theRPCDigiLabel
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Module for RPCRecHit production.

Author
M. Maggim – INFN Bari

Definition at line 41 of file RPCRecHitProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 36 of file RPCRecHitProducer.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, HLT_25ns14e33_v1_cff::deadSource, cmsRelvalreport::exit, personalPlayback::fp, edm::FileInPath::fullPath(), reco::get(), edm::ParameterSet::getParameter(), recoMuon::in, analyzePatCleaning_cfg::inputFile, HLT_25ns14e33_v1_cff::maskSource, RPCDeadStrips::DeadItem::rawId, RPCMaskedStrips::MaskItem::rawId, AlCaHLTBitMon_QueryRunRegistry::string, RPCMaskedStrips::MaskItem::strip, and RPCDeadStrips::DeadItem::strip.

36  {
37 
38  // Set verbose output
39 
40  produces<RPCRecHitCollection>();
41 
42  theRPCDigiLabel = consumes<RPCDigiCollection>(config.getParameter<InputTag>("rpcDigiLabel"));
43 
44  // Get the concrete reconstruction algo from the factory
45 
46  string theAlgoName = config.getParameter<string>("recAlgo");
47  theAlgo = RPCRecHitAlgoFactory::get()->create(theAlgoName,
48  config.getParameter<ParameterSet>("recAlgoConfig"));
49 
50  // Get masked- and dead-strip information
51 
53 
55 
56  maskSource = config.getParameter<std::string>("maskSource");
57 
58  if (maskSource == "File") {
59  edm::FileInPath fp = config.getParameter<edm::FileInPath>("maskvecfile");
60  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
61  if ( !inputFile ) {
62  std::cerr << "Masked Strips File cannot not be opened" << std::endl;
63  exit(1);
64  }
65  while ( inputFile.good() ) {
67  inputFile >> Item.rawId >> Item.strip;
68  if ( inputFile.good() ) MaskVec.push_back(Item);
69  }
70  inputFile.close();
71  }
72 
73  deadSource = config.getParameter<std::string>("deadSource");
74 
75  if (deadSource == "File") {
76  edm::FileInPath fp = config.getParameter<edm::FileInPath>("deadvecfile");
77  std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in);
78  if ( !inputFile ) {
79  std::cerr << "Dead Strips File cannot not be opened" << std::endl;
80  exit(1);
81  }
82  while ( inputFile.good() ) {
84  inputFile >> Item.rawId >> Item.strip;
85  if ( inputFile.good() ) DeadVec.push_back(Item);
86  }
87  inputFile.close();
88  }
89 
90 }
T getParameter(std::string const &) const
std::string maskSource
edm::EDGetTokenT< RPCDigiCollection > theRPCDigiLabel
std::string deadSource
RPCMaskedStrips * RPCMaskedStripsObj
std::vector< RPCDeadStrips::DeadItem > DeadVec
RPCRecHitBaseAlgo * theAlgo
RPCDeadStrips * RPCDeadStripsObj
std::vector< RPCMaskedStrips::MaskItem > MaskVec
std::string fullPath() const
Definition: FileInPath.cc:165
T get(const Candidate &c)
Definition: component.h:55
RPCRecHitProducer::~RPCRecHitProducer ( )
virtual

Destructor.

Definition at line 93 of file RPCRecHitProducer.cc.

93  {
94 
95  delete theAlgo;
96  delete RPCMaskedStripsObj;
97  delete RPCDeadStripsObj;
98 
99 }
RPCMaskedStrips * RPCMaskedStripsObj
RPCRecHitBaseAlgo * theAlgo
RPCDeadStrips * RPCDeadStripsObj

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 103 of file RPCRecHitProducer.cc.

References HLT_25ns14e33_v1_cff::deadSource, RPCDeadStrips::DeadVec, edm::EventSetup::get(), HLT_25ns14e33_v1_cff::maskSource, RPCMaskedStrips::MaskVec, edm::ESHandle< class >::product(), RPCMaskedStrips::MaskItem::rawId, RPCDeadStrips::DeadItem::rawId, RPCMaskedStrips::MaskItem::strip, and RPCDeadStrips::DeadItem::strip.

103  {
104 
105  // Getting the masked-strip information
106 
107  if ( maskSource == "EventSetup" ) {
108  edm::ESHandle<RPCMaskedStrips> readoutMaskedStrips;
109  setup.get<RPCMaskedStripsRcd>().get(readoutMaskedStrips);
110  const RPCMaskedStrips* tmp_obj = readoutMaskedStrips.product();
111  RPCMaskedStripsObj->MaskVec = tmp_obj->MaskVec;
112  delete tmp_obj;
113  }
114  else if ( maskSource == "File" ) {
115  std::vector<RPCMaskedStrips::MaskItem>::iterator posVec;
116  for ( posVec = MaskVec.begin(); posVec != MaskVec.end(); ++posVec ) {
118  Item.rawId = (*posVec).rawId;
119  Item.strip = (*posVec).strip;
120  RPCMaskedStripsObj->MaskVec.push_back(Item);
121  }
122  }
123 
124  // Getting the dead-strip information
125 
126  if ( deadSource == "EventSetup" ) {
127  edm::ESHandle<RPCDeadStrips> readoutDeadStrips;
128  setup.get<RPCDeadStripsRcd>().get(readoutDeadStrips);
129  const RPCDeadStrips* tmp_obj = readoutDeadStrips.product();
130  RPCDeadStripsObj->DeadVec = tmp_obj->DeadVec;
131  delete tmp_obj;
132  }
133  else if ( deadSource == "File" ) {
134  std::vector<RPCDeadStrips::DeadItem>::iterator posVec;
135  for ( posVec = DeadVec.begin(); posVec != DeadVec.end(); ++posVec ) {
137  Item.rawId = (*posVec).rawId;
138  Item.strip = (*posVec).strip;
139  RPCDeadStripsObj->DeadVec.push_back(Item);
140  }
141  }
142 
143 }
std::string maskSource
std::vector< MaskItem > MaskVec
std::string deadSource
RPCMaskedStrips * RPCMaskedStripsObj
std::vector< RPCDeadStrips::DeadItem > DeadVec
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
RPCDeadStrips * RPCDeadStripsObj
std::vector< DeadItem > DeadVec
Definition: RPCDeadStrips.h:28
std::vector< RPCMaskedStrips::MaskItem > MaskVec
void RPCRecHitProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

The method which produces the rechits.

Implements edm::stream::EDProducerBase.

Definition at line 147 of file RPCRecHitProducer.cc.

References edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::end(), edm::EventSetup::get(), i, DetId::rawId(), HLT_25ns14e33_v3_cff::recHits, and edm::OwnVector< T, P >::size().

147  {
148 
149  // Get the RPC Geometry
150 
151  ESHandle<RPCGeometry> rpcGeom;
152  setup.get<MuonGeometryRecord>().get(rpcGeom);
153 
154  // Get the digis from the event
155 
157  event.getByToken(theRPCDigiLabel,digis);
158 
159  // Pass the EventSetup to the algo
160 
161  theAlgo->setES(setup);
162 
163  // Create the pointer to the collection which will store the rechits
164 
165  auto_ptr<RPCRecHitCollection> recHitCollection(new RPCRecHitCollection());
166 
167  // Iterate through all digi collections ordered by LayerId
168 
170  for (rpcdgIt = digis->begin(); rpcdgIt != digis->end();
171  ++rpcdgIt){
172 
173  // The layerId
174  const RPCDetId& rpcId = (*rpcdgIt).first;
175 
176  // Get the GeomDet from the setup
177  const RPCRoll* roll = rpcGeom->roll(rpcId);
178  if (roll == 0){
179  edm::LogError("BadDigiInput")<<"Failed to find RPCRoll for ID "<<rpcId;
180  continue;
181  }
182 
183  // Get the iterators over the digis associated with this LayerId
184  const RPCDigiCollection::Range& range = (*rpcdgIt).second;
185 
186 
187  // Getting the roll mask, that includes dead strips, for the given RPCDet
188 
189  RollMask mask;
190  int rawId = rpcId.rawId();
191  int Size = RPCMaskedStripsObj->MaskVec.size();
192  for (int i = 0; i < Size; i++ ) {
193  if ( RPCMaskedStripsObj->MaskVec[i].rawId == rawId ) {
194  int bit = RPCMaskedStripsObj->MaskVec[i].strip;
195  mask.set(bit-1);
196  }
197  }
198 
199  Size = RPCDeadStripsObj->DeadVec.size();
200  for (int i = 0; i < Size; i++ ) {
201  if ( RPCDeadStripsObj->DeadVec[i].rawId == rawId ) {
202  int bit = RPCDeadStripsObj->DeadVec[i].strip;
203  mask.set(bit-1);
204  }
205  }
206 
207  // Call the reconstruction algorithm
208 
210  theAlgo->reconstruct(*roll, rpcId, range, mask);
211 
212  if(recHits.size() > 0) //FIXME: is it really needed?
213  recHitCollection->put(rpcId, recHits.begin(), recHits.end());
214  }
215 
216  event.put(recHitCollection);
217 
218 }
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< RPCDigiCollection > theRPCDigiLabel
std::vector< MaskItem > MaskVec
size_type size() const
Definition: OwnVector.h:254
iterator begin()
Definition: OwnVector.h:234
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
RPCMaskedStrips * RPCMaskedStripsObj
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the algo at each event.
std::bitset< maskSIZE > RollMask
Definition: RPCRollMask.h:8
iterator end()
Definition: OwnVector.h:239
edm::RangeMap< RPCDetId, edm::OwnVector< RPCRecHit, edm::ClonePolicy< RPCRecHit > >, edm::ClonePolicy< RPCRecHit > > RPCRecHitCollection
const T & get() const
Definition: EventSetup.h:56
RPCRecHitBaseAlgo * theAlgo
RPCDeadStrips * RPCDeadStripsObj
std::vector< DeadItem > DeadVec
Definition: RPCDeadStrips.h:28
std::pair< const_iterator, const_iterator > Range
virtual edm::OwnVector< RPCRecHit > reconstruct(const RPCRoll &roll, const RPCDetId &rpcId, const RPCDigiCollection::Range &digiRange, const RollMask &mask)
Build all hits in the range associated to the rpcId, at the 1st step.

Member Data Documentation

std::string RPCRecHitProducer::deadSource
private

Definition at line 72 of file RPCRecHitProducer.h.

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

Definition at line 75 of file RPCRecHitProducer.h.

std::string RPCRecHitProducer::maskSource
private

Definition at line 71 of file RPCRecHitProducer.h.

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

Definition at line 74 of file RPCRecHitProducer.h.

RPCDeadStrips* RPCRecHitProducer::RPCDeadStripsObj
private

Definition at line 68 of file RPCRecHitProducer.h.

RPCMaskedStrips* RPCRecHitProducer::RPCMaskedStripsObj
private

Definition at line 65 of file RPCRecHitProducer.h.

RPCRecHitBaseAlgo* RPCRecHitProducer::theAlgo
private

Definition at line 63 of file RPCRecHitProducer.h.

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

Definition at line 59 of file RPCRecHitProducer.h.