CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
PixelVTXMonitor Class Reference

#include <PixelVTXMonitor.h>

Inheritance diagram for PixelVTXMonitor:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  PixelMEs
 

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 PixelVTXMonitor (const edm::ParameterSet &)
 
 ~PixelVTXMonitor () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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)
 

Protected Member Functions

void analyze (edm::Event const &iEvent, edm::EventSetup const &iSetup) override
 
void beginJob () override
 
void beginRun (edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
void endJob () override
 
void endRun (edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
- 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)
 

Private Member Functions

void bookHistograms ()
 

Private Attributes

DQMStoredbe_
 
std::string folderName_
 
std::map< std::string, PixelMEshistoMap_
 
HLTConfigProvider hltConfig_
 
edm::InputTag hltInputTag_
 
edm::EDGetTokenT
< edm::TriggerResults
hltInputTagToken_
 
float minVtxDoF_
 
std::string moduleName_
 
edm::ParameterSet parameters_
 
edm::InputTag pixelClusterInputTag_
 
edm::EDGetTokenT
< SiPixelClusterCollectionNew
pixelClusterInputTagToken_
 
edm::InputTag pixelVertexInputTag_
 
edm::EDGetTokenT
< reco::VertexCollection
pixelVertexInputTagToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 30 of file PixelVTXMonitor.h.

Member Typedef Documentation

Definition at line 33 of file PixelVTXMonitor.h.

Definition at line 32 of file PixelVTXMonitor.h.

Constructor & Destructor Documentation

PixelVTXMonitor::PixelVTXMonitor ( const edm::ParameterSet ps)

Definition at line 22 of file PixelVTXMonitor.cc.

References folderName_, edm::ParameterSet::getParameter(), hltInputTag_, hltInputTagToken_, minVtxDoF_, moduleName_, parameters_, pixelClusterInputTag_, pixelClusterInputTagToken_, pixelVertexInputTag_, pixelVertexInputTagToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

22  : parameters_(ps) {
26  consumes<SiPixelClusterCollectionNew>(parameters_.getParameter<edm::InputTag>("PixelClusterInputTag"));
28  consumes<reco::VertexCollection>(parameters_.getParameter<edm::InputTag>("PixelVertexInputTag"));
29  hltInputTagToken_ = consumes<edm::TriggerResults>(parameters_.getParameter<edm::InputTag>("HLTInputTag"));
33  minVtxDoF_ = parameters_.getParameter<double>("MinVtxDoF");
34 }
edm::EDGetTokenT< reco::VertexCollection > pixelVertexInputTagToken_
edm::EDGetTokenT< edm::TriggerResults > hltInputTagToken_
edm::ParameterSet parameters_
edm::InputTag pixelClusterInputTag_
edm::InputTag pixelVertexInputTag_
std::string folderName_
edm::InputTag hltInputTag_
edm::EDGetTokenT< SiPixelClusterCollectionNew > pixelClusterInputTagToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string moduleName_
PixelVTXMonitor::~PixelVTXMonitor ( )
override

Definition at line 36 of file PixelVTXMonitor.cc.

36 {}

Member Function Documentation

void PixelVTXMonitor::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements edm::EDAnalyzer.

Definition at line 113 of file PixelVTXMonitor.cc.

References dqm::impl::MonitorElement::Fill(), edm::Event::getByToken(), histoMap_, hltConfig_, hltInputTagToken_, edm::HandleBase::isValid(), minVtxDoF_, fed_dqm_sourceclient-live_cfg::path, pixelClusterInputTag_, pixelClusterInputTagToken_, pixelVertexInputTag_, pixelVertexInputTagToken_, PixelVertexes_cfi::pixelVertices, HIInitialJetCoreClusterSplitting_cff::siPixelClusters, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerIndex(), and triggerResults.

113  {
114  if (histoMap_.empty())
115  return;
116 
117  //Access Pixel Clusters
119  iEvent.getByToken(pixelClusterInputTagToken_, siPixelClusters);
120 
121  if (!siPixelClusters.isValid()) {
122  edm::LogError("PixelVTXMonotor") << "Could not find Cluster Collection " << pixelClusterInputTag_;
123  return;
124  }
125  unsigned nClusters = siPixelClusters->size();
126 
127  //Access Pixel Verteces
129  iEvent.getByToken(pixelVertexInputTagToken_, pixelVertices);
130  if (!pixelVertices.isValid()) {
131  edm::LogError("PixelVTXMonotor") << "Could not find Vertex Collection " << pixelVertexInputTag_;
132  return;
133  }
134 
135  int nVtx = 0;
136  for (reco::VertexCollection::const_iterator ivtx = pixelVertices->begin(); ivtx != pixelVertices->end(); ++ivtx) {
137  if (minVtxDoF_ == -1)
138  nVtx++;
139  else {
140  if ((ivtx->isValid() == true) && (ivtx->isFake() == false) && (ivtx->ndof() >= minVtxDoF_) &&
141  (ivtx->tracksSize() != 0))
142  nVtx++;
143  }
144  }
145  // Access Trigger Results
147  iEvent.getByToken(hltInputTagToken_, triggerResults);
148  if (!triggerResults.isValid())
149  return;
150 
151  for (std::map<std::string, PixelMEs>::iterator it = histoMap_.begin(); it != histoMap_.end(); ++it) {
152  std::string path = it->first;
153  MonitorElement* me_clus = it->second.clusME;
154  MonitorElement* me_vtx = it->second.vtxME;
155  unsigned int index = hltConfig_.triggerIndex(path);
156  if (index < triggerResults->size() && triggerResults->accept(index)) {
157  if (me_vtx)
158  me_vtx->Fill(nVtx);
159  if (me_clus)
160  me_clus->Fill(nClusters);
161  }
162  }
163 }
edm::EDGetTokenT< reco::VertexCollection > pixelVertexInputTagToken_
edm::EDGetTokenT< edm::TriggerResults > hltInputTagToken_
Log< level::Error, false > LogError
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
void Fill(long long x)
HLTConfigProvider hltConfig_
edm::InputTag pixelClusterInputTag_
int iEvent
Definition: GenABIO.cc:224
std::map< std::string, PixelMEs > histoMap_
static std::string const triggerResults
Definition: EdmProvDump.cc:44
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag pixelVertexInputTag_
edm::EDGetTokenT< SiPixelClusterCollectionNew > pixelClusterInputTagToken_
tuple size
Write out results.
void PixelVTXMonitor::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 96 of file PixelVTXMonitor.cc.

References dbe_, and Utilities::operator.

void PixelVTXMonitor::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 98 of file PixelVTXMonitor.cc.

References bookHistograms(), hltConfig_, hltInputTag_, HLTConfigProvider::init(), and edm::InputTag::process().

98  {
99  bool changed = true;
100  if (hltConfig_.init(iRun, iSetup, hltInputTag_.process(), changed)) {
101  // if init returns TRUE, initialisation has succeeded!
102  edm::LogInfo("PixelVTXMonitor") << "HLT config with process name " << hltInputTag_.process()
103  << " successfully extracted";
104  } else {
105  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
106  // with the file and/or code and needs to be investigated!
107  edm::LogError("PixelVTXMonotor") << "Error! HLT config extraction with process name " << hltInputTag_.process()
108  << " failed";
109  // In this case, all access methods will return empty values!
110  }
111  bookHistograms();
112 }
Log< level::Error, false > LogError
HLTConfigProvider hltConfig_
Log< level::Info, false > LogInfo
edm::InputTag hltInputTag_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::string const & process() const
Definition: InputTag.h:40
void PixelVTXMonitor::bookHistograms ( )
private

Definition at line 38 of file PixelVTXMonitor.cc.

References dqm::implementation::IBooker::book1D(), PixelVTXMonitor::PixelMEs::clusME, dbe_, folderName_, edm::ParameterSet::getParameter(), histoMap_, hltConfig_, moduleName_, parameters_, dqm::implementation::DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, HLTConfigProvider::triggerNames(), and PixelVTXMonitor::PixelMEs::vtxME.

Referenced by beginRun().

38  {
39  std::vector<std::string> hltPathsOfInterest =
40  parameters_.getParameter<std::vector<std::string> >("HLTPathsOfInterest");
41  if (hltPathsOfInterest.empty())
42  return;
43 
44  const std::vector<std::string>& pathList = hltConfig_.triggerNames();
45  std::vector<std::string> selectedPaths;
46  for (std::vector<std::string>::const_iterator it = pathList.begin(); it != pathList.end(); ++it) {
47  int nmatch = 0;
48  for (std::vector<std::string>::const_iterator kt = hltPathsOfInterest.begin(); kt != hltPathsOfInterest.end();
49  ++kt) {
50  nmatch += TPRegexp(*kt).Match(*it);
51  }
52  if (!nmatch)
53  continue;
54  else
55  selectedPaths.push_back(*it);
56  }
57 
58  edm::ParameterSet ClusHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1ClusPar");
59  edm::ParameterSet VtxHistoPar = parameters_.getParameter<edm::ParameterSet>("TH1VtxPar");
60 
61  std::string currentFolder = moduleName_ + "/" + folderName_;
62  dbe_->setCurrentFolder(currentFolder);
63 
64  PixelMEs local_MEs;
65  for (std::vector<std::string>::iterator it = selectedPaths.begin(); it != selectedPaths.end(); it++) {
66  std::string tag = (*it);
67  std::map<std::string, PixelMEs>::iterator iPos = histoMap_.find(tag);
68  if (iPos == histoMap_.end()) {
69  std::string hname, htitle;
70 
71  hname = "nPxlClus_";
72  hname += tag;
73  htitle = "# of Pixel Clusters (";
74  htitle += tag + ")";
75  local_MEs.clusME = dbe_->book1D(hname,
76  htitle,
77  ClusHistoPar.getParameter<int32_t>("Xbins"),
78  ClusHistoPar.getParameter<double>("Xmin"),
79  ClusHistoPar.getParameter<double>("Xmax"));
80 
81  hname = "nPxlVtx_";
82  hname += tag;
83  htitle = "# of Pixel Vertices (";
84  htitle += tag + ")";
85  local_MEs.vtxME = dbe_->book1D(hname,
86  htitle,
87  VtxHistoPar.getParameter<int32_t>("Xbins"),
88  VtxHistoPar.getParameter<double>("Xmin"),
89  VtxHistoPar.getParameter<double>("Xmax"));
90 
91  histoMap_.insert(std::make_pair(tag, local_MEs));
92  }
93  }
94 }
edm::ParameterSet parameters_
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
const std::vector< std::string > & triggerNames() const
names of trigger paths
HLTConfigProvider hltConfig_
std::map< std::string, PixelMEs > histoMap_
std::string folderName_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string moduleName_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void PixelVTXMonitor::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 167 of file PixelVTXMonitor.cc.

167 {}
void PixelVTXMonitor::endRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 165 of file PixelVTXMonitor.cc.

165 {}

Member Data Documentation

DQMStore* PixelVTXMonitor::dbe_
private

Definition at line 59 of file PixelVTXMonitor.h.

Referenced by beginJob(), and bookHistograms().

std::string PixelVTXMonitor::folderName_
private

Definition at line 50 of file PixelVTXMonitor.h.

Referenced by bookHistograms(), and PixelVTXMonitor().

std::map<std::string, PixelMEs> PixelVTXMonitor::histoMap_
private

Definition at line 67 of file PixelVTXMonitor.h.

Referenced by analyze(), and bookHistograms().

HLTConfigProvider PixelVTXMonitor::hltConfig_
private

Definition at line 60 of file PixelVTXMonitor.h.

Referenced by analyze(), beginRun(), and bookHistograms().

edm::InputTag PixelVTXMonitor::hltInputTag_
private

Definition at line 56 of file PixelVTXMonitor.h.

Referenced by beginRun(), and PixelVTXMonitor().

edm::EDGetTokenT<edm::TriggerResults> PixelVTXMonitor::hltInputTagToken_
private

Definition at line 53 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

float PixelVTXMonitor::minVtxDoF_
private

Definition at line 57 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

std::string PixelVTXMonitor::moduleName_
private

Definition at line 49 of file PixelVTXMonitor.h.

Referenced by bookHistograms(), and PixelVTXMonitor().

edm::ParameterSet PixelVTXMonitor::parameters_
private
edm::InputTag PixelVTXMonitor::pixelClusterInputTag_
private

Definition at line 54 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

edm::EDGetTokenT<SiPixelClusterCollectionNew> PixelVTXMonitor::pixelClusterInputTagToken_
private

Definition at line 51 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

edm::InputTag PixelVTXMonitor::pixelVertexInputTag_
private

Definition at line 55 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().

edm::EDGetTokenT<reco::VertexCollection> PixelVTXMonitor::pixelVertexInputTagToken_
private

Definition at line 52 of file PixelVTXMonitor.h.

Referenced by analyze(), and PixelVTXMonitor().