CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::SecSourceAnalyzer Class Reference

#include <SecSourceAnalyzer.h>

Inheritance diagram for edm::SecSourceAnalyzer:
edm::EDAnalyzer

Public Member Functions

virtual void dummyFunction (EventPrincipal const &ep)
 
virtual void getBranches (EventPrincipal const &ep)
 
 SecSourceAnalyzer (const edm::ParameterSet &)
 
 ~SecSourceAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

bool dataStep2_
 
boost::shared_ptr< PileUpinput_
 
edm::InputTag label_
 
int maxBunch_
 
int minBunch_
 
InputTag tag_
 
std::vector< float > TrueNumInteractions_ [5]
 
std::vector< std::vector
< edm::EventID > > 
vectorEventIDs_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 42 of file SecSourceAnalyzer.h.

Constructor & Destructor Documentation

SecSourceAnalyzer::SecSourceAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 52 of file SecSourceAnalyzer.cc.

References dataStep2_, edm::ParameterSet::getParameter(), diJetCalib::histoFileName, input_, label_, and Playback_cff::playback.

53  :minBunch_(0),
54  maxBunch_(0),
55  tag_(InputTag())
56 {
57 // int minb = minBunch_;
58 // int maxb = maxBunch_;
59  int averageNumber = 1;
60  std::string histoFileName = " ";
61  TH1F * histoName = new TH1F("h","",10,0,10);
62  bool playback = false;
63 
64  input_.reset(new edm::PileUp(iConfig.getParameter<edm::ParameterSet>("input"),
65  averageNumber,histoName,playback));
66 
67  dataStep2_ = iConfig.getParameter<bool>("dataStep2");
68 
69 
70  if (dataStep2_)
71  // The data file contain the PCrossingFrame<SimTrack>
72  label_ = iConfig.getParameter<edm::InputTag>("collPCF");
73  else
74  // The data file contain the SimTrack
75  label_ = iConfig.getParameter<edm::InputTag>("collSimTrack");
76 
77 }
T getParameter(std::string const &) const
tuple histoFileName
Definition: diJetCalib.py:108
boost::shared_ptr< PileUp > input_
tuple playback
Definition: Playback_cff.py:20
SecSourceAnalyzer::~SecSourceAnalyzer ( )

Definition at line 80 of file SecSourceAnalyzer.cc.

81 {
82 }

Member Function Documentation

void SecSourceAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 91 of file SecSourceAnalyzer.cc.

References gather_cfg::cout, dummyFunction(), getBranches(), edm::EventBase::id(), input_, maxBunch_, minBunch_, nevt, and vectorEventIDs_.

92 {
94 
95  int nevt = 0 ;
96  for( int ibx = minBunch_ ; ibx <= maxBunch_ ; ++ibx )
97  {
98  if( ibx == 0 )
99  {
100  input_->readPileUp( iEvent.id(),
101  vectorEventIDs_[ ibx-minBunch_ ],
102  boost::bind(&SecSourceAnalyzer::getBranches,
103  this, _1), ibx
104  );
105  }
106  else
107  {
108  input_->readPileUp( iEvent.id(),
109  vectorEventIDs_[ ibx-minBunch_ ],
110  boost::bind(&SecSourceAnalyzer::dummyFunction,
111  this, _1), ibx
112  );
113  }
114 
115  nevt += vectorEventIDs_[ ibx-minBunch_ ].size() ;
116  }
117 
118  std::cout << "-> The std::vector<EventPrincipalVector> of the secondary source 'input' has been filled with "
119  << nevt << " element corresponding to " << maxBunch_-minBunch_+1
120  << " bunch." << std::endl;
121 }
std::vector< std::vector< edm::EventID > > vectorEventIDs_
virtual void dummyFunction(EventPrincipal const &ep)
virtual void getBranches(EventPrincipal const &ep)
boost::shared_ptr< PileUp > input_
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:121
void SecSourceAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 165 of file SecSourceAnalyzer.cc.

166 {
167 }
virtual void edm::SecSourceAnalyzer::dummyFunction ( EventPrincipal const &  ep)
inlinevirtual

Definition at line 49 of file SecSourceAnalyzer.h.

Referenced by analyze().

49 {}
void SecSourceAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file SecSourceAnalyzer.cc.

References input_.

171  {
172  if (input_) input_->endJob();
173 }
boost::shared_ptr< PileUp > input_
void SecSourceAnalyzer::getBranches ( EventPrincipal const &  ep)
virtual

Definition at line 123 of file SecSourceAnalyzer.cc.

References gather_cfg::cout, dataStep2_, edm::EventPrincipal::id(), label_, edm::Principal::size(), and tag_.

Referenced by analyze().

124  {
125  std::cout <<"-> Get the event: id " << ep.id() << std::endl;
126  std::cout << "-> dataStep2_ = " << dataStep2_ << std::endl;
127  tag_ = InputTag(label_);
128 
129  std::cout << "-> Will try to get the branch with the tag : " << tag_ << std::endl;
130  std::cout << " and the EventPrincipal ep with a size = " << ep.size() << std::endl;
131 
132  if (!dataStep2_){
133  // Get the SimTrack collection
134 
135  // default version changed to transmit vertexoffset
136  boost::shared_ptr<Wrapper<std::vector<SimTrack> > const> shPtr =
137  getProductByTag<std::vector<SimTrack> >(ep, tag_);
138 
139  if (shPtr)
140  std::cout << "-> Could get SimTrack !" << std::endl;
141  else
142  std::cout << "-> Could not get SimTrack !" << std::endl;
143 
144  }
145  else{
146  // Get the PCrossingFrame collection given as signal
147 
148  // default version changed to transmit vertexoffset
149  tag_ = InputTag("CFwriter","g4SimHits");
150  boost::shared_ptr<Wrapper<PCrossingFrame<SimTrack> > const> shPtr =
151  getProductByTag<PCrossingFrame<SimTrack> >(ep, tag_);
152 
153  if (shPtr)
154  std::cout << "-> Could get PCrossingFrame<SimTrack> !" << std::endl;
155  else
156  std::cout << "-> Could not get PCrossingFrame<SimTrack> !" << std::endl;
157 
158  }
159 
160  }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

bool edm::SecSourceAnalyzer::dataStep2_
private

Definition at line 60 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

boost::shared_ptr<PileUp> edm::SecSourceAnalyzer::input_
private

Definition at line 65 of file SecSourceAnalyzer.h.

Referenced by analyze(), endJob(), and SecSourceAnalyzer().

edm::InputTag edm::SecSourceAnalyzer::label_
private
int edm::SecSourceAnalyzer::maxBunch_
private

Definition at line 58 of file SecSourceAnalyzer.h.

Referenced by analyze().

int edm::SecSourceAnalyzer::minBunch_
private

Definition at line 57 of file SecSourceAnalyzer.h.

Referenced by analyze().

InputTag edm::SecSourceAnalyzer::tag_
private

Definition at line 68 of file SecSourceAnalyzer.h.

Referenced by getBranches().

std::vector< float > edm::SecSourceAnalyzer::TrueNumInteractions_[5]
private

Definition at line 66 of file SecSourceAnalyzer.h.

std::vector<std::vector<edm::EventID> > edm::SecSourceAnalyzer::vectorEventIDs_
private

Definition at line 63 of file SecSourceAnalyzer.h.

Referenced by analyze().