74 #include "CLHEP/Random/RandomEngine.h" 81 hitsProducer_(iConfig.getParameter<
std::
string>(
"hitsProducer")),
82 trackerContainers_(iConfig.getParameter<
std::vector<
std::
string> >(
"ROUList")),
83 geometryType_(iConfig.getParameter<
std::
string>(
"GeometryType")),
101 <<
"Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n" 102 "which is not present in the configuration file. You must add the service\n" 103 "in the configuration file or remove the modules that require it.";
116 unsigned int detId_raw = det_u->geographicalId().rawId();
139 edm::LogInfo(
"Phase2TrackerDigitizer") <<
"Destroying the Digitizer";
143 size_t globalSimHitIndex,
const unsigned int tofBin) {
144 if (hSimHits.isValid()) {
145 std::set<unsigned int> detIds;
146 std::vector<PSimHit>
const&
simHits = *hSimHits.product();
148 for (
auto it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it, ++globalSimHitIndex) {
149 unsigned int detId_raw = (*it).detUnitId();
151 if (detIds.insert(detId_raw).second) {
160 algomap_[algotype]->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, phase2det, bfield);
162 edm::LogInfo(
"Phase2TrackerDigitizer") <<
"Unsupported algorithm: ";
174 if (
first_) el.second->init(iSetup);
175 el.second->initializeEvent();
186 accumulate_local<edm::Event>(
iEvent, iSetup);
191 accumulate_local<PileUpEventPrincipal>(
iEvent, iSetup);
199 iEvent.getByLabel(tag, simHits);
218 if(!isOuterTrackerReadoutAnalog)
222 DetId detId(detId_raw);
260 edm::LogError(
"Phase2TrackerDigitizer")<<
"ERROR - Wrong Detector Type, No Algorithm available ";
267 std::vector<edm::DetSet<PixelDigi> > digiVector;
268 std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
270 DetId detId_raw =
DetId(det_u->geographicalId().rawId());
276 std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
277 algomap_[algotype]->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u),
281 for (
auto const & digi_p : digi_map) {
284 collector.data.emplace_back(ip.first, ip.second, info.
sig_tot);
286 linkcollector.data.emplace_back(digi_p.first, sim_p.second->trackId(), sim_p.second->hitIndex(), sim_p.second->tofBin(), sim_p.second->eventId(), sim_p.first);
289 if (!collector.data.empty()) digiVector.push_back(
std::move(collector));
290 if (!linkcollector.data.empty()) digiLinkVector.push_back(
std::move(linkcollector));
294 std::unique_ptr<edm::DetSetVector<PixelDigi> >
296 std::unique_ptr<edm::DetSetVector<PixelDigiSimLink> >
305 std::vector<edm::DetSet<Phase2TrackerDigi> > digiVector;
306 std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
308 DetId detId_raw =
DetId(det_u->geographicalId().rawId());
313 std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
314 algomap_[algotype]->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u),
319 for (
auto const & digi_p : digi_map) {
322 collector.data.emplace_back(ip.first, ip.second, info.
ot_bit);
325 linkcollector.data.emplace_back(digi_p.first, sim_p.second->trackId(), sim_p.second->hitIndex(), sim_p.second->tofBin(), sim_p.second->eventId(), sim_p.first);
329 if (!collector.data.empty()) digiVector.push_back(
std::move(collector));
330 if (!linkcollector.data.empty()) digiLinkVector.push_back(
std::move(linkcollector));
334 std::unique_ptr<edm::DetSetVector<Phase2TrackerDigi> >
336 std::unique_ptr<edm::DetSetVector<PixelDigiSimLink> >
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
edm::ESWatcher< TrackerDigiGeometryRecord > theTkDigiGeomWatcher
const edm::ParameterSet & iconfig_
ModuleTypeCache moduleTypeCache_
LuminosityBlockIndex index() const
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >, size_t globalSimHitIndex, const unsigned int tofBin)
void accumulate_local(T const &iEvent, edm::EventSetup const &iSetup)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const Plane & surface() const
The nominal surface of the GeomDet.
std::unordered_map< unsigned, TrackerGeometry::ModuleType > ModuleTypeCache
std::map< unsigned int, const Phase2TrackerGeomDetUnit * > detectorUnits_
CLHEP::HepRandomEngine * rndEngine_
edm::ESHandle< TrackerTopology > tTopoHand
const std::string geometryType_
edm::ESHandle< TrackerGeometry > pDD_
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. ...
ModuleType getDetectorType(DetId) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
void addOuterTrackerCollection(edm::Event &iEvent, const edm::EventSetup &iSetup)
AlgorithmType getAlgoType(unsigned int idet)
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &iSetup) override
static std::pair< int, int > channelToPixel(int ch)
bool check(const edm::EventSetup &iSetup)
const vstring trackerContainers_
edm::ESHandle< MagneticField > pSetup_
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
const std::string hitsProducer_
#define DEFINE_DIGI_ACCUMULATOR(type)
Phase2TrackerDigitizer(const edm::ParameterSet &iConfig, edm::stream::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
std::vector< std::pair< float, SimHitInfoForLinks * > > simInfoList
void addPixelCollection(edm::Event &iEvent, const edm::EventSetup &iSetup, const bool ot_analog)
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &iSetup) override
~Phase2TrackerDigitizer() override
const PositionType & position() const
T const * product() const
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)