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

Functions

void BookHistsV ()
 
void ClearHistsV ()
 
void d ()
 
void DrawHistsV ()
 
void DrawHlist (TCanvas *c, TObjArray h)
 
void FillHistsV (Vertex &v)
 
void td (int numt=-1)
 
void tr_stop (const char *rcut="nseg>=2&&t.eFlag>-1")
 
void vd (int trmin=3, int trmax=100, float amin=.015, float amax=2.)
 

Variables

float dpp = .5
 
EdbDataProcdproc =0
 
EdbDisplayds =0
 
EdbPVRecgAli =0
 
EdbVertexRecgEVR =0
 
TObjArray hld1
 
TObjArray hld2
 
TObjArray hld3
 
TObjArray hld4
 
TObjArray hlist
 
TH1F * hp [23] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
 
int MINMULT = 3
 
float momentum = 1.
 
int nsegMax = 40
 
int nsegMin = 10
 
float ProbMinP = 0.01
 
float ProbMinV = 0.01
 
bool ReFit = true
 
bool ReProp = true
 
bool usemom = false
 
bool UseSegPar = false
 

Function Documentation

◆ BookHistsV()

void BookHistsV ( )

235 {
236  if (!hp[3]) hp[3] = new TH1F("Hist_Vt_Sx","Vertex X sigma",100,0.,10.);
237  if (!hp[4]) hp[4] = new TH1F("Hist_Vt_Sy","Vertex Y sigma",100,0.,10.);
238  if (!hp[5]) hp[5] = new TH1F("Hist_Vt_Sz","Vertex Z sigma",100,0.,500.);
239  if (!hp[6]) hp[6] = new TH1F("Hist_Vt_Chi2","Vertex Chi-square/D.F.",25,0.,5.);
240  if (!hp[7]) hp[7] = new TH1F("Hist_Vt_Prob","Vertex Chi-square Probability",26,0.,1.04);
241  if (!hp[9]) hp[9] = new TH1F("Hist_Vt_Nvert","Number of reconstructed vertexs",100,0.,100.);
242  if (!hp[22]) hp[22] = new TH1F("Hist_Vt_Ntracks","Number of tracks at vertex", 20, 0.,20.);
243  if (!hp[14]) hp[14] = new TH1F("Hist_Vt_Dist","RMS track-vertex distance",100, 0.,50.);
244  if (!hp[18]) hp[18] = new TH1F("Hist_Vt_AngleV","RMS track-track angle, mrad", 100, 0.,1000.);
245 
246  if (!hp[10]) hp[10] = new TH1F("Hist_Vt_Ntrack","Number of reconstructed tracks",100,0.,10000.);
247  if (!hp[11]) hp[11] = new TH1F("Hist_Vt_Nsegs","Number of track segments",60,0.,60.);
248  if (!hp[12]) hp[12] = new TH1F("Hist_Vt_Dtrack","Track DeltaX, microns",100,-5.,+5.);
249  if (!hp[17]) hp[17] = new TH1F("Hist_Vt_Trprob","Track probability",110, 0.,1.1);
250  if (!hp[20]) hp[20] = new TH1F("Hist_Vt_Angle","Track angle, mrad", 100, 0.,1000.);
251  if (!hp[21]) hp[21] = new TH1F("Hist_Vt_Momen","Track momentum, GeV/c", 100, 0.,20.);
252 
253  hld1.Add(hp[3]);
254  hld1.Add(hp[4]);
255  hld1.Add(hp[5]);
256  hld1.Add(hp[6]);
257  hld1.Add(hp[7]);
258  hld1.Add(hp[9]);
259  hld1.Add(hp[22]);
260  hld1.Add(hp[14]);
261  hld1.Add(hp[18]);
262 
263  hld2.Add(hp[10]);
264  hld2.Add(hp[11]);
265  hld2.Add(hp[12]);
266  hld2.Add(hp[17]);
267  hld2.Add(hp[20]);
268  hld2.Add(hp[21]);
269 
270  for (int i=0; i<22; i++)
271  if (hp[i]) hlist.Add(hp[i]);
272 }
TH1F * hp[23]
Definition: tr_stop.C:23
TObjArray hld1
Definition: tr_stop.C:24
TObjArray hld2
Definition: tr_stop.C:24
TObjArray hlist
Definition: tr_stop.C:24

◆ ClearHistsV()

void ClearHistsV ( )

374 {
375  for(int i=0; i<22; i++) {
376  if (hp[i]) hp[i]->Clear();
377  }
378 }

