Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-sim97X Make use of ESGetToken in SimTracker/TrackerHitAssociation #36024

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
************************************************************/

//#include <vector>
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
Expand Down
3 changes: 0 additions & 3 deletions SimTracker/TrackerHitAssociation/test/TestAssociator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

#include "SimTracker/TrackerHitAssociation/test/TestAssociator.h"

//--- framework stuff
#include "FWCore/Framework/interface/ESHandle.h"

//--- for Geometry:
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
Expand Down
4 changes: 2 additions & 2 deletions SimTracker/TrackerHitAssociation/test/TestAssociator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
*
************************************************************/

#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"

class TestAssociator : public edm::EDAnalyzer {
class TestAssociator : public edm::one::EDAnalyzer<> {
public:
explicit TestAssociator(const edm::ParameterSet& conf);

Expand Down
6 changes: 3 additions & 3 deletions SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ myTrackAnalyzer::myTrackAnalyzer(edm::ParameterSet const& conf)
: trackerHitAssociatorConfig_(conf, consumesCollector()),
doPixel_(conf.getParameter<bool>("associatePixel")),
doStrip_(conf.getParameter<bool>("associateStrip")),
trackCollectionTag_(conf.getParameter<edm::InputTag>("trackCollectionTag")) {}
trackCollectionTag_(conf.getParameter<edm::InputTag>("trackCollectionTag")),
tokGeo_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()) {}

myTrackAnalyzer::~myTrackAnalyzer() {}

void myTrackAnalyzer::analyze(const edm::Event& event, const edm::EventSetup& setup) {
//
// extract tracker geometry
//
edm::ESHandle<TrackerGeometry> theG;
setup.get<TrackerDigiGeometryRecord>().get(theG);
auto const& theG = setup.getHandle(tokGeo_);

using namespace std;

Expand Down
11 changes: 5 additions & 6 deletions SimTracker/TrackerHitAssociation/test/myTrackAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
#include <memory>

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"

#include "FWCore/Framework/interface/ESHandle.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
Expand All @@ -39,7 +37,7 @@

class SiStripHitAssociator;

class myTrackAnalyzer : public edm::EDAnalyzer {
class myTrackAnalyzer : public edm::one::EDAnalyzer<> {
public:
typedef std::map<const TrackingRecHit*, int> sim_id_map;
sim_id_map SimIdMap;
Expand All @@ -52,8 +50,9 @@ class myTrackAnalyzer : public edm::EDAnalyzer {

private:
TrackerHitAssociator::Config trackerHitAssociatorConfig_;
bool doPixel_, doStrip_;
edm::InputTag trackCollectionTag_;
const bool doPixel_, doStrip_;
const edm::InputTag trackCollectionTag_;
const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tokGeo_;
};

#endif