CMS 3D CMS Logo

Functions
TopHypothesisFWLiteAnalyzer.cc File Reference
#include <memory>
#include <string>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <iostream>
#include "FWCore/FWLite/interface/FWLiteEnabler.h"
#include "AnalysisDataFormats/TopObjects/interface/TtSemiLeptonicEvent.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 16 of file TopHypothesisFWLiteAnalyzer.cc.

16  {
17  if (argc < 4) {
18  // -------------------------------------------------
19  std::cerr << "ERROR: Wrong number of arguments!" << std::endl
20  << "Please specify: * file name" << std::endl
21  << " * process name" << std::endl
22  << " * HypoClassKey" << std::endl
23  << "Example: TopHypothesisFWLiteAnalyzer ttSemiLepEvtBuilder.root TEST kGeom" << std::endl;
24  // -------------------------------------------------
25  return -1;
26  }
27 
28  // get HypoClassKey
30 
31  // load framework libraries
32  gSystem->Load("libFWCoreFWLite");
34 
35  // set nice style for histograms
36  setNiceStyle();
37 
38  // define some histograms
39  TH1F* hadWPt_ = new TH1F("hadWPt", "p_{t} (W_{had}) [GeV]", 100, 0., 500.);
40  TH1F* hadWMass_ = new TH1F("hadWMass", "M (W_{had}) [GeV]", 50, 0., 150.);
41  TH1F* hadTopPt_ = new TH1F("hadTopPt", "p_{t} (t_{had}) [GeV]", 100, 0., 500.);
42  TH1F* hadTopMass_ = new TH1F("hadTopMass", "M (t_{had}) [GeV]", 50, 50., 250.);
43 
44  TH1F* lepWPt_ = new TH1F("lepWPt", "p_{t} (W_{lep}) [GeV]", 100, 0., 500.);
45  TH1F* lepWMass_ = new TH1F("lepWMass", "M (W_{lep}) [GeV]", 50, 0., 150.);
46  TH1F* lepTopPt_ = new TH1F("lepTopPt", "p_{t} (t_{lep}) [GeV]", 100, 0., 500.);
47  TH1F* lepTopMass_ = new TH1F("lepTopMass", "M (t_{lep}) [GeV]", 50, 50., 250.);
48 
49  // -------------------------------------------------
50  std::cout << "open file: " << argv[1] << std::endl;
51  // -------------------------------------------------
52  TFile* inFile = TFile::Open(argv[1]);
53  TTree* events_ = nullptr;
54  if (inFile)
55  inFile->GetObject("Events", events_);
56  if (events_ == nullptr) {
57  // -------------------------------------------------
58  std::cerr << "ERROR: Unable to retrieve TTree Events!" << std::endl
59  << "Either wrong file name or the tree doesn't exist." << std::endl;
60  // -------------------------------------------------
61  return -1;
62  }
63 
64  // acess branch of ttSemiLepEvent
65  char decayName[50];
66  sprintf(decayName, "recoGenParticles_decaySubset__%s.obj", argv[2]);
67  TBranch* decay_ = events_->GetBranch(decayName); // referred to from within TtGenEvent class
68  assert(decay_ != nullptr);
69  char genEvtName[50];
70  sprintf(genEvtName, "TtGenEvent_genEvt__%s.obj", argv[2]);
71  TBranch* genEvt_ = events_->GetBranch(genEvtName); // referred to from within TtSemiLeptonicEvent class
72  assert(genEvt_ != nullptr);
73  char semiLepEvtName[50];
74  sprintf(semiLepEvtName, "TtSemiLeptonicEvent_ttSemiLepEvent__%s.obj", argv[2]);
75  TBranch* semiLepEvt_ = events_->GetBranch(semiLepEvtName);
76  assert(semiLepEvt_ != nullptr);
77 
78  // loop over events and fill histograms
79  int nevt = events_->GetEntries();
80  TtSemiLeptonicEvent semiLepEvt;
81  // -------------------------------------------------
82  std::cout << "start looping " << nevt << " events..." << std::endl;
83  // -------------------------------------------------
84  for (int evt = 0; evt < nevt; ++evt) {
85  // set branch address
86  semiLepEvt_->SetAddress(&semiLepEvt);
87  // get event
88  decay_->GetEntry(evt);
89  genEvt_->GetEntry(evt);
90  semiLepEvt_->GetEntry(evt);
91  events_->GetEntry(evt, 0);
92 
93  // -------------------------------------------------
94  if (evt > 0 && !(evt % 10))
95  std::cout << " processing event: " << evt << std::endl;
96  // -------------------------------------------------
97 
98  // fill histograms
99  if (!semiLepEvt.isHypoAvailable(hypoClassKey)) {
100  std::cerr << "NonValidHyp:: "
101  << "Hypothesis not available for this event" << std::endl;
102  continue;
103  }
104  if (!semiLepEvt.isHypoValid(hypoClassKey)) {
105  std::cerr << "NonValidHyp::"
106  << "Hypothesis not valid for this event" << std::endl;
107  continue;
108  }
109 
110  const reco::Candidate* hadTop = semiLepEvt.hadronicDecayTop(hypoClassKey);
111  const reco::Candidate* hadW = semiLepEvt.hadronicDecayW(hypoClassKey);
112  const reco::Candidate* lepTop = semiLepEvt.leptonicDecayTop(hypoClassKey);
113  const reco::Candidate* lepW = semiLepEvt.leptonicDecayW(hypoClassKey);
114 
115  if (hadTop && hadW && lepTop && lepW) {
116  hadWPt_->Fill(hadW->pt());
117  hadWMass_->Fill(hadW->mass());
118  hadTopPt_->Fill(hadTop->pt());
119  hadTopMass_->Fill(hadTop->mass());
120 
121  lepWPt_->Fill(lepW->pt());
122  lepWMass_->Fill(lepW->mass());
123  lepTopPt_->Fill(lepTop->pt());
124  lepTopMass_->Fill(lepTop->mass());
125  }
126  }
127  // -------------------------------------------------
128  std::cout << "close file" << std::endl;
129  // -------------------------------------------------
130  inFile->Close();
131 
132  // save histograms to file
133  TFile outFile("analyzeHypothesis.root", "recreate");
134  // strip the leading "k" from the hypoClassKey to build directory name
135  TString outDir = "analyze" + std::string(hypoClassKey, 1, hypoClassKey.length());
136  outFile.mkdir(outDir);
137  outFile.cd(outDir);
138  hadWPt_->Write();
139  hadWMass_->Write();
140  hadTopPt_->Write();
141  hadTopMass_->Write();
142  lepWPt_->Write();
143  lepWMass_->Write();
144  lepTopPt_->Write();
145  lepTopMass_->Write();
146  outFile.Close();
147 
148  // free allocated space
149  delete hadWPt_;
150  delete hadWMass_;
151  delete hadTopPt_;
152  delete hadTopMass_;
153  delete lepWPt_;
154  delete lepWMass_;
155  delete lepTopPt_;
156  delete lepTopMass_;
157 
158  return 0;
159 }

References dir2webdir::argc, cmsBatch::argv, cms::cuda::assert(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, gather_cfg::cout, FWLiteEnabler::enable(), TtSemiLeptonicEvent::hadronicDecayTop(), TtSemiLeptonicEvent::hadronicDecayW(), HypothesisAnalyzer_cff::hypoClassKey, TtEvent::isHypoAvailable(), TtEvent::isHypoValid(), TtSemiLeptonicEvent::leptonicDecayTop(), TtSemiLeptonicEvent::leptonicDecayW(), reco::Candidate::mass(), nevt, visualization-live-secondInstance_cfg::outDir, L1TdeCSCTF_cfi::outFile, reco::Candidate::pt(), setNiceStyle(), and AlCaHLTBitMon_QueryRunRegistry::string.

cmsBatch.argv
argv
Definition: cmsBatch.py:279
TtSemiLeptonicEvent::leptonicDecayTop
const reco::Candidate * leptonicDecayTop(const std::string &key, const unsigned &cmb=0) const
get leptonic top of the given hypothesis
Definition: TtSemiLeptonicEvent.h:72
TtEvent::isHypoValid
bool isHypoValid(const std::string &key, const unsigned &cmb=0) const
check if hypothesis 'cmb' within the hypothesis class was valid; if not it lead to an empty Composite...
Definition: TtEvent.h:78
TtEvent::isHypoAvailable
bool isHypoAvailable(const std::string &key, const unsigned &cmb=0) const
Definition: TtEvent.h:70
dir2webdir.argc
argc
Definition: dir2webdir.py:39
reco::Candidate::mass
virtual double mass() const =0
mass
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::Candidate::pt
virtual double pt() const =0
transverse momentum
cms::cuda::assert
assert(be >=bs)
setNiceStyle
void setNiceStyle()
Definition: NiceStyle.cc:3
TtSemiLeptonicEvent
Class derived from the TtEvent for the semileptonic decay channel.
Definition: TtSemiLeptonicEvent.h:24
TtSemiLeptonicEvent::hadronicDecayTop
const reco::Candidate * hadronicDecayTop(const std::string &key, const unsigned &cmb=0) const
get hadronic top of the given hypothesis
Definition: TtSemiLeptonicEvent.h:32
TtSemiLeptonicEvent::hadronicDecayW
const reco::Candidate * hadronicDecayW(const std::string &key, const unsigned &cmb=0) const
get hadronic W of the given hypothesis
Definition: TtSemiLeptonicEvent.h:48
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
HypothesisAnalyzer_cff.hypoClassKey
hypoClassKey
Definition: HypothesisAnalyzer_cff.py:10
TtSemiLeptonicEvent::leptonicDecayW
const reco::Candidate * leptonicDecayW(const std::string &key, const unsigned &cmb=0) const
get leptonic W of the given hypothesis
Definition: TtSemiLeptonicEvent.h:88
visualization-live-secondInstance_cfg.outDir
outDir
Definition: visualization-live-secondInstance_cfg.py:74
reco::Candidate
Definition: Candidate.h:27
nevt
int nevt
Definition: ReggeGribovPartonMCHadronizer.h:66
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8