CMS 3D CMS Logo

Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes

HLTMuonMatchAndPlot Class Reference

#include <HLTMuonMatchAndPlot.h>

Inheritance diagram for HLTMuonMatchAndPlot:
HLTMuonBPAG HLTTopPlotter

List of all members.

Classes

struct  HltFakeStruct
struct  MatchStruct

Public Member Functions

virtual void analyze (const edm::Event &iEvent)
virtual void begin ()
virtual MonitorElementbookIt (TString name, TString title, std::vector< double >)
virtual MonitorElementbookIt (TString name, TString title, int nbins, float *xBinLowEdges)
TString calcHistoSuffix (std::string moduleName)
virtual void endRun (const edm::Run &r, const edm::EventSetup &c)
virtual void fillPlots (std::vector< MatchStruct > &myRecMatches, std::vector< std::vector< HltFakeStruct > > &myHltFakeCands)
virtual void finish ()
 HLTMuonMatchAndPlot (const edm::ParameterSet &pset, std::string triggerName, std::vector< std::string > moduleNames, MuonSelectionStruct inputSelection, std::string customName, std::vector< std::string > validTriggers, const edm::Run &currentRun, const edm::EventSetup &currentEventSetup)
 Constructor.
virtual bool selectAndMatchMuons (const edm::Event &iEvent, std::vector< MatchStruct > &myRecMatches, std::vector< std::vector< HltFakeStruct > > &myHltFakeCands)
bool selectAndMatchMuons (const edm::Event &iEvent, std::vector< MatchStruct > &myRecMatches, std::vector< std::vector< HltFakeStruct > > &myHltFakeCands, MuonSelectionStruct muonSelection)
virtual ~HLTMuonMatchAndPlot ()

Public Attributes

std::vector< std::vector
< HltFakeStruct > > 
hltFakeCands
std::vector< MatchStructrecMatches

Protected Member Functions

virtual bool applyTrackSelection (MuonSelectionStruct mySelection, reco::Muon candMuon)
virtual bool applyTriggerSelection (MuonSelectionStruct mySelection, const edm::Event &event)
int findGenMatch (double eta, double phi, double maxDeltaR, std::vector< MatchStruct > matches)
const reco::CandidatefindMother (const reco::Candidate *)
int findRecMatch (double eta, double phi, double maxdeltaR, std::vector< MatchStruct > matches)
void getAodTriggerObjectsForModule (edm::InputTag collectionTag, edm::Handle< trigger::TriggerEvent > aodTriggerEvent, trigger::TriggerObjectCollection trigObjs, std::vector< trigger::TriggerObject > &foundObjects, MuonSelectionStruct muonSelection)
reco::TrackRef getCandTrackRef (MuonSelectionStruct mySelection, reco::Muon candMuon)
int getCharge (int pdgId)
void moveOverflow (MonitorElement *myElement)

Protected Attributes

std::vector< MonitorElement * > allHltCandEta
std::vector< MonitorElement * > allHltCandPhi
std::vector< MonitorElement * > allHltCandPt
reco::BeamSpot beamSpot
edm::InputTag BeamSpotInputTag
std::vector< MonitorElement * > booked1DMonitorElements
bool createStandAloneHistos
DQMStoredbe_
int eventNumber
std::vector< MonitorElement * > fakeHltCandEta
std::vector< MonitorElement * > fakeHltCandPhi
std::vector< MonitorElement * > fakeHltCandPt
bool foundBeamSpot
std::vector< MonitorElement * > hBeamSpotZ0Rec
std::vector< MonitorElement * > hChargeFlipMatched
std::vector< MonitorElement * > hDeltaRMatched
std::vector< MonitorElement * > hIsolationRec
std::string histoFileName
int HLT_PLOT_OFFSET
edm::InputTag HltAodInputTag
edm::InputTag HltRawInputTag
std::vector< MonitorElement * > hMatchedDeltaPhi
MonitorElementhNumObjects
MonitorElementhNumOrphansRec
std::vector< MonitorElement * > hPassCharge
std::vector< MonitorElement * > hPassD0BeamRec
std::vector< MonitorElement * > hPassD0Rec
std::vector< MonitorElement * > hPassEtaRec
std::vector< MonitorElement * > hPassExaclyOneMuonMaxPtRec
std::vector< MonitorElement * > hPassMatchPtRec
std::vector< MonitorElement * > hPassMaxPtRec
std::vector< MonitorElement * > hPassPhiRec
std::vector< MonitorElement * > hPassPtRec
std::vector< MonitorElement * > hPassPtRecExactlyOne
std::vector< MonitorElement * > hPassZ0BeamRec
std::vector< MonitorElement * > hPassZ0Rec
std::vector< MonitorElement * > hPhiVsEtaRec
std::vector< MonitorElement * > hResoEtaAodRec
std::vector< MonitorElement * > hResoPhiAodRec
std::vector< MonitorElement * > hResoPtAodRec
bool includeOverflow
bool isIsolatedPath
bool isL1Path
bool isL2Path
bool isL3Path
bool makeNtuple
std::string matchType
MonitorElementmeNumberOfEvents
MuonSelectionStruct mySelection
int numBinsInPtHisto
unsigned int numHltLabels
unsigned int numL1Cands
float ptBins [100]
std::vector< MonitorElement * > rawMatchHltCandEta
std::vector< MonitorElement * > rawMatchHltCandPhi
std::vector< MonitorElement * > rawMatchHltCandPt
edm::InputTag RecoMuonInputTag
bool requireL1SeedForHLTPaths
std::vector< std::string > selectedValidTriggers
std::string theAodL1Label
std::string theAodL2Label
std::vector< double > theChargeFlipParameters
std::vector< double > theChargeParameters
std::vector< double > theD0Parameters
std::vector< double > theDRParameters
std::vector< double > theEtaParameters
TFile * theFile
std::vector< std::string > theHltCollectionLabels
std::string theHltProcessName
std::vector< double > theIsolationParameters
std::string theL1CollectionLabel
double theL1DrCut
std::string theL1SeedModuleForHLTPath
double theL2DrCut
double theL3DrCut
double theMaxEtaCut
std::vector< double > theMaxPtParameters
double theMinPtCut
int theMotherParticleId
std::vector< double > theNSigmas
TNtuple * theNtuple
std::string theNtupleFileName
float theNtuplePars [100]
std::string theNtuplePath
unsigned int theNumberOfObjects
std::vector< double > thePhiEtaParameters2d
std::vector< double > thePhiParameters
std::vector< double > thePhiParameters0Pi
std::vector< double > thePtParameters
std::vector< double > theResParameters
std::string theTriggerName
std::vector< double > theZ0Parameters
edm::InputTag TriggerResultLabel
bool useAod
bool useFullDebugInformation
bool useMuonFromReco
bool useOldLabels

Static Protected Attributes

static const int NEG_CHARGE = -1
static const int POS_CHARGE = 1

Detailed Description

Get L1/HLT efficiency/rate plots Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLTOfflinePerformance

Date:
2010/07/21 04:23:22
Revision:
1.13
Author:
J. Slaunwhite, based on code from Jeff Klukas

Definition at line 98 of file HLTMuonMatchAndPlot.h.


Constructor & Destructor Documentation

HLTMuonMatchAndPlot::HLTMuonMatchAndPlot ( const edm::ParameterSet pset,
std::string  triggerName,
std::vector< std::string >  moduleNames,
MuonSelectionStruct  inputSelection,
std::string  customName,
std::vector< std::string >  validTriggers,
const edm::Run currentRun,
const edm::EventSetup currentEventSetup 
)

Constructor.

Definition at line 61 of file HLTMuonMatchAndPlot.cc.

