CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TopBottomClusterInfoProducer Class Reference
Inheritance diagram for TopBottomClusterInfoProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 TopBottomClusterInfoProducer (const edm::ParameterSet &iConfig)
 
 ~TopBottomClusterInfoProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::InputTag pixelClustersNew_
 
edm::InputTag pixelClustersOld_
 
edm::InputTag stripClustersNew_
 
edm::InputTag stripClustersOld_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 32 of file TopBottomClusterInfoProducer.cc.

Constructor & Destructor Documentation

TopBottomClusterInfoProducer::TopBottomClusterInfoProducer ( const edm::ParameterSet iConfig)

Definition at line 48 of file TopBottomClusterInfoProducer.cc.

48  :
49  stripClustersOld_(iConfig.getParameter<InputTag>("stripClustersOld")),
50  pixelClustersOld_(iConfig.getParameter<InputTag>("pixelClustersOld")),
51  stripClustersNew_(iConfig.getParameter<InputTag>("stripClustersNew")),
52  pixelClustersNew_(iConfig.getParameter<InputTag>("pixelClustersNew"))
53 {
54  produces< ClusterRemovalInfo >();
55 }
T getParameter(std::string const &) const
TopBottomClusterInfoProducer::~TopBottomClusterInfoProducer ( )

Definition at line 58 of file TopBottomClusterInfoProducer.cc.

59 {
60 }

Member Function Documentation

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_.

