Skip to content

Commit

Permalink
implement review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
guitargeek committed Jul 8, 2020
1 parent 8a4ac53 commit dbff213
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 91 deletions.
1 change: 0 additions & 1 deletion DQM/BeamMonitor/plugins/BeamSpotProblemMonitor.cc
Expand Up @@ -14,7 +14,6 @@
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "RecoVertex/BeamSpotProducer/interface/BeamSpotOnlineProducer.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"

Expand Down
1 change: 1 addition & 0 deletions RecoHI/HiTracking/test/BuildFile.xml
@@ -1,5 +1,6 @@
<use name="root"/>
<use name="CommonTools/UtilAlgos"/>
<use name="DataFormats/SiPixelDetId"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="Geometry/CommonDetUnit"/>
<use name="Geometry/Records"/>
Expand Down
40 changes: 7 additions & 33 deletions RecoHI/HiTracking/test/HIPixelClusterVtxAnalyzer.cc
@@ -1,20 +1,13 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"

#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"

#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"

#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h"
Expand All @@ -36,18 +29,9 @@
// ROOT includes
#include <TH1.h>

namespace edm {
class Run;
class Event;
class EventSetup;
} // namespace edm

class TrackerGeometry;

class HIPixelClusterVtxAnalyzer : public edm::EDAnalyzer {
public:
explicit HIPixelClusterVtxAnalyzer(const edm::ParameterSet &ps);
~HIPixelClusterVtxAnalyzer();

private:
struct VertexHit {
Expand Down Expand Up @@ -83,11 +67,6 @@ HIPixelClusterVtxAnalyzer::HIPixelClusterVtxAnalyzer(const edm::ParameterSet &ps
// Constructor
}

/*****************************************************************************/
HIPixelClusterVtxAnalyzer::~HIPixelClusterVtxAnalyzer() {
// Destructor
}

/*****************************************************************************/
void HIPixelClusterVtxAnalyzer::analyze(const edm::Event &ev, const edm::EventSetup &es) {
if (counter > maxHists_)
Expand All @@ -102,9 +81,6 @@ void HIPixelClusterVtxAnalyzer::analyze(const edm::Event &ev, const edm::EventSe
minZ_,
maxZ_);

// new vertex collection
auto vertices = std::make_unique<reco::VertexCollection>();

// get pixel rechits
edm::Handle<SiPixelRecHitCollection> hRecHits;
try {
Expand All @@ -121,19 +97,17 @@ void HIPixelClusterVtxAnalyzer::analyze(const edm::Event &ev, const edm::EventSe

// loop over pixel rechits
std::vector<VertexHit> vhits;
for (SiPixelRecHitCollection::DataContainer::const_iterator hit = hits->data().begin(), end = hits->data().end();
hit != end;
++hit) {
if (!hit->isValid())
for (auto const &hit : hits->data()) {
if (!hit.isValid())
continue;
DetId id(hit->geographicalId());
DetId id(hit.geographicalId());
if (id.subdetId() != int(PixelSubdetector::PixelBarrel))
continue;
const PixelGeomDetUnit *pgdu = static_cast<const PixelGeomDetUnit *>(tgeo->idToDet(id));
if (1) {
const RectangularPixelTopology *pixTopo =
static_cast<const RectangularPixelTopology *>(&(pgdu->specificTopology()));
std::vector<SiPixelCluster::Pixel> pixels(hit->cluster()->pixels());
std::vector<SiPixelCluster::Pixel> pixels(hit.cluster()->pixels());
bool pixelOnEdge = false;
for (std::vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin(); pixel != pixels.end();
++pixel) {
Expand All @@ -148,12 +122,12 @@ void HIPixelClusterVtxAnalyzer::analyze(const edm::Event &ev, const edm::EventSe
continue;
}

LocalPoint lpos = LocalPoint(hit->localPosition().x(), hit->localPosition().y(), hit->localPosition().z());
LocalPoint lpos = LocalPoint(hit.localPosition().x(), hit.localPosition().y(), hit.localPosition().z());
GlobalPoint gpos = pgdu->toGlobal(lpos);
VertexHit vh;
vh.z = gpos.z();
vh.r = gpos.perp();
vh.w = hit->cluster()->sizeY();
vh.w = hit.cluster()->sizeY();
vhits.push_back(vh);
}

Expand Down
50 changes: 0 additions & 50 deletions RecoVertex/BeamSpotProducer/interface/BeamSpotOnlineProducer.h

This file was deleted.

50 changes: 43 additions & 7 deletions RecoVertex/BeamSpotProducer/plugins/BeamSpotOnlineProducer.cc
@@ -1,10 +1,47 @@
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
#include "RecoVertex/BeamSpotProducer/interface/BeamSpotOnlineProducer.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
/**_________________________________________________________________
class: BeamSpotOnlineProducer.h
package: RecoVertex/BeamSpotProducer
author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
________________________________________________________________**/

#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
#include "DataFormats/Scalers/interface/BeamSpotOnline.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
#include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/IOVSyncValue.h"
#include "FWCore/Framework/interface/MakerMacros.h"
//#include "FWCore/Framework/interface/IOVSyncValue.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/ESGetToken.h"

class BeamSpotOnlineProducer : public edm::stream::EDProducer<> {
public:
/// constructor
explicit BeamSpotOnlineProducer(const edm::ParameterSet& iConf);

/// produce a beam spot class
void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;

private:
const bool changeFrame_;
const double theMaxZ, theSetSigmaZ;
double theMaxR2;
const edm::EDGetTokenT<BeamSpotOnlineCollection> scalerToken_;
const edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> l1GtEvmReadoutRecordToken_;
const edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd> beamToken_;

const unsigned int theBeamShoutMode;
};

using namespace edm;

Expand All @@ -22,8 +59,6 @@ BeamSpotOnlineProducer::BeamSpotOnlineProducer(const ParameterSet& iconf)
produces<reco::BeamSpot>();
}

BeamSpotOnlineProducer::~BeamSpotOnlineProducer() {}

void BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup) {
//shout MODE only in stable beam
bool shoutMODE = false;
Expand Down Expand Up @@ -131,4 +166,5 @@ void BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup) {
iEvent.put(std::move(result));
}

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(BeamSpotOnlineProducer);

0 comments on commit dbff213

Please sign in to comment.