FairRoot/PandaRoot
Functions | Variables
TrackPointsVis.C File Reference
#include <map>

Go to the source code of this file.

Functions

void Init ()
 
void SetEntryNr (Int_t nr)
 
void Next ()
 
void Draw ()
 
void ExtractData (TClonesArray *array, TGraph *g)
 
int TrackPointsVis ()
 

Variables

Int_t gEntryNr = 0
 
TTree * t
 
TClonesArray * mvdHitArray = new TClonesArray("PndSdsHit")
 
TClonesArray * mvdProjectedArray = new TClonesArray("PndSdsHit")
 
TClonesArray * trackArray = new TClonesArray("PndTrack")
 
TGraph * gHitPoints = new TGraph(4)
 
TGraph * gProjections = new TGraph(4)
 
TMultiGraph * mg = new TMultiGraph()
 

Function Documentation

void Draw ( )

Definition at line 63 of file TrackPointsVis.C.

References ExtractData(), gHitPoints, gProjections, mvdHitArray, and mvdProjectedArray.

Referenced by Next(), and TrackPointsVis().

63  {
64 
65  std::cout << "mvdHitArray: " << mvdHitArray->GetEntries() << " projectedHitArray " << mvdProjectedArray->GetEntries() << std::endl;
66 
67 // gHitPoints->Clear();
70  //if (gHitPoints->GetN() != x.size()) gHitPoints->Expand(x.size());
71 
72  std::cout << "NHits: " << gHitPoints->GetN() << std::endl;
73  gHitPoints->Draw("apl");
74  gProjections->Draw("pl");
75 }
TGraph * gProjections
TGraph * gHitPoints
TClonesArray * mvdHitArray
TClonesArray * mvdProjectedArray
void ExtractData(TClonesArray *array, TGraph *g)
void ExtractData ( TClonesArray *  array,
TGraph *  g 
)

Definition at line 77 of file TrackPointsVis.C.

References i, x, and y.

Referenced by Draw().

77  {
78  std::map<Double_t, Double_t> x;
79  std::map<Double_t, Double_t> y;
80  for (int i = 0; i < array->GetEntriesFast(); i++){
81  PndSdsHit* myHit = (PndSdsHit*)array->At(i);
82  x[myHit->GetZ()] = myHit->GetX();
83  y[myHit->GetZ()] = myHit->GetY();
84  std::cout << i << " : (" << myHit->GetX() << "/" << myHit->GetY() << "/" << myHit->GetZ() << ")" << std::endl;
85  }
86  for (int j = 0; j < g->GetN(); j++) g->RemovePoint(j);
87 
88  std::map<Double_t, Double_t >::iterator yit = y.begin();
89  int i = 0;
90  for (std::map<Double_t, Double_t >::iterator xit = x.begin() ; xit != x.end(); xit++, yit++, i++){
91  g->SetPoint(i, xit->second, yit->second);
92  }
93 }
Int_t i
Definition: run_full.C:25
TFile * g
Double_t x
Double_t y
void Init ( )

Initialize the session

Definition at line 19 of file TrackPointsVis.C.

References f, gHitPoints, gProjections, mg, mvdHitArray, mvdProjectedArray, t, and trackArray.

Referenced by ClassImp(), PndMvdPixelDigiSorterTask::Init(), PndMvdDigiPixelDraw::Init(), PndDrcAccuDigiPixelDraw::Init(), PndTrackCandDraw::Init(), FairFilteredPrimaryGenerator::Init(), PndFilteredPrimaryGenerator::Init(), and TrackPointsVis().

20 {
21  TFile* f = new TFile("2014-10-27-00-06-02_50_MHz_Filtered_PosCorrected_Event.root", "READ");
22  t = (TTree*)f->Get("pndsim");
23  t->AddFriend("pndsim", "2014-10-27-00-06-02_50_MHz_Filtered_PosCorrected_Residuals.root");
24  t->AddFriend("pndsim", "2014-10-27-00-06-02_50_MHz_Filtered_PosCorrected_Track.root");
25  t->AddFriend("pndsim", "2014-10-27-00-06-02_50_MHz_Filtered_TimeCorrectedSorted_Event.root");
26  t->StartViewer();
27 
28  t->SetBranchAddress("MVDHitsPixelPosCorrected", &mvdHitArray);
29  t->SetBranchAddress("MvdProjectedHit", &mvdProjectedArray);
30  t->SetBranchAddress("MvdTrack", &trackArray);
31 
32  gHitPoints->SetLineColor(kRed);
33  gHitPoints->SetMarkerStyle(2);
34  gHitPoints->SetMarkerColor(kRed);
35 
36  gProjections->SetLineColor(kBlue);
37  gProjections->SetMarkerStyle(5);
38  gProjections->SetMarkerColor(kBlue);
39 
40 
41 // mg->Add(gProjections, "Projected");
42  mg->Add(gHitPoints, "Hits");
43  t->GetEntry(0);
44 }
TGraph * gProjections
TFile * f
Definition: bump_analys.C:12
TGraph * gHitPoints
TClonesArray * mvdHitArray
TClonesArray * trackArray
TMultiGraph * mg
TClonesArray * mvdProjectedArray
TTree * t
void Next ( )

Definition at line 51 of file TrackPointsVis.C.

References Bool_t, Draw(), gEntryNr, mvdProjectedArray, run, and t.

51  {
52  Bool_t run = kTRUE;
53  while(run){
54  t->GetEntry(++gEntryNr);
55  if (mvdProjectedArray->GetEntriesFast() > 0){
56  run = kFALSE;
57  }
58  }
59  std::cout << "NextEntry: " << gEntryNr << std::endl;
60  Draw();
61 }
Int_t run
Definition: autocutx.C:47
void Draw()
Int_t gEntryNr
TClonesArray * mvdProjectedArray
TTree * t
void SetEntryNr ( Int_t  nr)

Definition at line 46 of file TrackPointsVis.C.

References gEntryNr, and t.

46  {
47  gEntryNr = nr;
48  t->GetEntry(gEntryNr);
49 }
Int_t gEntryNr
TTree * t
int TrackPointsVis ( )

Definition at line 95 of file TrackPointsVis.C.

References Draw(), and Init().

96 {
97  Init();
98  Draw();
99  return 0;
100 }
void Init()
void Draw()

Variable Documentation

Int_t gEntryNr = 0

Definition at line 10 of file TrackPointsVis.C.

Referenced by Next(), and SetEntryNr().

TGraph* gHitPoints = new TGraph(4)

Definition at line 15 of file TrackPointsVis.C.

Referenced by Draw(), and Init().

TGraph* gProjections = new TGraph(4)

Definition at line 16 of file TrackPointsVis.C.

Referenced by Draw(), and Init().

TMultiGraph* mg = new TMultiGraph()

Definition at line 17 of file TrackPointsVis.C.

Referenced by Init().

TClonesArray* mvdHitArray = new TClonesArray("PndSdsHit")

Definition at line 12 of file TrackPointsVis.C.

Referenced by Draw(), and Init().

TClonesArray* mvdProjectedArray = new TClonesArray("PndSdsHit")

Definition at line 13 of file TrackPointsVis.C.

Referenced by Draw(), Init(), and Next().

TTree* t

Definition at line 11 of file TrackPointsVis.C.

Referenced by Init(), Next(), and SetEntryNr().

TClonesArray* trackArray = new TClonesArray("PndTrack")

Definition at line 14 of file TrackPointsVis.C.

Referenced by Init().