Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DQM_L1TMonitor_L1TdeStage2CaloLayer2
0002 #define DQM_L1TMonitor_L1TdeStage2CaloLayer2
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  * Short class description.
0020  *
0021  * Longer class description...
0022  * ... desc continued.
0023  */
0024 class L1TdeStage2CaloLayer2 : public DQMEDAnalyzer {
0025 public:
0026   /**
0027    * Class constructor
0028    *
0029    * Receives the set of parameters, specified by the python configuration file
0030    * used to initialise the module as a part of a sequence. The contents of the
0031    * set is used to configure the internal state of the objects of this class.
0032    * Values from the parameter set are extracted and used to initialise
0033    * bxcollections for jet, e/g, tau and sum objects reconstructed by firmware
0034    * (data) and emulator. These collections are the basis of the comparisons
0035    * performed by this module.
0036    *
0037    * @param edm::ParamterSet & ps A pointer to the parameter set used
0038    */
0039   L1TdeStage2CaloLayer2(const edm::ParameterSet& ps);
0040 
0041 protected:
0042   /**
0043    * Method to declare or "book" all histograms that will be part of module
0044    *
0045    * Histograms that are to be visualised as part of the DQM module should be
0046    * registered with the IBooker object any additional configuration such as
0047    * title or axis labels and ranges. A good rule of thumb for the amount of
0048    * configuration is that it should be possible to understnand the contents of
0049    * the histogram using the configuration received from this method since the
0050    * plots generated by this module would later be stored into ROOT files for
0051    * transfer to the DQM system and it should be possible to ...
0052    *
0053    * @param DQMStore::IBooker& ibooker Object that handles the creation of plots
0054    * @param edm::Run const &           Reference to run object
0055    * @param edm::EventSetup const &    Reference to event configuration object
0056    *
0057    * @return void
0058    */
0059   void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override;
0060 
0061   /**
0062    * Main method where the analysis code resides, executed once for each run
0063    *
0064    * The main body of the module code is contained in this method. The different
0065    * object collections are extracted from the run and are passed to the
0066    * respective comparison methods for processing of each object type.
0067    *
0068    * @param edm::Event const &         Reference to event object
0069    * @param edm::EventSetup const &    Reference to event configuration object
0070    *
0071    * @return void
0072    */
0073   void analyze(const edm::Event&, const edm::EventSetup&) override;
0074 
0075 private:
0076   /**
0077    * Encapsulates the code required for performing a comparison of
0078    * the jets contained in a given event.
0079    *
0080    * Method is called once per each event with the jet collections associated
0081    * with the event being extracted for bx = 0 as the RAW information required
0082    * to run the emulator is only available for bx 0. The implementation checks
0083    * if the size of collections is the same and when so, compares the jets in
0084    * the same positions within the data/emul collections. When a discrepancy is
0085    * found, the properties (Et, eta, phi) of the problematic data/emul objects
0086    * are stored in dedicated histograms. In cases of differences, a distinction
0087    * is made between objects whose energy or position are in disagremeent.When
0088    * the length of data/emul collections is different, all of the objects are
0089    * "stored" in the histograms dedicated to problematic objects.
0090    *
0091    * @param edm::Handle<l1t::JetBXCollection>& dataCol Reference to jet
0092    *    collection from data
0093    * @param edm::Handle<l1t::JetBXCollection>& emulCol Reference to jet
0094    *    collection from emulation
0095    *
0096    * @return bool Flag of whether the agreement was perfect
0097    */
0098   bool compareJets(const edm::Handle<l1t::JetBxCollection>& dataCol, const edm::Handle<l1t::JetBxCollection>& emulCol);
0099 
0100   /**
0101    * Encapsulates the code required for performing a comparison of
0102    * the e/gs contained in a given event.
0103    *
0104    * Method is called once per each event with the e/g collections associated
0105    * with the event being extracted for bx = 0 as the RAW information required
0106    * to run the emulator is only available for bx 0. The implementation checks
0107    * if the size of collections is the same and when so, compares the e/gs in
0108    * the same positions within the data/emul collections. When a discrepancy is
0109    * found, the properties (Et, eta, phi) of the problematic data/emul objects
0110    * are stored in dedicated histograms. In cases of differences, a distinction
0111    * is made between objects whose energy or position are in disagremeent.
0112    * Another distinction is made between isolated and non-isolated e/g
0113    * candidates and problematic objects are handled accordingly. When the length
0114    * of data/emul collections is different, all of the objects are "stored" in
0115    * the histograms dedicated to problematic objects.
0116    *
0117    * @param edm::Handle<l1t::EGammaBXCollection>& dataCol Reference to e/gamma
0118    *    collection from data
0119    * @param edm::Handle<l1t::EGammaBXCollection>& emulCol Reference to e/gamma
0120    *    collection from emulation
0121    *
0122    * @return bool Flag of whether the agreement was perfect
0123    */
0124   bool compareEGs(const edm::Handle<l1t::EGammaBxCollection>& dataCol,
0125                   const edm::Handle<l1t::EGammaBxCollection>& emulCol);
0126 
0127   /**
0128    * Encapsulates the code required for performing a comparison of
0129    * the taus contained in a given event.
0130    *
0131    * Method is called once per each event with the tau collections associated
0132    * with the event being extracted for bx = 0 as the RAW information required
0133    * to run the emulator is only available for bx 0. The implementation checks
0134    * if the size of collections is the same and when so, compares the taus in
0135    * the same positions within the data/emul collections. When a discrepancy is
0136    * found, the properties (Et, eta, phi) of the problematic data/emul objects
0137    * are stored in dedicated histograms. In cases of differences, a distinction
0138    * is made between objects whose energy or position are in disagremeent.
0139    * Another distinction is made between isolated and non-isolated tau
0140    * candidates and problematic objects are handled accordingly. When the length
0141    * of data/emul collections is different, all of the objects are "stored" in
0142    * the histograms dedicated to problematic objects.
0143    *
0144    * @param edm::Handle<l1t::TauBXCollection>& dataCol Reference to tau
0145    *    collection from data
0146    * @param edm::Handle<l1t::TauBXCollection>& emulCol Reference to tau
0147    *    collection from emulation
0148    *
0149    * @return bool Flag of whether the agreement was perfect
0150    */
0151   bool compareTaus(const edm::Handle<l1t::TauBxCollection>& dataCol, const edm::Handle<l1t::TauBxCollection>& emulCol);
0152 
0153   /**
0154    * Encapsulates the code required for performing a comparison of
0155    * the taus contained in a given event.
0156    *
0157    * Method is called once per each event with the sum collections associated
0158    * with the event being extracted for bx = 0 as the RAW information required
0159    * to run the emulator is only available for bx 0. The implementation loops
0160    * over the collection and depending of the sum type, each variant is compared
0161    * independently. If any disagreement is found, the event is marked a bad and
0162    * the properties of the sum are stored in the data/emulator problematic
0163    * histograms.
0164    *
0165    * @param edm::Handle<l1t::TauBXCollection>& dataCol Reference to tau
0166    *    collection from data
0167    * @param edm::Handle<l1t::TauBXCollection>& emulCol Reference to tau
0168    *    collection from emulation
0169    *
0170    * @return bool Flag of whether the agreement was perfect
0171    */
0172   bool compareSums(const edm::Handle<l1t::EtSumBxCollection>& dataCol,
0173                    const edm::Handle<l1t::EtSumBxCollection>& emulCol);
0174 
0175   // Holds the name of directory in DQM where module hostograms will be shown.
0176   // Value is taken from python configuration file (passed in class constructor)
0177   std::string monitorDir;
0178 
0179   // collections to hold entities reconstructed from data and emulation
0180   edm::EDGetTokenT<l1t::JetBxCollection> calol2JetCollectionData;
0181   edm::EDGetTokenT<l1t::JetBxCollection> calol2JetCollectionEmul;
0182   edm::EDGetTokenT<l1t::EGammaBxCollection> calol2EGammaCollectionData;
0183   edm::EDGetTokenT<l1t::EGammaBxCollection> calol2EGammaCollectionEmul;
0184   edm::EDGetTokenT<l1t::TauBxCollection> calol2TauCollectionData;
0185   edm::EDGetTokenT<l1t::TauBxCollection> calol2TauCollectionEmul;
0186   edm::EDGetTokenT<l1t::EtSumBxCollection> calol2EtSumCollectionData;
0187   edm::EDGetTokenT<l1t::EtSumBxCollection> calol2EtSumCollectionEmul;
0188 
0189   enum summaryBins {
0190     NEVENTS = 1,  // total number of events
0191     EVENTGOOD,    // number of good events (100% agreement)
0192     NJETS_S,      // total number of jets objects found
0193     JETGOOD_S,    // number of jets in agreement (energy and pos)
0194     NEGS_S,       // total number of e/g objects found
0195     EGGOOD_S,     // number of e/g in agremeent (energy and pos)
0196     NTAUS_S,      // total number of tau objects found
0197     TAUGOOD_S,    // number of taus in agremenet (energy and pos)
0198     NSUMS_S,      // total number of sums
0199     SUMGOOD_S     // number of good sums across all events
0200   };
0201 
0202   enum problemCauses {
0203     NEVENTS_P = 1,  // total number of events
0204     JETCOLLSIZE,    // no. events with different data/emul obj. in jet coll.
0205     EGCOLLSIZE,     // no. events with different data/emul obj. in eg coll.
0206     TAUCOLLSIZE,    // no. events with different data/emul obj. in tau coll.
0207     JETMISMATCH,    // no. events failed due to a jet mismatch
0208     EGMISMATCH,     // no. events failed due to an e/g mismatch
0209     TAUMISMATCH,    // no. events failed due to a tau mismatch
0210     SUMMISMATCH     // no. events failed due to a sum mismatch
0211   };
0212 
0213   enum jetVars { NJETS = 1, JETGOOD, JETPOSOFF, JETETOFF };
0214 
0215   enum egVars { NEGS = 1, EGGOOD, EGPOSOFF, EGETOFF, NISOEGS, ISOEGGOOD, ISOEGPOSOFF, ISOEGETOFF };
0216 
0217   enum tauVars { NTAUS = 1, TAUGOOD, TAUPOSOFF, TAUETOFF, NISOTAUS, ISOTAUGOOD, ISOTAUPOSOFF, ISOTAUETOFF };
0218 
0219   enum sumVars {
0220     NSUMS = 1,
0221     SUMGOOD,
0222     NETTSUMS,
0223     ETTSUMGOOD,
0224     NHTTSUMS,
0225     HTTSUMGOOD,
0226     NMETSUMS,
0227     METSUMGOOD,
0228     NMHTSUMS,
0229     MHTSUMGOOD,
0230     NMBHFSUMS,
0231     MBHFSUMGOOD,
0232     NTOWCOUNTS,
0233     TOWCOUNTGOOD,
0234     NASYMCOUNTS,
0235     ASYMCOUNTGOOD,
0236     NCENTRCOUNTS,
0237     CENTRCOUNTGOOD
0238   };
0239 
0240   // objects to represent individual plots shown in DQM
0241   MonitorElement* agreementSummary;
0242   MonitorElement* jetSummary;
0243   MonitorElement* tauSummary;
0244   MonitorElement* egSummary;
0245   MonitorElement* sumSummary;
0246   MonitorElement* problemSummary;
0247 
0248   // histograms to store the properties of mismatched jets
0249   MonitorElement* jetEtData;
0250   MonitorElement* jetEtaData;
0251   MonitorElement* jetPhiData;
0252   MonitorElement* jetEtEmul;
0253   MonitorElement* jetEtaEmul;
0254   MonitorElement* jetPhiEmul;
0255   MonitorElement* jet2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0256   MonitorElement* jet2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0257 
0258   // histograms to store the properties of mismatched non-isolated e/g
0259   MonitorElement* egEtData;
0260   MonitorElement* egEtaData;
0261   MonitorElement* egPhiData;
0262   MonitorElement* egEtEmul;
0263   MonitorElement* egEtaEmul;
0264   MonitorElement* egPhiEmul;
0265   MonitorElement* eg2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0266   MonitorElement* eg2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0267 
0268   // histograms to store the properties of mismatched isolated e/g
0269   MonitorElement* isoEgEtData;
0270   MonitorElement* isoEgEtaData;
0271   MonitorElement* isoEgPhiData;
0272   MonitorElement* isoEgEtEmul;
0273   MonitorElement* isoEgEtaEmul;
0274   MonitorElement* isoEgPhiEmul;
0275   MonitorElement* isoEg2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0276   MonitorElement* isoEg2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0277 
0278   // histograms to store the properties of mismatched non-isolated taus
0279   MonitorElement* tauEtData;
0280   MonitorElement* tauEtaData;
0281   MonitorElement* tauPhiData;
0282   MonitorElement* tauEtEmul;
0283   MonitorElement* tauEtaEmul;
0284   MonitorElement* tauPhiEmul;
0285   MonitorElement* tau2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0286   MonitorElement* tau2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0287 
0288   // histograms to store the properties of mismatched isolated taus
0289   MonitorElement* isoTauEtData;
0290   MonitorElement* isoTauEtaData;
0291   MonitorElement* isoTauPhiData;
0292   MonitorElement* isoTauEtEmul;
0293   MonitorElement* isoTauEtaEmul;
0294   MonitorElement* isoTauPhiEmul;
0295   MonitorElement* isoTau2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0296   MonitorElement* isoTau2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0297 
0298   // histograms for mismatched ett sums
0299   MonitorElement* ettData;
0300   MonitorElement* ettEmul;
0301   MonitorElement* ettHFData;
0302   MonitorElement* ettHFEmul;
0303   MonitorElement* ettEmData;
0304   MonitorElement* ettEmEmul;
0305 
0306   // mismatched htt sums
0307   MonitorElement* httData;
0308   MonitorElement* httEmul;
0309   MonitorElement* httHFData;
0310   MonitorElement* httHFEmul;
0311 
0312   // mismatched met sums
0313   MonitorElement* metEtData;
0314   MonitorElement* metEtEmul;
0315   MonitorElement* metPhiData;
0316   MonitorElement* metPhiEmul;
0317   MonitorElement* metHFEtData;
0318   MonitorElement* metHFEtEmul;
0319   MonitorElement* metHFPhiData;
0320   MonitorElement* metHFPhiEmul;
0321 
0322   // mismatched mht sums
0323   MonitorElement* mhtEtData;
0324   MonitorElement* mhtEtEmul;
0325   MonitorElement* mhtPhiData;
0326   MonitorElement* mhtPhiEmul;
0327   MonitorElement* mhtHFEtData;
0328   MonitorElement* mhtHFEtEmul;
0329   MonitorElement* mhtHFPhiData;
0330   MonitorElement* mhtHFPhiEmul;
0331 
0332   // mismatched min bias sums
0333   MonitorElement* mbhfp0Data;
0334   MonitorElement* mbhfp0Emul;
0335   MonitorElement* mbhfm0Data;
0336   MonitorElement* mbhfm0Emul;
0337   MonitorElement* mbhfp1Data;
0338   MonitorElement* mbhfp1Emul;
0339   MonitorElement* mbhfm1Data;
0340   MonitorElement* mbhfm1Emul;
0341 
0342   // mismatched towercount sum
0343   MonitorElement* towCountData;
0344   MonitorElement* towCountEmul;
0345 
0346   // mismatched assymetry
0347 
0348   MonitorElement* asymCountData;
0349   MonitorElement* asymCountEmul;
0350 
0351   // mismatched centrality
0352 
0353   MonitorElement* centrCountData;
0354   MonitorElement* centrCountEmul;
0355 
0356   bool verbose;
0357   bool enable2DComp;  // Default value is false. Set to true in the configuration file for enabling 2D eta-phi histograms
0358 
0359   // use only bx = 0 since it only contains RAW data (needed for emulator)
0360   const unsigned int currBx = 0;
0361 };
0362 
0363 #endif