Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77834
b: "refs/heads/CMSSW_7_1_X"
c: 57e118c
h: "refs/heads/CMSSW_7_1_X"
v: v3
  • Loading branch information
Jonathan Jason Hollar committed Nov 13, 2009
1 parent 2f0fc58 commit bdce106
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": c014b33877238333181341d5711872bca0c6a8fb
"refs/heads/CMSSW_7_1_X": 57e118cff55d47cb4e5023997ea41ffe8c80a423
70 changes: 70 additions & 0 deletions trunk/HLTrigger/HLTanalyzers/interface/HLTBitAnalyzer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <iostream>

#include "HLTrigger/HLTanalyzers/interface/EventHeader.h"
#include "HLTrigger/HLTanalyzers/interface/HLTInfo.h"

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"

#include "DataFormats/Common/interface/Handle.h"

#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"

#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"

/** \class HLTBitAnalyzer
*
* $Date: November 2006
* $Revision:
* \author P. Bargassa - Rice U.
*/

class HLTBitAnalyzer : public edm::EDAnalyzer {
public:
explicit HLTBitAnalyzer(edm::ParameterSet const& conf);
virtual void analyze(edm::Event const& e, edm::EventSetup const& iSetup);
virtual void endJob();

// static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);

// Analysis tree to be filled
TTree *HltTree;

private:
// variables persistent across events should be declared here.
//
///Default analyses

EventHeader evt_header_;
HLTInfo hlt_analysis_;

edm::InputTag hltresults_,genEventInfo_;
std::string l1extramc_, l1extramu_;
edm::InputTag m_l1extramu;
edm::InputTag m_l1extraemi;
edm::InputTag m_l1extraemn;
edm::InputTag m_l1extrajetc;
edm::InputTag m_l1extrajetf;
edm::InputTag m_l1extrataujet;
edm::InputTag m_l1extramet;
edm::InputTag m_l1extramht;

edm::InputTag gtReadoutRecord_,gtObjectMap_;
edm::InputTag gctBitCounts_,gctRingSums_;

int errCnt;
const int errMax(){return 100;}

string _HistName; // Name of histogram file
double _EtaMin,_EtaMax;
TFile* m_file; // pointer to Histogram file

};
19 changes: 19 additions & 0 deletions trunk/HLTrigger/HLTanalyzers/python/HLTBitAnalyser_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import FWCore.ParameterSet.Config as cms

hltbitanalysis = cms.EDAnalyzer("HLTBitAnalyzer",
### Trigger objects
l1GctHFBitCounts = cms.InputTag("hltGctDigis"),
l1GctHFRingSums = cms.InputTag("hltGctDigis"),
l1GtObjectMapRecord = cms.InputTag("hltL1GtObjectMap::HLT"),
l1GtReadoutRecord = cms.InputTag("hltGtDigis::HLT"),

l1extramc = cms.string('hltL1extraParticles'),
l1extramu = cms.string('hltL1extraParticles'),
hltresults = cms.InputTag("TriggerResults::HLT"),

### Run parameters
RunParameters = cms.PSet(
HistogramFile = cms.untracked.string('hltbitanalysis.root')
)

)
159 changes: 159 additions & 0 deletions trunk/HLTrigger/HLTanalyzers/src/HLTBitAnalyzer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// File: HLTBitAnalyzer.cc
// Description: Example of Analysis driver originally from Jeremy Mans,
// Date: 13-October-2006

#include <boost/foreach.hpp>

#include "HLTrigger/HLTanalyzers/interface/HLTBitAnalyzer.h"
#include "HLTMessages.h"

typedef std::pair<const char *, const edm::InputTag *> MissingCollectionInfo;

template <class T>
static inline
bool getCollection(const edm::Event & event, std::vector<MissingCollectionInfo> & missing, edm::Handle<T> & handle, const edm::InputTag & name, const char * description)
{
event.getByLabel(name, handle);
bool valid = handle.isValid();
if (not valid) {
missing.push_back( std::make_pair(description, & name) );
handle.clear();
}
return valid;
}

