85 : firstInitializeEvent_(
true),
86 firstFinalizeEvent_(
true),
87 applyLateReweighting_(
88 iConfig.exists(
"applyLateReweighting") ? iConfig.getParameter<
bool>(
"applyLateReweighting") :
false),
89 store_SimHitEntryExitPoints_(iConfig.exists(
"store_SimHitEntryExitPoints")
90 ? iConfig.getParameter<
bool>(
"store_SimHitEntryExitPoints")
95 pilotBlades(iConfig.exists(
"enablePilotBlades") ? iConfig.getParameter<
bool>(
"enablePilotBlades") :
false),
100 edm::LogInfo(
"PixelDigitizer ") <<
"Enter the Pixel Digitizer";
110 "siPixelExtraSimHit");
119 <<
"SiPixelDigitizer requires the RandomNumberGeneratorService\n" 120 "which is not present in the configuration file. You must add the service\n" 121 "in the configuration file or remove the modules that require it.";
124 _pixeldigialgo = std::make_unique<SiPixelDigitizerAlgorithm>(iConfig, iC);
136 size_t globalSimHitIndex,
137 const unsigned int tofBin,
139 if (hSimHits.isValid()) {
140 std::set<unsigned int> detIds;
141 std::vector<PSimHit>
const&
simHits = *hSimHits.product();
144 for (std::vector<PSimHit>::const_iterator it =
simHits.begin(), itEnd =
simHits.end(); it != itEnd;
145 ++it, ++globalSimHitIndex) {
146 unsigned int detId = (*it).detUnitId();
147 if (detIds.insert(
detId).second) {
154 std::map<unsigned int, PixelGeomDetUnit const*>::iterator itDet =
detectorUnits.find(
detId);
157 auto pixdet = itDet->second;
158 assert(pixdet !=
nullptr);
161 LogDebug(
"PixelDigitizer ") <<
"B-field(T) at " << pixdet->surface().position()
162 <<
"(cm): " <<
pSetup->
inTesla(pixdet->surface().position());
164 it, itEnd, globalSimHitIndex, tofBin, pixdet, bfield, tTopo,
randomEngine_);
196 unsigned int detId = iu->geographicalId().rawId();
197 if (iu->type().isTrackerPixel()) {
199 assert(pixdet !=
nullptr);
200 if (iu->subDetector() ==
221 if ((*i).find(
std::string(
"HighTof")) != std::string::npos)
244 if ((*i).find(
std::string(
"HighTof")) != std::string::npos)
261 std::vector<edm::DetSet<PixelDigi> > theDigiVector;
262 std::vector<edm::DetSet<PixelDigiSimLink> > theDigiLinkVector;
263 std::vector<edm::DetSet<PixelSimHitExtraInfo> > theExtraSimHitInfoVector;
272 std::unique_ptr<PixelFEDChannelCollection> PixelFEDChannelCollection_ =
274 if (PixelFEDChannelCollection_ ==
nullptr) {
275 throw cms::Exception(
"NullPointerError") <<
"PixelFEDChannelCollection not set in chooseScenario function.\n";
281 if (iu->type().isTrackerPixel()) {
286 std::vector<PixelDigiAddTempInfo> tempcollector;
289 _pixeldigialgo->digitize(dynamic_cast<const PixelGeomDetUnit*>(iu),
297 if (!tempcollector.
empty()) {
298 std::vector<PixelDigiAddTempInfo>::const_iterator loopNewClass;
299 unsigned int channelPrevious2 = -1;
300 size_t hitFirstOne2 = -1;
301 for (loopNewClass = tempcollector.
begin(); loopNewClass != tempcollector.
end(); ++loopNewClass) {
311 bool checkTwoSimHits =
false;
312 if (channelPrevious2 == loopNewClass->channel() && hitFirstOne2 != loopNewClass->hitIndex()) {
314 checkTwoSimHits =
true;
316 channelPrevious2 = loopNewClass->channel();
317 hitFirstOne2 = loopNewClass->hitIndex();
320 bool checkInTheList =
false;
321 if (!checkTwoSimHits) {
322 std::vector<PixelSimHitExtraInfo>::iterator loopTempSH;
323 for (loopTempSH = tempSHcollector.begin(); loopTempSH != tempSHcollector.end(); ++loopTempSH) {
324 if (loopNewClass->hitIndex() == loopTempSH->hitIndex()) {
325 checkInTheList =
true;
326 loopTempSH->addDigiInfo(loopNewClass->channel());
329 if (!checkInTheList) {
331 loopNewClass->entryPoint(),
332 loopNewClass->exitPoint(),
333 loopNewClass->channel());
334 tempSHcollector.push_back(newSHEntry);
343 dynamic_cast<const PixelGeomDetUnit*>(iu), collector.data, tempSHcollector.data, tTopo,
randomEngine_);
346 if (!collector.data.empty()) {
347 theDigiVector.push_back(
std::move(collector));
349 if (!linkcollector.data.empty()) {
350 theDigiLinkVector.push_back(
std::move(linkcollector));
352 if (!tempSHcollector.data.empty()) {
353 theExtraSimHitInfoVector.push_back(
std::move(tempSHcollector));
361 std::unique_ptr<edm::DetSetVector<PixelDigiSimLink> > outputlink(
363 std::unique_ptr<edm::DetSetVector<PixelSimHitExtraInfo> > outputExtraSim(
~SiPixelDigitizer() override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const TrackerGeometry * pDD
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const int NumberOfEndcapDisks
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const MagneticField * pSetup
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::unique_ptr< PileupMixingContent > PileupInfo_
unsigned int layer(const DetId &id) const
const std::string hitsProducer
SiPixelDigitizer(const edm::ParameterSet &conf, edm::ProducesCollector, edm::ConsumesCollector &iC)
std::map< unsigned int, PixelGeomDetUnit const * > detectorUnits
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >, size_t globalSimHitIndex, const unsigned int tofBin, edm::EventSetup const &c)
std::unique_ptr< SiPixelDigitizerAlgorithm > _pixeldigialgo
const bool store_SimHitEntryExitPoints_
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
bool applyLateReweighting_
Namespace of DDCMS conversion namespace.
Log< level::Info, false > LogInfo
CLHEP::HepRandomEngine * randomEngine_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > pSetupToken_
const vstring trackerContainers
bool firstInitializeEvent_
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
std::map< std::string, size_t > crossingSimHitIndexOffset_
Offset to add to the index of each sim hit to account for which crossing it's in. ...