36 void getSimTrackId(std::vector<UniqueSimTrackId>& simTrkId,
40 auto isearch = simLinks->find(detId);
41 if (isearch != simLinks->end()) {
45 if (channel == it->channel()) {
77 : sipixelSimLinksToken_(
79 sistripSimLinksToken_(
81 siphase2OTSimLinksToken_(
88 cfg.getParameter<edm::
InputTag>(
"phase2OTClusterSrc"))),
89 trackingParticleToken_(
91 throwOnMissingCollections_(cfg.getParameter<bool>(
"throwOnMissingCollections")) {
92 produces<ClusterTPAssociation>();
105 desc.
add<
bool>(
"throwOnMissingCollections",
true);
106 descriptions.
add(
"tpClusterProducerDefault", desc);
127 auto clusterTPList = std::make_unique<ClusterTPAssociation>();
136 auto clusterTPList = std::make_unique<ClusterTPAssociation>();
145 auto clusterTPList = std::make_unique<ClusterTPAssociation>();
154 auto clusterTPList = std::make_unique<ClusterTPAssociation>();
159 auto clusterTPList = std::make_unique<ClusterTPAssociation>(TPCollectionH);
162 std::unordered_map<UniqueSimTrackId, TrackingParticleRef, UniqueSimTrackIdHash> mapping;
163 auto const& tpColl = *TPCollectionH.
product();
166 auto const& trackingParticle = tpColl[itp];
170 for (
auto const& trk : trackingParticle.g4Tracks()) {
173 mapping.insert(std::make_pair(trkid, trackingParticleRef));
177 std::unordered_set<UniqueSimTrackId, UniqueSimTrackIdHash> simTkIds;
178 std::vector<UniqueSimTrackId> trkid;
179 if (foundPixelClusters) {
181 clusterTPList->addKeyID(pixelClusters.
id());
183 iter != pixelClusters->end();
185 uint32_t detid = iter->id();
197 getSimTrackId<PixelDigiSimLink>(trkid, sipixelSimLinks, detId, channel);
198 simTkIds.insert(trkid.begin(), trkid.end());
201 for (
auto iset = simTkIds.begin(); iset != simTkIds.end(); iset++) {
202 auto ipos = mapping.find(*iset);
203 if (ipos != mapping.end()) {
212 if (foundStripClusters) {
214 clusterTPList->addKeyID(stripClusters.
id());
216 eter = stripClusters->end(
false);
219 if (!(*iter).isValid())
221 uint32_t detid = iter->id();
232 for (
int istr = first; istr <
last; ++istr) {
234 getSimTrackId<StripDigiSimLink>(trkid, sistripSimLinks, detId, istr);
235 simTkIds.insert(trkid.begin(), trkid.end());
237 for (
auto iset = simTkIds.begin(); iset != simTkIds.end(); iset++) {
238 auto ipos = mapping.find(*iset);
239 if (ipos != mapping.end()) {
248 if (foundPhase2OTClusters) {
250 clusterTPList->addKeyID(phase2OTClusters.
id());
251 if (phase2OTClusters.
isValid()) {
253 eter = phase2OTClusters->end(
false);
256 if (!(*iter).isValid())
258 uint32_t detid = iter->id();
269 for (
unsigned int istr(0); istr < cluster.
size(); ++istr) {
272 getSimTrackId<PixelDigiSimLink>(trkid, siphase2OTSimLinks, detId, channel);
273 simTkIds.insert(trkid.begin(), trkid.end());
276 for (
auto iset = simTkIds.begin(); iset != simTkIds.end(); iset++) {
277 auto ipos = mapping.find(*iset);
278 if (ipos != mapping.end()) {
286 clusterTPList->sortAndUnique();
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::pair< uint32_t, EncodedEventId > UniqueSimTrackId
std::vector< OmniClusterRef > OmniClusterCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > phase2OTClustersToken_
SiStripCluster const & amplitudes() const
uint16_t firstStrip() const
data_type const * const_iterator
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > siphase2OTSimLinksToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClustersToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned int firstRow() const
decltype(auto) emplace_back(Args &&...args)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
ClusterTPAssociationProducer(const edm::ParameterSet &)
unsigned int column() const
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
T const * product() const
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > sipixelSimLinksToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~ClusterTPAssociationProducer() override=default
Pixel cluster – collection of neighboring pixels above threshold.
bool throwOnMissingCollections_
static int pixelToChannel(int row, int col)
std::vector< TrackingParticle > TrackingParticleCollection
collection_type::const_iterator const_iterator
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > sistripSimLinksToken_