CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
31 
32 
35 
37 
38 #include "InputAnalyzer.h"
39 
40 
41 //
42 // constructors and destructor
43 //
44 namespace edm
45 {
46 
48 {
49 
50  dataStep2_ = iConfig.getParameter<bool>("dataStep2");
51 
52  labelPCF_ = consumes<PCrossingFrame<SimTrack>>(iConfig.getParameter<edm::InputTag>("collPCF"));
53 
54  //will only be needed if not Step2:
55  labelSimTr_ = consumes<SimTrackContainer>(iConfig.getParameter<edm::InputTag>("collSimTrack"));
56 }
57 
58 
60 {
61 }
62 
63 
64 //
65 // member functions
66 //
67 
68 // ------------ method called to for each event ------------
69 void
71 {
72  std::cout << " dataStep2_ = " << dataStep2_ << std::endl;
73 
74  if (!dataStep2_){
75  // Get the SimTrack collection
76 
77  //double simPt=0;
78  int i=0;
79 
80  // Get the SimTrack collection from the event
82  bool gotTracks = iEvent.getByToken(labelSimTr_,simTracks);
83 
84  if (!gotTracks)
85  {
86  std::cout<<"-> Could not read SimTracks !!!!"<<std::endl;
87  }
88  else{
89  std::cout<<"-> Could read SimTracks !!!!"<<std::endl;
90 
91  }
92 
93 
94  // Loop over the tracks
95  SimTrackContainer::const_iterator simTrack;
96  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
97  i++;
98 
99  //simPt=(*simTrack).momentum().Pt();
100  //std::cout << " # i = " << i << " simPt = " << simPt << std::endl;
101 
102  }
103 
104 
105  }
106  else{
107  // Get the PCrossingFrame collection given as signal
108 
110  bool gotTracks = iEvent.getByToken(labelPCF_,cf_simtrack);
111 
112  if (!gotTracks)
113  {
114  std::cout<<"-> Could not read PCrossingFrame<SimTracks> !!!!"<<std::endl;
115  }
116  else
117  std::cout<<"-> Could read PCrossingFrame<SimTracks> !!!!"<<std::endl;
118 
119  }
120 }
121 
122 
123 // ------------ method called once each job just before starting event loop ------------
125 {
126 }
127 
128 // ------------ method called once each job just after ending the event loop ------------
129 void
131 }
132 
133 }//edm
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< SimTrackContainer > labelSimTr_
Definition: InputAnalyzer.h:50
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
int iEvent
Definition: GenABIO.cc:230
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
InputAnalyzer(const edm::ParameterSet &)
virtual void beginJob()
virtual void endJob()
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< PCrossingFrame< SimTrack > > labelPCF_
Definition: InputAnalyzer.h:49