CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

HLTHiggsSubAnalysis Class Reference

#include <HLTHiggsSubAnalysis.h>

List of all members.

Public Types

enum  { GEN, RECO }

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
void beginJob ()
void beginRun (const edm::Run &iRun, const edm::EventSetup &iEventSetup)
const std::vector< unsigned int > getObjectsType (const std::string &hltpath) const
 Extract what objects need this analysis.
 HLTHiggsSubAnalysis (const edm::ParameterSet &pset, const std::string &analysisname)
 ~HLTHiggsSubAnalysis ()

Private Member Functions

void bookHist (const std::string &source, const std::string &objType, const std::string &variable)
void bookobjects (const edm::ParameterSet &anpset)
void fillHist (const std::string &source, const std::string &objType, const std::string &variable, const float &value)
void initobjects (const edm::Event &iEvent, EVTColContainer *col)
void InitSelector (const unsigned int &objtype)
void insertcandidates (const unsigned int &objtype, const EVTColContainer *col, std::vector< MatchStruct > *matches)

Private Attributes

std::string _analysisname
std::vector< HLTHiggsPlotter_analyzers
std::map< unsigned int, double > _cutMaxEta
std::map< unsigned int, double > _cutMinPt
std::map< unsigned int,
unsigned int > 
_cutMotherId
std::map< unsigned int,
std::vector< double > > 
_cutsDr
DQMStore_dbe
std::map< std::string,
MonitorElement * > 
_elements
std::map< unsigned int,
std::string > 
_genCut
 gen/rec objects cuts
std::string _genParticleLabel
std::map< unsigned int,
StringCutObjectSelector
< reco::GenParticle > * > 
_genSelectorMap
HLTConfigProvider _hltConfig
std::set< std::string > _hltPaths
 the hlt paths found in the hltConfig
std::vector< std::string > _hltPathsToCheck
 the hlt paths with regular expressions
std::string _hltProcessName
unsigned int _minCandidates
 The minimum number of reco/gen candidates needed by the analysis.
std::vector< double > _parametersEta
 Some kinematical parameters.
std::vector< double > _parametersPhi
std::vector< double > _parametersTurnOn
edm::ParameterSet _pset
StringCutObjectSelector
< reco::CaloMET > * 
_recCaloMETSelector
std::map< unsigned int,
std::string > 
_recCut
StringCutObjectSelector
< reco::GsfElectron > * 
_recElecSelector
std::map< unsigned int,
std::string > 
_recLabels
StringCutObjectSelector
< reco::Muon > * 
_recMuonSelector
StringCutObjectSelector
< reco::PFTau > * 
_recPFTauSelector
StringCutObjectSelector
< reco::Photon > * 
_recPhotonSelector
StringCutObjectSelector
< reco::Track > * 
_recTrackSelector
std::map< std::string,
std::string > 
_shortpath2long
 Relation between the short version of a path.

Detailed Description

Generate histograms for trigger efficiencies Higgs related Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/HiggsWGHLTValidate

Date:
2012/03/23 11:50:56
Revision:
1.7
Author:
J. Duarte Campderros (based and adapted on J. Klukas, M. Vander Donckt and J. Alcaraz code from the HLTriggerOffline/Muon package)

Definition at line 55 of file HLTHiggsSubAnalysis.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
GEN 
RECO 

Definition at line 58 of file HLTHiggsSubAnalysis.h.

                {
                        GEN,
                        RECO
                };

Constructor & Destructor Documentation

HLTHiggsSubAnalysis::HLTHiggsSubAnalysis ( const edm::ParameterSet pset,
const std::string &  analysisname 
)

Definition at line 34 of file HLTHiggsSubAnalysis.cc.

References _cutMaxEta, _cutMinPt, _dbe, _genCut, _hltPathsToCheck, _minCandidates, _recCut, _recLabels, bookobjects(), edm::ParameterSet::getParameter(), EVTColContainer::getTypeString(), edm::ParameterSet::getUntrackedParameter(), and cmsCodeRules::cppFunctionSkipper::operator.

                                                :
        _pset(pset),
        _analysisname(analysisname),
        _minCandidates(0),
        _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
        _genParticleLabel(pset.getParameter<std::string>("genParticleLabel")),
        _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
        _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
        _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
        _recMuonSelector(0),
        _recElecSelector(0),
        _recCaloMETSelector(0),
        _recPFTauSelector(0),
        _recPhotonSelector(0),
        _recTrackSelector(0),
        _dbe(0)
{
        // Specific parameters for this analysis
        edm::ParameterSet anpset = pset.getParameter<edm::ParameterSet>(analysisname);
        // Collections labels (but genparticles already initialized) 
        // initializing _recLabels data member)
        this->bookobjects( anpset );

        // Generic objects: Initialization of cuts
        for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
                        it != _recLabels.end(); ++it)
        {
                const std::string objStr = EVTColContainer::getTypeString(it->first);
                _genCut[it->first] = pset.getParameter<std::string>( std::string(objStr+"_genCut").c_str() );
                _recCut[it->first] = pset.getParameter<std::string>( std::string(objStr+"_recCut").c_str() );
                _cutMinPt[it->first] = pset.getParameter<double>( std::string(objStr+"_cutMinPt").c_str() );
                _cutMaxEta[it->first] = pset.getParameter<double>( std::string(objStr+"_cutMaxEta").c_str() );
        }

        //--- Updating parameters if has to be modified for this particular specific analysis
        for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
                        it != _recLabels.end(); ++it)
        {
                const std::string objStr = EVTColContainer::getTypeString(it->first);
                try
                {
                        _genCut[it->first] = anpset.getUntrackedParameter<std::string>( std::string(objStr+"_genCut").c_str() ); 
                }
                catch(edm::Exception)
                {
                }
                try
                {
                        _recCut[it->first] = anpset.getUntrackedParameter<std::string>( std::string(objStr+"_recCut").c_str() );
                }
                catch(edm::Exception)
                {
                }
                try
                {
                        _cutMinPt[it->first] = anpset.getUntrackedParameter<double>( std::string(objStr+"_cutMinPt").c_str() );
                }
                catch(edm::Exception)
                {
                }
                try
                {
                        _cutMaxEta[it->first] = anpset.getUntrackedParameter<double>( std::string(objStr+"_cutMaxEta").c_str() );
                }
                catch(edm::Exception)
                {
                }
        }
        
        _hltPathsToCheck = anpset.getParameter<std::vector<std::string> >("hltPathsToCheck");
        _minCandidates = anpset.getParameter<unsigned int>("minCandidates");

        _dbe = edm::Service<DQMStore>().operator->();
        _dbe->setVerbose(0);
}
HLTHiggsSubAnalysis::~HLTHiggsSubAnalysis ( )

Definition at line 111 of file HLTHiggsSubAnalysis.cc.

References _genSelectorMap, _recCaloMETSelector, _recElecSelector, _recMuonSelector, _recPFTauSelector, _recPhotonSelector, _recTrackSelector, and Association::map.

{
        for(std::map<unsigned int,StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
                        it != _genSelectorMap.end(); ++it)
        {
                if( it->second != 0)
                {
                        delete it->second;
                        it->second =0;
                }
        }
        if( _recMuonSelector != 0)
        {
                delete _recMuonSelector;
                _recMuonSelector =0;
        }
        if( _recElecSelector != 0)
        {
                delete _recElecSelector;
                _recElecSelector =0;
        }
        if( _recPhotonSelector != 0)
        {
                delete _recPhotonSelector;
                _recPhotonSelector =0;
        }
        if( _recCaloMETSelector != 0)
        {
                delete _recCaloMETSelector;
                _recCaloMETSelector =0;
        }
        if( _recPFTauSelector != 0)
        {
                delete _recPFTauSelector;
                _recPFTauSelector =0;
        }
        if( _recTrackSelector != 0)
        {
                delete _recTrackSelector;
                _recTrackSelector =0;
        }
}

Member Function Documentation

void HLTHiggsSubAnalysis::analyze ( const edm::Event iEvent,
const edm::EventSetup iEventSetup,
EVTColContainer cols 
)

Definition at line 279 of file HLTHiggsSubAnalysis.cc.

References _analyzers, _genCut, _genSelectorMap, _minCandidates, _recLabels, _shortpath2long, edm::HLTGlobalStatus::accept(), eta(), fillHist(), GEN, EVTColContainer::genParticles, EVTColContainer::getTypeString(), i, initobjects(), InitSelector(), insertcandidates(), j, Association::map, phi, RECO, edm::TriggerNames::size(), python::multivaluedict::sort(), LaserTracksInput_cfi::source, edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), EVTColContainer::triggerResults, and trigNames.

{
        // Initialize the collection (the ones which hasn't been initialiazed yet)
        this->initobjects(iEvent,cols);
        // utility map
        std::map<unsigned int,std::string> u2str;
        u2str[GEN]="gen";
        u2str[RECO]="rec";

        // Extract the match structure containing the gen/reco candidates (electron, muons,...)
        // common to all the SubAnalysis
        //---- Generation
        // Make each good gen object into the base cand for a MatchStruct
        std::vector<MatchStruct> * matches = new std::vector<MatchStruct>;
//      bool alreadyMu = false;
        for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
                        it != _recLabels.end(); ++it)
        {
                // Avoiding the TkMu and Mu case
/*              if( alreadyMu )
                {
                        continue;
                }*/
                // Initialize selectors when first event
                if(!_genSelectorMap[it->first]) 
                {
                        _genSelectorMap[it->first] = new StringCutObjectSelector<reco::GenParticle>(_genCut[it->first]);
                }

                for(size_t i = 0; i < cols->genParticles->size(); ++i)
                {
                        if(_genSelectorMap[it->first]->operator()(cols->genParticles->at(i)))
                        {
                                matches->push_back(MatchStruct(&cols->genParticles->at(i),it->first));
                        }
                }
/*              if( it->first == EVTColContainer::MUON || it->first == EVTColContainer::TRACK )
                {
                        alreadyMu = true;
                }*/
        }
        // Sort the MatchStructs by pT for later filling of turn-on curve
        std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
        
        // Map to reference the source (gen/reco) with the recoCandidates
        std::map<unsigned int,std::vector<MatchStruct> > sourceMatchMap;  // To be a pointer to delete
        // --- Storing the generating candidates
        sourceMatchMap[GEN] = *matches;
        
        // Reuse the vector
        matches->clear();
        // --- same for RECO objects
        // Extraction of the objects candidates 
        for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
                        it != _recLabels.end(); ++it)
        {
                // Reco selectors (the function takes into account if it was instantiated 
                // before or not
                this->InitSelector(it->first);
                // -- Storing the matches 
                this->insertcandidates(it->first,cols,matches);
        }
        // Sort the MatchStructs by pT for later filling of turn-on curve
        std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
        // --- Storing the reco candidates
        sourceMatchMap[RECO] = *matches;
        // --- All the objects are in place
        delete matches;  
        
        // -- Trigger Results
        const edm::TriggerNames trigNames = iEvent.triggerNames(*(cols->triggerResults));

        // Filling the histograms if pass the minimum amount of candidates needed by the analysis:
        // GEN + RECO CASE in the same loop
        for(std::map<unsigned int,std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin(); 
                        it != sourceMatchMap.end(); ++it)
        {
                // it->first: gen/reco   it->second: matches (std::vector<MatchStruc>)
                if( it->second.size() < _minCandidates )   // FIXME: A bug is potentially here: what about the mixed channels?
                {
                        continue;
                }
                
                // Filling the gen/reco objects (eff-denominators): 
                // Just the first two different ones, if there are more
                std::map<unsigned int,int> * countobjects = new std::map<unsigned int,int>;
                // Initializing the count of the used object
                for(std::map<unsigned int,std::string>::iterator co = _recLabels.begin();
                                co != _recLabels.end(); ++co)
                {
                        countobjects->insert(std::pair<unsigned int,int>(co->first,0));
                }
                int counttotal = 0;
                const int totalobjectssize2 = 2*countobjects->size();
                for(size_t j = 0; j < it->second.size(); ++j)
                {
                        const unsigned int objType = it->second[j].objType;
                        const std::string objTypeStr = EVTColContainer::getTypeString(objType);

                        float pt  = (it->second)[j].pt; 
                        float eta = (it->second)[j].eta;
                        float phi = (it->second)[j].phi;
                        
                        this->fillHist(u2str[it->first],objTypeStr,"Eta",eta);
                        this->fillHist(u2str[it->first],objTypeStr,"Phi",phi);
                        if( (*countobjects)[objType] == 0 )
                        {
                                this->fillHist(u2str[it->first],objTypeStr,"MaxPt1",pt);
                                // Filled the high pt ...
                                ++((*countobjects)[objType]);
                                ++counttotal;
                        }
                        else if( (*countobjects)[objType] == 1  )
                        {
                                this->fillHist(u2str[it->first],objTypeStr,"MaxPt2",pt);
                                // Filled the second high pt ...
                                ++((*countobjects)[objType]);
                                ++counttotal;
                        }
                        else
                        {
                                // Already the minimum two objects has been filled, get out...
                                if( counttotal == totalobjectssize2 )
                                {
                                        break;
                                }
                        }                               
                }
                delete countobjects;
        
                // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
                const std::string source = u2str[it->first];
                for(std::vector<HLTHiggsPlotter>::iterator an = _analyzers.begin();
                                an != _analyzers.end(); ++an)
                {
                        const std::string hltPath = _shortpath2long[an->gethltpath()];
                        const bool ispassTrigger =  cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
                        an->analyze(ispassTrigger,source,it->second);
                }
        }
}
void HLTHiggsSubAnalysis::beginJob ( void  )

Definition at line 155 of file HLTHiggsSubAnalysis.cc.

{
}
void HLTHiggsSubAnalysis::beginRun ( const edm::Run iRun,
const edm::EventSetup iEventSetup 
)

Definition at line 161 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _analyzers, _dbe, _hltConfig, _hltPaths, _hltPathsToCheck, _hltProcessName, _pset, _recLabels, _shortpath2long, bookHist(), cmsRelvalreport::exit, spr::find(), newFWLiteAna::found, getObjectsType(), EVTColContainer::getTypeString(), i, HLTConfigProvider::init(), j, LogTrace, getHLTPrescaleColumns::path, listBenchmarks::pattern, DQMStore::setCurrentFolder(), LaserTracksInput_cfi::source, and HLTConfigProvider::triggerNames().

{
        std::string baseDir = "HLT/Higgs/"+_analysisname+"/";
        _dbe->setCurrentFolder(baseDir);

        // Initialize the confighlt
        bool changedConfig;
        if(!_hltConfig.init(iRun,iSetup,_hltProcessName,changedConfig))
        {
                edm::LogError("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun: "
                        << "Initializtion of HLTConfigProvider failed!!";
        }


        // Parse the input paths to get them if there are in the table 
        // and associate them the last filter of the path (in order to extract the
        _hltPaths.clear();
        for(size_t i = 0; i < _hltPathsToCheck.size(); ++i)
        {
                bool found = false;
                TPRegexp pattern(_hltPathsToCheck[i]);
                for(size_t j = 0 ; j < _hltConfig.triggerNames().size(); ++j)
                {
                        std::string thetriggername = _hltConfig.triggerNames()[j];
                        if(TString(thetriggername).Contains(pattern))
                        {
                                _hltPaths.insert(thetriggername);
                                found = true;
                        }
                }
                if( ! found )
                {
                        edm::LogWarning("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun, In "
                                << _analysisname << " subfolder NOT found the path: '" 
                                << _hltPathsToCheck[i] << "*'" ;
                }
        }

        LogTrace("HiggsValidation") << "SubAnalysis: " << _analysisname 
                << "\nHLT Trigger Paths found >>>"; 
        // Initialize the plotters (analysers for each trigger path)
        _analyzers.clear();
        for(std::set<std::string>::iterator iPath = _hltPaths.begin(); 
                        iPath != _hltPaths.end(); ++iPath) 
        {
                // Avoiding the dependence of the version number for
                // the trigger paths
                std::string path = * iPath;
                std::string shortpath = path;
                if(path.rfind("_v") < path.length())
                {
                        shortpath = path.substr(0, path.rfind("_v"));
                }
                _shortpath2long[shortpath] = path;

                // Objects needed by the HLT path
                const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
                // Sanity check: the object needed by a trigger path should be
                // introduced by the user via config python (_recLabels datamember)
                std::vector<unsigned int> userInstantiate;
                for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin() ; 
                                it != _recLabels.end(); ++it)
                {
                        userInstantiate.push_back(it->first);
                }
                for(std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end(); 
                                ++it)
                {
                        if( std::find(userInstantiate.begin(),userInstantiate.end(), *it) == 
                                        userInstantiate.end() )
                        {
                                edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::beginRun, " 
                                        << "Incoherence found in the python configuration file!!\nThe SubAnalysis '" 
                                        << _analysisname << "' has been asked to evaluate the trigger path '"
                                        << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
                                        << " needs a '" << EVTColContainer::getTypeString(*it) 
                                        << "' which has not been instantiate ('recVariableLabels'" 
                                        << ")" ;
                                exit(-1);
                        }
                }
                LogTrace("HiggsValidation") << " --- " << shortpath;
                
                // the hlt path, the objects (elec,muons,photons,...)
                // needed to evaluate the path are the argumens of the plotter
                HLTHiggsPlotter analyzer(_pset, shortpath,objsNeedHLT, _dbe);
                _analyzers.push_back(analyzer);
        }

        // Call the beginRun (which books all the path dependent histograms)
        for(std::vector<HLTHiggsPlotter>::iterator it = _analyzers.begin(); 
                        it != _analyzers.end(); ++it) 
        {
                it->beginRun(iRun, iSetup);
        }

        // Book the gen/reco analysis-dependent histograms (denominators)
        for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
                        it != _recLabels.end(); ++it)
        {
                const std::string objStr = EVTColContainer::getTypeString(it->first);
                std::vector<std::string> sources(2);
                sources[0] = "gen";
                sources[1] = "rec";
          
                for(size_t i = 0; i < sources.size(); i++) 
                {
                        std::string source = sources[i];
                        bookHist(source, objStr, "Eta");
                        bookHist(source, objStr, "Phi");
                        bookHist(source, objStr, "MaxPt1");
                        bookHist(source, objStr, "MaxPt2");
                }
        }
}
void HLTHiggsSubAnalysis::bookHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable 
) [private]

Definition at line 583 of file HLTHiggsSubAnalysis.cc.

References _dbe, _elements, _parametersEta, _parametersPhi, _parametersTurnOn, DQMStore::book1D(), prof2calltree::edges, h, i, max(), min, mergeVDriftHistosByStation::name, LaserTracksInput_cfi::source, and indexGen::title.

Referenced by beginRun().

{
        std::string sourceUpper = source; 
        sourceUpper[0] = std::toupper(sourceUpper[0]);
        std::string name = source + objType + variable ;
        TH1F * h = 0;

        if(variable.find("MaxPt") != std::string::npos) 
        {
                std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading";
                std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
                const size_t nBins = _parametersTurnOn.size() - 1;
                float * edges = new float[nBins + 1];
                for(size_t i = 0; i < nBins + 1; i++)
                {
                        edges[i] = _parametersTurnOn[i];
                }
                h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
                delete edges;
        }
        else 
        {
                std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
                std::string title  = symbol + " of " + sourceUpper + " " + objType;
                std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;

                int    nBins = (int)params[0];
                double min   = params[1];
                double max   = params[2];
                h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
        }
        h->Sumw2();
        _elements[name] = _dbe->book1D(name, h);
        delete h;
}
void HLTHiggsSubAnalysis::bookobjects ( const edm::ParameterSet anpset) [private]

Definition at line 453 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _genSelectorMap, _recLabels, EVTColContainer::CALOMET, EVTColContainer::ELEC, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), pat::MUON, EVTColContainer::PFTAU, and pat::PHOTON.

Referenced by HLTHiggsSubAnalysis().

{
        if( anpset.exists("recMuonLabel") )
        {
                _recLabels[EVTColContainer::MUON] = anpset.getParameter<std::string>("recMuonLabel");
                _genSelectorMap[EVTColContainer::MUON] = 0 ;
        }
        if( anpset.exists("recElecLabel") )
        {
                _recLabels[EVTColContainer::ELEC] = anpset.getParameter<std::string>("recElecLabel");
                _genSelectorMap[EVTColContainer::ELEC] = 0 ;
        }
        if( anpset.exists("recPhotonLabel") )
        {
                _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<std::string>("recPhotonLabel");
                _genSelectorMap[EVTColContainer::PHOTON] = 0 ;
        }
        if( anpset.exists("recCaloMETLabel") )
        {
                _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<std::string>("recCaloMETLabel");
                _genSelectorMap[EVTColContainer::CALOMET] = 0 ;
        }
        if( anpset.exists("recPFTauLabel") )
        {
                _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<std::string>("recPFTauLabel");
                _genSelectorMap[EVTColContainer::PFTAU] = 0 ;
        }
        /*if( anpset.exists("recTrackLabel") )
        {
                _recLabels[EVTColContainer::TRACK] = anpset.getParameter<std::string>("recTrackLabel");
                _genSelectorMap[EVTColContainer::TRACK] = 0 ;
        }*/

        if( _recLabels.size() < 1 )
        {
                edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::bookobjects, " 
                << "Not included any object (recMuonLabel, recElecLabel, ...)  "
                << "in the analysis " << _analysisname;
                return;
        }
}
void HLTHiggsSubAnalysis::fillHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
const float &  value 
) [private]

