EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MediaBank.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MediaBank.h
1 //
2 // AYK (ayk@bnl.gov), shaped up in Nov'2015;
3 //
4 // Media distribution along Kalman filter node arrangement line;
5 //
6 
7 #include <vector>
8 
9 #ifndef _MEDIA_BANK_
10 #define _MEDIA_BANK_
11 
12 #include <ayk.h>
13 #include <3d.h>
14 
15 #include <MediaLayer.h>
16 
17 class MediaBank {
18  public:
19  // Shape up old request_media_scan() function up as a constructor;
20  MediaBank(/*const t_3d_line &scanLine,*/ const t_3d_line &axisLine, double maxLength):
21  mScanLine(axisLine), mAxisLine(axisLine), mMaxLength(maxLength), mOutOfRangeFlag(false),
22  mSlopeCff(1.0) {};
23 
24  void SetScanLine(const t_3d_line &scanLine) {
25  mScanLine = scanLine;
26 
27  mSlopeCff = scanLine.nx.Dot(mAxisLine.nx);
28  // This would not make any sense;
29  if (mSlopeCff <= 0.0) throw;
30  };
31 
32  // Print out media bank contents;
33  void Print();
34 
35  int StartNextLayer(TGeoMaterial *material, TVector3 pt);
38  if (!layer) return;
39 
40  // Correct thickness for relative slope of scan axis;
41  layer->SetThickness(thickness * mSlopeCff);
42 
43  // Check out-of-range condition;
44  if (GetMaxLength() && layer->GetZ0() + thickness > GetMaxLength())
45  mOutOfRangeFlag = true;
46  };
47 
48  unsigned GetMediaLayerCount() const { return mMediaLayers.size(); };
49  const MediaLayer *GetMediaLayer(unsigned iq) const {
50  return (iq < mMediaLayers.size() ? &mMediaLayers[iq] : 0);
51  };
53  return (mMediaLayers.size() ? &mMediaLayers[GetMediaLayerCount()-1] : 0);
54  };
55  double GetMaxLength() const { return mMaxLength; };
56 
57  bool IsOutOfRange() const { return mOutOfRangeFlag; };
58 
59  const t_3d_line &GetScanLine() const { return mScanLine; };
60 
61  private:
62  // If non-zero, material will be recorded along "axis" line, but
63  // not further from axis.x[] than this value;
64  double mMaxLength;
65 
67 
68  // mAxisLine.nx[] is a vector along which material thickness should be
69  // estimated; in a certain sense it is along node ordering direction;
70  // mAxisLine.x[] determines start of coordinate system; is the line
71  // along which ROOT TGeoManager will perform the actual material scan;
73  double mSlopeCff;
74 
75  std::vector<MediaLayer> mMediaLayers;
76 };
77 
78 #endif
79