CMS 3D CMS Logo

InputAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: InputAnalyzer
4 // Class: InputAnalyzer
5 //
13 //
14 // Original Author: Emilia Lubenova Becheva
15 // Created: Mon Apr 20 13:43:06 CEST 2009
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
30 
33 
35 
36 #include "InputAnalyzer.h"
37 
38 //
39 // constructors and destructor
40 //
41 namespace edm {
42 
44  dataStep2_ = iConfig.getParameter<bool>("dataStep2");
45 
46  labelPCF_ = consumes<PCrossingFrame<SimTrack>>(iConfig.getParameter<edm::InputTag>("collPCF"));
47 
48  //will only be needed if not Step2:
49  labelSimTr_ = consumes<SimTrackContainer>(iConfig.getParameter<edm::InputTag>("collSimTrack"));
50  }
51 
53 
54  //
55  // member functions
56  //
57 
58  // ------------ method called to for each event ------------
60  std::cout << " dataStep2_ = " << dataStep2_ << std::endl;
61 
62  if (!dataStep2_) {
63  // Get the SimTrack collection
64 
65  //double simPt=0;
66  int i = 0;
67 
68  // Get the SimTrack collection from the event
70  bool gotTracks = iEvent.getByToken(labelSimTr_, simTracks);
71 
72  if (!gotTracks) {
73  std::cout << "-> Could not read SimTracks !!!!" << std::endl;
74  } else {
75  std::cout << "-> Could read SimTracks !!!!" << std::endl;
76  }
77 
78  // Loop over the tracks
79  SimTrackContainer::const_iterator simTrack;
80  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack) {
81  i++;
82 
83  //simPt=(*simTrack).momentum().Pt();
84  //std::cout << " # i = " << i << " simPt = " << simPt << std::endl;
85  }
86 
87  } else {
88  // Get the PCrossingFrame collection given as signal
89 
91  bool gotTracks = iEvent.getByToken(labelPCF_, cf_simtrack);
92 
93  if (!gotTracks) {
94  std::cout << "-> Could not read PCrossingFrame<SimTracks> !!!!" << std::endl;
95  } else
96  std::cout << "-> Could read PCrossingFrame<SimTracks> !!!!" << std::endl;
97  }
98  }
99 
100  // ------------ method called once each job just before starting event loop ------------
102 
103  // ------------ method called once each job just after ending the event loop ------------
105 
106 } // namespace edm
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
edm::InputAnalyzer::labelPCF_
edm::EDGetTokenT< PCrossingFrame< SimTrack > > labelPCF_
Definition: InputAnalyzer.h:46
edm::InputAnalyzer::labelSimTr_
edm::EDGetTokenT< SimTrackContainer > labelSimTr_
Definition: InputAnalyzer.h:47
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TrackCandidateProducer_cfi.simTracks
simTracks
Definition: TrackCandidateProducer_cfi.py:15
EDAnalyzer.h
edm::Handle
Definition: AssociativeIterator.h:50
edm::InputAnalyzer::dataStep2_
bool dataStep2_
Definition: InputAnalyzer.h:45
MakerMacros.h
edm::InputAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: InputAnalyzer.cc:59
ProductID.h
edm::InputAnalyzer::~InputAnalyzer
~InputAnalyzer() override
Definition: InputAnalyzer.cc:52
edm::InputAnalyzer::endJob
void endJob() override
Definition: InputAnalyzer.cc:104
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
muonSimHitMatcherPSet.simTrack
simTrack
Definition: muonSimHitMatcherPSet.py:4
iEvent
int iEvent
Definition: GenABIO.cc:224
InputAnalyzer.h
edm::EventSetup
Definition: EventSetup.h:57
InputTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::InputAnalyzer::beginJob
void beginJob() override
Definition: InputAnalyzer.cc:101
edm::InputAnalyzer::InputAnalyzer
InputAnalyzer(const edm::ParameterSet &)
Definition: InputAnalyzer.cc:43
Frameworkfwd.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15