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;
32 gSystem->Load(
"libFWCoreFWLite");
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.);
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.);
52 TFile* inFile = TFile::Open(
argv[1]);
53 TTree* events_ =
nullptr;
55 inFile->GetObject(
"Events", events_);
56 if (events_ ==
nullptr) {
58 std::cerr <<
"ERROR: Unable to retrieve TTree Events!" << std::endl
59 <<
"Either wrong file name or the tree doesn't exist." << std::endl;
66 sprintf(decayName,
"recoGenParticles_decaySubset__%s.obj",
argv[2]);
67 TBranch* decay_ = events_->GetBranch(decayName);
68 assert(decay_ !=
nullptr);
70 sprintf(genEvtName,
"TtGenEvent_genEvt__%s.obj",
argv[2]);
71 TBranch* genEvt_ = events_->GetBranch(genEvtName);
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);
79 int nevt = events_->GetEntries();
82 std::cout <<
"start looping " << nevt <<
" events..." << std::endl;
84 for (
int evt = 0; evt <
nevt; ++evt) {
86 semiLepEvt_->SetAddress(&semiLepEvt);
88 decay_->GetEntry(evt);
89 genEvt_->GetEntry(evt);
90 semiLepEvt_->GetEntry(evt);
91 events_->GetEntry(evt, 0);
94 if (evt > 0 && !(evt % 10))
95 std::cout <<
" processing event: " << evt << std::endl;
101 <<
"Hypothesis not available for this event" << std::endl;
106 <<
"Hypothesis not valid for this event" << std::endl;
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());
121 lepWPt_->Fill(lepW->
pt());
122 lepWMass_->Fill(lepW->
mass());
123 lepTopPt_->Fill(lepTop->
pt());
124 lepTopMass_->Fill(lepTop->
mass());
133 TFile
outFile(
"analyzeHypothesis.root",
"recreate");
135 TString
outDir =
"analyze" +
std::string(hypoClassKey, 1, hypoClassKey.length());
141 hadTopMass_->Write();
145 lepTopMass_->Write();
const reco::Candidate * leptonicDecayW(const std::string &key, const unsigned &cmb=0) const
get leptonic W of the given hypothesis
bool isHypoAvailable(const std::string &key, const unsigned &cmb=0) const
const reco::Candidate * hadronicDecayW(const std::string &key, const unsigned &cmb=0) const
get hadronic W of the given hypothesis
const reco::Candidate * hadronicDecayTop(const std::string &key, const unsigned &cmb=0) const
get hadronic top of the given hypothesis
Class derived from the TtEvent for the semileptonic decay channel.
static void enable()
enable automatic library loading
const reco::Candidate * leptonicDecayTop(const std::string &key, const unsigned &cmb=0) const
get leptonic top of the given hypothesis
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
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...