CMS 3D CMS Logo

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::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void dummyFunction (EventPrincipal const &ep)
 
virtual void getBranches (EventPrincipal const &ep, ModuleCallingContext const *)
 
 SecSourceAnalyzer (const edm::ParameterSet &)
 
 ~SecSourceAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 40 of file SecSourceAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file SecSourceAnalyzer.cc.

References boostrapWithFamos_cff::averageNumber, dataStep2_, edm::ParameterSet::getParameter(), mix_2012_lumiLevel_15_20_50ns_PoissonOOTPU_cfi::histoFileName, input_, label_, DigiHGCalTB160_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  std::unique_ptr<TH1F> histoName(new TH1F("h","",10,0,10));
65  bool playback = false;
66 
67  auto conf = std::make_shared<PileUpConfig>("input",averageNumber,histoName,playback);
68  input_.reset(new edm::PileUp(iConfig.getParameter<edm::ParameterSet>("input"),conf));
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
std::shared_ptr< PileUp > input_
SecSourceAnalyzer::~SecSourceAnalyzer ( )
override

Definition at line 83 of file SecSourceAnalyzer.cc.

84 {
85 }

Member Function Documentation

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

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_.

Referenced by dummyFunction().

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 176 of file SecSourceAnalyzer.cc.

Referenced by dummyFunction().

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

Definition at line 48 of file SecSourceAnalyzer.h.

References analyze(), beginJob(), and endJob().

Referenced by analyze().

48 {}
void SecSourceAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 182 of file SecSourceAnalyzer.cc.

References input_.

Referenced by dummyFunction().

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

Definition at line 128 of file SecSourceAnalyzer.cc.

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

Referenced by analyze().

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

Member Data Documentation

bool edm::SecSourceAnalyzer::dataStep2_
private

Definition at line 59 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

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

Definition at line 64 of file SecSourceAnalyzer.h.

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

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

Definition at line 57 of file SecSourceAnalyzer.h.

Referenced by analyze().

int edm::SecSourceAnalyzer::minBunch_
private

Definition at line 56 of file SecSourceAnalyzer.h.

Referenced by analyze().

InputTag edm::SecSourceAnalyzer::tag_
private

Definition at line 67 of file SecSourceAnalyzer.h.

Referenced by getBranches().

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

Definition at line 65 of file SecSourceAnalyzer.h.

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

Definition at line 62 of file SecSourceAnalyzer.h.

Referenced by analyze().