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 _parametersPu(pset.getParameter<std::vector<double> >(
"parametersPu")),
43 _parametersTurnOn(pset.getParameter<std::vector<double> >(
"parametersTurnOn")),
44 _trigResultsTag(iC.consumes<edm::
TriggerResults>(edm::InputTag(
"TriggerResults",
"",_hltProcessName))),
47 _recCaloMETSelector(0),
49 _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();
83 if(anpset.
existsAs<
double>( objStr+
"_cutMinPt" ,
false) )
87 if(anpset.
existsAs<
double>( objStr+
"_cutMaxEta" ,
false) )
96 if( pset.
exists(
"pileUpInfoLabel") )
140 edm::LogError(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun: "
141 <<
"Initializtion of HLTConfigProvider failed!!";
155 if(TString(thetriggername).Contains(pattern))
163 edm::LogWarning(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun, In "
170 <<
"\nHLT Trigger Paths found >>>";
173 for(std::set<std::string>::iterator iPath =
_hltPaths.begin();
180 if(path.rfind(
"_v") < path.length())
182 shortpath = path.substr(0, path.rfind(
"_v"));
187 const std::vector<unsigned int> objsNeedHLT = this->
getObjectsType(shortpath);
190 std::vector<unsigned int> userInstantiate;
191 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin() ;
194 userInstantiate.push_back(it->first);
196 for(std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
199 if(
std::find(userInstantiate.begin(),userInstantiate.end(), *it) ==
200 userInstantiate.end() )
202 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::beginRun, "
203 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
204 <<
_analysisname <<
"' has been asked to evaluate the trigger path '"
205 << shortpath <<
"' (found it in 'hltPathsToCheck') BUT this path"
207 <<
"' which has not been instantiate ('recVariableLabels'"
212 LogTrace(
"HiggsValidation") <<
" --- " << shortpath;
227 std::vector<std::string> sources(2);
231 for(std::map<unsigned int,std::string>::const_iterator it =
_recLabels.begin();
236 for(
size_t i = 0;
i < sources.size();
i++)
239 bookHist(source, objStr,
"Eta", ibooker);
240 bookHist(source, objStr,
"Phi", ibooker);
241 bookHist(source, objStr,
"MaxPt1", ibooker);
242 bookHist(source, objStr,
"MaxPt2", ibooker);
247 for(std::vector<HLTHiggsPlotter>::iterator it =
_analyzers.begin();
250 it->bookHistograms(ibooker);
253 for(
size_t i = 0;
i < sources.size();
i++)
259 std::string nameGlobalEfficiencyPassing= nameGlobalEfficiency+
"_passingHLT";
265 int nBins = (int)params[0];
266 double min = params[1];
267 double max = params[2];
274 if(path.rfind(
"_v") < path.length())
276 shortpath = path.substr(0, path.rfind(
"_v"));
278 std::string titlePassing =
"nb of interations in the event passing path " + shortpath;
279 _elements[nameVtxPlot+
"_"+shortpath] = ibooker.
book1D(nameVtxPlot+
"_"+shortpath, titlePassing.c_str(), nBins,
min,
max);
282 _elements[nameGlobalEfficiency]->setBinLabel(
j+1,shortpath);
283 _elements[nameGlobalEfficiencyPassing]->setBinLabel(
j+1,shortpath);
296 std::map<unsigned int,std::string> u2str;
304 std::vector<PileupSummaryInfo>::const_iterator PVI;
305 for(PVI = puInfo->begin(); PVI != puInfo->end(); ++PVI) {
306 if(PVI->getBunchCrossing()==0){
307 nbMCvtx = PVI->getPU_NumInteractions();
317 std::vector<MatchStruct> * matches =
new std::vector<MatchStruct>;
319 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
349 std::map<unsigned int,std::vector<MatchStruct> > sourceMatchMap;
351 sourceMatchMap[
GEN] = *matches;
357 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
369 sourceMatchMap[
RECO] = *matches;
378 for(
std::map<
unsigned int,std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin();
379 it != sourceMatchMap.end(); ++it)
389 std::map<unsigned int,int> * countobjects =
new std::map<unsigned int,int>;
391 for(std::map<unsigned int,std::string>::iterator co =
_recLabels.begin();
394 countobjects->insert(std::pair<unsigned int,int>(co->first,0));
397 const int totalobjectssize2 = 2*countobjects->
size();
398 for(
size_t j = 0;
j < it->second.size(); ++
j)
400 const unsigned int objType = it->second[
j].objType;
403 float pt = (it->second)[
j].pt;
404 float eta = (it->second)[
j].eta;
405 float phi = (it->second)[
j].phi;
407 this->
fillHist(u2str[it->first],objTypeStr,
"Eta",eta);
408 this->
fillHist(u2str[it->first],objTypeStr,
"Phi",phi);
409 if( (*countobjects)[objType] == 0 )
411 this->
fillHist(u2str[it->first],objTypeStr,
"MaxPt1",pt);
413 ++((*countobjects)[objType]);
416 else if( (*countobjects)[objType] == 1 )
418 this->
fillHist(u2str[it->first],objTypeStr,
"MaxPt2",pt);
420 ++((*countobjects)[objType]);
426 if( counttotal == totalobjectssize2 )
441 for(std::vector<HLTHiggsPlotter>::iterator an =
_analyzers.begin();
445 const std::string fillShortPath = an->gethltpath();
447 an->analyze(ispassTrigger,source,it->second);
448 int refOfThePath = -1;
453 _elements[SummaryName]->Fill(refOfThePath);
455 _elements[SummaryName+
"_passingHLT"]->Fill(refOfThePath,1);
456 _elements[nameVtxPlot+
"_"+fillShortPath.c_str()]->Fill(nbMCvtx);
459 _elements[SummaryName+
"_passingHLT"]->Fill(refOfThePath,0);
469 static const unsigned int objSize = 5;
478 std::set<unsigned int> objsType;
480 for(
unsigned int i = 0;
i < objSize; ++
i)
484 if( ! TString(hltPath).Contains(objTypeStr) )
489 objsType.insert(objtriggernames[i]);
492 return std::vector<unsigned int>(objsType.begin(),objsType.end());
499 if( anpset.
exists(
"recMuonLabel") )
505 if( anpset.
exists(
"recElecLabel") )
511 if( anpset.
exists(
"recPhotonLabel") )
517 if( anpset.
exists(
"recCaloMETLabel") )
523 if( anpset.
exists(
"recPFTauLabel") )
538 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::bookobjects, "
539 <<
"Not included any object (recMuonLabel, recElecLabel, ...) "
571 for(std::map<unsigned int,std::string>::iterator it =
_recLabels.begin();
606 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::initobjects "
607 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second <<
"'";
617 sourceUpper[0] = std::toupper(sourceUpper[0]);
621 if(variable.find(
"MaxPt") != std::string::npos){
622 std::string desc = (variable ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
625 float *
edges =
new float[nBins + 1];
626 for(
size_t i = 0;
i < nBins + 1;
i++)
630 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
635 std::string symbol = (variable ==
"Eta") ?
"#eta" :
"#phi";
639 int nBins = (int)params[0];
640 double min = params[1];
641 double max = params[2];
642 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
653 sourceUpper[0] = toupper(sourceUpper[0]);
695 std::vector<MatchStruct> * matches)
699 for(
size_t i = 0;
i < cols->
muons->size();
i++)
719 for(
size_t i = 0;
i < cols->
photons->size();
i++)
739 for(
size_t i = 0;
i < cols->
pfTaus->size();
i++)
const std::vector< reco::Muon > * muons
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
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
void initobjects(const edm::Event &iEvent, EVTColContainer *col)
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
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 reco::GenParticleCollection * genParticles
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
const std::vector< reco::PFTau > * pfTaus
std::vector< Muon > MuonCollection
collection of Muon objects
void bookHistograms(DQMStore::IBooker &)
std::vector< double > _parametersPu
edm::EDGetTokenT< reco::PhotonCollection > _recLabelsPhoton
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.
tuple path
else: Piece not in the list, fine.
unsigned int triggerIndex(std::string const &name) const
std::string _hltProcessName
const T & max(const T &a, const T &b)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
std::vector< HLTHiggsPlotter > _analyzers
MonitorElement * book1D(Args &&...args)
std::map< unsigned int, std::string > _recLabels
const std::vector< reco::Photon > * photons
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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[]
void bookHist(const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
void setCurrentFolder(const std::string &fullpath)
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)
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
const std::vector< reco::GsfElectron > * electrons
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
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
static std::string const source
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector