68 const std::vector<edm::ParameterSet>& pluginConfigs = config.
getParameter<std::vector<edm::ParameterSet>>(
"plugins");
70 for (
unsigned int iplugin = 0; iplugin<pluginConfigs.size(); ++iplugin)
79 edm::LogInfo(
"TrackingRecHitProducer: ")<<
"adding plugin type '"<<pluginType<<
"' as '"<<pluginName<<
"'"<<std::endl;
84 throw cms::Exception(
"TrackingRecHitAlgorithm plugin not found: ") <<
"plugin type = "<<pluginType<<
"\nconfiguration=\n"<<pluginConfig.
dump();
91 produces<FastTrackerRecHitCollection>();
92 produces<FastTrackerRecHitRefCollection>(
"simHit2RecHitMap");
101 _recHitAlgorithms.clear();
108 algo->beginStream(
id);
128 trackerGeomRec.get(trackerGeometryHandle);
129 trackerTopoRec.
get(trackerTopologyHandle);
136 const std::vector<DetId>& detIds = trackerGeometry->
detIds();
137 std::vector<unsigned int> numberOfDetIdsPerAlgorithm(
_recHitAlgorithms.size(),0);
139 for (
const DetId& detId: detIds)
149 numberOfDetIdsPerAlgorithm[ialgo]+=1;
155 throw cms::Exception(
"FastSimulation/TrackingRecHitProducer: DetId not configured! ("+trackerTopology->
print(detId)+
")");
171 algo->beginEvent(event,eventSetup);
179 output_recHits->reserve(simHits->size());
184 std::map<unsigned int,std::vector<std::pair<unsigned int,const PSimHit*>>> simHitsIdPairPerDetId;
185 for (
unsigned int ihit = 0; ihit < simHits->size(); ++ihit)
188 simHitsIdPairPerDetId[simHit->
detUnitId()].push_back(std::make_pair(ihit,simHit));
191 for (
auto simHitsIdPairIt = simHitsIdPairPerDetId.begin(); simHitsIdPairIt != simHitsIdPairPerDetId.end(); ++simHitsIdPairIt)
193 const DetId& detId = simHitsIdPairIt->first;
194 std::map<unsigned int, TrackingRecHitPipe>::const_iterator pipeIt =
_detIdPipes.find(detId);
197 auto& simHitIdPairList = simHitsIdPairIt->second;
202 product = pipe.
produce(product);
204 const std::vector<TrackingRecHitProduct::RecHitToSimHitIdPairs>& recHitToSimHitIdPairsList = product->getRecHitToSimHitIdPairs();
207 for (
unsigned int irecHit = 0; irecHit < recHitToSimHitIdPairsList.size(); ++irecHit)
209 output_recHits->push_back(recHitToSimHitIdPairsList[irecHit].
first);
210 const std::vector<TrackingRecHitProduct::SimHitIdPair>& simHitIdPairList = recHitToSimHitIdPairsList[irecHit].second;
211 for (
unsigned int isimHit = 0; isimHit < simHitIdPairList.size(); ++isimHit)
213 unsigned int simHitId = simHitIdPairList[isimHit].first;
214 if (not (*output_recHitRefs)[simHitId].isNull())
216 throw cms::Exception(
"FastSimulation/TrackingRecHitProducer",
"A PSimHit cannot lead to multiple FastTrackerRecHits");
225 throw cms::Exception(
"FastSimulation/TrackingRecHitProducer",
"A PSimHit carries a DetId which does not belong to the TrackerGeometry: "+std::to_string(detId));
232 algo->endEvent(event,eventSetup);
237 for(
unsigned recHitIndex = 0; recHitIndex < output_recHits->size(); ++recHitIndex)
243 event.put(
std::move(output_recHitRefs),
"simHit2RecHitMap");
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
std::string dump(unsigned int indent=0) const
#define DEFINE_FWK_MODULE(type)
void setupDetIdPipes(const edm::EventSetup &eventSetup)
std::map< unsigned int, TrackingRecHitPipe > _detIdPipes
void beginStream(edm::StreamID id) override
~TrackingRecHitProducer() override
void addAlgorithm(TrackingRecHitAlgorithm *algorithm)
edm::EDGetTokenT< std::vector< PSimHit > > _simHitToken
std::string print(DetId detid) const
unsigned long long _trackerGeometryCacheID
edm::Ref< FastTrackerRecHitCollection > FastTrackerRecHitRef
bool passSelection(std::string selectionStr) const
const std::string & getSelectionString() const
std::vector< TrackingRecHitAlgorithm * > _recHitAlgorithms
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
unsigned int size() const
void get(HolderT &iHolder) const
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
def pipe(cmdline, input=None)
std::shared_ptr< TrackingRecHitProduct > TrackingRecHitProductPtr
std::vector< FastTrackerRecHitRef > FastTrackerRecHitRefCollection
TrackingRecHitProducer(const edm::ParameterSet &config)
void beginRun(edm::Run const &, const edm::EventSetup &eventSetup) override
void endStream() override
unsigned long long _trackerTopologyCacheID
T const * product() const
TrackingRecHitProductPtr produce(TrackingRecHitProductPtr product) const
T get(const Candidate &c)
unsigned int detUnitId() const