Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
decile_RhoFluct.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file decile_RhoFluct.cc
1 #define RhoFluct_cxx
2 #include "RhoFluct.h"
3 #include <TH2.h>
4 #include <TStyle.h>
5 #include <TCanvas.h>
6 
7 void RhoFluct::Loop(string out_name)
8 {
9 // In a ROOT session, you can do:
10 // root> .L RhoFluct.C
11 // root> RhoFluct t
12 // root> t.GetEntry(12); // Fill t data members with entry number 12
13 // root> t.Show(); // Show values of entry 12
14 // root> t.Show(16); // Read and show values of entry 16
15 // root> t.Loop(); // Loop on all entries
16 //
17 
18 // This is the loop skeleton where:
19 // jentry is the global entry number in the chain
20 // ientry is the entry number in the current Tree
21 // Note that the argument to GetEntry must be:
22 // jentry for TChain::GetEntry
23 // ientry for TTree::GetEntry and TBranch::GetEntry
24 //
25 // To read only selected branches, Insert statements like:
26 // METHOD1:
27 // fChain->SetBranchStatus("*",0); // disable all branches
28 // fChain->SetBranchStatus("branchname",1); // activate branchname
29 // METHOD2: replace line
30 // fChain->GetEntry(jentry); //read all branches
31 //by b_branchname->GetEntry(ientry); //read only this branch
32  if (fChain == 0) return;
33 
34  TFile* fout = new TFile(voi_stem(out_name,".root").c_str(),"recreate");
35 
36  array<TH1D*,10> harr_sub1, harr_rhoA;
37  for (int i=0; i<10; ++i) {
38  int i0 = i*10;
39  int i1 = i*10+10;
40  harr_sub1[i] = new TH1D(Form("fluct_sub1_%i",i),
41  Form("impact param [%4.2f-%4.2f];p_{T,jet}^{SUB1+probe}-p_{T}^{probe};N_{events}", IP_DEC[i], IP_DEC[i+1]), 400, -50, 50);
42  harr_rhoA[i] = new TH1D(Form("fluct_rhoA_%i",i),
43  Form("impact param [%4.2f-%4.2f];(p_{T,jet}^{calo+probe}-#rho#timesA)-p_{T}^{probe};N_{events}", IP_DEC[i], IP_DEC[i+1]), 400, -50, 50);
44  }
45 
46  Long64_t nentries = fChain->GetEntriesFast();
47 
48  Long64_t nbytes = 0, nb = 0;
49  for (Long64_t jentry=0; jentry<nentries;jentry++) {
50  Long64_t ientry = LoadTree(jentry);
51  if (ientry < 0) break;
52  nb = fChain->GetEntry(jentry); nbytes += nb;
53  // if (Cut(ientry) < 0) continue;
54 
56  if (k<0 || k>9) {
57  cout << "bad impact parameter; should NEVER happen" << endl;
58  }
59 
61  // Do the sub1 fluctuations
62  if (sub1_ismatched) {
63  harr_sub1[k]->Fill(sub1Jet_delPt);
64  }
65  if (rhoA_ismatched) {
66  harr_rhoA[k]->Fill(rhoAJet_delPt);
67  }
68 
69  /* if (true) if (jentry > 1000) break; */
70  }
71 
72  for (int k=0;k<10;++k) {
73  harr_sub1[k]->Write();
74  harr_rhoA[k]->Write();
75  }
76  fout->Close();
77 }