FairRoot/PandaRoot
drawMvdHistos.C
Go to the documentation of this file.
1 double CalcEventsPerYear(Int_t simEvents, Int_t interactionRate = 2*1E7, Double_t dutyCycle = 0.5)
2 {
3  Int_t secondsPerYear = 60*60*24*365;
4  return (double)interactionRate/simEvents * secondsPerYear * dutyCycle;
5 }
6 
7 
8 int drawMvdHistos(TString fileName, TString selector, Int_t columns = 2, Int_t mult = 1)
9 {
10  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
11  gROOT->LoadMacro("$VMCWORKDIR/macro/mvd/TransformHisto.C");
12  gStyle->SetPalette(1);
13 // gSystem->Load("libEve");
14 // gROOT->LoadMacro("DrawEveHisto.C");
15 
16  TFile f(fileName);
17  TGeoManager* fGeoMan = new TGeoManager("geoMan","geoMan");
18  fGeoMan->Import("Mvd_GridUrqmdSim.root");
20 
21  TString id = gH->GetVolumeID(selector);
22 
23  //TEveManager::Create();
24 
25  TList* l = f.GetListOfKeys();
26  TIter iter(l);
27  TIter iter2(l);
28  TObject* ob;
29  int NHistos = 0;
30  double max = 0, oldMax = 0;
31 
32  TString path;
33  while(ob = iter()){
34  if (TString(ob->GetName()).Contains(id)){
35  NHistos++;
36  TH2D* histo = (TH2D*)(f.Get(ob->GetName()));
37  max = histo->GetMaximum();
38  if (max > oldMax)
39  oldMax = max;
40  }
41  }
42  max = oldMax*1.1;
43 
44  TCanvas *c1 = new TCanvas();
45  c1->Divide(columns, NHistos/columns);
46  TH1D h1("h1",selector, 1000,0,max*CalcEventsPerYear(mult, 1E6));
47 
48  int i = 0;
49  while(ob = iter2()){
50  if (TString(ob->GetName()).Contains(id)){
51  TH2D* histo = (TH2D*)(f.Get(ob->GetName()));
52  TF1* f1 = new TF1("f1","1",-100,100);
53  histo->Multiply(f1, CalcEventsPerYear(mult, 1E6));
54  c1->cd(++i);
55  histo->DrawCopy("colz");
56  TH1D htemp(TransformHisto(histo,0,max*CalcEventsPerYear(mult,1E6)));
57  h1.Add(&htemp);
58  }
59  }
60  TCanvas *c2 = new TCanvas();
61  c2->cd(1);
62  h1.DrawCopy();
63  return 0;
64 
65 }
Int_t i
Definition: run_full.C:25
TF1 * f1
Definition: reco_analys2.C:50
c2
Definition: plot_dirc.C:39
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
TGeoManager * gGeoManager
TH1D TransformHisto(TH2 *h2, double min, double max)
Definition: style/Tools.C:300
Class to access the naming information of the MVD.
TString GetVolumeID(TString name)
returns the volume ID for a given volume name
Double_t
TFile * f
Definition: bump_analys.C:12
c1
Definition: plot_dirc.C:35
int drawMvdHistos(TString fileName, TString selector, Int_t columns=2, Int_t mult=1)
Definition: drawMvdHistos.C:8
double CalcEventsPerYear(Int_t simEvents, Int_t interactionRate=2 *1E7, Double_t dutyCycle=0.5)
Definition: drawMvdHistos.C:1
Double_t mult
TH1D * htemp[nsteps]
Definition: dedx_bands.C:61