11 [
this](
edm::InputTag const &
tag) { return mayConsume<reco::VertexCollection>(tag); });
12 hltPathNames_ = iConfig.
getParameter<std::vector<std::string>>(
"HLTPathNames");
16 hlTriggerResults_Label =
label.module;
18 for (
unsigned int i = 0;
i < VertexCollection_.size();
i++) {
20 VertexCollection_Label.push_back(
label.module);
27 triggerConfChanged_ =
true;
30 hltConfigProvider_.init(iRun, iSetup,
label.process, triggerConfChanged_);
31 const std::vector<std::string> &allHltPathNames = hltConfigProvider_.triggerNames();
34 for (
size_t trgs = 0; trgs < hltPathNames_.size(); trgs++) {
35 unsigned int found = 1;
37 for (
size_t it = 0; it < allHltPathNames.size(); ++it) {
38 found = allHltPathNames.at(it).find(hltPathNames_[trgs]);
43 hltPathIndexs_.push_back(it_mem);
47 for (
size_t trgs = 0; trgs < hltPathNames_.size(); trgs++) {
48 if (hltPathIndexs_[trgs] < 0) {
49 _isfoundHLTs.push_back(
false);
51 _isfoundHLTs.push_back(
true);
62 if (hlTriggerResults_Label.empty() || hlTriggerResults_Label ==
"NULL") {
63 edm::LogInfo(
"NoTriggerResults") <<
"TriggerResults ==> Empty";
66 iEvent.
getByToken(hlTriggerResults_, TriggerResulsHandler);
67 if (TriggerResulsHandler.
isValid())
70 edm::LogInfo(
"NoTriggerResults") <<
"TriggerResults ==> not readable";
79 iEvent.
getByToken(simVertexCollection_, simVertexCollection);
80 if (!simVertexCollection.
isValid()) {
81 edm::LogInfo(
"NoSimVertex") <<
"SimVertex collection is invalid";
84 if (simVertexCollection->empty()) {
85 edm::LogInfo(
"NoSimVertex") <<
"SimVertex collection is empty";
88 const SimVertex simPVh = *(simVertexCollection->begin());
93 for (
unsigned int ind = 0; ind < hltPathNames_.size(); ind++) {
94 for (
unsigned int coll = 0;
coll < VertexCollection_.size();
coll++) {
95 bool VertexOK =
false;
96 if (!_isfoundHLTs[ind])
98 if (!triggerResults.
accept(hltPathIndexs_[ind]))
102 if (!VertexCollection_Label.at(
coll).empty() && VertexCollection_Label.at(
coll) !=
"NULL") {
104 if (VertexHandler.
isValid() > 0)
110 float value = VertexHandler->begin()->z() - simPV;
113 float maxValue = H1_.at(ind)[
"Vertex_" + VertexCollection_Label.at(
coll)]->getTH1F()->GetXaxis()->GetXmax();
114 if (value > maxValue)
115 value = maxValue - 0.0001;
116 if (value < -maxValue)
117 value = -maxValue + 0.0001;
119 H1_.at(ind)[
"Vertex_" + VertexCollection_Label.at(
coll)]->Fill(value);
131 for (
unsigned int ind = 0; ind < hltPathNames_.size(); ind++) {
132 dqmFolder = Form(
"%s/Vertex/%s", mainFolder_.c_str(), hltPathNames_[ind].c_str());
133 H1_.push_back(std::map<std::string, MonitorElement *>());
135 for (
unsigned int coll = 0;
coll < VertexCollection_.size();
coll++) {
137 if (VertexCollection_Label.at(
coll) == (
"hltFastPrimaryVertex"))
141 int vertexBins = 100;
142 if (!VertexCollection_Label.at(
coll).empty() && VertexCollection_Label.at(
coll) !=
"NULL") {
143 H1_.back()[
"Vertex_" + VertexCollection_Label.at(
coll)] =
144 ibooker.
book1D(
"Vertex_" + VertexCollection_Label.at(
coll),
145 VertexCollection_Label.at(
coll).c_str(),
149 H1_.back()[
"Vertex_" + VertexCollection_Label.at(
coll)]->
setAxisTitle(
"vertex error (cm)", 1);
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool accept() const
Has at least one path accepted the event?
#define DEFINE_FWK_MODULE(type)
void setCurrentFolder(std::string const &fullpath)
MonitorElement * book1D(Args &&...args)
const math::XYZTLorentzVectorD & position() const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
T const * product() const
static std::string const triggerResults("TriggerResults")
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)