CMS 3D CMS Logo

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

#include <SimPPS/PPSPixelDigiProducer/plugins/PPSPixelDigiProducer.cc>

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

Public Member Functions

 CTPPSPixelDigiProducer (const edm::ParameterSet &)
 
 ~CTPPSPixelDigiProducer () override
 
- 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 produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ParameterSet conf_
 
edm::ESGetToken< CTPPSPixelGainCalibrations, CTPPSPixelGainCalibrationsRcdgainCalibESToken_
 
CLHEP::HepRandomEngine * rndEngine_ = nullptr
 
std::vector< std::string > RPix_hit_containers_
 
std::map< uint32_t, std::unique_ptr< RPixDetDigitizer > > theAlgoMap
 
edm::ESGetToken< PPSPixelTopology, PPSPixelTopologyRcdthePixelTopologyToken_
 
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
 
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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 79 of file PPSPixelDigiProducer.cc.

Member Typedef Documentation

◆ simhit_map

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

Definition at line 90 of file PPSPixelDigiProducer.cc.

◆ simhit_map_iterator

typedef simhit_map::iterator CTPPSPixelDigiProducer::simhit_map_iterator
private

Definition at line 91 of file PPSPixelDigiProducer.cc.

Constructor & Destructor Documentation

◆ CTPPSPixelDigiProducer()

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

Definition at line 105 of file PPSPixelDigiProducer.cc.

References edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, RPix_hit_containers_, tokenCrossingFramePPSPixel, and verbosity_.

107  produces<edm::DetSetVector<CTPPSPixelDigi>>();
108 
109  // register data to consume
110  tokenCrossingFramePPSPixel = consumes<CrossingFrame<PSimHit>>(edm::InputTag("mix", "g4SimHitsCTPPSPixelHits"));
111 
112  RPix_hit_containers_.clear();
113  RPix_hit_containers_ = conf.getParameter<std::vector<std::string>>("ROUList");
114  verbosity_ = conf.getParameter<int>("RPixVerbosity");
115 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< std::string > RPix_hit_containers_
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
edm::ESGetToken< CTPPSPixelGainCalibrations, CTPPSPixelGainCalibrationsRcd > gainCalibESToken_
edm::ESGetToken< PPSPixelTopology, PPSPixelTopologyRcd > thePixelTopologyToken_

◆ ~CTPPSPixelDigiProducer()

CTPPSPixelDigiProducer::~CTPPSPixelDigiProducer ( )
override

Definition at line 117 of file PPSPixelDigiProducer.cc.

117 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 119 of file PPSPixelDigiProducer.cc.

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

119  {
121  // all distances in [mm]
122  // RPDigiProducer
123  desc.add<std::vector<std::string>>("ROUList", {"CTPPSPixelHits"});
124  desc.add<int>("RPixVerbosity", 0);
125  desc.add<bool>("CTPPSPixelDigiSimHitRelationsPersistence",
126  false); // save links betweend digi, clusters and OSCAR/Geant4 hits
127 
128  // RPDetDigitizer
129  desc.add<double>("RPixEquivalentNoiseCharge", 1000.0);
130  desc.add<bool>("RPixNoNoise", false);
131 
132  // RPDisplacementGenerator
133  desc.add<double>("RPixGeVPerElectron", 3.61e-09);
134  desc.add<std::vector<double>>("RPixInterSmearing", {0.011});
135  desc.add<bool>("RPixLandauFluctuations", true);
136  desc.add<int>("RPixChargeDivisions", 20);
137  desc.add<double>("RPixDeltaProductionCut", 0.120425); // [MeV]
138 
139  // RPixChargeShare
140  desc.add<std::string>("ChargeMapFile2E", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap.txt");
141  desc.add<std::string>("ChargeMapFile2E_2X", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap_2X.txt");
142  desc.add<std::string>("ChargeMapFile2E_2Y", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap_2Y.txt");
143  desc.add<std::string>("ChargeMapFile2E_2X2Y", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap_2X2Y.txt");
144  desc.add<double>(
145  "RPixCoupling",
146  0.250); // fraction of the remaining charge going to the closer neighbour pixel. Value = 0.135, Value = 0.0 bypass the charge map and the charge sharing approach
147 
148  // RPixDummyROCSimulator
149  desc.add<double>("RPixDummyROCThreshold", 1900.0);
150  desc.add<double>("RPixDummyROCElectronPerADC", 135.0); // 210.0 to be verified
151  desc.add<int>("VCaltoElectronGain", 50); // same values as in RPixDetClusterizer
152  desc.add<int>("VCaltoElectronOffset", -411); //
153  desc.add<bool>("doSingleCalibration", false); //
154  desc.add<double>("RPixDeadPixelProbability", 0.001);
155  desc.add<bool>("RPixDeadPixelSimulationOn", true);
156 
157  desc.add<std::string>("mixLabel", "mix");
158  desc.add<std::string>("InputCollection", "g4SimHitsCTPPSPixelHits");
159  descriptions.add("RPixDetDigitizer", desc);
160 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 166 of file PPSPixelDigiProducer.cc.

References MixCollection< T >::MixItr::bunch(), cuy::col, conf_, submitPVResolutionJobs::count, edm::DetSet< T >::data, Exception, gainCalibESToken_, edm::EventSetup::getData(), edm::RandomNumberGenerator::getEngine(), MixCollection< T >::MixItr::getTrigger(), iEvent, edm::Service< T >::isAvailable(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, eostools::move(), edm::Handle< T >::product(), rndEngine_, theAlgoMap, thePixelTopologyToken_, tokenCrossingFramePPSPixel, and verbosity_.

166  {
167  if (!rndEngine_) {
169  if (!rng.isAvailable()) {
170  throw cms::Exception("Configuration")
171  << "This class requires the RandomNumberGeneratorService\n"
172  "which is not present in the configuration file. You must add the service\n"
173  "in the configuration file or remove the modules that require it.";
174  }
175  rndEngine_ = &(rng->getEngine(iEvent.streamID()));
176  }
177 
178  // get calibration DB
179  const auto& gainCalibration = iSetup.getData(gainCalibESToken_);
180  const auto& thePixelTopology = iSetup.getData(thePixelTopologyToken_);
181 
182  // Step A: Get Inputs
184 
185  iEvent.getByToken(tokenCrossingFramePPSPixel, cf);
186 
187  if (verbosity_) {
188  edm::LogInfo("PPS") << "PixelDigiProducer \n\n=================== Starting SimHit access"
189  << " ===================";
190 
191  MixCollection<PSimHit> col{cf.product(), std::pair(-0, 0)};
193  int count = 0;
194  for (cfi = col.begin(); cfi != col.end(); cfi++) {
195  edm::LogInfo("PPS") << "PixelDigiProducer"
196  << " Hit " << count << " has tof " << cfi->timeOfFlight() << " trackid " << cfi->trackId()
197  << " bunchcr " << cfi.bunch() << " trigger " << cfi.getTrigger()
198  << ", from EncodedEventId: " << cfi->eventId().bunchCrossing() << " "
199  << cfi->eventId().event() << " bcr from MixCol " << cfi.bunch();
200  edm::LogInfo("PPS") << " PixelDigiProducer Hit: " << (*cfi) << " " << cfi->exitPoint();
201  count++;
202  }
203  }
204 
205  MixCollection<PSimHit> allRPixHits{cf.product(), std::pair(0, 0)};
206 
207  if (verbosity_)
208  edm::LogInfo("PPS") << "PixelDigiProducer Input MixCollection size = " << allRPixHits.size();
209 
210  //Loop on PSimHit
211  simhit_map SimHitMap;
212  SimHitMap.clear();
213 
215  for (isim = allRPixHits.begin(); isim != allRPixHits.end(); ++isim) {
216  SimHitMap[(*isim).detUnitId()].push_back((*isim));
217  }
218 
219  // Step B: LOOP on hits in event
220  std::vector<edm::DetSet<CTPPSPixelDigi>> theDigiVector;
221  theDigiVector.reserve(400);
222  theDigiVector.clear();
223 
224  for (simhit_map_iterator it = SimHitMap.begin(); it != SimHitMap.end(); ++it) {
225  edm::DetSet<CTPPSPixelDigi> digi_collector(it->first);
226 
227  if (theAlgoMap.find(it->first) == theAlgoMap.end()) {
228  theAlgoMap[it->first] = std::make_unique<RPixDetDigitizer>(
229  conf_, *rndEngine_, it->first, thePixelTopology); //a digitizer for any detector
230  }
231 
232  std::vector<int> input_links;
233  std::vector<std::vector<std::pair<int, double>>> output_digi_links; // links to simhits
234 
235  theAlgoMap.at(it->first)->run(
236  SimHitMap[it->first], input_links, digi_collector.data, output_digi_links, &gainCalibration, &thePixelTopology);
237 
238  if (!digi_collector.data.empty()) {
239  theDigiVector.push_back(digi_collector);
240  }
241  }
242 
243  std::unique_ptr<edm::DetSetVector<CTPPSPixelDigi>> digi_output(new edm::DetSetVector<CTPPSPixelDigi>(theDigiVector));
244 
245  if (verbosity_) {
246  edm::LogInfo("PPS") << "PixelDigiProducer digi_output->size()=" << digi_output->size();
247  }
248 
249  iEvent.put(std::move(digi_output));
250 }
simhit_map::iterator simhit_map_iterator
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
T const * product() const
Definition: Handle.h:70
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
CLHEP::HepRandomEngine * rndEngine_
std::map< unsigned int, std::vector< PSimHit > > simhit_map
Log< level::Info, false > LogInfo
bool getTrigger() const
Definition: MixCollection.h:97
edm::ESGetToken< CTPPSPixelGainCalibrations, CTPPSPixelGainCalibrationsRcd > gainCalibESToken_
std::map< uint32_t, std::unique_ptr< RPixDetDigitizer > > theAlgoMap
col
Definition: cuy.py:1009
bool isAvailable() const
Definition: Service.h:40
edm::ESGetToken< PPSPixelTopology, PPSPixelTopologyRcd > thePixelTopologyToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ conf_

edm::ParameterSet CTPPSPixelDigiProducer::conf_
private

Definition at line 93 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ gainCalibESToken_

edm::ESGetToken<CTPPSPixelGainCalibrations, CTPPSPixelGainCalibrationsRcd> CTPPSPixelDigiProducer::gainCalibESToken_
private

Definition at line 101 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ rndEngine_

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

Definition at line 97 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ RPix_hit_containers_

std::vector<std::string> CTPPSPixelDigiProducer::RPix_hit_containers_
private

Definition at line 89 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer().

◆ theAlgoMap

std::map<uint32_t, std::unique_ptr<RPixDetDigitizer> > CTPPSPixelDigiProducer::theAlgoMap
private

Definition at line 95 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ thePixelTopologyToken_

edm::ESGetToken<PPSPixelTopology, PPSPixelTopologyRcd> CTPPSPixelDigiProducer::thePixelTopologyToken_
private

Definition at line 102 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ tokenCrossingFramePPSPixel

edm::EDGetTokenT<CrossingFrame<PSimHit> > CTPPSPixelDigiProducer::tokenCrossingFramePPSPixel
private

Definition at line 100 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer(), and produce().

◆ verbosity_

int CTPPSPixelDigiProducer::verbosity_
private

Definition at line 98 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer(), and produce().