FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PndFtsDataAccessor Class Reference

#include <PndFtsDataAccessor.h>

Inheritance diagram for PndFtsDataAccessor:

Public Member Functions

 PndFtsDataAccessor ()
 
virtual ~PndFtsDataAccessor ()
 
virtual void Exec (Option_t *option)
 
virtual InitStatus Init ()
 
virtual void Finish ()
 
void Reset ()
 
void Register ()
 
void SetParContainers ()
 
void SetFtsActivity (Bool_t act=kTRUE)
 
void SetGemActivity (Bool_t act=kTRUE)
 
void SetMvdActivity (Bool_t act=kTRUE)
 
void SetPersistence (Bool_t persistence)
 

Protected Member Functions

 PndFtsDataAccessor (const PndFtsDataAccessor &L)
 
PndFtsDataAccessoroperator= (const PndFtsDataAccessor &)
 
 ClassDef (PndFtsDataAccessor, 1)
 

Protected Attributes

TClonesArray * fMCTracks
 
TClonesArray * fMCPoints [4]
 Array of PndMCTrack. More...
 
TClonesArray * fHits [4]
 Array of event's points. More...
 
Int_t fBranchIDs [4]
 Array of event's hits. More...
 
Bool_t fBranchActive [4]
 Array of Branch IDs. More...
 
FairField * fField
 Array of Branch Activeness. More...
 
Double_t By
 
Double_t po [3]
 
Double_t BB [3]
 
Bool_t fPersistence
 
TDatabasePDG * pdg
 
PndGeoFtsParfFtsParameters
 Particle DB. More...
 
TClonesArray * fTubeArrayFts
 

Detailed Description

Definition at line 28 of file PndFtsDataAccessor.h.

Constructor & Destructor Documentation

PndFtsDataAccessor::PndFtsDataAccessor ( )

Definition at line 41 of file PndFtsDataAccessor.cxx.

References fBranchActive, fVerbose, and i.

41  :
42  FairTask("FTSDataAccessor"), fMCTracks(0), By(0), fPersistence(kTRUE), pdg(0)
43 {
44  //---
45  fVerbose = 0;
46  for (int i=0;i<4;i++) fBranchActive[i]=kTRUE;
47 }
int fVerbose
Definition: poormantracks.C:24
Int_t i
Definition: run_full.C:25
Bool_t fBranchActive[4]
Array of Branch IDs.
TClonesArray * fMCTracks
PndFtsDataAccessor::~PndFtsDataAccessor ( )
virtual

Definition at line 50 of file PndFtsDataAccessor.cxx.

51 {
52  FairRootManager *fManager =FairRootManager::Instance();
53  fManager->Write();
54 }
PndFtsDataAccessor::PndFtsDataAccessor ( const PndFtsDataAccessor L)
protected

Member Function Documentation

PndFtsDataAccessor::ClassDef ( PndFtsDataAccessor  ,
 
)
protected
void PndFtsDataAccessor::Exec ( Option_t *  option)
virtual

Definition at line 159 of file PndFtsDataAccessor.cxx.

References At, b1, b2, C(), c1, c2, CR, Double_t, dx, dy, f, fabs(), fBranchActive, fBranchIDs, fField, fHits, fMCPoints, fMCTracks, fTubeArrayFts, fVerbose, GetEntriesFast(), PndFtsTube::GetHalfLength(), PndFtsHit::GetIsochrone(), PndFtsHit::GetIsochroneError(), PndFtsHit::GetLayerID(), PndMCTrack::GetMomentum(), PndMCTrack::GetMotherID(), PndMCTrack::GetPdgCode(), PndFtsTube::GetPosition(), PndFtsTube::GetRadIn(), PndFtsTube::GetRotationMatrix(), PndMCTrack::GetStartVertex(), PndFtsTube::GetWireDirection(), hit(), i, m, out, p, point, pz, r, sqrt(), TString, x, y, Z, and z.

