Skip to content

Commit 62d4691

Browse files
committed
Directory Validation/Commissioning_dimuon_2010
1 parent bcadd42 commit 62d4691

File tree

6 files changed

+148
-37
lines changed

6 files changed

+148
-37
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,24 @@ This step is only needed the first time.
1313
cmsrel CMSSW_4_2_8
1414
```
1515

16-
## Cloning and copying the 2010-commissioning-dimuon repository from Github
16+
## Cloning the 2010-commissioning-dimuon repository from Github
1717
```
18-
git clone https://github.com/cms-opendata-validation/2010-commissioning-dimuon
19-
cp -R 2010-commissioning-dimuon/Demo CMSSW_4_2_8/src
18+
git clone https://github.com/cms-opendata-validation/2010-commissioning-dimuon Validation/Commissioning_dimuon_2010
19+
2020
```
2121

2222
## Setting up the CMS environment
2323
```
24-
cd CMSSW_4_2_8/src/Demo/DemoAnalyzer
24+
cd CMSSW_4_2_8/src/Validation/Commissioning_dimuon_2010
2525
cmsenv
26+
2627
```
2728

2829
## Compiling and Running
2930
```
3031
scram b
3132
cmsRun demoanalyzer_cfg.py
33+
3234
```
3335

3436
After analysis, Commissioning00val.root file should be created.

README.md~

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# 2010-commissioning-dimuon
2+
3+
Validation code for 2010 Commissioning dataset, based on dimuon mass spectrum.
4+
You need to work in a Virtual Machine properly contextualized for CMS.
5+
6+
In order to run the demoanalyzer_cfg.py to create the Commissioning ROOT files,
7+
you need to create a working area and set up a proper CMS environment.
8+
9+
## Creating the Working Area
10+
11+
This step is only needed the first time.
12+
```
13+
cmsrel CMSSW_4_2_8
14+
```
15+
16+
## Cloning and copying the 2010-commissioning-dimuon repository from Github
17+
```
18+
git clone https://github.com/cms-opendata-validation/2010-commissioning-dimuon
19+
cp -R 2010-commissioning-dimuon/Demo CMSSW_4_2_8/src
20+
```
21+
22+
## Setting up the CMS environment
23+
```
24+
cd CMSSW_4_2_8/src/Demo/DemoAnalyzer
25+
cmsenv
26+
```
27+
28+
## Compiling and Running
29+
```
30+
scram b
31+
cmsRun demoanalyzer_cfg.py
32+
```
33+
34+
After analysis, Commissioning00val.root file should be created.
35+
Then, is necessary to change input and also output files in demoanalyzer_cfg.py, to save these changes and to rerun program.
36+
In the repository from github are index files with names:
37+
CMS_Run2010B_Commissioning_AOD_Apr21ReReco-v1_0000_file_index.txt
38+
CMS_Run2010B_Commissioning_AOD_Apr21ReReco-v1_0002_file_index.txt
39+
CMS_Run2010B_Commissioning_AOD_Apr21ReReco-v1_0003_file_index.txt
40+
CMS_Run2010B_Commissioning_AOD_Apr21ReReco-v1_0004_file_index.txt
41+
42+
43+
When you rerun for all four index files you should have four root files with names:
44+
Commissioning00val.root
45+
Commissioning02val.root
46+
Commissioning03val.root
47+
Commissioning04val.root
48+
49+
The last thing what you should do is to merge these four root files into one root file.
50+
You do this as follow. In the downloaded repository is also file with name mergeCommissioning.C .
51+
Press command for opening ROOT program: root
52+
In this programe just type command: .x mergeCommissioning.C .
53+
This merging create a root file called CommissioningAllval.root.
54+
55+
To look at this output, write down command:
56+
```
57+
new TBrowser
58+
```
59+
and navigate to relevant file.

demoanalyzer_cfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
# ****************************************************************
3535

3636
# *** Commissioning data set ***
37-
files2010data = FileUtils.loadListFromFile ('/home/cms-opendata/CMSSW_4_2_8/src/Validation/Commissioning/datasets/CMS_Run2010B_Commissioning_AOD_Apr21ReReco-v1_0000_file_index.txt')
37+
files2010data = FileUtils.loadListFromFile ('/home/cms-opendata/CMSSW_4_2_8/src/Validation/Commissioning-dimuon-2010/datasets/CMS_Run2010B_Commissioning_AOD_Apr21ReReco-v1_0000_file_index.txt')
3838
process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring(*files2010data))
3939

4040
# *************************************************
4141
# number of events to be skipped (0 by default) *
4242
# *************************************************
4343
process.source.skipEvents = cms.untracked.uint32(0)
44-
process.demo = cms.EDAnalyzer('Commissioning')
44+
process.demo = cms.EDAnalyzer('Commissioning-dimuon-2010')
4545
# ***********************************************************
4646
# output file name *
4747
# change this according to input file, or according to wish *

demoanalyzer_cfg.py~

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import FWCore.ParameterSet.Config as cms
2+
from RecoMuon.TrackingTools.MuonServiceProxy_cff import *
3+
import PhysicsTools.PythonAnalysis.LumiList as LumiList
4+
import FWCore.ParameterSet.Types as CfgTypes
5+
#import FWCore.PythonUtilities.LumiList as LumiList
6+
process = cms.Process("Validation")
7+
8+
# intialize MessageLogger and output report
9+
process.load("FWCore.MessageLogger.MessageLogger_cfi")
10+
process.MessageLogger.cerr.threshold = 'INFO'
11+
process.MessageLogger.categories.append('Validation')
12+
process.MessageLogger.cerr.INFO = cms.untracked.PSet(limit = cms.untracked.int32(-1))
13+
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
14+
# **********************************************************************
15+
# set the maximum number of events to be processed *
16+
# this number (argument of int32) is to be modified by the user *
17+
# according to need and wish *
18+
# default is preset to 10000 events *
19+
# **********************************************************************
20+
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(20000000) )
21+
22+
# ****************************************************************************
23+
# define the input data set here by inserting the appropriate .txt file list *
24+
# ****************************************************************************
25+
import FWCore.Utilities.FileUtils as FileUtils
26+
#
27+
# ****************************************************************
28+
# exactly one of the following 'files2010data =' statements *
29+
# should be uncommented. *
30+
# For MUO-10-004, the default is the Mu data set. *
31+
# To run over all sets, replace '0000' by '0001' etc. *
32+
# consecutively (make sure you save the output before rerunning) *
33+
# and add up the histograms using root tools. *
34+
# ****************************************************************
35+
36+
# *** Commissioning data set ***
37+
files2010data = FileUtils.loadListFromFile ('/home/cms-opendata/CMSSW_4_2_8/src/Validation/Commissioning/datasets/CMS_Run2010B_Commissioning_AOD_Apr21ReReco-v1_0000_file_index.txt')
38+
process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring(*files2010data))
39+
40+
# *************************************************
41+
# number of events to be skipped (0 by default) *
42+
# *************************************************
43+
process.source.skipEvents = cms.untracked.uint32(0)
44+
process.demo = cms.EDAnalyzer('Commissioning')
45+
# ***********************************************************
46+
# output file name *
47+
# change this according to input file, or according to wish *
48+
# ***********************************************************
49+
process.TFileService = cms.Service("TFileService",fileName = cms.string('Commissioning00val.root'))
50+
process.p = cms.Path(process.demo)

src/DemoAnalyzer.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// -*- C++ -*-
22
//
3-
// Package: Commissioning
4-
// Class: Commissioning
3+
// Package: Commissioning_dimuon_2010
4+
// Class: Commissioning_dimuon_2010
55
//
6-
/**\class Commissioning DemoAnalyzer.cc Validation/Commissioning/src/DemoAnalyzer.cc
6+
/**\class Commissioning DemoAnalyzer.cc Validation/Commissioning_dimuon_2010/src/DemoAnalyzer.cc
77
88
Description: [one line class summary]
99
@@ -64,10 +64,10 @@
6464
// class declaration
6565
//
6666

67-
class Commissioning: public edm::EDAnalyzer {
67+
class Commissioning_dimuon_2010: public edm::EDAnalyzer {
6868
public:
69-
explicit Commissioning(const edm::ParameterSet&);
70-
~Commissioning();
69+
explicit Commissioning_dimuon_2010(const edm::ParameterSet&);
70+
~Commissioning_dimuon_2010();
7171

7272
private:
7373
virtual void beginJob();
@@ -117,7 +117,7 @@ TH1D *h203;
117117
// constructors and destructor
118118
//
119119

120-
Commissioning::Commissioning(const edm::ParameterSet& iConfig) {
120+
Commissioning::Commissioning_dimuon_2010(const edm::ParameterSet& iConfig) {
121121

122122
// *****************************************************************
123123
// This is the main analysis routine
@@ -225,7 +225,7 @@ h203 = fs->make<TH1D>("Lumi section", "Lumi section", 300, 0, 3000);
225225
}
226226

227227

228-
Commissioning::~Commissioning() {
228+
Commissioning_dimuon_2010::~Commissioning_dimuon_2010() {
229229
// do anything here that needs to be done at destruction time
230230
// (e.g. close files, deallocate resources etc.)
231231
}
@@ -237,7 +237,7 @@ Commissioning::~Commissioning() {
237237
//
238238

239239
// ------------ method called for each event ------------
240-
void Commissioning::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
240+
void Commissioning_dimuon_2010::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
241241

242242
// **********************************************
243243
// here each relevant event will get analyzed
@@ -459,7 +459,7 @@ if (!providesGoodLumisection(iEvent)) {
459459

460460

461461
// ---- method called for each event to check good quality lumi section ---- //
462-
bool Commissioning::providesGoodLumisection(const edm::Event& iEvent) {
462+
bool Commissioning_dimuon_2010::providesGoodLumisection(const edm::Event& iEvent) {
463463

464464
// check JSON "by hand"
465465
// This is a 'primitive' check which has the advantage that it also works
@@ -775,15 +775,15 @@ bool Commissioning::providesGoodLumisection(const edm::Event& iEvent) {
775775

776776

777777
// ------------ method called once each job just before starting event loop ------------
778-
void Commissioning::beginJob() {
778+
void Commissioning_dimuon_2010::beginJob() {
779779

780780
}
781781

782782
// ------------ method called once each job just after ending the event loop ------------
783-
void Commissioning::endJob() {
783+
void Commissioning_dimuon_2010::endJob() {
784784
}
785785

786786
//define this as a plug-in
787-
DEFINE_FWK_MODULE(Commissioning);
787+
DEFINE_FWK_MODULE(Commissioning_dimuon_2010);
788788

789789

src/DemoAnalyzer.cc~

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// -*- C++ -*-
22
//
3-
// Package: DemoAnalyzer
4-
// Class: DemoAnalyzer
3+
// Package: Commissioning
4+
// Class: Commissioning
55
//
6-
/**\class DemoAnalyzer DemoAnalyzer.cc Demo/DemoAnalyzer/src/DemoAnalyzer.cc
6+
/**\class Commissioning DemoAnalyzer.cc Validation/Commissioning/src/DemoAnalyzer.cc
77
88
Description: [one line class summary]
99
@@ -64,10 +64,10 @@
6464
// class declaration
6565
//
6666

67-
class DemoAnalyzer: public edm::EDAnalyzer {
67+
class Commissioning: public edm::EDAnalyzer {
6868
public:
69-
explicit DemoAnalyzer(const edm::ParameterSet&);
70-
~DemoAnalyzer();
69+
explicit Commissioning(const edm::ParameterSet&);
70+
~Commissioning();
7171

7272
private:
7373
virtual void beginJob();
@@ -117,7 +117,7 @@ TH1D *h203;
117117
// constructors and destructor
118118
//
119119

120-
DemoAnalyzer::DemoAnalyzer(const edm::ParameterSet& iConfig) {
120+
Commissioning::Commissioning(const edm::ParameterSet& iConfig) {
121121

122122
// *****************************************************************
123123
// This is the main analysis routine
@@ -225,7 +225,7 @@ h203 = fs->make<TH1D>("Lumi section", "Lumi section", 300, 0, 3000);
225225
}
226226

227227

228-
DemoAnalyzer::~DemoAnalyzer() {
228+
Commissioning::~Commissioning() {
229229
// do anything here that needs to be done at destruction time
230230
// (e.g. close files, deallocate resources etc.)
231231
}
@@ -237,7 +237,7 @@ DemoAnalyzer::~DemoAnalyzer() {
237237
//
238238

239239
// ------------ method called for each event ------------
240-
void DemoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
240+
void Commissioning::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
241241

242242
// **********************************************
243243
// here each relevant event will get analyzed
@@ -261,7 +261,7 @@ using namespace std;
261261

262262
//--------------Fill basic Event-information histograms---------------------//
263263
// debug print commented out
264-
// LogInfo("Demo")<<"Event id: "<<iEvent.id()<<" Run number: "<<iEvent.run();
264+
// LogInfo("Validation")<<"Event id: "<<iEvent.id()<<" Run number: "<<iEvent.run();
265265

266266
h200->Fill(iEvent.run()); // Run number which the analyzed Event belongs to
267267
h202->Fill((iEvent.id()).event()); // Event's EventNumber
@@ -282,12 +282,12 @@ if (!providesGoodLumisection(iEvent)) {
282282

283283
// event is not in JSON (see above)
284284
h201->Fill(iEvent.run());
285-
LogInfo("Demo") << "not in JSON, Event id (" << iEvent.id() << ") --> analysing anyway";
285+
LogInfo("Validation") << "not in JSON, Event id (" << iEvent.id() << ") --> analysing anyway";
286286
}
287287
// analyze in any case! (use this only for Commissioning!)
288288
// else { // Event is to be analyzed
289289

290-
LogInfo("Demo")
290+
LogInfo("Validation")
291291
<< "Starting to analyze \n"
292292
<< "Event number: " << (iEvent.id()).event()
293293
<< ", Run number: " << iEvent.run()
@@ -344,8 +344,8 @@ if (!providesGoodLumisection(iEvent)) {
344344
h55->Fill(it->normalizedChi2());
345345

346346
// the following can be uncommented if more log information is wished
347-
// LogInfo("Demo") <<"global muon track pointer "<<it;
348-
// LogInfo("Demo")<<"global muon track p"<<it->p()<<" global muon track pos"<<it->referencePoint()<<" global muon track vertex"<<it->vertex();
347+
// LogInfo("Validation") <<"global muon track pointer "<<it;
348+
// LogInfo("Validation")<<"global muon track p"<<it->p()<<" global muon track pos"<<it->referencePoint()<<" global muon track vertex"<<it->vertex();
349349

350350
//-----------------prepare variables to determine quality cuts---------------//
351351
// WHAT: 1) Find out the number of Hits in the current globalMuon-Track
@@ -459,7 +459,7 @@ if (!providesGoodLumisection(iEvent)) {
459459

460460

461461
// ---- method called for each event to check good quality lumi section ---- //
462-
bool DemoAnalyzer::providesGoodLumisection(const edm::Event& iEvent) {
462+
bool Commissioning::providesGoodLumisection(const edm::Event& iEvent) {
463463

464464
// check JSON "by hand"
465465
// This is a 'primitive' check which has the advantage that it also works
@@ -775,15 +775,15 @@ bool DemoAnalyzer::providesGoodLumisection(const edm::Event& iEvent) {
775775

776776

777777
// ------------ method called once each job just before starting event loop ------------
778-
void DemoAnalyzer::beginJob() {
778+
void Commissioning::beginJob() {
779779

780780
}
781781

782782
// ------------ method called once each job just after ending the event loop ------------
783-
void DemoAnalyzer::endJob() {
783+
void Commissioning::endJob() {
784784
}
785785

786786
//define this as a plug-in
787-
DEFINE_FWK_MODULE(DemoAnalyzer);
787+
DEFINE_FWK_MODULE(Commissioning);
788788

789789

0 commit comments

Comments
 (0)