00001 #ifndef PSCALIB_CALIBPARSSTORE_H
00002 #define PSCALIB_CALIBPARSSTORE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <iostream>
00015 #include <string>
00016 #include <vector>
00017
00018
00019
00020
00021
00022
00023 #include "ndarray/ndarray.h"
00024 #include "pdsdata/xtc/Src.hh"
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "ImgAlgos/GlobalMethods.h"
00027 #include "PSCalib/CalibPars.h"
00028
00029
00030
00031
00032
00033
00034
00035 #include "PSCalib/GenericCalibPars.h"
00036
00037 #include "pdscalibdata/CsPadBaseV2.h"
00038 #include "pdscalibdata/CsPad2x2BaseV2.h"
00039 #include "pdscalibdata/PnccdBaseV1.h"
00040 #include "pdscalibdata/PrincetonBaseV1.h"
00041 #include "pdscalibdata/AndorBaseV1.h"
00042 #include "pdscalibdata/Andor3dBaseV1.h"
00043 #include "pdscalibdata/Epix100aBaseV1.h"
00044 #include "pdscalibdata/VarShapeCameraBaseV1.h"
00045
00046
00047
00048
00049
00050
00051 namespace PSCalib {
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 class CalibParsStore {
00113 public:
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 static PSCalib::CalibPars*
00129 Create ( const std::string& calibdir,
00130 const std::string& group,
00131 const std::string& str_src,
00132 const unsigned long& runnum,
00133 unsigned print_bits=255 )
00134 {
00135 unsigned prbits = (print_bits & 8) ? 255 : 0;
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 if ( str_src.find(":Cspad.") != std::string::npos ) {
00170 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for Cspad source: " << str_src);
00171 std::string type_group = (group==std::string()) ? "CsPad::CalibV1" : group;
00172 return new PSCalib::GenericCalibPars<pdscalibdata::CsPadBaseV2>(calibdir, type_group, str_src, runnum, prbits);
00173 }
00174
00175 if ( str_src.find(":Cspad2x2.") != std::string::npos ) {
00176 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for Cspad2x2 source: " << str_src);
00177 std::string type_group = (group==std::string()) ? "CsPad2x2::CalibV1" : group;
00178 return new PSCalib::GenericCalibPars<pdscalibdata::CsPad2x2BaseV2>(calibdir, type_group, str_src, runnum, prbits);
00179 }
00180
00181 if ( str_src.find(":pnCCD.") != std::string::npos ) {
00182 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for pnCCD source: " << str_src);
00183 std::string type_group = (group==std::string()) ? "PNCCD::CalibV1" : group;
00184 return new PSCalib::GenericCalibPars<pdscalibdata::PnccdBaseV1>(calibdir, type_group, str_src, runnum, prbits);
00185 }
00186
00187 if ( str_src.find(":Princeton.") != std::string::npos ) {
00188 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for Princeton source: " << str_src);
00189 std::string type_group = (group==std::string()) ? "Princeton::CalibV1" : group;
00190 return new PSCalib::GenericCalibPars<pdscalibdata::PrincetonBaseV1>(calibdir, type_group, str_src, runnum, prbits);
00191 }
00192
00193 if ( str_src.find(":DualAndor.") != std::string::npos ) {
00194 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for Andor source: " << str_src);
00195 std::string type_group = (group==std::string()) ? "Andor3d::CalibV1" : group;
00196 return new PSCalib::GenericCalibPars<pdscalibdata::Andor3dBaseV1>(calibdir, type_group, str_src, runnum, prbits);
00197 }
00198
00199 if ( str_src.find(":Andor.") != std::string::npos ) {
00200 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for Andor source: " << str_src);
00201 std::string type_group = (group==std::string()) ? "Andor::CalibV1" : group;
00202 return new PSCalib::GenericCalibPars<pdscalibdata::AndorBaseV1>(calibdir, type_group, str_src, runnum, prbits);
00203 }
00204
00205 if ( str_src.find(":Epix100a.") != std::string::npos ) {
00206 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for Epix100a source: " << str_src);
00207 std::string type_group = (group==std::string()) ? "Epix100a::CalibV1" : group;
00208 return new PSCalib::GenericCalibPars<pdscalibdata::Epix100aBaseV1>(calibdir, type_group, str_src, runnum, prbits);
00209 }
00210
00211 std::vector<std::string> v_camera_names;
00212 v_camera_names.push_back(":Opal1000.");
00213 v_camera_names.push_back(":Opal2000.");
00214 v_camera_names.push_back(":Opal4000.");
00215 v_camera_names.push_back(":Opal8000.");
00216 v_camera_names.push_back(":Tm6740.");
00217 v_camera_names.push_back(":OrcaFl40.");
00218 v_camera_names.push_back(":Fccd960.");
00219 v_camera_names.push_back(":Rayonix.");
00220
00221 prbits = (print_bits & 8) ? 255 : 0;
00222
00223 for (std::vector<std::string>::iterator it = v_camera_names.begin(); it != v_camera_names.end(); ++it) {
00224 if ( str_src.find(*it) != std::string::npos ) {
00225 std::string type_group = (group==std::string()) ? "Camera::CalibV1" : group;
00226 if (print_bits & 1) MsgLog("CalibParsStore", info, "Get access to calibration store for det " << *it
00227 << " source: " << str_src << " group: " << type_group);
00228 return new PSCalib::GenericCalibPars<pdscalibdata::VarShapeCameraBaseV1>(calibdir, type_group, str_src, runnum, prbits);
00229
00230 }
00231 }
00232
00233 std::string msg = "Calibration parameters for source: " + str_src + " are not implemented yet...";
00234 MsgLog("CalibParsStore", error, msg);
00235
00236 abort();
00237
00238
00239 }
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252 static PSCalib::CalibPars*
00253 Create ( const std::string& calibdir,
00254 const std::string& group,
00255 const Pds::Src& src,
00256 const unsigned long& runnum,
00257 unsigned print_bits=255 )
00258 {
00259 return Create(calibdir, group, ImgAlgos::srcToString(src), runnum, print_bits);
00260 }
00261
00262 };
00263
00264 }
00265
00266 #endif // PSCALIB_CALIBPARSSTORE_H