Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#include "DQM/SiStripCommissioningSources/plugins/tracking/ClusterCount.h"

//
// constructors and destructor
//
ClusterCount::ClusterCount(const edm::ParameterSet& iConfig)

{
  //now do what ever initialization is needed
  //   clusterLabel_ = iConfig.getParameter<edm::InputTag>("ClustersLabel");
  clusterToken_ = consumes<edm::DetSetVector<SiStripCluster> >(iConfig.getParameter<edm::InputTag>("ClustersLabel"));
}

ClusterCount::~ClusterCount() {
  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)
}

void ClusterCount::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&, edm::EventSetup const&) {}

//
// member functions
//

// ------------ method called to for each event  ------------
void ClusterCount::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
  using namespace edm;
  // look at the clusters
  edm::Handle<edm::DetSetVector<SiStripCluster> > clusters;
  iEvent.getByToken(clusterToken_, clusters);
  const edm::DetSetVector<SiStripCluster>* clusterSet = clusters.product();
  // loop on the detsetvector<cluster>
  for (edm::DetSetVector<SiStripCluster>::const_iterator DSViter = clusterSet->begin(); DSViter != clusterSet->end();
       DSViter++) {
    edm::DetSet<SiStripCluster>::const_iterator begin = DSViter->data.begin();
    edm::DetSet<SiStripCluster>::const_iterator end = DSViter->data.end();
    for (edm::DetSet<SiStripCluster>::const_iterator iter = begin; iter != end; ++iter) {
      LogDebug("ReconstructedClusters") << "Detid/Strip: " << std::hex << DSViter->id << std::dec << " / "
                                        << iter->barycenter();
    }
  }
}