Definition at line 620 of file HLTHiggsSubAnalysis.cc.

References _elements, mergeVDriftHistosByStation::name, and LaserTracksInput_cfi::source.

Referenced by analyze().

{
        std::string sourceUpper = source; 
        sourceUpper[0] = toupper(sourceUpper[0]);
        std::string name = source + objType + variable ;

        _elements[name]->Fill(value);
}
const std::vector< unsigned int > HLTHiggsSubAnalysis::getObjectsType ( const std::string &  hltpath) const

Extract what objects need this analysis.

Definition at line 423 of file HLTHiggsSubAnalysis.cc.

References EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::getTypeString(), i, pat::MUON, EVTColContainer::PFTAU, and pat::PHOTON.

Referenced by beginRun().

{
        static const unsigned int objSize = 5; //6;
        static const unsigned int objtriggernames[] = { EVTColContainer::MUON, 
                EVTColContainer::ELEC, 
                EVTColContainer::PHOTON,
//              EVTColContainer::TRACK,  // Note is tracker muon
                EVTColContainer::PFTAU,
                EVTColContainer::CALOMET
        };

        std::set<unsigned int> objsType;
        // The object to deal has to be entered via the config .py
        for(unsigned int i = 0; i < objSize; ++i)
        {
                std::string objTypeStr = EVTColContainer::getTypeString( objtriggernames[i] );
                // Check if it is needed this object for this trigger
                if( ! TString(hltPath).Contains(objTypeStr) )
                {
                        continue;
                }

                objsType.insert(objtriggernames[i]);
        }

        return std::vector<unsigned int>(objsType.begin(),objsType.end());
}
void HLTHiggsSubAnalysis::initobjects ( const edm::Event iEvent,
EVTColContainer col 
) [private]

Definition at line 495 of file HLTHiggsSubAnalysis.cc.

References _genParticleLabel, _hltProcessName, _recLabels, EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::genParticles, edm::Event::getByLabel(), EVTColContainer::isCommonInit(), edm::HandleBase::isValid(), EVTColContainer::MUON, EVTColContainer::PFTAU, EVTColContainer::PHOTON, edm::Handle< T >::product(), EVTColContainer::set(), and EVTColContainer::triggerResults.

Referenced by analyze().

{
        /*if( col != 0 && col->isAllInit() )
        {
                // Already init, not needed to do nothing
                return;
        }*/
        if( ! col->isCommonInit() )
        {
                // TO BE DEPRECATED AS we don't need it anymore.
                // There is no match with HLT candidates... Use, then TriggerResults
                /*edm::Handle<trigger::TriggerEventWithRefs> rawTEH;
                iEvent.getByLabel("hltTriggerSummaryRAW",rawTEH);
                if(rawTEH.failedToGet())
                {
                        edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::initobjecst, "
                                << "No trigger summary found"; 
                        return;
                }
                col->rawTriggerEvent = rawTEH.product();*/
                // END-- TO BE DEPRECATED
        
                // extract the trigger results (path info, pass,...)
                edm::Handle<edm::TriggerResults> trigResults;
                edm::InputTag trigResultsTag("TriggerResults","",_hltProcessName);
                iEvent.getByLabel(trigResultsTag,trigResults);
                if( trigResults.isValid() )
                {
                        col->triggerResults = trigResults.product();
                }

                // GenParticle collection if is there
                edm::Handle<reco::GenParticleCollection> genPart;
                iEvent.getByLabel(_genParticleLabel,genPart);
                if( genPart.isValid() )
                {
                        col->genParticles = genPart.product();
                }
        }
                
        for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin(); 
                        it != _recLabels.end(); ++it)
        {
                if( it->first == EVTColContainer::MUON )
                {
                        edm::Handle<reco::MuonCollection> theHandle;
                        iEvent.getByLabel(it->second, theHandle);
                        col->set(theHandle.product());
                }
                else if( it->first == EVTColContainer::ELEC )
                {
                        edm::Handle<reco::GsfElectronCollection> theHandle;
                        iEvent.getByLabel(it->second, theHandle);
                        col->set(theHandle.product());
                }
                else if( it->first == EVTColContainer::PHOTON )
                {
                        edm::Handle<reco::PhotonCollection> theHandle;
                        iEvent.getByLabel(it->second, theHandle);
                        col->set(theHandle.product());
                }
                else if( it->first == EVTColContainer::CALOMET )
                {
                        edm::Handle<reco::CaloMETCollection> theHandle;
                        iEvent.getByLabel(it->second, theHandle);
                        col->set(theHandle.product());
                }
                else if( it->first == EVTColContainer::PFTAU )
                {
                        edm::Handle<reco::PFTauCollection> theHandle;
                        iEvent.getByLabel(it->second, theHandle);
                        col->set(theHandle.product());
                }
/*              else if( it->first == EVTColContainer::TRACK )
                {
                        edm::Handle<reco::TrackCollection> theHandle;
                        iEvent.getByLabel(it->second, theHandle);
                        col->set(theHandle.product());
                }*/
                else
                {
                        edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::initobjects " 
                                << " NOT IMPLEMENTED (yet) ERROR: '" << it->second << "'";
                        //return; ??
                }
        }
}
void HLTHiggsSubAnalysis::InitSelector ( const unsigned int &  objtype) [private]

