36 _analysisname(analysisname),
38 _hltProcessName(pset.getParameter<std::
string>(
"hltProcessName")),
40 _parametersEta(pset.getParameter<std::vector<double> >(
"parametersEta")),
41 _parametersPhi(pset.getParameter<std::vector<double> >(
"parametersPhi")),
42 _parametersTurnOn(pset.getParameter<std::vector<double> >(
"parametersTurnOn")),
43 _trigResultsTag(iC.consumes<edm::TriggerResults>(edm::InputTag(
"TriggerResults",
"",_hltProcessName))),
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();
150 edm::LogError(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun: "
151 <<
"Initializtion of HLTConfigProvider failed!!";
165 if(TString(thetriggername).Contains(pattern))
173 edm::LogWarning(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun, In "
180 <<
"\nHLT Trigger Paths found >>>";
183 for(std::set<std::string>::iterator iPath =
_hltPaths.begin();
190 if(path.rfind(
"_v") < path.length())
192 shortpath = path.substr(0, path.rfind(
"_v"));
197 const std::vector<unsigned int> objsNeedHLT = this->
getObjectsType(shortpath);
200 std::vector<unsigned int> userInstantiate;
201 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin() ;
204 userInstantiate.push_back(it->first);
206 for(std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
209 if(
std::find(userInstantiate.begin(),userInstantiate.end(), *it) ==
210 userInstantiate.end() )
212 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::beginRun, "
213 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
214 <<
_analysisname <<
"' has been asked to evaluate the trigger path '"
215 << shortpath <<
"' (found it in 'hltPathsToCheck') BUT this path"
217 <<
"' which has not been instantiate ('recVariableLabels'"
222 LogTrace(
"HiggsValidation") <<
" --- " << shortpath;
231 for(std::vector<HLTHiggsPlotter>::iterator it =
_analyzers.begin();
234 it->beginRun(iRun, iSetup);
238 for(std::map<unsigned int,std::string>::const_iterator it =
_recLabels.begin();
242 std::vector<std::string> sources(2);
246 for(
size_t i = 0;
i < sources.size();
i++)
265 std::map<unsigned int,std::string> u2str;
273 std::vector<MatchStruct> * matches =
new std::vector<MatchStruct>;
275 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
305 std::map<unsigned int,std::vector<MatchStruct> > sourceMatchMap;
307 sourceMatchMap[
GEN] = *matches;
313 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
325 sourceMatchMap[
RECO] = *matches;
334 for(
std::map<
unsigned int,std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin();
335 it != sourceMatchMap.end(); ++it)
345 std::map<unsigned int,int> * countobjects =
new std::map<unsigned int,int>;
347 for(std::map<unsigned int,std::string>::iterator co =
_recLabels.begin();
350 countobjects->insert(std::pair<unsigned int,int>(co->first,0));
353 const int totalobjectssize2 = 2*countobjects->
size();
354 for(
size_t j = 0;
j < it->second.size(); ++
j)
356 const unsigned int objType = it->second[
j].objType;
359 float pt = (it->second)[
j].pt;
360 float eta = (it->second)[
j].eta;
361 float phi = (it->second)[
j].phi;
363 this->
fillHist(u2str[it->first],objTypeStr,
"Eta",eta);
364 this->
fillHist(u2str[it->first],objTypeStr,
"Phi",phi);
365 if( (*countobjects)[objType] == 0 )
367 this->
fillHist(u2str[it->first],objTypeStr,
"MaxPt1",pt);
369 ++((*countobjects)[objType]);
372 else if( (*countobjects)[objType] == 1 )
374 this->
fillHist(u2str[it->first],objTypeStr,
"MaxPt2",pt);
376 ++((*countobjects)[objType]);
382 if( counttotal == totalobjectssize2 )
392 for(std::vector<HLTHiggsPlotter>::iterator an =
_analyzers.begin();
397 an->analyze(ispassTrigger,source,it->second);
405 static const unsigned int objSize = 5;
414 std::set<unsigned int> objsType;
416 for(
unsigned int i = 0;
i < objSize; ++
i)
420 if( ! TString(hltPath).Contains(objTypeStr) )
425 objsType.insert(objtriggernames[i]);
428 return std::vector<unsigned int>(objsType.begin(),objsType.end());
435 if( anpset.
exists(
"recMuonLabel") )
441 if( anpset.
exists(
"recElecLabel") )
447 if( anpset.
exists(
"recPhotonLabel") )
453 if( anpset.
exists(
"recCaloMETLabel") )
459 if( anpset.
exists(
"recPFTauLabel") )
473 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::bookobjects, "
474 <<
"Not included any object (recMuonLabel, recElecLabel, ...) "
506 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
541 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::initobjects "
542 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second <<
"'";
552 sourceUpper[0] = std::toupper(sourceUpper[0]);
556 if(variable.find(
"MaxPt") != std::string::npos)
558 std::string desc = (variable ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
561 float *
edges =
new float[nBins + 1];
562 for(
size_t i = 0;
i < nBins + 1;
i++)
566 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
571 std::string symbol = (variable ==
"Eta") ?
"#eta" :
"#phi";
575 int nBins = (int)params[0];
576 double min = params[1];
577 double max = params[2];
578 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
589 sourceUpper[0] = toupper(sourceUpper[0]);
631 std::vector<MatchStruct> * matches)
635 for(
size_t i = 0;
i < cols->
muons->size();
i++)
655 for(
size_t i = 0;
i < cols->
photons->size();
i++)
675 for(
size_t i = 0;
i < cols->
pfTaus->size();
i++)
std::vector< double > _parametersTurnOn
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
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::vector< PFTau > PFTauCollection
collection of PFTau objects
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
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.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::PFTauCollection > _recLabelsPFTau
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
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
edm::EDGetTokenT< reco::PhotonCollection > _recLabelsPhoton
const std::vector< reco::GsfElectron > * electrons
edm::EDGetTokenT< reco::CaloMETCollection > _recLabelsCaloMET
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.
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
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
std::map< unsigned int, double > _cutMinPt
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup)
edm::EDGetTokenT< edm::TriggerResults > _trigResultsTag
static const char *const trigNames[]
const reco::GenParticleCollection * genParticles
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
edm::EDGetTokenT< reco::GsfElectronCollection > _recLabelsElec
HLTHiggsSubAnalysis(const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&iC)
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
std::vector< Photon > PhotonCollection
collectin of Photon objects
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)
edm::EDGetTokenT< reco::MuonCollection > _recLabelsMuon
std::vector< double > _parametersPhi
std::string _analysisname
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::vector< double > _parametersEta
Some kinematical parameters.
std::map< unsigned int, double > _cutMaxEta
void bookobjects(const edm::ParameterSet &anpset, edm::ConsumesCollector &iC)
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
const std::vector< reco::PFTau > * pfTaus
void bookHist(const std::string &source, const std::string &objType, const std::string &variable)
static std::string const source
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
const std::vector< reco::Muon > * muons
void setCurrentFolder(const std::string &fullpath)