22 const std::vector<unsigned int> & objectsType) :
24 _hltProcessName(pset.getParameter<std::
string>(
"hltProcessName")),
25 _objectsType(std::set<unsigned int>(objectsType.
begin(), objectsType.
end())),
26 _nObjects(objectsType.
size()),
27 _parametersEta(pset.getParameter<std::vector<double> >(
"parametersEta")),
28 _parametersPhi(pset.getParameter<std::vector<double> >(
"parametersPhi")),
29 _parametersTurnOn(pset.getParameter<std::vector<double> >(
"parametersTurnOn")),
30 _parametersTurnOnSumEt(pset.getParameter<std::vector<double> >(
"parametersTurnOnSumEt")),
31 _parametersDxy(pset.getParameter<std::vector<double> >(
"parametersDxy")),
35 if (pset.
exists(
"dropPt2")) {
38 if (pset.
exists(
"dropPt3")) {
41 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaPlotter::constructor()";
59 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaPlotter::plotterBookHistos()";
60 for (std::set<unsigned int>::iterator it =
_objectsType.begin();
62 std::vector<std::string> sources(2);
68 for (
size_t i = 0;
i < sources.size();
i++) {
71 if ( source ==
"gen" ) {
72 if ( TString(objTypeStr).Contains(
"MET") ||
73 TString(objTypeStr).Contains(
"MHT") ||
74 TString(objTypeStr).Contains(
"Jet") ) {
77 bookHist(iBooker, source, objTypeStr,
"MaxPt1");
80 bookHist(iBooker, source, objTypeStr,
"Eta");
81 bookHist(iBooker, source, objTypeStr,
"Phi");
87 bookHist(iBooker, source, objTypeStr,
"Dxy");
91 if ( TString(objTypeStr).Contains(
"MET") ||
92 TString(objTypeStr).Contains(
"MHT") ) {
93 bookHist(iBooker, source, objTypeStr,
"MaxPt1");
94 bookHist(iBooker, source, objTypeStr,
"SumEt");
96 bookHist(iBooker, source, objTypeStr,
"MaxPt1");
99 bookHist(iBooker, source, objTypeStr,
"Eta");
100 bookHist(iBooker, source, objTypeStr,
"Phi");
106 bookHist(iBooker, source, objTypeStr,
"Dxy");
117 const std::vector<reco::LeafCandidate> & matches,
118 std::map<int,double> theSumEt,
119 std::vector<float> & dxys)
121 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaPlotter::analyze()";
122 if (!isPassTrigger) {
126 std::map<unsigned int, int> countobjects;
128 for (std::set<unsigned int>::iterator co =
_objectsType.begin();
130 countobjects[*co] = 0;
136 int totalobjectssize = 1;
139 totalobjectssize *= countobjects.size();
141 for (
size_t j = 0;
j < matches.size(); ++
j) {
147 const unsigned int objType = matches[
j].pdgId();
150 float pt = matches[
j].pt();
151 float eta = matches[
j].eta();
152 float phi = matches[
j].phi();
154 if ( !( TString(objTypeStr).Contains(
"MET") || TString(objTypeStr).Contains(
"MHT") ) ) {
155 this->
fillHist(isPassTrigger, source, objTypeStr,
"Eta", eta);
156 this->
fillHist(isPassTrigger, source, objTypeStr,
"Phi", phi);
158 else if( source!=
"gen" ) {
159 if(theSumEt[objType]>=0 && countobjects[objType] == 0) {
160 this->
fillHist(isPassTrigger, source, objTypeStr,
"SumEt", theSumEt[objType]);
165 this->
fillHist(isPassTrigger, source, objTypeStr,
"Dxy", dxys[
j] );
167 if (countobjects[objType] == 0) {
168 if ( !( TString(objTypeStr).Contains(
"MET") || TString(objTypeStr).Contains(
"MHT") ) || source!=
"gen" ) {
169 this->
fillHist(isPassTrigger, source, objTypeStr,
"MaxPt1", pt);
172 ++(countobjects[objType]);
175 else if (countobjects[objType] == 1 && !
_drop_pt2) {
176 if( !( TString(objTypeStr).Contains(
"MET") || TString(objTypeStr).Contains(
"MHT") ) ) {
177 this->
fillHist(isPassTrigger, source, objTypeStr,
"MaxPt2", pt);
180 ++(countobjects[objType]);
183 else if (countobjects[objType] == 2 && !
_drop_pt3) {
184 if( !( TString(objTypeStr).Contains(
"MET") || TString(objTypeStr).Contains(
"MHT") ) ) {
185 this->
fillHist(isPassTrigger, source, objTypeStr,
"MaxPt3", pt);
188 ++(countobjects[objType]);
192 if (counttotal == totalobjectssize) {
206 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaPlotter::bookHist()";
208 sourceUpper[0] = std::toupper(sourceUpper[0]);
212 if (variable.find(
"SumEt") != std::string::npos) {
215 float *
edges =
new float[nBins + 1];
216 for (
size_t i = 0;
i < nBins + 1;
i++) {
219 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
222 else if (variable.find(
"Dxy") != std::string::npos) {
227 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
229 else if (variable.find(
"MaxPt") != std::string::npos) {
230 std::string desc = (variable ==
"MaxPt1") ?
"Leading" :
231 (variable ==
"MaxPt2") ?
"Next-to-Leading" :
"Next-to-next-to-Leading";
232 std::string title =
"pT of " + desc +
" " + sourceUpper +
" " + objType +
" "
235 float *
edges =
new float[nBins + 1];
236 for (
size_t i = 0;
i < nBins + 1;
i++) {
239 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
244 std::string symbol = (variable ==
"Eta") ?
"#eta" :
"#phi";
249 int nBins = (int)params[0];
250 double min = params[1];
251 double max = params[2];
252 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
269 sourceUpper[0] = toupper(sourceUpper[0]);
272 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaPlotter::fillHist()" << name <<
" " <<
value;
274 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaPlotter::fillHist()" << name <<
" worked";
T getParameter(std::string const &) const
void plotterBookHistos(DQMStore::IBooker &iBooker, const edm::Run &iRun, const edm::EventSetup &iSetup)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::set< unsigned int > _objectsType
std::vector< double > _parametersDxy
std::vector< double > _parametersTurnOnSumEt
HLTExoticaPlotter(const edm::ParameterSet &pset, const std::string &hltPath, const std::vector< unsigned int > &objectsType)
std::vector< double > _parametersEta
MonitorElement * book1D(Args &&...args)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::vector< double > _parametersTurnOn
void fillHist(const bool &passTrigger, const std::string &source, const std::string &objType, const std::string &var, const float &value)
std::vector< double > _parametersPhi
void bookHist(DQMStore::IBooker &iBooker, const std::string &source, const std::string &objType, const std::string &variable)
void analyze(const bool &isPassTrigger, const std::string &source, const std::vector< reco::LeafCandidate > &matches, std::map< int, double > theSumEt, std::vector< float > &dxys)
volatile std::atomic< bool > shutdown_flag false
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
tuple size
Write out results.
std::map< std::string, MonitorElement * > _elements