Skip to content

Commit

Permalink
Merge pull request #238 from mtosi/from-CMSSW_7_0_0_pre1_getByLabel2g…
Browse files Browse the repository at this point in the history
…etByToken

getByLabel ---> getByToken
  • Loading branch information
ktf committed Aug 9, 2013
2 parents 961c994 + 62ae0ff commit b821ef9
Show file tree
Hide file tree
Showing 75 changed files with 701 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <vector>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDFilter.h"

Expand All @@ -22,6 +23,7 @@
//
// class declaration
//
class SiStripEventSummary;

class SiStripCommissioningRunTypeFilter : public edm::EDFilter {

Expand All @@ -35,7 +37,8 @@ class SiStripCommissioningRunTypeFilter : public edm::EDFilter {
virtual bool filter(edm::Event&, const edm::EventSetup&);

// ----------member data ---------------------------
edm::InputTag inputModuleLabel_;
// edm::InputTag inputModuleLabel_;
edm::EDGetTokenT<SiStripEventSummary> summaryToken_;
std::vector<sistrip::RunType> runTypes_;

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <vector>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDFilter.h"

Expand All @@ -20,6 +21,8 @@
//
// class declaration
//
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"


class SiStripCommissioningSeedFilter : public edm::EDFilter {

Expand All @@ -33,7 +36,8 @@ class SiStripCommissioningSeedFilter : public edm::EDFilter {
virtual bool filter(edm::Event&, const edm::EventSetup&) override;

// ----------member data ---------------------------
edm::InputTag inputModuleLabel_;
// edm::InputTag inputModuleLabel_;
edm::EDGetTokenT<TrajectorySeedCollection> seedcollToken_;

};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef DQM_SiStripCommissioningSources_SiStripCommissioningSource_H
#define DQM_SiStripCommissioningSources_SiStripCommissioningSource_H

#include "FWCore/Utilities/interface/EDGetToken.h"
#include "CalibFormats/SiStripObjects/interface/SiStripFecCabling.h"
#include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
#include "DataFormats/Common/interface/DetSetVector.h"
Expand Down Expand Up @@ -96,6 +97,10 @@ class SiStripCommissioningSource : public edm::EDAnalyzer {
SiStripFecCabling* fecCabling_;

// ---------- Input / output ----------
edm::EDGetTokenT<SiStripEventSummary> inputModuleSummaryToken_;
edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > digiVirginRawToken_;
edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > digiScopeModeToken_;
edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > digiFineDelaySelectionToken_;

/** Name of digi input module. */
std::string inputModuleLabel_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// Original Author: Christophe DELAERE
// Created: Fri Jan 18 12:17:46 CET 2008
// $Id: SiStripCommissioningBasicPrescaler.cc,v 1.1 2008/07/07 16:24:08 delaer Exp $
// $Id: SiStripCommissioningBasicPrescaler.cc,v 1.1 2008/10/22 10:44:25 delaer Exp $
//
//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// Original Author: Christophe DELAERE
// Created: Fri Jan 18 12:17:46 CET 2008
// $Id: SiStripCommissioningRunTypeFilter.cc,v 1.1 2008/01/18 14:07:37 delaer Exp $
// $Id: SiStripCommissioningRunTypeFilter.cc,v 1.2 2008/04/12 20:06:27 delaer Exp $
//
//

Expand All @@ -31,7 +31,8 @@
SiStripCommissioningRunTypeFilter::SiStripCommissioningRunTypeFilter(const edm::ParameterSet& iConfig)
{
//now do what ever initialization is needed
inputModuleLabel_ = iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) ;
summaryToken_ = consumes<SiStripEventSummary>(iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) );
// inputModuleLabel_ = iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) ;
std::vector<std::string> runTypes = iConfig.getParameter<std::vector<std::string> >("runTypes");
for(std::vector<std::string>::const_iterator run = runTypes.begin(); run != runTypes.end(); ++run) {
runTypes_.push_back(SiStripEnumsAndStrings::runType(*run));
Expand All @@ -49,7 +50,8 @@ SiStripCommissioningRunTypeFilter::filter(edm::Event& iEvent, const edm::EventSe
using namespace edm;
// Retrieve commissioning information from "event summary"
edm::Handle<SiStripEventSummary> summary;
iEvent.getByLabel( inputModuleLabel_, summary );
// iEvent.getByLabel( inputModuleLabel_, summary );
iEvent.getByToken(summaryToken_, summary );
return (std::find(runTypes_.begin(),runTypes_.end(),summary->runType())!=runTypes_.end());
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// Original Author: Christophe DELAERE
// Created: Fri Jan 18 12:17:46 CET 2008
// $Id: SiStripCommissioningSeedFilter.cc,v 1.2 2008/04/12 20:06:27 delaer Exp $
// $Id: SiStripCommissioningSeedFilter.cc,v 1.1 2008/07/07 16:24:08 delaer Exp $
//
//

Expand All @@ -24,7 +24,6 @@

// user include files
#include "DQM/SiStripCommissioningSources/interface/SiStripCommissioningSeedFilter.h"
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"


//
Expand All @@ -33,7 +32,8 @@
SiStripCommissioningSeedFilter::SiStripCommissioningSeedFilter(const edm::ParameterSet& iConfig)
{
//now do what ever initialization is needed
inputModuleLabel_ = iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) ;
// inputModuleLabel_ = iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) ;
seedcollToken_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) );
}

//
Expand All @@ -47,7 +47,8 @@ SiStripCommissioningSeedFilter::filter(edm::Event& iEvent, const edm::EventSetup
using namespace edm;

edm::Handle<TrajectorySeedCollection> seedcoll;
iEvent.getByLabel(inputModuleLabel_,seedcoll);
// iEvent.getByLabel(inputModuleLabel_,seedcoll);
iEvent.getByToken(seedcollToken_,seedcoll);
bool result = (*seedcoll).size()>0;
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ ClusterCount::ClusterCount(const edm::ParameterSet& iConfig)

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

}

Expand All @@ -32,7 +33,8 @@ ClusterCount::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
using namespace edm;
// look at the clusters
edm::Handle<edm::DetSetVector<SiStripCluster> > clusters;
iEvent.getByLabel(clusterLabel_, clusters);
// iEvent.getByLabel(clusterLabel_, 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++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//
// Original Author: Christophe DELAERE
// Created: Tue May 27 11:11:05 CEST 2008
// $Id: ClusterCount.h,v 1.2 2010/01/04 16:40:10 lowette Exp $
// $Id: ClusterCount.h,v 1.3 2010/02/20 20:59:01 wmtan Exp $
//
//

Expand All @@ -24,6 +24,7 @@
#include <memory>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"

Expand Down Expand Up @@ -54,7 +55,8 @@ class ClusterCount : public edm::EDAnalyzer {
virtual void analyze(const edm::Event&, const edm::EventSetup&);

// ----------member data ---------------------------
edm::InputTag clusterLabel_;
// edm::InputTag clusterLabel_;
edm::EDGetTokenT<edm::DetSetVector<SiStripCluster> > clusterToken_;

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// Original Author: Christophe DELAERE
// Created: Fri Nov 17 10:52:42 CET 2006
// $Id: SiStripFineDelayHit.cc,v 1.17 2012/01/17 10:04:37 innocent Exp $
// $Id: SiStripFineDelayHit.cc,v 1.18 2013/02/27 15:07:58 davidlt Exp $
//
//

Expand All @@ -35,7 +35,6 @@

#include "DataFormats/Common/interface/Ref.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackExtra.h"
Expand All @@ -44,15 +43,11 @@
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
#include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
#include "DataFormats/Candidate/interface/Candidate.h"
#include <DataFormats/SiStripCommon/interface/SiStripEventSummary.h>
#include <DataFormats/SiStripCommon/interface/ConstantsForRunType.h>
#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
#include <DataFormats/SiStripCommon/interface/SiStripFedKey.h>
#include <CondFormats/SiStripObjects/interface/FedChannelConnection.h>
#include <CondFormats/SiStripObjects/interface/SiStripFedCabling.h>
Expand Down Expand Up @@ -95,12 +90,21 @@ SiStripFineDelayHit::SiStripFineDelayHit(const edm::ParameterSet& iConfig):event
maxAngle_ = iConfig.getParameter<double>("MaxTrackAngle");
minTrackP2_ = iConfig.getParameter<double>("MinTrackMomentum")*iConfig.getParameter<double>("MinTrackMomentum");
maxClusterDistance_ = iConfig.getParameter<double>("MaxClusterDistance");
/*
clusterLabel_ = iConfig.getParameter<edm::InputTag>("ClustersLabel");
trackLabel_ = iConfig.getParameter<edm::InputTag>("TracksLabel");
seedLabel_ = iConfig.getParameter<edm::InputTag>("SeedsLabel");
inputModuleLabel_ = iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) ;
digiLabel_ = iConfig.getParameter<edm::InputTag>("DigiLabel");
homeMadeClusters_ = iConfig.getParameter<bool>("NoClustering");
*/
clustersToken_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<edm::InputTag>("ClustersLabel") );
trackToken_ = consumes<std::vector<Trajectory> > (iConfig.getParameter<edm::InputTag>("TracksLabel") );
trackCollectionToken_ = consumes<reco::TrackCollection> (iConfig.getParameter<edm::InputTag>("TracksLabel") );
seedcollToken_ = consumes<TrajectorySeedCollection> (iConfig.getParameter<edm::InputTag>("SeedsLabel") );
inputModuleToken_ = consumes<SiStripEventSummary> (iConfig.getParameter<edm::InputTag>( "InputModuleLabel" ) );
digiToken_ = consumes<edm::DetSetVector<SiStripDigi> > (iConfig.getParameter<edm::InputTag>("DigiLabel") );

homeMadeClusters_ = iConfig.getParameter<bool>("NoClustering");
explorationWindow_ = iConfig.getParameter<uint32_t>("ExplorationWindow");
noTracking_ = iConfig.getParameter<bool>("NoTracking");
mode_=0;
Expand Down Expand Up @@ -180,7 +184,8 @@ std::vector< std::pair<uint32_t,std::pair<double, double> > > SiStripFineDelayHi
}
} else {
edm::Handle<TrajectorySeedCollection> seedcoll;
event_->getByLabel(seedLabel_,seedcoll);
// event_->getByLabel(seedLabel_,seedcoll);
event_->getByToken(seedcollToken_,seedcoll);
// use trajectories in event.
hitangle = anglefinder_->findtrackangle(trajVec);
}
Expand Down Expand Up @@ -351,7 +356,8 @@ SiStripFineDelayHit::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
using namespace edm;
// Retrieve commissioning information from "event summary"
edm::Handle<SiStripEventSummary> runsummary;
iEvent.getByLabel( inputModuleLabel_, runsummary );
// iEvent.getByLabel( inputModuleLabel_, runsummary );
iEvent.getByToken( inputModuleToken_, runsummary );
if(runsummary->runType()==sistrip::APV_LATENCY) mode_ = 2; // LatencyScan
else if(runsummary->runType()==sistrip::FINE_DELAY) mode_ = 1; // DelayScan
else {
Expand All @@ -369,7 +375,8 @@ SiStripFineDelayHit::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
output.reserve(100);
// access the tracks
edm::Handle<reco::TrackCollection> trackCollection;
iEvent.getByLabel(trackLabel_,trackCollection);
// iEvent.getByLabel(trackLabel_,trackCollection);
iEvent.getByToken(trackCollectionToken_,trackCollection);
const reco::TrackCollection *tracks=trackCollection.product();
edm::ESHandle<TrackerGeometry> tracker;
iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
Expand All @@ -380,17 +387,20 @@ SiStripFineDelayHit::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
edm::Handle< edm::DetSetVector<SiStripDigi> > hits;
const edm::DetSetVector<SiStripDigi>* hitSet = NULL;
if(homeMadeClusters_) {
iEvent.getByLabel(digiLabel_,hits);
// iEvent.getByLabel(digiLabel_,hits);
iEvent.getByToken(digiToken_,hits);
hitSet = hits.product();
}
// look at the clusters
edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusters;
iEvent.getByLabel(clusterLabel_, clusters);
// iEvent.getByLabel(clusterLabel_, clusters);
iEvent.getByToken(clustersToken_, clusters);
const edmNew::DetSetVector<SiStripCluster>* clusterSet = clusters.product();
// look at the trajectories if they are in the event
std::vector<Trajectory> trajVec;
edm::Handle<std::vector<Trajectory> > TrajectoryCollection;
iEvent.getByLabel(trackLabel_,TrajectoryCollection);
// iEvent.getByLabel(trackLabel_,TrajectoryCollection);
iEvent.getByToken(trackToken_,TrajectoryCollection);
trajVec = *(TrajectoryCollection.product());
// loop on tracks
for(reco::TrackCollection::const_iterator itrack = tracks->begin(); itrack<tracks->end(); itrack++) {
Expand All @@ -401,7 +411,8 @@ SiStripFineDelayHit::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
if(mode_==1) {
// Retrieve and decode commissioning information from "event summary"
edm::Handle<SiStripEventSummary> summary;
iEvent.getByLabel( inputModuleLabel_, summary );
// iEvent.getByLabel( inputModuleLabel_, summary );
iEvent.getByToken( inputModuleToken_, summary );
uint32_t layerCode = (const_cast<SiStripEventSummary*>(summary.product())->layerScanned())>>16;
StripSubdetector::SubDetector subdet = StripSubdetector::TIB;
if(((layerCode>>6)&0x3)==0) subdet = StripSubdetector::TIB;
Expand Down Expand Up @@ -486,7 +497,8 @@ SiStripFineDelayHit::produceNoTracking(edm::Event& iEvent, const edm::EventSetup
output.reserve(100);
// Retrieve and decode commissioning information from "event summary"
edm::Handle<SiStripEventSummary> summary;
iEvent.getByLabel( inputModuleLabel_, summary );
// iEvent.getByLabel( inputModuleLabel_, summary );
iEvent.getByToken( inputModuleToken_, summary );
uint32_t layerCode = (const_cast<SiStripEventSummary*>(summary.product())->layerScanned())>>16;
StripSubdetector::SubDetector subdet = StripSubdetector::TIB;
if(((layerCode>>6)&0x3)==0) subdet = StripSubdetector::TIB;
Expand All @@ -497,7 +509,8 @@ SiStripFineDelayHit::produceNoTracking(edm::Event& iEvent, const edm::EventSetup
std::pair<uint32_t, uint32_t> mask = deviceMask(subdet,layerIdx);
// look at the clusters
edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusters;
iEvent.getByLabel(clusterLabel_,clusters);
// iEvent.getByLabel(clusterLabel_,clusters);
iEvent.getByToken(clustersToken_,clusters);
for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=clusters->begin(); DSViter!=clusters->end();DSViter++ ) {
// check that we are in the layer of interest
if(mode_==1 && ((DSViter->id() & mask.first) != mask.second) ) continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <utility>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
Expand All @@ -24,6 +25,12 @@
#include <TrackingTools/PatternTools/interface/Trajectory.h>
#include "DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayTLA.h"

#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
#include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
#include <DataFormats/SiStripCommon/interface/SiStripEventSummary.h>

//
// class decleration
//
Expand Down Expand Up @@ -54,7 +61,13 @@ class SiStripFineDelayHit : public edm::EDProducer {
double maxAngle_, minTrackP2_, maxClusterDistance_;
int mode_; // 1=delayScan 2=latencyScan
int explorationWindow_;
edm::InputTag digiLabel_, clusterLabel_, trackLabel_, seedLabel_, inputModuleLabel_;
// edm::InputTag digiLabel_, clusterLabel_, trackLabel_, seedLabel_, inputModuleLabel_;
edm::EDGetTokenT<TrajectorySeedCollection> seedcollToken_;
edm::EDGetTokenT<SiStripEventSummary> inputModuleToken_;
edm::EDGetTokenT<reco::TrackCollection> trackCollectionToken_;
edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > digiToken_;
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clustersToken_;
edm::EDGetTokenT<std::vector<Trajectory> > trackToken_;
std::map<uint32_t,uint32_t> connectionMap_;
};

Expand Down
Loading

0 comments on commit b821ef9

Please sign in to comment.