Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-05 23:13:00

0001 #ifndef GCTTEST_H_
0002 #define GCTTEST_H_
0003 
0004 /*!
0005  * \class gctTestFunctions
0006  * \brief Top level skeleton for standalone testing
0007  * 
0008  * Contains a bunch of test functionality migrated from 
0009  * standalone test programs, to reduce duplication of code
0010  * and allow the tests to be done in an EDAnalyzer.
0011  *
0012  * Split into separate files to keep file sizes down.
0013  *
0014  * \author Greg Heath
0015  * \date March 2007
0016  *
0017  */
0018 
0019 #include <vector>
0020 #include <stdint.h>
0021 #include <string>
0022 
0023 #include "FWCore/Framework/interface/Event.h"
0024 
0025 class L1CaloEmCand;
0026 class L1CaloRegion;
0027 
0028 class gctTestElectrons;
0029 class gctTestSingleEvent;
0030 class gctTestEnergyAlgos;
0031 class gctTestFirmware;
0032 class gctTestUsingLhcData;
0033 class gctTestHt;
0034 class gctTestHfEtSums;
0035 
0036 class L1GlobalCaloTrigger;
0037 
0038 class L1GctJetFinderParams;
0039 class L1GctChannelMask;
0040 class L1CaloEtScale;
0041 
0042 class gctTestFunctions {
0043 public:
0044   // structs and typedefs
0045 
0046   // Constructor and destructor
0047   gctTestFunctions();
0048   ~gctTestFunctions();
0049 
0050   // Configuration method based on EventSetup - so not to be called from constructor
0051   void configure(const L1GctJetFinderParams& jfPars,
0052                  const L1GctChannelMask& chanMask,
0053                  const L1CaloEtScale& etScale,
0054                  const L1CaloEtScale& htMissScale,
0055                  const L1CaloEtScale& hfRingEtScale);
0056 
0057   /// Clear vectors of input data
0058   void reset();
0059 
0060   /// Load another event into the gct. Overloaded for the various ways of doing this.
0061   void loadNextEvent(L1GlobalCaloTrigger*& gct, const bool simpleEvent, const int16_t bx);
0062   void loadNextEvent(L1GlobalCaloTrigger*& gct, const std::string fileName, bool& endOfFile, const int16_t bx);
0063   void loadNextEvent(L1GlobalCaloTrigger*& gct, const std::string fileName, const int16_t bx);
0064   void loadNextEvent(L1GlobalCaloTrigger*& gct, const edm::Event& iEvent, const int16_t bx);
0065   void loadSingleEvent(L1GlobalCaloTrigger*& gct, const std::string fileName, const int16_t bx);
0066 
0067   /// Read the input electron data (after GCT processing).
0068   void fillElectronData(const L1GlobalCaloTrigger* gct);
0069 
0070   /// Read the firmware results from a file for the next event
0071   void fillJetsFromFirmware(const std::string& fileName);
0072 
0073   /// Read the input jet data from the jetfinders (after GCT processing).
0074   void fillRawJetData(const L1GlobalCaloTrigger* gct);
0075 
0076   /// Check the electron sorter
0077   bool checkElectrons(const L1GlobalCaloTrigger* gct) const;
0078 
0079   /// Check the jet finder against results from the firmware
0080   bool checkJetFinder(const L1GlobalCaloTrigger* gct) const;
0081 
0082   /// Check the energy sums algorithms
0083   bool checkEnergySums(const L1GlobalCaloTrigger* gct) const;
0084 
0085   /// Check the Ht summing algorithms
0086   bool checkHtSums(const L1GlobalCaloTrigger* gct) const;
0087 
0088   /// Check the Hf Et sums
0089   bool checkHfEtSums(const L1GlobalCaloTrigger* gct) const;
0090 
0091   /// Analyse calculation of energy sums in firmware
0092   bool checkEnergySumsFromFirmware(const L1GlobalCaloTrigger* gct, const std::string& fileName) const;
0093 
0094   /// Check against data read from hardware or a different version of the emulator
0095   void checkHwResults(const L1GlobalCaloTrigger* gct, const edm::Event& iEvent) const;
0096   void checkEmResults(const L1GlobalCaloTrigger* gct, const edm::Event& iEvent) const;
0097 
0098 private:
0099   gctTestElectrons* theElectronsTester;
0100   gctTestSingleEvent* theSingleEventTester;
0101   gctTestEnergyAlgos* theEnergyAlgosTester;
0102   gctTestFirmware* theFirmwareTester;
0103   gctTestUsingLhcData* theRealDataTester;
0104   gctTestHt* theHtTester;
0105   gctTestHfEtSums* theHfEtSumsTester;
0106 
0107   std::vector<std::vector<L1CaloEmCand> > m_inputEmCands;
0108   std::vector<std::vector<L1CaloRegion> > m_inputRegions;
0109 
0110   int m_bxStart;
0111   int m_numOfBx;
0112 
0113   void bxRangeUpdate(const int16_t bx);
0114 };
0115 
0116 #endif /*GCTTEST_H_*/