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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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_ = 0
 
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

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

Definition at line 88 of file PPSPixelDigiProducer.cc.

typedef simhit_map::iterator CTPPSPixelDigiProducer::simhit_map_iterator
private

Definition at line 89 of file PPSPixelDigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 103 of file PPSPixelDigiProducer.cc.

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

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 }
T getParameter(std::string const &) const
std::vector< std::string > RPix_hit_containers_
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
CTPPSPixelDigiProducer::~CTPPSPixelDigiProducer ( )
override

Definition at line 114 of file PPSPixelDigiProducer.cc.

114 {}

Member Function Documentation

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

Definition at line 116 of file PPSPixelDigiProducer.cc.

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

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 }
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 168 of file PPSPixelDigiProducer.cc.

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

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
182  theGainCalibrationDB.getDB(iEvent, iSetup);
183 
184  // Step A: Get Inputs
186 
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] = std::unique_ptr<RPixDetDigitizer>(
232  new 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 }
simhit_map::iterator simhit_map_iterator
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const CTPPSPixelGainCalibrations * getCalibs() const
CTPPSPixelGainCalibrationDBService theGainCalibrationDB
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
bool getTrigger() const
Definition: MixCollection.h:98
edm::EDGetTokenT< CrossingFrame< PSimHit > > tokenCrossingFramePPSPixel
bool isAvailable() const
Definition: Service.h:40
CLHEP::HepRandomEngine * rndEngine_
virtual void getDB(const edm::Event &e, const edm::EventSetup &c)
std::map< unsigned int, std::vector< PSimHit > > simhit_map
T const * product() const
Definition: Handle.h:69
std::map< uint32_t, std::unique_ptr< RPixDetDigitizer > > theAlgoMap
HLT enums.
StreamID streamID() const
Definition: Event.h:96
col
Definition: cuy.py:1010
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::ParameterSet CTPPSPixelDigiProducer::conf_
private

Definition at line 91 of file PPSPixelDigiProducer.cc.

Referenced by produce().

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

Definition at line 95 of file PPSPixelDigiProducer.cc.

Referenced by produce().

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

Definition at line 87 of file PPSPixelDigiProducer.cc.

Referenced by CTPPSPixelDigiProducer().

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

Definition at line 93 of file PPSPixelDigiProducer.cc.

Referenced by produce().

CTPPSPixelGainCalibrationDBService CTPPSPixelDigiProducer::theGainCalibrationDB
private

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

Referenced by CTPPSPixelDigiProducer(), and produce().