CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
CTPPSPixelGainCalibrationsRcd
gainCalibESToken_
 
CLHEP::HepRandomEngine * rndEngine_ = nullptr
 
std::vector< std::string > RPix_hit_containers_
 
std::map< uint32_t,
std::unique_ptr
< RPixDetDigitizer > > 
theAlgoMap
 
edm::ESGetToken
< PPSPixelTopology,
PPSPixelTopologyRcd
thePixelTopologyToken_
 
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

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

Definition at line 90 of file PPSPixelDigiProducer.cc.

typedef simhit_map::iterator CTPPSPixelDigiProducer::simhit_map_iterator
private

Definition at line 91 of file PPSPixelDigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 105 of file PPSPixelDigiProducer.cc.

References edm::ParameterSet::getParameter(), HLT_FULL_cff::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 }
std::vector< std::string > RPix_hit_containers_
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< CTPPSPixelGainCalibrations, CTPPSPixelGainCalibrationsRcd > gainCalibESToken_
edm::ESGetToken< PPSPixelTopology, PPSPixelTopologyRcd > thePixelTopologyToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
CTPPSPixelDigiProducer::~CTPPSPixelDigiProducer ( )
override

Definition at line 117 of file PPSPixelDigiProducer.cc.

117 {}

Member Function Documentation

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

Definition at line 119 of file PPSPixelDigiProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::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 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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::Event::getByToken(), edm::EventSetup::getData(), edm::RandomNumberGenerator::getEngine(), MixCollection< T >::MixItr::getTrigger(), edm::Service< T >::isAvailable(), eostools::move(), edm::Handle< T >::product(), edm::Event::put(), rndEngine_, edm::Event::streamID(), 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 
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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
bool getTrigger() const
Definition: MixCollection.h:97
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
def move
Definition: eostools.py:511
bool isAvailable() const
Definition: Service.h:40
CLHEP::HepRandomEngine * rndEngine_
std::map< unsigned int, std::vector< PSimHit > > simhit_map
Log< level::Info, false > LogInfo
T const * product() const
Definition: Handle.h:70
edm::ESGetToken< CTPPSPixelGainCalibrations, CTPPSPixelGainCalibrationsRcd > gainCalibESToken_
std::map< uint32_t, std::unique_ptr< RPixDetDigitizer > > theAlgoMap
StreamID streamID() const
Definition: Event.h:98
edm::ESGetToken< PPSPixelTopology, PPSPixelTopologyRcd > thePixelTopologyToken_
int col
Definition: cuy.py:1009

Member Data Documentation

edm::ParameterSet CTPPSPixelDigiProducer::conf_
private

Definition at line 93 of file PPSPixelDigiProducer.cc.

Referenced by produce().

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

Definition at line 101 of file PPSPixelDigiProducer.cc.

Referenced by produce().

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

Definition at line 97 of file PPSPixelDigiProducer.cc.

Referenced by produce().

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

Definition at line 89 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer().

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

Definition at line 95 of file PPSPixelDigiProducer.cc.

Referenced by produce().

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

Definition at line 102 of file PPSPixelDigiProducer.cc.

Referenced by produce().

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

Definition at line 100 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer(), and produce().

int CTPPSPixelDigiProducer::verbosity_
private

Definition at line 98 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer(), and produce().