FairRoot/PandaRoot
hit_analys.C
Go to the documentation of this file.
1 {
2  // Macro to compare angular position of the CbmEmcHit and CbmEmcPoint
3 
4  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
5  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
6  rootlogon();
7  basiclibs();
8 
9  TFile* f = new TFile("hit_emc.root"); // the sim file you want to analyse
10  TTree *t=(TTree *) f->Get("pndsim") ;
11 
12  TClonesArray* hit_array=new TClonesArray("PndEmcHit");
13 
14  t->SetBranchAddress("EmcHit",&hit_array);
15 
17 
18  TH1F *h1= new TH1F("h1","Theta",100,-0.1,0.1);
19 
20  for (Int_t j=0; j< t->GetEntriesFast(); j++)
21  {
22  t->GetEntry(j);
23  for (Int_t i=0; i<hit_array->GetEntriesFast(); i++)
24  {
25  PndEmcHit *hit=(PndEmcHit*)hit_array->At(i);
26  TVector3 hit_pos(hit->GetX(),hit->GetY(),hit->GetZ());
27  hit_theta=hit_pos.Theta();
28 
29  std::vector<PndEmcPoint*> pointList=hit->GetPointList();
30  if (pointList.size()!=0)
31  {
32  TVector3 point_pos(pointList[0]->GetX(),pointList[0]->GetY(),pointList[0]->GetZ());
33  point_theta=point_pos.Theta();
34  h1->Fill(hit_theta-point_theta);
35  }
36  }
37  }
38 
39  TCanvas* c1 = new TCanvas("c1", "", 100, 100, 800, 800);
40  h1->Draw();
41  c1->Update();
42 
43 }
44 
Int_t i
Definition: run_full.C:25
double point_theta
Definition: hit_analys.C:16
TH1F * h1
Definition: hit_analys.C:18
TClonesArray * hit_array
Definition: hit_analys.C:12
std::vector< PndEmcPoint * > & GetPointList()
Definition: PndEmcHit.h:68
TTree * t
Definition: hit_analys.C:10
TFile * f
Definition: hit_analys.C:9
represents the deposited energy of one emc crystal from simulation
Definition: PndEmcHit.h:26
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
TCanvas * c1
Definition: hit_analys.C:39
double hit_theta
Definition: hit_analys.C:16
basiclibs()