37 _analysisname(analysisname),
39 _hltProcessName(pset.getParameter<std::
string>(
"hltProcessName")),
40 _genParticleLabel(pset.getParameter<std::
string>(
"genParticleLabel")),
41 _parametersEta(pset.getParameter<std::vector<double> >(
"parametersEta")),
42 _parametersPhi(pset.getParameter<std::vector<double> >(
"parametersPhi")),
43 _parametersTurnOn(pset.getParameter<std::vector<double> >(
"parametersTurnOn")),
46 _recCaloMETSelector(0),
48 _recPhotonSelector(0),
59 for(std::map<unsigned int,std::string>::const_iterator it =
_recLabels.begin();
70 for(std::map<unsigned int,std::string>::const_iterator it =
_recLabels.begin();
170 edm::LogError(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun: "
171 <<
"Initializtion of HLTConfigProvider failed!!";
185 if(TString(thetriggername).Contains(pattern))
193 edm::LogWarning(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun, In "
200 <<
"\nHLT Trigger Paths found >>>";
203 for(std::set<std::string>::iterator iPath =
_hltPaths.begin();
210 if(path.rfind(
"_v") < path.length())
212 shortpath = path.substr(0, path.rfind(
"_v"));
217 const std::vector<unsigned int> objsNeedHLT = this->
getObjectsType(shortpath);
220 std::vector<unsigned int> userInstantiate;
221 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin() ;
224 userInstantiate.push_back(it->first);
226 for(std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
229 if(
std::find(userInstantiate.begin(),userInstantiate.end(), *it) ==
230 userInstantiate.end() )
232 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::beginRun, "
233 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
234 <<
_analysisname <<
"' has been asked to evaluate the trigger path '"
235 << shortpath <<
"' (found it in 'hltPathsToCheck') BUT this path"
237 <<
"' which has not been instantiate ('recVariableLabels'"
242 LogTrace(
"HiggsValidation") <<
" --- " << shortpath;
251 for(std::vector<HLTHiggsPlotter>::iterator it =
_analyzers.begin();
254 it->beginRun(iRun, iSetup);
258 for(std::map<unsigned int,std::string>::const_iterator it =
_recLabels.begin();
262 std::vector<std::string> sources(2);
266 for(
size_t i = 0;
i < sources.size();
i++)
285 std::map<unsigned int,std::string> u2str;
293 std::vector<MatchStruct> * matches =
new std::vector<MatchStruct>;
295 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
325 std::map<unsigned int,std::vector<MatchStruct> > sourceMatchMap;
327 sourceMatchMap[
GEN] = *matches;
333 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
345 sourceMatchMap[
RECO] = *matches;
354 for(
std::map<
unsigned int,std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin();
355 it != sourceMatchMap.end(); ++it)
365 std::map<unsigned int,int> * countobjects =
new std::map<unsigned int,int>;
367 for(std::map<unsigned int,std::string>::iterator co =
_recLabels.begin();
370 countobjects->insert(std::pair<unsigned int,int>(co->first,0));
373 const int totalobjectssize2 = 2*countobjects->
size();
374 for(
size_t j = 0;
j < it->second.size(); ++
j)
376 const unsigned int objType = it->second[
j].objType;
379 float pt = (it->second)[
j].pt;
380 float eta = (it->second)[
j].eta;
381 float phi = (it->second)[
j].phi;
383 this->
fillHist(u2str[it->first],objTypeStr,
"Eta",eta);
384 this->
fillHist(u2str[it->first],objTypeStr,
"Phi",phi);
385 if( (*countobjects)[objType] == 0 )
387 this->
fillHist(u2str[it->first],objTypeStr,
"MaxPt1",pt);
389 ++((*countobjects)[objType]);
392 else if( (*countobjects)[objType] == 1 )
394 this->
fillHist(u2str[it->first],objTypeStr,
"MaxPt2",pt);
396 ++((*countobjects)[objType]);
402 if( counttotal == totalobjectssize2 )
412 for(std::vector<HLTHiggsPlotter>::iterator an =
_analyzers.begin();
417 an->analyze(ispassTrigger,source,it->second);
425 static const unsigned int objSize = 5;
434 std::set<unsigned int> objsType;
436 for(
unsigned int i = 0;
i < objSize; ++
i)
440 if( ! TString(hltPath).Contains(objTypeStr) )
445 objsType.insert(objtriggernames[i]);
448 return std::vector<unsigned int>(objsType.begin(),objsType.end());
455 if( anpset.
exists(
"recMuonLabel") )
460 if( anpset.
exists(
"recElecLabel") )
465 if( anpset.
exists(
"recPhotonLabel") )
470 if( anpset.
exists(
"recCaloMETLabel") )
475 if( anpset.
exists(
"recPFTauLabel") )
488 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::bookobjects, "
489 <<
"Not included any object (recMuonLabel, recElecLabel, ...) "
520 iEvent.
getByLabel(trigResultsTag,trigResults);
535 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
576 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::initobjects "
577 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second <<
"'";
587 sourceUpper[0] = std::toupper(sourceUpper[0]);
591 if(variable.find(
"MaxPt") != std::string::npos)
593 std::string desc = (variable ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
596 float *
edges =
new float[nBins + 1];
597 for(
size_t i = 0;
i < nBins + 1;
i++)
601 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
606 std::string symbol = (variable ==
"Eta") ?
"#eta" :
"#phi";
610 int nBins = (int)params[0];
611 double min = params[1];
612 double max = params[2];
613 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
624 sourceUpper[0] = toupper(sourceUpper[0]);
666 std::vector<MatchStruct> * matches)
670 for(
size_t i = 0;
i < cols->
muons->size();
i++)
690 for(
size_t i = 0;
i < cols->
photons->size();
i++)
710 for(
size_t i = 0;
i < cols->
pfTaus->size();
i++)
std::vector< double > _parametersTurnOn
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void InitSelector(const unsigned int &objtype)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
std::map< std::string, std::string > _shortpath2long
Relation between the short version of a path.
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
static std::string getTypeString(const unsigned int &objtype)
void initobjects(const edm::Event &iEvent, EVTColContainer *col)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
std::map< std::string, MonitorElement * > _elements
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
const std::vector< reco::Photon > * photons
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::set< std::string > _hltPaths
the hlt paths found in the hltConfig
const std::vector< reco::CaloMET > * caloMETs
const edm::TriggerResults * triggerResults
container with all the objects needed
Strings::size_type size() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
HLTConfigProvider _hltConfig
const std::vector< reco::GsfElectron > * electrons
StringCutObjectSelector< reco::Track > * _recTrackSelector
std::map< unsigned int, std::string > _recCut
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
void bookobjects(const edm::ParameterSet &anpset)
unsigned int triggerIndex(std::string const &name) const
std::string _hltProcessName
const T & max(const T &a, const T &b)
std::vector< HLTHiggsPlotter > _analyzers
std::map< unsigned int, std::string > _recLabels
HLTHiggsSubAnalysis(const edm::ParameterSet &pset, const std::string &analysisname)
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
std::map< unsigned int, double > _cutMinPt
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup)
static const char *const trigNames[]
const reco::GenParticleCollection * genParticles
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
StringCutObjectSelector< reco::Muon > * _recMuonSelector
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
T const * product() const
Helper structure to order MatchStruct.
const std::vector< unsigned int > getObjectsType(const std::string &hltpath) const
Extract what objects need this analysis.
void insertcandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< MatchStruct > *matches)
std::vector< double > _parametersPhi
std::string _analysisname
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::string _genParticleLabel
std::vector< double > _parametersEta
Some kinematical parameters.
std::map< unsigned int, double > _cutMaxEta
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
const std::vector< reco::PFTau > * pfTaus
void bookHist(const std::string &source, const std::string &objType, const std::string &variable)
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
const std::vector< reco::Muon > * muons
void setCurrentFolder(const std::string &fullpath)