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
24 
27 
29 
32 
34 
35 #include "InputAnalyzer.h"
36 
37 //
38 // constructors and destructor
39 //
40 namespace edm {
41 
43  dataStep2_ = iConfig.getParameter<bool>("dataStep2");
44 
45  labelPCF_ = consumes<PCrossingFrame<SimTrack>>(iConfig.getParameter<edm::InputTag>("collPCF"));
46 
47  //will only be needed if not Step2:
48  labelSimTr_ = consumes<SimTrackContainer>(iConfig.getParameter<edm::InputTag>("collSimTrack"));
49  }
50 
52 
53  //
54  // member functions
55  //
56 
57  // ------------ method called to for each event ------------
59  std::cout << " dataStep2_ = " << dataStep2_ << std::endl;
60 
61  if (!dataStep2_) {
62  // Get the SimTrack collection
63 
64  //double simPt=0;
65  int i = 0;
66 
67  // Get the SimTrack collection from the event
69  bool gotTracks = iEvent.getByToken(labelSimTr_, simTracks);
70 
71  if (!gotTracks) {
72  std::cout << "-> Could not read SimTracks !!!!" << std::endl;
73  } else {
74  std::cout << "-> Could read SimTracks !!!!" << std::endl;
75  }
76 
77  // Loop over the tracks
78  SimTrackContainer::const_iterator simTrack;
79  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack) {
80  i++;
81 
82  //simPt=(*simTrack).momentum().Pt();
83  //std::cout << " # i = " << i << " simPt = " << simPt << std::endl;
84  }
85 
86  } else {
87  // Get the PCrossingFrame collection given as signal
88 
90  bool gotTracks = iEvent.getByToken(labelPCF_, cf_simtrack);
91 
92  if (!gotTracks) {
93  std::cout << "-> Could not read PCrossingFrame<SimTracks> !!!!" << std::endl;
94  } else
95  std::cout << "-> Could read PCrossingFrame<SimTracks> !!!!" << std::endl;
96  }
97  }
98 
99  // ------------ method called once each job just before starting event loop ------------
101 
102  // ------------ method called once each job just after ending the event loop ------------
104 
105 } // 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