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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
CLHEP::HepRandomEngine * rndEngine_ = nullptr
 
std::vector< std::string > RPix_hit_containers_
 
std::map< uint32_t, std::unique_ptr< RPixDetDigitizer > > theAlgoMap
 
CTPPSPixelGainCalibrationDBService theGainCalibrationDB
 
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

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

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

Definition at line 77 of file PPSPixelDigiProducer.cc.

Member Typedef Documentation

◆ simhit_map

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

Definition at line 88 of file PPSPixelDigiProducer.cc.

◆ simhit_map_iterator

typedef simhit_map::iterator CTPPSPixelDigiProducer::simhit_map_iterator
private

Definition at line 89 of file PPSPixelDigiProducer.cc.

Constructor & Destructor Documentation

◆ CTPPSPixelDigiProducer()

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

Definition at line 103 of file PPSPixelDigiProducer.cc.

103  : conf_(conf) {
104  produces<edm::DetSetVector<CTPPSPixelDigi>>();
105 
106  // register data to consume
107  tokenCrossingFramePPSPixel = consumes<CrossingFrame<PSimHit>>(edm::InputTag("mix", "g4SimHitsCTPPSPixelHits"));
108 
109  RPix_hit_containers_.clear();
110  RPix_hit_containers_ = conf.getParameter<std::vector<std::string>>("ROUList");
111  verbosity_ = conf.getParameter<int>("RPixVerbosity");
112 }

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

◆ ~CTPPSPixelDigiProducer()

CTPPSPixelDigiProducer::~CTPPSPixelDigiProducer ( )
override

Definition at line 114 of file PPSPixelDigiProducer.cc.

114 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 116 of file PPSPixelDigiProducer.cc.

