CMS 3D CMS Logo

TopBottomClusterInfoProducer.cc
Go to the documentation of this file.
6 
21 
24 
28 //
29 // class decleration
30 //
31 
33 public:
36  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
37 
38 private:
43 };
44 
45 using namespace std;
46 using namespace edm;
47 using namespace reco;
48 
50  pixelClustersOld_ =
51  consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<edm::InputTag>("stripClustersOld"));
52  stripClustersOld_ =
53  consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<edm::InputTag>("pixelClustersOld"));
54  pixelClustersNew_ =
55  consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<edm::InputTag>("stripClustersNew"));
56  stripClustersNew_ =
57  consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<edm::InputTag>("pixelClustersNew"));
58  produces<ClusterRemovalInfo>();
59 }
60 
62 
65  iEvent.getByToken(pixelClustersOld_, pixelClustersOld);
67  iEvent.getByToken(stripClustersOld_, stripClustersOld);
68 
70  iEvent.getByToken(pixelClustersNew_, pixelClustersNew);
72  iEvent.getByToken(stripClustersNew_, stripClustersNew);
73 
74  auto cri = std::make_unique<ClusterRemovalInfo>(pixelClustersOld, stripClustersOld);
75  ClusterRemovalInfo::Indices& pixelInd = cri->pixelIndices();
76  ClusterRemovalInfo::Indices& stripInd = cri->stripIndices();
77  stripInd.reserve(stripClustersNew->size());
78  pixelInd.reserve(pixelClustersNew->size());
79 
80  //const SiStripCluster * firstOffsetStripNew = & stripClustersNew->data().front();
82  itdetNew != stripClustersNew->end();
83  ++itdetNew) {
84  edmNew::DetSet<SiStripCluster> oldDSstripNew = *itdetNew;
85  if (oldDSstripNew.empty())
86  continue; // skip empty detsets
87  for (edmNew::DetSet<SiStripCluster>::const_iterator clNew = oldDSstripNew.begin(); clNew != oldDSstripNew.end();
88  ++clNew) {
89  uint16_t firstStripNew = clNew->firstStrip();
90  uint32_t idStripNew = itdetNew->id();
91  //uint32_t keyNew = ((&*clNew) - firstOffsetStripNew);
92  //cout << "new strip index=" << keyNew << endl;
93  uint32_t keyOld = 99999;
94 
95  const SiStripCluster* firstOffsetStripOld = &stripClustersOld->data().front();
97  if (itdetOld != stripClustersOld->end()) {
98  edmNew::DetSet<SiStripCluster> oldDSstripOld = *itdetOld;
99  if (oldDSstripOld.empty())
100  continue; // skip empty detsets
101  for (edmNew::DetSet<SiStripCluster>::const_iterator clOld = oldDSstripOld.begin(); clOld != oldDSstripOld.end();
102  ++clOld) {
103  uint16_t firstStripOld = clOld->firstStrip();
104  uint32_t idStripOld = itdetOld->id();
105  if (idStripNew == idStripOld && firstStripNew == firstStripOld) {
106  keyOld = ((&*clOld) - firstOffsetStripOld);
107  //cout << "old strip index=" << keyOld << endl;
108  break;
109  }
110  }
111  }
112  //assert(keyOld!=99999);
113  //cout << "push back strip index=" << keyOld << endl;
114  stripInd.push_back(keyOld);
115  }
116  }
117 
118  //const SiPixelCluster * firstOffsetPixelNew = & pixelClustersNew->data().front();
120  itdetNew != pixelClustersNew->end();
121  ++itdetNew) {
122  edmNew::DetSet<SiPixelCluster> oldDSpixelNew = *itdetNew;
123  if (oldDSpixelNew.empty())
124  continue; // skip empty detsets
125  for (edmNew::DetSet<SiPixelCluster>::const_iterator clNew = oldDSpixelNew.begin(); clNew != oldDSpixelNew.end();
126  ++clNew) {
127  int minPixelRowNew = clNew->minPixelRow();
128  //uint32_t keyNew = ((&*clNew) - firstOffsetPixelNew);
129  //cout << "new pixel index=" << keyNew << endl;
130  uint32_t keyOld = 99999;
131 
132  const SiPixelCluster* firstOffsetPixelOld = &pixelClustersOld->data().front();
134  if (itdetOld != pixelClustersOld->end()) {
135  edmNew::DetSet<SiPixelCluster> oldDSpixelOld = *itdetOld;
136  if (oldDSpixelOld.empty())
137  continue; // skip empty detsets
138  for (edmNew::DetSet<SiPixelCluster>::const_iterator clOld = oldDSpixelOld.begin(); clOld != oldDSpixelOld.end();
139  ++clOld) {
140  int minPixelRowOld = clOld->minPixelRow();
141  if (minPixelRowNew == minPixelRowOld) {
142  keyOld = ((&*clOld) - firstOffsetPixelOld);
143  //cout << "old pixel index=" << keyOld << endl;
144  break;
145  }
146  }
147  }
148  assert(keyOld != 99999);
149  //cout << "push back pixel index=" << keyOld << endl;
150  pixelInd.push_back(keyOld);
151  }
152  }
153 
154  //cout << "pixelInd size" << pixelInd.size() << endl;
155  //cout << "stripInd size" << stripInd.size() << endl;
156 
157  cri->setNewPixelClusters(
159  cri->setNewStripClusters(
161 
162  iEvent.put(std::move(cri));
163 }
164 
ClusterRemovalInfo.h
TopBottomClusterInfoProducer::TopBottomClusterInfoProducer
TopBottomClusterInfoProducer(const edm::ParameterSet &iConfig)
Definition: TopBottomClusterInfoProducer.cc:49
edm::StreamID
Definition: StreamID.h:30
TrajectoryStateOnSurface.h
Handle.h
TopBottomClusterInfoProducer_cfi.pixelClustersOld
pixelClustersOld
Definition: TopBottomClusterInfoProducer_cfi.py:5
TopBottomClusterInfoProducer_cfi.pixelClustersNew
pixelClustersNew
Definition: TopBottomClusterInfoProducer_cfi.py:7
PixelSubdetector.h
edmNew::DetSetVector::id
id_type id(size_t cell) const
Definition: DetSetVectorNew.h:564
reco::ClusterRemovalInfo::Indices
std::vector< uint32_t > Indices
Definition: ClusterRemovalInfo.h:22
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelCluster.h
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
TopBottomClusterInfoProducer::pixelClustersNew_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersNew_
Definition: TopBottomClusterInfoProducer.cc:40
cms::cuda::assert
assert(be >=bs)
SiPixelCluster
Pixel cluster – collection of neighboring pixels above threshold.
Definition: SiPixelCluster.h:27
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
TopBottomClusterInfoProducer_cfi.stripClustersNew
stripClustersNew
Definition: TopBottomClusterInfoProducer_cfi.py:6
edmNew::DetSet::end
iterator end()
Definition: DetSetNew.h:56
MakerMacros.h
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TopBottomClusterInfoProducer::stripClustersNew_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClustersNew_
Definition: TopBottomClusterInfoProducer.cc:42
ProductID.h
edmNew::DetSet
Definition: DetSetNew.h:22
TopBottomClusterInfoProducer::stripClustersOld_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClustersOld_
Definition: TopBottomClusterInfoProducer.cc:41
SiPixelRecHit.h
TrajTrackAssociation.h
edm::global::EDProducer
Definition: EDProducer.h:32
SiPixelRecHitCollection.h
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripCluster.h
Event.h
edmNew::DetSet::id
id_type id() const
Definition: DetSetNew.h:64
ModuleDef.h
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripRecHit2DCollection.h
edmNew::DetSet::begin
iterator begin()
Definition: DetSetNew.h:54
ProjectedSiStripRecHit2D.h
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
TopBottomClusterInfoProducer::~TopBottomClusterInfoProducer
~TopBottomClusterInfoProducer() override
Definition: TopBottomClusterInfoProducer.cc:61
InputTag.h
Trajectory.h
edmNew::DetSetVector
Definition: DetSetNew.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::OrphanHandle
Definition: EDProductfwd.h:39
edmNew::DetSet::detId
id_type detId() const
Definition: DetSetNew.h:66
Frameworkfwd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TopBottomClusterInfoProducer_cfi.stripClustersOld
stripClustersOld
Definition: TopBottomClusterInfoProducer_cfi.py:4
ParameterSet.h
SiStripMatchedRecHit2D.h
EDProducer.h
edm::Event
Definition: Event.h:73
SiStripCluster
Definition: SiStripCluster.h:9
SiStripRecHit2D.h
StripSubdetector.h
DetSetVectorNew.h
edmNew::DetSet::empty
bool empty() const
Definition: DetSetNew.h:70
edm::InputTag
Definition: InputTag.h:15
TopBottomClusterInfoProducer
Definition: TopBottomClusterInfoProducer.cc:32
TopBottomClusterInfoProducer::pixelClustersOld_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersOld_
Definition: TopBottomClusterInfoProducer.cc:39
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31
TopBottomClusterInfoProducer::produce
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition: TopBottomClusterInfoProducer.cc:63