Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:32

0001 #ifndef DQM_L1TMonitor_L1TStage2uGTCaloLayer2Comp
0002 #define DQM_L1TMonitor_L1TStage2uGTCaloLayer2Comp
0003 
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 
0006 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0007 #include "DQMServices/Core/interface/DQMStore.h"
0008 
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 
0013 #include "DataFormats/L1Trigger/interface/EGamma.h"
0014 #include "DataFormats/L1Trigger/interface/Jet.h"
0015 #include "DataFormats/L1Trigger/interface/EtSum.h"
0016 #include "DataFormats/L1Trigger/interface/Tau.h"
0017 
0018 /**
0019  * Class to perform event by event comparisons between CaloLayer2 ouputs and uGT
0020  * inputs and produce summary of problems found
0021  *
0022  * Module should be run as part of L1TStage2 online sequence and relies on
0023  * collections of jets, e/g, tau and sum objects as they come out of CaloLayer2
0024  * and are unpacked by uGT. The purpose of the comparisions is to identify
0025  * issues with the data transmission links or the unpacking process in the uGT
0026  * FPGA firmare. The module is also used to compare the inputs of all uGT boards.
0027  *
0028  * Summary differentiates between different types of errors and errors with
0029  * different objects in attempt to identify issues with specific links. In the
0030  * case of the sums, due to the large number of different types and their spread
0031  * over many links, it was decided to not differentiate between the different
0032  * types of objects and their properties for the current implementation.
0033  */
0034 class L1TStage2uGTCaloLayer2Comp : public DQMEDAnalyzer {
0035 public:
0036   /**
0037    * Class constructor
0038    *
0039    * Receives the set of parameters, specified by the python configuration file
0040    * used to initialise the module as a part of a sequence. The contents of the
0041    * set is used to configure the internal state of the objects of this class.
0042    * Values from the parameter set are extracted and used to initialise
0043    * bxcollections for jet, e/g, tau and sum objects reconstructed and unpacked
0044    * by CaloLayer2 and uGT firmwares. These collections are the basis of the
0045    * comparisons performed by this module.
0046    *
0047    * @param edm::ParamterSet & ps A pointer to the parameter set used
0048    */
0049   L1TStage2uGTCaloLayer2Comp(const edm::ParameterSet& ps);
0050 
0051 protected:
0052   /**
0053    * Method to declare or "book" all histograms that will be part of module
0054    *
0055    * Histograms that are to be visualised as part of the DQM module should be
0056    * registered with the IBooker object any additional configuration such as
0057    * title or axis labels and ranges. A good rule of thumb for the amount of
0058    * configuration is that it should be possible to understnand the contents of
0059    * the histogram using the configuration received from this method since the
0060    * plots generated by this module would later be stored into ROOT files for
0061    * transfer to the DQM system and it should be possible to extract useful
0062    * information without the need for specific render plugins.
0063    *
0064    * @param DQMStore::IBooker& ibooker Object that handles the creation of plots
0065    * @param edm::Run const &           Reference to run object
0066    * @param edm::EventSetup const &    Reference to event configuration object
0067    *
0068    * @return void
0069    */
0070   void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override;
0071 
0072   /**
0073    * Main method where the analysis code resides, executed once for each run
0074    *
0075    * The main body of the module code is contained in this method. The different
0076    * object collections are extracted from the run and are passed to the
0077    * respective comparison methods for processing of each object type.
0078    *
0079    * @param edm::Event const &      Reference to event object
0080    * @param edm::EventSetup const & Reference to event configuration object
0081    *
0082    * @return void
0083    */
0084   void analyze(const edm::Event&, const edm::EventSetup&) override;
0085 
0086 private:
0087   /**
0088    * Encapsulates the code required for performing a comparison of
0089    * the jets contained in a given event.
0090    *
0091    * Method is called once per each event with the jet collections associated
0092    * with the event being extracted for all bx. The implementation checks
0093    * if the size of collections is the same and when so, compares the jets in
0094    * the same positions within the calol2/ugt collections. The number and type
0095    * of discrepancies are accumulated in different bins of a summary histogram.
0096    *
0097    * @param edm::Handle<l1t::JetBXCollection>& col1 Reference to jet
0098    *    collection 1
0099    * @param edm::Handle<l1t::JetBXCollection>& col2 Reference to jet
0100    *    collection 2
0101    *
0102    * @return bool Flag of whether the agreement was perfect
0103    */
0104   bool compareJets(const edm::Handle<l1t::JetBxCollection>& col1, const edm::Handle<l1t::JetBxCollection>& col2);
0105 
0106   /**
0107    * Encapsulates the code required for performing a comparison of
0108    * the e/gs contained in a given event.
0109    *
0110    * Method is called once per each event with the e/g collections associated
0111    * with the event being extracted for all bx. The implementation checks
0112    * if the size of collections is the same and when so, compares the e/gs in
0113    * the same positions within the calol2/ugt collections. The number and type
0114    * of discrepancies are accumulated in different bins of a summary histogram.
0115    *
0116    * @param edm::Handle<l1t::EGammaBXCollection>& col1 Reference to e/gamma
0117    *    collection 1
0118    * @param edm::Handle<l1t::EGammaBXCollection>& col2 Reference to e/gamma
0119    *    collection 2
0120    *
0121    * @return bool Flag of whether the agreement was perfect
0122    */
0123   bool compareEGs(const edm::Handle<l1t::EGammaBxCollection>& col1, const edm::Handle<l1t::EGammaBxCollection>& col2);
0124 
0125   /**
0126    * Encapsulates the code required for performing a comparison of
0127    * the taus contained in a given event.
0128    *
0129    * Method is called once per each event with the e/g collections associated
0130    * with the event being extracted for all bx. The implementation checks
0131    * if the size of collections is the same and when so, compares the taus in
0132    * the same positions within the calol2/ugt collections. The number and type
0133    *
0134    * @param edm::Handle<l1t::TauBXCollection>& col1 Reference to tau
0135    *    collection 1
0136    * @param edm::Handle<l1t::TauBXCollection>& col2 Reference to tau
0137    *    collection 2
0138    *
0139    * @return bool Flag of whether the agreement was perfect
0140    */
0141   bool compareTaus(const edm::Handle<l1t::TauBxCollection>& col1, const edm::Handle<l1t::TauBxCollection>& col2);
0142 
0143   /**
0144    * Encapsulates the code required for performing a comparison of
0145    * the taus contained in a given event.
0146    *
0147    * Method is called once per each event with the sum collections associated
0148    * with the event being extracted for all bx. The implementation loops
0149    * over the collection and depending of the their type
0150    * sums are compared separately but all sum errors are accumulated together.
0151    *
0152    * @param edm::Handle<l1t::TauBXCollection>& col1 Reference to sum
0153    *    collection 1
0154    * @param edm::Handle<l1t::TauBXCollection>& col2 Reference to sum
0155    *    collection 2
0156    *
0157    * @return bool Flag of whether the agreement was perfect
0158    */
0159   bool compareSums(const edm::Handle<l1t::EtSumBxCollection>& col1, const edm::Handle<l1t::EtSumBxCollection>& col2);
0160 
0161   // Holds the name of directory in DQM where module hostograms will be shown.
0162   // Value is taken from python configuration file (passed in class constructor)
0163   std::string monitorDir;
0164 
0165   // names of calol2 or ugt collections that are being compared
0166   std::string collection1Title;
0167   std::string collection2Title;
0168 
0169   // collections to hold entities reconstructed from calol2 or ugt
0170   edm::EDGetTokenT<l1t::JetBxCollection> JetCollection1;
0171   edm::EDGetTokenT<l1t::JetBxCollection> JetCollection2;
0172   edm::EDGetTokenT<l1t::EGammaBxCollection> EGammaCollection1;
0173   edm::EDGetTokenT<l1t::EGammaBxCollection> EGammaCollection2;
0174   edm::EDGetTokenT<l1t::TauBxCollection> TauCollection1;
0175   edm::EDGetTokenT<l1t::TauBxCollection> TauCollection2;
0176   edm::EDGetTokenT<l1t::EtSumBxCollection> EtSumCollection1;
0177   edm::EDGetTokenT<l1t::EtSumBxCollection> EtSumCollection2;
0178 
0179   enum numeratorBins {
0180     EVENTBAD = 1,    // number of (no.) bad events (where an error was found)
0181     EVENTBADJETCOL,  // no. events with a jet collection size difference
0182     EVENTBADEGCOL,   // no. events with a eg collection size difference
0183     EVENTBADTAUCOL,  // no. events with a tau collection size difference
0184     EVENTBADSUMCOL,  // no. events with a sum collection size difference
0185     JETBADET,        // no. jets with bad Et
0186     JETBADETA,       // no. jets with bad eta
0187     JETBADPHI,       // no. jets with bad phi
0188     EGBADET,         // no. egs with bad Et
0189     EGBADETA,        // no. egs with bad phi
0190     EGBADPHI,        // no. egs with bad eta
0191     TAUBADET,        // no. tau with bad Et
0192     TAUBADETA,       // no. tau with bad eta
0193     TAUBADPHI,       // no. tau with bad phi
0194     BADSUM           // no. sums with any disagreement
0195   };
0196 
0197   enum denumBins {
0198     EVENTS1 = 1,  // total no. events (used for taking a ratio) x5
0199     EVENTS2,
0200     EVENTS3,
0201     EVENTS4,
0202     EVENTS5,
0203     JETS1,  // total no. jets x3
0204     JETS2,
0205     JETS3,
0206     EGS1,  // total no. egs x3
0207     EGS2,
0208     EGS3,
0209     TAUS1,  // total no. taus x3
0210     TAUS2,
0211     TAUS3,
0212     SUMS  // total no. sums
0213   };
0214 
0215   // objects to represent individual plots shown in DQM
0216   MonitorElement* comparisonNum;
0217   MonitorElement* comparisonDenum;
0218   bool verbose;
0219 };
0220 
0221 #endif