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

bool dummyFunction (EventPrincipal const &ep)
 
bool getBranches (EventPrincipal const &ep, ModuleCallingContext const *)
 
 SecSourceAnalyzer (const edm::ParameterSet &)
 
 ~SecSourceAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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::unique_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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 40 of file SecSourceAnalyzer.h.

Constructor & Destructor Documentation

◆ SecSourceAnalyzer()

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

Definition at line 52 of file SecSourceAnalyzer.cc.

References boostrapWithFamos_cff::averageNumber, edm::EDConsumerBase::consumesCollector(), dataStep2_, edm::ParameterSet::getParameter(), mix_2012_lumiLevel_15_20_50ns_PoissonOOTPU_cfi::histoFileName, HltBtagPostValidation_cff::histoName, input_, label_, personalPlayback::playback, and AlCaHLTBitMon_QueryRunRegistry::string.

53  : minBunch_(0), maxBunch_(0), tag_(InputTag()) {
54  // int minb = minBunch_;
55  // int maxb = maxBunch_;
56  int averageNumber = 1;
58  std::unique_ptr<TH1F> histoName(new TH1F("h", "", 10, 0, 10));
59  bool playback = false;
60 
61  auto conf = std::make_shared<PileUpConfig>("input", averageNumber, histoName, playback);
62  input_ = std::make_unique<edm::PileUp>(
63  iConfig.getParameter<edm::ParameterSet>("input"), conf, consumesCollector(), false);
64 
65  dataStep2_ = iConfig.getParameter<bool>("dataStep2");
66 
67  if (dataStep2_)
68  // The data file contain the PCrossingFrame<SimTrack>
69  label_ = iConfig.getParameter<edm::InputTag>("collPCF");
70  else
71  // The data file contain the SimTrack
72  label_ = iConfig.getParameter<edm::InputTag>("collSimTrack");
73  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< PileUp > input_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.

◆ ~SecSourceAnalyzer()

SecSourceAnalyzer::~SecSourceAnalyzer ( )
override

Definition at line 75 of file SecSourceAnalyzer.cc.

75 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 82 of file SecSourceAnalyzer.cc.

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

82  {
83  using namespace std::placeholders;
84  vectorEventIDs_.resize(maxBunch_ - minBunch_ + 1);
85 
86  int nevt = 0;
87  for (int ibx = minBunch_; ibx <= maxBunch_; ++ibx) {
88  if (ibx == 0) {
89  input_->readPileUp(iEvent.id(),
91  std::bind(&SecSourceAnalyzer::getBranches, this, _1, iEvent.moduleCallingContext()),
92  ibx,
93  iEvent.streamID());
94  } else {
95  input_->readPileUp(iEvent.id(),
97  std::bind(&SecSourceAnalyzer::dummyFunction, this, _1),
98  ibx,
99  iEvent.streamID());
100  }
101 
102  nevt += vectorEventIDs_[ibx - minBunch_].size();
103  }
104 
105  std::cout << "-> The std::vector<EventPrincipalVector> of the secondary source 'input' has been filled with "
106  << nevt << " element corresponding to " << maxBunch_ - minBunch_ + 1 << " bunch." << std::endl;
107  }
std::unique_ptr< PileUp > input_
bool getBranches(EventPrincipal const &ep, ModuleCallingContext const *)
bool dummyFunction(EventPrincipal const &ep)
int iEvent
Definition: GenABIO.cc:224
std::vector< std::vector< edm::SecondaryEventIDAndFileInfo > > vectorEventIDs_

◆ beginJob()

void SecSourceAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 152 of file SecSourceAnalyzer.cc.

152 {}

◆ dummyFunction()

bool edm::SecSourceAnalyzer::dummyFunction ( EventPrincipal const &  ep)
inline

Definition at line 46 of file SecSourceAnalyzer.h.

Referenced by analyze().

46 { return true; }

◆ endJob()

void SecSourceAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 155 of file SecSourceAnalyzer.cc.

References input_.

155  {
156  if (input_)
157  input_->endStream();
158  }
std::unique_ptr< PileUp > input_

◆ getBranches()

bool SecSourceAnalyzer::getBranches ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)

Definition at line 109 of file SecSourceAnalyzer.cc.

References gather_cfg::cout, dataStep2_, SiStripBadComponentsDQMServiceTemplate_cfg::ep, HLT_2022v12_cff::InputTag, label_, edm::one::EDAnalyzerBase::moduleDescription(), and tag_.

Referenced by analyze().

109  {
110  InternalContext internalContext(ep.id(), mcc);
111  ParentContext parentContext(&internalContext);
112  ModuleCallingContext moduleCallingContext(&moduleDescription());
113  ModuleContextSentry moduleContextSentry(&moduleCallingContext, parentContext);
114 
115  std::cout << "-> Get the event: id " << ep.id() << std::endl;
116  std::cout << "-> dataStep2_ = " << dataStep2_ << std::endl;
117  tag_ = InputTag(label_);
118 
119  std::cout << "-> Will try to get the branch with the tag : " << tag_ << std::endl;
120  std::cout << " and the EventPrincipal ep with a size = " << ep.size() << std::endl;
121 
122  if (!dataStep2_) {
123  // Get the SimTrack collection
124 
125  // default version changed to transmit vertexoffset
126  std::shared_ptr<Wrapper<std::vector<SimTrack> > const> shPtr =
127  getProductByTag<std::vector<SimTrack> >(ep, tag_, &moduleCallingContext);
128 
129  if (shPtr)
130  std::cout << "-> Could get SimTrack !" << std::endl;
131  else
132  std::cout << "-> Could not get SimTrack !" << std::endl;
133 
134  } else {
135  // Get the PCrossingFrame collection given as signal
136 
137  // default version changed to transmit vertexoffset
138  tag_ = InputTag("CFwriter", "g4SimHits");
139  std::shared_ptr<Wrapper<PCrossingFrame<SimTrack> > const> shPtr =
140  getProductByTag<PCrossingFrame<SimTrack> >(ep, tag_, &moduleCallingContext);
141 
142  if (shPtr)
143  std::cout << "-> Could get PCrossingFrame<SimTrack> !" << std::endl;
144  else
145  std::cout << "-> Could not get PCrossingFrame<SimTrack> !" << std::endl;
146  }
147 
148  return true;
149  }
ModuleDescription const & moduleDescription() const

Member Data Documentation

◆ dataStep2_

bool edm::SecSourceAnalyzer::dataStep2_
private

Definition at line 57 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

◆ input_

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

Definition at line 62 of file SecSourceAnalyzer.h.

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

◆ label_

edm::InputTag edm::SecSourceAnalyzer::label_
private

◆ maxBunch_

int edm::SecSourceAnalyzer::maxBunch_
private

Definition at line 55 of file SecSourceAnalyzer.h.

Referenced by analyze().

◆ minBunch_

int edm::SecSourceAnalyzer::minBunch_
private

Definition at line 54 of file SecSourceAnalyzer.h.

Referenced by analyze().

◆ tag_

InputTag edm::SecSourceAnalyzer::tag_
private

Definition at line 65 of file SecSourceAnalyzer.h.

Referenced by getBranches().

◆ TrueNumInteractions_

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

Definition at line 63 of file SecSourceAnalyzer.h.

◆ vectorEventIDs_

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

Definition at line 60 of file SecSourceAnalyzer.h.

Referenced by analyze().