9 void ReadJetTree2009(
int nentries = 1e6,
10 const char* jetfile =
"jets.root",
11 const char* skimfile =
"skim.root",
12 const char* outfile =
"out.root")
14 cout <<
"nentries = " << nentries << endl;
15 cout <<
"jetfile = " << jetfile << endl;
16 cout <<
"skimfile = " << skimfile << endl;
17 cout <<
"outfile = " << outfile << endl;
20 gSystem->Load(
"StJetEvent");
21 gSystem->Load(
"StJetSkimEvent");
24 TChain* jetChain =
new TChain(
"jet");
25 TChain* skimChain =
new TChain(
"jetSkimTree");
27 jetChain->Add(jetfile);
28 skimChain->Add(skimfile);
32 jetChain->SetBranchAddress(
"ConeJets12",&jets);
36 skimChain->SetBranchAddress(
"skimEventBranch",&skim);
39 TFile* ofile = TFile::Open(outfile,
"recreate");
42 TH1F* hTriggers =
new TH1F(
"hTriggers",
";trigger ID",5,0,5);
43 TH1F* hVertexZ =
new TH1F(
"hVertexZ",
";z-vertex [cm]",100,-200,200);
45 TH1F* hJetPt =
new TH1F(
"hJetPt",
";jet pt [GeV]",100,0,100);
46 TH1F* hJetEta =
new TH1F(
"hJetEta",
";jet #eta",100,-1.5,1.5);
47 TH1F* hJetPhi =
new TH1F(
"hJetPhi",
";jet #phi [radians]",100,-TMath::Pi(),TMath::Pi());
48 TH1F* hJetRt =
new TH1F(
"hJetRt",
";R_{T}",101,0,1.01);
49 TH1F* hNtracks =
new TH1F(
"hNtracks",
";track multiplicity",50,0,50);
50 TH1F* hNtowers =
new TH1F(
"hNtowers",
";tower multiplicity",50,0,50);
52 TH1F* hTrackPt =
new TH1F(
"hTrackPt",
";track pt [GeV]",100,0,100);
53 TH1F* hTrackEta =
new TH1F(
"hTrackEta",
";track #eta",100,-1.5,1.5);
54 TH1F* hTrackPhi =
new TH1F(
"hTrackPhi",
";track #phi [radians]",100,-TMath::Pi(),TMath::Pi());
56 TH1F* hTowerPt =
new TH1F(
"hTowerPt",
";tower pt [GeV]",100,0,100);
57 TH1F* hTowerEta =
new TH1F(
"hTowerEta",
";tower #eta",100,-1.5,1.5);
58 TH1F* hTowerPhi =
new TH1F(
"hTowerPhi",
";tower #phi [radians]",100,-TMath::Pi(),TMath::Pi());
61 for (
int iEntry = 0; iEntry < nentries; ++iEntry) {
62 if (jetChain->GetEvent(iEntry) <= 0 || skimChain->GetEvent(iEntry) <= 0)
break;
68 assert(jets->runId() == skim->runId() && jets->eventId() == skim->eventId());
71 if (iEntry % 1000 == 0) cout << iEntry << endl;
74 for (
int i = 0; i < skim->triggers()->GetEntriesFast(); ++i) {
77 if (trig && trig->didFire()) {
78 hTriggers->Fill(Form(
"%d",trig->trigId()),1);
83 hVertexZ->Fill(jets->vertex()->position().z());
86 for (
int iJet = 0; iJet < jets->vertex()->numberOfJets(); ++iJet) {
88 hJetPt->Fill(jet->pt());
89 hJetEta->Fill(jet->eta());
90 hJetPhi->Fill(jet->phi());
91 hJetRt->Fill(jet->neutralFraction());
92 hNtracks->Fill(jet->numberOfTracks());
93 hNtowers->Fill(jet->numberOfTowers());
95 for (
int iTrack = 0; iTrack < jet->numberOfTracks(); ++iTrack) {
97 hTrackPt->Fill(track->pt());
98 hTrackEta->Fill(track->eta());
99 hTrackPhi->Fill(track->phi());
102 for (
int iTower = 0; iTower < jet->numberOfTowers(); ++iTower) {
104 hTowerPt->Fill(tower->pt());
105 hTowerEta->Fill(tower->eta());
106 hTowerPhi->Fill(tower->phi());
112 hTriggers->LabelsDeflate();