116  {
118  // all distances in [mm]
119  // RPDigiProducer
120  desc.add<std::vector<std::string>>("ROUList", {"CTPPSPixelHits"});
121  desc.add<int>("RPixVerbosity", 0);
122  desc.add<bool>("CTPPSPixelDigiSimHitRelationsPersistence",
123  false); // save links betweend digi, clusters and OSCAR/Geant4 hits
124 
125  // RPDetDigitizer
126  desc.add<double>("RPixEquivalentNoiseCharge", 1000.0);
127  desc.add<bool>("RPixNoNoise", false);
128 
129  // RPDisplacementGenerator
130  desc.add<double>("RPixGeVPerElectron", 3.61e-09);
131  desc.add<std::vector<double>>("RPixInterSmearing", {0.011});
132  desc.add<bool>("RPixLandauFluctuations", true);
133  desc.add<int>("RPixChargeDivisions", 20);
134  desc.add<double>("RPixDeltaProductionCut", 0.120425); // [MeV]
135 
136  // RPixChargeShare
137  desc.add<std::string>("ChargeMapFile2E", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap.txt");
138  desc.add<std::string>("ChargeMapFile2E_2X", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap_2X.txt");
139  desc.add<std::string>("ChargeMapFile2E_2Y", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap_2Y.txt");
140  desc.add<std::string>("ChargeMapFile2E_2X2Y", "SimPPS/PPSPixelDigiProducer/data/PixelChargeMap_2X2Y.txt");
141  desc.add<double>(
142  "RPixCoupling",
143  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
144 
145  // RPixDummyROCSimulator
146  desc.add<double>("RPixDummyROCThreshold", 1900.0);
147  desc.add<double>("RPixDummyROCElectronPerADC", 135.0); // 210.0 to be verified
148  desc.add<int>("VCaltoElectronGain", 50); // same values as in RPixDetClusterizer
149  desc.add<int>("VCaltoElectronOffset", -411); //
150  desc.add<bool>("doSingleCalibration", false); //
151  desc.add<double>("RPixDeadPixelProbability", 0.001);
152  desc.add<bool>("RPixDeadPixelSimulationOn", true);
153 
154  // CTPPSPixelSimTopology
155  desc.add<double>("RPixActiveEdgeSmearing", 0.020);
156  desc.add<double>("RPixActiveEdgePosition", 0.150);
157 
158  desc.add<std::string>("mixLabel", "mix");
159  desc.add<std::string>("InputCollection", "g4SimHitsCTPPSPixelHits");
160  descriptions.add("RPixDetDigitizer", desc);
161 }

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

◆ produce()

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

Definition at line 168 of file PPSPixelDigiProducer.cc.

168  {
169  using namespace edm;
170  if (!rndEngine_) {
172  if (!rng.isAvailable()) {
173  throw cms::Exception("Configuration")
174  << "This class requires the RandomNumberGeneratorService\n"
175  "which is not present in the configuration file. You must add the service\n"
176  "in the configuration file or remove the modules that require it.";
177  }
178  rndEngine_ = &(rng->getEngine(iEvent.streamID()));
179  }
180 
181  // get calibration DB
183 
184  // Step A: Get Inputs
186 
187  iEvent.getByToken(tokenCrossingFramePPSPixel, cf);
188 
189  if (verbosity_) {
190  edm::LogInfo("PPSPixelDigiProducer") << "\n\n=================== Starting SimHit access"
191  << " ===================";
192 
193  MixCollection<PSimHit> col{cf.product(), std::pair(-0, 0)};
194  edm::LogInfo("PPSPixelDigiProducer") << col;
196  int count = 0;
197  for (cfi = col.begin(); cfi != col.end(); cfi++) {
198  edm::LogInfo("PPSPixelDigiProducer")
199  << " Hit " << count << " has tof " << cfi->timeOfFlight() << " trackid " << cfi->trackId() << " bunchcr "
200  << cfi.bunch() << " trigger " << cfi.getTrigger()
201  << ", from EncodedEventId: " << cfi->eventId().bunchCrossing() << " " << cfi->eventId().event()
202  << " bcr from MixCol " << cfi.bunch();
203  edm::LogInfo("PPSPixelDigiProducer") << " Hit: " << (*cfi) << " " << cfi->exitPoint();
204  count++;
205  }
206  }
207 
208  MixCollection<PSimHit> allRPixHits{cf.product(), std::pair(0, 0)};
209 
210  if (verbosity_)
211  edm::LogInfo("PPSPixelDigiProducer") << "Input MixCollection size = " << allRPixHits.size();
212 
213  //Loop on PSimHit
214  simhit_map SimHitMap;
215  SimHitMap.clear();
216 
218  for (isim = allRPixHits.begin(); isim != allRPixHits.end(); ++isim) {
219  SimHitMap[(*isim).detUnitId()].push_back((*isim));
220  }
221 
222  // Step B: LOOP on hits in event
223  std::vector<edm::DetSet<CTPPSPixelDigi>> theDigiVector;
224  theDigiVector.reserve(400);
225  theDigiVector.clear();
226 
227  for (simhit_map_iterator it = SimHitMap.begin(); it != SimHitMap.end(); ++it) {
228  edm::DetSet<CTPPSPixelDigi> digi_collector(it->first);
229 
230  if (theAlgoMap.find(it->first) == theAlgoMap.end()) {
231  theAlgoMap[it->first] =
232  std::make_unique<RPixDetDigitizer>(conf_, *rndEngine_, it->first, iSetup); //a digitizer for eny detector
233  }
234 
235  std::vector<int> input_links;
236  std::vector<std::vector<std::pair<int, double>>> output_digi_links; // links to simhits
237 
238  (theAlgoMap.find(it->first)->second)
239  ->run(
240  SimHitMap[it->first], input_links, digi_collector.data, output_digi_links, theGainCalibrationDB.getCalibs());
241 
242  if (!digi_collector.data.empty()) {
243  theDigiVector.push_back(digi_collector);
244  }
245  }
246 
247  std::unique_ptr<edm::DetSetVector<CTPPSPixelDigi>> digi_output(new edm::DetSetVector<CTPPSPixelDigi>(theDigiVector));
248 
249  if (verbosity_) {
250  edm::LogInfo("PPSPixelDigiProducer") << "digi_output->size()=" << digi_output->size();
251  }
252 
253  iEvent.put(std::move(digi_output));
254 }

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

Member Data Documentation

◆ conf_

edm::ParameterSet CTPPSPixelDigiProducer::conf_
private

Definition at line 91 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ rndEngine_

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

Definition at line 95 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ RPix_hit_containers_

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

Definition at line 87 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer().

◆ theAlgoMap

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

Definition at line 93 of file PPSPixelDigiProducer.cc.

Referenced by produce().

◆ theGainCalibrationDB

CTPPSPixelGainCalibrationDBService CTPPSPixelDigiProducer::theGainCalibrationDB
private

Definition at line 98 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 96 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer(), and produce().

CTPPSPixelDigiProducer::tokenCrossingFramePPSPixel
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
Definition: PPSPixelDigiProducer.cc:100
edm::DetSetVector
Definition: DetSetVector.h:61
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::DetSet
Definition: DetSet.h:23
edm
HLT enums.
Definition: AlignableModifier.h:19
cuy.col
col
Definition: cuy.py:1010
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
MixCollection::MixItr
Definition: MixCollection.h:62
CTPPSPixelGainCalibrationDBService::getCalibs
const CTPPSPixelGainCalibrations * getCalibs() const
Definition: CTPPSPixelGainCalibrationDBService.h:28
MixCollection::MixItr::bunch
int bunch() const
Definition: MixCollection.h:91
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MixCollection
Definition: MixCollection.h:11
CTPPSPixelDigiProducer::verbosity_
int verbosity_
Definition: PPSPixelDigiProducer.cc:96
MixCollection::MixItr::getTrigger
bool getTrigger() const
Definition: MixCollection.h:98
CTPPSPixelGainCalibrationDBService::getDB
virtual void getDB(const edm::Event &e, const edm::EventSetup &c)
Definition: CTPPSPixelGainCalibrationDBService.cc:25
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
CTPPSPixelDigiProducer::theAlgoMap
std::map< uint32_t, std::unique_ptr< RPixDetDigitizer > > theAlgoMap
Definition: PPSPixelDigiProducer.cc:93
CTPPSPixelDigiProducer::simhit_map
std::map< unsigned int, std::vector< PSimHit > > simhit_map
Definition: PPSPixelDigiProducer.cc:88
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
CTPPSPixelDigiProducer::simhit_map_iterator
simhit_map::iterator simhit_map_iterator
Definition: PPSPixelDigiProducer.cc:89
CTPPSPixelDigiProducer::rndEngine_
CLHEP::HepRandomEngine * rndEngine_
Definition: PPSPixelDigiProducer.cc:95
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:246
CTPPSPixelDigiProducer::theGainCalibrationDB
CTPPSPixelGainCalibrationDBService theGainCalibrationDB
Definition: PPSPixelDigiProducer.cc:98
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CTPPSPixelDigiProducer::conf_
edm::ParameterSet conf_
Definition: PPSPixelDigiProducer.cc:91
CTPPSPixelDigiProducer::RPix_hit_containers_
std::vector< std::string > RPix_hit_containers_
Definition: PPSPixelDigiProducer.cc:87