Definition at line 633 of file HLTHiggsSubAnalysis.cc.

References _recCaloMETSelector, _recCut, _recElecSelector, _recMuonSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::MUON, EVTColContainer::PFTAU, and EVTColContainer::PHOTON.

Referenced by analyze().

{       
        if( objtype == EVTColContainer::MUON && _recMuonSelector == 0 )
        {
                _recMuonSelector = new StringCutObjectSelector<reco::Muon>(_recCut[objtype]);
        }
        else if( objtype == EVTColContainer::ELEC && _recElecSelector == 0)
        {
                _recElecSelector = new StringCutObjectSelector<reco::GsfElectron>(_recCut[objtype]);
        }
        else if( objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0)
        {
                _recPhotonSelector = new StringCutObjectSelector<reco::Photon>(_recCut[objtype]);
        }
        else if( objtype == EVTColContainer::CALOMET && _recCaloMETSelector == 0)
        {
                _recCaloMETSelector = new StringCutObjectSelector<reco::CaloMET>(_recCut[objtype]);
        }
        else if( objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0 )
        {
                _recPFTauSelector = new StringCutObjectSelector<reco::PFTau>(_recCut[objtype]);
        }
        /*else if( objtype == EVTColContainer::TRACK && _recTrackSelector == 0)
        {
                _recTrackSelector = new StringCutObjectSelector<reco::Track>(_recCut[objtype]);
        }*/
/*      else
        {
FIXME: ERROR NO IMPLEMENTADO
        }*/
}
void HLTHiggsSubAnalysis::insertcandidates ( const unsigned int &  objtype,
const EVTColContainer col,
std::vector< MatchStruct > *  matches 
) [private]

Definition at line 665 of file HLTHiggsSubAnalysis.cc.

References _recCaloMETSelector, _recElecSelector, _recMuonSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::CALOMET, EVTColContainer::caloMETs, EVTColContainer::ELEC, EVTColContainer::electrons, i, EVTColContainer::MUON, EVTColContainer::muons, EVTColContainer::PFTAU, EVTColContainer::pfTaus, EVTColContainer::PHOTON, and EVTColContainer::photons.

Referenced by analyze().

