75 #include "CLHEP/Random/RandomEngine.h" 82 hitsProducer_(iConfig.getParameter<
std::
string>(
"hitsProducer")),
83 trackerContainers_(iConfig.getParameter<
std::vector<
std::
string> >(
"ROUList")),
84 geometryType_(iConfig.getParameter<
std::
string>(
"GeometryType")),
102 <<
"Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n" 103 "which is not present in the configuration file. You must add the service\n" 104 "in the configuration file or remove the modules that require it.";
117 unsigned int detId_raw = det_u->geographicalId().rawId();
140 edm::LogInfo(
"Phase2TrackerDigitizer") <<
"Destroying the Digitizer";
144 size_t globalSimHitIndex,
const unsigned int tofBin) {
145 if (hSimHits.isValid()) {
146 std::set<unsigned int> detIds;
147 std::vector<PSimHit>
const&
simHits = *hSimHits.product();
149 for (
auto it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it, ++globalSimHitIndex) {
150 unsigned int detId_raw = (*it).detUnitId();
152 if (detIds.insert(detId_raw).second) {
161 algomap_[algotype]->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, phase2det, bfield);
163 edm::LogInfo(
"Phase2TrackerDigitizer") <<
"Unsupported algorithm: ";
175 if (
first_) el.second->init(iSetup);
176 el.second->initializeEvent();
187 accumulate_local<edm::Event>(
iEvent, iSetup);
192 accumulate_local<PileUpEventPrincipal>(
iEvent, iSetup);
200 iEvent.getByLabel(tag, simHits);
219 if(!isOuterTrackerReadoutAnalog)
223 DetId detId(detId_raw);
261 edm::LogError(
"Phase2TrackerDigitizer")<<
"ERROR - Wrong Detector Type, No Algorithm available ";
268 std::vector<edm::DetSet<PixelDigi> > digiVector;
269 std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
271 DetId detId_raw =
DetId(det_u->geographicalId().rawId());
277 std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
278 algomap_[algotype]->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u),
282 for (
auto const & digi_p : digi_map) {
285 collector.data.emplace_back(ip.first, ip.second, info.
sig_tot);
287 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);
290 if (!collector.data.empty()) digiVector.push_back(
std::move(collector));
291 if (!linkcollector.data.empty()) digiLinkVector.push_back(
std::move(linkcollector));
295 std::unique_ptr<edm::DetSetVector<PixelDigi> >
297 std::unique_ptr<edm::DetSetVector<PixelDigiSimLink> >
306 std::vector<edm::DetSet<Phase2TrackerDigi> > digiVector;
307 std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
309 DetId detId_raw =
DetId(det_u->geographicalId().rawId());
314 std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
315 algomap_[algotype]->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u),
320 for (
auto const & digi_p : digi_map) {
323 collector.data.emplace_back(ip.first, ip.second, info.
ot_bit);
326 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);
330 if (!collector.data.empty()) digiVector.push_back(
std::move(collector));
331 if (!linkcollector.data.empty()) digiLinkVector.push_back(
std::move(linkcollector));
335 std::unique_ptr<edm::DetSetVector<Phase2TrackerDigi> >
337 std::unique_ptr<edm::DetSetVector<PixelDigiSimLink> >
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
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::ProducerBase &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)