References dbe_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), diJetCalib::histoFileName, HltComparatorCreateWorkflow::hltConfig, i, HLTConfigProvider::init(), LogTrace, module(), HLTConfigProvider::moduleType(), cmsCodeRules::cppFunctionSkipper::operator, jptDQMConfig_cff::ptBins, and DQMStore::setVerbose().

  :  mySelection(inputSelection), selectedValidTriggers(validTriggers)
{


  LogTrace ("HLTMuonVal") << "\n\n Inside HLTMuonMatchAndPlot Constructor";
  LogTrace ("HLTMuonVal") << "The trigger name is " << triggerName
                          << " and the module names are listed";

  for (vector<string>::iterator iMod = moduleNames.begin();
       iMod != moduleNames.end(); iMod++){
    LogTrace ("HLTMuonVal") << (*iMod);
  }
    
  
  theHltProcessName  = pset.getParameter<string>("HltProcessName");

  LogTrace ("HLTMuonVal") << "HLTMuonMatchAndPlot: Constructor: Initializing HLTConfigProvider with HLT process name: " << theHltProcessName << endl;

  
  HLTConfigProvider hltConfig;
  bool hltConfigChanged;
  bool hltConfigInitSuccess = hltConfig.init(currentRun, currentEventSetup, theHltProcessName, hltConfigChanged);

  theNumberOfObjects = ( TString(triggerName).Contains("Double") ) ? 2 : 1;
  theTriggerName     = triggerName;
    
  useAod         = true;

  requireL1SeedForHLTPaths = pset.getUntrackedParameter<bool>("RequireRecoToMatchL1Seed", false);

  matchType = pset.getUntrackedParameter<string>("matchType");

  // JMS Added a method to make standalone histogram output
  createStandAloneHistos = pset.getUntrackedParameter<bool>("createStandAloneHistos");
  histoFileName = pset.getUntrackedParameter<string> ("histoFileName");

  theHltCollectionLabels.clear();

  // make these config file inputs eventually
  useOldLabels = false;
  useFullDebugInformation = false;

  if (useFullDebugInformation) {
    // if you're filling all plots
    // then you'll have (All, L1, HLT)
    HLT_PLOT_OFFSET = 2;
  } else {
    // if you're only filling
    // the plots for one trigger
    // then have (All, HLT)
    HLT_PLOT_OFFSET = 1;
  }

  isL1Path = false;
  isL2Path = false;
  isL3Path = true;

  if (TString(triggerName).Contains("L1")) {
    isL1Path = true;
    isL3Path = false;
  }

  if (TString(triggerName).Contains("L2")) {
    isL2Path = true;
    isL3Path = false;
  }
  if (TString(triggerName).Contains("L3")) {
    isL3Path = true;
    isL3Path = false;
  }

    
  
  LogTrace ("HLTMuonVal") << "Parsing Module names... useOldLabels? "
                          << useOldLabels
                          << ",  useFullDebugInformation? "
                          << useFullDebugInformation
                          << endl;
                          
  
  TPRegexp l1Regexp("L1.*Filtered");
  TPRegexp l2Regexp("L2.*Filtered");

  string theLastHltFilter = "";

  theL1SeedModuleForHLTPath = "" ;


  for ( size_t i = 0; i < moduleNames.size(); i++ ) {
    string module = moduleNames[i];

    if (hltConfigInitSuccess) {
      LogTrace ("HLTMuonVal") << "Considering Module named    "
                              << module
                              << "      which has type =    "
                              << hltConfig.moduleType(module);

      if ( hltConfig.moduleType(module) == "HLTLevel1GTSeed" ) {
        LogTrace ("HLTMuonVal") << "Module = " << module
                                <<  " is a HLTLevel1GTSeed!!"
                                << endl
                                << "Storing it as L1Seed"
                                << endl;
        theL1SeedModuleForHLTPath = module;
      }
    }

    
    if ( TString(module).Contains(l1Regexp) ) {
      // this will be used to look up info
      // in the AOD information
      theL1CollectionLabel = module;
      LogTrace ("HLTMuonVal") << "... module is L1 collection";

      
    } else if ( TString(module).Contains(l2Regexp) ) {
      // this is a l2 module, only consider it if the trigger
      // is an L2 passthrough or if we want to use debug trigger info

      if (useFullDebugInformation) {
        theHltCollectionLabels.push_back(module);
        LogTrace ("HLTMuonVal") << "... module added to HLT collection list";
      } else if (isL2Path) {
        LogTrace ("HLTMuonVal") << "... module saved for later";
        theLastHltFilter = module;
      }

      
    } else if (TString(module).Contains("Filtered") ) {
      // must be L3 filtered here
      // potential to have Pre vs Iso filtered
      // In AOD, I think there is only information
      // for the *final* filter

      if (useFullDebugInformation) {
        LogTrace ("HLTMuonVal") << "... module added to HLT collection list" << endl;
        theHltCollectionLabels.push_back(module);        
      } else if (isL3Path) {
        LogTrace ("HLTMuonVal") << "... module saved for later" << endl;
        theLastHltFilter = module;
      }      

    }
  }

  if (!useFullDebugInformation && theLastHltFilter != "" ) {
    
    LogTrace("HLTMuonVal") << "\nAfter running over labels, we find hlt label coll size = "
                           << theHltCollectionLabels.size() << endl
                           << "\n\nwill only use the final hlt label = "
                           << theLastHltFilter << endl;

    theHltCollectionLabels.push_back (theLastHltFilter);
  }
  

  numHltLabels   = theHltCollectionLabels.size();
  isIsolatedPath = ( numHltLabels == 4 ) ? true : false;

  // -- Right now the new way is to hard-code it
  // -- this uses the most generic kind of muon
  // -- selectors will handle other cuts
  //theRecoLabel = "muons";

  RecoMuonInputTag =  pset.getParameter<edm::InputTag>("RecoMuonInputTag");  
  BeamSpotInputTag = pset.getParameter<edm::InputTag>("BeamSpotInputTag");
  HltRawInputTag  = pset.getParameter<edm::InputTag>("HltRawInputTag");
  HltAodInputTag = pset.getParameter<edm::InputTag>("HltAodInputTag");
  
  TriggerResultLabel = pset.getParameter<edm::InputTag>("TriggerResultLabel");  
  
  //useMuonFromGenerator = false; // = ( theGenLabel  == "" ) ? false : true;
  useMuonFromReco      = true; // = ( theRecoLabel == "" ) ? false : true;

  //define default parameters so that you don't crash

  vector <double> etaDefault;
  etaDefault.push_back(15);
  etaDefault.push_back(-2.1);
  etaDefault.push_back(2.1);

  theEtaParameters   = pset.getUntrackedParameter< vector<double> >("EtaParameters", etaDefault);
  
  vector <double> phiDefault;
  phiDefault.push_back(15);
  phiDefault.push_back(-3.2);
  phiDefault.push_back(3.2);

  thePhiParameters   = pset.getUntrackedParameter< vector<double> >("PhiParameters", phiDefault);

  // leave this vector of size 0
  vector <double> ptDefault;

  //  pt parameters are a different story
  //  it's a vector of doubles but it unpacked
  //  as bin low edges
  thePtParameters    = pset.getUntrackedParameter< vector<double> >("PtParameters", ptDefault);

  
  vector <double> resDefault;
  resDefault.push_back(10);
  resDefault.push_back(-0.1);
  resDefault.push_back(0.1);
  theResParameters = pset.getUntrackedParameter < vector<double> >("ResParameters", resDefault);  

  vector <double> d0Default;
  d0Default.push_back(10);
  d0Default.push_back(-2.0);
  d0Default.push_back(2.0);

  theD0Parameters = pset.getUntrackedParameter <vector<double> > ("D0Parameters", d0Default);

  vector <double> z0Default;
  z0Default.push_back(10);
  z0Default.push_back(-25);
  z0Default.push_back(25);

  theZ0Parameters = pset.getUntrackedParameter < vector<double> > ("Z0Parameters", z0Default);

  
  
  int numPtBinEdge = 0;
  if ( thePtParameters.size() > 100) {
    LogInfo ("HLTMuonVal") << "Warning!!! You specified a list of pt bin edges that is > 100 bins"
                           << "This is too many bins!! Truncating the list!!! " << endl;
    numPtBinEdge = 100;
  } else if (thePtParameters.size() < 1) {

    numPtBinEdge = 5;
    numBinsInPtHisto = numPtBinEdge - 1;
    ptBins[0] = 0;
    ptBins[1] = 20;
    ptBins[2] = 50;
    ptBins[3] = 100;
    ptBins[4] = 150;
    
  } else {
    numPtBinEdge = thePtParameters.size();
    // the number of bins in the histo is one
    // less than the number of edges
    numBinsInPtHisto = numPtBinEdge - 1;
  
    for (int iBin = 0; iBin < numPtBinEdge; iBin++){
      ptBins[iBin] = (float) thePtParameters[iBin];
      //LogTrace ("HLTMuonVal") << the 
    }

  }


  
  // Duplicate the pt parameters for some 2D histos
//   for(int i =0; i < 2; i++){
//     for (std::vector<double>::const_iterator iNum = theMaxPtParameters.begin();
//          iNum != theMaxPtParameters.end();
//          iNum++){
      
//       // if this is the # of bins, then
//       // halve the number of bins.
//       if (iNum == theMaxPtParameters.begin()){
//         theMaxPtParameters2d.push_back(floor((*iNum)/2));
//       } else {
//         theMaxPtParameters2d.push_back((*iNum));
//       }
//     }
//   }

//   // Duplicate the eta parameters for some 2D histos
//   for(int i =0; i < 2; i++){
//     for (std::vector<double>::const_iterator iNum = theEtaParameters.begin();
//          iNum != theEtaParameters.end();
//          iNum++){
//       // if this is the nBins param, halve it
//       if (iNum ==  theEtaParameters.begin()){
//         theEtaParameters2d.push_back(floor((*iNum)/2));      
//       } else {
//         theEtaParameters2d.push_back(*iNum);                   
//       }
      
//       // also fill the eta/phi plot parameters
//       // but don't worry about doubleing bins
//       // if (i < 1){
//       //         if (iNum ==  theEtaParameters.begin()){
//       //           thePhiEtaParameters2d.push_back(floor((*iNum)/2));      
//       //         } else {
//       //           thePhiEtaParameters2d.push_back(*iNum);      
      
//       //         } 
      
//       //       }
//     }
//   }

//   // Duplicate the pt parameters for some 2D histos
//   for(int i =0; i < 2; i++){
//     for (std::vector<double>::const_iterator iNum = thePhiParameters.begin();
//          iNum != thePhiParameters.end();
//          iNum++){

//       if (iNum == thePhiParameters.begin()) {
//         thePhiParameters2d.push_back(floor((*iNum)/2));
//       } else {
//         thePhiParameters2d.push_back(*iNum);
//       }

//       //       if (i < 1){
      
//       //         // if (iNum ==  theEtaParameters.begin()){
//       //         //           thePhiEtaParameters2d.push_back(floor((*iNum)/2));      
//       //         //         } else {
//       //         //           thePhiEtaParameters2d.push_back(*iNum);      
      
//       //         //         } 
      
//       //       }
//     }
//   }



  //=======================================



  theL1DrCut     = pset.getUntrackedParameter<double>("L1DrCut", 0.4);
  theL2DrCut     = pset.getUntrackedParameter<double>("L2DrCut", 0.1);
  theL3DrCut     = pset.getUntrackedParameter<double>("L3DrCut", 0.05);

  
  //==========================================
  // Hard-coded parameters
  // Make modifibly from script later
  //==========================================


  // put in the phi parameters
  thePhiEtaParameters2d.push_back(10);
  thePhiEtaParameters2d.push_back(-2.2);
  thePhiEtaParameters2d.push_back(2.2);

  thePhiEtaParameters2d.push_back(10);
  thePhiEtaParameters2d.push_back(-3.15);
  thePhiEtaParameters2d.push_back(3.15);
  
  
  // theD0Parameters.push_back(25);
  // theD0Parameters.push_back(-50.0);
  // theD0Parameters.push_back(50.0);
  
  //   theZ0Parameters.push_back(25);
  //   theZ0Parameters.push_back(-100);
  //   theZ0Parameters.push_back(100);

  theChargeParameters.push_back(3);
  theChargeParameters.push_back(-1.5);
  theChargeParameters.push_back(1.5);

  theDRParameters.push_back(10);
  theDRParameters.push_back(0.0);
  theDRParameters.push_back(theL2DrCut);

  theChargeFlipParameters.push_back(2);
  theChargeFlipParameters.push_back(-1.0);
  theChargeFlipParameters.push_back(1.0);
  theChargeFlipParameters.push_back(2);
  theChargeFlipParameters.push_back(-1.0);
  theChargeFlipParameters.push_back(1.0);

  theIsolationParameters.push_back(10);
  theIsolationParameters.push_back(0.0);
  theIsolationParameters.push_back(1.0);

  thePhiParameters0Pi.push_back(10);
  thePhiParameters0Pi.push_back(0);
  thePhiParameters0Pi.push_back(3.2);

  // theDeltaPhiVsPhiParameters.push_back(50);
  //   theDeltaPhiVsPhiParameters.push_back(-3.15);
  //   theDeltaPhiVsPhiParameters.push_back(3.15);
  //   theDeltaPhiVsPhiParameters.push_back(50);
  //   theDeltaPhiVsPhiParameters.push_back(0);
  //   theDeltaPhiVsPhiParameters.push_back(3.2);

//   theDeltaPhiVsZ0Parameters.push_back(theZ0Parameters[0]);
//   theDeltaPhiVsZ0Parameters.push_back(theZ0Parameters[1]);
//   theDeltaPhiVsZ0Parameters.push_back(theZ0Parameters[2]);
//   theDeltaPhiVsZ0Parameters.push_back(50);
//   theDeltaPhiVsZ0Parameters.push_back(0);
//   theDeltaPhiVsZ0Parameters.push_back(3.2);

//   theDeltaPhiVsD0Parameters.push_back(theD0Parameters[0]);
//   theDeltaPhiVsD0Parameters.push_back(theD0Parameters[1]);
//   theDeltaPhiVsD0Parameters.push_back(theD0Parameters[2]);
//   theDeltaPhiVsD0Parameters.push_back(50);
//   theDeltaPhiVsD0Parameters.push_back(0);
//   theDeltaPhiVsD0Parameters.push_back(3.2);
      
  

  
  dbe_ = 0 ;
  if ( pset.getUntrackedParameter<bool>("DQMStore", false) ) {
    dbe_ = Service<DQMStore>().operator->();
    dbe_->setVerbose(0);
  }

  if (!dbe_) {

    LogInfo ("HLTMuonVal") << "===WARNING=== Couldn't find DQMStore..." 
                           << "Won't be able to book ME's..."
                           << "The rest of the run will probably not be useful..."
                           << endl;

  }

  eventNumber = 0;

  LogTrace ("HLTMuonVal") << "exiting constructor\n\n";

}
virtual HLTMuonMatchAndPlot::~HLTMuonMatchAndPlot ( ) [inline, virtual]

