CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
void beginJob() override
edm::EDGetTokenT< SimTrackContainer > labelSimTr_
Definition: InputAnalyzer.h:47
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
int iEvent
Definition: GenABIO.cc:224
void endJob() override
void analyze(const edm::Event &, const edm::EventSetup &) override
InputAnalyzer(const edm::ParameterSet &)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
tuple cout
Definition: gather_cfg.py:144
~InputAnalyzer() override
edm::EDGetTokenT< PCrossingFrame< SimTrack > > labelPCF_
Definition: InputAnalyzer.h:46