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 edm::EDConsumerBase

Public Member Functions

virtual void dummyFunction (EventPrincipal const &ep)
 
virtual void getBranches (EventPrincipal const &ep, ModuleCallingContext const *)
 
 SecSourceAnalyzer (const edm::ParameterSet &)
 
 ~SecSourceAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
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
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 43 of file SecSourceAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file SecSourceAnalyzer.cc.

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

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

Definition at line 83 of file SecSourceAnalyzer.cc.

84 {
85 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 94 of file SecSourceAnalyzer.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 175 of file SecSourceAnalyzer.cc.

176 {
177 }
virtual void edm::SecSourceAnalyzer::dummyFunction ( EventPrincipal const &  ep)
inlinevirtual

Definition at line 51 of file SecSourceAnalyzer.h.

Referenced by analyze().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 181 of file SecSourceAnalyzer.cc.

References input_.

181  {
182  if (input_) input_->endJob();
183 }
boost::shared_ptr< PileUp > input_
void SecSourceAnalyzer::getBranches ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)
virtual

Definition at line 127 of file SecSourceAnalyzer.cc.

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

Referenced by analyze().

129  {
130  InternalContext internalContext(ep.id(), mcc);
131  ParentContext parentContext(&internalContext);
132  ModuleCallingContext moduleCallingContext(&moduleDescription());
133  ModuleContextSentry moduleContextSentry(&moduleCallingContext, parentContext);
134 
135  std::cout <<"-> Get the event: id " << ep.id() << std::endl;
136  std::cout << "-> dataStep2_ = " << dataStep2_ << std::endl;
137  tag_ = InputTag(label_);
138 
139  std::cout << "-> Will try to get the branch with the tag : " << tag_ << std::endl;
140  std::cout << " and the EventPrincipal ep with a size = " << ep.size() << std::endl;
141 
142  if (!dataStep2_){
143  // Get the SimTrack collection
144 
145  // default version changed to transmit vertexoffset
146  boost::shared_ptr<Wrapper<std::vector<SimTrack> > const> shPtr =
147  getProductByTag<std::vector<SimTrack> >(ep, tag_, &moduleCallingContext);
148 
149  if (shPtr)
150  std::cout << "-> Could get SimTrack !" << std::endl;
151  else
152  std::cout << "-> Could not get SimTrack !" << std::endl;
153 
154  }
155  else{
156  // Get the PCrossingFrame collection given as signal
157 
158  // default version changed to transmit vertexoffset
159  tag_ = InputTag("CFwriter","g4SimHits");
160  boost::shared_ptr<Wrapper<PCrossingFrame<SimTrack> > const> shPtr =
161  getProductByTag<PCrossingFrame<SimTrack> >(ep, tag_, &moduleCallingContext);
162 
163  if (shPtr)
164  std::cout << "-> Could get PCrossingFrame<SimTrack> !" << std::endl;
165  else
166  std::cout << "-> Could not get PCrossingFrame<SimTrack> !" << std::endl;
167 
168  }
169 
170  }
ModuleDescription const & moduleDescription() const
Definition: EDAnalyzer.h:41
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

bool edm::SecSourceAnalyzer::dataStep2_
private

Definition at line 62 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

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

Definition at line 67 of file SecSourceAnalyzer.h.

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

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

Definition at line 60 of file SecSourceAnalyzer.h.

Referenced by analyze().

int edm::SecSourceAnalyzer::minBunch_
private

Definition at line 59 of file SecSourceAnalyzer.h.

Referenced by analyze().

InputTag edm::SecSourceAnalyzer::tag_
private

Definition at line 70 of file SecSourceAnalyzer.h.

Referenced by getBranches().

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

Definition at line 68 of file SecSourceAnalyzer.h.

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

Definition at line 65 of file SecSourceAnalyzer.h.

Referenced by analyze().