4.1.2 Writing your own EDAnalyzer
Complete:
Detailed Review status
Goals of this page:
You will learn the first steps of interacting with the CMS framework and how to write a module where you can put your analysis code.
Contents
Introduction
First, a few general words about analysis in the CMSSW framework. Physics analysis proceeds via a series of subsequent steps. Building blocks are identified and more complex objects are built on top of them. For instance, the Higgs search
H -> ZZ -> µµµµ requires:
- identifying muon candidates;
- reconstructing Z candidates starting from muon candidates;
- reconstructing Higgs candidates starting from Z candidates.
This process clearly identifies three products: muon candidates, Z candidates, and a Higgs candidate, as well as three processes to reconstruct them. These are well mapped into three Framework modules (EDProducers) that add into the Event three different products (the candidates collections).
Taking advantage of the modularity provided by the Framework for analysis enhances flexibility and allows separation of the analysis processes into single units that can be reused for different applications.
In this tutorial you will create (and later modify) a new EDAnalyzer module
and a configuration file which will run it. You will create a configuration
fragment include (cfi) file for the module, to contain the default values
for its parameters. You will use the tracer to watch the processing.
#Customize
Customize this document
Set up your Environment
If you are working at Fermilab's cmslpc cluster you need to execute the following command before you start
#tcsh users
source /cvmfs/cms.cern.ch/cmsset_default.csh
At CERN, you can login directly to
lxplus.cern.ch
# make a your working directory
mkdir MYDEMOANALYZER
cd MYDEMOANALYZER
# create a new project area
cmsrel CMSSW_7_4_15
cd CMSSW_7_4_15/src/
cmsenv
Write a Framework Module
First, create a subsystem area. The actual name used for the directory is not important, we'll use
Demo
. From the
src
directory, make and change to the
Demo
area:
mkdir Demo
cd Demo
Note that if you do not create the subsystem area and create you module directly under the
src
directory, your code will not compile. Create the "skeleton" of an EDAnalyzer module (see
SWGuideSkeletonCodeGenerator for more information):
mkedanlzr DemoAnalyzer
Compile the code:
cd DemoAnalyzer
scram b
We'll use a ROOT file as the data source when we run with this module.
The data source is defined in the configuration file. For your convenience, there is already a data file processed in CMSSW_5_3_4, which is fully compatible with CMSSW_7_4_15 release, containing 100 events. It is located at
/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
.
The
mkedanlzr
script has generated an example python configuration file
ConfFile_cfg.py
in the
DemoAnalyzer/python
directory. Open the file using your favorite text editor and change the data source file to as shown below.
And now the configuration file should read like this:
import FWCore.ParameterSet.Config as cms
process = cms.Process("Demo")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
process.source = cms.Source("PoolSource",
# replace 'myfile.root' with the source file you want to use
fileNames = cms.untracked.vstring(
'file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root'
)
)
process.demo = cms.EDAnalyzer('DemoAnalyzer'
)
process.p = cms.Path(process.demo)
Full documentation about the configuration language is in
SWGuideAboutPythonConfigFile.
Run the job
cd ../..
cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
You should see something like this (click on Show result below):
[lxplus402 @ ~/workbook/MYDEMOANALYZER/CMSSW_5_3_5/src]$ cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
11-Mar-2013 02:11:38 CET Initiating request to open file file:/afs/cern.ch/cms/Tutorials/TTJets_RECO_5_3_4.root
11-Mar-2013 02:11:45 CET Successfully opened file file:/afs/cern.ch/cms/Tutorials/TTJets_RECO_5_3_4.root
Begin processing the 1st record. Run 1, Event 261746003, LumiSection 872662 at 11-Mar-2013 02:11:46.878 CET
Begin processing the 2nd record. Run 1, Event 261746009, LumiSection 872662 at 11-Mar-2013 02:11:46.879 CET
Begin processing the 3rd record. Run 1, Event 261746010, LumiSection 872662 at 11-Mar-2013 02:11:46.880 CET
...
Begin processing the 48th record. Run 1, Event 261746140, LumiSection 872662 at 11-Mar-2013 02:11:47.320 CET
Begin processing the 49th record. Run 1, Event 261746141, LumiSection 872662 at 11-Mar-2013 02:11:47.320 CET
Begin processing the 50th record. Run 1, Event 261746142, LumiSection 872662 at 11-Mar-2013 02:11:47.321 CET
11-Mar-2013 02:11:47 CET Closed file file:/afs/cern.ch/cms/Tutorials/TTJets_RECO_5_3_4.root
=============================================
MessageLogger Summary
type category sev module subroutine count total
---- -------------------- -- ---------------- ---------------- ----- -----
1 fileAction -s file_close 1 1
2 fileAction -s file_open 2 2
type category Examples: run/evt run/evt run/evt
---- -------------------- ---------------- ---------------- ----------------
1 fileAction PostEndRun
2 fileAction pre-events pre-events
Severity # Occurrences Total Occurrences
-------- ------------- -----------------
System 3 3
Take notice that at this point, no action has been yet required in the new framework module - no output nor root
files will be produced.
NOTE: You may want to run your analyzer on a data file of your choice instead of the one above.
If you are using CMSSW version X and you are using the data file that is processed with CMSSW version Y, make sure that Y < X. For more info on how to look for data in DAS look at
WorkBookLocatingDataSamples. Also BEFORE you run, make sure the data file you want to read actually exists. Every file in mass storage has a unique Logical File Name (LFN). The list of LFNs for all files in a specified dataset can be obtained from DAS. An example would be
/store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
. There is a mapping between the LFN of a file and its Physical File Name (PFN). The PFN of a file differs from site to site, unlike the LFN. To obtain the PFN of a file from its LFN, use the
edmFileUtil
command.
On lxplus:
[lxplus402 @ ~/workbook/MYDEMOANALYZER/7_4_15/src/Demo/DemoAnalyzer]$ edmFileUtil -d /store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
root://eoscms.cern.ch//eos/cms/store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
On cmslpc:
[jstupak@cmslpc35 DemoAnalyzer]$ edmFileUtil -d /store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
root://cmsxrootd-site.fnal.gov//store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
On lxplus, use the
eos ls
command and the LFN to verify that a file exists in mass storage:
[lxplus402 @ ~/workbook/MYDEMOANALYZER/7_4_15/src/Demo/DemoAnalyzer]$ eos ls -l /store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
-rw-r--r-- 2 phedex zh 418309738 Oct 16 15:52 6CA1C627-246C-E511-8A6A-02163E014147.root
On cmslpc, use the
ls -l /eos/uscms
command and the LFN to verify that a file exists in mass storage:
[jstupak@cmslpc35 DemoAnalyzer]$ ls -l /eos/uscms/store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
-rw-r--r-- 1 cmsprod us_cms 418309738 Dec 2 16:41 /eos/uscms/store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
From any site with xrootd installed (cvmfs) use
xrdfs
with option
stat
in between both put the server site (output of edmFileUtil ) and last argument LFN to verify that a file exist in a given storage:
-bash-4.1$ xrdfs root://eoscms.cern.ch stat /store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
Path: /store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
Id: 5764607523034286847
Size: 418309738
Flags: 16 (IsReadable)
-bash-4.1$ xrdfs root://cmsxrootd-site.fnal.gov stat /store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
Path: /store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root
Id: -3458764513820540908
Size: 418309738
Flags: 16 (IsReadable)
Sometimes one may want to copy the entire file in the local
Demo/DemoAnalyzer/
directory. Remember these files are big so this is not recommended. But, just as a reminder, before you copy the file make sure that data file exists. If the data file is absent try another one by searching in
DAS
. To copy a datafile on lxplus and cmslpc to your local working directory, in both cases the PFN is used. On lxplus, use the
xrdcp
command:
xrdcp root://eoscms.cern.ch//eos/cms/store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root .
On cmslpc, use the
cp /eos/uscms
command and LFN:
cp /eos/uscms/store/data/Run2015D/SingleMuon/MINIAOD/PromptReco-v4/000/258/159/00000/6CA1C627-246C-E511-8A6A-02163E014147.root .
In case you copy the file you will have to change in the configuration file
fileNames
parameter to point to the local copy.
Since the data files are big, you may want to copy only a few events from the file, as explained in
WorkBookDataSamples. If you DO NOT copy the data file to your working area, you can read it directly from mass storage.
Get tracks from the Event
Demo/DemoAnalyzer/plugins/DemoAnalyzer.cc
is the place to put your analysis code. In this example, we only add
very simple statement printing the number of tracks.
Edit
Demo/DemoAnalyzer/plugins/BuildFile.xml
: so that it looks like this
<use name="FWCore/Framework"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="DataFormats/TrackReco"/>
<use name="CommonTools/UtilAlgos"/>
<flags EDM_PLUGIN="1"/>
More on information on the structure of a typical
BuildFile.xml
can be found on
WorkBookBuildFilesIntro.
Edit
Demo/DemoAnalyzer/plugins/DemoAnalyzer.cc
:
- Add the following include statements (together with the other include statements):
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
- Edit the method
analyze
which starts with
DemoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
and put the following lines below
using namespace edm;
Handle<reco::TrackCollection> tracks;
iEvent.getByLabel("generalTracks", tracks);
LogInfo("Demo") << "number of tracks "<<tracks->size();
To see how to access data from a triggered or simulated physics event look at
SWGuideEDMGetDataFromEvent.
To know what other collections (besides
TrackCollection
of reconstructed objects are available, you can have a look to
SWGuideRecoDataTable.
Hold on, I have a question: if I want to add my own stuff in the analyzer, how am I supposed to know
what header file to include and what to add to the BuildFile.xml?
In this case, we want to add tracks. The tracks are part of event content. The event content can be found in
SWGuideRecoDataTable. If you looking for tracks, you will find
generalTracks
in the table, and
its collection name which you will need in the code as shown above. If you follow the link to the collection
name, you will find the class documentation of the object. You will see that its header file is
"DataFormats/TrackReco/interface/Track.h" and you will need to include it in your analyzer.
As it resides in
DataFormats/TrackReco
package you will need to add it to your BuildFile.xml.

: Many links in
SWGuideRecoDataTable point to a non-existing version in the class documentation. We are working to fix it.
To print out the information that we added in the analyzer, we need to replace the line
process.load("FWCore.MessageService.MessageLogger_cfi")
) in file
ConfFile_cfg.py
with the segment below
# initialize MessageLogger and output report
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.threshold = 'INFO'
process.MessageLogger.categories.append('Demo')
process.MessageLogger.cerr.INFO = cms.untracked.PSet(
limit = cms.untracked.int32(-1)
)
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
More information on the
MessageLogger
can be found on
SWGuideMessageLogger.
Now, compile the code and run the job again:
scram b
cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
The output should look something like this:
[lxplus404 @ ~/workbook/MYDEMOANALYZER/CMSSW_7_4_15/src]$ cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
31-Dec-2015 00:09:29 CET Initiating request to open file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
%MSG-i Root_Information: file_open TClass::Init() 31-Dec-2015 00:09:39 CET pre-events
no dictionary for class reco::LeafRefCandidateT<edm::Ref<vector<reco::Track>,reco::Track,edm::refhelper::FindUsingAdvance<vector<reco::Track>,reco::Track> > > is available
%MSG
31-Dec-2015 00:09:39 CET Successfully opened file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
Begin processing the 1st record. Run 1, Event 19279309, LumiSection 64278 at 31-Dec-2015 00:09:46.481 CET
%MSG-i GetByLabelWithoutRegistration: DemoAnalyzer:demo 31-Dec-2015 00:09:46 CET Run: 1 Event: 19279309
::getByLabel without corresponding call to consumes or mayConsumes for this module.
type: std::vector<reco::Track>
module label: generalTracks
product instance name: ''
process name: ''
%MSG
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:09:46 CET Run: 1 Event: 19279309
number of tracks 1051
%MSG
Begin processing the 2nd record. Run 1, Event 19279311, LumiSection 64278 at 31-Dec-2015 00:09:46.535 CET
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:09:46 CET Run: 1 Event: 19279311
number of tracks 919
%MSG
Begin processing the 3rd record. Run 1, Event 19279312, LumiSection 64278 at 31-Dec-2015 00:09:46.549 CET
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:09:46 CET Run: 1 Event: 19279312
number of tracks 402
...
%MSG
Begin processing the 98th record. Run 1, Event 19280566, LumiSection 64282 at 31-Dec-2015 00:09:47.098 CET
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:09:47 CET Run: 1 Event: 19280566
number of tracks 297
%MSG
Begin processing the 99th record. Run 1, Event 19280570, LumiSection 64282 at 31-Dec-2015 00:09:47.099 CET
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:09:47 CET Run: 1 Event: 19280570
number of tracks 533
%MSG
Begin processing the 100th record. Run 1, Event 19280577, LumiSection 64282 at 31-Dec-2015 00:09:47.100 CET
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:09:47 CET Run: 1 Event: 19280577
number of tracks 321
%MSG
31-Dec-2015 00:09:47 CET Closed file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
TrigReport ---------- Event Summary ------------
TrigReport Events total = 100 passed = 100 failed = 0
TrigReport ---------- Path Summary ------------
TrigReport Trig Bit# Executed Passed Failed Error Name
TrigReport 1 0 100 100 0 0 p
TrigReport -------End-Path Summary ------------
TrigReport Trig Bit# Executed Passed Failed Error Name
TrigReport ---------- Modules in Path: p ------------
TrigReport Trig Bit# Visited Passed Failed Error Name
TrigReport 1 0 100 100 0 0 demo
TrigReport ---------- Module Summary ------------
TrigReport Visited Executed Passed Failed Error Name
TrigReport 100 100 100 0 0 demo
TrigReport 100 100 100 0 0 TriggerResults
TimeReport ---------- Event Summary ---[sec]----
TimeReport event loop CPU/event = 0.004178
TimeReport event loop Real/event = 0.007112
TimeReport sum Streams Real/event = 0.006155
TimeReport efficiency CPU/Real/thread = 0.587531
TimeReport ---------- Path Summary ---[Real sec]----
TimeReport per event per exec Name
TimeReport 0.005370 0.005370 p
TimeReport per event per exec Name
TimeReport -------End-Path Summary ---[Real sec]----
TimeReport per event per exec Name
TimeReport per event per exec Name
TimeReport ---------- Modules in Path: p ---[Real sec]----
TimeReport per event per visit Name
TimeReport 0.000226 0.000226 demo
TimeReport per event per visit Name
TimeReport ---------- Module Summary ---[Real sec]----
TimeReport per event per exec per visit Name
TimeReport 0.000021 0.000021 0.000021 TriggerResults
TimeReport 0.000226 0.000226 0.000226 demo
TimeReport per event per exec per visit Name
T---Report end!
=============================================
MessageLogger Summary
type category sev module subroutine count total
---- -------------------- -- ---------------- ---------------- ----- -----
1 fileAction -s file_close 1 1
2 fileAction -s file_open 2 2
type category Examples: run/evt run/evt run/evt
---- -------------------- ---------------- ---------------- ----------------
1 fileAction PostEndRun
2 fileAction pre-events pre-events
Severity # Occurrences Total Occurrences
-------- ------------- -----------------
System 3 3
Add parameters to our module
In this section, we determine the minimum number of tracks for an event to be displayed, and make it so we can change this number in the config and not need to recompile.
- Edit the
Demo/DemoAnalyzer/plugins/DemoAnalyzer.cc
file. Add a new member data line to the DemoAnalyzer class:
private:
// ----------member data ---------------------------
unsigned int minTracks_;
DemoAnalyzer::DemoAnalyzer(const edm::ParameterSet& iConfig)
{
//now do what ever initialization is needed
}
to set the value of minTracks_ from a parameter. It should look like this (Note ":" colon at the end of
.....iConfig)
)
DemoAnalyzer::DemoAnalyzer(const edm::ParameterSet& iConfig) :
minTracks_(iConfig.getUntrackedParameter<unsigned int>("minTracks",0))
{
//now do what ever initialization is needed
}
DemoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
method to use minTracks_ to decide when to print the number of tracks:
if( minTracks_ <= tracks->size() ) {
LogInfo("Demo") << "number of tracks "<<tracks->size();
}
So now this segment will look like this( Note: the first
LogInfo("Demo")....
has been commented, since now we want
"number of tracks"
to be printed
only if
minTracks_
is greater than a certain number as you will see below)
DemoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
using namespace edm;
Handle<reco::TrackCollection> tracks;
iEvent.getByLabel("generalTracks", tracks);
//LogInfo("Demo") << "number of tracks "<<tracks->size();
if( minTracks_ <= tracks->size() ) {
LogInfo("Demo") << "number of tracks "<<tracks->size();
}
#ifdef THIS_IS_AN_EVENT_EXAMPLE
Handle<ExampleData> pIn;
iEvent.getByLabel("example",pIn);
#endif
#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
ESHandle<SetupData> pSetup;
iSetup.get<SetupRecord>().get(pSetup);
#endif
}
Also to see if actually
minTracks_
gets used, replace the line
process.demo = cms.EDAnalyzer('DemoAnalyzer'
) in
ConfFile_cfg.py
by the segment below to use a value of say
minTracks_ = 1000 .
process.demo = cms.EDAnalyzer('DemoAnalyzer',
minTracks = cms.untracked.uint32(1000)
)
- Compile the code.
scram b
NOTE: whenever you make changes in the code of your analyzer you have to do
scram b
The output should be something like this (Only events with tracks greater than 1000 get printed). Click here:
[lxplus404 @ ~/workbook/MYDEMOANALYZER/CMSSW_7_4_15/src]$ cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
31-Dec-2015 00:36:47 CET Initiating request to open file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
%MSG-i Root_Information: file_open TClass::Init() 31-Dec-2015 00:36:53 CET pre-events
no dictionary for class reco::LeafRefCandidateT<edm::Ref<vector<reco::Track>,reco::Track,edm::refhelper::FindUsingAdvance<vector<reco::Track>,reco::Track> > > is available
%MSG
31-Dec-2015 00:36:53 CET Successfully opened file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
Begin processing the 1st record. Run 1, Event 19279309, LumiSection 64278 at 31-Dec-2015 00:36:56.202 CET
%MSG-i GetByLabelWithoutRegistration: DemoAnalyzer:demo 31-Dec-2015 00:36:56 CET Run: 1 Event: 19279309
::getByLabel without corresponding call to consumes or mayConsumes for this module.
type: std::vector<reco::Track>
module label: generalTracks
product instance name: ''
process name: ''
%MSG
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:36:56 CET Run: 1 Event: 19279309
number of tracks 1051
%MSG
Begin processing the 2nd record. Run 1, Event 19279311, LumiSection 64278 at 31-Dec-2015 00:36:56.212 CET
Begin processing the 3rd record. Run 1, Event 19279312, LumiSection 64278 at 31-Dec-2015 00:36:56.215 CET
Begin processing the 4th record. Run 1, Event 19279316, LumiSection 64278 at 31-Dec-2015 00:36:56.216 CET
Begin processing the 5th record. Run 1, Event 19279318, LumiSection 64278 at 31-Dec-2015 00:36:56.218 CET
Begin processing the 6th record. Run 1, Event 19279319, LumiSection 64278 at 31-Dec-2015 00:36:56.220 CET
Begin processing the 7th record. Run 1, Event 19279324, LumiSection 64278 at 31-Dec-2015 00:36:56.223 CET
Begin processing the 8th record. Run 1, Event 19279326, LumiSection 64278 at 31-Dec-2015 00:36:56.224 CET
Begin processing the 9th record. Run 1, Event 19279341, LumiSection 64278 at 31-Dec-2015 00:36:56.226 CET
Begin processing the 10th record. Run 1, Event 19279353, LumiSection 64278 at 31-Dec-2015 00:36:56.228 CET
Begin processing the 11th record. Run 1, Event 19279354, LumiSection 64278 at 31-Dec-2015 00:36:56.230 CET
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:36:56 CET Run: 1 Event: 19279354
number of tracks 1166
%MSG
Begin processing the 12th record. Run 1, Event 19279358, LumiSection 64278 at 31-Dec-2015 00:36:56.233 CET
Begin processing the 13th record. Run 1, Event 19279360, LumiSection 64278 at 31-Dec-2015 00:36:56.235 CET
Begin processing the 14th record. Run 1, Event 19279362, LumiSection 64278 at 31-Dec-2015 00:36:56.237 CET
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 00:36:56 CET Run: 1 Event: 19279362
number of tracks 1314
...
A look at demoanalyzer_cfi.py file
There is file named
CfiFile_cfi.py
in the
Demo/DemoAnalyzer/python
directory. A
_cfi.py
file contains default values of all the required parameters of a package. Rather than setting all the analyzer (we also call it module) parameters in your
ConfFile_cfg.py
file, one can define all of them in the
CfiFile_cfi.py
file. These parameters can then be reset (or overridden) by giving them a value you want in
ConfFile_cfg.py
. However, you will have to include
CfiFile_cfi.py
in
ConfFile_cfg.py
.
To explain it more clearly, I can put the default value of minTracks=0 in
CfiFile_cfi.py
and override it to say
minTracks=50
in
ConfFile_cfg.py
. Thus if there are, say 10 parameters defined with their default values in
CfiFile_cfi.py
and I want to change two of those to some other value, I can do that in
ConfFile_cfg.py
WITHOUT changing the file
CfiFile_cfi.py
that has default values.
The
mkedanlzr
script has created a
CfiFile_cfi.py
file in the
python
directory as mentioned above.
- Add the newly created parameter
minTracks
and its default value to this CfiFile_cfi.py
file so that it its content looks like this:
import FWCore.ParameterSet.Config as cms
demo = cms.EDAnalyzer('DemoAnalyzer',
minTracks=cms.untracked.uint32(0)
)
- Edit the
ConfFile_cfg.py
file and REPLACE
process.demo = cms.EDAnalyzer('DemoAnalyzer',
minTracks=cms.untracked.uint32(1000)
)
WITH (these are 2 different lines, so should be on seperate lines each
process.load("Demo.DemoAnalyzer.CfiFile_cfi")
process.demo.minTracks=1000
Here we use the default parameter values, and reset only the minTracks parameter to a different value.
cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
You will see the same output as before EXCEPT that now you are overriding the default value of minTracks=0 defined in
CfiFile_cfi.py
with a value you choose (in this case
minTracks=1000
) in
ConfFile_cfg.py
. In this case the file with default parameters
CfiFile_cfi.py
remains untouched.
See what is available in the Event
1. Edit the configuration file,
ConfFile_cfg.py
and add the EventContentAnalyzer module. The module EventContentAnalyzer dumps all products stored in an event to the screen. One can add it to the path as follows:
process.dump=cms.EDAnalyzer('EventContentAnalyzer')
Also
REPLACE the line (which should still be the last line)
process.p = cms.Path(process.demo)
WITH
process.p = cms.Path(process.demo*process.dump)
In this case you probably want to run over only one event, change the number of events to 1 ( default is -1 which means all events)
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
2. Run the job.
cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
The output should be something like this:
[lxplus404 @ ~/workbook/MYDEMOANALYZER/CMSSW_7_4_15/src]$ cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
31-Dec-2015 01:00:58 CET Initiating request to open file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
%MSG-i Root_Information: file_open TClass::Init() 31-Dec-2015 01:01:04 CET pre-events
no dictionary for class reco::LeafRefCandidateT<edm::Ref<vector<reco::Track>,reco::Track,edm::refhelper::FindUsingAdvance<vector<reco::Track>,reco::Track> > > is available
%MSG
31-Dec-2015 01:01:04 CET Successfully opened file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
Begin processing the 1st record. Run 1, Event 19279309, LumiSection 64278 at 31-Dec-2015 01:01:06.967 CET
%MSG-i GetByLabelWithoutRegistration: DemoAnalyzer:demo 31-Dec-2015 01:01:06 CET Run: 1 Event: 19279309
::getByLabel without corresponding call to consumes or mayConsumes for this module.
type: std::vector<reco::Track>
module label: generalTracks
product instance name: ''
process name: ''
%MSG
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 01:01:06 CET Run: 1 Event: 19279309
number of tracks 1051
%MSG
++Event 1 contains 383 products with friendlyClassName, moduleLabel, productInstanceName and processName:
++BeamSpotOnlines "scalersRawToDigi" "" "RECO" (productId = 4:1)
++CaloTowersSorted "towerMaker" "" "RECO" (productId = 4:15)
...
++recoVertexs "offlinePrimaryVertices" "" "RECO" (productId = 4:1026)
++recoVertexs "offlinePrimaryVerticesWithBS" "" "RECO" (productId = 4:1028)
++triggerTriggerEvent "hltTriggerSummaryAOD" "" "HLT" (productId = 3:1414)
++uintedmValueMap "muons" "cosmicsVeto" "RECO" (productId = 4:1032)
31-Dec-2015 01:01:07 CET Closed file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
Summary for key being the concatenation of friendlyClassName, moduleLabel, productInstanceName and processName
1 occurrences of key BeamSpotOnlines + "scalersRawToDigi" + "" "RECO"
1 occurrences of key CaloTowersSorted + "towerMaker" + "" "RECO"
1 occurrences of key CastorRecHitsSorted + "castorreco" + "" "RECO"
...
1 occurrences of key recoVertexs + "offlinePrimaryVerticesWithBS" + "" "RECO"
1 occurrences of key triggerTriggerEvent + "hltTriggerSummaryAOD" + "" "HLT"
1 occurrences of key uintedmValueMap + "muons" + "cosmicsVeto" "RECO"
TrigReport ---------- Event Summary ------------
TrigReport Events total = 1 passed = 1 failed = 0
TrigReport ---------- Path Summary ------------
TrigReport Trig Bit# Executed Passed Failed Error Name
TrigReport 1 0 1 1 0 0 p
TrigReport -------End-Path Summary ------------
TrigReport Trig Bit# Executed Passed Failed Error Name
TrigReport ---------- Modules in Path: p ------------
TrigReport Trig Bit# Visited Passed Failed Error Name
TrigReport 1 0 1 1 0 0 demo
TrigReport 1 1 1 1 0 0 dump
TrigReport ---------- Module Summary ------------
TrigReport Visited Executed Passed Failed Error Name
TrigReport 1 1 1 0 0 demo
TrigReport 1 1 1 0 0 dump
TrigReport 1 1 1 0 0 TriggerResults
TimeReport ---------- Event Summary ---[sec]----
TimeReport event loop CPU/event = 0.123668
TimeReport event loop Real/event = 0.124931
TimeReport sum Streams Real/event = 0.052483
TimeReport efficiency CPU/Real/thread = 0.989889
TimeReport ---------- Path Summary ---[Real sec]----
TimeReport per event per exec Name
TimeReport 0.048820 0.048820 p
TimeReport per event per exec Name
TimeReport -------End-Path Summary ---[Real sec]----
TimeReport per event per exec Name
TimeReport per event per exec Name
TimeReport ---------- Modules in Path: p ---[Real sec]----
TimeReport per event per visit Name
TimeReport 0.000309 0.000309 demo
TimeReport 0.038008 0.038008 dump
TimeReport per event per visit Name
TimeReport ---------- Module Summary ---[Real sec]----
TimeReport per event per exec per visit Name
TimeReport 0.000080 0.000080 0.000080 TriggerResults
TimeReport 0.000309 0.000309 0.000309 demo
TimeReport 0.038008 0.038008 0.038008 dump
TimeReport per event per exec per visit Name
T---Report end!
=============================================
MessageLogger Summary
type category sev module subroutine count total
---- -------------------- -- ---------------- ---------------- ----- -----
1 EventContent -s EventContentAnal 384 384
2 EventContent -s EventContentAnal 384 384
3 fileAction -s file_close 1 1
4 fileAction -s file_open 2 2
type category Examples: run/evt run/evt run/evt
---- -------------------- ---------------- ---------------- ----------------
1 EventContent 1/19279309 1/19279309 1/19279309
2 EventContent PostEndRun PostEndRun PostEndRun
3 fileAction PostEndRun
4 fileAction pre-events pre-events
Severity # Occurrences Total Occurrences
-------- ------------- -----------------
System 771 771
3. A different way of looking at the content of
ROOT file is using the command line tool
edmDumpEventContent
. Compare that output with the result of the above example with the
EventContentAnalyzer
. So you would know what is available in your root file that you want to access.
To do this do:
edmDumpEventContent /afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
For example if your
edmDumpEventContent
looks like this:
[lxplus404 @ ~/workbook/MYDEMOANALYZER/CMSSW_5_3_5/src]$ edmDumpEventContent /afs/cern.ch/cms/Tutorials/TTJets_RECO_5_3_4.root
Type Module Label Process
----------------------------------------------------------------------------------------------
LHEEventProduct "source" "" "LHE"
GenEventInfoProduct "generator" "" "SIM"
edm::HepMCProduct "generator" "" "SIM"
edm::TriggerResults "TriggerResults" "" "SIM"
vector<SimTrack> "g4SimHits" "" "SIM"
vector<SimVertex> "g4SimHits" "" "SIM"
vector<int> "genParticles" "" "SIM"
vector<reco::GenJet> "ak5GenJets" "" "SIM"
vector<reco::GenJet> "ak7GenJets" "" "SIM"
vector<reco::GenJet> "iterativeCone5GenJets" "" "SIM"
vector<reco::GenJet> "kt4GenJets" "" "SIM"
vector<reco::GenJet> "kt6GenJets" "" "SIM"
vector<reco::GenMET> "genMetCalo" "" "SIM"
vector<reco::GenMET> "genMetCaloAndNonPrompt" "" "SIM"
vector<reco::GenMET> "genMetTrue" "" "SIM"
vector<reco::GenParticle> "genParticles" "" "SIM"
FEDRawDataCollection "rawDataCollector" "" "HLT"
L1GlobalTriggerObjectMapRecord "hltL1GtObjectMap" "" "HLT"
L1GlobalTriggerReadoutRecord "hltGtDigis" "" "HLT"
L1MuGMTReadoutCollection "hltGtDigis" "" "HLT"
MuonDigiCollection<CSCDetId,CSCALCTDigi> "hltMuonCSCDigis" "MuonCSCALCTDigi" "HLT"
MuonDigiCollection<CSCDetId,CSCCLCTDigi> "hltMuonCSCDigis" "MuonCSCCLCTDigi" "HLT"
MuonDigiCollection<CSCDetId,CSCComparatorDigi> "hltMuonCSCDigis" "MuonCSCComparatorDigi" "HLT"
MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> "hltMuonCSCDigis" "MuonCSCCorrelatedLCTDigi" "HLT"
MuonDigiCollection<CSCDetId,CSCDCCFormatStatusDigi> "hltMuonCSCDigis" "MuonCSCDCCFormatStatusDigi" "HLT"
MuonDigiCollection<CSCDetId,CSCRPCDigi> "hltMuonCSCDigis" "MuonCSCRPCDigi" "HLT"
MuonDigiCollection<CSCDetId,CSCStripDigi> "hltMuonCSCDigis" "MuonCSCStripDigi" "HLT"
MuonDigiCollection<CSCDetId,CSCWireDigi> "hltMuonCSCDigis" "MuonCSCWireDigi" "HLT"
MuonDigiCollection<DTChamberId,DTLocalTrigger> "hltMuonDTDigis" "" "HLT"
MuonDigiCollection<DTLayerId,DTDigi> "hltMuonDTDigis" "" "HLT"
MuonDigiCollection<DTLayerId,DTDigiSimLink> "simMuonDTDigis" "" "HLT"
MuonDigiCollection<RPCDetId,RPCDigi> "hltMuonRPCDigis" "" "HLT"
RPCRawDataCounts "hltMuonRPCDigis" "" "HLT"
double "hltAntiKT5CaloJets" "rho" "HLT"
double "hltAntiKT5PFJets" "rho" "HLT"
double "hltAntiKT5CaloJets" "sigma" "HLT"
double "hltAntiKT5PFJets" "sigma" "HLT"
edm::AssociationMap<edm::OneToMany<vector<L2MuonTrajectorySeed>,vector<L2MuonTrajectorySeed>,unsigned int> > "hltL2Muons" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL2Muons" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3MuonsIOHit" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3MuonsOIHit" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3MuonsOIState" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3TkTracksFromL2IOHit" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3TkTracksFromL2OIHit" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3TkTracksFromL2OIState" "" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3MuonsIOHit" "L2Seeded" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3MuonsOIHit" "L2Seeded" "HLT"
edm::AssociationMap<edm::OneToOne<vector<Trajectory>,vector<reco::Track>,unsigned short> > "hltL3MuonsOIState" "L2Seeded" "HLT"
edm::AssociationMap<edm::OneToOne<vector<reco::Track>,vector<reco::Track>,unsigned int> > "hltL2Muons" "" "HLT"
edm::AssociationVector<edm::RefToBaseProd<reco::Jet>,vector<edm::RefVector<vector<reco::Track>,reco::Track,edm::refhelper::FindUsingAdvance<vector<reco::Track>,reco::Track> > >,edm::RefToBase<reco::Jet>,unsigned int,edm::helper::AssociationIdenticalKeyReference> "hltPFTauJetTracksAssociator" "" "HLT"
edm::DetSetVector<RPCDigiSimLink> "simMuonRPCDigis" "RPCDigiSimLink" "HLT"
edm::DetSetVector<StripDigiSimLink> "simMuonCSCDigis" "MuonCSCStripDigiSimLinks" "HLT"
edm::DetSetVector<StripDigiSimLink> "simMuonCSCDigis" "MuonCSCWireDigiSimLinks" "HLT"
edm::LazyGetter<SiStripCluster> "hltSiStripRawToClustersFacility" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL2Muons" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3MuonsIOHit" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3MuonsOIHit" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3MuonsOIState" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3TkTracksFromL2IOHit" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3TkTracksFromL2OIHit" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3TkTracksFromL2OIState" "" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3MuonsIOHit" "L2Seeded" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3MuonsOIHit" "L2Seeded" "HLT"
edm::OwnVector<TrackingRecHit,edm::ClonePolicy<TrackingRecHit> > "hltL3MuonsOIState" "L2Seeded" "HLT"
edm::RangeMap<CSCDetId,edm::OwnVector<CSCRecHit2D,edm::ClonePolicy<CSCRecHit2D> >,edm::ClonePolicy<CSCRecHit2D> > "hltCsc2DRecHits" "" "HLT"
edm::RangeMap<CSCDetId,edm::OwnVector<CSCSegment,edm::ClonePolicy<CSCSegment> >,edm::ClonePolicy<CSCSegment> > "hltCscSegments" "" "HLT"
edm::RangeMap<DTChamberId,edm::OwnVector<DTRecSegment4D,edm::ClonePolicy<DTRecSegment4D> >,edm::ClonePolicy<DTRecSegment4D> > "hltDt4DSegments" "" "HLT"
edm::RangeMap<RPCDetId,edm::OwnVector<RPCRecHit,edm::ClonePolicy<RPCRecHit> >,edm::ClonePolicy<RPCRecHit> > "hltRpcRecHits" "" "HLT"
edm::RefVector<vector<reco::Track>,reco::Track,edm::refhelper::FindUsingAdvance<vector<reco::Track>,reco::Track> > "hltBSoftMuonMu5L3" "" "HLT"
edm::SortedCollection<CaloTower,edm::StrictWeakOrdering<CaloTower> > "hltTowerMakerForAll" "" "HLT"
edm::SortedCollection<CaloTower,edm::StrictWeakOrdering<CaloTower> > "hltTowerMakerForMuons" "" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltEcalRecHitAll" "EcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltEcalRecHitAll" "EcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaEBUncalibrator" "etaEcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaEEUncalibrator" "etaEcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaRecHitsFilterEBonly" "etaEcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaEBUncalibrator" "etaEcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaEEUncalibrator" "etaEcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaRecHitsFilterEEonly" "etaEcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaRecHitsFilterEBonly" "etaEcalRecHitsES" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaEtaRecHitsFilterEEonly" "etaEcalRecHitsES" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPhiSymStream" "phiSymEcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPhiSymUncalibrator" "phiSymEcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPhiSymStream" "phiSymEcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPhiSymUncalibrator" "phiSymEcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0EBUncalibrator" "pi0EcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0EEUncalibrator" "pi0EcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0RecHitsFilterEBonly" "pi0EcalRecHitsEB" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0EBUncalibrator" "pi0EcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0EEUncalibrator" "pi0EcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0RecHitsFilterEEonly" "pi0EcalRecHitsEE" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0RecHitsFilterEBonly" "pi0EcalRecHitsES" "HLT"
edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "hltAlCaPi0RecHitsFilterEEonly" "pi0EcalRecHitsES" "HLT"
edm::SortedCollection<ZDCDataFrame,edm::StrictWeakOrdering<ZDCDataFrame> > "simHcalUnsuppressedDigis" "" "HLT"
edm::TriggerResults "TriggerResults" "" "HLT"
edmNew::DetSetVector<SiPixelCluster> "hltSiPixelClusters" "" "HLT"
reco::BeamSpot "hltOnlineBeamSpot" "" "HLT"
vector<DcsStatus> "hltScalersRawToDigi" "" "HLT"
vector<L1MuGMTCand> "hltGtDigis" "" "HLT"
vector<L2MuonTrajectorySeed> "hltL2MuonSeeds" "" "HLT"
vector<L3MuonTrajectorySeed> "hltL3TrajSeedIOHit" "" "HLT"
vector<L3MuonTrajectorySeed> "hltL3TrajSeedOIHit" "" "HLT"
vector<L3MuonTrajectorySeed> "hltL3TrajSeedOIState" "" "HLT"
vector<L3MuonTrajectorySeed> "hltL3TrajectorySeed" "" "HLT"
vector<LumiScalers> "hltScalersRawToDigi" "" "HLT"
vector<PileupSummaryInfo> "addPileupInfo" "" "HLT"
vector<TrackCandidate> "hltL3TrackCandidateFromL2IOHit" "" "HLT"
vector<TrackCandidate> "hltL3TrackCandidateFromL2OIHit" "" "HLT"
vector<TrackCandidate> "hltL3TrackCandidateFromL2OIState" "" "HLT"
vector<double> "hltAntiKT5CaloJets" "rhos" "HLT"
vector<double> "hltAntiKT5PFJets" "rhos" "HLT"
vector<double> "hltAntiKT5CaloJets" "sigmas" "HLT"
vector<double> "hltAntiKT5PFJets" "sigmas" "HLT"
vector<l1extra::L1EmParticle> "hltL1extraParticles" "Isolated" "HLT"
vector<l1extra::L1EmParticle> "hltL1extraParticles" "NonIsolated" "HLT"
vector<l1extra::L1EtMissParticle> "hltL1extraParticles" "MET" "HLT"
vector<l1extra::L1EtMissParticle> "hltL1extraParticles" "MHT" "HLT"
vector<l1extra::L1HFRings> "hltL1extraParticles" "" "HLT"
vector<l1extra::L1JetParticle> "hltL1extraParticles" "Central" "HLT"
vector<l1extra::L1JetParticle> "hltL1extraParticles" "Forward" "HLT"
vector<l1extra::L1JetParticle> "hltL1extraParticles" "Tau" "HLT"
vector<l1extra::L1MuonParticle> "hltL1extraParticles" "" "HLT"
vector<reco::CaloJet> "hltAntiKT5CaloJets" "" "HLT"
vector<reco::CaloJet> "hltCaloJetCorrected" "" "HLT"
vector<reco::CaloJet> "hltCaloJetCorrectedRegional" "" "HLT"
vector<reco::CaloJet> "hltL2TauJets" "" "HLT"
vector<reco::CaloMET> "hltMet" "" "HLT"
vector<reco::Electron> "hltPixelMatch3HitElectronsActivity" "" "HLT"
vector<reco::Electron> "hltPixelMatch3HitElectronsL1Seeded" "" "HLT"
vector<reco::Electron> "hltPixelMatchElectronsActivity" "" "HLT"
vector<reco::Electron> "hltPixelMatchElectronsL1Seeded" "" "HLT"
vector<reco::IsolatedPixelTrackCandidate> "hltHITIPTCorrectorHB" "" "HLT"
vector<reco::IsolatedPixelTrackCandidate> "hltHITIPTCorrectorHE" "" "HLT"
vector<reco::IsolatedPixelTrackCandidate> "hltIsolPixelTrackProdHB" "" "HLT"
vector<reco::IsolatedPixelTrackCandidate> "hltIsolPixelTrackProdHE" "" "HLT"
vector<reco::MuonTrackLinks> "hltL3MuonsIOHit" "" "HLT"
vector<reco::MuonTrackLinks> "hltL3MuonsLinksCombination" "" "HLT"
vector<reco::MuonTrackLinks> "hltL3MuonsOIHit" "" "HLT"
vector<reco::MuonTrackLinks> "hltL3MuonsOIState" "" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "AddedMuonsAndHadrons" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "CleanedCosmicsMuons" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "CleanedFakeMuons" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "CleanedHF" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "CleanedPunchThroughMuons" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "CleanedPunchThroughNeutralHadrons" "HLT"
vector<reco::PFCandidate> "hltParticleFlow" "CleanedTrackerAndGlobalMuons" "HLT"
vector<reco::PFJet> "hltAntiKT5PFJets" "" "HLT"
vector<reco::PFTauTagInfo> "hltPFTauTagInfo" "" "HLT"
vector<reco::RecoChargedCandidate> "hltL2MuonCandidates" "" "HLT"
vector<reco::RecoChargedCandidate> "hltL2MuonCandidatesNoVtx" "" "HLT"
vector<reco::RecoChargedCandidate> "hltL3MuonCandidates" "" "HLT"
vector<reco::RecoChargedCandidate> "hltMuTrackJpsiCtfTrackCands" "" "HLT"
vector<reco::RecoChargedCandidate> "hltMuTrackJpsiPixelTrackCands" "" "HLT"
vector<reco::RecoEcalCandidate> "hltL1SeededRecoEcalCandidate" "" "HLT"
vector<reco::RecoEcalCandidate> "hltRecoEcalSuperClusterActivityCandidate" "" "HLT"
vector<reco::RecoEcalCandidate> "hltRecoEcalSuperClusterActivityCandidateSC4" "" "HLT"
vector<reco::Track> "hltL2Muons" "" "HLT"
vector<reco::Track> "hltL3Muons" "" "HLT"
vector<reco::Track> "hltL3MuonsIOHit" "" "HLT"
vector<reco::Track> "hltL3MuonsOIHit" "" "HLT"
vector<reco::Track> "hltL3MuonsOIState" "" "HLT"
vector<reco::Track> "hltL3TkFromL2OICombination" "" "HLT"
vector<reco::Track> "hltL3TkTracksFromL2" "" "HLT"
vector<reco::Track> "hltL3TkTracksFromL2IOHit" "" "HLT"
vector<reco::Track> "hltL3TkTracksFromL2OIHit" "" "HLT"
vector<reco::Track> "hltL3TkTracksFromL2OIState" "" "HLT"
vector<reco::Track> "hltL3MuonsIOHit" "L2Seeded" "HLT"
vector<reco::Track> "hltL3MuonsOIHit" "L2Seeded" "HLT"
vector<reco::Track> "hltL3MuonsOIState" "L2Seeded" "HLT"
vector<reco::Track> "hltL2Muons" "UpdatedAtVtx" "HLT"
vector<reco::TrackExtra> "hltL2Muons" "" "HLT"
vector<reco::TrackExtra> "hltL3MuonsIOHit" "" "HLT"
vector<reco::TrackExtra> "hltL3MuonsOIHit" "" "HLT"
vector<reco::TrackExtra> "hltL3MuonsOIState" "" "HLT"
vector<reco::TrackExtra> "hltL3TkTracksFromL2IOHit" "" "HLT"
vector<reco::TrackExtra> "hltL3TkTracksFromL2OIHit" "" "HLT"
vector<reco::TrackExtra> "hltL3TkTracksFromL2OIState" "" "HLT"
vector<reco::TrackExtra> "hltL3MuonsIOHit" "L2Seeded" "HLT"
vector<reco::TrackExtra> "hltL3MuonsOIHit" "L2Seeded" "HLT"
vector<reco::TrackExtra> "hltL3MuonsOIState" "L2Seeded" "HLT"
trigger::TriggerEvent "hltTriggerSummaryAOD" "" "HLT"
trigger::TriggerEventWithRefs "hltTriggerSummaryRAW" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltL1MatchedLooseIsoPFTau20" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltL1sDoubleTauJet44erorDoubleJetC64" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltL1sL1ETM36or40" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltL1sL1SingleEG12" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltL1sMu12Eta2p1ETM20" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltMu8Ele17CaloIdTCaloIsoVLPixelMatchFilter" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltOverlapFilterIsoEle20LooseIsoPFTau20L1Jet" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltPFTau20" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltPFTau20Track" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltPFTau20TrackLooseIso" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltPFTau35" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltPFTau35Track" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltPFTau35TrackPt20" "" "HLT"
trigger::TriggerFilterObjectWithRefs "hltPFTau35TrackPt20LooseIso" "" "HLT"
EBDigiCollection "selectDigi" "selectedEcalEBDigiCollection" "RECO"
EEDigiCollection "selectDigi" "selectedEcalEEDigiCollection" "RECO"
EcalTrigPrimCompactColl "ecalCompactTrigPrim" "" "RECO"
HcalNoiseSummary "hcalnoise" "" "RECO"
L1GlobalTriggerObjectMaps "l1L1GtObjectMap" "" "RECO"
L1GlobalTriggerReadoutRecord "gtDigis" "" "RECO"
L1MuGMTReadoutCollection "gtDigis" "" "RECO"
double "fixedGridRhoAll" "" "RECO"
double "fixedGridRhoFastjetAll" "" "RECO"
double "ak5CaloJets" "rho" "RECO"
double "ak5PFJets" "rho" "RECO"
double "ak5TrackJets" "rho" "RECO"
double "ak7BasicJets" "rho" "RECO"
double "ak7CaloJets" "rho" "RECO"
double "ak7PFJets" "rho" "RECO"
double "iterativeCone5CaloJets" "rho" "RECO"
double "iterativeCone5PFJets" "rho" "RECO"
double "kt4CaloJets" "rho" "RECO"
double "kt4PFJets" "rho" "RECO"
double "kt4TrackJets" "rho" "RECO"
double "kt6CaloJets" "rho" "RECO"
double "kt6CaloJetsCentral" "rho" "RECO"
double "kt6PFJets" "rho" "RECO"
double "kt6PFJetsCentralChargedPileUp" "rho" "RECO"
double "kt6PFJetsCentralNeutral" "rho" "RECO"
double "kt6PFJetsCentralNeutralTight" "rho" "RECO"
double "ak5CaloJets" "sigma" "RECO"
double "ak5PFJets" "sigma" "RECO"
double "ak5TrackJets" "sigma" "RECO"
double "ak7BasicJets" "sigma" "RECO"
double "ak7CaloJets" "sigma" "RECO"
double "ak7PFJets" "sigma" "RECO"
double "iterativeCone5CaloJets" "sigma" "RECO"
double "iterativeCone5PFJets" "sigma" "RECO"
double "kt4CaloJets" "sigma" "RECO"
double "kt4PFJets" "sigma" "RECO"
double "kt4TrackJets" "sigma" "RECO"
double "kt6CaloJets" "sigma" "RECO"
double "kt6CaloJetsCentral" "sigma" "RECO"
double "kt6PFJets" "sigma" "RECO"
double "kt6PFJetsCentralChargedPileUp" "sigma" "RECO"
double "kt6PFJetsCentralNeutral" "sigma" "RECO"
double "kt6PFJetsCentralNeutralTight" "sigma" "RECO"
edm::AssociationMap<edm::OneToOne<vector<reco::SuperCluster>,vector<reco::HFEMClusterShape>,unsigned int> > "hfEMClusters" "" "RECO"
...
vector<reco::Track> "ckfInOutTracksFromConversions" "" "RECO"
vector<reco::Track> "ckfOutInTracksFromConversions" "" "RECO"
vector<reco::Track> "conversionStepTracks" "" "RECO"
vector<reco::Track> "cosmicMuons" "" "RECO"
vector<reco::Track> "cosmicMuons1Leg" "" "RECO"
vector<reco::Track> "cosmicsVetoTracks" "" "RECO"
vector<reco::Track> "generalTracks" "" "RECO"
vector<reco::Track> "globalCosmicMuons" "" "RECO"
vector<reco::Track> "globalCosmicMuons1Leg" "" "RECO"
vector<reco::Track> "globalMuons" "" "RECO"
vector<reco::Track> "globalSETMuons" "" "RECO"
vector<reco::Track> "pixelTracks" "" "RECO"
vector<reco::Track> "refittedStandAloneMuons" "" "RECO"
vector<reco::Track> "regionalCosmicTracks" "" "RECO"
vector<reco::Track> "standAloneMuons" "" "RECO"
vector<reco::Track> "standAloneSETMuons" "" "RECO"
vector<reco::Track> "uncleanedOnlyCkfInOutTracksFromConversions" "" "RECO"
vector<reco::Track> "uncleanedOnlyCkfOutInTracksFromConversions" "" "RECO"
vector<reco::Track> "refittedStandAloneMuons" "UpdatedAtVtx" "RECO"
vector<reco::Track> "standAloneMuons" "UpdatedAtVtx" "RECO"
vector<reco::Track> "standAloneSETMuons" "UpdatedAtVtx" "RECO"
vector<reco::Track> "tevMuons" "default" "RECO"
vector<reco::Track> "tevMuons" "dyt" "RECO"
vector<reco::Track> "tevMuons" "firstHit" "RECO"
vector<reco::Track> "impactParameterTagInfos" "ghostTracks" "RECO"
vector<reco::Track> "tevMuons" "picky" "RECO"
vector<reco::TrackExtra> "ckfInOutTracksFromConversions" "" "RECO"
vector<reco::TrackExtra> "ckfOutInTracksFromConversions" "" "RECO"
vector<reco::TrackExtra> "conversionStepTracks" "" "RECO"
vector<reco::TrackExtra> "cosmicMuons" "" "RECO"
vector<reco::TrackExtra> "cosmicMuons1Leg" "" "RECO"
vector<reco::TrackExtra> "electronGsfTracks" "" "RECO"
vector<reco::TrackExtra> "generalTracks" "" "RECO"
vector<reco::TrackExtra> "globalCosmicMuons" "" "RECO"
vector<reco::TrackExtra> "globalCosmicMuons1Leg" "" "RECO"
vector<reco::TrackExtra> "globalMuons" "" "RECO"
vector<reco::TrackExtra> "globalSETMuons" "" "RECO"
vector<reco::TrackExtra> "pixelTracks" "" "RECO"
vector<reco::TrackExtra> "refittedStandAloneMuons" "" "RECO"
vector<reco::TrackExtra> "regionalCosmicTracks" "" "RECO"
vector<reco::TrackExtra> "standAloneMuons" "" "RECO"
vector<reco::TrackExtra> "standAloneSETMuons" "" "RECO"
vector<reco::TrackExtra> "uncleanedOnlyCkfInOutTracksFromConversions" "" "RECO"
vector<reco::TrackExtra> "uncleanedOnlyCkfOutInTracksFromConversions" "" "RECO"
vector<reco::TrackExtra> "tevMuons" "default" "RECO"
vector<reco::TrackExtra> "tevMuons" "dyt" "RECO"
vector<reco::TrackExtra> "tevMuons" "firstHit" "RECO"
vector<reco::TrackExtra> "tevMuons" "picky" "RECO"
vector<reco::TrackExtrapolation> "trackExtrapolator" "" "RECO"
vector<reco::TrackIPTagInfo> "impactParameterTagInfos" "" "RECO"
vector<reco::TrackJet> "ak5TrackJets" "" "RECO"
vector<reco::TrackJet> "kt4TrackJets" "" "RECO"
vector<reco::Vertex> "offlinePrimaryVertices" "" "RECO"
vector<reco::Vertex> "offlinePrimaryVerticesWithBS" "" "RECO"
vector<reco::Vertex> "pixelVertices" "" "RECO"
vector<reco::VertexCompositeCandidate> "generalV0Candidates" "Kshort" "RECO"
vector<reco::VertexCompositeCandidate> "generalV0Candidates" "Lambda" "RECO"
and if you want to use
"generalTracks"
in your code (which we already did in the
DemoAnalyzer.cc
code above), you would do the following:
Handle<reco::TrackCollection> tracks;
iEvent.getByLabel("generalTracks", tracks);
Watch the processing of a job
1. Edit the configuration file,
ConfFile_cfg.py, and add the Tracer service ( just above the line
process.p = cms.Path(process.demo*process.dump)) in
ConfFile_cfg.py. This service identifies what module is called and when.
process.Tracer = cms.Service("Tracer")
You can remove the module
dump
if you added it as explained above, and set maxEvents to -1 (run over all events in the file).
2. Run the job
cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
The output should be something like this:
[lxplus404 @ ~/workbook/MYDEMOANALYZER/CMSSW_7_4_15/src]$ cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
++ starting: constructing source: PoolSource
++++ starting: open input file: lfn = file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
31-Dec-2015 01:22:37 CET Initiating request to open file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
%MSG-i Root_Information: file_open TClass::Init() 31-Dec-2015 01:22:42 CET pre-events
no dictionary for class reco::LeafRefCandidateT<edm::Ref<vector<reco::Track>,reco::Track,edm::refhelper::FindUsingAdvance<vector<reco::Track>,reco::Track> > > is availa
ble
%MSG
31-Dec-2015 01:22:42 CET Successfully opened file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
++++ finished: open input file: lfn = file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
++ finished: constructing source: PoolSource
++++ starting: constructing module with label 'TriggerResults' id = 1
++++ finished: constructing module with label 'TriggerResults' id = 1
++++ starting: constructing module with label 'demo' id = 2
++++ finished: constructing module with label 'demo' id = 2
++ preallocate: 1 concurrent runs, 1 concurrent luminosity sections, 1 streams
++ starting: begin job
++++ starting: begin job for module with label 'demo' id = 2
++++ finished: begin job for module with label 'demo' id = 2
++++ starting: begin job for module with label 'TriggerResults' id = 1
++++ finished: begin job for module with label 'TriggerResults' id = 1
++ finished: begin job
++++ starting: begin stream for module: stream = 0 label = 'demo' id = 2
++++ finished: begin stream for module: stream = 0 label = 'demo' id = 2
++++ starting: begin stream for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: begin stream for module: stream = 0 label = 'TriggerResults' id = 1
++++ starting: source run
++++ finished: source run
++++ starting: global begin run 1 : time = 1
++++++ starting: global begin run for module: label = 'demo' id = 2
++++++ finished: global begin run for module: label = 'demo' id = 2
++++++ starting: global begin run for module: label = 'TriggerResults' id = 1
++++++ finished: global begin run for module: label = 'TriggerResults' id = 1
++++ finished: global begin run 1 : time = 1
++++ starting: begin run: stream = 0 run = 1 time = 1
++++++ starting: begin run for module: stream = 0 label = 'demo' id = 2
++++++ finished: begin run for module: stream = 0 label = 'demo' id = 2
++++ finished: begin run: stream = 0 run = 1 time = 1
++++ starting: source lumi
++++ finished: source lumi
++++ starting: global begin lumi: run = 1 lumi = 64278 time = 1396505000001
++++++ starting: global begin lumi for module: label = 'demo' id = 2
++++++ finished: global begin lumi for module: label = 'demo' id = 2
++++++ starting: global begin lumi for module: label = 'TriggerResults' id = 1
++++++ finished: global begin lumi for module: label = 'TriggerResults' id = 1
++++ finished: global begin lumi: run = 1 lumi = 64278 time = 1396505000001
++++ starting: begin lumi: stream = 0 run = 1 lumi = 64278 time = 1396505000001
++++++ starting: begin lumi for module: stream = 0 label = 'demo' id = 2
++++++ finished: begin lumi for module: stream = 0 label = 'demo' id = 2
++++ finished: begin lumi: stream = 0 run = 1 lumi = 64278 time = 1396505000001
++++ starting: source event
++++ finished: source event
Begin processing the 1st record. Run 1, Event 19279309, LumiSection 64278 at 31-Dec-2015 01:22:45.085 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279309 time = 1396545000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
%MSG-i GetByLabelWithoutRegistration: DemoAnalyzer:demo 31-Dec-2015 01:22:45 CET Run: 1 Event: 19279309
::getByLabel without corresponding call to consumes or mayConsumes for this module.
type: std::vector<reco::Track>
module label: generalTracks
product instance name: ''
process name: ''
%MSG
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 01:22:45 CET Run: 1 Event: 19279309
number of tracks 1051
%MSG
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279309 time = 1396545000001
++++ starting: source event
++++ finished: source event
Begin processing the 2nd record. Run 1, Event 19279311, LumiSection 64278 at 31-Dec-2015 01:22:45.098 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279311 time = 1396555000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279311 time = 1396555000001
++++ starting: source event
++++ finished: source event
Begin processing the 3rd record. Run 1, Event 19279312, LumiSection 64278 at 31-Dec-2015 01:22:45.106 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279312 time = 1396560000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279312 time = 1396560000001
++++ starting: source event
++++ finished: source event
Begin processing the 4th record. Run 1, Event 19279316, LumiSection 64278 at 31-Dec-2015 01:22:45.108 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279316 time = 1396580000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279316 time = 1396580000001
++++ starting: source event
++++ finished: source event
Begin processing the 5th record. Run 1, Event 19279318, LumiSection 64278 at 31-Dec-2015 01:22:45.111 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279318 time = 1396590000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279318 time = 1396590000001
++++ starting: source event
++++ finished: source event
Begin processing the 6th record. Run 1, Event 19279319, LumiSection 64278 at 31-Dec-2015 01:22:45.113 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279319 time = 1396595000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279319 time = 1396595000001
++++ starting: source event
++++ finished: source event
Begin processing the 7th record. Run 1, Event 19279324, LumiSection 64278 at 31-Dec-2015 01:22:45.117 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279324 time = 1396620000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279324 time = 1396620000001
++++ starting: source event
++++ finished: source event
Begin processing the 8th record. Run 1, Event 19279326, LumiSection 64278 at 31-Dec-2015 01:22:45.118 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279326 time = 1396630000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279326 time = 1396630000001
++++ starting: source event
++++ finished: source event
Begin processing the 9th record. Run 1, Event 19279341, LumiSection 64278 at 31-Dec-2015 01:22:45.121 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279341 time = 1396705000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279341 time = 1396705000001
++++ starting: source event
++++ finished: source event
Begin processing the 10th record. Run 1, Event 19279353, LumiSection 64278 at 31-Dec-2015 01:22:45.123 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279353 time = 1396765000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279353 time = 1396765000001
++++ starting: source event
++++ finished: source event
Begin processing the 11th record. Run 1, Event 19279354, LumiSection 64278 at 31-Dec-2015 01:22:45.126 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64278 event = 19279354 time = 1396770000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
%MSG-i Demo: DemoAnalyzer:demo 31-Dec-2015 01:22:45 CET Run: 1 Event: 19279354
number of tracks 1166
%MSG
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64278 event = 19279354 time = 1396770000001
++++ starting: source event
++++ finished: source event
...
Begin processing the 100th record. Run 1, Event 19280577, LumiSection 64282 at 31-Dec-2015 01:22:45.384 CET
++++ starting: processing event : stream = 0 run = 1 lumi = 64282 event = 19280577 time = 1402885000001
++++++ starting: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'demo' id = 2
++++++++ starting: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: delayed processing event for module: stream = 0 label = 'demo' id = 2
++++++++ finished: processing event for module: stream = 0 label = 'demo' id = 2
++++++ finished: processing path 'p' : stream = 0
++++++++ starting: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++++++ finished: processing event for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: processing event : stream = 0 run = 1 lumi = 64282 event = 19280577 time = 1402885000001
++++ starting: end lumi: stream = 0 run = 1 lumi = 64282 time = 1404000000001
++++++ starting: end lumi for module: stream = 0 label = 'demo' id = 2
++++++ finished: end lumi for module: stream = 0 label = 'demo' id = 2
++++ finished: end lumi: stream = 0 run = 1 lumi = 64282 time = 1404000000001
++++ starting: global end lumi: run = 1 lumi = 64282 time = 1402505000001
++++++ starting: global end lumi for module: label = 'demo' id = 2
++++++ finished: global end lumi for module: label = 'demo' id = 2
++++++ starting: global end lumi for module: label = 'TriggerResults' id = 1
++++++ finished: global end lumi for module: label = 'TriggerResults' id = 1
++++ finished: global end lumi: run = 1 lumi = 64282 time = 1402505000001
++++ starting: end run: stream = 0 run = 1 time = 2500000000001
++++++ starting: end run for module: stream = 0 label = 'demo' id = 2
++++++ finished: end run for module: stream = 0 label = 'demo' id = 2
++++ finished: end run: stream = 0 run = 1 time = 2500000000001
++++ starting: global end run 1 : time = 2500000000001
++++++ starting: global end run for module: label = 'demo' id = 2
++++++ finished: global end run for module: label = 'demo' id = 2
++++++ starting: global end run for module: label = 'TriggerResults' id = 1
++++++ finished: global end run for module: label = 'TriggerResults' id = 1
++++ finished: global end run 1 : time = 2500000000001
++++ starting: close input file: lfn = file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
31-Dec-2015 01:22:45 CET Closed file file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
++++ finished: close input file: lfn = file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root
++++ starting: end stream for module: stream = 0 label = 'demo' id = 2
++++ finished: end stream for module: stream = 0 label = 'demo' id = 2
++++ starting: end stream for module: stream = 0 label = 'TriggerResults' id = 1
++++ finished: end stream for module: stream = 0 label = 'TriggerResults' id = 1
++++ starting: end job for module with label 'demo' id = 2
++++ finished: end job for module with label 'demo' id = 2
++++ starting: end job for module with label 'TriggerResults' id = 1
++++ finished: end job for module with label 'TriggerResults' id = 1
TrigReport ---------- Event Summary ------------
TrigReport Events total = 100 passed = 100 failed = 0
TrigReport ---------- Path Summary ------------
TrigReport Trig Bit# Executed Passed Failed Error Name
TrigReport 1 0 100 100 0 0 p
TrigReport -------End-Path Summary ------------
TrigReport Trig Bit# Executed Passed Failed Error Name
TrigReport ---------- Modules in Path: p ------------
TrigReport Trig Bit# Visited Passed Failed Error Name
TrigReport 1 0 100 100 0 0 demo
TrigReport ---------- Module Summary ------------
TrigReport Visited Executed Passed Failed Error Name
TrigReport 100 100 100 0 0 demo
TrigReport 100 100 100 0 0 TriggerResults
TimeReport ---------- Event Summary ---[sec]----
TimeReport event loop CPU/event = 0.003727
TimeReport event loop Real/event = 0.003764
TimeReport sum Streams Real/event = 0.002747
TimeReport efficiency CPU/Real/thread = 0.990191
TimeReport ---------- Path Summary ---[Real sec]----
TimeReport per event per exec Name
TimeReport 0.002073 0.002073 p
TimeReport per event per exec Name
TimeReport -------End-Path Summary ---[Real sec]----
TimeReport per event per exec Name
TimeReport per event per exec Name
TimeReport ---------- Modules in Path: p ---[Real sec]----
TimeReport per event per visit Name
TimeReport 0.000135 0.000135 demo
TimeReport per event per visit Name
TimeReport ---------- Module Summary ---[Real sec]----
TimeReport per event per exec per visit Name
TimeReport 0.000020 0.000020 0.000020 TriggerResults
TimeReport 0.000135 0.000135 0.000135 demo
TimeReport per event per exec per visit Name
T---Report end!
++ finished: end job
=============================================
MessageLogger Summary
type category sev module subroutine count total
---- -------------------- -- ---------------- ---------------- ----- -----
1 Tracer -s AfterBeginJob 1 1
2 Tracer -s AfterFile 1 1
3 Tracer -s AfterModConstruc 2 2
4 Tracer -s AfterModEndJob 1 1
5 Tracer -s AfterModGlobalBe 2 2
6 Tracer -s AfterModGlobalBe 1 1
7 Tracer -s AfterModGlobalEn 2 2
8 Tracer -s AfterModGlobalEn 1 1
9 Tracer -s AfterModStreamBe 2 2
10 Tracer -s AfterModStreamBe 1 1
11 Tracer -s AfterModStreamEn 2 2
12 Tracer -s AfterModStreamEn 1 1
13 Tracer -s DemoAnalyzer:dem 400 400
14 Tracer -s DemoAnalyzer:dem 2 2
15 Tracer -s DemoAnalyzer:dem 4 4
16 Tracer -s DemoAnalyzer:dem 2 2
17 Tracer -s DemoAnalyzer:dem 2 2
18 Tracer -s DemoAnalyzer:dem 2 2
19 Tracer -s DemoAnalyzer:dem 2 2
20 Tracer -s DemoAnalyzer:dem 4 4
21 Tracer -s DemoAnalyzer:dem 2 2
22 Tracer -s DemoAnalyzer:dem 2 2
23 Tracer -s DemoAnalyzer:dem 4 4
24 Tracer -s DemoAnalyzer:dem 2 2
25 Tracer -s DemoAnalyzer:dem 4 4
26 Tracer -s DemoAnalyzer:dem 2 2
27 Tracer -s PoolSource:sourc 1 1
28 Tracer -s PostModuleEvent 200 200
29 Tracer -s PreBeginLumi 4 4
30 Tracer -s PreBeginRun 2 2
31 Tracer -s PreEndLumi 4 4
32 Tracer -s PreEndRun 2 2
33 Tracer -s PreEventProcessi 100 100
34 Tracer -s PreProcPath p 100 100
35 Tracer -s TriggerResultIns 200 200
36 Tracer -s TriggerResultIns 2 2
37 Tracer -s TriggerResultIns 4 4
38 Tracer -s TriggerResultIns 2 2
39 Tracer -s TriggerResultIns 2 2
40 Tracer -s TriggerResultIns 2 2
41 Tracer -s TriggerResultIns 2 2
42 Tracer -s TriggerResultIns 4 4
43 Tracer -s TriggerResultIns 2 2
44 Tracer -s TriggerResultIns 2 2
45 Tracer -s file_close 2 2
46 Tracer -s file_open 2 2
47 Tracer -s source 206 206
48 fileAction -s file_close 1 1
49 fileAction -s file_open 2 2
type category Examples: run/evt run/evt run/evt
---- -------------------- ---------------- ---------------- ----------------
1 Tracer BeforeEvents
2 Tracer pre-events
3 Tracer pre-events pre-events
4 Tracer PostEndRun
5 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642
6 Tracer Run: 1
7 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642
8 Tracer End Run: 1
9 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642
10 Tracer Run: 1
11 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642
12 Tracer End Run: 1
13 Tracer 1/19279309 1/19279309 1/19280577
14 Tracer pre-events pre-events
15 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
16 Tracer Run: 1 Run: 1
17 Tracer BeforeEvents BeforeEvents
18 Tracer pre-events pre-events
19 Tracer PostEndRun PostEndRun
20 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
21 Tracer End Run: 1 End Run: 1
22 Tracer PostEndRun PostEndRun
23 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
24 Tracer Run: 1 Run: 1
25 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
26 Tracer End Run: 1 End Run: 1
27 Tracer pre-events
28 Tracer 1/19279309 1/19279309 1/19280577
29 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
30 Tracer Run: 1 Run: 1
31 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
32 Tracer End Run: 1 End Run: 1
33 Tracer 1/19279309 1/19279311 1/19280577
34 Tracer 1/19279309 1/19279311 1/19280577
35 Tracer 1/19279309 1/19279309 1/19280577
36 Tracer pre-events pre-events
37 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
38 Tracer Run: 1 Run: 1
39 Tracer BeforeEvents BeforeEvents
40 Tracer pre-events pre-events
41 Tracer PostEndRun PostEndRun
42 Tracer Run: 1 Lumi: 642 Run: 1 Lumi: 642 Run: 1 Lumi: 642
43 Tracer End Run: 1 End Run: 1
44 Tracer PostEndRun PostEndRun
45 Tracer PostEndRun PostEndRun
46 Tracer pre-events pre-events
47 Tracer BeforeEvents BeforeEvents PostProcessEvent
48 fileAction PostEndRun
49 fileAction pre-events pre-events
Severity # Occurrences Total Occurrences
-------- ------------- -----------------
System 1299 1299
Add a histogram
I will not go into detail about how you should add histograms. Below are the three files that you have to change to plot a histogram. Compare it to what you already have and make changes by seeing what is missing. If you do not want to make changes, just copy and paste them as is. Here are the steps. The order in which you do them does not matter.
1. Make changes in your demo analyzer
DemoAnalyzer.cc
and it should like this
DemoAnalyzer.cc.
2. Make changes in the
BuildFile.xml
and it should look like this:
BuildFile.xml
3. Make changes in the config file
ConfFile_cfg.py
and it should like this
ConfFile_cfg.py
Then do
scram b
and run it by doing
cmsRun Demo/DemoAnalyzer/python/ConfFile_cfg.py
You will see that now you have a root file called
histodemo.root
.
Open this root file and you will see a histogram showing number of tracks in 200 events over which you ran. The plot looks like this:
If you want to see other collections, as mentioned above you have to see what are available at
Reco event content documentation.
Histo Analyzer
This package is similar to the DemoAnalyzer package. The point in having it here is that, having understood how to create, change and run your own demo analyzer (or module), you can also have look at this package that tells you how to add histograms to your analyzer which I already briefly showed you above. This has been historically here and I did not want to remove it. After all it does not hurt to tell how to include a histogram in your analyzer again.
Eventually, you may want your analyzer to record something rather than just print out track numbers. The
mkedanlzr
script has an option
example_histo
to generate an analyzer code which writes a histogram in a root file. If you use it together with the option
example_track
, it will access the tracks, find their charge and fill a histogram.
To use this option, go to the
CMSSW_7_4_15/src
directory and create a new subdirectory
mkdir Histo
cd Histo
Create a new analyzer module
mkedanlzr HistoAnalyzer example_track example_histo
Go to the
HistoAnalyzer
directory and compile the code
cd HistoAnalyzer
scram b
Change the data file to
'file:/afs/cern.ch/cms/Tutorials/TWIKI_DATA/TTJets_8TeV_53X.root'
in
HistoAnalyzer/python/ConfFile_cfg.py
that we were already using in
ConfFile_cfg.py
and change
'ctfWithMaterialTracks'
to
'generalTracks'
by commenting out as follows
process.demo = cms.EDAnalyzer('HistoAnalyzer'
# , tracks = cms.untracked.InputTag('ctfWithMaterialTracks')
, tracks = cms.untracked.InputTag('generalTracks')
)
Run the analyzer
cmsRun HistoAnalyzer/python/ConfFile_cfg.py
A root file
histo.root
has been created and you can find the histogram in root
root histo.root
new TBrowser
Double-click on ROOT files, double-click on histo.root and double-click on demo and you will find the histogram "charge" which is specified in the
Histo/HistoAnalyzer/src/HistoAnalyzer.cc
.
The histogram looks like this:
Detailed instructions on how to write out a histogram file can be found in
page
TFileService: a ROOT Histogram Service.
Review status
JohnStupak - 10 Mar 2013 |
Revised to CMSSW_5_3_5 |
SudhirMalik - 13 June 2011 |
Revised to CMSSW_4_2_4 |
SudhirMalik - 22 Mar 2011 |
Revised to CMSSW_4_1_3 |
SudhirMalik - 29 August 2010 |
Introduced WBRELEASE variables |
RogerWolf - 7 June 2010 |
Lifted to CMSSW_3_6_2, CMSSW_3_6_1 input files and pictures are still valid though |
SudhirMalik - 1 June 2010 |
Revised to CMSSW_3_6_1 |
%RESPONSIBLE%
SudhirMalik