Fork me on GitHub

Ticket #997: mononew_zero_jet_left_subjet_1.C

File mononew_zero_jet_left_subjet_1.C, 2.4 KB (added by Nikolay Kolev, 8 years ago)
Line 
1#define mononew_zero_jet_left_subjet_1_cxx
2#include "mononew_zero_jet_left_subjet_1.h"
3#include <TH2.h>
4#include <TStyle.h>
5#include <TCanvas.h>
6#include <TLorentzVector.h>
7
8void mononew_zero_jet_left_subjet_1::Loop()
9{
10// In a ROOT session, you can do:
11// Root > .L mononew_zero_jet_left_subjet_1.C
12// Root > mononew_zero_jet_left_subjet_1 t
13// Root > t.GetEntry(12); // Fill t data members with entry number 12
14// Root > t.Show(); // Show values of entry 12
15// Root > t.Show(16); // Read and show values of entry 16
16// Root > t.Loop(); // Loop on all entries
17//
18
19// This is the loop skeleton where:
20// jentry is the global entry number in the chain
21// ientry is the entry number in the current Tree
22// Note that the argument to GetEntry must be:
23// jentry for TChain::GetEntry
24// ientry for TTree::GetEntry and TBranch::GetEntry
25//
26// To read only selected branches, Insert statements like:
27// METHOD1:
28// fChain->SetBranchStatus("*",0); // disable all branches
29// fChain->SetBranchStatus("branchname",1); // activate branchname
30// METHOD2: replace line
31// fChain->GetEntry(jentry); //read all branches
32//by b_branchname->GetEntry(ientry); //read only this branch
33 if (fChain == 0) return;
34
35 Long64_t nentries = fChain->GetEntriesFast();
36
37 Long64_t nbytes = 0, nb = 0;
38 for (Long64_t jentry=0; jentry<nentries;jentry++) {
39 Long64_t ientry = LoadTree(jentry);
40 if (ientry < 0) break;
41 nb = fChain->GetEntry(jentry); nbytes += nb;
42 // if (Cut(ientry) < 0) continue;
43 }
44}
45
46void mononew_zero_jet_left_subjet_1::Preprocess()
47{
48 int evEntry = 0;
49
50 ofstream out_file("mononew_zero_jet_left_subjet_1.ppdat");
51
52 // while (GetEntry(evEntry) != 0)
53 // GetEntry(evEntry);
54 while (evEntry < 100)
55 {
56 GetEntry(evEntry);
57
58 for (int i = 0; i < Jet_; i++)
59 {
60 out_file << Jet_NSubJetsTrimmed[i] << endl;
61
62 // This is just an example:
63 out_file << (Jet_TrimmedP4[0][i])[0] << " "
64 << (Jet_TrimmedP4[1][i])[0] << " "
65 << (Jet_TrimmedP4[2][i])[0] << " "
66 << (Jet_TrimmedP4[3][i])[0] << " "
67 << (Jet_TrimmedP4[4][i])[0] << endl;
68 }
69
70 out_file << Jet_ << endl;
71
72 evEntry++;
73
74 } // end while on events
75
76 out_file.close();
77
78}
79
80
81