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=default
 
- 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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::ESGetToken< TotemAnalysisMask, TotemReadoutRcdtokenAnalysisMask
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 52 of file RPDigiProducer.cc.

Member Typedef Documentation

◆ simhit_map

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

Definition at line 67 of file RPDigiProducer.cc.

◆ simhit_map_iterator

typedef simhit_map::iterator RPDigiProducer::simhit_map_iterator
private

Definition at line 68 of file RPDigiProducer.cc.

Constructor & Destructor Documentation

◆ RPDigiProducer()

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

Definition at line 90 of file RPDigiProducer.cc.

References edm::EDConsumerBase::esConsumes(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), HLT_2022v14_cff::InputTag, RP_hit_containers_, simulateDeadChannels, tokenAnalysisMask, tokenCrossingFrameTotemRP, and verbosity_.

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  if (simulateDeadChannels) {
107  }
108 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::ESGetToken< TotemAnalysisMask, TotemReadoutRcd > tokenAnalysisMask
edm::ParameterSet conf_
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFrameTotemRP
std::vector< std::string > RP_hit_containers_

◆ ~RPDigiProducer()

RPDigiProducer::~RPDigiProducer ( )
overridedefault

Member Function Documentation

◆ beginRun()

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

Reimplemented from edm::EDProducer.

Definition at line 200 of file RPDigiProducer.cc.

References deadChannelsManager, edm::EventSetup::getData(), simulateDeadChannels, and tokenAnalysisMask.

200  {
201  // get analysis mask to mask channels
202  if (simulateDeadChannels) {
203  //set analysisMask in deadChannelsManager
205  }
206 }
edm::ESGetToken< TotemAnalysisMask, TotemReadoutRcd > tokenAnalysisMask
bool getData(T &iHolder) const
Definition: EventSetup.h:122
DeadChannelsManager deadChannelsManager

◆ convertRPStripDetSet()

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

Definition at line 208 of file RPDigiProducer.cc.

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

Referenced by produce().

208  {
209  edm::DetSet<TotemRPDigi> rpdigi_detset(rpstrip_detset.detId());
210  rpdigi_detset.reserve(rpstrip_detset.size());
211 
212  for (std::vector<TotemRPDigi>::const_iterator stripIterator = rpstrip_detset.data.begin();
213  stripIterator < rpstrip_detset.data.end();
214  ++stripIterator) {
215  rpdigi_detset.push_back(TotemRPDigi(stripIterator->stripNumber()));
216  }
217 
218  return rpdigi_detset;
219 }
det_id_type detId() const
Definition: DetSet.h:74
void reserve(size_t s)
Definition: DetSet.h:65
collection_type data
Definition: DetSet.h:80
size_type size() const
Definition: DetSet.h:61

◆ fillDescriptions()

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

Definition at line 221 of file RPDigiProducer.cc.

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

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

◆ produce()

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

Implements edm::EDProducer.

Definition at line 115 of file RPDigiProducer.cc.

References MixCollection< T >::MixItr::bunch(), cuy::col, conf_, convertRPStripDetSet(), submitPVResolutionJobs::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_.

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

Member Data Documentation

◆ conf_

edm::ParameterSet RPDigiProducer::conf_
private

Definition at line 70 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 79 of file RPDigiProducer.cc.

Referenced by beginRun().

◆ rndEngine_

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

Definition at line 73 of file RPDigiProducer.cc.

Referenced by produce().

◆ RP_hit_containers_

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

Definition at line 66 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 84 of file RPDigiProducer.cc.

Referenced by beginRun(), and RPDigiProducer().

◆ theAlgoMap

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

Definition at line 71 of file RPDigiProducer.cc.

Referenced by produce().

◆ tokenAnalysisMask

edm::ESGetToken<TotemAnalysisMask, TotemReadoutRcd> RPDigiProducer::tokenAnalysisMask
private

Definition at line 87 of file RPDigiProducer.cc.

Referenced by beginRun(), and RPDigiProducer().

◆ tokenCrossingFrameTotemRP

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

Definition at line 86 of file RPDigiProducer.cc.

Referenced by RPDigiProducer().

◆ verbosity_

int RPDigiProducer::verbosity_
private

Definition at line 74 of file RPDigiProducer.cc.

Referenced by produce(), and RPDigiProducer().