FairRoot/PandaRoot
PndFTSCAPerformance.cxx
Go to the documentation of this file.
1 // $Id: PndFTSCAPerformance.cxx,v 1.13 2010/09/01 10:38:27 ikulakov Exp $
2 // **************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project *
4 // ALICE Experiment at CERN, All rights reserved. *
5 // *
6 // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7 // Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8 // for The ALICE HLT Project. *
9 // *
10 // Developed by: Igor Kulakov <I.Kulakov@gsi.de> *
11 // Maksym Zyzak <M.Zyzak@gsi.de> *
12 // *
13 // Permission to use, copy, modify and distribute this software and its *
14 // documentation strictly for non-commercial purposes is hereby granted *
15 // without fee, provided that the above copyright notice appears in all *
16 // copies and that both the copyright notice and this permission notice *
17 // appear in the supporting documentation. The authors make no claims *
18 // about the suitability of this software for any purpose. It is *
19 // provided "as is" without express or implied warranty. *
20 // *
21 //***************************************************************************
22 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
23 
24 #include "PndFTSCAPerformance.h"
25 
26 #include "PndFTSCounters.h"
27 #include "PndFTSPerformanceBase.h"
29 //#include "PndFTSTopoPerformance.h"
30 #include "PndFTSCAParam.h"
31 
32 #include "PndFTSCAGBHit.h"
33 #include "PndFTSCAMCTrack.h"
34 #ifndef HLTCA_STANDALONE
35 #include "PndFTSCAMCPoint.h"
36 #endif
37 #include "PndFTSCAGBTrack.h"
38 #include "PndFTSCAGBTracker.h"
39 
40 #include "PndFTSCADisplay.h"
41 
42 #include "PndFTSCAParameters.h"
43 
44 #include "TRandom3.h" //dbg
45 #include "TMath.h"
46 #include "TROOT.h"
47 #include "Riostream.h"
48 #include "TFile.h"
49 #include "TH1.h"
50 #include "TH2.h"
51 #include "TProfile.h"
52 #include "TStyle.h"
53 
54 PndFTSCAPerformance::PndFTSCAPerformance()
55 {
56  static bool first_call = true;
57 
58  if (first_call){
59  typedef TSubPerformance TSP;
60 
63 #if !defined(KFPARTICLE)
64  const int NSPerfo = 1;
65 #else
66 #ifndef STAR_STANDALONE
67  const int NSPerfo = 1;
68 #else // HLTCA_STANDALONE
69  const int NSPerfo = 1;
70 #endif // HLTCA_STANDALONE
71 #endif
72  const TSP perfos[NSPerfo] = {
73  TSP(new PndFTSCAGlobalPerformance, "Global Performance")
74 #ifdef KFPARTICLE
75  //,TSP(new PndFTSTopoPerformance, "Topo Performance")
76 #endif
77  };
78 
79  subPerformances.resize(NSPerfo);
80  for (int iP = 0; iP < NSPerfo; iP++){
81  subPerformances[iP] = perfos[iP];
82  }
83  }
84  first_call = false;
85  //* constructor
86 }
87 
88 PndFTSCAPerformance::~PndFTSCAPerformance()
89 {
90  //* destructor
91  fHitLabels.Resize( 0 );
92  fMCTracks.Resize( 0 );
93  for (unsigned int iPerf = 0; iPerf < subPerformances.size(); iPerf++){ // TODO: why we can't do this in subPerformances.~destructor() ??
94  if (subPerformances[iPerf].perf) delete subPerformances[iPerf].perf;
95  }
96 }
97 
98 PndFTSCAPerformance &PndFTSCAPerformance::Instance()
99 {
100  // reference to static object
101  static PndFTSCAPerformance gPndFTSCAPerformance;
102  return gPndFTSCAPerformance;
103 }
104 
105 bool PndFTSCAPerformance::SetNewEvent(PndFTSCAGBTracker* const tracker, string mcTracksFile, string mcPointsFile)
106 {
107  fTracker = tracker;
108  // Read MC info from file
109  FILE *file = std::fopen( mcTracksFile.data(), "rb" );
110  if ( !file ) {
111  return false;
112  }
113  ReadMCEvent( file );
114  fclose( file );
115 
116  file = std::fopen( mcPointsFile.data(), "rb" );
117  if ( !file ) {
118  return false;
119  }
120  ReadLocalMCPoints( file );
121  fclose( file );
122 
123  return true;
124 } // void PndFTSCAPerformance::SetNewEvent
125 
126 void PndFTSCAPerformance::InitSubPerformances()
127 {
128  // Init subperformances
129  //static bool first_call = true; //[R.K. 9/2018] unused
130  for (unsigned int iPerf = 0; iPerf < subPerformances.size(); iPerf++){
131  subPerformances[iPerf]->SetNewEvent(fTracker, &fHitLabels, &fMCTracks, &fLocalMCPoints);
132  }
133 #ifdef KFPARTICLE
134  /*if ( GetSubPerformance("Topo Performance") )
135  dynamic_cast<PndFTSTopoPerformance*>(GetSubPerformance("Topo Performance"))->SetNewEvent2(fTopoReconstructor);*/
136 #endif
137 
138 // if (first_call) CreateHistos();
139 
140  //first_call = false; //[R.K. 9/2018] unused
141 } // void PndFTSCAPerformance::InitSubPerformances
142 
143 void PndFTSCAPerformance::CreateHistos()
144 {
145  for (unsigned int iPerf = 0; iPerf < subPerformances.size(); iPerf++){
146  if(!(subPerformances[iPerf]->IsHistoCreated()))
147  subPerformances[iPerf]->CreateHistos(subPerformances[iPerf].name, fOutputFile);
148  }
149 }
150 
151 bool PndFTSCAPerformance::CreateHistos(string name)
152 {
153  unsigned i = 0;
154  for( ; i < (subPerformances.size()) && (subPerformances[i].name != name); i++);
155  if(!(subPerformances[i]->IsHistoCreated()) && i != subPerformances.size())
156  subPerformances[i]->CreateHistos(subPerformances[i].name, fOutputFile);
157  if ( i == subPerformances.size() ) return 0;
158  return 1;
159 }
160 
161 
162 void PndFTSCAPerformance::WriteDir2Current( TObject *obj )
163 {
164  //* recursive function to write down all created in the file histos
165  if ( !obj->IsFolder() ) obj->Write();
166  else {
167  TDirectory *cur = gDirectory;
168  ((TDirectory*)obj)->cd();
169  TList *listSub = ( ( TDirectory* )obj )->GetList();
170  TIter it( listSub );
171  while ( TObject *obj1 = it() ) WriteDir2Current( obj1 );
172  cur->cd();
173  }
174 }
175 
176 
177 void PndFTSCAPerformance::WriteHistos()
178 {
179  if(fOutputFile) WriteDir2Current(fOutputFile);
180 }
181 
182 void PndFTSCAPerformance::ExecPerformance()
183 {
184  fStatNEvents++;
185 #ifdef KFPARTICLE
186  for (unsigned int iPerf = 0; iPerf < subPerformances.size(); iPerf++){
187 #else
188  for (unsigned int iPerf = 0; iPerf < subPerformances.size(); iPerf++){
189 #endif
190  if(subPerformances[iPerf].IsGlobalPerf) subPerformances[iPerf]->Exec(0);
191  }
192 #if 1 // current event efficiencies
193  for (unsigned int iPerf = 0; iPerf < subPerformances.size(); iPerf++){
194  cout << endl
195  << " ---- " << subPerformances[iPerf].name << " event " << fStatNEvents << " ---- "<< endl;
196  subPerformances[iPerf]->PrintEfficiency();
197  }
198  cout << endl << " ============================== " << endl;
199 #endif //0
200  for (unsigned int iPerf = 0; iPerf < subPerformances.size(); iPerf++){
201  cout << endl
202  << " ---- " << subPerformances[iPerf].name << " " << fStatNEvents << " events Statistic ---- " << endl;
203  if(subPerformances[iPerf].IsGlobalPerf) subPerformances[iPerf]->PrintEfficiencyStatistic();
204  };
205 
206 }
207 
208 PndFTSPerformanceBase* PndFTSCAPerformance::GetSubPerformance(string name)
209 {
210  unsigned i = 0;
211  for( ; (i < subPerformances.size()) && (subPerformances[i].name != name); i++);
212  //ASSERT ( i != subPerformances.size() , " Incorrect name of subPerformance used.");
213  if ( i == subPerformances.size() ) return 0;
214  return subPerformances[i].perf;
215 } // PndFTSPerformanceBase* PndFTSCAPerformance::GetSubPerformance(string name)
216 
217 
219 void PndFTSCAPerformance::WriteMCEvent( FILE *file ) const
220 {
221  // write MC information to the file
222  int n = fMCTracks.Size();
223  std::fwrite( &n, sizeof( int ), 1, file );
224  n = fHitLabels.Size();
225  std::fwrite( &n, sizeof( int ), 1, file );
226  std::fwrite( fMCTracks.Data(), sizeof( PndFTSCAMCTrack ), fMCTracks.Size(), file );
227  std::fwrite( fHitLabels.Data(), sizeof( PndFTSCAHitLabel ), fHitLabels.Size(), file );
228 }
229 
230 void PndFTSCAPerformance::ReadMCEvent( FILE *file )
231 {
232  // read mc info from the file
233  int read;
234  int n;
235 
236  read = std::fread( &n, sizeof( int ), 1, file );
237  assert( read == 1 );
238  fMCTracks.Resize( n );
239  read = std::fread( &n, sizeof( int ), 1, file );
240  assert( read == 1 );
241  fHitLabels.Resize( n );
242 
243  read = std::fread( fMCTracks.Data(), sizeof( PndFTSCAMCTrack ), fMCTracks.Size(), file );
244  assert( read == fMCTracks.Size() );
245 
246  read = std::fread( fHitLabels.Data(), sizeof( PndFTSCAHitLabel ), fHitLabels.Size(), file );
247  assert( read == fHitLabels.Size() );
248  UNUSED_PARAM1(read);
249 // for (int i = 0; i < fMCTracks.Size(); i++){
250 // PndFTSCAMCTrack& mc = fMCTracks[i];
251 // std::cout << mc.PDG() << " ";
252 // std::cout << std::endl;
253 // for (int iPar = 0; iPar < 7; iPar++)
254 // std::cout << mc.Par(iPar) << " ";
255 // std::cout << std::endl;
256 // for (int iPar = 0; iPar < 7; iPar++)
257 // std::cout << mc.TPCPar(iPar) << " ";
258 // std::cout << std::endl;
259 // // std::cout << mc.P() << " ";
260 // };
261 // for (int i = 0; i < fHitLabels.Size(); i++){
262 // PndFTSCAHitLabel& l = fHitLabels[i];
263 // for (int iPar = 0; iPar < 3; iPar++)
264 // std::cout << l.fLab[iPar] << " ";
265 // std::cout << std::endl;
266 // };
267 }
268 
269 void PndFTSCAPerformance::ReadLocalMCPoints( FILE *file )
270 {
271 
272  int read;
273  int n;
274 
275  read = std::fread( &n, sizeof( int ), 1, file );
276  assert( read == 1 );
277  fLocalMCPoints.Resize( n );
278 
279  read = std::fread( fLocalMCPoints.Data(), sizeof( PndFTSCALocalMCPoint ), fLocalMCPoints.Size(), file );
280  assert( read == fLocalMCPoints.Size() );
281  UNUSED_PARAM1(read);
282 } // void PndFTSCAPerformance::ReadLocalMCPoints( FILE *file )
283 
284 
285 void PndFTSCAPerformance::SetMCTracks(vector<PndFTSCAMCTrack>& mcTracks)
286 {
287  const int N = mcTracks.size();
288  fMCTracks.Resize(N);
289  for(int i = 0; i < N; i++){
290  fMCTracks[i] = mcTracks[i];
291  }
292 }
293 
294 void PndFTSCAPerformance::SetMCPoints(vector<PndFTSCALocalMCPoint>& mcPoints)
295 {
296  const int N = mcPoints.size();
297  fLocalMCPoints.Resize(N);
298  for(int i = 0; i < N; i++){
299  fLocalMCPoints[i] = mcPoints[i];
300  }
301 }
302 
303 void PndFTSCAPerformance::SetHitLabels(vector<PndFTSCAHitLabel>& hitLabels)
304 {
305  const int N = hitLabels.size();
306  fHitLabels.Resize(N);
307  for(int i = 0; i < N; i++){
308  fHitLabels[i] = hitLabels[i];
309  }
310 }
311 
312 void PndFTSCAPerformance::SaveDataInFiles(string /*prefix*/) const //[R.K. 9/2018] unused
313 {
314  /*
315  {
316  ofstream ofile((prefix+"hitLabels.data").data(),ios::out|ios::app);
317  const int Size = fHitLabels.Size();
318  ofile << Size << std::endl;
319  for (int i = 0; i < fHitLabels.Size(); i++){
320  const PndFTSCAHitLabel &l = fHitLabels[i];
321  ofile << l;
322  }
323  ofile.close();
324  }
325 
326  {
327  ofstream ofile((prefix+"MCTracks.data").data(),ios::out|ios::app);
328  const int Size = fMCTracks.Size();
329  ofile << Size << std::endl;
330  for (int i = 0; i < fMCTracks.Size(); i++){
331  const PndFTSCAMCTrack &l = fMCTracks[i];
332  ofile << l;
333  }
334  ofile.close();
335  }
336 
337  {
338  ofstream ofile((prefix+"MCPoints.data").data(),ios::out|ios::app);
339  const int Size = fLocalMCPoints.Size();
340  ofile << Size << std::endl;
341  for (int i = 0; i < fLocalMCPoints.Size(); i++){
342  const PndFTSCALocalMCPoint &l = fLocalMCPoints[i];
343  ofile << l;
344  }
345  ofile.close();
346  }*/
347 }
348 
349 bool PndFTSCAPerformance::ReadData(vector <int>& labels, vector <PndFTSCALocalMCPoint>& mcpoints, vector<PndFTSCAMCTrack>& mctracks)
350 {
351 
352  {
353  fHitLabels.Resize(labels.size());
354  for (unsigned int i = 0; i < labels.size(); i++){
355  PndFTSCAHitLabel l;
356  l.fLab[0] = labels[i];
357  l.fLab[1] = -1;
358  l.fLab[2] = -1;
359  fHitLabels[i] = l;
360  //cout<<"labels[i] "<<labels[i]<<endl;
361  //cout<<"label l["<<i<<"]: "<<fHitLabels[i].fLab[0]<<" "<<fHitLabels[i].fLab[1]<<" "<<fHitLabels[i].fLab[2]<<" ";
362  }
363  /*ifstream ifile((prefix+"hitLabels.data").data());
364  if ( !ifile.is_open() ) return 0;
365  int Size;
366  ifile >> Size;
367  cout<<"hitlables size "<<Size<<endl;
368  fHitLabels.Resize(Size);
369  for (int i = 0; i < Size; i++){
370  PndFTSCAHitLabel &l = fHitLabels[i];
371  ifile >> l;
372  }
373  ifile.close();*/
374  }
375  cout<<endl;
376  {
377  fMCTracks.Resize(mctracks.size());
378  for (unsigned int i = 0; i < mctracks.size(); i++){
379  fMCTracks[i] = mctracks[i];
380  //cout<<"fMCTracks["<<i<<"]: "<<fMCTracks[i];
381  }
382 
383  /*ifstream ifile((prefix+"MCTracks.data").data());
384  if ( !ifile.is_open() ) return 0;
385  int Size;
386  ifile >> Size;
387  cout<<"mctracks size "<<Size<<endl;
388  fMCTracks.Resize(Size);
389  for (int i = 0; i < Size; i++){
390  PndFTSCAMCTrack &l = fMCTracks[i];
391  ifile >> l;
392  }
393  ifile.close();*/
394  }
395 
396 
397  {
398  fLocalMCPoints.Resize(mcpoints.size());
399  //cout<<"mcpoints.size() "<<mcpoints.size()<<endl;
400  for (unsigned int i = 0; i < mcpoints.size(); i++){
401  fLocalMCPoints[i] = mcpoints[i];
402  //cout<<"fLocalMCPoints["<<i<<"].IRow(): "<<fLocalMCPoints[i].IRow()<<" QP() "<<fLocalMCPoints[i].QP()<<endl;
403  }
404  /*ifstream ifile((prefix+"MCPoints.data").data());
405  if ( !ifile.is_open() ) return 0;
406  int Size;
407  ifile >> Size;
408  cout<<"mcpoints size "<<Size<<endl;
409  fLocalMCPoints.Resize(Size);
410  for (int i = 0; i < Size; i++){
411  PndFTSCALocalMCPoint &l = fLocalMCPoints[i];
412  ifile >> l;
413  }
414  ifile.close();*/
415  }
416 
417  // calculate needed additional info
418  {
419  const int NMCTracks = fMCTracks.Size();
420  // NMCRows
421  for (int i = 0; i < NMCTracks; ++i ){
422  PndFTSCAMCTrack& t = fMCTracks[i];
423 
424  vector<int> rows;
425  rows.resize( PndFTSCAParameters::MaxNStations, 0 );
426  for (int j = 0, iP = t.FirstMCPointID(); j < t.NMCPoints(); iP++, j++){
427  //cout<<"fLocalMCPoints[iP].IRow() "<<fLocalMCPoints[iP].IRow()<<endl;
428  rows[fLocalMCPoints[iP].IRow()]++;
429  }
430 
431  int nRows = 0;
432 
433  int nMCContRows = 0;
434  int istaold = -2, ncont=0;
435  for (unsigned int j = 0 ; j < rows.size(); j++) {
436  if( rows[j] > 0 ) {
437  nRows++;
438 
439  if( istaold == static_cast<int>(j)-1 ) {
440  ncont++;
441  }
442  else {
443  nMCContRows = (nMCContRows > ncont) ? nMCContRows : ncont;
444  ncont = 1;
445  }
446  istaold = j;
447  }
448  }
449  nMCContRows = (nMCContRows > ncont) ? nMCContRows : ncont;
450 
451  t.SetNMCRows( nRows );
452  t.SetNMCContRows( nMCContRows );
453  }
454 
455  // NHitRows
456 
457  vector<int> zero(PndFTSCAParameters::MaxNStations, 0);
458  vector< vector<int> > nmchits(NMCTracks,zero);
459  PndFTSResizableArray<PndFTSCAGBHit>& hits = const_cast<PndFTSCAGBTracker *>(fTracker)->fHits;
460  for (int i = 0; i < hits.Size(); i++) {
461  int id = hits[i].ID();
462  for ( int il = 0; il < 3; il++ ) {
463  int trackId = HitLabel(id).fLab[il];
464  if(trackId < 0) continue;
465  ASSERT(trackId < NMCTracks, "Incorrect MCPoints of MCTracks file. " << trackId << " < " << NMCTracks );
466  assert( hits[i].IRow() < PndFTSCAParameters::MaxNStations );
467  nmchits[trackId][hits[i].IRow()]++;
468  }
469  }
470 
471  for (int i = 0; i < NMCTracks; ++i ){
472  PndFTSCAMCTrack& t = fMCTracks[i];
473  int nRows = 0;
474 
475  int nHitContRows = 0;
476  int istaold = -1, ncont=0;
477  for (int j = 0; j < PndFTSCAParameters::MaxNStations; ++j ) {
478  if ( nmchits[i][j] ) {
479  nRows++;
480 
481  if( istaold == j-1 ) {
482  ncont++;
483  }
484  else {
485  nHitContRows = (nHitContRows > ncont) ? nHitContRows : ncont;
486  ncont = 1;
487  }
488  istaold = j;
489  }
490  }
491  nHitContRows = (nHitContRows > ncont) ? nHitContRows : ncont;
492 
493  t.SetNHitRows( nRows );
494  t.SetNHitContRows( nHitContRows );
495  }
496 
497  // Angle, HitErrors
498  for ( int ih = 0; ih < hits.Size(); ih++ ) {
499  PndFTSCAGBHit &hit = hits[ih];
500  const PndFTSCAHitLabel &l = (fHitLabels)[hit.ID()];
501 
502  const int iMC = l.fLab[0];
503  if( iMC<0 ) continue;
504  PndFTSCAMCTrack &mc = (fMCTracks)[iMC];
505 
506 
507  int MCindex = -1;
508  int nFirstMC = mc.FirstMCPointID();
509  int nMCPoints = mc.NMCPoints();
510  PndFTSCALocalMCPoint *points = &((fLocalMCPoints).Data()[nFirstMC]);
511 
512  for(int iMCPoint=0; iMCPoint<nMCPoints; iMCPoint++)
513  {
514  if(points[iMCPoint].IRow() == hit.IRow())
515  {
516  if(fabs(hit.Y() - points[iMCPoint].Y())<2 && fabs(hit.Z() - points[iMCPoint].Z())<2) // dbg +
517  MCindex = iMCPoint;
518  }
519  }
520  if(MCindex == -1)
521  {
522  continue;
523  }
524 
525  points[MCindex].SetAngle(hit.Angle());
526  points[MCindex].SetErr2Z(hit.Err2Z());
527  points[MCindex].SetErr2Y(hit.Err2Y());
528  }
529 
530  // PV
531  fPV[0] = fPV[1] = fPV[2] = 0;
532  for (int i = 0; i < NMCTracks; ++i ){
533  PndFTSCAMCTrack& t = fMCTracks[i];
534  if (t.MotherId() > 0) continue;
535  fPV[0] = t.X();
536  fPV[1] = t.Y();
537  fPV[2] = t.Z();
538  break;
539  }
540 
541 #ifdef STAR_HFT
542  // Secondary tracks. Tmp
543  for (int i = 0; i < NMCTracks; ++i ){
544  PndFTSCAMCTrack& t = fMCTracks[i];
545  if (t.MotherId() > 0) continue;
546  t.SetMotherId( 1 );
547  if ( ( abs(fPV[0] - t.X()) <= 1e-7 ) && ( abs(fPV[1] - t.Y()) <= 1e-7 ) && ( abs(fPV[2] - t.Z()) <= 1e-7 ) )
548  t.SetMotherId( -1 );
549  }
550 #endif
551  }
552 
553  return 1;
554 }
555 
556 int PndFTSCAPerformance::GetMCPoint( const PndFTSCAGBHit& hit ) const
557 {
558  const PndFTSCAHitLabel &l = fHitLabels[hit.ID()];
559 
560  int iMCP = -1;
561  float dxMin = 1.e6;
562  for( int k = 0; k < 3 && iMCP == -1; k++ ) {
563  const int iMC = l.fLab[k];
564  if (iMC < 0) continue;
565 
566  const PndFTSCAMCTrack &mc = fMCTracks[iMC];
567 
568  int nFirstMC = mc.FirstMCPointID();
569  int nMCPoints = mc.NMCPoints();
570 
571  // float r2Min = 1e10;
572  const PndFTSCALocalMCPoint *points = &(fLocalMCPoints.Data()[nFirstMC]);
573  for(int iMCPoint=0; iMCPoint<nMCPoints; iMCPoint++)
574  {
575  const PndFTSCALocalMCPoint &p = points[iMCPoint];
576 #ifdef DRIFT_TUBES
577  if(fabs(p.Z() - hit.Z()) > 0.3) continue;
578 #else
579  if( fabs(xPLoc - xHLoc) > 2.f || fabs(p.Angle() - hit.Angle()) > 1e-6 ) continue;
580 #endif
581  float sinA = fTracker->GetParameters().Station(hit.IRow()).f.sin;
582  float cosA = fTracker->GetParameters().Station(hit.IRow()).f.cos;
583  float correction = cosA*(p.Px()/p.Pz()) + sinA*(p.Py()/p.Pz());
584  float dx = cosA*hit.X() + sinA*hit.Y() + hit.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y(); // dx = hit.X() - hit.R() - p.X();
585  if(hit.IsLeft())
586  dx = cosA*hit.X() + sinA*hit.Y() - hit.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y(); // dx = hit.X() + hit.R() - p.X();
587 
588  if(fabs(dx)<dxMin)
589  {
590  if( fabs(dx) < 10*sqrt(hit.Err2R())*sqrt(1.+correction*correction) ) //if( fabs(dx) < 5*sqrt(hit.Err2X0()) ) // suppose we have only one MCPoint per track per station
591  {
592  iMCP = iMCPoint + nFirstMC;
593  dxMin = fabs(dx);
594  }
595  }
596  }
597  }
598 
599 
600  return iMCP;
601 }
602 
603 #include "PndFTSCADisplay.h"
604  // Use smeared MCposition instead of hits
605 void PndFTSCAPerformance::ShiftHitsToMC( float errorX1, float errorX2 ){
606  PndFTSResizableArray<PndFTSCAGBHit>& hits = const_cast<PndFTSCAGBTracker *>(fTracker)->fHits;
607 
608  std::sort( hits.Data(), hits.Data() + const_cast<PndFTSCAGBTracker *>(fTracker)->NHits(), PndFTSCAGBHit::Compare ); // has an influence on the procedure. CHECKME why?
609 
610  static TRandom3 rand;
611  {
612  int nHits = fTracker->NHits();
613 
614  for ( int ih = 0; ih < nHits; ih++ ) {
615  PndFTSCAGBHit &hit = hits[ih];
616 
617  const int iMCP = GetMCPoint(hit);
618  if (iMCP == -1) continue;
619  const PndFTSCALocalMCPoint& point = fLocalMCPoints.Data()[iMCP];
620 
621 // #ifdef DRAW
622 // PndFTSCADisplay::Instance().SetTPCView();
623 // PndFTSCADisplay::Instance().DrawTPC();
624 // for(int iMCPoint=0; iMCPoint<nMCPoints; iMCPoint++)
625 // {
626 // PndFTSCADisplay::Instance().DrawGBPoint((float)points[iMCPoint].X(),
627 // (float)points[iMCPoint].Y(),
628 // (float)points[iMCPoint].Z(), 1, (Size_t)1);
629 // }
630 // PndFTSCADisplay::Instance().DrawGBPoint((float)hit.X(),
631 // (float)hit.Y(),
632 // (float)hit.Z(),
633 // -1, (Size_t)0.5);
634 // PndFTSCADisplay::Instance().DrawGBPoint((float)point.X(),
635 // (float)point.Y(),
636 // (float)point.Z(),
637 // 2, (Size_t)0.5);
638 // std::cout << hit.IRow() << " " << hit.X() << " " << hit.Y() << " " << hit.Z() << std::endl;
639 // std::cout << point.IRow() << " " << point.X() << " " << point.Y() << " " << point.Z() << std::endl;
640 //
641 // PndFTSCADisplay::Instance().Ask();
642 // #endif
643 
644  if ( errorX2 <= 0 ) errorX2 = errorX1;
645 
646  const float err2X1 = errorX1*errorX1;
647  const float err2X2 = errorX2*errorX2;
648 
649  if ( errorX1 <= 0 ) ;
650  else hit.SetErr2Y(err2X1);
651  if ( errorX2 <= 0 ) ;
652  else hit.SetErr2Z(err2X2);
653  if ( errorX1 <= 0 || errorX2 <= 0 ) ;
654  else hit.SetErrYZ(0);
655 
656  const float_v Err2Y = hit.Err2Y(), Err2Z = hit.Err2Z();
657 
658  double mcX = point.X();
659  double mcY = point.Y();
660  double mcZ = point.Z();
661  double angle = hit.Angle();
662 
663  double xl,yl,zl;
664  PndFTSCAParameters::GlobalToCALocal( mcX, mcY, mcZ, angle, xl, yl, zl );
665  yl += sqrt(Err2Y[0])*rand.Gaus();
666  zl += sqrt(Err2Z[0])*rand.Gaus();
667  double xg,yg,zg;
668  PndFTSCAParameters::CALocalToGlobal( xl, yl, zl, angle, xg, yg, zg );
669  hit.SetX( xg );
670  hit.SetY( yg );
671  hit.SetZ( zg );
672  }
673  }
674 }
675 
676  // Create new hits spreading MCPositions
677 void PndFTSCAPerformance::ResimulateHits( float errorX1, float errorX2 ){
678  PndFTSResizableArray<PndFTSCAGBHit>& hits = const_cast<PndFTSCAGBTracker *>(fTracker)->fHits;
679 
680  const int NHits = fLocalMCPoints.Size();
681  const_cast<PndFTSCAGBTracker *>(fTracker)->fNHits = NHits;
682  // hits.Clear();
683  hits.Resize(NHits);
684  fHitLabels.Resize(NHits);
685  PndFTSResizableArray<FTSCAStrip> &fStrips = const_cast<PndFTSCAGBTracker *>(fTracker)->fFStrips; // create a virtual strip for each hit (currently strips position is not used for FTS, so don't have to fill them)
686  PndFTSResizableArray<FTSCAStrip> &bStrips = const_cast<PndFTSCAGBTracker *>(fTracker)->fBStrips; // create a virtual strip for each hit
687 
688  fStrips.Resize(NHits);
689  bStrips.Resize(NHits);
690 
691 
692  static TRandom3 rand;
693  for ( int ih = 0; ih < NHits; ih++ ) {
694  PndFTSCALocalMCPoint &mcP = fLocalMCPoints[ih];
695 
696  PndFTSCAGBHit &hit = hits[ih];
697  hit.SetID(ih);
698  PndFTSCAHitLabel &l = fHitLabels[ih];
699  l.fLab[0] = mcP.TrackI();
700  l.fLab[1] = -1;
701  l.fLab[2] = -1;
702 
703  // get errors
704  if ( errorX2 <= 0 ) errorX2 = errorX1;
705 
706  const float err2X1 = errorX1*errorX1;
707  const float err2X2 = errorX2*errorX2;
708 #ifdef STAR_HFT
709  if ( errorX1 <= 0 ) hit.SetErr2Y(mcP.Err2Y());
710  else hit.SetErr2Y(err2X1);
711  if ( errorX2 <= 0 ) hit.SetErr2Z(mcP.Err2Z());
712  else hit.SetErr2Z(err2X2);
713 #else
714  hit.SetErr2Y(err2X1); hit.SetErr2Z(err2X2);
715 #endif
716  float_v Err2Y = hit.Err2Y(), Err2Z = hit.Err2Z();
717 
718  double mcX = mcP.X();
719  double mcY = mcP.Y();
720  double mcZ = mcP.Z();
721 
722  hit.SetIRow( mcP.IRow() );
723  hit.SetAngle( mcP.Angle() );
724 
725  double mcXTmp = mcX*cos( hit.Angle() ) + mcY*sin( hit.Angle() );
726  double mcYTmp = -mcX*sin( hit.Angle() ) + mcY*cos( hit.Angle() );
727  mcYTmp -= sqrt(Err2Y[0])*rand.Gaus();
728  mcZ -= sqrt(Err2Z[0])*rand.Gaus();
729  mcX = mcXTmp*cos( hit.Angle() ) - mcYTmp*sin( hit.Angle() );
730  mcY = mcXTmp*sin( hit.Angle() ) + mcYTmp*cos( hit.Angle() );
731 
732  hit.SetX( mcX );
733  hit.SetY( mcY );
734  hit.SetZ( mcZ );
735 
736  hit.SetFStripP( &fStrips[ih] );
737  hit.SetBStripP( &bStrips[ih] );
738  }
739 }
740 
741  // Match hits with closest MCPoint
742 void PndFTSCAPerformance::RematchHits(){
743  PndFTSResizableArray<PndFTSCAGBHit>& hits = const_cast<PndFTSCAGBTracker *>(fTracker)->fHits;
744 
745  const int NHits = fTracker->NHits();
746 
747  for ( int ih = 0; ih < NHits; ih++ ) {
748  PndFTSCAGBHit &hit = hits[ih];
749  PndFTSCAHitLabel &l = fHitLabels[ih];
750 
751  int MCindex = -1;
752  float R2 = 10e30;
753  for(int iMCPoint=0; iMCPoint < fLocalMCPoints.Size(); iMCPoint++)
754  {
755  if(fLocalMCPoints[iMCPoint].IRow() != hit.IRow()) continue;
756 
757  const float dY = hit.Y() - fLocalMCPoints[iMCPoint].Y();
758  const float dZ = hit.Z() - fLocalMCPoints[iMCPoint].Z();
759  const float r2 = dY*dY + dZ*dZ;
760 
761  if( r2 < R2 ) {
762  MCindex = iMCPoint;
763  R2 = r2;
764  }
765  }
766  if(MCindex == -1)
767  {
768  l.fLab[0] = -1;
769  l.fLab[1] = -1;
770  l.fLab[2] = -1;
771  continue;
772  }
773 
774 
775  l.fLab[0] = fLocalMCPoints[MCindex].TrackI();
776  l.fLab[1] = -1;
777  l.fLab[2] = -1;
778  }
779 }
780 
781 #ifdef DRIFT_TUBES
782 struct Vector3 {
783  Vector3( const float& x, const float& y, const float& z):fx(x),fy(y),fz(z){};
784  float X() const { return fx; }
785  float Y() const { return fy; }
786  float Z() const { return fz; }
787  private:
788  float fx,fy,fz;
789 };
790 
791 bool operator<(const Vector3& a, const Vector3& b) {
792  if (a.X() != b.X())
793  return a.X() < b.X();
794  else
795  if (a.Y() != b.Y())
796  return a.Y() < b.Y();
797  else
798  return a.Z() < b.Z();
799 }
800 
801  // Rid of hits with same wires positions
802 void PndFTSCAPerformance::CombineHits(){
803  PndFTSResizableArray<PndFTSCAGBHit>& hits = const_cast<PndFTSCAGBTracker *>(fTracker)->fHits;
804  const int NHits = hits.Size();
805  map<Vector3,float> minR[PndFTSCAParameters::MaxNStations];
806  map<Vector3,bool> isPileuped[PndFTSCAParameters::MaxNStations];
807  for (int i = 0; i < NHits; i++){
808  PndFTSCAGBHit &l = hits[i];
809  const int iS = l.IRow();
810 
811  Vector3 v(l.X(), l.Y(), l.Z());
812  if ( minR[iS].count(v) > 0 ) {
813  minR[iS][v] = min(l.R(), minR[iS][v]);
814  isPileuped[iS][v] = true;
815  //assert(iS >= PndFTSCAParameters::MaxNStations/*PndFTSCAParameters::NMVDStations*/); // MVD
816  }
817  else {
818  minR[iS][v] = l.R();
819  isPileuped[iS][v] = false;
820  }
821  }
822 
824  int nHits2 = 0;
825  for( int iS = 0; iS < PndFTSCAParameters::MaxNStations; iS++ ) {
826  nHits2 += minR[iS].size();
827  }
828  hits2.Resize(nHits2);
829  for (int i = 0, j = 0; i < NHits; i++){
830  PndFTSCAGBHit &l = hits[i];
831  Vector3 v(l.X(), l.Y(), l.Z());
832  const int iS = l.IRow();
833 
834  if ( minR[iS][v] == l.R() ) {
835  l.SetIsPileuped(isPileuped[iS][v]);
836  hits2[j] = l;
837  j++;
838  }
839  }
840 
841 #ifndef HLTCA_STANDALONE
842  // merge labels
843  for (int j = 0; j < nHits2; j++){
844  PndFTSCAGBHit &l2 = hits2[j];
845  const int id2 = l2.ID();
846  Vector3 v2(l2.X(), l2.Y(), l2.Z());
847  for (int i = 0; i < NHits; i++){
848  PndFTSCAGBHit &l = hits[i];
849  const int id = l.ID();
850  if ( id2 == id ) continue;
851  Vector3 v(l.X(), l.Y(), l.Z());
852  if ( l.X() != l2.X() || l.Y() != l2.Y() || l.Z() != l2.Z() ) continue;
853 
854  int k = 0;
855  bool flag = false;
856  for( ; k < 3 && fHitLabels[id2].fLab[k] != -1; k++ )
857  if ( fHitLabels[id2].fLab[k] == fHitLabels[id].fLab[0] ) flag = true;
858  if (flag) continue;
859  if (k >= 3) continue;
860  fHitLabels[id2].fLab[k] = fHitLabels[id].fLab[0]; // suppose we have only 1 label from the begining
861  }
862  }
863 #endif
864 
865  const_cast<PndFTSCAGBTracker *>(fTracker)->SetNHits(nHits2);
866  for (int i = 0; i < nHits2; i++){
867  hits[i] = hits2[i];
868  }
869 
870  // do not need to correct labels, since they are matched with hits by hit::fID
871 }
872 
873  // Rid of hits with same wires positions
874 void PndFTSCAPerformance::DivideHitsOnLR(){
875  PndFTSResizableArray<PndFTSCAGBHit>& hits = const_cast<PndFTSCAGBTracker *>(fTracker)->fHits;
876  const int NHits = hits.Size();
877 
878  int nMvdHits = 0;
879 
880 // for (int i = 0; i < NHits; i++){
881 // PndFTSCAGBHit &hIn = hits[i];
882 // if(hIn.IRow() < PndFTSCAParameters::MaxNStations /*PndFTSCAParameters::NMVDStations*/)
883 // nMvdHits++;
884 // }
885 
887  const int NHits2 = nMvdHits + 2*(NHits-nMvdHits);
888  hits2.Resize(NHits2);
889 
890  for(int i=0; i<nMvdHits; i++)
891  {
892  hits2[i] = hits[i];
893  }
894 
895  for (int i = nMvdHits; i < NHits; i++){
896  PndFTSCAGBHit &hIn = hits[i];
897  PndFTSCAGBHit &hOut1 = hits2[2*i-nMvdHits];
898  PndFTSCAGBHit &hOut2 = hits2[2*i-nMvdHits+1];
899 
900  const float k = 1.5; // diff between real size and sigma
901  //const float r = hIn.R(); //[R.K. 9/2018] unused
902 
903  // const float x = hIn.X();
904  // const float y = hIn.Y();
905 
906 
907 
908 
909  const float errT = 0.02/k; // tangential error 2 mm
910 // cout << 0.02/k << " " << sqrt(hIn.Err2R()) << endl;
911  const float errN = sqrt(hIn.Err2R()); // normal error
912  // const float R = 0.5/k; // TODO
913  // const float e0 = errT/R;
914  // const float e1 = errN/R;
915 
916  hOut1 = hIn;
917  {
918  const double beta = hIn.Beta(); // strip angle
919 
920  const double C11 = errN*errN;
921  const double C22 = hIn.Err2X2();
922  const double s = sin(beta);
923  const double c = cos(beta);
924  hOut1.SetErr2X0( errT*errT );
925  hOut1.SetErrX12( -s*c*(C11-C22) );
926  hOut1.SetErr2X1( c*c*C11+s*s*C22 );
927  hOut1.SetErr2X2( s*s*C11+c*c*C22 );
928  }
929 
930 #ifdef PANDA_STT
931  const float x = hIn.X();
932  const float y = hIn.Y();
933  const float a = hIn.Angle();
934 
935  hOut1.SetX( x + r*cos(a) ); // neglect 3deg angle
936  hOut1.SetY( y - r*sin(a) );
937 #else //PANDA_FTS
938  const float x = hIn.X();
939 
940  hOut1.SetX( x ); // neglect 3deg angle
941 #endif
942  hOut1.SetIsLeft( false );
943  hOut2 = hOut1;
944 
945 #ifdef PANDA_STT
946  hOut2.SetX( x - r*cos(a) );
947  hOut2.SetY( y + r*sin(a) );
948 #else
949  hOut1.SetX( x );
950 #endif
951  hOut2.SetIsLeft( true );
952 
953  hOut1.SetID(hIn.ID()*2-nMvdHits);
954  hOut2.SetID(hIn.ID()*2-nMvdHits+1);
955  }
956 
957  const_cast<PndFTSCAGBTracker *>(fTracker)->SetNHits(NHits2);
958  for (int i = 0; i < NHits2; i++){
959  hits[i] = hits2[i];
960  }
961 
962  // create additional hitLables
964  const int NLabs = fHitLabels.Size();
965  labs2.Resize(nMvdHits + 2*(NLabs-nMvdHits));
966  for (int i = 0; i < nMvdHits; i++){
967  labs2[i] = fHitLabels[i];
968  }
969  for (int i = nMvdHits; i < NLabs; i++){
970  labs2[2*i-nMvdHits] = fHitLabels[i];
971  labs2[2*i-nMvdHits+1] = fHitLabels[i];
972  }
973  fHitLabels.Resize(nMvdHits + 2*(NLabs-nMvdHits));
974  for (int i = 0; i < nMvdHits + 2*(NLabs-nMvdHits); i++){
975  fHitLabels[i] = labs2[i];
976  }
977 
978  // clean labels (half of created hits are "fake")
979  for (int iHit = nMvdHits; iHit < hits.Size(); iHit+=2)
980  {
981  const PndFTSCAGBHit &hitR = hits[iHit];
982  const PndFTSCAGBHit &hitL = hits[iHit+1];
983 
984  int iMCP = -1;
985  float dxMin = 1.e6;
986  for( int k = 0; k < 3 && iMCP == -1; k++ )
987  {
988  const int iMCTrack = fHitLabels[iHit].fLab[k];
989  if (iMCTrack < 0) continue;
990 
991  const PndFTSCAMCTrack &mcTrack = fMCTracks[iMCTrack];
992 
993  int nFirstMC = mcTrack.FirstMCPointID();
994  int nMCPoints = mcTrack.NMCPoints();
995 
996  // float r2Min = 1e10;
997  const PndFTSCALocalMCPoint *points = &(fLocalMCPoints.Data()[nFirstMC]);
998  for(int iMCPoint=0; iMCPoint<nMCPoints; iMCPoint++)
999  {
1000  const PndFTSCALocalMCPoint &p = points[iMCPoint];
1001 
1002  if(fabs(p.Z() - hitR.Z()) > 0.5) continue;
1003 
1004  float sinA = fTracker->GetParameters().Station(hitR.IRow()).f.sin;
1005  float cosA = fTracker->GetParameters().Station(hitR.IRow()).f.cos;
1006  float correction = cosA*(p.Px()/p.Pz()) + sinA*(p.Py()/p.Pz());
1007  float dxR = cosA*hitR.X() + sinA*hitR.Y() + hitR.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y();
1008  float dxL = cosA*hitL.X() + sinA*hitL.Y() - hitL.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y();
1009 
1010  float dx = dxR;
1011  if(fabs(dxL)<fabs(dxR))
1012  dx = dxL;
1013 
1014  if(fabs(dx)<dxMin)
1015  {
1016 // if( fabs(dx) < 10*sqrt(hitR.Err2R())*sqrt(1.+correction*correction) )
1017  {
1018  iMCP = iMCPoint + nFirstMC;
1019  dxMin = fabs(dx);
1020  }
1021  }
1022  }
1023  }
1024 
1025  if (iMCP < 0)
1026  {
1027  for(int iLabel=0; iLabel<3; iLabel++)
1028  {
1029  fHitLabels[iHit].fLab[iLabel] = -1;
1030  fHitLabels[iHit+1].fLab[iLabel] = -1;
1031  }
1032  continue;
1033  }
1034 
1035  const PndFTSCALocalMCPoint &p = fLocalMCPoints[iMCP];
1036 
1037  float sinA = fTracker->GetParameters().Station(hitR.IRow()).f.sin;
1038  float cosA = fTracker->GetParameters().Station(hitR.IRow()).f.cos;
1039  float correction = cosA*(p.Px()/p.Pz()) + sinA*(p.Py()/p.Pz());
1040  float dxR = cosA*hitR.X() + sinA*hitR.Y() + hitR.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y(); // dx = hit.X() - hit.R() - p.X();
1041  float dxL = cosA*hitL.X() + sinA*hitL.Y() - hitL.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y(); // dx = hit.X() + hit.R() - p.X();
1042 
1043  if(fabs(dxR) < fabs(dxL))
1044  for(int iLabel=0; iLabel<3; iLabel++)
1045  fHitLabels[iHit+1].fLab[iLabel] = -1;
1046  else
1047  for(int iLabel=0; iLabel<3; iLabel++)
1048  fHitLabels[iHit].fLab[iLabel] = -1;
1049  }
1050 
1051 #if 0
1052  const int NMCPoints = GetMCPoints()->Size();
1053  vector<vector<int> > hitsOnPoint(NMCPoints);
1054  for(int iH = nMvdHits; iH < hits.Size(); iH++) {
1055  const PndFTSCAGBHit &h = hits[iH];
1056  int id = GetMCPoint(h);
1057  if(id < 0) {
1058  // delete match with MCTracks
1059  for( int k = 0; k < 3; k++ ) {
1060  fHitLabels[h.ID()].fLab[k] = -1;
1061  }
1062  continue;
1063  }
1064  hitsOnPoint[id].push_back(iH);
1065  }
1066 
1067 std::cout << "fHitLabels " << fHitLabels.Size() << std::endl;
1068  int nNegative = 0;
1069  for(int iHL=0; iHL<fHitLabels.Size(); iHL++)
1070  {
1071  std::cout << "iHL " << iHL << " " << fHitLabels[iHL].fLab[0] << " " <<fHitLabels[iHL].fLab[1] << " " << fHitLabels[iHL].fLab[2] << " " << std::endl;
1072  if(fHitLabels[iHL].fLab[0] < 0 && fHitLabels[iHL].fLab[1] < 0 && fHitLabels[iHL].fLab[2] < 0)
1073  nNegative++;
1074  }
1075 std::cout << "nNegative " << nNegative << std::endl;
1076 
1077  // clean double hits. Comment this out to calculate efficiency without tacking into account left-right ambiguity
1078 // #ifdef INCLUDE_LR_EFF
1079  for(int iT=0; iT<NMCPoints; iT++) {
1080  const vector<int> &hop = hitsOnPoint[iT];
1081  if (hop.size() == 0) continue;
1082  float r2Min = 1e10;
1083  int iBestH = -1;
1084  for( unsigned int iH = 0; iH < hop.size(); iH++ ) {
1085  const PndFTSCAGBHit &h = hits[hop[iH]];
1086  const int iMCP = GetMCPoint(h);
1087  if (iMCP < 0) continue;
1088  const PndFTSCALocalMCPoint &p = fLocalMCPoints[iMCP];
1089 
1090  float sinA = fTracker->GetParameters().Station(h.IRow()).f.sin;
1091  float cosA = fTracker->GetParameters().Station(h.IRow()).f.cos;
1092  float correction = cosA*(p.Px()/p.Pz()) + sinA*(p.Py()/p.Pz());
1093  float dx = cosA*h.X() + sinA*h.Y() + h.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y(); // dx = hit.X() - hit.R() - p.X();
1094  if(h.IsLeft())
1095  dx = cosA*h.X() + sinA*h.Y() - h.R()*sqrt(1.+correction*correction) - cosA*p.X()- sinA*p.Y(); // dx = hit.X() + hit.R() - p.X();
1096 
1097  if (fabs(dx) < r2Min) {
1098  r2Min = fabs(dx);
1099  iBestH = iH;
1100  }
1101  }
1102 
1103 // #ifndef HLTCA_STANDALONE
1104 std::cout << "Ololo!! " << hop.size() << std::endl;
1105  for( unsigned int iH = 0; iH < hop.size(); iH++ ) {
1106  if (static_cast<int>(iH) == iBestH) continue;
1107  const PndFTSCAGBHit &h = hits[hop[iH]];
1108 // if (h.R()*h.R() < 9.f*h.Err2R()) continue; // can't really distinguish left and right side of this tubes
1109 
1110  const int id = GetMCPoint(h);
1111  if(id < 0) continue;
1112  const int iMCT = fLocalMCPoints[id].TrackI();
1113  // delete match with MCTrack
1114  for( int k = 0; k < 3; k++ ) {
1115  if ( fHitLabels[h.ID()].fLab[k] == iMCT ) {
1116  fHitLabels[h.ID()].fLab[k] = -1;
1117  }
1118  }
1119  }
1120 // #endif
1121  }
1122 // #endif // 1
1123 
1124 std::cout << "fHitLabels " << fHitLabels.Size() << std::endl;
1125  int nNegative2 = 0;
1126  for(int iHL=0; iHL<fHitLabels.Size(); iHL++)
1127  {
1128  std::cout << "iHL " << iHL << " " << fHitLabels[iHL].fLab[0] << " " <<fHitLabels[iHL].fLab[1] << " " << fHitLabels[iHL].fLab[2] << " " << std::endl;
1129  if(fHitLabels[iHL].fLab[0] < 0 && fHitLabels[iHL].fLab[1] < 0 && fHitLabels[iHL].fLab[2] < 0)
1130  nNegative2++;
1131  }
1132 std::cout << "nNegative " << nNegative2 << std::endl;
1133 #endif
1134 }
1135 #endif // PANDA_STT
1136 
1137 
1138 
1139 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE
Double_t p
Definition: anasim.C:58
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
TRandom1 rand
Definition: RiemannTest.C:20
static bool Compare(const PndFTSCAGBHit &a, const PndFTSCAGBHit &b)
Hits reordering in accordance with the geometry and the track-finder needs: Hits are sorted by sector...
double r
Definition: RiemannTest.C:14
void SetErr2Z(float v)
Definition: PndFTSCAGBHit.h:93
Int_t i
Definition: run_full.C:25
TTree * b
TFile * file
int NMCPoints() const
int Size() const
Definition: PndFTSArray.h:374
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int nHits2
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
double mcZ
Definition: anaLmdCluster.C:53
TLorentzVector s
Definition: Pnd2DStar.C:50
int n
int IRow() const
Definition: PndFTSCAGBHit.h:56
void SetAngle(float v)
float Z() const
Definition: PndFTSCAGBHit.h:43
void SetNHitContRows(int v)
void SetFStripP(FTSCAStrip *s)
double Y
Definition: anaLmdDigi.C:68
__m128 v
Definition: P4_F32vec4.h:4
void SetNHitRows(int v)
void SetErr2Y(float v)
Definition: PndFTSCAGBHit.h:92
float Y() const
Definition: PndFTSCAGBHit.h:42
std::vector< std::string > labels
float X() const
void SetMotherId(int v)
void SetY(float v)
Definition: PndFTSCAGBHit.h:89
void SetNMCContRows(int v)
Int_t a
Definition: anaLmdDigi.C:126
int MotherId() const
void SetIRow(int v)
Definition: PndFTSCAGBHit.h:95
static void GlobalToCALocal(T x, T y, T angle, T &x0, T &x1)
int nHits
Definition: RiemannTest.C:16
float Angle() const
double mcX
Definition: anaLmdCluster.C:53
void SetErr2Y(float v)
float Err2Y() const
Definition: PndFTSCAGBHit.h:46
void SetNMCRows(int v)
TFile * f
Definition: bump_analys.C:12
Double_t z
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:25
int ID() const
Definition: PndFTSCAGBHit.h:57
void SetErrYZ(float v)
Definition: PndFTSCAGBHit.h:94
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void SetBStripP(FTSCAStrip *s)
float X() const
Definition: PndFTSCAGBHit.h:41
TString name
double mcY
Definition: anaLmdCluster.C:53
double dx
double X
Definition: anaLmdDigi.C:68
void SetX(float v)
Definition: PndFTSCAGBHit.h:88
void SetErr2Z(float v)
float Err2Y() const
float Angle() const
Double_t x
#define ASSERT(v, msg)
Definition: PndCADef.h:56
double Z
Definition: anaLmdDigi.C:68
static void CALocalToGlobal(T x0, T x1, T angle, T &x, T &y)
TVector3 v2
Definition: bump_analys.C:40
void SetZ(float v)
Definition: PndFTSCAGBHit.h:90
TTree * t
Definition: bump_analys.C:13
int count
void SetID(int v)
Definition: PndFTSCAGBHit.h:96
PndSdsMCPoint * hit
Definition: anasim.C:70
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
Double_t y
float Y() const
float Err2X2() const
Definition: PndFTSCAGBHit.h:54
void SetAngle(float v)
Double_t angle
float Err2Z() const
Definition: PndFTSCAGBHit.h:47
void Resize(int x)
Definition: PndFTSArray.h:703
float Z() const
friend F32vec4 operator<(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:75
float Err2Z() const
double r2
int FirstMCPointID() const
PndSdsMCPoint * point
Definition: anaLmdCluster.C:72