|
@@ -0,0 +1,65 @@
|
|
|
+#define refMultReader_cxx
|
|
|
+#include "refMultReader.h"
|
|
|
+#include <TH2.h>
|
|
|
+#include <TStyle.h>
|
|
|
+#include <TFile.h>
|
|
|
+#include <TCanvas.h>
|
|
|
+
|
|
|
+#include <iostream>
|
|
|
+
|
|
|
+void refMultReader::Loop(const char* outfile)
|
|
|
+{
|
|
|
+// In a ROOT session, you can do:
|
|
|
+// root> .L refMultReader.C
|
|
|
+// root> refMultReader t
|
|
|
+// root> t.GetEntry(12); // Fill t data members with entry number 12
|
|
|
+// root> t.Show(); // Show values of entry 12
|
|
|
+// root> t.Show(16); // Read and show values of entry 16
|
|
|
+// root> t.Loop(); // Loop on all entries
|
|
|
+//
|
|
|
+
|
|
|
+// This is the loop skeleton where:
|
|
|
+// jentry is the global entry number in the chain
|
|
|
+// ientry is the entry number in the current Tree
|
|
|
+// Note that the argument to GetEntry must be:
|
|
|
+// jentry for TChain::GetEntry
|
|
|
+// ientry for TTree::GetEntry and TBranch::GetEntry
|
|
|
+//
|
|
|
+// To read only selected branches, Insert statements like:
|
|
|
+// METHOD1:
|
|
|
+// fChain->SetBranchStatus("*",0); // disable all branches
|
|
|
+// fChain->SetBranchStatus("branchname",1); // activate branchname
|
|
|
+// METHOD2: replace line
|
|
|
+// fChain->GetEntry(jentry); //read all branches
|
|
|
+//by b_branchname->GetEntry(ientry); //read only this branch
|
|
|
+ if (fChain == 0) return;
|
|
|
+
|
|
|
+ TH1F *hMult = new TH1F("hRefMult","refMult (|#eta|<0.5, p_{T}>0.15 GeV/c)",2500,0.,2500.);
|
|
|
+
|
|
|
+ // Long64_t nentries = fChain->GetEntriesFast();
|
|
|
+ Long64_t nentries = 500e3;
|
|
|
+
|
|
|
+ Long64_t nbytes = 0, nb = 0;
|
|
|
+ Int_t refMult;
|
|
|
+ for (Long64_t jentry=0; jentry<nentries;jentry++) {
|
|
|
+ Long64_t ientry = LoadTree(jentry);
|
|
|
+ if (ientry < 0) break;
|
|
|
+ nb = fChain->GetEntry(jentry); nbytes += nb;
|
|
|
+ // if (Cut(ientry) < 0) continue;
|
|
|
+ if (jentry%1000==0) std::cout << "Event [" << jentry << "/"
|
|
|
+ << nentries << "]" << std::endl;
|
|
|
+ refMult = 0;
|
|
|
+ for (int iTr=0; iTr<n_tracks_mpd; iTr++)
|
|
|
+ {
|
|
|
+ if (TMath::Abs(signed_pt_mpd[iTr]) < 0.15) continue;
|
|
|
+ if (TMath::Abs(eta_mpd[iTr]) > 0.5) continue;
|
|
|
+ if (n_hits_mpd[iTr] < 32) continue;
|
|
|
+ refMult++;
|
|
|
+ }
|
|
|
+ hMult->Fill(refMult);
|
|
|
+ }
|
|
|
+ TFile *fo = new TFile(outfile,"recreate");
|
|
|
+ fo->cd();
|
|
|
+ hMult->Write();
|
|
|
+ fo->Close();
|
|
|
+}
|