Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DTAGMGeometry.cc
Go to the documentation of this file.
1 //
2 // File: DTAGMGeometry.cc
3 // Created: Sat Jul 5 10:18:56 EST 2014
4 // Creator: jonesrt on gluey.phys.uconn.edu
5 //
6 
7 #include <stdlib.h>
8 #include <iostream>
9 #include <map>
10 
11 #include <JANA/JApplication.h>
12 #include <JANA/JEvent.h>
13 #include "DTAGMGeometry.h"
14 
15 const unsigned int DTAGMGeometry::kRowCount = 5;
16 const unsigned int DTAGMGeometry::kColumnCount = 102;
17 const double DTAGMGeometry::kFiberWidth = 0.2; // cm
18 const double DTAGMGeometry::kFiberLength = 2.0; // cm
19 
20 
21 //---------------------------------
22 // DTAGMGeometry (Constructor)
23 //---------------------------------
25 {
26  /* read tagger set endpoint energy from calibdb */
27  std::map<string,double> result1;
28  loop->GetCalib("/PHOTON_BEAM/endpoint_energy", result1);
29  if (result1.find("PHOTON_BEAM_ENDPOINT_ENERGY") == result1.end()) {
30  std::cerr << "Error in DTAGMGeometry constructor: "
31  << "failed to read photon beam endpoint energy "
32  << "from calibdb at /PHOTON_BEAM/endpoint_energy" << std::endl;
34  }
35  else {
36  m_endpoint_energy_GeV = result1["PHOTON_BEAM_ENDPOINT_ENERGY"];
37  }
38 
39  /* read microscope channel energy bounds from calibdb */
40  std::vector<std::map<string,double> > result2;
41  loop->GetCalib("/PHOTON_BEAM/microscope/scaled_energy_range", result2);
42  if (result2.size() != kColumnCount) {
43  std::cerr << "Error in DTAGMGeometry constructor: "
44  << "failed to read photon beam scaled_energy_range table "
45  << "from calibdb at /PHOTON_BEAM/microscope/scaled_energy_range" << std::endl;
46  for (unsigned int i=0; i <= TAGM_MAX_COLUMN; ++i) {
47  m_column_xlow[i] = 0;
48  m_column_xhigh[i] = 0;
49  }
50  }
51  else {
52  for (unsigned int i=0; i < result2.size(); ++i) {
53  int column = (result2[i])["column"];
54  m_column_xlow[column] = (result2[i])["xlow"];
55  m_column_xhigh[column] = (result2[i])["xhigh"];
56  }
57  }
58 }
59 
61 
62 bool DTAGMGeometry::E_to_column(double E, unsigned int &column) const
63 {
64  double x = E/m_endpoint_energy_GeV;
65  for (column=1; column <= kColumnCount; ++column) {
66  if ( x >= m_column_xlow[column] &&
67  x <= m_column_xhigh[column] )
68  {
69  return true;
70  }
71  }
72  return false;
73 }
74 
75 double DTAGMGeometry::getElow(unsigned int column)
76 const
77 {
78  if (column > 0 && column <= kColumnCount)
80  else
81  return 0;
82 }
83 
84 double DTAGMGeometry::getEhigh(unsigned int column)
85 const
86 {
87  if (column > 0 && column <= kColumnCount)
89  else
90  return 0;
91 }
static const double kFiberLength
Definition: DTAGMGeometry.h:33
#define TAGM_MAX_COLUMN
Definition: DTAGMGeometry.h:19
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
static const double kFiberWidth
Definition: DTAGMGeometry.h:32
double getEhigh(unsigned int column) const
static const unsigned int kRowCount
Definition: DTAGMGeometry.h:30
double m_column_xhigh[TAGM_MAX_COLUMN+1]
Definition: DTAGMGeometry.h:50
bool E_to_column(double E, unsigned int &column) const
DTAGMGeometry(JEventLoop *loop)
double getElow(unsigned int column) const
double m_column_xlow[TAGM_MAX_COLUMN+1]
Definition: DTAGMGeometry.h:49
static const unsigned int kColumnCount
Definition: DTAGMGeometry.h:31
double m_endpoint_energy_GeV
Definition: DTAGMGeometry.h:48