CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1GctPrintLuts Class Reference

#include <L1Trigger/L1GlobalCaloTrigger/plugins/L1GctPrintLuts.cc>

Inheritance diagram for L1GctPrintLuts:
edm::EDAnalyzer

Public Types

typedef L1GlobalCaloTrigger::lutPtr lutPtr
 typedefs More...
 
typedef
L1GlobalCaloTrigger::lutPtrVector 
lutPtrVector
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

 L1GctPrintLuts (const edm::ParameterSet &)
 
 ~L1GctPrintLuts ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
int configureGct (const edm::EventSetup &c)
 
virtual void endJob ()
 

Private Attributes

L1GlobalCaloTriggerm_gct
 
std::string m_hfSumLutOutFileName
 
std::string m_htMissLutOutFileName
 
lutPtrVector m_jetEtCalibLuts
 
std::string m_jetRanksOutFileName
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: print Gct lookup table contents to a file

Definition at line 39 of file L1GctPrintLuts.h.

Member Typedef Documentation

typedefs

Definition at line 43 of file L1GctPrintLuts.h.

Definition at line 44 of file L1GctPrintLuts.h.

Constructor & Destructor Documentation

L1GctPrintLuts::L1GctPrintLuts ( const edm::ParameterSet iConfig)
explicit

Definition at line 34 of file L1GctPrintLuts.cc.

References L1GctJetFinderBase::COL_OFFSET, and m_jetEtCalibLuts.

34  :
35  m_jetRanksOutFileName (iConfig.getUntrackedParameter<std::string>("jetRanksFilename", "gctJetRanksContents.txt" )),
36  m_hfSumLutOutFileName (iConfig.getUntrackedParameter<std::string>("hfSumLutFilename", "gctHfSumLutContents.txt" )),
37  m_htMissLutOutFileName(iConfig.getUntrackedParameter<std::string>("htMissLutFilename","gctHtMissLutContents.txt")),
40 {
41  // Fill the jetEtCalibLuts vector
42  lutPtr nextLut( new L1GctJetEtCalibrationLut() );
43 
44  for (unsigned ieta=0; ieta<L1GctJetFinderBase::COL_OFFSET; ieta++) {
45  nextLut->setEtaBin(ieta);
46  m_jetEtCalibLuts.push_back(nextLut);
47  nextLut.reset ( new L1GctJetEtCalibrationLut() );
48  }
49 
50 }
T getUntrackedParameter(std::string const &, T const &) const
Jet Et calibration LUT.
lutPtrVector m_jetEtCalibLuts
Bit-level emulation of the Global Calorimeter Trigger.
L1GlobalCaloTrigger::lutPtr lutPtr
typedefs
std::string m_hfSumLutOutFileName
static const unsigned int COL_OFFSET
The index offset between columns.
std::string m_jetRanksOutFileName
L1GlobalCaloTrigger * m_gct
std::string m_htMissLutOutFileName
L1GctPrintLuts::~L1GctPrintLuts ( )

Definition at line 52 of file L1GctPrintLuts.cc.

53 {
54 
55  // do anything here that needs to be done at desctruction time
56  // (e.g. close files, deallocate resources etc.)
57 
58 }

Member Function Documentation

void L1GctPrintLuts::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 67 of file L1GctPrintLuts.cc.

References L1GctHfEtSumsLut::bitCountNegEtaRing1, L1GctHfEtSumsLut::bitCountNegEtaRing2, L1GctHfEtSumsLut::bitCountPosEtaRing1, L1GctHfEtSumsLut::bitCountPosEtaRing2, configureGct(), L1GctHfEtSumsLut::etSumNegEtaRing1, L1GctHfEtSumsLut::etSumNegEtaRing2, L1GctHfEtSumsLut::etSumPosEtaRing1, L1GctHfEtSumsLut::etSumPosEtaRing2, mergeVDriftHistosByStation::file, L1GctGlobalHfSumAlgos::getBCLut(), L1GlobalCaloTrigger::getEnergyFinalStage(), L1GctGlobalHfSumAlgos::getESLut(), L1GctGlobalEnergyAlgos::getHfSumProcessor(), L1GctGlobalEnergyAlgos::getHtMissLut(), m_gct, m_hfSumLutOutFileName, m_htMissLutOutFileName, m_jetEtCalibLuts, and m_jetRanksOutFileName.

68 {
69  // get config data from EventSetup
70  // check this has been done successfully before proceeding
71  if (configureGct(iSetup) == 0) {
72 
73  // Write to a new file
74  struct stat buffer ;
75  if ( !stat( m_jetRanksOutFileName.c_str(), &buffer ) ) {
76  edm::LogWarning("LutFileExists") << "File " << m_jetRanksOutFileName << " already exists. It will not be overwritten." << std::endl;
77  } else {
78 
79  std::ofstream file;
80  file.open( m_jetRanksOutFileName.c_str() );
81 
82  if (file.good()) {
83  // Print the calibration lut contents
84  file << " Gct lookup table printout \n"
85  << "===========================\n\n"
86  << "Jet Et Calibration lut contents\n" << std::endl;
87  for (unsigned ieta=0; ieta<m_jetEtCalibLuts.size(); ieta++) {
88  file << *m_jetEtCalibLuts.at(ieta) << std::endl;
89  }
90  } else {
91  edm::LogWarning("LutFileError") << "Error opening file " << m_jetRanksOutFileName << ". No lookup tables written." << std::endl;
92  }
93  file.close();
94  }
95 
96  if ( !stat( m_hfSumLutOutFileName.c_str(), &buffer ) ) {
97  edm::LogWarning("LutFileExists") << "File " << m_hfSumLutOutFileName << " already exists. It will not be overwritten." << std::endl;
98  } else {
99 
100  std::ofstream file;
101  file.open( m_hfSumLutOutFileName.c_str() );
102 
103  if (file.good()) {
104  // Print the Hf luts
105  file << "\n\n Hf ring jet bit count luts:" << std::endl;
106  file << "\n Positive eta, ring1" << std::endl;
108  file << "\n Positive eta, ring2" << std::endl;
110  file << "\n Negative eta, ring1" << std::endl;
112  file << "\n Negative eta, ring2" << std::endl;
114  file << "\n\n Hf Et sum luts:" << std::endl;
115  file << "\n Positive eta, ring1" << std::endl;
117  file << "\n Positive eta, ring2" << std::endl;
119  file << "\n Negative eta, ring1" << std::endl;
121  file << "\n Negative eta, ring2" << std::endl;
123  } else {
124  edm::LogWarning("LutFileError") << "Error opening file " << m_hfSumLutOutFileName << ". No lookup tables written." << std::endl;
125  }
126  file.close();
127  }
128 
129  if ( !stat( m_htMissLutOutFileName.c_str(), &buffer ) ) {
130  edm::LogWarning("LutFileExists") << "File " << m_htMissLutOutFileName << " already exists. It will not be overwritten." << std::endl;
131  } else {
132 
133  std::ofstream file;
134  file.open( m_htMissLutOutFileName.c_str() );
135 
136  if (file.good()) {
137  // Print the HtMiss luts
138  file << "\n\n missing Ht lut:" << std::endl;
139  file << *m_gct->getEnergyFinalStage()->getHtMissLut() << std::endl;
140  } else {
141  edm::LogWarning("LutFileError") << "Error opening file " << m_hfSumLutOutFileName << ". No lookup tables written." << std::endl;
142  }
143  file.close();
144  }
145  }
146 }
lutPtrVector m_jetEtCalibLuts
const L1GctHfBitCountsLut * getBCLut(const L1GctHfEtSumsLut::hfLutType type) const
Get lut pointers.
L1GctGlobalHfSumAlgos * getHfSumProcessor() const
provide access to hf sum processor
std::string m_hfSumLutOutFileName
int configureGct(const edm::EventSetup &c)
L1GctGlobalEnergyAlgos * getEnergyFinalStage() const
get the energy final stage
const L1GctHfEtSumsLut * getESLut(const L1GctHfEtSumsLut::hfLutType type) const
std::string m_jetRanksOutFileName
L1GlobalCaloTrigger * m_gct
std::string m_htMissLutOutFileName
const L1GctHtMissLut * getHtMissLut() const
void L1GctPrintLuts::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file L1GctPrintLuts.cc.

152 {
153 }
int L1GctPrintLuts::configureGct ( const edm::EventSetup c)
private

Definition at line 156 of file L1GctPrintLuts.cc.

References edm::EventSetup::get(), m_gct, m_jetEtCalibLuts, edm::ESHandle< class >::product(), L1GlobalCaloTrigger::setHtMissScale(), L1GlobalCaloTrigger::setJetEtCalibrationLuts(), L1GlobalCaloTrigger::setJetFinderParams(), L1GlobalCaloTrigger::setupHfSumLuts(), and summarizeEdmComparisonLogfiles::success.

Referenced by analyze().

157 {
158  int success = 0;
159  if (&c==0) {
160  success = -1;
161  edm::LogWarning("L1GctConfigFailure") << "Cannot find EventSetup information." << std::endl;
162  }
163 
164  if (success == 0) {
165  // get data from EventSetup
167  c.get< L1GctJetFinderParamsRcd >().get( jfPars ) ; // which record?
168  edm::ESHandle< L1CaloEtScale > hfRingEtScale ;
169  c.get< L1HfRingEtScaleRcd >().get( hfRingEtScale ) ; // which record?
170  edm::ESHandle< L1CaloEtScale > htMissScale ;
171  c.get< L1HtMissScaleRcd >().get( htMissScale ) ; // which record?
172 // edm::ESHandle< L1GctChannelMask > chanMask ;
173 // c.get< L1GctChannelMaskRcd >().get( chanMask ) ; // which record?
175  c.get< L1JetEtScaleRcd >().get( etScale ) ; // which record?
176 
177  if (jfPars.product() == 0) {
178  success = -1;
179  edm::LogWarning("L1GctConfigFailure")
180  << "Failed to find a L1GctJetFinderParamsRcd:L1GctJetFinderParams in EventSetup!" << std::endl;
181  }
182 
183  if (hfRingEtScale.product() == 0) {
184  success = -1;
185  edm::LogWarning("L1GctConfigFailure")
186  << "Failed to find a L1HfRingEtScaleRcd:L1CaloEtScale in EventSetup!" << std::endl;
187  }
188 
189  if (htMissScale.product() == 0) {
190  success = -1;
191  edm::LogWarning("L1GctConfigFailure")
192  << "Failed to find a L1HtMissScaleRcd:L1CaloEtScale in EventSetup!" << std::endl;
193  }
194 
195 // if (chanMask.product() == 0) {
196 // success = -1;
197 // edm::LogWarning("L1GctConfigFailure")
198 // << "Failed to find a L1GctChannelMaskRcd:L1GctChannelMask in EventSetup!" << std::endl;
199 // }
200 
201  if (success==0) {
202  // tell the jet Et Luts about the scales
203  for (unsigned ieta=0; ieta<m_jetEtCalibLuts.size(); ieta++) {
204  m_jetEtCalibLuts.at(ieta)->setFunction(jfPars.product());
205  m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product());
206  }
207 
208 
209  // pass all the setup info to the gct
211  m_gct->setJetFinderParams(jfPars.product());
212  m_gct->setHtMissScale(htMissScale.product());
213  m_gct->setupHfSumLuts(hfRingEtScale.product());
214  // m_gct->setChannelMask(chanMask.product());
215 
216  }
217  }
218 
219  if (success != 0) {
220  edm::LogError("L1GctConfigError")
221  << "Configuration failed - GCT emulator will not be run" << std::endl;
222  }
223  return success;
224 }
lutPtrVector m_jetEtCalibLuts
void setJetFinderParams(const L1GctJetFinderParams *const jfpars)
void setHtMissScale(const L1CaloEtScale *const scale)
setup scale for missing Ht
void setupHfSumLuts(const L1CaloEtScale *const scale)
setup Hf sum LUTs
void setJetEtCalibrationLuts(const lutPtrVector &jfluts)
setup the Jet Calibration Luts
const T & get() const
Definition: EventSetup.h:55
L1GlobalCaloTrigger * m_gct
T const * product() const
Definition: ESHandle.h:62
void L1GctPrintLuts::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 228 of file L1GctPrintLuts.cc.

228  {
229 }

Member Data Documentation

L1GlobalCaloTrigger* L1GctPrintLuts::m_gct
private

Definition at line 65 of file L1GctPrintLuts.h.

Referenced by analyze(), and configureGct().

std::string L1GctPrintLuts::m_hfSumLutOutFileName
private

Definition at line 61 of file L1GctPrintLuts.h.

Referenced by analyze().

std::string L1GctPrintLuts::m_htMissLutOutFileName
private

Definition at line 62 of file L1GctPrintLuts.h.

Referenced by analyze().

lutPtrVector L1GctPrintLuts::m_jetEtCalibLuts
private

Definition at line 68 of file L1GctPrintLuts.h.

Referenced by analyze(), configureGct(), and L1GctPrintLuts().

std::string L1GctPrintLuts::m_jetRanksOutFileName
private

Definition at line 60 of file L1GctPrintLuts.h.

Referenced by analyze().