// Boiler-plate constructor definition of an analyzer module:
HLTBitAnalyzer::HLTBitAnalyzer(edm::ParameterSet const& conf) {

// If your module takes parameters, here is where you would define
// their names and types, and access them to initialize internal
// variables. Example as follows:
std::cout << " Beginning HLTBitAnalyzer Analysis " << std::endl;

l1extramu_ = conf.getParameter<std::string> ("l1extramu");
m_l1extramu = edm::InputTag(l1extramu_, "");

// read the L1Extra collection name, and add the instance names as needed
l1extramc_ = conf.getParameter<std::string> ("l1extramc");
m_l1extraemi = edm::InputTag(l1extramc_, "Isolated");
m_l1extraemn = edm::InputTag(l1extramc_, "NonIsolated");
m_l1extrajetc = edm::InputTag(l1extramc_, "Central");
m_l1extrajetf = edm::InputTag(l1extramc_, "Forward");
m_l1extrataujet = edm::InputTag(l1extramc_, "Tau");
m_l1extramet = edm::InputTag(l1extramc_, "MET");
m_l1extramht = edm::InputTag(l1extramc_, "MHT");

hltresults_ = conf.getParameter<edm::InputTag> ("hltresults");
gtReadoutRecord_ = conf.getParameter<edm::InputTag> ("l1GtReadoutRecord");
gtObjectMap_ = conf.getParameter<edm::InputTag> ("l1GtObjectMapRecord");

gctBitCounts_ = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFBitCounts").label(), "" );
gctRingSums_ = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFRingSums").label(), "" );

m_file = 0; // set to null
errCnt = 0;

// read run parameters with a default value
edm::ParameterSet runParameters = conf.getParameter<edm::ParameterSet>("RunParameters");
_HistName = runParameters.getUntrackedParameter<std::string>("HistogramFile", "test.root");

// open the tree file
m_file = new TFile(_HistName.c_str(), "RECREATE");
if (m_file)
m_file->cd();

// Initialize the tree
HltTree = new TTree("HltTree", "");

// Setup the different analysis
hlt_analysis_.setup(conf, HltTree);
evt_header_.setup(HltTree);
}

// Boiler-plate "analyze" method declaration for an analyzer module.
void HLTBitAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {

edm::Handle<edm::TriggerResults> hltresults;
edm::Handle<l1extra::L1EmParticleCollection> l1extemi, l1extemn;
edm::Handle<l1extra::L1MuonParticleCollection> l1extmu;
edm::Handle<l1extra::L1JetParticleCollection> l1extjetc, l1extjetf, l1exttaujet;
edm::Handle<l1extra::L1EtMissParticleCollection> l1extmet,l1extmht;
edm::Handle<L1GlobalTriggerReadoutRecord> l1GtRR;
edm::Handle<L1GlobalTriggerObjectMapRecord> l1GtOMRec;
edm::Handle<L1GlobalTriggerObjectMap> l1GtOM;
edm::Handle< L1GctHFBitCountsCollection > gctBitCounts ;
edm::Handle< L1GctHFRingEtSumsCollection > gctRingSums ;

// extract the collections from the event, check their validity and log which are missing
std::vector<MissingCollectionInfo> missing;

getCollection( iEvent, missing, hltresults, hltresults_, kHltresults );
getCollection( iEvent, missing, l1extemi, m_l1extraemi, kL1extemi );
getCollection( iEvent, missing, l1extemn, m_l1extraemn, kL1extemn );
getCollection( iEvent, missing, l1extmu, m_l1extramu, kL1extmu );
getCollection( iEvent, missing, l1extjetc, m_l1extrajetc, kL1extjetc );
getCollection( iEvent, missing, l1extjetf, m_l1extrajetf, kL1extjetf );
getCollection( iEvent, missing, l1exttaujet, m_l1extrataujet, kL1exttaujet );
getCollection( iEvent, missing, l1extmet, m_l1extramet, kL1extmet );
getCollection( iEvent, missing, l1extmht, m_l1extramht, kL1extmht );
getCollection( iEvent, missing, l1GtRR, gtReadoutRecord_, kL1GtRR );
getCollection( iEvent, missing, l1GtOMRec, gtObjectMap_, kL1GtOMRec );
getCollection( iEvent, missing, gctBitCounts, gctBitCounts_, kL1GctBitCounts );
getCollection( iEvent, missing, gctRingSums, gctRingSums_, kL1GctRingSums );


// print missing collections
if (not missing.empty() and (errCnt < errMax())) {
errCnt++;
std::stringstream out;
out << "OpenHLT analyser - missing collections:";
BOOST_FOREACH(const MissingCollectionInfo & entry, missing)
out << "\n\t" << entry.first << ": " << entry.second->encode();
edm::LogPrint("OpenHLT") << out.str() << std::endl;
if (errCnt == errMax())
edm::LogWarning("OpenHLT") << "Maximum error count reached -- No more messages will be printed.";
}

// run the analysis, passing required event fragments
hlt_analysis_.analyze(
hltresults,
l1extemi,
l1extemn,
l1extmu,
l1extjetc,
l1extjetf,
l1exttaujet,
l1extmet,
l1extmht,
l1GtRR,
l1GtOMRec,
gctBitCounts,
gctRingSums,
HltTree);

evt_header_.analyze(iEvent, HltTree);

// std::cout << " Ending Event Analysis" << std::endl;
// After analysis, fill the variables tree
if (m_file)
m_file->cd();
HltTree->Fill();
}

// "endJob" is an inherited method that you may implement to do post-EOF processing and produce final output.
void HLTBitAnalyzer::endJob() {

if (m_file)
m_file->cd();

HltTree->Write();
delete HltTree;
HltTree = 0;

if (m_file) { // if there was a tree file...
m_file->Write(); // write out the branches
delete m_file; // close and delete the file
m_file = 0; // set to zero to clean up
}

}
2 changes: 2 additions & 0 deletions trunk/HLTrigger/HLTanalyzers/src/SealModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
#include "DataFormats/EgammaCandidates/interface/Photon.h"

#include "HLTrigger/HLTanalyzers/interface/HLTAnalyzer.h"
#include "HLTrigger/HLTanalyzers/interface/HLTBitAnalyzer.h"
#include "HLTrigger/HLTanalyzers/interface/HLTGetDigi.h"
#include "HLTrigger/HLTanalyzers/interface/HLTGetRaw.h"

DEFINE_FWK_MODULE(HLTrigReport);

DEFINE_FWK_MODULE(HLTAnalyzer);
DEFINE_FWK_MODULE(HLTBitAnalyzer);
DEFINE_FWK_MODULE(HLTGetDigi);
DEFINE_FWK_MODULE(HLTGetRaw);
1 change: 0 additions & 1 deletion trunk/HLTrigger/HLTanalyzers/test/HLTAnalysis_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
# Meanwhile...:
process.GlobalTag.globaltag = 'MC_31X_V9::All'


process.load('Configuration/StandardSequences/SimL1Emulator_cff')

# OpenHLT specificss
Expand Down
69 changes: 69 additions & 0 deletions trunk/HLTrigger/HLTanalyzers/test/HLTBitAnalysis_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import FWCore.ParameterSet.Config as cms

##################################################################

OUTPUT_HIST='hltbits.root'
NEVTS=1000

##################################################################

process = cms.Process("ANALYSIS")

process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 100

process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool(False)
)

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/relval/CMSSW_3_3_2/RelValZTT/GEN-SIM-DIGI-RAW-HLTDEBUG/STARTUP31X_V8-v2/0000/CC203608-59C8-DE11-B1E6-0018F3D096EA.root'
)
)

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32( NEVTS ),
skipBadFiles = cms.bool(True)
)

process.load('Configuration/StandardSequences/GeometryExtended_cff')
process.load('Configuration/StandardSequences/MagneticField_38T_cff')

process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
# Which AlCa condition for what. Available from pre11
# * DESIGN_31X_V1 - no smearing, alignment and calibration constants = 1. No bad channels.
# * MC_31X_V1 (was IDEAL_31X) - conditions intended for 31X physics MC production: no smearing,
# alignment and calibration constants = 1. Bad channels are masked.
# * STARTUP_31X_V1 (was STARTUP_31X) - conditions needed for HLT 8E29 menu studies: As MC_31X_V1 (including bad channels),
# but with alignment and calibration constants smeared according to knowledge from CRAFT.
# * CRAFT08_31X_V1 (was CRAFT_31X) - conditions for CRAFT08 reprocessing.
# * CRAFT_31X_V1P, CRAFT_31X_V1H - initial conditions for 2009 cosmic data taking - as CRAFT08_31X_V1 but with different
# tag names to allow append IOV, and DT cabling map corresponding to 2009 configuration (10 FEDs).
# Meanwhile...:
#process.GlobalTag.globaltag = 'MC_31X_V9::All'
process.GlobalTag.globaltag = 'STARTUP31X_V8::All'

process.load('Configuration/StandardSequences/SimL1Emulator_cff')

# OpenHLT specificss
# Define the HLT reco paths
process.load("HLTrigger.Configuration.HLT_FULL_cff")
# Remove the PrescaleService which, in 31X, it is expected once HLT_XXX_cff is imported

process.DQM = cms.Service( "DQM",)
process.DQMStore = cms.Service( "DQMStore",)

# AlCa OpenHLT specific settings

# Define the analyzer modules
process.load("HLTrigger.HLTanalyzers.HLTBitAnalyser_cfi")
process.analyzeThis = cms.Path( process.hltbitanalysis )
process.hltbitanalysis.RunParameters.HistogramFile=OUTPUT_HIST

# pdt
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")

# Schedule the whole thing
process.schedule = cms.Schedule(
process.analyzeThis )

0 comments on commit bdce106

Please sign in to comment.