15 template <
typename T,
typename R>
32 template <
typename T,
typename R>
35 printdebug_(
p.getUntrackedParameter<
bool>(
"printDebug",
true)),
36 formatedOutput_(
p.getUntrackedParameter<
std::
string>(
"outputFile",
"")) {
37 edm::LogInfo(
"AlignPCLThresholdsReader") <<
"AlignPCLThresholdsReader" << std::endl;
40 template <
typename T,
typename R>
42 edm::LogInfo(
"AlignPCLThresholdsReader") <<
"~AlignPCLThresholdsReader " << std::endl;
45 template <
typename T,
typename R>
47 edm::LogInfo(
"AlignPCLThresholdsReader") <<
"### AlignPCLThresholdsReader::analyze ###" << std::endl;
48 edm::LogInfo(
"AlignPCLThresholdsReader") <<
" I AM IN RUN NUMBER " <<
e.id().run() << std::endl;
49 edm::LogInfo(
"AlignPCLThresholdsReader") <<
" ---EVENT NUMBER " <<
e.id().event() << std::endl;
58 <<
"Record \"" << inputKey.
type().
name() <<
"\" does not exist " << std::endl;
63 edm::LogInfo(
"AlignPCLThresholdsReader") <<
"got eshandle" << std::endl;
65 if (!thresholdHandle.
isValid()) {
66 edm::LogError(
"AlignPCLThresholdsReader") <<
" Could not get Handle" << std::endl;
71 edm::LogInfo(
"AlignPCLThresholdsReader") <<
"got AlignPCLThresholds* " << std::endl;
72 edm::LogInfo(
"AlignPCLThresholdsReader") <<
"print pointer address : ";
76 edm::LogInfo(
"AlignPCLThresholdsReader") <<
"Content of myThresholds " << std::endl;
82 FILE* pFile =
nullptr;
83 if (!formatedOutput_.empty())
84 pFile = fopen(formatedOutput_.c_str(),
"w");
86 fprintf(pFile,
"AlignPCLThresholds::printAll() \n");
88 " =======================================================================================================" 90 fprintf(pFile,
"N records cut: %i \n",
thresholds->getNrecords());
95 if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
99 for (
auto it = m_thresholds.begin(); it != m_thresholds.end(); ++it) {
100 bool hasFractionCut = (m_floatMap.find(it->first) != m_floatMap.end());
103 " =====================================================================================================" 105 fprintf(pFile,
"key : %s \n", (it->first).c_str());
106 fprintf(pFile,
"- Xcut : %8.3f um ", (it->second).getXcut());
107 fprintf(pFile,
"| sigXcut : %8.3f ", (it->second).getSigXcut());
108 fprintf(pFile,
"| maxMoveXcut : %8.3f um ", (it->second).getMaxMoveXcut());
109 fprintf(pFile,
"| ErrorXcut : %8.3f um ", (it->second).getErrorXcut());
110 if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
111 if (hasFractionCut) {
113 "| X_fractionCut : %8.3f \n",
116 fprintf(pFile,
"\n");
119 fprintf(pFile,
"\n");
122 fprintf(pFile,
"- thetaXcut : %8.3f urad ", (it->second).getThetaXcut());
123 fprintf(pFile,
"| sigThetaXcut : %8.3f ", (it->second).getSigThetaXcut());
124 fprintf(pFile,
"| maxMoveThetaXcut : %8.3f urad ", (it->second).getMaxMoveThetaXcut());
125 fprintf(pFile,
"| ErrorThetaXcut : %8.3f urad ", (it->second).getErrorThetaXcut());
126 if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
127 if (hasFractionCut) {
129 "| thetaX_fractionCut : %8.3f \n",
130 thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_X));
132 fprintf(pFile,
"\n");
135 fprintf(pFile,
"\n");
138 fprintf(pFile,
"- Ycut : %8.3f um ", (it->second).getYcut());
139 fprintf(pFile,
"| sigYcut : %8.3f ", (it->second).getSigXcut());
140 fprintf(pFile,
"| maxMoveYcut : %8.3f um ", (it->second).getMaxMoveYcut());
141 fprintf(pFile,
"| ErrorYcut : %8.3f um ", (it->second).getErrorYcut());
142 if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
143 if (hasFractionCut) {
145 "| Y_fractionCut : %8.3f \n",
148 fprintf(pFile,
"\n");
151 fprintf(pFile,
"\n");
154 fprintf(pFile,
"- thetaYcut : %8.3f urad ", (it->second).getThetaYcut());
155 fprintf(pFile,
"| sigThetaYcut : %8.3f ", (it->second).getSigThetaYcut());
156 fprintf(pFile,
"| maxMoveThetaYcut : %8.3f urad ", (it->second).getMaxMoveThetaYcut());
157 fprintf(pFile,
"| ErrorThetaYcut : %8.3f urad ", (it->second).getErrorThetaYcut());
158 if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
159 if (hasFractionCut) {
161 "| thetaY_fractionCut : %8.3f \n",
162 thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Y));
164 fprintf(pFile,
"\n");
167 fprintf(pFile,
"\n");
170 fprintf(pFile,
"- Zcut : %8.3f um ", (it->second).getZcut());
171 fprintf(pFile,
"| sigZcut : %8.3f ", (it->second).getSigZcut());
172 fprintf(pFile,
"| maxMoveZcut : %8.3f um ", (it->second).getMaxMoveZcut());
173 fprintf(pFile,
"| ErrorZcut : %8.3f um ", (it->second).getErrorZcut());
174 if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
175 if (hasFractionCut) {
177 "| Z_fractionCut : %8.3f \n",
180 fprintf(pFile,
"\n");
183 fprintf(pFile,
"\n");
186 fprintf(pFile,
"- thetaZcut : %8.3f urad ", (it->second).getThetaZcut());
187 fprintf(pFile,
"| sigThetaZcut : %8.3f ", (it->second).getSigThetaZcut());
188 fprintf(pFile,
"| maxMoveThetaZcut : %8.3f urad ", (it->second).getMaxMoveThetaZcut());
189 fprintf(pFile,
"| ErrorThetaZcut : %8.3f urad ", (it->second).getErrorThetaZcut());
190 if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
191 if (hasFractionCut) {
193 "| thetaZ_fractionCut : %8.3f \n",
194 thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Z));
196 fprintf(pFile,
"\n");
199 fprintf(pFile,
"\n");
202 if ((it->second).hasExtraDOF()) {
203 for (
unsigned int j = 0;
j < (it->second).extraDOFSize();
j++) {
204 std::array<float, 4> extraDOFCuts =
thresholds->getExtraDOFCutsForAlignable(it->first,
j);
206 "Extra DOF: %i with label %s \n ",
208 thresholds->getExtraDOFLabelForAlignable(it->first,
j).c_str());
209 fprintf(pFile,
"- cut : %8.3f ", extraDOFCuts.at(0));
210 fprintf(pFile,
"| sigCut : %8.3f ", extraDOFCuts.at(1));
211 fprintf(pFile,
"| maxMoveCut : %8.3f ", extraDOFCuts.at(2));
212 fprintf(pFile,
"| maxErrorCut : %8.3f \n ", extraDOFCuts.at(3));
219 template <
typename T,
typename R>
222 desc.setComment(
"Reads payloads of type AlignPCLThresholds");
223 desc.addUntracked<
bool>(
"printDebug",
true);
const TypeTag & type() const
~AlignPCLThresholdsReader() override
const std::string formatedOutput_
std::unordered_map< std::string, std::vector< float > > param_map
std::map< std::string, AlignPCLThreshold > threshold_map
const edm::ESGetToken< T, R > thresholdToken_
#define DEFINE_FWK_MODULE(type)
AlignPCLThresholdsReader(edm::ParameterSet const &p)
std::string defaultModuleLabel()
Log< level::Error, false > LogError
char const * name() const
T const * product() const
AlignPCLThresholdsReader< AlignPCLThresholdsHG, AlignPCLThresholdsHGRcd > AlignPCLThresholdsHGReader
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Info, false > LogInfo
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
AlignPCLThresholdsReader< AlignPCLThresholds, AlignPCLThresholdsRcd > AlignPCLThresholdsLGReader
heterocontainer::HCTypeTag TypeTag
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag