CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edmtest::AlignPCLThresholdsReader< T, R > Class Template Reference
Inheritance diagram for edmtest::AlignPCLThresholdsReader< T, R >:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 AlignPCLThresholdsReader (edm::ParameterSet const &p)
 
 ~AlignPCLThresholdsReader () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 

Private Attributes

const std::string formatedOutput_
 
const bool printdebug_
 
const edm::ESGetToken< T, R > thresholdToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<typename T, typename R>
class edmtest::AlignPCLThresholdsReader< T, R >

Definition at line 16 of file AlignPCLThresholdsReader.cc.

Constructor & Destructor Documentation

◆ AlignPCLThresholdsReader()

template<typename T , typename R >
edmtest::AlignPCLThresholdsReader< T, R >::AlignPCLThresholdsReader ( edm::ParameterSet const &  p)
explicit

Definition at line 33 of file AlignPCLThresholdsReader.cc.

35  printdebug_(p.getUntrackedParameter<bool>("printDebug", true)),
36  formatedOutput_(p.getUntrackedParameter<std::string>("outputFile", "")) {
37  edm::LogInfo("AlignPCLThresholdsReader") << "AlignPCLThresholdsReader" << std::endl;
38  }
const edm::ESGetToken< T, R > thresholdToken_
Log< level::Info, false > LogInfo

◆ ~AlignPCLThresholdsReader()

template<typename T , typename R >
edmtest::AlignPCLThresholdsReader< T, R >::~AlignPCLThresholdsReader ( )
override

Definition at line 41 of file AlignPCLThresholdsReader.cc.

41  {
42  edm::LogInfo("AlignPCLThresholdsReader") << "~AlignPCLThresholdsReader " << std::endl;
43  }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

template<typename T , typename R >
void edmtest::AlignPCLThresholdsReader< T, R >::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 46 of file AlignPCLThresholdsReader.cc.

References visDQMUpload::context, MillePedeFileConverter_cfg::e, edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::ESHandleBase::isValid(), dqmiolumiharvest::j, edm::eventsetup::heterocontainer::HCTypeTag::name(), edm::ESHandle< T >::product(), particleFlowZeroSuppressionECAL_cff::thresholds, edm::eventsetup::EventSetupRecordKey::type(), X, BeamSpotPI::Y, and BeamSpotPI::Z.

46  {
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;
50 
51  edm::eventsetup::EventSetupRecordKey inputKey = edm::eventsetup::EventSetupRecordKey::makeKey<R>();
54 
55  if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
56  //record not found
57  edm::LogInfo("AlignPCLThresholdsReader")
58  << "Record \"" << inputKey.type().name() << "\" does not exist " << std::endl;
59  }
60 
61  //this part gets the handle of the event source and the record (i.e. the Database)
62  edm::ESHandle<T> thresholdHandle = context.getHandle(thresholdToken_);
63  edm::LogInfo("AlignPCLThresholdsReader") << "got eshandle" << std::endl;
64 
65  if (!thresholdHandle.isValid()) {
66  edm::LogError("AlignPCLThresholdsReader") << " Could not get Handle" << std::endl;
67  return;
68  }
69 
70  const T* thresholds = thresholdHandle.product();
71  edm::LogInfo("AlignPCLThresholdsReader") << "got AlignPCLThresholds* " << std::endl;
72  edm::LogInfo("AlignPCLThresholdsReader") << "print pointer address : ";
73  edm::LogInfo("AlignPCLThresholdsReader") << thresholds << std::endl;
74 
75  edm::LogInfo("AlignPCLThresholdsReader") << "Size " << thresholds->size() << std::endl;
76  edm::LogInfo("AlignPCLThresholdsReader") << "Content of myThresholds " << std::endl;
77  // use built-in method in the CondFormat to print the content
78  if (thresholds && printdebug_) {
79  thresholds->printAll();
80  }
81 
82  FILE* pFile = nullptr;
83  if (!formatedOutput_.empty())
84  pFile = fopen(formatedOutput_.c_str(), "w");
85  if (pFile) {
86  fprintf(pFile, "AlignPCLThresholds::printAll() \n");
87  fprintf(pFile,
88  " ======================================================================================================="
89  "============\n");
90  fprintf(pFile, "N records cut: %i \n", thresholds->getNrecords());
91 
92  AlignPCLThresholds::threshold_map m_thresholds = thresholds->getThreshold_Map();
94 
95  if constexpr (std::is_same_v<T, AlignPCLThresholdsHG>) {
96  m_floatMap = thresholds->getFloatMap();
97  }
98 
99  for (auto it = m_thresholds.begin(); it != m_thresholds.end(); ++it) {
100  bool hasFractionCut = (m_floatMap.find(it->first) != m_floatMap.end());
101 
102  fprintf(pFile,
103  " ====================================================================================================="
104  "==============\n");
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) {
112  fprintf(pFile,
113  "| X_fractionCut : %8.3f \n",
114  thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::X));
115  } else {
116  fprintf(pFile, "\n");
117  }
118  } else {
119  fprintf(pFile, "\n");
120  }
121 
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) {
128  fprintf(pFile,
129  "| thetaX_fractionCut : %8.3f \n",
130  thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_X));
131  } else {
132  fprintf(pFile, "\n");
133  }
134  } else {
135  fprintf(pFile, "\n");
136  }
137 
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) {
144  fprintf(pFile,
145  "| Y_fractionCut : %8.3f \n",
146  thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Y));
147  } else {
148  fprintf(pFile, "\n");
149  }
150  } else {
151  fprintf(pFile, "\n");
152  }
153 
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) {
160  fprintf(pFile,
161  "| thetaY_fractionCut : %8.3f \n",
162  thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Y));
163  } else {
164  fprintf(pFile, "\n");
165  }
166  } else {
167  fprintf(pFile, "\n");
168  }
169 
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) {
176  fprintf(pFile,
177  "| Z_fractionCut : %8.3f \n",
178  thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::Z));
179  } else {
180  fprintf(pFile, "\n");
181  }
182  } else {
183  fprintf(pFile, "\n");
184  }
185 
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) {
192  fprintf(pFile,
193  "| thetaZ_fractionCut : %8.3f \n",
194  thresholds->getFractionCut(it->first, AlignPCLThresholds::coordType::theta_Z));
195  } else {
196  fprintf(pFile, "\n");
197  }
198  } else {
199  fprintf(pFile, "\n");
200  }
201 
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);
205  fprintf(pFile,
206  "Extra DOF: %i with label %s \n ",
207  j,
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));
213  }
214  }
215  }
216  }
217  }
std::unordered_map< std::string, std::vector< float > > param_map
std::map< std::string, AlignPCLThreshold > threshold_map
const edm::ESGetToken< T, R > thresholdToken_
#define X(str)
Definition: MuonsGrabber.cc:38
Log< level::Error, false > LogError
T const * product() const
Definition: ESHandle.h:86
bool isValid() const
Definition: ESHandle.h:44
Log< level::Info, false > LogInfo
heterocontainer::HCTypeTag TypeTag
long double T
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121

◆ fillDescriptions()

template<typename T , typename R >
void edmtest::AlignPCLThresholdsReader< T, R >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 220 of file AlignPCLThresholdsReader.cc.

References edm::ConfigurationDescriptions::add(), defaultModuleLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

220  {
222  desc.setComment("Reads payloads of type AlignPCLThresholds");
223  desc.addUntracked<bool>("printDebug", true);
224  desc.addUntracked<std::string>("outputFile", "");
225  descriptions.add(defaultModuleLabel<AlignPCLThresholdsReader<T, R>>(), desc);
226  }
std::string defaultModuleLabel()
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ formatedOutput_

template<typename T , typename R >
const std::string edmtest::AlignPCLThresholdsReader< T, R >::formatedOutput_
private

Definition at line 29 of file AlignPCLThresholdsReader.cc.

◆ printdebug_

template<typename T , typename R >
const bool edmtest::AlignPCLThresholdsReader< T, R >::printdebug_
private

Definition at line 28 of file AlignPCLThresholdsReader.cc.

◆ thresholdToken_

template<typename T , typename R >
const edm::ESGetToken<T, R> edmtest::AlignPCLThresholdsReader< T, R >::thresholdToken_
private

Definition at line 27 of file AlignPCLThresholdsReader.cc.