77 const std::vector<edm::ParameterSet>& pluginConfigs =
config.getParameter<std::vector<edm::ParameterSet>>(
"plugins");
79 for (
unsigned int iplugin = 0; iplugin < pluginConfigs.size(); ++iplugin) {
84 std::unique_ptr<TrackingRecHitAlgorithm> recHitAlgorithm{
86 if (recHitAlgorithm) {
88 <<
"adding plugin type '" << pluginType <<
"' as '" <<
pluginName <<
"'" << std::endl;
92 <<
"plugin type = " << pluginType <<
"\nconfiguration=\n" 100 produces<FastTrackerRecHitCollection>();
101 produces<FastTrackerRecHitRefCollection>(
"simHit2RecHitMap");
108 algo->beginStream(
id);
141 const std::vector<DetId>& detIds = trackerGeometry.
detIds();
142 std::vector<unsigned int> numberOfDetIdsPerAlgorithm(
_recHitAlgorithms.size(), 0);
150 if (
selector.passSelection(
algo->getSelectionString())) {
151 numberOfDetIdsPerAlgorithm[ialgo] += 1;
155 if (
pipe.size() == 0) {
156 throw cms::Exception(
"FastSimulation/TrackingRecHitProducer: DetId not configured! (" +
176 auto output_recHits = std::make_unique<FastTrackerRecHitCollection>();
177 output_recHits->reserve(
simHits->size());
183 std::map<unsigned int, std::vector<std::pair<unsigned int, const PSimHit*>>> simHitsIdPairPerDetId;
184 for (
unsigned int ihit = 0; ihit <
simHits->size(); ++ihit) {
186 simHitsIdPairPerDetId[
simHit->detUnitId()].push_back(std::make_pair(ihit,
simHit));
189 for (
auto simHitsIdPairIt = simHitsIdPairPerDetId.begin(); simHitsIdPairIt != simHitsIdPairPerDetId.end();
192 std::map<unsigned int, TrackingRecHitPipe>::const_iterator pipeIt =
_detIdPipes.find(
detId);
194 auto& simHitIdPairList = simHitsIdPairIt->second;
199 product =
pipe.produce(product);
201 const std::vector<TrackingRecHitProduct::RecHitToSimHitIdPairs>& recHitToSimHitIdPairsList =
202 product->getRecHitToSimHitIdPairs();
204 for (
unsigned int irecHit = 0; irecHit < recHitToSimHitIdPairsList.size(); ++irecHit) {
205 output_recHits->push_back(recHitToSimHitIdPairsList[irecHit].
first);
206 const std::vector<TrackingRecHitProduct::SimHitIdPair>& simHitIdPairList =
207 recHitToSimHitIdPairsList[irecHit].second;
208 double energyLoss_tot = 0;
209 for (
unsigned int isimHit = 0; isimHit < simHitIdPairList.size(); ++isimHit) {
210 unsigned int simHitId = simHitIdPairList[isimHit].first;
215 if (not(*output_recHitRefs)[simHitId].isNull()) {
217 "A PSimHit cannot lead to multiple FastTrackerRecHits");
226 "FastSimulation/TrackingRecHitProducer",
227 "A PSimHit carries a DetId which does not belong to the TrackerGeometry: " +
std::to_string(
detId));
238 for (
unsigned recHitIndex = 0; recHitIndex < output_recHits->size(); ++recHitIndex) {
243 event.put(
std::move(output_recHitRefs),
"simHit2RecHitMap");
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyESToken_
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::string print(DetId detid) const
void setupDetIdPipes(const edm::EventSetup &eventSetup)
std::map< unsigned int, TrackingRecHitPipe > _detIdPipes
void beginStream(edm::StreamID id) override
~TrackingRecHitProducer() override
edm::EDGetTokenT< std::vector< PSimHit > > _simHitToken
unsigned long long _trackerGeometryCacheID
edm::Ref< FastTrackerRecHitCollection > FastTrackerRecHitRef
unsigned long long cacheIdentifier() const
static std::string to_string(const XMLCh *ch)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryESToken_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
#define DEFINE_FWK_MODULE(type)
def pipe(cmdline, input=None)
std::shared_ptr< TrackingRecHitProduct > TrackingRecHitProductPtr
Log< level::Info, false > LogInfo
const edm::ESGetToken< SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd > siPixelTemplateDBObjectESToken_
const edm::ESGetToken< std::vector< SiPixelTemplateStore >, SiPixelTemplateDBObjectESProducerRcd > siPixelTemplateStoreESToken_
TrackingRecHitProducer(const edm::ParameterSet &config)
void beginRun(edm::Run const &, const edm::EventSetup &eventSetup) override
std::vector< std::unique_ptr< TrackingRecHitAlgorithm > > _recHitAlgorithms
void endStream() override
unsigned long long _trackerTopologyCacheID
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const