20 std::cerr <<
"ERROR: Wrong number of arguments!" << std::endl
21 <<
"Please specify: * file name" << std::endl
22 <<
" * process name" << std::endl
23 <<
" * HypoClassKey" << std::endl
24 <<
"Example: TopHypothesisFWLiteAnalyzer ttSemiLepEvtBuilder.root TEST kGeom" << std::endl;
33 gSystem->Load(
"libFWCoreFWLite" );
40 TH1F* hadWPt_ =
new TH1F(
"hadWPt",
"p_{t} (W_{had}) [GeV]", 100, 0., 500.);
41 TH1F* hadWMass_ =
new TH1F(
"hadWMass",
"M (W_{had}) [GeV]", 50, 0., 150.);
42 TH1F* hadTopPt_ =
new TH1F(
"hadTopPt",
"p_{t} (t_{had}) [GeV]", 100, 0., 500.);
43 TH1F* hadTopMass_=
new TH1F(
"hadTopMass",
"M (t_{had}) [GeV]", 50, 50., 250.);
45 TH1F* lepWPt_ =
new TH1F(
"lepWPt",
"p_{t} (W_{lep}) [GeV]", 100, 0., 500.);
46 TH1F* lepWMass_ =
new TH1F(
"lepWMass",
"M (W_{lep}) [GeV]", 50, 0., 150.);
47 TH1F* lepTopPt_ =
new TH1F(
"lepTopPt",
"p_{t} (t_{lep}) [GeV]", 100, 0., 500.);
48 TH1F* lepTopMass_=
new TH1F(
"lepTopMass",
"M (t_{lep}) [GeV]", 50, 50., 250.);
51 std::cout <<
"open file: " << argv[1] << std::endl;
53 TFile* inFile = TFile::Open(argv[1]);
55 if( inFile ) inFile->GetObject(
"Events", events_);
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_ != 0 );
70 sprintf(genEvtName,
"TtGenEvent_genEvt__%s.obj", argv[2]);
71 TBranch* genEvt_ = events_->GetBranch( genEvtName );
72 assert( genEvt_ != 0 );
73 char semiLepEvtName[50];
74 sprintf(semiLepEvtName,
"TtSemiLeptonicEvent_ttSemiLepEvent__%s.obj", argv[2]);
75 TBranch* semiLepEvt_ = events_->GetBranch( semiLepEvtName );
76 assert( semiLepEvt_ != 0 );
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))
std::cout <<
" processing event: " << evt << std::endl;
99 std::cerr <<
"NonValidHyp:: " <<
"Hypothesis not available for this event" << std::endl;
103 std::cerr <<
"NonValidHyp::" <<
"Hypothesis not valid for this event" << std::endl;
112 if(hadTop && hadW && lepTop && lepW){
113 hadWPt_ ->Fill( hadW->
pt() );
114 hadWMass_ ->Fill( hadW->
mass() );
115 hadTopPt_ ->Fill( hadTop->
pt() );
116 hadTopMass_->Fill( hadTop->
mass());
118 lepWPt_ ->Fill( lepW->
pt() );
119 lepWMass_ ->Fill( lepW->
mass() );
120 lepTopPt_ ->Fill( lepTop->
pt() );
121 lepTopMass_->Fill( lepTop->
mass());
130 TFile
outFile(
"analyzeHypothesis.root",
"recreate" );
132 TString outDir =
"analyze" +
std::string(hypoClassKey, 1, hypoClassKey.length());
133 outFile.mkdir(outDir);
136 hadWMass_ ->Write( );
137 hadTopPt_ ->Write( );
138 hadTopMass_->Write( );
140 lepWMass_ ->Write( );
141 lepTopPt_ ->Write( );
142 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...
int main(int argc, char *argv[])