CMS 3D CMS Logo

Functions
TopMuonFWLiteAnalyzer.cc File Reference
#include <memory>
#include <string>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <iostream>
#include "FWCore/FWLite/interface/FWLiteEnabler.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/Electron.h"
#include "TopQuarkAnalysis/Examples/bin/NiceStyle.cc"
#include "TopQuarkAnalysis/Examples/interface/RootSystem.h"
#include "TopQuarkAnalysis/Examples/interface/RootHistograms.h"
#include "TopQuarkAnalysis/Examples/interface/RootPostScript.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

===============================================================================================================================================================================================


variant2: for each run define phi-averaged A for normalization channel (Dref,16) and then, divide Rijk on it, i.e. get RRijk

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=29 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=28

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:


CALO JETS


PF JETS

Definition at line 17 of file TopMuonFWLiteAnalyzer.cc.

17  {
18  if (argc < 3) {
19  // -------------------------------------------------
20  std::cerr << "ERROR:: "
21  << "Wrong number of arguments! Please specify:" << std::endl
22  << " * filepath" << std::endl
23  << " * process name" << std::endl;
24  // -------------------------------------------------
25  return -1;
26  }
27 
28  // load framework libraries
29  gSystem->Load("libFWCoreFWLite");
31 
32  // set nice style for histograms
33  setNiceStyle();
34 
35  // define some histograms
36  TH1I* noMuons = new TH1I("noMuons", "N(Muon)", 10, 0, 10);
37  TH1I* noLepts = new TH1I("noLepts", "N(Lepton)", 10, 0, 10);
38  TH1F* ptMuons = new TH1F("ptMuons", "pt_{Muons}", 100, 0., 300.);
39  TH1F* enMuons = new TH1F("enMuons", "energy_{Muons}", 100, 0., 300.);
40  TH1F* etaMuons = new TH1F("etaMuons", "eta_{Muons}", 100, -3., 3.);
41  TH1F* phiMuons = new TH1F("phiMuons", "phi_{Muons}", 100, -5., 5.);
42 
43  // -------------------------------------------------
44  std::cout << "open file: " << argv[1] << std::endl;
45  // -------------------------------------------------
46  TFile* inFile = TFile::Open(argv[1]);
47  TTree* events_ = nullptr;
48  if (inFile)
49  inFile->GetObject("Events", events_);
50  if (events_ == nullptr) {
51  // -------------------------------------------------
52  std::cerr << "ERROR:: "
53  << "Unable to retrieve TTree Events!" << std::endl
54  << " Eighter wrong file name or the the tree doesn't exists" << std::endl;
55  // -------------------------------------------------
56  return -1;
57  }
58 
59  // acess branch of muons and elecs
60  char muonName[50];
61  sprintf(muonName, "patMuons_selectedPatMuons__%s.obj", argv[2]);
62  TBranch* muons_ = events_->GetBranch(muonName);
63  assert(muons_ != nullptr);
64  char elecName[50];
65  sprintf(elecName, "patElectrons_selectedPatElectrons__%s.obj", argv[2]);
66  TBranch* elecs_ = events_->GetBranch(elecName);
67  assert(elecs_ != nullptr);
68 
69  // loop over events and fill histograms
70  std::vector<pat::Muon> muons;
71  std::vector<pat::Electron> elecs;
72  int nevt = events_->GetEntries();
73 
74  // -------------------------------------------------
75  std::cout << "start looping " << nevt << " events..." << std::endl;
76  // -------------------------------------------------
77  for (int evt = 0; evt < nevt; ++evt) {
78  // set branch address
79  muons_->SetAddress(&muons);
80  elecs_->SetAddress(&elecs);
81  // get event
82  muons_->GetEntry(evt);
83  elecs_->GetEntry(evt);
84  events_->GetEntry(evt, 0);
85 
86  // -------------------------------------------------
87  if (evt > 0 && !(evt % 10))
88  std::cout << " processing event: " << evt << std::endl;
89  // -------------------------------------------------
90 
91  // fill histograms
92  noMuons->Fill(muons.size());
93  noLepts->Fill(muons.size() + elecs.size());
94  for (unsigned idx = 0; idx < muons.size(); ++idx) {
95  // fill histograms
96  ptMuons->Fill(muons[idx].pt());
97  enMuons->Fill(muons[idx].energy());
98  etaMuons->Fill(muons[idx].eta());
99  phiMuons->Fill(muons[idx].phi());
100  }
101  }
102  // -------------------------------------------------
103  std::cout << "close file" << std::endl;
104  // -------------------------------------------------
105  inFile->Close();
106 
107  // save histograms to file
108  TFile outFile("analyzeMuons.root", "recreate");
109  outFile.mkdir("analyzeMuon");
110  outFile.cd("analyzeMuon");
111  noMuons->Write();
112  noLepts->Write();
113  ptMuons->Write();
114  enMuons->Write();
115  etaMuons->Write();
116  phiMuons->Write();
117  outFile.Close();
118 
119  // free allocated space
120  delete noMuons;
121  delete noLepts;
122  delete ptMuons;
123  delete enMuons;
124  delete etaMuons;
125  delete phiMuons;
126 
127  return 0;
128 }

References dir2webdir::argc, cmsBatch::argv, cms::cuda::assert(), beam_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, singleTopDQM_cfi::elecs, FWLiteEnabler::enable(), HCALHighEnergyHPDFilter_cfi::energy, PVValHelper::eta, b2gDoubleLeptonHLTEventValidation_cfi::etaMuons, charmTagsComputerCvsB_cfi::idx, nano_cff::muonName, PDWG_BPHSkim_cff::muons, nevt, L1TdeCSCTF_cfi::outFile, PVValHelper::phi, DiDispStaMuonMonitor_cfi::pt, b2gDoubleLeptonHLTEventValidation_cfi::ptMuons, and setNiceStyle().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
cmsBatch.argv
argv
Definition: cmsBatch.py:279
b2gDoubleLeptonHLTEventValidation_cfi.ptMuons
ptMuons
Definition: b2gDoubleLeptonHLTEventValidation_cfi.py:15
dir2webdir.argc
argc
Definition: dir2webdir.py:39
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
setNiceStyle
void setNiceStyle()
Definition: NiceStyle.cc:3
PVValHelper::eta
Definition: PVValidationHelpers.h:69
singleTopDQM_cfi.elecs
elecs
Definition: singleTopDQM_cfi.py:41
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
b2gDoubleLeptonHLTEventValidation_cfi.etaMuons
etaMuons
Definition: b2gDoubleLeptonHLTEventValidation_cfi.py:16
PVValHelper::phi
Definition: PVValidationHelpers.h:68
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
nano_cff.muonName
muonName
Definition: nano_cff.py:54
nevt
int nevt
Definition: ReggeGribovPartonMCHadronizer.h:66