FEDRA emulsion software from the OPERA Collaboration
traceback.C File Reference

Functions

void drawXYview ()
 
EdbSegmentgetRawSeg (int vid, int sid)
 
EdbSegPgetS1 (int areaID=28, int viewID=56, int segID=74)
 
EdbSegPgetS2 (int areaID=28, int viewID=56, int segID=74)
 
void init (char *frun="data/seg.root", char *fcp="data/02_011.cp.root")
 
void traceback ()
 

Variables

EdbSegCouplecp =0
 
EdbRunrun
 
EdbSegPs =0
 
EdbSegPs1 =0
 
EdbSegPs2 =0
 
TTree * tree_s1
 
TTree * tree_s2
 

Function Documentation

◆ drawXYview()

void drawXYview ( )
54 {
55  // plot position of linked microtrack in view RS
56 
57  TH2F *top = new TH2F("top","top",180, -180.,180., 150, -150.,150.);
58  TH2F *bot = new TH2F("bot","bot",180, -180.,180., 150, -150.,150.);
59 
60  init();
61 
62  EdbView *view = run->GetView();
63  EdbSegment *seg;
64 
65  int nentr = (int)(tree_s1->GetEntries());
66  for(int i=0; i<nentr; i++ ) {
67  tree_s1->GetEntry(i);
68  seg = getRawSeg(s1->Vid(0), s1->Vid(1));
69  top->Fill( seg->GetX0(), seg->GetY0() );
70  tree_s2->GetEntry(i);
71  seg = getRawSeg(s2->Vid(0), s2->Vid(1));
72  bot->Fill( seg->GetX0(), seg->GetY0() );
73  }
74  TCanvas *c1 = new TCanvas("c1");
75  top->Draw();
76  TCanvas *c2 = new TCanvas("c2");
77  bot->Draw();
78 }
EdbView * GetView() const
Definition: EdbRun.h:109
virtual Float_t GetX0() const
Definition: EdbSegment.h:37
virtual Float_t GetY0() const
Definition: EdbSegment.h:38
Int_t Vid(int i) const
Definition: EdbSegP.h:165
Definition: EdbSegment.h:61
Definition: EdbView.h:134
TCanvas * c1
Definition: energy.C:13
TCanvas * c2
Definition: energy.C:26
new TCanvas()
void init(char *frun="data/seg.root", char *fcp="data/02_011.cp.root")
Definition: traceback.C:81
TTree * tree_s1
Definition: traceback.C:12
EdbSegP * s1
Definition: traceback.C:16
TTree * tree_s2
Definition: traceback.C:13
EdbSegment * getRawSeg(int vid, int sid)
Definition: traceback.C:101
EdbSegP * s2
Definition: traceback.C:17
EdbRun * run
Definition: traceback.C:11

◆ getRawSeg()

EdbSegment* getRawSeg ( int  vid,
int  sid 
)
102 {
103  view = run->GetEntry(vid);
104  return view->GetSegment(sid);
105 }
EdbView * GetEntry(int entry, int ih=1, int icl=0, int iseg=1, int itr=0, int ifr=0)
Definition: EdbRun.cxx:489
EdbSegment * GetSegment(int i) const
Definition: EdbView.h:219

◆ getS1()

EdbSegP* getS1 ( int  areaID = 28,
int  viewID = 56,
int  segID = 74 
)
109 {
110  int entry = run->GetEntryNumberWithIndex(areaID,viewID);
111  tree_s1->GetEntryWithIndex(entry,segID);
112  //s1->Print();
113  return s1;
114 }
TLegendEntry * entry
Definition: Canv_SYSTEMATICS_ALLCOMBINED__RMSEnergy__vs__Energy__ELECTRON.C:130
int GetEntryNumberWithIndex(int event, int view) const
Definition: EdbRun.h:150

◆ getS2()

EdbSegP* getS2 ( int  areaID = 28,
int  viewID = 56,
int  segID = 74 
)
118 {
119  int entry = run->GetEntryNumberWithIndex(areaID,viewID);
120  tree_s2->GetEntryWithIndex(entry,segID);
121  //s2->Print();
122  return s2;
123 }

