5
5
#include " DataFormats/GsfTrackReco/interface/GsfTrack.h"
6
6
#include " DataFormats/EgammaCandidates/interface/GsfElectron.h"
7
7
#include " DataFormats/EgammaReco/interface/BasicClusterFwd.h"
8
- #include " DataFormats/VertexReco/interface/VertexFwd.h"
9
- #include " DataFormats/VertexReco/interface/Vertex.h"
10
8
#include " DataFormats/Common/interface/Handle.h"
11
9
#include " DataFormats/BeamSpot/interface/BeamSpot.h"
12
10
#include " DataFormats/Common/interface/TriggerResults.h"
@@ -32,12 +30,12 @@ ElectronAnalyzer::ElectronAnalyzer( const edm::ParameterSet & conf )
32
30
{
33
31
// general, collections
34
32
Selection_ = conf.getParameter <int >(" Selection" );
35
- electronCollection_ = conf.getParameter <edm::InputTag>(" ElectronCollection" );
36
- matchingObjectCollection_ = conf.getParameter <edm::InputTag>(" MatchingObjectCollection" );
37
- trackCollection_ = conf.getParameter <edm::InputTag>(" TrackCollection" );
38
- vertexCollection_ = conf.getParameter <edm::InputTag>(" VertexCollection" );
39
- gsftrackCollection_ = conf.getParameter <edm::InputTag>(" GsfTrackCollection" );
40
- beamSpotTag_ = conf.getParameter <edm::InputTag>(" BeamSpot" );
33
+ electronCollection_ = consumes<GsfElectronCollection>( conf.getParameter <edm::InputTag>(" ElectronCollection" ) );
34
+ matchingObjectCollection_ = consumes<SuperClusterCollection>( conf.getParameter <edm::InputTag>(" MatchingObjectCollection" ) );
35
+ trackCollection_ = consumes<TrackCollection>( conf.getParameter <edm::InputTag>(" TrackCollection" ) );
36
+ vertexCollection_ = consumes<VertexCollection>( conf.getParameter <edm::InputTag>(" VertexCollection" ) );
37
+ gsftrackCollection_ = consumes<GsfTrackCollection>( conf.getParameter <edm::InputTag>(" GsfTrackCollection" ) );
38
+ beamSpotTag_ = consumes<BeamSpot>( conf.getParameter <edm::InputTag>(" BeamSpot" ) );
41
39
readAOD_ = conf.getParameter <bool >(" ReadAOD" );
42
40
43
41
// matching
@@ -282,10 +280,12 @@ void ElectronAnalyzer::book()
282
280
283
281
// matching object
284
282
std::string matchingObjectType ;
285
- if (std::string::npos!=matchingObjectCollection_.label ().find (" SuperCluster" ,0 ))
286
- { matchingObjectType = " SC" ; }
283
+ Labels l;
284
+ labelsForToken (matchingObjectCollection_,l);
285
+ if (std::string::npos != std::string (l.module ).find (" SuperCluster" ,0 ))
286
+ { matchingObjectType = " SC" ; }
287
287
if (matchingObjectType==" " )
288
- { edm::LogError (" ElectronMcFakeValidator::beginJob" )<<" Unknown matching object type !" ; }
288
+ { edm::LogError (" ElectronMcFakeValidator::beginJob" )<<" Unknown matching object type !" ; }
289
289
else
290
290
{ edm::LogInfo (" ElectronMcFakeValidator::beginJob" )<<" Matching object type: " <<matchingObjectType ; }
291
291
// std::string htitle = "# "+matchingObjectType+"s", xtitle = "N_{"+matchingObjectType+"}" ;
@@ -317,30 +317,19 @@ void ElectronAnalyzer::book()
317
317
void ElectronAnalyzer::analyze ( const edm::Event& iEvent, const edm::EventSetup & iSetup )
318
318
{
319
319
nEvents_++ ;
320
- // if (!trigger(iEvent)) return ;
321
- // nAfterTrigger_++ ;
322
-
323
- // edm::Handle<SuperClusterCollection> barrelSCs ;
324
- // iEvent.getByLabel("correctedHybridSuperClusters",barrelSCs) ;
325
- // edm::Handle<SuperClusterCollection> endcapsSCs ;
326
- // iEvent.getByLabel("correctedMulti5x5SuperClustersWithPreshower",endcapsSCs) ;
327
- // std::cout<<"[ElectronMcSignalValidator::analyze]"
328
- // <<"Event "<<iEvent.id()
329
- // <<" has "<<barrelSCs.product()->size()<<" barrel superclusters"
330
- // <<" and "<<endcapsSCs.product()->size()<<" endcaps superclusters" ;
331
- //
320
+
332
321
edm::Handle <GsfElectronCollection> gsfElectrons ;
333
- iEvent.getByLabel (electronCollection_,gsfElectrons) ;
322
+ iEvent.getByToken (electronCollection_,gsfElectrons) ;
334
323
edm::Handle <reco::SuperClusterCollection> recoClusters ;
335
- iEvent.getByLabel (matchingObjectCollection_,recoClusters) ;
324
+ iEvent.getByToken (matchingObjectCollection_,recoClusters) ;
336
325
edm::Handle <reco::TrackCollection> tracks;
337
- iEvent.getByLabel (trackCollection_,tracks);
326
+ iEvent.getByToken (trackCollection_,tracks);
338
327
edm::Handle <reco::GsfTrackCollection> gsfTracks;
339
- iEvent.getByLabel (gsftrackCollection_,gsfTracks);
328
+ iEvent.getByToken (gsftrackCollection_,gsfTracks);
340
329
edm::Handle <reco::VertexCollection> vertices;
341
- iEvent.getByLabel (vertexCollection_,vertices);
330
+ iEvent.getByToken (vertexCollection_,vertices);
342
331
edm::Handle <reco::BeamSpot> recoBeamSpotHandle ;
343
- iEvent.getByLabel (beamSpotTag_,recoBeamSpotHandle) ;
332
+ iEvent.getByToken (beamSpotTag_,recoBeamSpotHandle) ;
344
333
const BeamSpot bs = *recoBeamSpotHandle ;
345
334
346
335
int ievt = iEvent.id ().event ();
0 commit comments