◆ d()

void d ( )

371 { DrawHistsV();}
void DrawHistsV()
Definition: tr_stop.C:287

◆ DrawHistsV()

void DrawHistsV ( )

288 {
289 
290  int n = hld1.GetEntries();
291  if (n)
292  {
293  TCanvas *cv1 = new TCanvas("Vertex_reconstruction_1","MC Vertex reconstruction", 760, 760);
294  DrawHlist(cv1, hld1);
295  }
296 
297  n = hld2.GetEntries();
298  if (n)
299  {
300  TCanvas *cv2 = new TCanvas("Vertex_reconstruction_2","Vertex reconstruction (tracks hists)", 600, 760);
301  DrawHlist(cv2, hld2);
302  }
303 
304  n = hld3.GetEntries();
305  if (n)
306  {
307  TCanvas *cv3 = new TCanvas("Vertex_reconstruction_3","Vertex reconstruction (eff hists)", 600, 760);
308  DrawHlist(cv3, hld3);
309  }
310 
311  n = hld4.GetEntries();
312  if (n)
313  {
314  TCanvas *cv4 = new TCanvas("Vertex_reconstruction_4","Vertex reconstruction (ntracks)", 600, 760);
315  DrawHlist(cv4, hld4);
316  }
317 }
TCanvas * cv4
Definition: RecDispMC_Profiles.C:63
TCanvas * cv1
Definition: RecDispMC_Profiles.C:63
TCanvas * cv2
Definition: RecDispMC_Profiles.C:63
TCanvas * cv3
Definition: RecDispMC_Profiles_new.C:70
new TCanvas()
void DrawHlist(TCanvas *c, TObjArray h)
Definition: tr_stop.C:319
TObjArray hld4
Definition: tr_stop.C:24
TObjArray hld3
Definition: tr_stop.C:24

◆ DrawHlist()

void DrawHlist ( TCanvas c,
TObjArray  h 
)

320 {
321  int n = h.GetEntries();
322  if (n < 2)
323  {
324  }
325  else if (n < 3)
326  {
327  c->Divide(1,2);
328  }
329  else if (n < 4)
330  {
331  c->Divide(1,3);
332  }
333  else if (n < 5)
334  {
335  c->Divide(2,2);
336  }
337  else if (n < 6)
338  {
339  c->Divide(2,3);
340  }
341  else if (n < 7)
342  {
343  c->Divide(2,3);
344  }
345  else if (n < 8)
346  {
347  c->Divide(2,4);
348  }
349  else if (n < 9)
350  {
351  c->Divide(2,4);
352  }
353  else if (n < 10)
354  {
355  c->Divide(3,3);
356  }
357  else if (n < 11)
358  {
359  c->Divide(2,5);
360  }
361  else
362  {
363  c->Divide(3,5);
364  }
365  for(int i=0; i<n; i++) {
366  c->cd(i+1);
367  if (h.At(i)) h.At(i)->Draw();
368  }
369 }

◆ FillHistsV()

void FillHistsV ( Vertex v)

276 {
277  hp[3]->Fill(v.vxerr());
278  hp[4]->Fill(v.vyerr());
279  hp[5]->Fill(v.vzerr());
280  hp[6]->Fill(v.ndf() > 0 ? v.chi2()/v.ndf() : 0);
281  hp[7]->Fill(v.prob());
282  hp[14]->Fill(v.rmsDistAngle());
283  hp[18]->Fill(v.angle()*1000.);
284  hp[22]->Fill(v.ntracks());
285 }
double vyerr() const
$\sqrt{\sigma_{vy}^2}$ vertex $y$-error
unsigned short int ndf() const
degrees of freedom of vertex fit
Definition: VtVertex.C:238
float chi2() const
$\chi^2$ of vertex fit
Definition: VtVertex.C:236
double vzerr() const
$\sqrt{\sigma_{vz}^2}$ vertex $z$-error
double angle() const
unsigned short int ntracks() const
no of tracks in vertex $n$
Definition: VtVertex.C:240
double rmsDistAngle() const
calc rms dist and rms angle
Definition: VtVertex.C:1073
float prob() const
upper tail $\chi^2$ probability
Definition: VtVertex.C:237
double vxerr() const
$\sqrt{\sigma_{vx}^2}$ vertex $x$-error

◆ td()

void td ( int  numt = -1)
147 {
148  if (!gAli) return;
149  if (!(gAli->eTracks)) return;
150  TObjArray *trarr=new TObjArray(100);
151  TObjArray *segarr = new TObjArray(100);
152  gStyle->SetPalette(1);
153 
154 // gAli->ExtractDataVolumeSegAll( *segarr );
155 
156  const char *title = "display-tracks";
157  if(!(ds=EdbDisplay::EdbDisplayExist(title)))
158  ds=new EdbDisplay(title,-30000.,2000.,-2000., 42000., -80000.,80000.);
159 
160  ds->SetDrawTracks(4);
161 
162  int ntr = gAli->eTracks->GetEntries();
163  int nn = 0;
164  int it0,it1;
165  if (numt == -1)
166  {
167  it0 = 0;
168  it1 = ntr;
169  }
170  else
171  {
172  it0 = numt;
173  it1 = numt+1;
174  }
175  for(int i=it0; i<it1; i++)
176  {
177  tra = (EdbTrackP*)(gAli->eTracks->At(i));
178  if (!tra) continue;
179  if (tra->Flag() != -10 && tra->N() >= nsegMin && tra->N() <= nsegMax) // skip "broken" tracks
180  {
181  if (tra->TrackZmax()->PID() > 10) continue;
182  trarr->Add(tra);
183  nn = gEVR->SegmentNeighboor(tra->TrackZmin(), 2000., 3, segarr, trarr);
184  printf("Track ID %d, neighborhood: %d segments and tracks\n", tra->ID(), nn);
185  }
186  }
187  ds->SetVerRec(gEVR);
188  ds->SetArrSegP( segarr );
189  ds->SetArrTr( trarr );
190  ds->Draw();
191 }
virtual void Draw(Option_t *option="")
Definition: EdbDisplayBase.cxx:786
Definition: EdbDisplay.h:21
void SetArrSegP(TObjArray *arr)
Definition: EdbDisplay.cxx:389
void SetArrTr(TObjArray *arr)
Definition: EdbDisplay.cxx:430
void SetDrawTracks(int opt)
Definition: EdbDisplay.h:97
void SetVerRec(EdbVertexRec *evr)
Definition: EdbDisplay.h:91
static EdbDisplay * EdbDisplayExist(const char *title)
Definition: EdbDisplay.cxx:232
TObjArray * eTracks
Definition: EdbPVRec.h:161
Definition: EdbPattern.h:118
EdbDisplay * ds
Definition: tr_stop.C:5
int nsegMax
Definition: tr_stop.C:11
int nsegMin
Definition: tr_stop.C:10
EdbVertexRec * gEVR
Definition: tr_stop.C:6
EdbPVRec * gAli
Definition: tr_stop.C:4

◆ tr_stop()

void tr_stop ( const char *  rcut = "nseg>=2&&t.eFlag>-1")
28 {
29  BookHistsV();
30 
31  dproc = new EdbDataProc("ref1.def");
32  dproc->InitVolume(1000, rcut);
33 
34  gAli = dproc->PVR();
35 
36  int ntr = gAli->eTracks->GetEntries();
37  printf("\n%d tracks are in the list\n",ntr);
38 
39  EdbTrackP *tra = 0;
40  int ntrgood = 0;
41  for(int i=0; i<ntr; i++)
42  {
43  tra = ((EdbTrackP*)(gAli->eTracks->At(i)));
44  if (tra->Flag() >= 0) ntrgood++;
45  }
46  printf("\n%d good tracks are in the list\n",ntrgood);
47 
48  if (ReFit)
49  {
50  for(int i=0; i<ntr; i++)
51  {
52  tra = ((EdbTrackP*)(gAli->eTracks->At(i)));
53  if (tra->Flag() < 0) continue;
57  }
58  gAli->FitTracks(momentum,0.139);
59  }
60 
61  gAli->FillCell(50,50,0.015,0.015);
62 
63  if (ReProp)
64  {
66  ntrgood = 0;
67  for(int i=0; i<ntr; i++)
68  {
69  tra = ((EdbTrackP*)(gAli->eTracks->At(i)));
70  if (tra->Flag() >= 0) ntrgood++;
71  }
72  printf("\n%d good tracks are in the list after additional propagation\n",
73  ntrgood);
74  }
75 
76  if (hp[10]) hp[10]->Fill(ntr);
77  float ang = 0.;
78  float tx = 0.;
79  float ty = 0.;
80  // tracks loop
81  ntr = gAli->eTracks->GetEntries();
82  int nt = 0;
83  for(int i=0; i<ntr; i++)
84  {
85  tra = (EdbTrackP*)(gAli->eTracks->At(i));
86  if (!tra) continue;
87 // tra->Print();
88  if (tra->Flag() != -10 && tra->N() >= 2) // skip "broken" tracks
89  {
90  // fill hist with number of segments
91  if (hp[11]) hp[11]->Fill(tra->N());
92  // fill hist with difference between measured and reconstructed coordinate
93  if (hp[12]) hp[12]->Fill((tra->GetSegment(0))->X()-(tra->GetSegmentF(0))->X());
94  // fill hist with track probability
95  if (hp[17]) hp[17]->Fill(tra->Prob());
96  tx = tra->TX();
97  ty = tra->TY();
98  ang = TMath::ACos(1./(1.+tx*tx+ty*ty))*1000.;
99  // fill hist with track Teta angle
100  if (hp[20]) hp[20]->Fill(ang);
101  // fill hist with track momentum
102  if (hp[21]) hp[21]->Fill(tra->P());
103  nt++;
104  }
105  }
106  printf("%d good tracks was found\n",nt);
107 
108  gEVR = new EdbVertexRec();
109  if (!(gAli->eTracks)) gAli->eTracks = new TObjArray(100);
111  if (!(gAli->eVTX)) gAli->eVTX = new TObjArray(100);
112  gEVR->eVTX = gAli->eVTX;
113  gEVR->ePVR = gAli;
114 
115  gEVR->eZbin = 100.; // default is 100. microns
116  gEVR->eAbin = 0.01; // default is 0.01 rad
117  gEVR->eDZmax = 3000.; // default is 3000. microns
118  gEVR->eProbMin = ProbMinV; // default 0.01, i.e 1%
119  gEVR->eImpMax = 55.; // default is 25. microns
120  gEVR->eUseSegPar = UseSegPar; // default is FALSE - use fitted track parameters
121  gEVR->eQualityMode= 0; // 0 - prob/(sx**2+sy**2), 1 = 1./aver_impact
122 
123  int nvtx = gEVR->FindVertex();
124  printf("%d 2-track vertexes was found\n",nvtx);
125 
126  if(nvtx != 0) {
127  int nadd = gEVR->ProbVertexN();
128  printf("%d vertexes with number of tracks >2 was found\n",nadd);
129  printf("----------------------------------------------\n");
130  EdbVertex *v = 0;
131  Vertex *vt = 0;
132  for(int i=0; i<nvtx; i++)
133  {
134  v = (EdbVertex*)(gEVR->eVTX->At(i));
135  if (!v) continue;
136 // if (i<10) v->Print();
137  if (v->Flag() < 0) continue;
138  vt = v->V();
139  if (vt) FillHistsV(*vt);
140  }
141  }
142 // vd();
143 }
Definition: EdbDataSet.h:180
EdbPVRec * PVR() const
Definition: EdbDataSet.h:197
int InitVolume(int datatype=0, const char *rcut="1")
Definition: EdbDataSet.cxx:2071
TObjArray * eVTX
Definition: EdbPVRec.h:162
void FillCell(float stepx, float stepy, float steptx, float stepty)
Definition: EdbPVRec.cxx:1088
int PropagateTracks(int nplmax, int nplmin, float probMin=0.05, int ngapMax=3, int design=0)
Definition: EdbPVRec.cxx:2483
void FitTracks(float p=10., float mass=0.139, TObjArray *gener=0, int design=0)
Definition: EdbPVRec.cxx:1889
Float_t Prob() const
Definition: EdbSegP.h:153
Float_t TX() const
Definition: EdbSegP.h:172
Float_t P() const
Definition: EdbSegP.h:149
Float_t TY() const
Definition: EdbSegP.h:173
void SetErrorP(float sp2)
Definition: EdbSegP.h:93
Int_t Flag() const
Definition: EdbSegP.h:146
EdbSegP * GetSegmentFirst() const
Definition: EdbPattern.h:194
EdbSegP * GetSegmentLast() const
Definition: EdbPattern.h:195
Int_t N() const
Definition: EdbPattern.h:182
EdbSegP * GetSegmentF(int i) const
Definition: EdbPattern.h:201
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:200
Int_t eQualityMode
Definition: EdbVertex.h:183
Float_t eAbin
Definition: EdbVertex.h:176
Bool_t eUseSegPar
Definition: EdbVertex.h:182
Float_t eImpMax
Definition: EdbVertex.h:179
Float_t eZbin
Definition: EdbVertex.h:175
Float_t eDZmax
Definition: EdbVertex.h:177
Float_t eProbMin
Definition: EdbVertex.h:178
Definition: EdbVertex.h:194
Int_t ProbVertexN()
Definition: EdbVertex.cxx:1448
TObjArray * eVTX
Definition: EdbVertex.h:205
Int_t FindVertex()
Definition: EdbVertex.cxx:1087
EdbPVRec * ePVR
Definition: EdbVertex.h:206
TObjArray * eEdbTracks
Definition: EdbVertex.h:204
Definition: EdbVertex.h:68
VERTEX::Vertex * V() const
Definition: EdbVertex.h:154
Int_t Flag() const
Definition: EdbVertex.h:124
Definition: VtVertex.hh:88
Double_t X
Definition: tlg2pattern.C:77
bool ReFit
Definition: tr_stop.C:17
float momentum
Definition: tr_stop.C:14
float ProbMinV
Definition: tr_stop.C:8
void FillHistsV(Vertex &v)
Definition: tr_stop.C:275
bool UseSegPar
Definition: tr_stop.C:16
EdbDataProc * dproc
Definition: tr_stop.C:3
float dpp
Definition: tr_stop.C:15
bool ReProp
Definition: tr_stop.C:19
void BookHistsV()
Definition: tr_stop.C:234
float ProbMinP
Definition: tr_stop.C:9

