CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edmtest::AlignPCLThresholdsReader Class Reference
Inheritance diagram for edmtest::AlignPCLThresholdsReader:
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
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () 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
 
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::vector< ModuleDescription const * > &modules, 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 updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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_
 

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)
 
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 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)
 

Detailed Description

Definition at line 14 of file AlignPCLThresholdsReader.cc.

Constructor & Destructor Documentation

edmtest::AlignPCLThresholdsReader::AlignPCLThresholdsReader ( edm::ParameterSet const &  p)
explicit

Definition at line 31 of file AlignPCLThresholdsReader.cc.

31  :
32  printdebug_(p.getUntrackedParameter<bool>("printDebug",true)),
33  formatedOutput_(p.getUntrackedParameter<std::string>("outputFile",""))
34  {
35  edm::LogInfo("AlignPCLThresholdsReader")<<"AlignPCLThresholdsReader"<<std::endl;
36  }
edmtest::AlignPCLThresholdsReader::~AlignPCLThresholdsReader ( )
override

Definition at line 38 of file AlignPCLThresholdsReader.cc.

38  {
39  edm::LogInfo("AlignPCLThresholdsReader")<<"~AlignPCLThresholdsReader "<<std::endl;
40  }

Member Function Documentation

void edmtest::AlignPCLThresholdsReader::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprivate

Definition at line 43 of file AlignPCLThresholdsReader.cc.

References edm::EventID::event(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), formatedOutput_, edm::EventSetup::get(), AlignPCLThresholds::getExtraDOFCutsForAlignable(), AlignPCLThresholds::getExtraDOFLabelForAlignable(), AlignPCLThresholds::getNrecords(), AlignPCLThresholds::getThreshold_Map(), edm::EventBase::id(), AlignPCLThresholds::printAll(), printdebug_, edm::ESHandle< T >::product(), edm::EventID::run(), AlignPCLThresholds::size(), particleFlowRecHitECAL_cfi::thresholds, and edm::eventsetup::EventSetupRecordKey::type().

43  {
44 
45  edm::LogInfo("AlignPCLThresholdsReader") <<"### AlignPCLThresholdsReader::analyze ###"<<std::endl;
46  edm::LogInfo("AlignPCLThresholdsReader") <<" I AM IN RUN NUMBER "<<e.id().run() <<std::endl;
47  edm::LogInfo("AlignPCLThresholdsReader") <<" ---EVENT NUMBER "<<e.id().event() <<std::endl;
48 
50 
51  if( recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
52  //record not found
53  edm::LogInfo("AlignPCLThresholdsReader") <<"Record \"AlignPCLThresholdsRcd"<<"\" does not exist "<<std::endl;
54  }
55 
56  //this part gets the handle of the event source and the record (i.e. the Database)
57  edm::ESHandle<AlignPCLThresholds> thresholdHandle;
58  edm::LogInfo("AlignPCLThresholdsReader") <<"got eshandle"<<std::endl;
59 
60  context.get<AlignPCLThresholdsRcd>().get(thresholdHandle);
61  edm::LogInfo("AlignPCLThresholdsReader") <<"got context"<<std::endl;
62 
63  const AlignPCLThresholds* thresholds=thresholdHandle.product();
64  edm::LogInfo("AlignPCLThresholdsReader") <<"got AlignPCLThresholds* "<< std::endl;
65  edm::LogInfo("AlignPCLThresholdsReader") << "print pointer address : " ;
66  edm::LogInfo("AlignPCLThresholdsReader") << thresholds << std::endl;
67 
68  edm::LogInfo("AlignPCLThresholdsReader") << "Size " << thresholds->size() << std::endl;
69  edm::LogInfo("AlignPCLThresholdsReader") <<"Content of myThresholds "<<std::endl;
70  // use built-in method in the CondFormat to print the content
71  if(printdebug_){
72  thresholds->printAll();
73  }
74 
75  FILE* pFile=nullptr;
76  if(formatedOutput_!="")pFile=fopen(formatedOutput_.c_str(), "w");
77  if(pFile){
78 
79  fprintf(pFile,"AlignPCLThresholds::printAll() \n");
80  fprintf(pFile," =================================================================================================================== \n");
81  fprintf(pFile,"N records cut: %i \n",thresholds->getNrecords());
82 
83  AlignPCLThresholds::threshold_map m_thresholds = thresholds->getThreshold_Map();
84 
85  for(auto it = m_thresholds.begin(); it != m_thresholds.end() ; ++it){
86  fprintf(pFile," =================================================================================================================== \n");
87  fprintf(pFile,"key : %s \n ",(it->first).c_str());
88  fprintf(pFile,"- Xcut : %8.3f um ",(it->second).getXcut() );
89  fprintf(pFile,"| sigXcut : %8.3f ",(it->second).getSigXcut() );
90  fprintf(pFile,"| maxMoveXcut : %8.3f um ",(it->second).getMaxMoveXcut() );
91  fprintf(pFile,"| ErrorXcut : %8.3f um\n ",(it->second).getErrorXcut() );
92 
93  fprintf(pFile,"- thetaXcut : %8.3f urad ",(it->second).getThetaXcut() );
94  fprintf(pFile,"| sigThetaXcut : %8.3f ",(it->second).getSigThetaXcut() );
95  fprintf(pFile,"| maxMoveThetaXcut : %8.3f urad ",(it->second).getMaxMoveThetaXcut());
96  fprintf(pFile,"| ErrorThetaXcut : %8.3f urad\n ",(it->second).getErrorThetaXcut() );
97 
98  fprintf(pFile,"- Ycut : %8.3f um ",(it->second).getYcut() );
99  fprintf(pFile,"| sigYcut : %8.3f ",(it->second).getSigXcut() );
100  fprintf(pFile,"| maxMoveYcut : %8.3f um ",(it->second).getMaxMoveYcut() );
101  fprintf(pFile,"| ErrorYcut : %8.3f um\n ",(it->second).getErrorYcut() );
102 
103  fprintf(pFile,"- thetaYcut : %8.3f urad ",(it->second).getThetaYcut() );
104  fprintf(pFile,"| sigThetaYcut : %8.3f ",(it->second).getSigThetaYcut() );
105  fprintf(pFile,"| maxMoveThetaYcut : %8.3f urad ",(it->second).getMaxMoveThetaYcut());
106  fprintf(pFile,"| ErrorThetaYcut : %8.3f urad\n ",(it->second).getErrorThetaYcut() );
107 
108  fprintf(pFile,"- Zcut : %8.3f um ",(it->second).getZcut() );
109  fprintf(pFile,"| sigZcut : %8.3f ",(it->second).getSigZcut() );
110  fprintf(pFile,"| maxMoveZcut : %8.3f um ",(it->second).getMaxMoveZcut() );
111  fprintf(pFile,"| ErrorZcut : %8.3f um\n ",(it->second).getErrorZcut() );
112 
113  fprintf(pFile,"- thetaZcut : %8.3f urad ",(it->second).getThetaZcut() );
114  fprintf(pFile,"| sigThetaZcut : %8.3f ",(it->second).getSigThetaZcut() );
115  fprintf(pFile,"| maxMoveThetaZcut : %8.3f urad ",(it->second).getMaxMoveThetaZcut());
116  fprintf(pFile,"| ErrorThetaZcut : %8.3f urad\n ",(it->second).getErrorThetaZcut() );
117 
118  if((it->second).hasExtraDOF()){
119  for (unsigned int j=0; j<(it->second).extraDOFSize(); j++){
120  std::array<float,4> extraDOFCuts = thresholds->getExtraDOFCutsForAlignable(it->first,j);
121  const char* theLabel = (thresholds->getExtraDOFLabelForAlignable(it->first,j)).c_str();
122  fprintf(pFile,"Extra DOF: %i with label %s \n ",j,theLabel);
123  fprintf(pFile,"- cut : %8.3f " ,extraDOFCuts.at(0));
124  fprintf(pFile,"| sigCut : %8.3f " ,extraDOFCuts.at(1));
125  fprintf(pFile,"| maxMoveCut : %8.3f " ,extraDOFCuts.at(2));
126  fprintf(pFile,"| maxErrorCut : %8.3f \n " ,extraDOFCuts.at(3));
127  }
128  }
129  }
130  }
131 
132  }
RunNumber_t run() const
Definition: EventID.h:39
const threshold_map & getThreshold_Map() const
EventNumber_t event() const
Definition: EventID.h:41
double size() const
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
std::string getExtraDOFLabelForAlignable(const std::string &AlignableId, const unsigned int i) const
std::array< float, 4 > getExtraDOFCutsForAlignable(const std::string &AlignableId, const unsigned int i) const
std::map< std::string, AlignPCLThreshold > threshold_map
const int & getNrecords() const
heterocontainer::HCTypeTag TypeTag
edm::EventID id() const
Definition: EventBase.h:60
T const * product() const
Definition: ESHandle.h:86
void edmtest::AlignPCLThresholdsReader::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 135 of file AlignPCLThresholdsReader.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), DEFINE_FWK_MODULE, edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

135  {
137  desc.setComment("Reads payloads of type AlignPCLThresholds");
138  desc.addUntracked<bool>("printDebug",true);
139  desc.addUntracked<std::string>("outputFile","");
140  descriptions.add("AlignPCLThresholdsReader",desc);
141  }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

const std::string edmtest::AlignPCLThresholdsReader::formatedOutput_
private

Definition at line 27 of file AlignPCLThresholdsReader.cc.

Referenced by analyze().

const bool edmtest::AlignPCLThresholdsReader::printdebug_
private

Definition at line 26 of file AlignPCLThresholdsReader.cc.

Referenced by analyze().