Definition at line 171 of file HLTMuonMatchAndPlot.h.

{} ;

Member Function Documentation

void HLTMuonMatchAndPlot::analyze ( const edm::Event iEvent) [virtual]

Reimplemented in HLTMuonBPAG, and HLTTopPlotter.

Definition at line 523 of file HLTMuonMatchAndPlot.cc.

References LogTrace.

{

  LogTrace( "HLTMuonVal" ) << "\n\nIn analyze for trigger path " << 
    theTriggerName << ", Event:" << eventNumber <<"\n\n\n";

  
  // Call the selection method with the default selection
  bool validSelection = selectAndMatchMuons (iEvent, recMatches, hltFakeCands, mySelection);
  if (validSelection) fillPlots (recMatches, hltFakeCands);

  eventNumber++;
  
}// end analyze
bool HLTMuonMatchAndPlot::applyTrackSelection ( MuonSelectionStruct  mySelection,
reco::Muon  candMuon 
) [protected, virtual]

Definition at line 1658 of file HLTMuonMatchAndPlot.cc.

References debug_cff::d0, MuonSelectionStruct::d0cut, edm::Ref< C, T, F >::isNonnull(), LogTrace, MuonSelectionStruct::trackCollection, and MuonSelectionStruct::z0cut.

                                                                                             {

  LogTrace ("HLTMuonVal") << "Applying track selection to your muon"
                          << endl;
  // get the track 
  // you should have specified the track using the collection names
  TrackRef theMuonTrack = getCandTrackRef (mySelection, candMuon);

  bool passedSelection = false;
  
  if ( theMuonTrack.isNonnull() ) {
     double d0 = theMuonTrack->d0();
     double z0 = theMuonTrack->dz();


     LogTrace ("HLTMuonVal") << "d0 = " << d0
                             << ", d0 cut = " << mySelection.d0cut << endl
                             << "z0 = " << z0
                             << ", z0 cut = " << mySelection.z0cut << endl;
                             
                             
     
     if (fabs(d0) < mySelection.d0cut &&
         fabs(z0) < mySelection.z0cut ) {
       passedSelection = true;
     }
  } else {
    LogTrace ("HLTMuonVal") << "This event didn't have a valid track of type "
                            << mySelection.trackCollection;            
  }

  return passedSelection;
  
}
bool HLTMuonMatchAndPlot::applyTriggerSelection ( MuonSelectionStruct  mySelection,
const edm::Event event 
) [protected, virtual]

Definition at line 1693 of file HLTMuonMatchAndPlot.cc.

