FairRoot/PandaRoot
plotDC02AnalyzedData.C
Go to the documentation of this file.
1 double FindMax(TFile* f, TString select)
2 {
3  TList* l = f->GetListOfKeys();
4  TIter iter(l);
5  TObject *ob;
6  TString maxName;
7 
8  double max, oldMax = 0;
9  while (ob = iter()) {
10  if (TString(ob->GetName()).Contains(select)) {
11  TH2D* histo = (TH2D*) (f->Get(ob->GetName()));
12  max = histo->GetMaximum();
13  // std::cout << "Maxmium: " << max << std::endl;
14  if (max > oldMax){
15  oldMax = max;
16  maxName = histo->GetName();
17  }
18  }
19  }
20  std::cout << "Maximum counts in: " << maxName << " " << oldMax << std::endl;
21  return oldMax;
22 }
23 
25 {
26  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
27  gSystem->Load("libEve");
28  gROOT->LoadMacro("DrawEveHisto.C");
29 
30  TFile* f = new TFile(fileName);
31  TGeoManager* fGeoMan = new TGeoManager("geoMan","geoMan");
32  fGeoMan->Import("Mvd_GridUrqmdSim.root");
34 
35  TEveManager::Create();
36 
37 // TIter iter2(l);
38 
39  TEveCompound* comp = new TEveCompound("RadDamHistos");
40  TEveCompound* pixelBL1 = new TEveCompound("PixelBL1");
41  TEveCompound* pixelBL2 = new TEveCompound("PixelBL2");
42  TEveCompound* pixelSDK = new TEveCompound("PixelSDK");
43  TEveCompound* pixelMDK = new TEveCompound("PixelMDK");
44  TEveCompound* strip = new TEveCompound("Strip");
45  TEveCompound* stripBL3 = new TEveCompound("StripBL3");
46  TEveCompound* stripBL4 = new TEveCompound("StripBL4");
47  TEveCompound* stripLDK = new TEveCompound("StripLDK");
48  comp->AddElement(pixelBL1);
49  comp->AddElement(pixelBL2);
50  comp->AddElement(pixelSDK);
51  comp->AddElement(pixelMDK);
52  comp->AddElement(strip);
53  strip->AddElement(stripBL3);
54  strip->AddElement(stripBL4);
55  strip->AddElement(stripLDK);
56 
57  double pixMax = FindMax(f, "1_1");
58  double stripMax = FindMax(f, gH->GetVolumeID("StripActiveoRectL"));
59 
60  stripMax = 60;
61 
62 // std::cout << "max: " << max << " stripMax: " << stripMax << std::endl;
63 
64 // std::cout << "OldMax: " << oldMax << std::endl;
65  TList* l = f->GetListOfKeys();
66  TIter iter(l);
67  TObject* ob;
68 
69  while(ob = iter()){
70  if (TString(ob->GetName()).Contains("1_1")){
71  TEveCompound* tempComp;
72  double tempMax;
73  if (TString(ob->GetName()).Contains(gH->GetVolumeID("PixeloBl1ov2-NEW"))){
74  tempComp = pixelBL1;
75  tempMax = pixMax;
76  }
77  else if (TString(ob->GetName()).Contains(gH->GetVolumeID("PixeloBl2ov3-NEW"))){
78  tempComp = pixelBL2;
79  tempMax = pixMax;
80  }
81  else if (TString(ob->GetName()).Contains(gH->GetVolumeID("PixeloSdk-v2-NEW"))){
82  tempComp = pixelSDK;
83  tempMax = pixMax;
84  }
85  else if (TString(ob->GetName()).Contains(gH->GetVolumeID("PixeloMdkov1-NEW"))){
86  tempComp = pixelMDK;
87  tempMax = pixMax;
88  }
89  else if (TString(ob->GetName()).Contains(gH->GetVolumeID("StripoBl3"))){
90  tempComp = stripBL3;
91  tempMax = stripMax;
92  }
93  else if (TString(ob->GetName()).Contains(gH->GetVolumeID("StripoBL4")) &&
94  !TString(ob->GetName()).Contains(gH->GetVolumeID("StripActiveoTrapL"))){
95  tempComp = stripBL4;
96  tempMax = stripMax;
97  }
98  else{
99  tempComp = stripLDK;
100  tempMax = stripMax;
101  }
102  TH2D* histo = (TH2D*)(f->Get(ob->GetName()));
103  PndStringVector sVec(histo->GetName());
104  TGeoHMatrix* matrix = gH.GetMatrixId(sVec.Replace("o","/"));
105 // std::cout << "OldMax2: " << oldMax << std::endl;
106  DrawEveHisto(histo, matrix, tempMax, tempComp);
107  }
108  }
109 
110  TGeoNode *N= gGeoManager->GetTopNode();
111  TEveGeoTopNode *TNod=new TEveGeoTopNode(gGeoManager, N);
112  gEve->AddGlobalElement(TNod);
113  gEve->AddGlobalElement(comp);
114  gEve->Redraw3D(kTRUE);
115  return 0;
116 }
void select(CandList &in, CandList &out, int chrg=0, int pdg=0, double mass=0.139)
double FindMax(TFile *f, TString select)
int plotDC02AnalyzedData(TString fileName)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
TGeoManager * gGeoManager
int DrawEveHisto(TH2 *histo, TGeoHMatrix *matrix, double max=-1., TEveCompound *comp=0)
Definition: DrawEveHisto.C:1
Class to access the naming information of the MVD.
TString GetVolumeID(TString name)
returns the volume ID for a given volume name
TFile * f
Definition: bump_analys.C:12