Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DPSGeometry.cc
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include <iostream>
3 #include <map>
4 
5 #include <JANA/JApplication.h>
6 #include <JANA/JEvent.h>
7 #include "DPSGeometry.h"
8 
9 //---------------------------------
10 // DPSGeometry (Constructor)
11 //---------------------------------
12 DPSGeometry::DPSGeometry(JEventLoop *loop)
13 {
14  // read PS hodoscope counter energy bounds from calibdb
15  std::vector<std::map<string,double> > result;
16  loop->GetCalib("/PHOTON_BEAM/pair_spectrometer/fine/energy_range", result);
17  if ((int)result.size() != NUM_FINE_COLUMNS) {
18  jerr << "Error in DPSGeometry constructor: "
19  << "failed to read fine PS energy_range table "
20  << "from calibdb at /PHOTON_BEAM/pair_spectrometer/fine/energy_range" << std::endl;
21  for (int arm=0; arm < NUM_ARMS; ++arm) {
22  for (int i=0; i < NUM_FINE_COLUMNS; ++i) {
23  m_energy_low[arm][i] = 0;
24  m_energy_high[arm][i] = 0;
25  }
26  }
27  }
28  else {
29  for (unsigned int i=0; i < result.size(); ++i) {
30  m_energy_low[0][i] = (result[i])["Elow_north"];
31  m_energy_high[0][i] = (result[i])["Ehigh_north"];
32  m_energy_low[1][i] = (result[i])["Elow_south"];
33  m_energy_high[1][i] = (result[i])["Ehigh_south"];
34  }
35  }
36 }
37 
39 
40 double DPSGeometry::getElow(int arm,int column) const
41 {
42  if (arm >=0 && arm <=1 && column > 0 && column <= NUM_FINE_COLUMNS)
43  return m_energy_low[arm][column-1];
44  else
45  return 0;
46 }
47 
48 double DPSGeometry::getEhigh(int arm,int column) const
49 {
50  if (arm >=0 && arm <=1 && column > 0 && column <= NUM_FINE_COLUMNS)
51  return m_energy_high[arm][column-1];
52  else
53  return 0;
54 }
static const int NUM_ARMS
Definition: DPSGeometry.h:22
double m_energy_low[NUM_ARMS][NUM_FINE_COLUMNS]
Definition: DPSGeometry.h:33
double getEhigh(int arm, int column) const
Definition: DPSGeometry.cc:48
DPSGeometry(JEventLoop *loop)
Definition: DPSGeometry.cc:12
static const int NUM_FINE_COLUMNS
Definition: DPSGeometry.h:26
double getElow(int arm, int column) const
Definition: DPSGeometry.cc:40
double m_energy_high[NUM_ARMS][NUM_FINE_COLUMNS]
Definition: DPSGeometry.h:34