25 : _verbose(cfg.getParameter<bool>(
"verbose")),
26 _pixelSimLinkSrc(cfg.getParameter<edm::
InputTag>(
"pixelSimLinkSrc")),
27 _stripSimLinkSrc(cfg.getParameter<edm::
InputTag>(
"stripSimLinkSrc")),
28 _pixelClusterSrc(cfg.getParameter<edm::
InputTag>(
"pixelClusterSrc")),
29 _stripClusterSrc(cfg.getParameter<edm::
InputTag>(
"stripClusterSrc")),
30 _trackingParticleSrc(cfg.getParameter<edm::
InputTag>(
"trackingParticleSrc"))
39 produces<ClusterTPAssociationList>();
46 auto clusterTPList = std::make_unique<ClusterTPAssociationList>();
73 itp < TPCollectionH.
product()->size(); ++itp) {
79 for (std::vector<SimTrack>::const_iterator itrk = trackingParticle->g4Track_begin();
80 itrk != trackingParticle->g4Track_end(); ++itrk) {
81 std::pair<uint32_t, EncodedEventId> trkid(itrk->trackId(), eid);
83 mapping.insert(std::make_pair(trkid, trackingParticle));
87 if ( foundPixelClusters ) {
90 iter != pixelClusters->end(); ++iter) {
91 uint32_t
detid = iter->id();
95 di != link_pixel.
end(); ++di) {
100 std::set<std::pair<uint32_t, EncodedEventId> > simTkIds;
104 std::vector<std::pair<uint32_t, EncodedEventId> > trkid(getSimTrackId<PixelDigiSimLink>(sipixelSimLinks, detId, channel));
105 if (trkid.size()==0)
continue;
106 simTkIds.insert(trkid.begin(),trkid.end());
109 for (std::set<std::pair<uint32_t, EncodedEventId> >::const_iterator iset = simTkIds.begin();
110 iset != simTkIds.end(); iset++) {
111 auto ipos = mapping.find(*iset);
112 if (ipos != mapping.end()) {
114 clusterTPList->push_back(std::make_pair(
OmniClusterRef(c_ref), ipos->second));
121 if ( foundStripClusters ) {
124 iter != eter; ++iter) {
125 if (!(*iter).isValid())
continue;
126 uint32_t
detid = iter->id();
130 di != link_strip.
end(); di++) {
135 std::set<std::pair<uint32_t, EncodedEventId> > simTkIds;
139 for (
int istr = first; istr <
last; ++istr) {
140 std::vector<std::pair<uint32_t, EncodedEventId> > trkid(getSimTrackId<StripDigiSimLink>(sistripSimLinks, detId, istr));
141 if (trkid.size()==0)
continue;
142 simTkIds.insert(trkid.begin(),trkid.end());
144 for (std::set<std::pair<uint32_t, EncodedEventId> >::const_iterator iset = simTkIds.begin();
145 iset != simTkIds.end(); iset++) {
146 auto ipos = mapping.find(*iset);
147 if (ipos != mapping.end()) {
149 clusterTPList->push_back(std::make_pair(
OmniClusterRef(c_ref), ipos->second));
157 iEvent.
put(std::move(clusterTPList));
160 template <
typename T>
161 std::vector<std::pair<uint32_t, EncodedEventId> >
164 const DetId& detId, uint32_t channel)
const
167 std::vector<std::pair<uint32_t, EncodedEventId> > simTrkId;
168 auto isearch = simLinks->find(detId);
169 if (isearch != simLinks->end()) {
173 it != link_detset.
data.end(); ++it) {
174 if (channel == it->channel()) {
175 simTrkId.
push_back(std::make_pair(it->SimTrackId(), it->eventId()));
T getParameter(std::string const &) const
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)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
void push_back(const T &t)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool clusterTPAssociationListGreater(std::pair< OmniClusterRef, TrackingParticleRef > i, std::pair< OmniClusterRef, TrackingParticleRef > j)
#define DEFINE_FWK_MODULE(type)
uint16_t firstStrip() const
data_type const * const_iterator
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClustersToken_
ClusterTPAssociationProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
~ClusterTPAssociationProducer()
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
T const * product() const
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > sipixelSimLinksToken_
Pixel cluster – collection of neighboring pixels above threshold.
static int pixelToChannel(int row, int col)
std::vector< std::pair< uint32_t, EncodedEventId > > getSimTrackId(const edm::Handle< edm::DetSetVector< T > > &simLinks, const DetId &detId, uint32_t channel) const
collection_type::const_iterator const_iterator
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > sistripSimLinksToken_
const std::vector< uint8_t > & amplitudes() const
virtual void produce(edm::Event &, const edm::EventSetup &)