◆ vd()

void vd ( int  trmin = 3,
int  trmax = 100,
float  amin = .015,
float  amax = 2. 
)
195 {
196  if (!gAli) return;
197  if (!(gAli->eTracks)) return;
198  if (!gEVR) return;
199  if (!(gEVR->eEdbTracks)) return;
200  if (!(gEVR->eVTX)) return;
201  TObjArray *varr = new TObjArray();
202  TObjArray *tarr = new TObjArray();
203 
204  EdbVertex *v=0;
205  EdbTrackP *t=0;
206 
207  int nv = gEVR->eVTX->GetEntries();
208  for(int i=0; i<nv; i++) {
209  v = (EdbVertex *)(gEVR->eVTX->At(i));
210 
211  if( v->N()<trmin ) continue;
212  if( v->N()>trmax ) continue;
213  if( v->Flag()<0 ) continue;
214  if( v->N()<3 && v->MaxAperture()<amin ) continue;//
215  if( v->N()<3 && v->MaxAperture()>amax ) continue;
216 
217  varr->Add(v);
218  for(int j=0; j<v->N(); j++) tarr->Add( v->GetTrack(j) );
219  }
220 
221  gStyle->SetPalette(1);
222  const char *title = "display-vertices";
223  if(!(ds=EdbDisplay::EdbDisplayExist(title)))
224  ds=new EdbDisplay(title,-30000.,2000., -2000.,42000.,-80000.,80000.);
225 
226  ds->SetVerRec(gEVR);
227  ds->SetArrTr( tarr );
228  ds->SetArrV( varr );
229  ds->SetDrawTracks(4);
230  ds->SetDrawVertex(1);
231  ds->Draw();
232 }
TTree * t
Definition: check_shower.C:4
void SetDrawVertex(int opt)
Definition: EdbDisplay.h:108
void SetArrV(TObjArray *arrv)
Definition: EdbDisplay.cxx:500
EdbTrackP * GetTrack(int i)
Definition: EdbVertex.h:141
Int_t N() const
Definition: EdbVertex.h:121
Float_t MaxAperture()
Definition: EdbVertex.cxx:252

Variable Documentation

◆ dpp

float dpp = .5

◆ dproc

EdbDataProc* dproc =0

◆ ds

EdbDisplay* ds =0

◆ gAli

EdbPVRec* gAli =0

◆ gEVR

EdbVertexRec* gEVR =0

◆ hld1

TObjArray hld1

◆ hld2

TObjArray hld2

◆ hld3

TObjArray hld3

◆ hld4

TObjArray hld4

◆ hlist

TObjArray hlist

◆ hp

TH1F* hp[23] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

◆ MINMULT

int MINMULT = 3

◆ momentum

float momentum = 1.

◆ nsegMax

int nsegMax = 40

◆ nsegMin

int nsegMin = 10

◆ ProbMinP

float ProbMinP = 0.01

◆ ProbMinV

float ProbMinV = 0.01

◆ ReFit

bool ReFit = true

◆ ReProp

bool ReProp = true

◆ usemom

bool usemom = false

◆ UseSegPar

bool UseSegPar = false