Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:44

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, JETQUALOFF };
0214 
0215   enum egVars { NEGS = 1, EGGOOD, EGPOSOFF, EGETOFF, NISOEGS, ISOEGGOOD, ISOEGPOSOFF, ISOEGETOFF, EGISOOFF };
0216 
0217   enum tauVars { NTAUS = 1, TAUGOOD, TAUPOSOFF, TAUETOFF, NISOTAUS, ISOTAUGOOD, ISOTAUPOSOFF, ISOTAUETOFF, TAUISOOFF };
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* jetQualData;
0253   MonitorElement* jetEtEmul;
0254   MonitorElement* jetEtaEmul;
0255   MonitorElement* jetPhiEmul;
0256   MonitorElement* jetQualEmul;
0257   MonitorElement* jet2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0258   MonitorElement* jet2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0259 
0260   // histograms to store the properties of mismatched non-isolated e/g
0261   MonitorElement* egEtData;
0262   MonitorElement* egEtaData;
0263   MonitorElement* egPhiData;
0264   MonitorElement* egIsoData;
0265   MonitorElement* egEtEmul;
0266   MonitorElement* egEtaEmul;
0267   MonitorElement* egPhiEmul;
0268   MonitorElement* egIsoEmul;
0269   MonitorElement* eg2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0270   MonitorElement* eg2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0271 
0272   // histograms to store the properties of mismatched isolated e/g
0273   MonitorElement* isoEgEtData;
0274   MonitorElement* isoEgEtaData;
0275   MonitorElement* isoEgPhiData;
0276   MonitorElement* isoEgEtEmul;
0277   MonitorElement* isoEgEtaEmul;
0278   MonitorElement* isoEgPhiEmul;
0279   MonitorElement* isoEg2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0280   MonitorElement* isoEg2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0281 
0282   // histograms to store the properties of mismatched non-isolated taus
0283   MonitorElement* tauEtData;
0284   MonitorElement* tauEtaData;
0285   MonitorElement* tauPhiData;
0286   MonitorElement* tauIsoData;
0287   MonitorElement* tauEtEmul;
0288   MonitorElement* tauEtaEmul;
0289   MonitorElement* tauPhiEmul;
0290   MonitorElement* tauIsoEmul;
0291   MonitorElement* tau2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0292   MonitorElement* tau2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0293 
0294   // histograms to store the properties of mismatched isolated taus
0295   MonitorElement* isoTauEtData;
0296   MonitorElement* isoTauEtaData;
0297   MonitorElement* isoTauPhiData;
0298   MonitorElement* isoTauEtEmul;
0299   MonitorElement* isoTauEtaEmul;
0300   MonitorElement* isoTauPhiEmul;
0301   MonitorElement* isoTau2DEtaPhiData;  // This histogram will be filled only if enable2DComp is true
0302   MonitorElement* isoTau2DEtaPhiEmul;  // This histogram will be filled only if enable2DComp is true
0303 
0304   // histograms for mismatched ett sums
0305   MonitorElement* ettData;
0306   MonitorElement* ettEmul;
0307   MonitorElement* ettHFData;
0308   MonitorElement* ettHFEmul;
0309   MonitorElement* ettEmData;
0310   MonitorElement* ettEmEmul;
0311 
0312   // mismatched htt sums
0313   MonitorElement* httData;
0314   MonitorElement* httEmul;
0315   MonitorElement* httHFData;
0316   MonitorElement* httHFEmul;
0317 
0318   // mismatched met sums
0319   MonitorElement* metEtData;
0320   MonitorElement* metEtEmul;
0321   MonitorElement* metPhiData;
0322   MonitorElement* metPhiEmul;
0323   MonitorElement* metHFEtData;
0324   MonitorElement* metHFEtEmul;
0325   MonitorElement* metHFPhiData;
0326   MonitorElement* metHFPhiEmul;
0327 
0328   // mismatched mht sums
0329   MonitorElement* mhtEtData;
0330   MonitorElement* mhtEtEmul;
0331   MonitorElement* mhtPhiData;
0332   MonitorElement* mhtPhiEmul;
0333   MonitorElement* mhtHFEtData;
0334   MonitorElement* mhtHFEtEmul;
0335   MonitorElement* mhtHFPhiData;
0336   MonitorElement* mhtHFPhiEmul;
0337 
0338   // mismatched min bias sums
0339   MonitorElement* mbhfp0Data;
0340   MonitorElement* mbhfp0Emul;
0341   MonitorElement* mbhfm0Data;
0342   MonitorElement* mbhfm0Emul;
0343   MonitorElement* mbhfp1Data;
0344   MonitorElement* mbhfp1Emul;
0345   MonitorElement* mbhfm1Data;
0346   MonitorElement* mbhfm1Emul;
0347 
0348   // mismatched towercount sum
0349   MonitorElement* towCountData;
0350   MonitorElement* towCountEmul;
0351 
0352   // mismatched assymetry
0353 
0354   MonitorElement* asymCountData;
0355   MonitorElement* asymCountEmul;
0356 
0357   // mismatched centrality
0358 
0359   MonitorElement* centrCountData;
0360   MonitorElement* centrCountEmul;
0361 
0362   bool verbose;
0363   bool enable2DComp;  // Default value is false. Set to true in the configuration file for enabling 2D eta-phi histograms
0364 
0365   // use only bx = 0 since it only contains RAW data (needed for emulator)
0366   const unsigned int currBx = 0;
0367 };
0368 
0369 #endif