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::stream::EDProducer<>

Public Member Functions

 RPDigiProducer (const edm::ParameterSet &)
 
 ~RPDigiProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

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::ESGetToken< CTPPSRPAlignmentCorrectionsData, VeryForwardMisalignedGeometryRecordalignmentToken
 
edm::ParameterSet conf_
 
DeadChannelsManager deadChannelsManager
 
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecordgeomToken
 
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::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 55 of file RPDigiProducer.cc.

Member Typedef Documentation

◆ simhit_map

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

Definition at line 70 of file RPDigiProducer.cc.

◆ simhit_map_iterator

typedef simhit_map::iterator RPDigiProducer::simhit_map_iterator
private

Definition at line 71 of file RPDigiProducer.cc.

Constructor & Destructor Documentation

◆ RPDigiProducer()

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

Definition at line 95 of file RPDigiProducer.cc.

References alignmentToken, deDxTools::esConsumes(), edm::ParameterSet::exists(), geomToken, edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, RP_hit_containers_, simulateDeadChannels, tokenAnalysisMask, tokenCrossingFrameTotemRP, and verbosity_.

95  : conf_(conf) {
96  //now do what ever other initialization is needed
97  produces<edm::DetSetVector<TotemRPDigi>>();
98 
99  // register data to consume
100  tokenCrossingFrameTotemRP = consumes<CrossingFrame<PSimHit>>(edm::InputTag("mix", "g4SimHitsTotemHitsRP", ""));
101 
102  RP_hit_containers_ = conf.getParameter<std::vector<std::string>>("ROUList");
103  verbosity_ = conf.getParameter<int>("RPVerbosity");
104 
105  simulateDeadChannels = false;
106  if (conf.exists(
107  "simulateDeadChannels")) { //check if "simulateDeadChannels" variable is defined in configuration file
108  simulateDeadChannels = conf.getParameter<bool>("simulateDeadChannels");
109  }
110  if (simulateDeadChannels) {
112  }
114  geomToken = esConsumes();
115 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, VeryForwardMisalignedGeometryRecord > alignmentToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomToken
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 
)
overrideprivate

Definition at line 213 of file RPDigiProducer.cc.

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