◆ init()

void init ( char *  frun = "data/seg.root",
char *  fcp = "data/02_011.cp.root" 
)
83 {
84  run = new EdbRun(frun);
85 
86  TFile *file_s1 = new TFile(fcp);
87  tree_s1 = (TTree*)file_s1->Get("couples");
88  tree_s1->SetBranchAddress("s1." , &s1 );
89  tree_s1->BuildIndex("s1.eVid[0]","s1.eVid[1]");
90 
91  TFile *file_s2 = new TFile(fcp);
92  tree_s2 = (TTree*)file_s2->Get("couples");
93  tree_s2->SetBranchAddress("s2." , &s2 );
94  tree_s2->BuildIndex("s2.eVid[0]","s2.eVid[1]");
95 
96  int nentr = (int)(tree_s1->GetEntries());
97  printf("nentr = %d\n",nentr);
98 }
Definition: EdbRun.h:74

◆ traceback()

void traceback ( )
22 {
23  // in this example is illustrated how to find raw segments for a given linked one
24  // and vice versa
25 
26  init();
27 
28  EdbView *view = run->GetView();
29  EdbSegment *seg;
30 
31  int nentr = (int)(tree_s1->GetEntries());
32  for(int i=0; i<20; i++ ) {
33 
34  printf("\ns1 (TOP):\n");
35  tree_s1->GetEntry(i);
36  printf("by using Vid of EdbSegP: %f %f %f %f\n", s1->TX(),s1->TY(),s1->W(), s1->Z());
37  seg = getRawSeg(s1->Vid(0), s1->Vid(1));
38  printf( "find raw EdbSegment : %f %f %f %f\n", seg->GetTx(),seg->GetTy(),seg->GetPuls(),seg->GetZ0());
39  EdbSegP *ss1=getS1( view->GetAreaID(), view->GetViewID(), seg->GetID() );
40  printf( "and then get again s1 : %f %f %f %f\n", ss1->TX(),ss1->TY(),ss1->W(), ss1->Z());
41 
42  printf("\ns2 (BOTTOM):\n");
43  tree_s2->GetEntry(i);
44  printf("by using Vid of EdbSegP: %f %f %f %f\n", s2->TX(),s2->TY(),s2->W(),s2->Z());
45  seg = getRawSeg(s2->Vid(0), s2->Vid(1));
46  printf( "find raw EdbSegment : %f %f %f %f\n", seg->GetTx(),seg->GetTy(),seg->GetPuls(),seg->GetZ0());
47  EdbSegP *ss2=getS2( view->GetAreaID(), view->GetViewID(), seg->GetID() );
48  printf( "and then get again s2 : %f %f %f %f\n", ss2->TX(),ss2->TY(),ss2->W(),ss2->Z());
49  }
50 }
virtual Float_t GetTx() const
Definition: EdbSegment.h:40
virtual Float_t GetZ0() const
Definition: EdbSegment.h:39
virtual Float_t GetTy() const
Definition: EdbSegment.h:41
Definition: EdbSegP.h:18
Float_t TX() const
Definition: EdbSegP.h:172
Float_t Z() const
Definition: EdbSegP.h:150
Float_t W() const
Definition: EdbSegP.h:148
Float_t TY() const
Definition: EdbSegP.h:173
Int_t GetPuls() const
Definition: EdbSegment.h:88
Int_t GetID() const
Definition: EdbSegment.h:90
Int_t GetViewID() const
Definition: EdbView.h:190
Int_t GetAreaID() const
Definition: EdbView.h:191
EdbSegP * getS2(int areaID=28, int viewID=56, int segID=74)
Definition: traceback.C:117
EdbSegP * getS1(int areaID=28, int viewID=56, int segID=74)
Definition: traceback.C:108

Variable Documentation

◆ cp

EdbSegCouple* cp =0

◆ run

EdbRun* run

◆ s

EdbSegP* s =0

◆ s1

EdbSegP* s1 =0

◆ s2

EdbSegP* s2 =0

◆ tree_s1

TTree* tree_s1

◆ tree_s2

TTree* tree_s2