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