References edm::HandleBase::isValid(), LogTrace, MuonSelectionStruct::requiredTriggers, and findQualityFiles::size.

                                                                                                    {

  bool passedAnyTrigger = false;
  //  Look and your event selection criteria
  //  if you have a vector of size zero
  //  or if you have a vector with just an empty string
  //  then you should just skip this selection and return true

  LogTrace ("HLTMuonVal") << "Checking to see if you have non-empty triggers to match"
                          << endl;
  
  if (mySelection.requiredTriggers.size() < 1)
    return true;

  vector<string>::const_iterator iTargetTrig;

  bool everythingIsEmpty = true;
  for ( iTargetTrig = mySelection.requiredTriggers.begin();
        iTargetTrig != mySelection.requiredTriggers.end();
        iTargetTrig ++ ) {

    if ( (*iTargetTrig) != "" ) {
      everythingIsEmpty = false;
    }
    
  }

  if (everythingIsEmpty) {
    LogTrace ("HLTMuonVal") << "Only empty triggers, skipping match";
    return true;
  }

  //  At this point, you have a true trigger requirement
  //  You need to check the trigger results
  //  0. Get the trigger resutls 
  //  1. Loop over list of target triggers 
  //  2. See if the target is valid according to HLTConfig
  //  3. If it is, check to see that it fired
  //
  //  Potential optimization - store the trigger index
  //  rather than doing the match for each event


  // Get the trigger results
  
  Handle<TriggerResults> trigRes;
  event.getByLabel(TriggerResultLabel, trigRes);
  if (!trigRes.isValid()){
    edm::InputTag triggerResultsLabelFU(TriggerResultLabel.label(),TriggerResultLabel.instance(), "FU");
    event.getByLabel(triggerResultsLabelFU,trigRes);
    if(!trigRes.isValid()) {
      LogTrace("HLTMuonVal")<< "Trigger Results WARNING: No trigger Results in event info, but you wanted to check a trigger";
      // Do nothing, and 
      //TrigResultsIn=false;

      return false;
    }
  }
  unsigned size = trigRes->size();

  unsigned int Ntp = 0;
  
  LogTrace("HLTMuonVal")<< "Ntp=" << Ntp <<" Size of trigger results="<<size;


  // loop over the list of target triggers  
  
  map<string,bool> firedTrigger;
  
  for ( iTargetTrig = mySelection.requiredTriggers.begin();
        iTargetTrig != mySelection.requiredTriggers.end();
        iTargetTrig++ ) {

    std::string targetName = (*iTargetTrig);

    LogTrace("HLTMuonVal") << "Looking to see if " << targetName << " has fired... ";

    firedTrigger[targetName] = false;
    vector<string>::const_iterator iValidTrig;
    unsigned int trigIndex = 0;
    for ( iValidTrig = selectedValidTriggers.begin();
          iValidTrig != selectedValidTriggers.end();
          iValidTrig ++) {

      if ( targetName == (*iValidTrig)){
        
        LogTrace ("HLTMuonVal") << "Trigger " << targetName
                                << " was part of the hlt configuration at index"
                                << trigIndex
                                << endl;
        
        firedTrigger[targetName] =  trigRes->accept(trigIndex);

        LogTrace ("HLTMuonVal") << "Did the trigger fire?      "
                                << ((firedTrigger[targetName]) ? "PASSED" : "FAILED")
                                << endl;
        
      }

      trigIndex++;
    } // end loop over valid triggers
  }// end loop over target triggers
    

  map<string,bool>::const_iterator iResult;

  passedAnyTrigger = false;

  LogTrace ("HLTMuonVal") << "OR-ing trigger results together" <<endl;

  
  for (iResult = firedTrigger.begin();
       iResult != firedTrigger.end();
       iResult ++) {

    passedAnyTrigger = passedAnyTrigger || iResult->second;
    
  }

  LogTrace ("HLTMuonVal") << "Returning " << passedAnyTrigger;

  return passedAnyTrigger;
  
}
void HLTMuonMatchAndPlot::begin ( void  ) [virtual]

Reimplemented in HLTMuonBPAG, and HLTTopPlotter.

Definition at line 1871 of file HLTMuonMatchAndPlot.cc.

References DQMStore::cd(), dbe_, h, i, testEve_cfg::level, LogTrace, jptDQMConfig_cff::ptBins, and DQMStore::setCurrentFolder().