{
        if( objType == EVTColContainer::MUON )
        {
                for(size_t i = 0; i < cols->muons->size(); i++)
                {
                        if(_recMuonSelector->operator()(cols->muons->at(i)))
                        {
                                matches->push_back(MatchStruct(&cols->muons->at(i),objType));
                        }
                }
        }
        else if( objType == EVTColContainer::ELEC )
        {
                for(size_t i = 0; i < cols->electrons->size(); i++)
                {
                        if(_recElecSelector->operator()(cols->electrons->at(i)))
                        {
                                matches->push_back(MatchStruct(&cols->electrons->at(i),objType));
                        }
                }
        }
        else if( objType == EVTColContainer::PHOTON )
        {
                for(size_t i = 0; i < cols->photons->size(); i++)
                {
                        if(_recPhotonSelector->operator()(cols->photons->at(i)))
                        {
                                matches->push_back(MatchStruct(&cols->photons->at(i),objType));
                        }
                }
        }
        else if( objType == EVTColContainer::CALOMET )
        {
                for(size_t i = 0; i < cols->caloMETs->size(); i++)
                {
                        if(_recCaloMETSelector->operator()(cols->caloMETs->at(i)))
                        {
                                matches->push_back(MatchStruct(&cols->caloMETs->at(i),objType));
                        }
                }
        }
        else if( objType == EVTColContainer::PFTAU )
        {
                for(size_t i = 0; i < cols->pfTaus->size(); i++)
                {
                        if(_recPFTauSelector->operator()(cols->pfTaus->at(i)))
                        {
                                matches->push_back(MatchStruct(&cols->pfTaus->at(i),objType));
                        }
                }
        }
        /*else if( objType == EVTColContainer::TRACK )
        {
                for(size_t i = 0; i < cols->tracks->size(); i++)
                {
                        if(_recTrackSelector->operator()(cols->tracks->at(i)))
                        {
                                matches->push_back(MatchStruct(&cols->tracks->at(i),objType));
                        }
                }
        }*/
        /*
        else FIXME: Control errores
        {
        }
        */
}

Member Data Documentation

std::string HLTHiggsSubAnalysis::_analysisname [private]

Definition at line 89 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun(), and bookobjects().

Definition at line 133 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and beginRun().

std::map<unsigned int,double> HLTHiggsSubAnalysis::_cutMaxEta [private]

Definition at line 115 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis().

std::map<unsigned int,double> HLTHiggsSubAnalysis::_cutMinPt [private]

Definition at line 114 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis().

std::map<unsigned int,unsigned int> HLTHiggsSubAnalysis::_cutMotherId [private]

Definition at line 116 of file HLTHiggsSubAnalysis.h.

std::map<unsigned int,std::vector<double> > HLTHiggsSubAnalysis::_cutsDr [private]

Definition at line 117 of file HLTHiggsSubAnalysis.h.

Definition at line 137 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun(), bookHist(), and HLTHiggsSubAnalysis().

std::map<std::string, MonitorElement *> HLTHiggsSubAnalysis::_elements [private]

Definition at line 138 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist(), and fillHist().

std::map<unsigned int,std::string> HLTHiggsSubAnalysis::_genCut [private]

gen/rec objects cuts

Definition at line 119 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

Definition at line 106 of file HLTHiggsSubAnalysis.h.

Referenced by initobjects().

The concrete String selectors (use the string cuts introduced via the config python)

Definition at line 124 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), bookobjects(), and ~HLTHiggsSubAnalysis().

Definition at line 135 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

std::set<std::string> HLTHiggsSubAnalysis::_hltPaths [private]

the hlt paths found in the hltConfig

Definition at line 99 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

std::vector<std::string> HLTHiggsSubAnalysis::_hltPathsToCheck [private]

the hlt paths with regular expressions

Definition at line 97 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun(), and HLTHiggsSubAnalysis().

std::string HLTHiggsSubAnalysis::_hltProcessName [private]

Definition at line 94 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun(), and initobjects().

unsigned int HLTHiggsSubAnalysis::_minCandidates [private]

The minimum number of reco/gen candidates needed by the analysis.

Definition at line 92 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

std::vector<double> HLTHiggsSubAnalysis::_parametersEta [private]

Some kinematical parameters.

Definition at line 110 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist().

std::vector<double> HLTHiggsSubAnalysis::_parametersPhi [private]

Definition at line 111 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist().

std::vector<double> HLTHiggsSubAnalysis::_parametersTurnOn [private]

Definition at line 112 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist().

Definition at line 87 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

Definition at line 127 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

std::map<unsigned int,std::string> HLTHiggsSubAnalysis::_recCut [private]

Definition at line 120 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis(), and InitSelector().

Definition at line 126 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

std::map<unsigned int,std::string> HLTHiggsSubAnalysis::_recLabels [private]

Definition at line 125 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

Definition at line 128 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

Definition at line 129 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

Definition at line 130 of file HLTHiggsSubAnalysis.h.

Referenced by ~HLTHiggsSubAnalysis().

std::map<std::string,std::string> HLTHiggsSubAnalysis::_shortpath2long [private]

Relation between the short version of a path.

Definition at line 102 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and beginRun().