CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
RPDigiProducer Class Reference
Inheritance diagram for RPDigiProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 RPDigiProducer (const edm::ParameterSet &)
 
 ~RPDigiProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Types

typedef std::map< unsigned int, std::vector< PSimHit > > simhit_map
 
typedef simhit_map::iterator simhit_map_iterator
 

Private Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
edm::DetSet< TotemRPDigiconvertRPStripDetSet (const edm::DetSet< TotemRPDigi > &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ParameterSet conf_
 
DeadChannelsManager deadChannelsManager
 
CLHEP::HepRandomEngine * rndEngine_ = nullptr
 
std::vector< std::string > RP_hit_containers_
 
bool simulateDeadChannels
 
std::map< RPDetId, std::unique_ptr< RPDetDigitizer > > theAlgoMap
 
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFrameTotemRP
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 53 of file RPDigiProducer.cc.

Member Typedef Documentation

◆ simhit_map

typedef std::map<unsigned int, std::vector<PSimHit> > RPDigiProducer::simhit_map
private

Definition at line 68 of file RPDigiProducer.cc.

◆ simhit_map_iterator

typedef simhit_map::iterator RPDigiProducer::simhit_map_iterator
private

Definition at line 69 of file RPDigiProducer.cc.

Constructor & Destructor Documentation

◆ RPDigiProducer()

RPDigiProducer::RPDigiProducer ( const edm::ParameterSet conf)
explicit

Definition at line 90 of file RPDigiProducer.cc.

90  : conf_(conf) {
91  //now do what ever other initialization is needed
92  produces<edm::DetSetVector<TotemRPDigi>>();
93 
94  // register data to consume
95  tokenCrossingFrameTotemRP = consumes<CrossingFrame<PSimHit>>(edm::InputTag("mix", "g4SimHitsTotemHitsRP", ""));
96 
97  RP_hit_containers_ = conf.getParameter<std::vector<std::string>>("ROUList");
98  verbosity_ = conf.getParameter<int>("RPVerbosity");
99 
100  simulateDeadChannels = false;
101  if (conf.exists(
102  "simulateDeadChannels")) { //check if "simulateDeadChannels" variable is defined in configuration file
103  simulateDeadChannels = conf.getParameter<bool>("simulateDeadChannels");
104  }
105 }

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), HLT_2018_cff::InputTag, RP_hit_containers_, simulateDeadChannels, tokenCrossingFrameTotemRP, and verbosity_.

◆ ~RPDigiProducer()

RPDigiProducer::~RPDigiProducer ( )
override

Definition at line 107 of file RPDigiProducer.cc.

107  {
108  // do anything here that needs to be done at desctruction time
109  // (e.g. close files, deallocate resources etc.)
110 }

Member Function Documentation

◆ beginRun()

