Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
VDColdboxChannelRanges Class Reference

#include <VDColdboxChannelRanges.h>

Inheritance diagram for VDColdboxChannelRanges:
IndexRangeTool

Public Types

using Index = IndexRange::Index
 
using IndexVector = std::vector< Index >
 
- Public Types inherited from IndexRangeTool
using Name = IndexRange::Name
 

Public Member Functions

 VDColdboxChannelRanges (fhicl::ParameterSet const &ps)
 
 ~VDColdboxChannelRanges () override=default
 
IndexRange get (std::string range_name) const override
 
- Public Member Functions inherited from IndexRangeTool
virtual ~IndexRangeTool ()=default
 

Private Types

using RangeMap = std::map< Name, IndexRange >
 

Private Member Functions

void insert (Name sran, Index ich1, Index ich2, Name slab1)
 
void assignFembRanges ()
 

Private Attributes

int m_LogLevel
 
IndexVector m_GhostRange
 
Index m_glo
 
Index m_ghi
 
RangeMap m_rans
 

Detailed Description

Definition at line 22 of file VDColdboxChannelRanges.h.

Member Typedef Documentation

Definition at line 26 of file VDColdboxChannelRanges.h.

Definition at line 27 of file VDColdboxChannelRanges.h.

using VDColdboxChannelRanges::RangeMap = std::map<Name, IndexRange>
private

Definition at line 48 of file VDColdboxChannelRanges.h.

Constructor & Destructor Documentation

VDColdboxChannelRanges::VDColdboxChannelRanges ( fhicl::ParameterSet const &  ps)

Definition at line 11 of file VDColdboxChannelRanges_tool.cc.

12 : m_LogLevel(ps.get<int>("LogLevel")),
13  m_GhostRange(ps.get<IndexVector>("GhostRange")),
14  m_glo(0), m_ghi(0) {
15  const string myname = "VDColdboxChannelRanges::ctor: ";
16  const Index nu = 384;
17  const Index ny = 640;
18  const Index ntot = 3200;
19  const Index nhaf = ntot/2;
20  Index nfmb = 13;
21  const IndexVector fuEdges = {1600, 1632, 1664, 1700, 1738, 1778, 1817, 1856, 1896, 1936, 1975, 1984, 1984, 1984};
22  const IndexVector fyEdges = {1984, 2064, 2144, 2236, 2304, 0, 0, 0, 0, 0, 2624, 2560, 2432, 2304};
23  const IndexVector fzEdges = {2624, 2624, 2624, 2624, 2646, 2734, 2823, 2912, 3000, 3088, 3177, 3200, 3200, 3200};
24  if ( m_GhostRange.size() == 2 && m_GhostRange[1] >= m_GhostRange[0] ) {
25  m_glo = m_GhostRange[0];
26  m_ghi = m_GhostRange[1] + 1;
27  } else if ( m_GhostRange.size() ) {
28  cout << myname << "WARNING: " << "Ignoring invalid ghost range." << endl;
29  }
30  if ( m_LogLevel >= 1 ) {
31  cout << myname << " LogLevel: " << m_LogLevel << endl;
32  cout << myname << " Ghost range: [";
33  if ( m_ghi > m_glo ) cout << m_glo << ", " << m_ghi-1;
34  cout << "]" << endl;
35  }
36  // Build entries for detector, haves and planes.
37  insert("cru", 0, ntot, "CRU");
38  insert("crt", 0, nhaf, "CRT");
39  insert("crb", 1600, ntot, "CRB");
40  insert("crtu", 0, nu, "CRTu");
41  insert("crty", nu, nu+ny, "CRTy");
42  insert("crtz", nu+ny, nhaf, "CRTz");
43  insert("crbu", nhaf, nhaf+nu, "CRBu");
44  insert("crby", nhaf+nu, nhaf+nu+ny, "CRBy");
45  insert("crbz", nhaf+nu+ny, ntot, "CRBz");
46  insert("crbg", m_glo, m_ghi, "CRBghost");
47  // Build the FEMB-view entries.
48  for ( Index kfmb=0; kfmb<nfmb; ++kfmb ) {
49  Index ifmb = kfmb + 1;
50  Name sfmb = std::to_string(ifmb);
51  if ( sfmb.size() < 2 ) sfmb = "0" + sfmb;
52  Index ich1 = fuEdges[kfmb];
53  Index ich2 = fuEdges[kfmb+1];
54  if ( ich1 && ich2 && ich1 != ich2 ) {
55  if ( ich1 > ich2 ) std::swap(ich1, ich2);
56  insert("femb" + sfmb + "u", ich1, ich2, "FEMB " + sfmb + "U");
57  }
58  ich1 = fyEdges[kfmb];
59  ich2 = fyEdges[kfmb+1];
60  if ( ich1 && ich2 && ich1 != ich2 ) {
61  if ( ich1 > ich2 ) std::swap(ich1, ich2);
62  insert("femb" + sfmb + "y", ich1, ich2, "FEMB " + sfmb + "Y");
63  }
64  ich1 = fzEdges[kfmb];
65  ich2 = fzEdges[kfmb+1];
66  if ( ich1 && ich2 && ich1 != ich2 ) {
67  if ( ich1 > ich2 ) std::swap(ich1, ich2);
68  insert("femb" + sfmb + "z", ich1, ich2, "FEMB " + sfmb + "Z");
69  }
70  }
71 }
std::vector< Index > IndexVector
ChannelGroupService::Name Name
unsigned int Index
void swap(Handle< T > &a, Handle< T > &b)
static constexpr double ps
Definition: Units.h:99
void insert(Name sran, Index ich1, Index ich2, Name slab1)
int ntot
Definition: train_cnn.py:133
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
QTextStream & endl(QTextStream &s)
VDColdboxChannelRanges::~VDColdboxChannelRanges ( )
overridedefault

Member Function Documentation

void VDColdboxChannelRanges::assignFembRanges ( )
private
IndexRange VDColdboxChannelRanges::get ( std::string  range_name) const
overridevirtual

Implements IndexRangeTool.

Definition at line 74 of file VDColdboxChannelRanges_tool.cc.

74  {
75  const string myname = "VDColdboxChannelRanges::get: ";
76  RangeMap::const_iterator iran = m_rans.find(sran);
77  if ( iran != m_rans.end() ) return iran->second;
78  if ( m_LogLevel >= 2 ) {
79  cout << myname << "Invalid channel range name: " << sran << endl;
80  }
81  return IndexRange(0, 0);
82 }
intermediate_table::const_iterator const_iterator
if(!yymsg) yymsg
QTextStream & endl(QTextStream &s)
void VDColdboxChannelRanges::insert ( Name  sran,
Index  ich1,
Index  ich2,
Name  slab1 
)
private

Definition at line 84 of file VDColdboxChannelRanges_tool.cc.

84  {
85  m_rans[sran] = IndexRange(sran, ich1, ich2, slab1);
86 }

Member Data Documentation

Index VDColdboxChannelRanges::m_ghi
private

Definition at line 46 of file VDColdboxChannelRanges.h.

IndexVector VDColdboxChannelRanges::m_GhostRange
private

Definition at line 42 of file VDColdboxChannelRanges.h.

Index VDColdboxChannelRanges::m_glo
private

Definition at line 45 of file VDColdboxChannelRanges.h.

int VDColdboxChannelRanges::m_LogLevel
private

Definition at line 41 of file VDColdboxChannelRanges.h.

RangeMap VDColdboxChannelRanges::m_rans
private

Definition at line 49 of file VDColdboxChannelRanges.h.


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