CMS 3D CMS Logo

Public Member Functions | Private Attributes

MuonAnalyzer Class Reference

#include <MuonAnalyzer.h>

Inheritance diagram for MuonAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 Get the analysis.
void beginJob (void)
 Inizialize parameters for histo binning.
void beginRun (const edm::Run &, const edm::EventSetup &)
void endJob (void)
 Save the histos.
 MuonAnalyzer (const edm::ParameterSet &)
 Constructor.
virtual ~MuonAnalyzer ()
 Destructor.

Private Attributes

std::string metname
edm::ParameterSet parameters
DQMStoretheDbe
DiMuonHistogramstheDiMuonHistograms
bool theDiMuonHistogramsFlag
EfficiencyAnalyzertheEfficiencyAnalyzer
bool theEfficiencyAnalyzerFlag
SegmentTrackAnalyzertheGlbMuonSegmentsAnalyzer
edm::InputTag theGlbMuTrackCollectionLabel
MuonEnergyDepositAnalyzertheMuEnergyAnalyzer
bool theMuEnergyAnalyzerFlag
edm::InputTag theMuonCollectionLabel
MuonKinVsEtaAnalyzertheMuonKinVsEtaAnalyzer
bool theMuonKinVsEtaAnalyzerFlag
MuonRecoAnalyzertheMuonRecoAnalyzer
bool theMuonRecoAnalyzerFlag
MuonRecoOneHLTtheMuonRecoOneHLTAnalyzer
bool theMuonRecoOneHLTAnalyzerFlag
bool theMuonSegmentsAnalyzerFlag
MuonSeedsAnalyzertheSeedsAnalyzer
bool theSeedsAnalyzerFlag
edm::InputTag theSeedsCollectionLabel
MuonServiceProxytheService
SegmentTrackAnalyzertheStaMuonSegmentsAnalyzer
edm::InputTag theStaMuTrackCollectionLabel
edm::InputTag theTriggerResultsLabel

Detailed Description

DQM muon analysis monitoring

Date:
2011/11/01 11:40:13
Revision:
1.19
Author:
G. Mila - INFN Torino

Definition at line 40 of file MuonAnalyzer.h.


Constructor & Destructor Documentation

MuonAnalyzer::MuonAnalyzer ( const edm::ParameterSet pSet)

Constructor.

Definition at line 43 of file MuonAnalyzer.cc.

References edm::ParameterSet::addParameter(), MuonServiceProxy_cff::MuonServiceProxy, and Parameters::parameters.

                                                      {
  parameters = pSet;
  
  // the services
  theService = new MuonServiceProxy(parameters.getParameter<ParameterSet>("ServiceParameters"));
  
  // Muon Collection Label
  theMuonCollectionLabel       = parameters.getParameter<edm::InputTag>("MuonCollection");
  theGlbMuTrackCollectionLabel = parameters.getParameter<edm::InputTag>("GlobalMuTrackCollection");
  theStaMuTrackCollectionLabel = parameters.getParameter<edm::InputTag>("STAMuTrackCollection");
  theSeedsCollectionLabel      = parameters.getParameter<edm::InputTag>("SeedCollection");
  theTriggerResultsLabel       = parameters.getParameter<edm::InputTag>("TriggerResultsLabel");
 
  // Analyzer Flags - define wheter or not run a submodule
  theMuEnergyAnalyzerFlag       = parameters.getUntrackedParameter<bool>("DoMuonEnergyAnalysis"   ,true);
  theSeedsAnalyzerFlag          = parameters.getUntrackedParameter<bool>("DoMuonSeedAnalysis"     ,true);
  theMuonRecoAnalyzerFlag       = parameters.getUntrackedParameter<bool>("DoMuonRecoAnalysis"     ,true);
  theMuonSegmentsAnalyzerFlag   = parameters.getUntrackedParameter<bool>("DoTrackSegmentsAnalysis",true);
  theMuonKinVsEtaAnalyzerFlag   = parameters.getUntrackedParameter<bool>("DoMuonKinVsEtaAnalysis" ,true);
  theDiMuonHistogramsFlag       = parameters.getUntrackedParameter<bool>("DoDiMuonHistograms"     ,true);
  theMuonRecoOneHLTAnalyzerFlag = parameters.getUntrackedParameter<bool>("DoMuonRecoOneHLT"       ,true);
  theEfficiencyAnalyzerFlag     = parameters.getUntrackedParameter<bool>("DoEfficiencyAnalysis"   ,true);
  
  // If the previous are defined... create the analyzer class 
  if(theMuEnergyAnalyzerFlag) 
    theMuEnergyAnalyzer = new MuonEnergyDepositAnalyzer(parameters.getParameter<ParameterSet>("muonEnergyAnalysis"), theService);
  if(theSeedsAnalyzerFlag)
    theSeedsAnalyzer = new MuonSeedsAnalyzer(parameters.getParameter<ParameterSet>("seedsAnalysis"), theService);
  if(theMuonRecoAnalyzerFlag)
    theMuonRecoAnalyzer = new MuonRecoAnalyzer(parameters.getParameter<ParameterSet>("muonRecoAnalysis"), theService);
  if(theMuonRecoAnalyzerFlag)
    theMuonKinVsEtaAnalyzer = new MuonKinVsEtaAnalyzer(parameters.getParameter<ParameterSet>("muonKinVsEtaAnalysis"), theService);
  if(theDiMuonHistogramsFlag)
    theDiMuonHistograms = new DiMuonHistograms(parameters.getParameter<ParameterSet>("dimuonHistograms"), theService);
  if(theMuonSegmentsAnalyzerFlag){
    // analysis on glb muon tracks
    ParameterSet  trackGlbMuAnalysisParameters = parameters.getParameter<ParameterSet>("trackSegmentsAnalysis");
    trackGlbMuAnalysisParameters.addParameter<edm::InputTag>("MuTrackCollection",theGlbMuTrackCollectionLabel);
    theGlbMuonSegmentsAnalyzer = new SegmentTrackAnalyzer(trackGlbMuAnalysisParameters, theService);
    // analysis on sta muon tracks
    ParameterSet  trackStaMuAnalysisParameters = parameters.getParameter<ParameterSet>("trackSegmentsAnalysis");
    trackStaMuAnalysisParameters.addParameter<edm::InputTag>("MuTrackCollection",theStaMuTrackCollectionLabel);
    theStaMuonSegmentsAnalyzer = new SegmentTrackAnalyzer(trackStaMuAnalysisParameters, theService);
  }
  if (theMuonRecoOneHLTAnalyzerFlag)
    theMuonRecoOneHLTAnalyzer = new MuonRecoOneHLT(parameters.getParameter<ParameterSet>("muonRecoOneHLTAnalysis"),theService);
  if(theEfficiencyAnalyzerFlag)
    theEfficiencyAnalyzer = new EfficiencyAnalyzer(parameters.getParameter<ParameterSet>("efficiencyAnalysis"), theService);
}
MuonAnalyzer::~MuonAnalyzer ( ) [virtual]

Member Function Documentation

void MuonAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Get the analysis.

Implements edm::EDAnalyzer.

Definition at line 128 of file MuonAnalyzer.cc.

References edm::Event::getByLabel(), edm::HandleBase::isValid(), LogTrace, metname, patZpeak::muons, muonTagProbeFilters_cff::staTracks, and patRefSel_triggerSelection_cff::triggerResults.

                                                                              {
  LogTrace(metname)<<"[MuonAnalyzer] Analysis of event # ";
  theService->update(iSetup);
  
  // Take the STA muon container
  edm::Handle<reco::MuonCollection> muons;
  iEvent.getByLabel(theMuonCollectionLabel,muons);

  edm::Handle<TriggerResults> triggerResults;
  iEvent.getByLabel(theTriggerResultsLabel, triggerResults);
  
  if(muons.isValid()){
    for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu!=muons->end(); ++recoMu){
      if(theMuEnergyAnalyzerFlag){
        LogTrace(metname)<<"[MuonAnalyzer] Call to the muon energy analyzer";
        theMuEnergyAnalyzer->analyze(iEvent, iSetup, *recoMu);
      }
      if(theMuonRecoAnalyzerFlag){
        LogTrace(metname)<<"[MuonAnalyzer] Call to the muon reco analyzer";
        theMuonRecoAnalyzer->analyze(iEvent, iSetup, *recoMu);
      }
      if(theMuonKinVsEtaAnalyzerFlag){
        LogTrace(metname)<<"[MuonAnalyzer] Call to the muon KinVsEta analyzer";
        theMuonKinVsEtaAnalyzer->analyze(iEvent, iSetup, *recoMu);
      }
      //      if(theMuonRecoOneHLTAnalyzerFlag) {
      //        LogTrace(metname)<<"[MuonAnalyzer] Call to the muon reco One HLT analyzer";
        //      theMuonRecoOneHLTAnalyzer->analyze(iEvent, iSetup, *recoMu, *triggerResults);
      //        theMuonRecoOneHLTAnalyzer->analyze(iEvent, iSetup, *triggerResults);
      //      }
    }
    if(theMuonRecoOneHLTAnalyzerFlag) {
      LogTrace(metname)<<"[MuonAnalyzer] Call to the muon reco One HLT analyzer";
      theMuonRecoOneHLTAnalyzer->analyze(iEvent, iSetup, *triggerResults);
    }
    if (theEfficiencyAnalyzerFlag){
      LogTrace(metname)<<"[MuonAnalyzer] Call to the efficiency analyzer";
      theEfficiencyAnalyzer->analyze(iEvent,iSetup);
    }
    if (theDiMuonHistogramsFlag){
      LogTrace(metname)<<"[MuonAnalyzer] Call to the dimuon analyzer";
      theDiMuonHistograms->analyze(iEvent,iSetup);
    }
  }
  
   // Take the track containers
   Handle<reco::TrackCollection> glbTracks;
   iEvent.getByLabel(theGlbMuTrackCollectionLabel,glbTracks);
   Handle<reco::TrackCollection> staTracks;
   iEvent.getByLabel(theStaMuTrackCollectionLabel,staTracks);

   if(glbTracks.isValid()){
     for (reco::TrackCollection::const_iterator recoTrack = glbTracks->begin(); recoTrack!=glbTracks->end(); ++recoTrack){
       if(theMuonSegmentsAnalyzerFlag){
         LogTrace(metname)<<"[SegmentsAnalyzer] Call to the track segments analyzer for glb muons";
         theGlbMuonSegmentsAnalyzer->analyze(iEvent, iSetup, *recoTrack);
       }
     }
   }
   if(staTracks.isValid()){
     for (reco::TrackCollection::const_iterator recoTrack = staTracks->begin(); recoTrack!=staTracks->end(); ++recoTrack){
       if(theMuonSegmentsAnalyzerFlag){
         LogTrace(metname)<<"[SegmentsAnalyzer] Call to the track segments analyzer for sta muons";
         theStaMuonSegmentsAnalyzer->analyze(iEvent, iSetup, *recoTrack);
       }
     }
   }
   
   
     

   // Take the seeds container
   edm::Handle<TrajectorySeedCollection> seeds;
   iEvent.getByLabel(theSeedsCollectionLabel, seeds);
   if(seeds.isValid()){
     for(TrajectorySeedCollection::const_iterator seed = seeds->begin(); seed != seeds->end(); ++seed){
       if(theSeedsAnalyzerFlag){
         LogTrace(metname)<<"[MuonAnalyzer] Call to the seeds analyzer";
         theSeedsAnalyzer->analyze(iEvent, iSetup, *seed);
       }
     }
   }

}
void MuonAnalyzer::beginJob ( void  ) [virtual]
void MuonAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 108 of file MuonAnalyzer.cc.

void MuonAnalyzer::endJob ( void  ) [virtual]

Save the histos.

Reimplemented from edm::EDAnalyzer.

Definition at line 214 of file MuonAnalyzer.cc.

References LogTrace, metname, dumpDBToFile_GT_ttrig_cfg::outputFileName, and Parameters::parameters.

                              {
  LogTrace(metname)<<"[MuonAnalyzer] Saving the histos";
  bool outputMEsInRootFile = parameters.getParameter<bool>("OutputMEsInRootFile");
  std::string outputFileName = parameters.getParameter<std::string>("OutputFileName");
  if(outputMEsInRootFile){
    theDbe->showDirStructure();
    theDbe->save(outputFileName);
  }
}

Member Data Documentation

std::string MuonAnalyzer::metname [private]

Definition at line 65 of file MuonAnalyzer.h.

Definition at line 62 of file MuonAnalyzer.h.

Definition at line 61 of file MuonAnalyzer.h.

Definition at line 93 of file MuonAnalyzer.h.

Definition at line 82 of file MuonAnalyzer.h.

Definition at line 95 of file MuonAnalyzer.h.

Definition at line 84 of file MuonAnalyzer.h.

Definition at line 91 of file MuonAnalyzer.h.

Definition at line 70 of file MuonAnalyzer.h.

Definition at line 87 of file MuonAnalyzer.h.

Definition at line 77 of file MuonAnalyzer.h.

Definition at line 68 of file MuonAnalyzer.h.

Definition at line 90 of file MuonAnalyzer.h.

Definition at line 80 of file MuonAnalyzer.h.

Definition at line 89 of file MuonAnalyzer.h.

Definition at line 79 of file MuonAnalyzer.h.

Definition at line 94 of file MuonAnalyzer.h.

Definition at line 83 of file MuonAnalyzer.h.

Definition at line 81 of file MuonAnalyzer.h.

Definition at line 88 of file MuonAnalyzer.h.

Definition at line 78 of file MuonAnalyzer.h.

Definition at line 74 of file MuonAnalyzer.h.

Definition at line 63 of file MuonAnalyzer.h.

Definition at line 92 of file MuonAnalyzer.h.

Definition at line 72 of file MuonAnalyzer.h.

Definition at line 75 of file MuonAnalyzer.h.