160 {
161  if(fVerbose>3) Info("Exec","Start eventloop.");
162  if(fVerbose>4){
163  Info("Exec","Print some array properties");
164  for(int iii=0;iii<4;iii++){
165  std::cout<<"fHits["<<iii<<"] is branchID "<<fBranchIDs[iii]<<" with the name "<<fHits[iii]->GetName()<<" and contains "<<fHits[iii]->GetEntriesFast()<<" entries."<<std::endl;
166  std::cout<<"fMCPoints["<<iii<<"] with the name "<<fMCPoints[iii]->GetName()<<" and contains "<<fMCPoints[iii]->GetEntriesFast()<<" entries."<<std::endl;
167  }
168  }
169 
170  // create output files
171  static int iEvent = -1;
172  iEvent++;
173  TString folder_name = "data/";
174  TString fadata_name = "data/event";
175  fadata_name += iEvent;
176  TString fadataH_name = fadata_name + "_hits.data";
177  TString fadataHL_name = fadata_name + "_hitLabels.data";
178  TString fadataMCT_name = fadata_name + "_MCTracks.data";
179  TString fadataMCP_name = fadata_name + "_MCPoints.data";
180  fstream outH(fadataH_name, fstream::out);
181  fstream outHL(fadataHL_name, fstream::out);
182  fstream outMCT(fadataMCT_name, fstream::out);
183  fstream outMCP(fadataMCP_name, fstream::out);
184 
185  //FairHit* ghit = NULL; //[R.K. 01/2017] unused variable?
186 
187  // Loop over all hits from FTS first (later other detectors, too)
188 
189  // Detector loop
190  for(Int_t iDet=0;iDet<1;iDet++) { // only FTS hits at the moment
191 
192  if (kFALSE == fBranchActive[iDet]) continue; //skip manually switched off detector
193  if(fVerbose>4) Info("Exec","Use detector %i",iDet);
194 
195  std::map<Int_t, FairHit*> firstHit;
196  std::map<Int_t, FairHit*> lastHit;
197  std::map<Int_t, FairMCPoint*> firstPoint;
198  std::map<Int_t, FairMCPoint*> lastPoint;
199  std::map<Int_t, PndTrackCand*> candlist;
200 
201  const int NHits = fHits[iDet]->GetEntriesFast();
202  // cout << " ----------------------- Store data ------------------------- " << endl;
203  // cout << " NFTSHits = " << NHits << endl;
204  outH << NHits << endl;
205  outHL << NHits << endl;
206  outMCP << NHits << endl; // WARNING: Currently use only MCPoints, which produces hits!!!!
207  map<int, unsigned int> nHitsInMCTrack, nMCPointsInMCTrack, FirstMCPointIDInMCTrack;
208  const int NStations = 48;
209  vector<float> zOfStation(NStations, -1.f);
210  int iWrittenHit = -1;
211  for (Int_t ih = 0; ih < NHits; ih++) {
212 
213  // RecoHits
214  PndFtsHit* hit = (PndFtsHit*) fHits[iDet]->At(ih);
215  if(!hit) {
216  if(fVerbose>3) Error("Exec","Have no ghit %i, array size: %i",ih,fHits[iDet]->GetEntriesFast());
217  continue;
218  }
219 
220  iWrittenHit++;
221  Int_t tubeID = ((PndFtsHit*) hit)->GetTubeID();
222  PndFtsTube *tube = (PndFtsTube*) fTubeArrayFts->At(tubeID);
223  TVector3 position = tube->GetPosition();
224  const Double_t x = position.X();
225  const Double_t y = position.Y();
226  const Double_t z = position.Z();
227  outH << x << " " << y << " " << z << " " << hit->GetIsochrone() << endl;
228 
229  const int iSta = hit->GetLayerID() - 1;
230  if ( zOfStation[iSta] == -1.f)
231  zOfStation[iSta] = z;
232  else
233  if ( std::abs(zOfStation[iSta] - z) > 1e-4f ) // 1mum precision
234  cout << " WARNING: different z positions within one layer. Settings inforation can be corrupted. " << zOfStation[iSta] << " " << z << endl;
235 
236  const Double_t dR = hit->GetIsochroneError();
237  const Double_t dR2 = dR*dR;
238  const Double_t kSS = 1.5; // coefficient between size and sigma
239  const Double_t dXY = tube->GetRadIn();
240  const Double_t errXY = dXY/kSS;
241  const Double_t errXY2 = errXY*errXY;
242  const Double_t errZ = tube->GetHalfLength()/kSS*sqrt(26); // 26 rows with basicaly same information
243 
244  TMatrixT<Double_t> RM = tube->GetRotationMatrix();
245  TMatrixT<Double_t> C(3,3); // CovMatrix
246  C[0][0] = errXY2;
247  C[1][1] = errXY2;
248  C[2][2] = errZ*errZ;
249  C[0][1] = C[0][2] = C[1][0] = C[1][2] = C[2][0] = C[2][1] = 0;
250 
251  TMatrixT<Double_t> CR = C; // rotated CovMatrix
252 
253  CR = RM*C;
254  CR = CR*RM.Transpose(RM);
255  outH << CR[0][0] << " " << CR[0][1] << " " << CR[0][2] << endl;
256  outH << CR[1][0] << " " << CR[1][1] << " " << CR[1][2] << endl;
257  outH << CR[2][0] << " " << CR[2][1] << " " << CR[2][2] << endl;
258  outH << dR2 << endl;
259  outH << tube->GetRadIn() << " " << tube->GetHalfLength() << endl;
260 
261  TVector3 wire_direction = tube->GetWireDirection(); // shows the wire direction, ( notSkewed layers - wire_direction.X() == 1 ).
262  outH << wire_direction.X() << " " << wire_direction.Y() << " " << wire_direction.Z() << endl; // TODO rid of covMatrix
263  outH << iSta << " " << iWrittenHit << " " << -1234 << endl; // station position is normal to z
264 
265  // MC Points
266  Int_t mchitid=hit->GetRefIndex();
267  if(mchitid<0) {
268  if(fVerbose>3) Error("Exec","Have a negative mcHit %i",mchitid);
269  continue;
270  }
271  const FairMCPoint* point = (FairMCPoint*)(fMCPoints[iDet]->At(mchitid));
272  if(!point) continue;
273  Int_t trackID = point->GetTrackID();
274  if(trackID<0) continue;
275 
276  Double_t q = 1;
277  { // get charge
278  const TClonesArray* fMCTrackArray = fMCTracks;
279  if ( trackID < fMCTrackArray->GetEntriesFast() ) {
280  const PndMCTrack* mcTr = (PndMCTrack*) fMCTrackArray->At(trackID);
281  if ( mcTr ) {
282  TParticlePDG * part = TDatabasePDG::Instance()->GetParticle(mcTr->GetPdgCode());
283  if ( part )
284  q = part->Charge()/3.f;
285  }
286  else { cout << " Bad MCTracks2" << endl; }
287  }
288  else { cout << " Bad MCTracks" << endl; }
289  }
290 
291  outHL << trackID << " " << -1 << " " << -1 << endl;
292  outMCP << point->GetX() << " " << point->GetY() << " " << point->GetZ() << endl;
293  outMCP << point->GetPx() << " " << point->GetPy() << " " << point->GetPz() << " "
294  << q/sqrt( point->GetPx()*point->GetPx() + point->GetPy()*point->GetPy() + point->GetPz()*point->GetPz() ) << endl;
295  outMCP << 0 << " " << iSta << " " << trackID << " " << trackID << endl;
296 
297  if ( nHitsInMCTrack.find(trackID) != nHitsInMCTrack.end() ) {
298  nHitsInMCTrack[trackID]++;
299  nMCPointsInMCTrack[trackID]++;
300  } else {
301  nHitsInMCTrack[trackID] = 1;
302  nMCPointsInMCTrack[trackID] = 1;
303  FirstMCPointIDInMCTrack[trackID] = iWrittenHit;
304  }
305 
306  } // end loop over hits
307 
308  { // MC Tracks
309  const TClonesArray* fMCTrackArray = fMCTracks;
310  const int nMCTracks = fMCTrackArray->GetEntriesFast();
311 
312  outMCT << nMCTracks << endl;
313  for ( int i = 0; i < nMCTracks; i++ ){
314  const PndMCTrack* mcTr = (PndMCTrack*) fMCTrackArray->At(i);
315 
316  if ( !mcTr ) {
317  outMCT << -1 << " " << -1 << endl;
318  outMCT << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << endl;
319  outMCT << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << endl;
320  outMCT << 0 << " " << 0 << endl;
321  outMCT << 0 << " " << 0 << " " << 0 << endl;
322  outMCT << 0 << " " << 0 << " " << 1 << endl;
323 
324  } else {
325 
326  Int_t pdgCode = mcTr->GetPdgCode();
327  Double_t px = mcTr->GetMomentum().X();
328  Double_t py = mcTr->GetMomentum().Y();
329  Double_t pz = mcTr->GetMomentum().Z();
330  Double_t p = sqrt( px*px + py*py + pz*pz );
331  Double_t q = 1;
332  { // get charge
333  TParticlePDG * part = TDatabasePDG::Instance()->GetParticle(pdgCode);
334  if ( part )
335  q = part->Charge()/3.f;
336  }
337  //Double_t ex,ey,ez,qp; //[R.K. 01/2017] unused variable?
338  outMCT << mcTr->GetMotherID() << " " << pdgCode << endl;
339  outMCT << mcTr->GetStartVertex().X() << " " << mcTr->GetStartVertex().Y() << " " << mcTr->GetStartVertex().Z() << " "
340  << px/fabs(p) << " " << py/fabs(p) << " " << pz/fabs(p) << " " << q/p << endl;
341  outMCT << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << endl;
342  outMCT << p << " " << sqrt( px*px + py*py ) << endl;
343  outMCT << nHitsInMCTrack[i] << " " << nMCPointsInMCTrack[i] << " " << FirstMCPointIDInMCTrack[i] << endl;
344  outMCT << 0 << " " << 0 << " " << 1 << endl;
345  }
346  }
347  }
348 
349 
350  // Settings
351  static bool isFirstEvent = true;
352  if ( isFirstEvent ) {
353  isFirstEvent = false;
354 
355  TString fadataGeo_name = folder_name + "settings.data";
356  fstream outGeo(fadataGeo_name, fstream::out);
357 
358  outGeo << NStations << endl;
359  outGeo << -10 << endl; // field
360  for( int iS = 0; iS < NStations; iS++ ) {
361  float slope = 5.f/180.f*3.14159265359f;
362  switch ( (iS/2)%4 ) {
363  case 0: slope = 0; break;
364  case 1: slope = slope; break;
365  case 2: slope = -slope; break;
366  case 3: slope = 0; break;
367  }
368  outGeo << iS << " " << zOfStation[iS] << " " << 0.00044 << " " << 0.0117 << " " << slope << " " << 1 << " " << 6 << endl;
369  }
370 
371  const int NSubStations = 8;
372  const float Height[NStations/NSubStations] = { 640, 640, 741.9, 818.9, 1200.0, 1200.0 }; // mm
373  float YMin[NStations/NSubStations]; // filled later
374  float YMax[NStations/NSubStations]; // filled later
375  float XMin[NStations/NSubStations] = { -659.025, -659.025, -881.225, -1042.825, -1951.825, -1951.825 }; // mm
376  float XMax[NStations/NSubStations]; // filled later
377  const float NTubes[NStations/NSubStations] = { 132, 132, 176, 208, 388, 388 };
378  float Z[NStations] = { 2949.627, 2958.373, 2999.627, 3008.373, 3049.627, 3058.373, 3099.627, 3108.373, // mm
379  3269.627, 3278.373, 3319.627, 3328.373, 3369.627, 3378.373, 3419.627, 3428.373,
380  3940.627, 3949.373, 4015.377, 4024.123, 4160.627, 4169.373, 4235.377, 4244.123,
381  4380.627, 4389.373, 4455.377, 4464.123, 4600.627, 4609.373, 4675.377, 4684.123,
382  6070.627, 6079.373, 6120.627, 6129.373, 6170.627, 6179.373, 6220.627, 6229.373,
383  6390.627, 6399.373, 6440.627, 6449.373, 6490.627, 6499.373, 6540.627, 6549.373 };
384 
385  for( int i = 0; i < NStations/NSubStations; i++ ) {
386  XMax[i] = XMin[i] + NTubes[i]*10.1;
387  YMin[i] = -Height[i]/2;
388  YMax[i] = Height[i]/2;
389  // convert into cm
390  XMin[i] /= 10;
391  XMax[i] /= 10;
392  YMin[i] /= 10;
393  YMax[i] /= 10;
394  }
395  for( int i = 0; i < NStations; i++ ) {
396  Z[i] /= 10;
397  }
398 
399  // Field
400  //int ind = 0; //[R.K. 01/2017] unused variable?
401  for( int i=0; i<3; i++ ){
402  Double_t z = i*(Z[0]-1.f)/2; // last point is taken in 1 cm from first station
403  Double_t point[3] = {0,0,z};
404  Double_t B[3] = {0,0,0};
405  fField->GetFieldValue( point, B );
406  outGeo << z << " " << B[0] << " " << B[1] << " " << B[2] << endl;
407  }
408 
409  const int M=5; // polinom order
410  const int N=(M+1)*(M+2)/2;
411  const int MaxN = 100;
412 
413  for ( Int_t ist = 0; ist<NStations; ist++ ) {
414  const float XMinS = XMin[ist/8]/2;
415  const float XMaxS = XMax[ist/8]/2;
416  const float YMinS = YMin[ist/8]/2;
417  const float YMaxS = YMax[ist/8]/2;
418  const float ZS = Z[ist];
419  const float DX = XMaxS - XMinS;
420  const float DY = YMaxS - YMinS;
421  const float XAverage = XMaxS - XMinS;
422  const float YAverage = YMaxS - YMinS;
423 
424  double dx = 1.; // step for the field approximation
425  double dy = 1.;
426 
427 
428  if( dx > DX/N/4 ) dx = DX/N/4.;
429  if( dy > DY/N/2 ) dy = DY/N/4.;
430 
431  double C[3][MaxN] = {0};
432  for( int i=0; i<3; i++)
433  for( int k=0; k<MaxN; k++) C[i][k] = 0;
434 
435  TMatrixD A(N,N);
436  TVectorD b0(N), b1(N), b2(N);
437  for( int i=0; i<N; i++){
438  for( int j=0; j<N; j++) A(i,j) = 0.;
439  b0(i)=b1(i)=b2(i) = 0.;
440  }
441 
442  const int NXBins = (XMaxS - XMinS)/dx;
443  const int NYBins = (YMaxS - YMinS)/dy;
444  const float dzVirtualStations = 5.f;
445  int nVirtualStations = (ist > 0 && ist%NSubStations == 0) ? static_cast<int>((Z[ist] - Z[ist-1])/dzVirtualStations) : 0;
446  outGeo << ist << endl;
447  outGeo << nVirtualStations << " " << dzVirtualStations << endl;
448  outGeo << XMinS << " " << dx << " " << NXBins << endl;
449  outGeo << YMinS << " " << dy << " " << NYBins << endl;
450 
451  for( int iV = nVirtualStations; iV >= 0; iV-- )
452  for( double ixb = 0; ixb < NXBins; ixb++ ) {
453  for( double iyb = 0; iyb < NYBins; iyb++ ) {
454  const double x = XMinS + ixb*dx;
455  const double y = YMinS + iyb*dy;
456 
457  Double_t p[3] = {x, y, ZS - iV*dzVirtualStations};
458  Double_t B[3] = {0.,0.,0.};
459  fField->GetFieldValue(p, B);
460 // outGeo << B[0] << " " << B[1] << " " << B[2] << endl;
461  double r = sqrt( (x - XAverage)*(x - XAverage)/DX/DX +
462  (y - YAverage)*(y - YAverage)/DY/DY );
463 // if( r>1. ) continue;
464  Double_t w = 1./(r*r+1);
465 
466  TVectorD m(N);
467  m(0)=1;
468  for( int i=1; i<=M; i++){
469  int k = (i-1)*(i)/2;
470  int l = i*(i+1)/2;
471  for( int j=0; j<i; j++ ) m(l+j) = x*m(k+j);
472  m(l+i) = y*m(k+i-1);
473  }
474 
475  TVectorD mt = m;
476  for( int i=0; i<N; i++){
477  for( int j=0; j<N;j++) A(i,j)+=w*m(i)*m(j);
478  b0(i)+=w*B[0]*m(i);
479  b1(i)+=w*B[1]*m(i);
480  b2(i)+=w*B[2]*m(i);
481  }
482  }
483  }
484  double det;
485  A.Invert(&det);
486  TVectorD c0 = A*b0, c1 = A*b1, c2 = A*b2;
487  for(int i=0; i<N; i++){
488  C[0][i] = c0(i);
489  C[1][i] = c1(i);
490  C[2][i] = c2(i);
491  }
492 
493  outGeo << N << endl;
494  for( int k=0; k<3; k++ ){
495  for( int j=0; j<N; j++)
496  outGeo << C[k][j] << " ";
497  outGeo << endl;
498  }
499 
500  // check
501 #if 0
502  Int_t N = 0;
503  Double_t sumR = 0;
504  for( double x = XMinS; x <= XMaxS; x += dx/10 )
505  for( double y = YMinS; y <= YMaxS; y += dy/10 ) {
506  float x2 = x*x;
507  float y2 = y*y;
508  float xy = x*y;
509 
510  float x3 = x2*x;
511  float y3 = y2*y;
512  float xy2 = x*y2;
513  float x2y = x2*y;
514 
515  float x4 = x3*x;
516  float y4 = y3*y;
517  float xy3 = x*y3;
518  float x2y2 = x2*y2;
519  float x3y = x3*y;
520 
521  float x5 = x4*x;
522  float y5 = y4*y;
523  float xy4 = x*y4;
524  float x2y3 = x2*y3;
525  float x3y2 = x3*y2;
526  float x4y = x4*y;
527 
528  float x6 = x5*x;
529  float y6 = y5*y;
530  float xy5 = x*y5;
531  float x2y4 = x2*y4;
532  float x3y3 = x3*y3;
533  float x4y2 = x4*y2;
534  float x5y = x5*y;
535 
536  float y7 = y6*y;
537  float xy6 = x*y6;
538  float x2y5 = x2*y5;
539  float x3y4 = x3*y4;
540  float x4y3 = x4*y3;
541  float x5y2 = x5*y2;
542  float x6y = x6*y;
543  float x7 = x5*x;
544 
545  Double_t BA[3] = {0.,0.,0.};
546  BA[0] = C[0][0] +C[0][1]*x +C[0][2]*y +C[0][3]*x2 +C[0][4]*xy +C[0][5]*y2 +C[0][6]*x3 +C[0][7]*x2y +C[0][8]*xy2 +C[0][9]*y3
547  +C[0][10]*x4 +C[0][11]*x3y +C[0][12]*x2y2 +C[0][13]*xy3 +C[0][14]*y4
548  +C[0][15]*x5 +C[0][16]*x4y +C[0][17]*x3y2 +C[0][18]*x2y3 +C[0][19]*xy4 +C[0][20]*y5
549  +C[0][21]*x6 +C[0][22]*x5y +C[0][23]*x4y2 +C[0][24]*x3y3 +C[0][25]*x2y4 +C[0][26]*xy5 +C[0][27]*y6
550  +C[0][28]*x7 +C[0][29]*x6y +C[0][30]*x5y2 +C[0][31]*x4y3 +C[0][32]*x3y4 +C[0][33]*x2y5 +C[0][34]*xy6 + C[0][35]*y7;
551 
552  BA[1] = C[1][0] +C[1][1]*x +C[1][2]*y +C[1][3]*x2 +C[1][4]*xy +C[1][5]*y2 +C[1][6]*x3 +C[1][7]*x2y +C[1][8]*xy2 +C[1][9]*y3
553  +C[1][10]*x4 +C[1][11]*x3y +C[1][12]*x2y2 +C[1][13]*xy3 +C[1][14]*y4
554  +C[1][15]*x5 +C[1][16]*x4y +C[1][17]*x3y2 +C[1][18]*x2y3 +C[1][19]*xy4 +C[1][20]*y5
555  +C[1][21]*x6 +C[1][22]*x5y +C[1][23]*x4y2 +C[1][24]*x3y3 +C[1][25]*x2y4 +C[1][26]*xy5 +C[1][27]*y6
556  +C[1][28]*x7 +C[1][29]*x6y +C[1][30]*x5y2 +C[1][31]*x4y3 +C[1][32]*x3y4 +C[1][33]*x2y5 +C[1][34]*xy6 + C[1][35]*y7;
557 
558  BA[2] = C[2][0] +C[2][1]*x +C[2][2]*y +C[2][3]*x2 +C[2][4]*xy +C[2][5]*y2 +C[2][6]*x3 +C[2][7]*x2y +C[2][8]*xy2 +C[2][9]*y3
559  +C[2][10]*x4 +C[2][11]*x3y +C[2][12]*x2y2 +C[2][13]*xy3 +C[2][14]*y4
560  +C[2][15]*x5 +C[2][16]*x4y +C[2][17]*x3y2 +C[2][18]*x2y3 +C[2][19]*xy4 +C[2][20]*y5
561  +C[2][21]*x6 +C[2][22]*x5y +C[2][23]*x4y2 +C[2][24]*x3y3 +C[2][25]*x2y4 +C[2][26]*xy5 +C[2][27]*y6
562  +C[2][28]*x7 +C[2][29]*x6y +C[2][30]*x5y2 +C[2][31]*x4y3 +C[2][32]*x3y4 +C[2][33]*x2y5 +C[2][34]*xy6 + C[2][35]*y7;
563 
564  Double_t p[3] = {x, y, ZS};
565  Double_t B[3] = {0.,0.,0.};
566  fField->GetFieldValue(p, B);
567  Double_t r = (B[0] - BA[0])*(B[0] - BA[0]) +
568  (B[1] - BA[1])*(B[1] - BA[1]) +
569  (B[2] - BA[2])*(B[2] - BA[2]);
570  r = sqrt(r);
571  N++;
572  sumR += r;
573  // if( r < 0.005 ) { cout << r << " " << x << " " << y << " " << B[0] << " " << B[1] << " " << B[2] << " " << BA[0] << " " << BA[1] << " " << BA[2] << endl; exit(0); }
574  }
575  // cout << ist << " AVR R = " << sumR/N << endl;
576 #endif
577  }
578 
579  outGeo.close();
580  } // settings
581 
582 
583 
584  } // iDet
585 
586 
587  outH.close();
588  outHL.close();
589  outMCT.close();
590  outMCP.close();
591 
592 
593  if(fVerbose>3) Info("Exec","End eventloop.");
594 }
Double_t CR[11]
int fVerbose
Definition: poormantracks.C:24
double dy
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
FairField * fField
Array of Branch Activeness.
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
c2
Definition: plot_dirc.C:39
cout<< "POINTs for new FwEndCap == "<< tsim-> GetEntriesFast()
TClonesArray * fMCPoints[4]
Array of PndMCTrack.
TVector3 GetWireDirection() const
Definition: PndFtsTube.cxx:83
Double_t p
Definition: anasim.C:58
Int_t GetLayerID() const
Definition: PndFtsHit.h:74
cout<< "blue = Monte Carlo "<< endl;cout<< "red = Helix Hit "<< endl;cout<< "green = Center Of Tubes "<< endl;for(Int_t k=0;k< track->GetEntriesFast();k++){PndSttTrack *stttrack=(PndSttTrack *) track-> At(k)
Definition: checkhelixhit.C:56
Bool_t fBranchActive[4]
Array of Branch IDs.
int Pic_FED Eff_lEE C()
TClonesArray * fMCTracks
Double_t
TClonesArray * point
Definition: anaLmdDigi.C:29
TFile * f
Definition: bump_analys.C:12
TMatrixT< Double_t > GetRotationMatrix() const
Definition: PndFtsTube.cxx:71
Double_t z
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TFile * out
Definition: reco_muo.C:20
c1
Definition: plot_dirc.C:35
TVector3 GetPosition() const
Definition: PndFtsTube.cxx:68
TClonesArray * fHits[4]
Array of event's points.
double dx
Double_t GetHalfLength() const
Definition: PndFtsTube.cxx:80
Double_t GetIsochrone() const
Definition: PndFtsHit.h:57
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
Double_t GetRadIn() const
Definition: PndFtsTube.cxx:74
Double_t x
TClonesArray * fTubeArrayFts
Double_t GetIsochroneError() const
Definition: PndFtsHit.h:58
double Z
Definition: anaLmdDigi.C:68
Double_t y
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Int_t GetMotherID() const
Definition: PndMCTrack.h:74
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
double pz[39]
Definition: pipisigmas.h:14
Int_t fBranchIDs[4]
Array of event's hits.
virtual void PndFtsDataAccessor::Finish ( )
inlinevirtual

Definition at line 37 of file PndFtsDataAccessor.h.

37 { };
InitStatus PndFtsDataAccessor::Init ( )
virtual

Definition at line 70 of file PndFtsDataAccessor.cxx.

References BB, By, fBranchIDs, fField, fFtsParameters, fHits, PndFtsMapCreator::FillTubeArray(), fMCPoints, fMCTracks, fTubeArrayFts, fVerbose, pdg, and Register().

70  {
71  // ---
72  if(fVerbose>3) Info("Init","Start initialisation.");
73 
74  FairRootManager *fManager = FairRootManager::Instance();
75 
76  // Get MC arrays
77  fMCTracks = dynamic_cast<TClonesArray *>(fManager->GetObject("MCTrack"));
78  if ( ! fMCTracks ) {
79  std::cout << "-W- PndFtsDataAccessor::Init: No MCTrack array! Needed for MC Truth" << std::endl;
80  return kERROR;
81  }
82 
83  //FTS
84  fMCPoints[0] = dynamic_cast<TClonesArray *> (fManager->GetObject("FTSPoint"));
85  if ( ! fMCPoints[0] ) {
86  std::cout << "-W- PndFtsDataAccessor::Init: No FTSPoint array!" << std::endl;
87  return kERROR;
88  }
89  fHits[0] = dynamic_cast<TClonesArray *> (fManager->GetObject("FTSHit"));
90  if ( ! fHits[0] ) {
91  std::cout << "-W- PndFtsDataAccessor::Init: No FTSHit array!" << std::endl;
92  return kERROR;
93  }
94  fBranchIDs[0] = FairRootManager::Instance()->GetBranchId("FTSHit");
95 
96 
97  //GEM
98  fMCPoints[1] = dynamic_cast<TClonesArray *> (fManager->GetObject("GEMPoint"));
99  if ( ! fMCPoints[1] ) {
100  std::cout << "-W- PndFtsDataAccessor::Init: No GEMPoint array!" << std::endl;
101  fMCPoints[1]=new TClonesArray("FairMCPoint");
102  }
103  fHits[1] = dynamic_cast<TClonesArray *> (fManager->GetObject("GEMHit"));
104  if ( ! fHits[1] ) {
105  std::cout << "-W- PndFtsDataAccessor::Init: No GEMHit array!" << std::endl;
106  fHits[1]=new TClonesArray("FairHit");
107  }
108  fBranchIDs[1] = FairRootManager::Instance()->GetBranchId("GEMHit");
109 
110  //MVD Pixel
111  fMCPoints[2] = dynamic_cast<TClonesArray *> (fManager->GetObject("MVDPoint"));
112  if ( ! fMCPoints[2] ) {
113  std::cout << "-W- PndFtsDataAccessor::Init: No MVDPoint array!" << std::endl;
114  fMCPoints[1]=new TClonesArray("FairMCPoint");
115  }
116  fHits[2] = dynamic_cast<TClonesArray *> (fManager->GetObject("MVDHitsPixel"));
117  if ( ! fHits[2] ) {
118  std::cout << "-W- PndFtsDataAccessor::Init: No MVDHitsPixel array!" << std::endl;
119  fHits[2]=new TClonesArray("FairHit");
120  }
121  fBranchIDs[2] = FairRootManager::Instance()->GetBranchId("MVDHitsPixel");
122 
123  fMCPoints[3] = fMCPoints[2];
124  fHits[3] = dynamic_cast<TClonesArray *> (fManager->GetObject("MVDHitsStrip"));
125  if ( ! fHits[3] ) {
126  std::cout << "-W- PndFtsDataAccessor::Init: No MVDHitsStrip array!" << std::endl;
127  fMCPoints[3]=new TClonesArray("FairHit");
128  }
129  fBranchIDs[3] = FairRootManager::Instance()->GetBranchId("MVDHitsStrip");
130 
131  if(fVerbose>3) Info("Init","Fetched all arrays.");
132 
133  Register();
134 
135  pdg = new TDatabasePDG();
136  if(fVerbose>3) Info("Init","End initialisation.");
137 
138 
140  fTubeArrayFts = mapperFts->FillTubeArray();
141 
142 
143 
144  if(fVerbose>3) Info("Init","Try to get B field.");
145  fField = FairRunAna::Instance()->GetField();
146 
147 
148  By = 0.;
149  po[0] = 0;
150  po[1] = 0;
151  po[2] = 0;
152  fField->GetFieldValue(po, BB); //return value in KG (G3)
153  By = BB[1] / 10.; // By is y-component of magnetic field in Tesla
154 
155  return kSUCCESS;
156 }
int fVerbose
Definition: poormantracks.C:24
PndGeoFtsPar * fFtsParameters
Particle DB.
FairField * fField
Array of Branch Activeness.
TClonesArray * fMCPoints[4]
Array of PndMCTrack.
TClonesArray * fMCTracks
TClonesArray * fHits[4]
Array of event's points.
TClonesArray * fTubeArrayFts
TClonesArray * FillTubeArray()
this function will be used in PndFtsHitProducesRealFast
Int_t fBranchIDs[4]
Array of event's hits.
PndFtsDataAccessor& PndFtsDataAccessor::operator= ( const PndFtsDataAccessor )
inlineprotected

Definition at line 76 of file PndFtsDataAccessor.h.

76 {return *this;}
void PndFtsDataAccessor::Register ( )

Definition at line 57 of file PndFtsDataAccessor.cxx.

References fVerbose.

Referenced by Init().

58 {
59  //---
60  if(fVerbose>3) Info("Register","Done.");
61 }
int fVerbose
Definition: poormantracks.C:24
void PndFtsDataAccessor::Reset ( )
inline

Definition at line 39 of file PndFtsDataAccessor.h.

39 {};
void PndFtsDataAccessor::SetFtsActivity ( Bool_t  act = kTRUE)
inline

Definition at line 46 of file PndFtsDataAccessor.h.

References fBranchActive.

46 {fBranchActive[0]=act;}
Bool_t fBranchActive[4]
Array of Branch IDs.
void PndFtsDataAccessor::SetGemActivity ( Bool_t  act = kTRUE)
inline

Definition at line 47 of file PndFtsDataAccessor.h.

References fBranchActive.

47 {fBranchActive[1]=act;}
Bool_t fBranchActive[4]
Array of Branch IDs.
void PndFtsDataAccessor::SetMvdActivity ( Bool_t  act = kTRUE)
inline

Definition at line 48 of file PndFtsDataAccessor.h.

References fBranchActive.

48 {fBranchActive[2]=act;fBranchActive[3]=act;}
Bool_t fBranchActive[4]
Array of Branch IDs.
void PndFtsDataAccessor::SetParContainers ( )

Definition at line 64 of file PndFtsDataAccessor.cxx.

References fFtsParameters, and rtdb.

64  {
65  FairRuntimeDb* rtdb = FairRunAna::Instance()->GetRuntimeDb();
66  fFtsParameters = (PndGeoFtsPar*) rtdb->getContainer("PndGeoFtsPar");
67 }
PndGeoFtsPar * fFtsParameters
Particle DB.
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void PndFtsDataAccessor::SetPersistence ( Bool_t  persistence)
inline

Definition at line 50 of file PndFtsDataAccessor.h.

References fPersistence.

50 { fPersistence = persistence; }

Member Data Documentation

Double_t PndFtsDataAccessor::BB[3]
protected

Definition at line 64 of file PndFtsDataAccessor.h.

Referenced by Init().

Double_t PndFtsDataAccessor::By
protected

Definition at line 63 of file PndFtsDataAccessor.h.

Referenced by Init().

Bool_t PndFtsDataAccessor::fBranchActive[4]
protected

Array of Branch IDs.

Definition at line 59 of file PndFtsDataAccessor.h.

Referenced by Exec(), PndFtsDataAccessor(), SetFtsActivity(), SetGemActivity(), and SetMvdActivity().

Int_t PndFtsDataAccessor::fBranchIDs[4]
protected

Array of event's hits.

Definition at line 58 of file PndFtsDataAccessor.h.

Referenced by Exec(), and Init().

FairField* PndFtsDataAccessor::fField
protected

Array of Branch Activeness.

Definition at line 62 of file PndFtsDataAccessor.h.

Referenced by Exec(), and Init().

PndGeoFtsPar* PndFtsDataAccessor::fFtsParameters
protected

Particle DB.

Definition at line 72 of file PndFtsDataAccessor.h.

Referenced by Init(), and SetParContainers().

TClonesArray* PndFtsDataAccessor::fHits[4]
protected

Array of event's points.

Definition at line 57 of file PndFtsDataAccessor.h.

Referenced by Exec(), and Init().

TClonesArray* PndFtsDataAccessor::fMCPoints[4]
protected

Array of PndMCTrack.

Definition at line 56 of file PndFtsDataAccessor.h.

Referenced by Exec(), and Init().

TClonesArray* PndFtsDataAccessor::fMCTracks
protected

Definition at line 55 of file PndFtsDataAccessor.h.

Referenced by Exec(), and Init().

Bool_t PndFtsDataAccessor::fPersistence
protected

Definition at line 67 of file PndFtsDataAccessor.h.

Referenced by SetPersistence().

TClonesArray* PndFtsDataAccessor::fTubeArrayFts
protected

Definition at line 73 of file PndFtsDataAccessor.h.

Referenced by Exec(), and Init().

TDatabasePDG* PndFtsDataAccessor::pdg
protected

Definition at line 70 of file PndFtsDataAccessor.h.

Referenced by Init().

Double_t PndFtsDataAccessor::po[3]
protected

Definition at line 64 of file PndFtsDataAccessor.h.


The documentation for this class was generated from the following files: