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 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersNew_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
id_type id() const
Definition: DetSetNew.h:61
data_type const * const_iterator
Definition: DetSetNew.h:31
assert(be >=bs)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClustersOld_
bool empty() const
Definition: DetSetNew.h:67
id_type detId() const
Definition: DetSetNew.h:63
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClustersNew_
int iEvent
Definition: GenABIO.cc:224
id_type id(size_t cell) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< uint32_t > Indices
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Pixel cluster – collection of neighboring pixels above threshold.
fixed size matrix
HLT enums.
iterator end()
Definition: DetSetNew.h:53
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
TopBottomClusterInfoProducer(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersOld_
def move(src, dest)
Definition: eostools.py:511
iterator begin()
Definition: DetSetNew.h:51