5 #include <JANA/JApplication.h>
6 #include <JANA/JEvent.h>
18 std::vector<std::map<string,double> > result;
20 loop->GetCalib(
"/PHOTON_BEAM/lumi/PS_accept", result);
23 jerr <<
"Error in DLumi constructor: "
24 <<
"failed to read constants for PS/PSC acceptances "
25 <<
"from calibdb at /PHOTON_BEAM/lumi/PS_accept" << std::endl;
40 loop->GetCalib(
"/PHOTON_BEAM/lumi/tagm_tagged", result);
42 if ((
int)result.size() !=
TAGM_CH) {
43 jerr <<
"Error in DLumi constructor: "
44 <<
"failed to read constants number of TAGM hits "
45 <<
"from calibdb at /PHOTON_BEAM/lumi/tagm_tagged" << std::endl;
46 for(
int ii = 0; ii <
TAGM_CH; ii++)
53 for (
int ii = 0; ii < static_cast<int>(result.size()); ii++) {
54 int cnt = (result[ii])[
"id"];
56 if( ((ii + 1) == cnt) && (cnt > 0) && (cnt <=
TAGM_CH))
60 jerr <<
"Error in DLumi constructor: "
61 <<
"Invalid counter in the /PHOTON_BEAM/lumi/tagm_tagged table "
71 loop->GetCalib(
"/PHOTON_BEAM/lumi/tagh_tagged", result);
73 if ((
int)result.size() !=
TAGH_CH) {
74 jerr <<
"Error in DLumi constructor: "
75 <<
"failed to read constants number of TAGH hits "
76 <<
"from calibdb at /PHOTON_BEAM/lumi/tagh_tagged" << std::endl;
77 for(
int ii = 0; ii <
TAGH_CH; ii++)
84 for (
int ii = 0; ii < static_cast<int>(result.size()); ii++) {
85 int cnt = (result[ii])[
"id"];
87 if( ((ii + 1) == cnt) && (cnt > 0) && (cnt <=
TAGH_CH))
90 jerr <<
"Error in DLumi constructor: "
91 <<
"Invalid counter in the /PHOTON_BEAM/lumi/tagh_tagged table "
102 jerr <<
"Error in DLumi constructor: "
103 <<
"Cannot get TAGH geometry "
111 jerr <<
"Error in DLumi constructor: "
112 <<
"Cannot get TAGM geometry "
117 std::map<string,double> result1;
118 loop->GetCalib(
"/PHOTON_BEAM/endpoint_energy", result1);
119 if (result1.find(
"PHOTON_BEAM_ENDPOINT_ENERGY") == result1.end()) {
120 std::cerr <<
"Error in DLumi constructor: "
121 <<
"failed to read photon beam endpoint energy "
122 <<
"from calibdb at /PHOTON_BEAM/endpoint_energy" << std::endl;
126 Ebeam = result1[
"PHOTON_BEAM_ENDPOINT_ENERGY"];
133 jerr <<
"Error in DLumi constructor: "
134 <<
"Cannot compute Luminosity "
149 double Epeak = Emin + Emax;
155 for(
int ii = 0; ii <
TAGM_CH; ii++){
160 double tagm_en = (tagm_emin + tagm_emax)/2.;
164 if( (tagm_en > 2*Emin) && (tagm_en < Epeak)){
166 accept = 1. - 2.*Emin / tagm_en;
168 if(accept < 0.) accept = 0.;
170 }
else if( (tagm_en >= Epeak) && (tagm_en <
Ebeam)){
172 accept = 2.*Emax / tagm_en - 1.;
174 if(accept < 0.) accept = 0.;
184 for(
int ii = 0; ii <
TAGH_CH; ii++){
189 double tagh_en = (tagh_emin + tagh_emax) / 2.;
193 if( (tagh_en > 2*Emin) && (tagh_en < Epeak)){
195 accept = 1. - 2.*Emin / tagh_en;
197 }
else if( (tagh_en >= Epeak) && (tagh_en <
Ebeam)){
199 accept = 2.*Emax / tagh_en - 1.;
201 if(accept < 0.) accept = 0.;
215 std::cout << std::endl;
216 std::cout <<
" Lumi for TAGM counters (nb) " << std::endl;
217 std::cout << std::endl;
219 for(
int ii = 0; ii <
TAGM_CH; ii++)
220 std::cout <<
" CH = " << ii + 1 <<
" Lumi = " <<
tagm_lumi[ii] << std::endl;
223 std::cout << std::endl;
224 std::cout <<
" Lumi for TAGH counters (nb) " << std::endl;
225 std::cout << std::endl;
227 for(
int ii = 0; ii <
TAGH_CH; ii++)
228 std::cout <<
" CH = " << ii + 1 <<
" Lumi = " <<
tagh_lumi[ii] << std::endl;
double tagh_lumi[TAGH_CH]
vector< const DTAGHGeometry * > taghGeomVect
double tagh_tagged[TAGH_CH]
vector< const DTAGMGeometry * > tagmGeomVect
double tagm_lumi[TAGM_CH]
double tagm_tagged[TAGM_CH]
static const int DETECTORS