{
  LogTrace ("HLTMuonVal") << "\n\nInside HLTMuonMatchAndPlot begin()";

  TString myLabel, newFolder;
  vector<TH1F*> h;

  if ( dbe_ ) {
    dbe_->cd();
    dbe_->setCurrentFolder("HLT/Muon");

    // JMS I think this is trimming all L1 names to
    // to be L1Filtered
    // Update this so that it really is just L1Filtered
    // new trigger names ruin string trimming

    if (useOldLabels) { 
      myLabel = theL1CollectionLabel;
      myLabel = myLabel(myLabel.Index("L1"),myLabel.Length());
      myLabel = myLabel(0,myLabel.Index("Filtered")+8);
    } else {
      myLabel = "L1Filtered";
    }
    // JMS Old way of doing things
    //newFolder = "HLT/Muon/Distributions/" + theTriggerName;
    newFolder = "HLT/Muon/Distributions/" + theTriggerName + "/" + mySelection.customLabel;

    
    
    dbe_->setCurrentFolder( newFolder.Data() );

    //meNumberOfEvents            = dbe_->bookInt("NumberOfEvents");
    //MonitorElement *meMinPtCut  = dbe_->bookFloat("MinPtCut"    );
    //MonitorElement *meMaxEtaCut = dbe_->bookFloat("MaxEtaCut"   );
    //meMinPtCut ->Fill(theMinPtCut );
    //meMaxEtaCut->Fill(theMaxEtaCut);
    
    vector<string> binLabels;
    binLabels.push_back( theL1CollectionLabel.c_str() );
    for ( size_t i = 0; i < theHltCollectionLabels.size(); i++ )
      binLabels.push_back( theHltCollectionLabels[i].c_str() );

    //hNumObjects = dbe_->book1D( "numObjects", "Number of Objects", 7, 0, 7 );
    //hNumObjects->setBinLabel( 1, "Gen" );
    //hNumObjects->setBinLabel( 2, "Reco" );
    //for ( size_t i = 0; i < binLabels.size(); i++ )
    //hNumObjects->setBinLabel( i + 3, binLabels[i].c_str() );
    //hNumObjects->getTH1()->LabelsDeflate("X");


    if ( useMuonFromReco ){

      //hNumOrphansRec = dbe_->book1D( "recNumOrphans", "Number of Orphans;;Number of Objects Not Matched to a Reconstructed #mu", 5, 0, 5 );
      //       for ( size_t i = 0; i < binLabels.size(); i++ )
      //         hNumOrphansRec->setBinLabel( i + 1, binLabels[i].c_str() );
      //hNumOrphansRec->getTH1()->LabelsDeflate("X");


      
      
      // 0 = MaxPt_All
      hPassMaxPtRec.push_back( bookIt( "recPassMaxPt_All", "pt of Leading Reco Muon" ,  numBinsInPtHisto, ptBins) );
      // 1 = MaxPt if matched to L1 Trigger
      if (useFullDebugInformation || isL1Path) hPassMaxPtRec.push_back( bookIt( "recPassMaxPt_" + myLabel, "pt of Leading Reco Muon, if matched to " + myLabel,  numBinsInPtHisto, ptBins) );

      hPassEtaRec.push_back( bookIt( "recPassEta_All", "#eta of Reco Muons", theEtaParameters) );
      if (useFullDebugInformation || isL1Path) hPassEtaRec.push_back( bookIt( "recPassEta_" + myLabel, "#eta of Reco Muons matched to " + myLabel, theEtaParameters) );
      
      hPassPhiRec.push_back( bookIt( "recPassPhi_All", "#phi of Reco Muons", thePhiParameters) );
      if (useFullDebugInformation || isL1Path) hPassPhiRec.push_back( bookIt( "recPassPhi_" + myLabel, "#phi of Reco Muons matched to " + myLabel, thePhiParameters) );
      

      
      hPassPtRec.push_back( bookIt( "recPassPt_All", "Pt of  Reco Muon" , numBinsInPtHisto, ptBins) );
      if (useFullDebugInformation || isL1Path) hPassPtRec.push_back( bookIt( "recPassPt_" + myLabel, "pt  Reco Muon, if matched to " + myLabel,  numBinsInPtHisto, ptBins) );
      
      hPassPtRecExactlyOne.push_back( bookIt( "recPassPtExactlyOne_All", "pt of Leading Reco Muon (==1 muon)" ,  numBinsInPtHisto, ptBins) );
      if (useFullDebugInformation || isL1Path) hPassPtRecExactlyOne.push_back( bookIt( "recPassPtExactlyOne_" + myLabel, "pt of Leading Reco Muon (==1 muon), if matched to " + myLabel,  numBinsInPtHisto, ptBins) );
      
      hPassExaclyOneMuonMaxPtRec.push_back( bookIt("recPassExactlyOneMuonMaxPt_All", "pt of Leading Reco Muon in events with exactly one muon" ,  numBinsInPtHisto, ptBins) );
      if (useFullDebugInformation || isL1Path) hPassExaclyOneMuonMaxPtRec.push_back( bookIt("recPassExactlyOneMuonMaxPt_" + myLabel, "pt of Leading Reco Muon in events with exactly one muon match to " + myLabel ,  numBinsInPtHisto, ptBins) );

      hPassD0Rec.push_back( bookIt("recPassD0_All", "Track 2-D impact parameter wrt (0,0,0)(d0) ALL", theD0Parameters));
      if (useFullDebugInformation || isL1Path) hPassD0Rec.push_back( bookIt("recPassD0_" + myLabel, "Track 2-D impact parameter (0,0,0)(d0) " + myLabel, theD0Parameters));
      hPassD0BeamRec.push_back( bookIt("recPassD0Beam_All", "Track 2-D impact parameter wrt (beam)(d0) ALL", theD0Parameters));
      if (useFullDebugInformation || isL1Path) hPassD0BeamRec.push_back( bookIt("recPassD0Beam_" + myLabel, "Track 2-D impact parameter (beam)(d0) " + myLabel, theD0Parameters));
      
      hPassZ0Rec.push_back( bookIt("recPassZ0_All", "Track Z0 wrt (0,0,0) ALL", theZ0Parameters));
      if (useFullDebugInformation || isL1Path) hPassZ0Rec.push_back( bookIt("recPassZ0_" + myLabel, "Track Z0 (0,0,0) " + myLabel, theZ0Parameters));      
      hPassZ0BeamRec.push_back( bookIt("recPassZ0Beam_All", "Track Z0 wrt (beam) ALL", theZ0Parameters));
      if (useFullDebugInformation || isL1Path) hPassZ0BeamRec.push_back( bookIt("recPassZ0Beam_" + myLabel, "Track Z0 (beam) " + myLabel, theZ0Parameters));

      hPassCharge.push_back( bookIt("recPassCharge_All", "Track Charge  ALL", theChargeParameters));
      if (useFullDebugInformation || isL1Path) hPassCharge.push_back( bookIt("recPassCharge_" + myLabel, "Track Charge  " + myLabel, theChargeParameters));

      hIsolationRec.push_back ( bookIt("recPassIsolation_ALL", "Muon Isolation cone 0.3", theIsolationParameters));
      if (useFullDebugInformation || isL1Path) hIsolationRec.push_back ( bookIt("recPassIsolation_" + myLabel, "Muon Isolation cone 0.3  " + myLabel, theIsolationParameters)); 

        // beamspot filled only once
      hBeamSpotZ0Rec.push_back ( bookIt("recBeamSpotZ0_All", "Z0 of beamspot for this event", theZ0Parameters));

      

      // =======================================================
      // these hisotgrams requite a match, and so will only have
      // L1,L2,L3 histograms and no "all" histogram
      // =======================================================
      
      // hDeltaRMatched.push_back ( bookIt("recDeltaRMatched_All" , "#Delta R between matched HLTCand", theDRParameters));
      if (useFullDebugInformation || isL1Path) hDeltaRMatched.push_back ( bookIt("recDeltaRMatched_" + myLabel, "#Delta R between matched HLTCand", theDRParameters));

      // hChargeFlipMatched.push_back ( bookIt("recChargeFlipMatched_All" , "Charge Flip from hlt to RECO;HLT;Reco", theChargeFlipParameters)); 
      if (useFullDebugInformation || isL1Path) hChargeFlipMatched.push_back ( bookIt("recChargeFlipMatched_" + myLabel, "Charge Flip from hlt to RECO;HLT Charge (-,+);Reco (-,+)", theChargeFlipParameters)); 

      if (useFullDebugInformation || isL1Path) hPassMatchPtRec.push_back( bookIt( "recPassMatchPt_" + myLabel, "Pt of Reco Muon that is matched to Trigger Muon " + myLabel, numBinsInPtHisto, ptBins) );
      //hPtMatchVsPtRec.push_back (bookIt("recPtVsMatchPt" + myLabel, "Reco Pt vs Matched HLT Muon Pt" + myLabel ,  theMaxPtParameters2d) );
      //hEtaMatchVsEtaRec.push_back( bookIt( "recEtaVsMatchEta_" + myLabel, "Reco #eta vs HLT #eta  " + myLabel, theEtaParameters2d) );
      //hPhiMatchVsPhiRec.push_back( bookIt( "recPhiVsMatchPhi_" + myLabel, "Reco #phi vs HLT #phi  " + myLabel, thePhiParameters2d) );
      
      if (useFullDebugInformation || isL1Path) hResoPtAodRec.push_back ( bookIt ("recResoPt_" + myLabel, "TrigSumAOD to RECO P_T resolution", theResParameters));
      if (useFullDebugInformation || isL1Path) hResoEtaAodRec.push_back ( bookIt ("recResoEta_" + myLabel, "TrigSumAOD to RECO #eta resolution", theResParameters));
      if (useFullDebugInformation || isL1Path) hResoPhiAodRec.push_back ( bookIt ("recResoPhi_" + myLabel, "TrigSumAOD to RECO #phi resolution", theResParameters));

      // Cosmic debugging histos
      if (useFullDebugInformation || isL1Path) hMatchedDeltaPhi.push_back ( bookIt( "recDeltaPhiMatched_" + myLabel, "Reco #phi vs HLT #phi  " + myLabel, thePhiParameters0Pi) );
      //hDeltaPhiVsPhi.push_back(bookIt( "recDeltaPhiVsPhi_" + myLabel, "#Delta #phi (reco,hlt) vs HLT #phi  " + myLabel, theDeltaPhiVsPhiParameters) );
      //hDeltaPhiVsZ0.push_back(bookIt( "recDeltaPhiVsZ0_" + myLabel, "#Delta #phi (reco, hlt) vs HLT z0  " + myLabel, theDeltaPhiVsZ0Parameters) );
      //hDeltaPhiVsD0.push_back(bookIt( "recDeltaPhiVsD0_" + myLabel, "#Delta #phi (reco, hlt) vs HLT d0 " + myLabel, theDeltaPhiVsD0Parameters) );
      
      //  RAW Histograms 

      if (useFullDebugInformation) {
        rawMatchHltCandPt.push_back( bookIt( "rawPassPt_All", "Pt of  Reco Muon" ,  numBinsInPtHisto, ptBins) );
        rawMatchHltCandPt.push_back( bookIt( "rawPassPt_" + myLabel, "pt  Reco Muon, if matched to " + myLabel,  numBinsInPtHisto, ptBins) );
      
        rawMatchHltCandEta.push_back( bookIt( "rawPassEta_All", "#eta of Reco Muons", theEtaParameters) );
        rawMatchHltCandEta.push_back( bookIt( "rawPassEta_" + myLabel, "#eta of Reco Muons matched to " + myLabel, theEtaParameters) );
      
        rawMatchHltCandPhi.push_back( bookIt( "rawPassPhi_All", "#phi of Reco Muons", thePhiParameters) );
        rawMatchHltCandPhi.push_back( bookIt( "rawPassPhi_" + myLabel, "#phi of Reco Muons matched to " + myLabel, thePhiParameters) );
      }
      
      //=================================
      //          2-D Histograms
      //=================================
      
      hPhiVsEtaRec.push_back ( bookIt ("recPhiVsRecEta_All", "Reco #phi vs Reco #eta  ", thePhiEtaParameters2d));
      if (useFullDebugInformation || isL1Path) hPhiVsEtaRec.push_back ( bookIt ("recPhiVsRecEta_" + myLabel, "Reco #phi vs Reco #eta  " +myLabel, thePhiEtaParameters2d));

    }

    // we won't enter this loop if we don't have an hlt label
    // we won't have an hlt label is this is a l1 path
    for ( unsigned int i = 0; i < theHltCollectionLabels.size(); i++ ) {

      if (useOldLabels) {
        myLabel = theHltCollectionLabels[i];
        TString level = ( myLabel.Contains("L2") ) ? "L2" : "L3";
        myLabel = myLabel(myLabel.Index(level),myLabel.Length());
        myLabel = myLabel(0,myLabel.Index("Filtered")+8);
      } else {
        TString tempString = theHltCollectionLabels[i];
        TString level = ( tempString.Contains("L2") ) ? "L2" : "L3";
        myLabel = level + "Filtered";
      }
      
      if ( useMuonFromReco ) {

        // These histos have All, L1, L2, L3
        hPassMaxPtRec.push_back( bookIt( "recPassMaxPt_" + myLabel, "pt of Leading Reco Muon, if matched to " + myLabel, numBinsInPtHisto, ptBins) );     
        hPassEtaRec.push_back( bookIt( "recPassEta_" + myLabel, "#eta of Reco Muons matched to " + myLabel, theEtaParameters) );
        hPassPhiRec.push_back( bookIt( "recPassPhi_" + myLabel, "#phi of Reco Muons matched to " + myLabel, thePhiParameters) );                

        hPassPtRec.push_back ( bookIt( "recPassPt_" + myLabel, "Pt of  Reco Muon, if matched to " + myLabel, numBinsInPtHisto, ptBins) );
        hPassPtRecExactlyOne.push_back (bookIt( "recPassPtExactlyOne__" + myLabel, "pt of Leading Reco Muon (==1 muon), if matched to " + myLabel, numBinsInPtHisto, ptBins) );

        hPassExaclyOneMuonMaxPtRec.push_back( bookIt("recPassExactlyOneMuonMaxPt_" + myLabel, "pt of Leading Reco Muon in events with exactly one muon match to " + myLabel ,  numBinsInPtHisto, ptBins) );        
        hPhiVsEtaRec.push_back ( bookIt ("recPhiVsRecEta_" + myLabel, "Reco #phi vs Reco #eta  " +myLabel, thePhiEtaParameters2d));

         
        hPassD0Rec.push_back( bookIt("recPassD0_" + myLabel, "Track 2-D impact parameter (Z0) " + myLabel, theD0Parameters));
        hPassD0BeamRec.push_back( bookIt("recPassD0Beam_" + myLabel, "Track 2-D impact parameter (beam)(d0) " + myLabel, theD0Parameters));
        hPassZ0Rec.push_back( bookIt("recPassZ0_" + myLabel, "Track Z0 " + myLabel, theZ0Parameters));
        hPassZ0BeamRec.push_back( bookIt("recPassZ0Beam_" + myLabel, "Track Z0 (0,0,0) " + myLabel, theZ0Parameters));
        hPassCharge.push_back( bookIt("recPassCharge_" + myLabel, "Track Charge  " + myLabel, theChargeParameters));

        hIsolationRec.push_back ( bookIt("recPassIsolation_" + myLabel, "Muon Isolation cone 0.3  " + myLabel, theIsolationParameters)); 
        
        // Match histos only have numHltLabels indices
        hPassMatchPtRec.push_back( bookIt( "recPassMatchPt_" + myLabel, "Pt of Reco Muon that is matched to Trigger Muon " + myLabel, numBinsInPtHisto, ptBins) );

        //hPtMatchVsPtRec.push_back (bookIt("recPtVsMatchPt" + myLabel, "Reco Pt vs Matched HLT Muon Pt" + myLabel ,  theMaxPtParameters2d) );
        //hEtaMatchVsEtaRec.push_back( bookIt( "recEtaVsMatchEta_" + myLabel, "Reco #eta vs HLT #eta  " + myLabel, theEtaParameters2d) );
        //hPhiMatchVsPhiRec.push_back( bookIt( "recPhiVsMatchPhi_" + myLabel, "Reco #phi vs HLT #phi  " + myLabel, thePhiParameters2d) );

        hResoPtAodRec.push_back ( bookIt ("recResoPt_" + myLabel, "TrigSumAOD to RECO P_T resolution", theResParameters));
        hResoEtaAodRec.push_back ( bookIt ("recResoEta_" + myLabel, "TrigSumAOD to RECO #eta resolution", theResParameters));
        hResoPhiAodRec.push_back ( bookIt ("recResoPhi_" + myLabel, "TrigSumAOD to RECO #phi resolution", theResParameters));

        hDeltaRMatched.push_back ( bookIt("recDeltaRMatched_" + myLabel, "#Delta R between matched HLTCand", theDRParameters));
        hChargeFlipMatched.push_back ( bookIt("recChargeFlipMatched_" + myLabel, "Charge Flip from hlt to RECO;HLT (-,+);Reco (-,+)", theChargeFlipParameters)); 

        // cosmic plots

        hMatchedDeltaPhi.push_back ( bookIt( "recDeltaPhiMatched_" + myLabel, "Reco #phi vs HLT #phi  " + myLabel, thePhiParameters0Pi) );  
        //hDeltaPhiVsPhi.push_back(bookIt( "recDeltaPhiVsPhi_" + myLabel, "Reco #phi vs HLT #phi  " + myLabel, theDeltaPhiVsPhiParameters) );
        //hDeltaPhiVsZ0.push_back(bookIt( "recDeltaPhiVsZ0_" + myLabel, "Reco #phi vs HLT #phi  " + myLabel, theDeltaPhiVsZ0Parameters) );
        //hDeltaPhiVsD0.push_back(bookIt( "recDeltaPhiVsD0_" + myLabel, "#Delta #phi (reco, hlt) vs HLT d0 " + myLabel, theDeltaPhiVsD0Parameters) );

        // these candidates are indexed by the number
        // of hlt labels
        allHltCandPt.push_back( bookIt("allHltCandPt_" + myLabel, "Pt of all HLT Muon Cands, for HLT " + myLabel, numBinsInPtHisto, ptBins));     
        allHltCandEta.push_back( bookIt("allHltCandEta_" + myLabel, "Eta of all HLT Muon Cands, for HLT " + myLabel, theEtaParameters));         
        allHltCandPhi.push_back( bookIt("allHltCandPhi_" + myLabel, "Phi of all HLT Muon Cands, for HLT " + myLabel, thePhiParameters));    

        fakeHltCandPt.push_back( bookIt("fakeHltCandPt_" + myLabel, "Pt of fake HLT Muon Cands, for HLT " + myLabel, numBinsInPtHisto, ptBins));     
        fakeHltCandEta.push_back( bookIt("fakeHltCandEta_" + myLabel, "Eta of fake HLT Muon Cands, for HLT " + myLabel, theEtaParameters));         
        fakeHltCandPhi.push_back( bookIt("fakeHltCandPhi_" + myLabel, "Phi of fake HLT Muon Cands, for HLT " + myLabel, thePhiParameters));    
                
        //fakeHltCandEtaPhi.push_back(bookIt("fakeHltCandPhiVsEta_" + myLabel, " AOD #phi vs  #eta for fake HLT Muon Cands, for HLT  " +myLabel, thePhiEtaParameters2d));

        // raw histograms

        if (useFullDebugInformation) {
          rawMatchHltCandPt.push_back( bookIt( "rawPassPt_" + myLabel, "pt  Reco Muon, if matched to " + myLabel,  numBinsInPtHisto, ptBins) );
          rawMatchHltCandEta.push_back( bookIt( "rawPassEta_" + myLabel, "#eta of Reco Muons matched to " + myLabel, theEtaParameters) );
          rawMatchHltCandPhi.push_back( bookIt( "rawPassPhi_" + myLabel, "#phi of Reco Muons matched to " + myLabel, thePhiParameters) );
        }
      }

    }
  }

}
virtual MonitorElement* HLTMuonMatchAndPlot::bookIt ( TString  name,
TString  title,
std::vector< double >   
) [virtual]
MonitorElement * HLTMuonMatchAndPlot::bookIt ( TString  name,
TString  title,
int  nbins,
float *  xBinLowEdges 
) [virtual]

Definition at line 2150 of file HLTMuonMatchAndPlot.cc.

References DQMStore::book1D(), dbe_, LogTrace, DQMStore::pwd(), and indexGen::title.

{
  LogTrace("HLTMuonVal") << "Directory " << dbe_->pwd() << " Name " << 
                            name << " Title:" << title;

  TH1F *tempHist = new TH1F(name, title, nbins, xBinLowEdges);
  tempHist->Sumw2();
  MonitorElement * returnedME = dbe_->book1D(name.Data(), tempHist);
  delete tempHist;

  booked1DMonitorElements.push_back(returnedME);
  return returnedME;
  
}
TString HLTMuonMatchAndPlot::calcHistoSuffix ( std::string  moduleName)

Definition at line 2176 of file HLTMuonMatchAndPlot.cc.

References testEve_cfg::level.

                                                               {

  TString level = "L3";
  TString myLabel = moduleName; // the return value

  
  if ( myLabel.Contains("L1") ) {
    level = "L1";
  } else if (myLabel.Contains("L2")) {
    level = "L2";
  } else if (myLabel.Contains("L3")) {
    level = "L3";
  }

  if (useOldLabels) {
    myLabel = myLabel(myLabel.Index(level),myLabel.Length());
    myLabel = myLabel(0,myLabel.Index("Filtered")+8);
    
  } else {
    myLabel = level + "Filtered";
  }

  return myLabel;
  
}
void HLTMuonMatchAndPlot::endRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Definition at line 487 of file HLTMuonMatchAndPlot.cc.

References LogTrace.

{

  LogTrace ("HLTMuonVal") << "\n\nInside HLTMuonMatchAndPlot endRun()";

  // loop over all the histograms we booked, and handle the overflow bins

  // do this at end run, since you want to be sure you did it before you
  // saved your ME's.
  
  vector<MonitorElement*>::iterator iMonitorEl;
  
  for ( iMonitorEl = booked1DMonitorElements.begin();
        iMonitorEl != booked1DMonitorElements.end();
        iMonitorEl++ ) {

    moveOverflow((*iMonitorEl));

  }
  

}
virtual void HLTMuonMatchAndPlot::fillPlots ( std::vector< MatchStruct > &  myRecMatches,
std::vector< std::vector< HltFakeStruct > > &  myHltFakeCands 
) [virtual]
int HLTMuonMatchAndPlot::findGenMatch ( double  eta,
double  phi,
double  maxDeltaR,
std::vector< MatchStruct matches 
) [protected]

Definition at line 1567 of file HLTMuonMatchAndPlot.cc.

References i.

{
  double bestDeltaR = maxDeltaR;
  int bestMatch = -1;
  for ( size_t i = 0; i < matches.size(); i++ ) {
    // double dR = reco::deltaR( eta, phi, 
    //                          matches[i].genCand->eta(), 
    //                          matches[i].genCand->phi() );

    
    double dR = 10;
    
    if ( dR  < bestDeltaR ) {
      bestMatch  =  i;
      bestDeltaR = dR;
    }
  }
  return bestMatch;
}
const reco::Candidate * HLTMuonMatchAndPlot::findMother ( const reco::Candidate p) [protected]

Definition at line 1550 of file HLTMuonMatchAndPlot.cc.

References reco::Candidate::mother(), and reco::Candidate::pdgId().

{
  const reco::Candidate* mother = p->mother();
  if ( mother ) {
    if ( mother->pdgId() == p->pdgId() ) return findMother(mother);
    else return mother;
  }
  else return 0;
}
int HLTMuonMatchAndPlot::findRecMatch ( double  eta,
double  phi,
double  maxdeltaR,
std::vector< MatchStruct matches 
) [protected]

Definition at line 1590 of file HLTMuonMatchAndPlot.cc.

References reco::deltaPhi(), Geom::deltaPhi(), deltaR(), and i.

{
  double bestDeltaR = maxDeltaR;
  int bestMatch = -1;

  // Case for delta R matching
  // the != cosmic case is for default handling.
  if (matchType != "cosmic" || matchType == "dr"  ) {
    for ( size_t i = 0; i < matches.size(); i++ ) {
      double dR = reco::deltaR( eta, phi, 
                                  matches[i].recCand->eta(), 
                                  matches[i].recCand->phi() );
      if ( dR  < bestDeltaR ) {
        bestMatch  =  i;
        bestDeltaR = dR;
      }
    }
    return bestMatch;
  }

  if (matchType == "cosmic") {

    //   Comsic trigger matching
    //   Just require the the muon
    //   will be in the same half of the detector
    //   ignore the eta information
    //   but we will look for the minmum delta phi
    //   with the muon in that region of the detector
    
    double bestDphi = 100.0;
    for ( size_t i = 0; i < matches.size(); i++ ) {

      double recCandPhi = matches[i].recCand->phi();

      
      if (recCandPhi < 0 && phi < 0) {
        if ( reco::deltaPhi(phi, recCandPhi) < bestDphi) {
          bestDphi = reco::deltaPhi(phi, recCandPhi);
          bestMatch = i;          
        }
      }

     
      if (recCandPhi > 0 && phi > 0) {
        
        if ( reco::deltaPhi(phi, recCandPhi) < bestDphi) {
          bestDphi = reco::deltaPhi(phi, recCandPhi);
          bestMatch = i;          
        }         
          
      }        
      
    }
    return bestMatch;
  }

  // If you get here, then you've improperly set
  // your matching

  LogWarning ("HLTMuonVal") << "WARNING: You have improperly set matchType" << endl
                         << "valid choices are 'dr' and 'cosmic', " <<endl
                         << "but you provided    " << matchType << endl;
  
  return bestMatch;
  
}
void HLTMuonMatchAndPlot::finish ( ) [virtual]

Reimplemented in HLTMuonBPAG, and HLTTopPlotter.

Definition at line 511 of file HLTMuonMatchAndPlot.cc.

References dbe_, diJetCalib::histoFileName, LogTrace, and DQMStore::save().

Referenced by HLTTopPlotter::finish(), and HLTMuonBPAG::finish().

{

  LogTrace ("HLTMuonVal") << "\n\nInside HLTMuonMatchAndPlot finish()" << endl;

  if (createStandAloneHistos && histoFileName != "") {
    dbe_->save(histoFileName);
  }
  
}
void HLTMuonMatchAndPlot::getAodTriggerObjectsForModule ( edm::InputTag  collectionTag,
edm::Handle< trigger::TriggerEvent aodTriggerEvent,
trigger::TriggerObjectCollection  trigObjs,
std::vector< trigger::TriggerObject > &  foundObjects,
MuonSelectionStruct  muonSelection 
) [protected]

Definition at line 2234 of file HLTMuonMatchAndPlot.cc.

References MuonSelectionStruct::customLabel, trigger::TriggerObject::eta(), MuonSelectionStruct::hltMuonSelector, trigger::TriggerObject::id(), j, relativeConstraints::keys, LogTrace, and trigger::TriggerObject::pt().

                                                                                            {


  //LogTrace ("HLTMuonVal") << "Getting trigger muons for module label = " << collectionTag << endl;
  
  size_t filterIndex   = aodTriggerEvent->filterIndex( collectionTag );
    
  LogTrace ("HLTMuonVal") << "\n\n filterIndex is "
                          << filterIndex;
    
  if ( filterIndex < aodTriggerEvent->sizeFilters() ) {
    const Keys &keys = aodTriggerEvent->filterKeys( filterIndex );

    LogTrace ("HLTMuonVal") << "\n\nGot keys";
    LogTrace ("HLTMuonVal") << "Key size is " << keys.size();
                              
    // The keys are apparently pointers into the trigger
    // trigObjs collections
    // Use the key's to look up the particles for the
    // filter module that you're using 
      
    for ( size_t j = 0; j < keys.size(); j++ ){
      TriggerObject foundObject = trigObjs[keys[j]];

      // This is the trigger object. Apply your filter to it!
      LogTrace ("HLTMuonVal") << "Testing to see if object in key passes selection"
                              << endl ;
        
      if (muonSelection.hltMuonSelector(foundObject)){
        
        LogTrace ("HLTMuonVal") << "OBJECT FOUND!!! - Storing a trigger object with id = "              
                                << foundObject.id() 
                                << ", eta = " << foundObject.eta()
                                << ", pt = " << foundObject.pt()
                                << ", custom name = " << muonSelection.customLabel
                                << "\n\n" << endl;
        //l1Particles.push_back( trigObjs[keys[j]].particle().p4() );
        foundObjects.push_back( foundObject );
      }
    }
  }

  
  
}
TrackRef HLTMuonMatchAndPlot::getCandTrackRef ( MuonSelectionStruct  mySelection,
reco::Muon  candMuon 
) [protected]

Definition at line 1820 of file HLTMuonMatchAndPlot.cc.

References reco::LeafCandidate::eta(), reco::Muon::globalTrack(), reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), edm::Ref< C, T, F >::isNonnull(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), LogTrace, reco::Muon::outerTrack(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), MuonSelectionStruct::trackCollection, and ExpressReco_HICollisions_FallBack::trackCollection.

                                                                                             {

  string trackCollection = mySelection.trackCollection;
  TrackRef theTrack;

  LogTrace ("HLTMuonVal") << "Getting the track reference for coll "
                          << trackCollection
                          << endl;

  LogTrace ("HLTMuonVal") << "Muon information" << endl
                          << "pt = " << candMuon.pt()
                          << ", phi = " << candMuon.phi()
                          << ", eta = " << candMuon.eta()
                          << ", global muon? = " << candMuon.isGlobalMuon()
                          << ", standalone muon = " << candMuon.isStandAloneMuon()
                          << ", tracker muon = " << candMuon.isTrackerMuon()
                          << endl;
  
  if (trackCollection == "innerTrack") {
    LogTrace ("HLTMuonVal") << "----> GET " << trackCollection;

    if ( candMuon.isTrackerMuon() ) {
      theTrack = candMuon.innerTrack();
    }
    
  } else if ( trackCollection == "outerTrack" ) {
    
    LogTrace ("HLTMuonVal") << "----> GET " << trackCollection;

    if ( candMuon.isStandAloneMuon() ) {
      theTrack = candMuon.outerTrack();
    }
    
  } else if ( trackCollection == "globalTrack") {

    LogTrace ("HLTMuonVal") << "----> GET " << trackCollection;
    if (candMuon.isGlobalMuon()) {
      theTrack = candMuon.globalTrack();
    }
  }

  if (theTrack.isNonnull()) {
    LogTrace ("HLTMuonVal") << "Found the desired track";
  } else {
    LogTrace ("HLTMuonVal") << "No track for this candidate";
  }
  
  return theTrack;
}
int HLTMuonMatchAndPlot::getCharge ( int  pdgId) [protected]

Definition at line 2168 of file HLTMuonMatchAndPlot.cc.

                                             {

  int resultCharge =  (pdgId > 0) ? POS_CHARGE : NEG_CHARGE;
  
  return resultCharge;
  
}
void HLTMuonMatchAndPlot::moveOverflow ( MonitorElement myElement) [protected]

Definition at line 2202 of file HLTMuonMatchAndPlot.cc.

References MonitorElement::getBinContent(), MonitorElement::getEntries(), MonitorElement::getNbinsX(), LogTrace, MonitorElement::setBinContent(), and MonitorElement::setEntries().

                                                                  {

  LogTrace ("HLTMuonVal") << "MOVEOVERFLOW" << endl;

  
  // This will handle an arbitrary dimension first/last bin
  // but you should think about how you will interpret this for
  // 2D/3D histos
  // Actually, this can't handle abitrary dimensions.
  int maxBin = myElement->getNbinsX();

  double originalEntries = myElement->getEntries();
  
  LogTrace ("HLTMuonVal") << "==MOVEOVERFLOW==  "
                                << "maxBin = " << maxBin
                                << ", calling underflow"
                                << endl;
  
  myElement->setBinContent(1, myElement->getBinContent(0) + myElement->getBinContent(1));

  LogTrace ("HLTMuonVal") << "reseting underflow to zero" << endl;
  myElement->setBinContent(0,0.0);
  LogTrace ("HLTMuonVal") << "calling overflow" << endl;
  myElement->setBinContent(maxBin,myElement->getBinContent(maxBin) + myElement->getBinContent(maxBin+1));
  LogTrace ("HLTMuonVal") << "seting overflow to zero" << endl;
  myElement->setBinContent(maxBin+1,0.0);

  myElement->setEntries(originalEntries);

}
bool HLTMuonMatchAndPlot::selectAndMatchMuons ( const edm::Event iEvent,
std::vector< MatchStruct > &  myRecMatches,
std::vector< std::vector< HltFakeStruct > > &  myHltFakeCands,
MuonSelectionStruct  muonSelection 
)
virtual bool HLTMuonMatchAndPlot::selectAndMatchMuons ( const edm::Event iEvent,
std::vector< MatchStruct > &  myRecMatches,
std::vector< std::vector< HltFakeStruct > > &  myHltFakeCands 
) [virtual]

Reimplemented in HLTMuonBPAG.

Referenced by HLTMuonBPAG::selectAndMatchMuons().


Member Data Documentation

Definition at line 398 of file HLTMuonMatchAndPlot.h.

Definition at line 399 of file HLTMuonMatchAndPlot.h.

Definition at line 397 of file HLTMuonMatchAndPlot.h.

Definition at line 249 of file HLTMuonMatchAndPlot.h.

Definition at line 267 of file HLTMuonMatchAndPlot.h.

Definition at line 230 of file HLTMuonMatchAndPlot.h.

Definition at line 357 of file HLTMuonMatchAndPlot.h.

Definition at line 355 of file HLTMuonMatchAndPlot.h.

Definition at line 349 of file HLTMuonMatchAndPlot.h.

Definition at line 405 of file HLTMuonMatchAndPlot.h.

Definition at line 406 of file HLTMuonMatchAndPlot.h.

Definition at line 404 of file HLTMuonMatchAndPlot.h.

Definition at line 250 of file HLTMuonMatchAndPlot.h.

Definition at line 383 of file HLTMuonMatchAndPlot.h.

Definition at line 395 of file HLTMuonMatchAndPlot.h.

Definition at line 393 of file HLTMuonMatchAndPlot.h.

Definition at line 394 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::histoFileName [protected]

Definition at line 358 of file HLTMuonMatchAndPlot.h.

Definition at line 239 of file HLTMuonMatchAndPlot.h.

Definition at line 269 of file HLTMuonMatchAndPlot.h.

std::vector< std::vector<HltFakeStruct> > HLTMuonMatchAndPlot::hltFakeCands

Definition at line 169 of file HLTMuonMatchAndPlot.h.

Definition at line 268 of file HLTMuonMatchAndPlot.h.

Definition at line 386 of file HLTMuonMatchAndPlot.h.

Definition at line 423 of file HLTMuonMatchAndPlot.h.

Definition at line 425 of file HLTMuonMatchAndPlot.h.

Definition at line 380 of file HLTMuonMatchAndPlot.h.

Definition at line 381 of file HLTMuonMatchAndPlot.h.

Definition at line 378 of file HLTMuonMatchAndPlot.h.

Definition at line 365 of file HLTMuonMatchAndPlot.h.

Definition at line 368 of file HLTMuonMatchAndPlot.h.

Definition at line 367 of file HLTMuonMatchAndPlot.h.

Definition at line 364 of file HLTMuonMatchAndPlot.h.

Definition at line 366 of file HLTMuonMatchAndPlot.h.

Definition at line 373 of file HLTMuonMatchAndPlot.h.

Definition at line 374 of file HLTMuonMatchAndPlot.h.

Definition at line 382 of file HLTMuonMatchAndPlot.h.

Definition at line 379 of file HLTMuonMatchAndPlot.h.

Definition at line 372 of file HLTMuonMatchAndPlot.h.

Definition at line 376 of file HLTMuonMatchAndPlot.h.

Definition at line 377 of file HLTMuonMatchAndPlot.h.

Definition at line 375 of file HLTMuonMatchAndPlot.h.

Definition at line 216 of file HLTMuonMatchAndPlot.h.

Definition at line 351 of file HLTMuonMatchAndPlot.h.

Definition at line 240 of file HLTMuonMatchAndPlot.h.

Definition at line 240 of file HLTMuonMatchAndPlot.h.

Definition at line 240 of file HLTMuonMatchAndPlot.h.

Definition at line 244 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::matchType [protected]

Definition at line 278 of file HLTMuonMatchAndPlot.h.

Definition at line 426 of file HLTMuonMatchAndPlot.h.

Definition at line 280 of file HLTMuonMatchAndPlot.h.

const int HLTMuonMatchAndPlot::NEG_CHARGE = -1 [static, protected]

Definition at line 296 of file HLTMuonMatchAndPlot.h.

Definition at line 314 of file HLTMuonMatchAndPlot.h.

unsigned int HLTMuonMatchAndPlot::numHltLabels [protected]

Definition at line 350 of file HLTMuonMatchAndPlot.h.

unsigned int HLTMuonMatchAndPlot::numL1Cands [protected]

Definition at line 242 of file HLTMuonMatchAndPlot.h.

const int HLTMuonMatchAndPlot::POS_CHARGE = 1 [static, protected]

Definition at line 295 of file HLTMuonMatchAndPlot.h.

float HLTMuonMatchAndPlot::ptBins[100] [protected]

Definition at line 313 of file HLTMuonMatchAndPlot.h.

Definition at line 416 of file HLTMuonMatchAndPlot.h.

Definition at line 417 of file HLTMuonMatchAndPlot.h.

Definition at line 415 of file HLTMuonMatchAndPlot.h.

Definition at line 167 of file HLTMuonMatchAndPlot.h.

Definition at line 266 of file HLTMuonMatchAndPlot.h.

Definition at line 275 of file HLTMuonMatchAndPlot.h.

std::vector<std::string> HLTMuonMatchAndPlot::selectedValidTriggers [protected]

Definition at line 285 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::theAodL1Label [protected]

Definition at line 272 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::theAodL2Label [protected]

Definition at line 273 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theChargeFlipParameters [protected]

Definition at line 309 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theChargeParameters [protected]

Definition at line 307 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theD0Parameters [protected]

Definition at line 305 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theDRParameters [protected]

Definition at line 308 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theEtaParameters [protected]

Definition at line 302 of file HLTMuonMatchAndPlot.h.

TFile* HLTMuonMatchAndPlot::theFile [protected]

Definition at line 247 of file HLTMuonMatchAndPlot.h.

std::vector<std::string> HLTMuonMatchAndPlot::theHltCollectionLabels [protected]

Definition at line 258 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::theHltProcessName [protected]

Definition at line 255 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theIsolationParameters [protected]

Definition at line 332 of file HLTMuonMatchAndPlot.h.

Definition at line 257 of file HLTMuonMatchAndPlot.h.

double HLTMuonMatchAndPlot::theL1DrCut [protected]

Definition at line 338 of file HLTMuonMatchAndPlot.h.

Definition at line 287 of file HLTMuonMatchAndPlot.h.

double HLTMuonMatchAndPlot::theL2DrCut [protected]

Definition at line 339 of file HLTMuonMatchAndPlot.h.

double HLTMuonMatchAndPlot::theL3DrCut [protected]

Definition at line 340 of file HLTMuonMatchAndPlot.h.

Definition at line 337 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theMaxPtParameters [protected]

Definition at line 300 of file HLTMuonMatchAndPlot.h.

Definition at line 336 of file HLTMuonMatchAndPlot.h.

Definition at line 341 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theNSigmas [protected]

Definition at line 342 of file HLTMuonMatchAndPlot.h.

TNtuple* HLTMuonMatchAndPlot::theNtuple [protected]

Definition at line 246 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::theNtupleFileName [protected]

Definition at line 344 of file HLTMuonMatchAndPlot.h.

float HLTMuonMatchAndPlot::theNtuplePars[100] [protected]

Definition at line 245 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::theNtuplePath [protected]

Definition at line 345 of file HLTMuonMatchAndPlot.h.

unsigned int HLTMuonMatchAndPlot::theNumberOfObjects [protected]

Definition at line 259 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::thePhiEtaParameters2d [protected]

Definition at line 317 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::thePhiParameters [protected]

Definition at line 303 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::thePhiParameters0Pi [protected]

Definition at line 304 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::thePtParameters [protected]

Definition at line 301 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theResParameters [protected]

Definition at line 329 of file HLTMuonMatchAndPlot.h.

std::string HLTMuonMatchAndPlot::theTriggerName [protected]

Definition at line 256 of file HLTMuonMatchAndPlot.h.

std::vector<double> HLTMuonMatchAndPlot::theZ0Parameters [protected]

Definition at line 306 of file HLTMuonMatchAndPlot.h.

Definition at line 283 of file HLTMuonMatchAndPlot.h.

bool HLTMuonMatchAndPlot::useAod [protected]

Definition at line 271 of file HLTMuonMatchAndPlot.h.

Definition at line 238 of file HLTMuonMatchAndPlot.h.

Definition at line 262 of file HLTMuonMatchAndPlot.h.

Definition at line 237 of file HLTMuonMatchAndPlot.h.