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 
42 
43 //
44 // constructors and destructor
45 //
46 namespace edm
47 {
48 
50 {
51 
52  dataStep2_ = iConfig.getParameter<bool>("dataStep2");
53 
54  if (dataStep2_)
55  // The data file contain the PCrossingFrame<SimTrack>
56  label_ = iConfig.getParameter<edm::InputTag>("collPCF");
57  else
58  // The data file contain the SimTrack
59  label_ = iConfig.getParameter<edm::InputTag>("collSimTrack");
60 }
61 
62 
64 {
65 }
66 
67 
68 //
69 // member functions
70 //
71 
72 // ------------ method called to for each event ------------
73 void
75 {
76  std::cout << " dataStep2_ = " << dataStep2_ << std::endl;
77 
78  if (!dataStep2_){
79  // Get the SimTrack collection
80 
81  //double simPt=0;
82  int i=0;
83 
84  // Get the SimTrack collection from the event
86  bool gotTracks = iEvent.getByLabel(label_,simTracks);
87 
88  if (!gotTracks)
89  {
90  std::cout<<"-> Could not read SimTracks !!!!"<<std::endl;
91  }
92  else{
93  std::cout<<"-> Could read SimTracks !!!!"<<std::endl;
94 
95  }
96 
97 
98  // Loop over the tracks
99  SimTrackContainer::const_iterator simTrack;
100  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
101  i++;
102 
103  //simPt=(*simTrack).momentum().Pt();
104  //std::cout << " # i = " << i << " simPt = " << simPt << std::endl;
105 
106  }
107 
108 
109  }
110  else{
111  // Get the PCrossingFrame collection given as signal
112 
114  bool gotTracks = iEvent.getByLabel("CFWriter","g4SimHits",cf_simtrack);
115 
116  if (!gotTracks)
117  {
118  std::cout<<"-> Could not read PCrossingFrame<SimTracks> !!!!"<<std::endl;
119  }
120  else
121  std::cout<<"-> Could read PCrossingFrame<SimTracks> !!!!"<<std::endl;
122 
123  }
124 }
125 
126 
127 // ------------ method called once each job just before starting event loop ------------
129 {
130 }
131 
132 // ------------ method called once each job just after ending the event loop ------------
133 void
135 }
136 
137 }//edm
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::InputTag label_
Definition: InputAnalyzer.h:46
int iEvent
Definition: GenABIO.cc:243
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
InputAnalyzer(const edm::ParameterSet &)
virtual void beginJob()
virtual void endJob()
tuple cout
Definition: gather_cfg.py:121