Public Member Functions | |
void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
TopBottomClusterInfoProducer (const edm::ParameterSet &iConfig) | |
~TopBottomClusterInfoProducer () | |
Private Attributes | |
edm::InputTag | pixelClustersNew_ |
edm::InputTag | pixelClustersOld_ |
edm::InputTag | stripClustersNew_ |
edm::InputTag | stripClustersOld_ |
Definition at line 32 of file TopBottomClusterInfoProducer.cc.
TopBottomClusterInfoProducer::TopBottomClusterInfoProducer | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 48 of file TopBottomClusterInfoProducer.cc.
: stripClustersOld_(iConfig.getParameter<InputTag>("stripClustersOld")), pixelClustersOld_(iConfig.getParameter<InputTag>("pixelClustersOld")), stripClustersNew_(iConfig.getParameter<InputTag>("stripClustersNew")), pixelClustersNew_(iConfig.getParameter<InputTag>("pixelClustersNew")) { produces< ClusterRemovalInfo >(); }
TopBottomClusterInfoProducer::~TopBottomClusterInfoProducer | ( | ) |
Definition at line 58 of file TopBottomClusterInfoProducer.cc.
{ }
void TopBottomClusterInfoProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 63 of file TopBottomClusterInfoProducer.cc.
References edmNew::DetSet< T >::begin(), edmNew::DetSet< T >::detId(), edmNew::DetSet< T >::empty(), edmNew::DetSet< T >::end(), edm::Event::getByLabel(), edmNew::DetSet< T >::id(), edm::HandleBase::id(), edmNew::DetSetVector< T >::id(), pixelClustersNew_, pixelClustersOld_, edm::Handle< T >::product(), edm::Event::put(), stripClustersNew_, and stripClustersOld_.
{ Handle<edmNew::DetSetVector<SiPixelCluster> > pixelClustersOld; iEvent.getByLabel(pixelClustersOld_, pixelClustersOld); Handle<edmNew::DetSetVector<SiStripCluster> > stripClustersOld; iEvent.getByLabel(stripClustersOld_, stripClustersOld); Handle<edmNew::DetSetVector<SiPixelCluster> > pixelClustersNew; iEvent.getByLabel(pixelClustersNew_, pixelClustersNew); Handle<edmNew::DetSetVector<SiStripCluster> > stripClustersNew; iEvent.getByLabel(stripClustersNew_, stripClustersNew); auto_ptr<ClusterRemovalInfo> cri(new ClusterRemovalInfo(pixelClustersOld, stripClustersOld)); ClusterRemovalInfo::Indices& pixelInd = cri->pixelIndices(); ClusterRemovalInfo::Indices& stripInd = cri->stripIndices(); stripInd.reserve(stripClustersNew->size()); pixelInd.reserve(pixelClustersNew->size()); //const SiStripCluster * firstOffsetStripNew = & stripClustersNew->data().front(); for (edmNew::DetSetVector<SiStripCluster>::const_iterator itdetNew = stripClustersNew->begin(); itdetNew != stripClustersNew->end(); ++itdetNew) { edmNew::DetSet<SiStripCluster> oldDSstripNew = *itdetNew; if (oldDSstripNew.empty()) continue; // skip empty detsets for (edmNew::DetSet<SiStripCluster>::const_iterator clNew = oldDSstripNew.begin(); clNew != oldDSstripNew.end(); ++clNew) { uint16_t firstStripNew = clNew->firstStrip(); uint32_t idStripNew = itdetNew->id(); //uint32_t keyNew = ((&*clNew) - firstOffsetStripNew); //cout << "new strip index=" << keyNew << endl; uint32_t keyOld=99999; const SiStripCluster * firstOffsetStripOld = & stripClustersOld->data().front(); edmNew::DetSetVector<SiStripCluster>::const_iterator itdetOld = stripClustersOld->find(itdetNew->id()); if (itdetOld != stripClustersOld->end()) { edmNew::DetSet<SiStripCluster> oldDSstripOld = *itdetOld; if (oldDSstripOld.empty()) continue; // skip empty detsets for (edmNew::DetSet<SiStripCluster>::const_iterator clOld = oldDSstripOld.begin(); clOld != oldDSstripOld.end(); ++clOld) { uint16_t firstStripOld = clOld->firstStrip(); uint32_t idStripOld = itdetOld->id(); if (idStripNew==idStripOld && firstStripNew==firstStripOld) { keyOld = ((&*clOld) - firstOffsetStripOld); //cout << "old strip index=" << keyOld << endl; break; } } } //assert(keyOld!=99999); //cout << "push back strip index=" << keyOld << endl; stripInd.push_back(keyOld); } } //const SiPixelCluster * firstOffsetPixelNew = & pixelClustersNew->data().front(); for (edmNew::DetSetVector<SiPixelCluster>::const_iterator itdetNew = pixelClustersNew->begin(); itdetNew != pixelClustersNew->end(); ++itdetNew) { edmNew::DetSet<SiPixelCluster> oldDSpixelNew = *itdetNew; if (oldDSpixelNew.empty()) continue; // skip empty detsets for (edmNew::DetSet<SiPixelCluster>::const_iterator clNew = oldDSpixelNew.begin(); clNew != oldDSpixelNew.end(); ++clNew) { int minPixelRowNew = clNew->minPixelRow(); //uint32_t keyNew = ((&*clNew) - firstOffsetPixelNew); //cout << "new pixel index=" << keyNew << endl; uint32_t keyOld=99999; const SiPixelCluster * firstOffsetPixelOld = & pixelClustersOld->data().front(); edmNew::DetSetVector<SiPixelCluster>::const_iterator itdetOld = pixelClustersOld->find(oldDSpixelNew.detId()); if (itdetOld != pixelClustersOld->end()) { edmNew::DetSet<SiPixelCluster> oldDSpixelOld = *itdetOld; if (oldDSpixelOld.empty()) continue; // skip empty detsets for (edmNew::DetSet<SiPixelCluster>::const_iterator clOld = oldDSpixelOld.begin(); clOld != oldDSpixelOld.end(); ++clOld) { int minPixelRowOld = clOld->minPixelRow(); if (minPixelRowNew==minPixelRowOld) { keyOld = ((&*clOld) - firstOffsetPixelOld); //cout << "old pixel index=" << keyOld << endl; break; } } } assert(keyOld!=99999); //cout << "push back pixel index=" << keyOld << endl; pixelInd.push_back(keyOld); } } //cout << "pixelInd size" << pixelInd.size() << endl; //cout << "stripInd size" << stripInd.size() << endl; cri->setNewPixelClusters(edm::OrphanHandle<SiPixelClusterCollectionNew>(pixelClustersNew.product(),pixelClustersNew.id())); cri->setNewStripClusters(edm::OrphanHandle<edmNew::DetSetVector<SiStripCluster> >(stripClustersNew.product(),stripClustersNew.id())); iEvent.put(cri); }
Definition at line 40 of file TopBottomClusterInfoProducer.cc.
Referenced by produce().
Definition at line 39 of file TopBottomClusterInfoProducer.cc.
Referenced by produce().
Definition at line 40 of file TopBottomClusterInfoProducer.cc.
Referenced by produce().
Definition at line 39 of file TopBottomClusterInfoProducer.cc.
Referenced by produce().