213  {
214  // get analysis mask to mask channels
215  if (simulateDeadChannels) {
216  //set analysisMask in deadChannelsManager
218  }
219 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< TotemAnalysisMask, TotemReadoutRcd > tokenAnalysisMask
DeadChannelsManager deadChannelsManager

◆ convertRPStripDetSet()

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

Definition at line 221 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().

221  {
222  edm::DetSet<TotemRPDigi> rpdigi_detset(rpstrip_detset.detId());
223  rpdigi_detset.reserve(rpstrip_detset.size());
224 
225  for (std::vector<TotemRPDigi>::const_iterator stripIterator = rpstrip_detset.data.begin();
226  stripIterator < rpstrip_detset.data.end();
227  ++stripIterator) {
228  rpdigi_detset.push_back(TotemRPDigi(stripIterator->stripNumber()));
229  }
230 
231  return rpdigi_detset;
232 }
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 234 of file RPDigiProducer.cc.

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

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

◆ produce()

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

Definition at line 122 of file RPDigiProducer.cc.

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

122  {
123  using namespace edm;
124 
125  // initialize random engine
126  if (!rndEngine_) {
128  if (!rng.isAvailable()) {
129  throw cms::Exception("Configuration")
130  << "This class requires the RandomNumberGeneratorService\n"
131  "which is not present in the configuration file. You must add the service\n"
132  "in the configuration file or remove the modules that require it.";
133  }
134  rndEngine_ = &(rng->getEngine(iEvent.streamID()));
135  }
136 
137  // Step A: Get Inputs
139  iEvent.getByLabel("mix", "g4SimHitsTotemHitsRP", cf);
140 
141  if (verbosity_) {
142  edm::LogInfo("RPDigiProducer") << "\n\n=================== Starting SimHit access"
143  << " ==================="
144  << "\n";
145 
146  MixCollection<PSimHit> col{cf.product(), std::pair(-0, 0)};
148  int count = 0;
149  for (cfi = col.begin(); cfi != col.end(); cfi++) {
150  edm::LogInfo("RPDigiProducer") << " Hit " << count << " has tof " << cfi->timeOfFlight() << " trackid "
151  << cfi->trackId() << " bunchcr " << cfi.bunch() << " trigger " << cfi.getTrigger()
152  << ", from EncodedEventId: " << cfi->eventId().bunchCrossing() << " "
153  << cfi->eventId().event() << " bcr from MixCol " << cfi.bunch() << "\n";
154  edm::LogInfo("RPDigiProducer") << " Hit: " << (*cfi) << "\n";
155  count++;
156  }
157  }
158 
159  MixCollection<PSimHit> allRPHits{cf.product(), std::pair(0, 0)};
160 
161  if (verbosity_)
162  edm::LogInfo("RPDigiProducer") << "Input MixCollection size = " << allRPHits.size() << "\n";
163 
164  //Loop on PSimHit
165  simhit_map simHitMap_;
166  simHitMap_.clear();
167 
169  for (isim = allRPHits.begin(); isim != allRPHits.end(); ++isim) {
170  simHitMap_[(*isim).detUnitId()].push_back((*isim));
171  }
172 
173  // Step B: LOOP on hits in event
174  std::vector<edm::DetSet<TotemRPDigi>> DigiVector;
175  DigiVector.reserve(400);
176  DigiVector.clear();
177 
178  CTPPSRPAlignmentCorrectionsData const* alignments = nullptr;
179  if (auto rec = iSetup.tryToGet<VeryForwardMisalignedGeometryRecord>()) {
180  alignments = &iSetup.getData(alignmentToken);
181  }
182  auto const& geom = iSetup.getData(geomToken);
183 
184  for (simhit_map_iterator it = simHitMap_.begin(); it != simHitMap_.end(); ++it) {
185  edm::DetSet<TotemRPDigi> digi_collector(it->first);
186 
187  if (theAlgoMap.find(it->first) == theAlgoMap.end()) {
188  theAlgoMap[it->first] = std::make_unique<RPDetDigitizer>(conf_, *rndEngine_, it->first, alignments, geom);
189  }
190 
191  std::vector<int> input_links;
192  simromanpot::DigiPrimaryMapType output_digi_links;
193 
194  (theAlgoMap.find(it->first)->second)
195  ->run(simHitMap_[it->first], input_links, digi_collector.data, output_digi_links);
196 
197  if (!digi_collector.data.empty()) {
198  DigiVector.push_back(convertRPStripDetSet(digi_collector));
199  }
200  }
201 
202  // Step C: create empty output collection
203  std::unique_ptr<edm::DetSetVector<TotemRPDigi>> digi_output(new edm::DetSetVector<TotemRPDigi>(DigiVector));
204 
205  if (verbosity_) {
206  edm::LogInfo("RPDigiProducer") << "digi_output->size()=" << digi_output->size() << "\n";
207  }
208  // Step D: write output to file
209  iEvent.put(std::move(digi_output));
210 }
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, VeryForwardMisalignedGeometryRecord > alignmentToken
std::map< unsigned int, std::vector< PSimHit > > simhit_map
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomToken
edm::DetSet< TotemRPDigi > convertRPStripDetSet(const edm::DetSet< TotemRPDigi > &)
T const * product() const
Definition: Handle.h:70
std::optional< T > tryToGet() const
Definition: EventSetup.h:100
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
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
HLT enums.
Event setup record containing the misaligned geometry information. It is used for alignment studies o...
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

◆ alignmentToken

Definition at line 91 of file RPDigiProducer.cc.

Referenced by produce(), and RPDigiProducer().

◆ conf_

edm::ParameterSet RPDigiProducer::conf_
private

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

Referenced by beginRun().

◆ geomToken

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> RPDigiProducer::geomToken
private

Definition at line 92 of file RPDigiProducer.cc.

Referenced by produce(), and RPDigiProducer().

◆ rndEngine_

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

Definition at line 76 of file RPDigiProducer.cc.

Referenced by produce().

◆ RP_hit_containers_

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

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

Referenced by beginRun(), and RPDigiProducer().

◆ theAlgoMap

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

Definition at line 74 of file RPDigiProducer.cc.

Referenced by produce().

◆ tokenAnalysisMask

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

Definition at line 90 of file RPDigiProducer.cc.

Referenced by beginRun(), and RPDigiProducer().

◆ tokenCrossingFrameTotemRP

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

Definition at line 89 of file RPDigiProducer.cc.

Referenced by RPDigiProducer().

◆ verbosity_

int RPDigiProducer::verbosity_
private

Definition at line 77 of file RPDigiProducer.cc.

Referenced by produce(), and RPDigiProducer().