void RPDigiProducer::beginRun ( const edm::Run beginrun,
const edm::EventSetup es 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 202 of file RPDigiProducer.cc.

202  {
203  // get analysis mask to mask channels
204  if (simulateDeadChannels) {
206  es.get<TotemReadoutRcd>().get(analysisMask);
207  deadChannelsManager = DeadChannelsManager(analysisMask); //set analysisMask in deadChannelsManager
208  }
209 }

References deadChannelsManager, edm::EventSetup::get(), get, and simulateDeadChannels.

◆ convertRPStripDetSet()

edm::DetSet< TotemRPDigi > RPDigiProducer::convertRPStripDetSet ( const edm::DetSet< TotemRPDigi > &  rpstrip_detset)
private

Definition at line 211 of file RPDigiProducer.cc.

211  {
212  edm::DetSet<TotemRPDigi> rpdigi_detset(rpstrip_detset.detId());
213  rpdigi_detset.reserve(rpstrip_detset.size());
214 
215  for (std::vector<TotemRPDigi>::const_iterator stripIterator = rpstrip_detset.data.begin();
216  stripIterator < rpstrip_detset.data.end();
217  ++stripIterator) {
218  rpdigi_detset.push_back(TotemRPDigi(stripIterator->stripNumber()));
219  }
220 
221  return rpdigi_detset;
222 }

References edm::DetSet< T >::data, edm::DetSet< T >::detId(), edm::DetSet< T >::reserve(), and edm::DetSet< T >::size().

Referenced by produce().

◆ fillDescriptions()

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

Definition at line 224 of file RPDigiProducer.cc.

224  {
225  //RPSiDetDigitizer
226  //all distances in [mm]
228  desc.add<bool>("RPLandauFluctuations", true);
229  desc.add<bool>("RPDisplacementOn", false);
230  desc.add<int>("RPVerbosity", 0);
231  desc.add<double>("RPVFATThreshold", 9000.0);
232  desc.add<double>("RPTopEdgePosition", 1.5);
233  desc.add<double>("RPActiveEdgeSmearing", 0.013);
234  desc.add<double>("RPEquivalentNoiseCharge300um", 1000.0);
235  desc.add<int>("RPVFATTriggerMode", 2);
236  desc.add<std::vector<double>>("RPInterStripSmearing",
237  {
238  0.011,
239  });
240  desc.add<double>("RPSharingSigmas", 5.0); //how many sigmas taken into account for the edges and inter strips
241  desc.add<double>("RPGeVPerElectron", 3.61e-09);
242  desc.add<double>("RPActiveEdgePosition", 0.034); //from the physical edge
243  desc.add<bool>("RPDeadStripSimulationOn", false);
244  desc.add<std::vector<std::string>>("ROUList",
245  {
246  "TotemHitsRP",
247  });
248  desc.add<bool>("RPNoNoise", false);
249  desc.add<bool>("RPDigiSimHitRelationsPresistence", false); //save links betweend digi, clusters and OSCAR/Geant4 hits
250  desc.add<std::string>("mixLabel", "mix");
251  desc.add<int>("RPChargeDivisionsPerThickness", 5);
252  desc.add<double>("RPDeltaProductionCut", 0.120425); //[MeV]
253  desc.add<double>("RPBottomEdgePosition", 1.5);
254  desc.add<double>("RPBottomEdgeSmearing", 0.011);
255  desc.add<double>("RPTopEdgeSmearing", 0.011);
256  desc.add<std::string>("InputCollection", "g4SimHitsTotemHitsRP");
257  desc.add<double>("RPInterStripCoupling",
258  1.0); //fraction of charge going to the strip, the missing part is taken by its neighbours
259  desc.add<double>("RPDeadStripProbability", 0.001);
260  desc.add<int>("RPChargeDivisionsPerStrip", 15);
261  descriptions.add("RPSiDetDigitizer", desc);
262 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

void RPDigiProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 116 of file RPDigiProducer.cc.

116  {
117  using namespace edm;
118 
119  // initialize random engine
120  if (!rndEngine_) {
122  if (!rng.isAvailable()) {
123  throw cms::Exception("Configuration")
124  << "This class requires the RandomNumberGeneratorService\n"
125  "which is not present in the configuration file. You must add the service\n"
126  "in the configuration file or remove the modules that require it.";
127  }
128  rndEngine_ = &(rng->getEngine(iEvent.streamID()));
129  }
130 
131  // Step A: Get Inputs
133  iEvent.getByLabel("mix", "g4SimHitsTotemHitsRP", cf);
134 
135  if (verbosity_) {
136  edm::LogInfo("RPDigiProducer") << "\n\n=================== Starting SimHit access"
137  << " ==================="
138  << "\n";
139 
140  MixCollection<PSimHit> col{cf.product(), std::pair(-0, 0)};
142  int count = 0;
143  for (cfi = col.begin(); cfi != col.end(); cfi++) {
144  edm::LogInfo("RPDigiProducer") << " Hit " << count << " has tof " << cfi->timeOfFlight() << " trackid "
145  << cfi->trackId() << " bunchcr " << cfi.bunch() << " trigger " << cfi.getTrigger()
146  << ", from EncodedEventId: " << cfi->eventId().bunchCrossing() << " "
147  << cfi->eventId().event() << " bcr from MixCol " << cfi.bunch() << "\n";
148  edm::LogInfo("RPDigiProducer") << " Hit: " << (*cfi) << "\n";
149  count++;
150  }
151  }
152 
153  MixCollection<PSimHit> allRPHits{cf.product(), std::pair(0, 0)};
154 
155  if (verbosity_)
156  edm::LogInfo("RPDigiProducer") << "Input MixCollection size = " << allRPHits.size() << "\n";
157 
158  //Loop on PSimHit
159  simhit_map simHitMap_;
160  simHitMap_.clear();
161 
163  for (isim = allRPHits.begin(); isim != allRPHits.end(); ++isim) {
164  simHitMap_[(*isim).detUnitId()].push_back((*isim));
165  }
166 
167  // Step B: LOOP on hits in event
168  std::vector<edm::DetSet<TotemRPDigi>> DigiVector;
169  DigiVector.reserve(400);
170  DigiVector.clear();
171 
172  for (simhit_map_iterator it = simHitMap_.begin(); it != simHitMap_.end(); ++it) {
173  edm::DetSet<TotemRPDigi> digi_collector(it->first);
174 
175  if (theAlgoMap.find(it->first) == theAlgoMap.end()) {
176  theAlgoMap[it->first] =
177  std::unique_ptr<RPDetDigitizer>(new RPDetDigitizer(conf_, *rndEngine_, it->first, iSetup));
178  }
179 
180  std::vector<int> input_links;
181  simromanpot::DigiPrimaryMapType output_digi_links;
182 
183  (theAlgoMap.find(it->first)->second)
184  ->run(simHitMap_[it->first], input_links, digi_collector.data, output_digi_links);
185 
186  if (!digi_collector.data.empty()) {
187  DigiVector.push_back(convertRPStripDetSet(digi_collector));
188  }
189  }
190 
191  // Step C: create empty output collection
192  std::unique_ptr<edm::DetSetVector<TotemRPDigi>> digi_output(new edm::DetSetVector<TotemRPDigi>(DigiVector));
193 
194  if (verbosity_) {
195  edm::LogInfo("RPDigiProducer") << "digi_output->size()=" << digi_output->size() << "\n";
196  }
197  // Step D: write output to file
198  iEvent.put(std::move(digi_output));
199 }

References MixCollection< T >::MixItr::bunch(), cuy::col, conf_, convertRPStripDetSet(), KineDebug3::count(), edm::DetSet< T >::data, Exception, edm::RandomNumberGenerator::getEngine(), MixCollection< T >::MixItr::getTrigger(), iEvent, edm::Service< T >::isAvailable(), eostools::move(), edm::Handle< T >::product(), rndEngine_, writedatasetfile::run, theAlgoMap, and verbosity_.

Member Data Documentation

◆ conf_

edm::ParameterSet RPDigiProducer::conf_
private

Definition at line 71 of file RPDigiProducer.cc.

Referenced by produce().

◆ deadChannelsManager

DeadChannelsManager RPDigiProducer::deadChannelsManager
private

this variable answers the question whether given channel is dead or not

Definition at line 80 of file RPDigiProducer.cc.

Referenced by beginRun().

◆ rndEngine_

CLHEP::HepRandomEngine* RPDigiProducer::rndEngine_ = nullptr
private

Definition at line 74 of file RPDigiProducer.cc.

Referenced by produce().

◆ RP_hit_containers_

std::vector<std::string> RPDigiProducer::RP_hit_containers_
private

Definition at line 67 of file RPDigiProducer.cc.

Referenced by RPDigiProducer().

◆ simulateDeadChannels

bool RPDigiProducer::simulateDeadChannels
private

this variable indicates whether we take into account dead channels or simulate as if all channels work ok (by default we do not simulate dead channels)

Definition at line 85 of file RPDigiProducer.cc.

Referenced by beginRun(), and RPDigiProducer().

◆ theAlgoMap

std::map<RPDetId, std::unique_ptr<RPDetDigitizer> > RPDigiProducer::theAlgoMap
private

Definition at line 72 of file RPDigiProducer.cc.

Referenced by produce().

◆ tokenCrossingFrameTotemRP

edm::EDGetTokenT<CrossingFrame<PSimHit> > RPDigiProducer::tokenCrossingFrameTotemRP
private

Definition at line 87 of file RPDigiProducer.cc.

Referenced by RPDigiProducer().

◆ verbosity_

int RPDigiProducer::verbosity_
private

Definition at line 75 of file RPDigiProducer.cc.

Referenced by produce(), and RPDigiProducer().

edm::DetSetVector
Definition: DetSetVector.h:61
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
simromanpot::DigiPrimaryMapType
std::vector< std::vector< std::pair< int, double > > > DigiPrimaryMapType
Definition: RPSimTypes.h:22
RPDigiProducer::theAlgoMap
std::map< RPDetId, std::unique_ptr< RPDetDigitizer > > theAlgoMap
Definition: RPDigiProducer.cc:72
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::DetSet::size
size_type size() const
Definition: DetSet.h:61
edm::DetSet
Definition: DetSet.h:23
edm
HLT enums.
Definition: AlignableModifier.h:19
cuy.col
col
Definition: cuy.py:1010
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
RPDetDigitizer
Definition: RPDetDigitizer.h:24
RPDigiProducer::simhit_map
std::map< unsigned int, std::vector< PSimHit > > simhit_map
Definition: RPDigiProducer.cc:68
TotemReadoutRcd
EventSetup record for TOTEM readout-related information.
Definition: TotemReadoutRcd.h:16
edm::Handle
Definition: AssociativeIterator.h:50
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
MixCollection::MixItr
Definition: MixCollection.h:62
RPDigiProducer::conf_
edm::ParameterSet conf_
Definition: RPDigiProducer.cc:71
DeadChannelsManager
Definition: DeadChannelsManager.h:14
MixCollection::MixItr::bunch
int bunch() const
Definition: MixCollection.h:91
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MixCollection
Definition: MixCollection.h:11
TotemRPDigi
Definition: TotemRPDigi.h:15
MixCollection::MixItr::getTrigger
bool getTrigger() const
Definition: MixCollection.h:98
RPDigiProducer::verbosity_
int verbosity_
Definition: RPDigiProducer.cc:75
edm::ESHandle< TotemAnalysisMask >
RPDigiProducer::RP_hit_containers_
std::vector< std::string > RP_hit_containers_
Definition: RPDigiProducer.cc:67
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
RPDigiProducer::simulateDeadChannels
bool simulateDeadChannels
Definition: RPDigiProducer.cc:85
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
RPDigiProducer::simhit_map_iterator
simhit_map::iterator simhit_map_iterator
Definition: RPDigiProducer.cc:69
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
RPDigiProducer::rndEngine_
CLHEP::HepRandomEngine * rndEngine_
Definition: RPDigiProducer.cc:74
edm::DetSet::detId
det_id_type detId() const
Definition: DetSet.h:74
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::DetSet::reserve
void reserve(size_t s)
Definition: DetSet.h:65
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
RPDigiProducer::deadChannelsManager
DeadChannelsManager deadChannelsManager
Definition: RPDigiProducer.cc:80
Exception
Definition: hltDiff.cc:246
edm::DetSet::data
collection_type data
Definition: DetSet.h:80
RPDigiProducer::convertRPStripDetSet
edm::DetSet< TotemRPDigi > convertRPStripDetSet(const edm::DetSet< TotemRPDigi > &)
Definition: RPDigiProducer.cc:211
RPDigiProducer::tokenCrossingFrameTotemRP
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFrameTotemRP
Definition: RPDigiProducer.cc:87