64 {
65 
67  iEvent.getByLabel(pixelClustersOld_, pixelClustersOld);
69  iEvent.getByLabel(stripClustersOld_, stripClustersOld);
70 
72  iEvent.getByLabel(pixelClustersNew_, pixelClustersNew);
74  iEvent.getByLabel(stripClustersNew_, stripClustersNew);
75 
76  auto_ptr<ClusterRemovalInfo> cri(new ClusterRemovalInfo(pixelClustersOld, stripClustersOld));
77  ClusterRemovalInfo::Indices& pixelInd = cri->pixelIndices();
78  ClusterRemovalInfo::Indices& stripInd = cri->stripIndices();
79  stripInd.reserve(stripClustersNew->size());
80  pixelInd.reserve(pixelClustersNew->size());
81 
82  //const SiStripCluster * firstOffsetStripNew = & stripClustersNew->data().front();
83  for (edmNew::DetSetVector<SiStripCluster>::const_iterator itdetNew = stripClustersNew->begin(); itdetNew != stripClustersNew->end(); ++itdetNew) {
84  edmNew::DetSet<SiStripCluster> oldDSstripNew = *itdetNew;
85  if (oldDSstripNew.empty()) continue; // skip empty detsets
86  for (edmNew::DetSet<SiStripCluster>::const_iterator clNew = oldDSstripNew.begin(); clNew != oldDSstripNew.end(); ++clNew) {
87  uint16_t firstStripNew = clNew->firstStrip();
88  uint32_t idStripNew = itdetNew->id();
89  //uint32_t keyNew = ((&*clNew) - firstOffsetStripNew);
90  //cout << "new strip index=" << keyNew << endl;
91  uint32_t keyOld=99999;
92 
93  const SiStripCluster * firstOffsetStripOld = & stripClustersOld->data().front();
94  edmNew::DetSetVector<SiStripCluster>::const_iterator itdetOld = stripClustersOld->find(itdetNew->id());
95  if (itdetOld != stripClustersOld->end()) {
96  edmNew::DetSet<SiStripCluster> oldDSstripOld = *itdetOld;
97  if (oldDSstripOld.empty()) continue; // skip empty detsets
98  for (edmNew::DetSet<SiStripCluster>::const_iterator clOld = oldDSstripOld.begin(); clOld != oldDSstripOld.end(); ++clOld) {
99  uint16_t firstStripOld = clOld->firstStrip();
100  uint32_t idStripOld = itdetOld->id();
101  if (idStripNew==idStripOld && firstStripNew==firstStripOld) {
102  keyOld = ((&*clOld) - firstOffsetStripOld);
103  //cout << "old strip index=" << keyOld << endl;
104  break;
105  }
106  }
107  }
108  //assert(keyOld!=99999);
109  //cout << "push back strip index=" << keyOld << endl;
110  stripInd.push_back(keyOld);
111  }
112  }
113 
114 
115  //const SiPixelCluster * firstOffsetPixelNew = & pixelClustersNew->data().front();
116  for (edmNew::DetSetVector<SiPixelCluster>::const_iterator itdetNew = pixelClustersNew->begin(); itdetNew != pixelClustersNew->end(); ++itdetNew) {
117  edmNew::DetSet<SiPixelCluster> oldDSpixelNew = *itdetNew;
118  if (oldDSpixelNew.empty()) continue; // skip empty detsets
119  for (edmNew::DetSet<SiPixelCluster>::const_iterator clNew = oldDSpixelNew.begin(); clNew != oldDSpixelNew.end(); ++clNew) {
120  int minPixelRowNew = clNew->minPixelRow();
121  //uint32_t keyNew = ((&*clNew) - firstOffsetPixelNew);
122  //cout << "new pixel index=" << keyNew << endl;
123  uint32_t keyOld=99999;
124 
125  const SiPixelCluster * firstOffsetPixelOld = & pixelClustersOld->data().front();
126  edmNew::DetSetVector<SiPixelCluster>::const_iterator itdetOld = pixelClustersOld->find(oldDSpixelNew.detId());
127  if (itdetOld != pixelClustersOld->end()) {
128  edmNew::DetSet<SiPixelCluster> oldDSpixelOld = *itdetOld;
129  if (oldDSpixelOld.empty()) continue; // skip empty detsets
130  for (edmNew::DetSet<SiPixelCluster>::const_iterator clOld = oldDSpixelOld.begin(); clOld != oldDSpixelOld.end(); ++clOld) {
131  int minPixelRowOld = clOld->minPixelRow();
132  if (minPixelRowNew==minPixelRowOld) {
133  keyOld = ((&*clOld) - firstOffsetPixelOld);
134  //cout << "old pixel index=" << keyOld << endl;
135  break;
136  }
137  }
138  }
139  assert(keyOld!=99999);
140  //cout << "push back pixel index=" << keyOld << endl;
141  pixelInd.push_back(keyOld);
142  }
143  }
144 
145  //cout << "pixelInd size" << pixelInd.size() << endl;
146  //cout << "stripInd size" << stripInd.size() << endl;
147 
148  cri->setNewPixelClusters(edm::OrphanHandle<SiPixelClusterCollectionNew>(pixelClustersNew.product(),pixelClustersNew.id()));
149  cri->setNewStripClusters(edm::OrphanHandle<edmNew::DetSetVector<SiStripCluster> >(stripClustersNew.product(),stripClustersNew.id()));
150 
151  iEvent.put(cri);
152 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
ProductID id() const
Definition: HandleBase.cc:15
data_type const * const_iterator
Definition: DetSetNew.h:25
id_type id(size_t cell) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool empty() const
Definition: DetSetNew.h:78
std::vector< uint32_t > Indices
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
id_type detId() const
Definition: DetSetNew.h:72
T const * product() const
Definition: Handle.h:74
Pixel cluster – collection of neighboring pixels above threshold.
iterator end()
Definition: DetSetNew.h:59
id_type id() const
Definition: DetSetNew.h:69
iterator begin()
Definition: DetSetNew.h:56

Member Data Documentation

edm::InputTag TopBottomClusterInfoProducer::pixelClustersNew_
private

Definition at line 40 of file TopBottomClusterInfoProducer.cc.

Referenced by produce().

edm::InputTag TopBottomClusterInfoProducer::pixelClustersOld_
private

Definition at line 39 of file TopBottomClusterInfoProducer.cc.

Referenced by produce().

edm::InputTag TopBottomClusterInfoProducer::stripClustersNew_
private

Definition at line 40 of file TopBottomClusterInfoProducer.cc.

Referenced by produce().

edm::InputTag TopBottomClusterInfoProducer::stripClustersOld_
private

Definition at line 39 of file TopBottomClusterInfoProducer.cc.

Referenced by produce().