CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQM/L1TMonitor/src/L1TGCT.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1TGCT.cc
00003  *
00004  * $Date: 2012/04/04 09:56:36 $
00005  * $Revision: 1.57 $
00006  * \author J. Berryhill
00007  *
00008  * $Log: L1TGCT.cc,v $
00009  * Revision 1.57  2012/04/04 09:56:36  ghete
00010  * Clean up L1TDEMON, add TriggerType hist to RCT, GCT, enable correlation condition tests in GT, clean up HCAL files.
00011  *
00012  * Revision 1.56  2012/03/29 21:16:48  rovere
00013  * Removed all instances of hltTriggerTypeFilter from L1T DQM Code.
00014  *
00015  * Revision 1.55  2010/06/28 09:29:30  tapper
00016  * Reduced number of bins.
00017  *
00018  * Revision 1.54  2010/06/28 06:40:46  tapper
00019  * Reduced numbers of bins in correlation plots (MET vs MHT and SumET vs HT).
00020  *
00021  * Revision 1.53  2010/06/14 20:38:45  tapper
00022  * Fixed stupid bug in MET vs MHT phi correlation.
00023  *
00024  * Revision 1.52  2010/06/09 14:39:27  tapper
00025  * Fixed labels and binning again.
00026  *
00027  * Revision 1.51  2010/06/09 14:03:04  tapper
00028  * Fixed histogram titles and binning in projections.
00029  *
00030  * Revision 1.50  2010/05/30 10:01:59  tapper
00031  * Added one histogram, correlation of sum ET and HT and changed a few labels for the better.
00032  *
00033  * Revision 1.49  2010/04/30 12:50:22  tapper
00034  * Fixed number of bins and range for MHT phi.
00035  *
00036  * Revision 1.48  2010/04/05 11:34:58  tapper
00037  * Changed scales on 2D HF correlation plots. No idea why they had eta phi scales when they only have 3 bits....
00038  *
00039  * Revision 1.47  2010/04/02 16:32:42  tapper
00040  * 1. Changed GCT unpacker settings to unpack 5 BXs.
00041  * 2. Changed L1TGCT to plot only central BX distributions but all 5 BXs for timing plots.
00042  * 3. Made labels more descriptive in GCT emulator expert DQM.
00043  *
00044  * Revision 1.46  2009/11/19 14:39:15  puigh
00045  * modify beginJob
00046  *
00047  * Revision 1.45  2009/11/02 22:30:27  tapper
00048  * Err that'll teach me to test it properly.... fixed a bug in the HF ring histograms.
00049  *
00050  * Revision 1.44  2009/11/02 17:00:05  tapper
00051  * Changes to L1TdeGCT (to include energy sums), to L1TDEMON (should not make any difference now) and L1TGCT to add multiple BXs.
00052  *
00053  * Revision 1.43  2009/07/22 19:40:24  puigh
00054  * Update binning to reflect instrumentation
00055  *
00056  * Revision 1.42  2009/06/23 09:48:55  tapper
00057  * Added missing occupancy plot for central and forward jets.
00058  *
00059  * Revision 1.41  2009/06/22 15:58:20  tapper
00060  * Added MET vs MHT correlation plots (both for magnitude and phi). Still untested!
00061  *
00062  * Revision 1.39  2009/05/27 21:49:26  jad
00063  * updated Total and Missing Energy histograms and added Overlow plots
00064  *
00065  * Revision 1.38  2009/02/24 13:01:42  jad
00066  * Updated MET_PHI histogram to obey the correct limits
00067  *
00068  * Revision 1.37  2008/11/11 13:20:32  tapper
00069  * A whole list of house keeping:
00070  * 1. New shifter histogram with central and forward jets together.
00071  * 2. Relabelled Ring 0 and Ring 1 to Ring 1 and Ring 2 for HF rings.
00072  * 3. Tidied up some histograms names to make all consistent.
00073  * 4. Switched eta and phi in 2D plots to match RCT.
00074  * 5. Removed 1D eta and phi plots. Will not be needed for Qtests in future.
00075  *
00076  * Revision 1.36  2008/10/28 14:16:16  tapper
00077  * Tidied up and removed some unnecessary code.
00078  *
00079  * Revision 1.35  2008/10/24 08:38:54  jbrooke
00080  * fix empty jet plots
00081  *
00082  * Revision 1.34  2008/10/10 12:41:24  jbrooke
00083  * put back checks on energy sum vector size, change [] to .at()
00084  *
00085  * Revision 1.33  2008/09/21 14:37:51  jad
00086  * updated HF Sums & Counts and added individual Jet Candidates and differences
00087  *
00088  * Revision 1.30  2008/06/09 11:07:52  tapper
00089  * Removed electron sub-folders with histograms per eta and phi bin.
00090  *
00091  * Revision 1.29  2008/06/06 15:18:22  tapper
00092  * Removed errorSummary folder stuff.
00093  *
00094  * Revision 1.28  2008/06/02 11:08:58  tapper
00095  * Added HF ring histograms....
00096  *
00097  * Revision 1.27  2008/05/12 12:52:46  tapper
00098  * Fixed problem when no GCT data in the event.
00099  *
00100  * Revision 1.26  2008/05/09 16:42:27  ameyer
00101  * *** empty log message ***
00102  *
00103  * Revision 1.25  2008/04/29 15:24:49  tapper
00104  * Changed path to summary histograms.
00105  *
00106  * Revision 1.24  2008/04/28 09:23:07  tapper
00107  * Added 1D eta and phi histograms for electrons and jets as input to Q tests.
00108  *
00109  * Revision 1.23  2008/04/25 15:40:21  tapper
00110  * Added histograms to EventInfo//errorSummarySegments.
00111  *
00112  * Revision 1.22  2008/03/20 19:38:25  berryhil
00113  *
00114  *
00115  * organized message logger
00116  *
00117  * Revision 1.21  2008/03/14 20:35:46  berryhil
00118  *
00119  *
00120  * stripped out obsolete parameter settings
00121  *
00122  * rpc tpg restored with correct dn access and dbe handling
00123  *
00124  * Revision 1.20  2008/03/12 17:24:24  berryhil
00125  *
00126  *
00127  * eliminated log files, truncated HCALTPGXana histo output
00128  *
00129  * Revision 1.19  2008/03/01 00:40:00  lat
00130  * DQM core migration.
00131  *
00132  * Revision 1.18  2008/02/20 18:59:29  tapper
00133  * Ported GCTMonitor histograms into L1TGCT
00134  *
00135  * Revision 1.17  2008/01/22 18:56:02  muzaffar
00136  * include cleanup. Only for cc/cpp files
00137  *
00138  * Revision 1.16  2007/12/21 17:41:20  berryhil
00139  *
00140  *
00141  * try/catch removal
00142  *
00143  * Revision 1.15  2007/11/19 15:08:22  lorenzo
00144  * changed top folder name
00145  *
00146  * Revision 1.14  2007/09/27 23:01:28  ratnik
00147  * QA campaign: fixes to compensate includes cleanup in  DataFormats/L1Trigger
00148  *
00149  * Revision 1.13  2007/09/27 16:56:26  wittich
00150  * verbosity fixes
00151  *
00152  * Revision 1.12  2007/09/26 15:26:23  berryhil
00153  *
00154  *
00155  * restored L1TGCT.cc
00156  *
00157  * Revision 1.10  2007/09/05 22:31:36  wittich
00158  * - Factorize getByLabels to approximate my understanding of what the
00159  *   HW can do.
00160  * - tested (loosely speaking) on GREJ' data.
00161  *
00162  * Revision 1.9  2007/09/04 02:54:19  wittich
00163  * - fix dupe ME in RCT
00164  * - put in rank>0 req in GCT
00165  * - various small other fixes
00166  *
00167  * Revision 1.8  2007/08/31 18:14:21  wittich
00168  * update GCT packages to reflect GctRawToDigi, and move to raw plots
00169  *
00170  * Revision 1.7  2007/08/31 11:02:56  wittich
00171  * cerr -> LogInfo
00172  *
00173  * Revision 1.6  2007/02/22 19:43:53  berryhil
00174  *
00175  *
00176  *
00177  * InputTag parameters added for all modules
00178  *
00179  *
00180  *
00181  */
00182 
00183 #include "DQM/L1TMonitor/interface/L1TGCT.h"
00184 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00185 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
00186 
00187 // Trigger Headers
00188 
00189 // GCT and RCT data formats
00190 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
00191 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtSums.h"
00192 #include "DQMServices/Core/interface/DQMStore.h"
00193 
00194 using namespace edm;
00195 
00196 // Define statics for bins etc.
00197 const unsigned int JETETABINS = 22;
00198 const float JETETAMIN = -0.5;
00199 const float JETETAMAX = 21.5;
00200 
00201 const unsigned int EMETABINS = 22;
00202 const float EMETAMIN = -0.5;
00203 const float EMETAMAX = 21.5;
00204 
00205 const unsigned int METPHIBINS = 72;
00206 const float METPHIMIN = -0.5;
00207 const float METPHIMAX = 71.5;
00208 
00209 const unsigned int MHTPHIBINS = 18;
00210 const float MHTPHIMIN = -0.5;
00211 const float MHTPHIMAX = 17.5;
00212 
00213 const unsigned int PHIBINS = 18;
00214 const float PHIMIN = -0.5;
00215 const float PHIMAX = 17.5;
00216 
00217 const unsigned int OFBINS = 2;
00218 const float OFMIN = -0.5;
00219 const float OFMAX = 1.5;
00220 
00221 const unsigned int BXBINS = 5;
00222 const float BXMIN = -2.5;
00223 const float BXMAX = 2.5;
00224 
00225 // Bins for 3, 5, 6, 7, 10 and 12 bits
00226 const unsigned int R3BINS = 8;
00227 const float R3MIN = -0.5;
00228 const float R3MAX = 7.5;
00229 const unsigned int R5BINS = 32;
00230 const float R5MIN = -0.5;
00231 const float R5MAX = 31.5;
00232 const unsigned int R6BINS = 64;
00233 const float R6MIN = -0.5;
00234 const float R6MAX = 63.5;
00235 const unsigned int R7BINS = 128;
00236 const float R7MIN = -0.5;
00237 const float R7MAX = 127.5;
00238 const unsigned int R10BINS = 1024;
00239 const float R10MIN = -0.5;
00240 const float R10MAX = 1023.5;
00241 const unsigned int R12BINS = 4096;
00242 const float R12MIN = -0.5;
00243 const float R12MAX = 4095.5;
00244 
00245 L1TGCT::L1TGCT(const edm::ParameterSet & ps) :
00246   gctCenJetsSource_(ps.getParameter<edm::InputTag>("gctCentralJetsSource")),
00247   gctForJetsSource_(ps.getParameter<edm::InputTag>("gctForwardJetsSource")),
00248   gctTauJetsSource_(ps.getParameter<edm::InputTag>("gctTauJetsSource")),
00249   gctEnergySumsSource_(ps.getParameter<edm::InputTag>("gctEnergySumsSource")),
00250   gctIsoEmSource_(ps.getParameter<edm::InputTag>("gctIsoEmSource")),
00251   gctNonIsoEmSource_(ps.getParameter<edm::InputTag>("gctNonIsoEmSource")),
00252   filterTriggerType_ (ps.getParameter< int >("filterTriggerType"))
00253 {
00254 
00255   // verbosity switch
00256   verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
00257 
00258   if (verbose_)
00259     edm::LogInfo("L1TGCT") << "L1TGCT: constructor...." << std::endl;
00260 
00261 
00262   dbe = NULL;
00263   if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
00264     dbe = edm::Service < DQMStore > ().operator->();
00265     dbe->setVerbose(0);
00266   }
00267 
00268   outputFile_ = ps.getUntrackedParameter < std::string > ("outputFile", "");
00269   if (outputFile_.size() != 0) {
00270     edm::LogInfo("L1TGCT") << "L1T Monitoring histograms will be saved to "
00271                            << outputFile_ << std::endl;
00272   }
00273 
00274   bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
00275   if(disable){
00276     outputFile_="";
00277   }
00278 
00279 
00280   if (dbe != NULL) {
00281     dbe->setCurrentFolder("L1T/L1TGCT");
00282   }
00283 
00284 }
00285 
00286 L1TGCT::~L1TGCT()
00287 {
00288 }
00289 
00290 void L1TGCT::beginJob(void)
00291 {
00292 
00293   nev_ = 0;
00294 
00295   // get hold of back-end interface
00296   DQMStore *dbe = 0;
00297   dbe = edm::Service < DQMStore > ().operator->();
00298 
00299   if (dbe) {
00300     dbe->setCurrentFolder("L1T/L1TGCT");
00301     dbe->rmdir("L1T/L1TGCT");
00302   }
00303 
00304 
00305   if (dbe) {
00306 
00307     dbe->setCurrentFolder("L1T/L1TGCT");
00308 
00309     triggerType_ =
00310       dbe->book1D("TriggerType", "TriggerType", 17, -0.5, 16.5);
00311 
00312     l1GctAllJetsEtEtaPhi_ = dbe->book2D("AllJetsEtEtaPhi", "CENTRAL AND FORWARD JET E_{T}",
00313                                         JETETABINS, JETETAMIN, JETETAMAX,
00314                                         PHIBINS, PHIMIN, PHIMAX);
00315     l1GctCenJetsEtEtaPhi_ = dbe->book2D("CenJetsEtEtaPhi", "CENTRAL JET E_{T}",
00316                                         JETETABINS, JETETAMIN, JETETAMAX,
00317                                         PHIBINS, PHIMIN, PHIMAX); 
00318     l1GctForJetsEtEtaPhi_ = dbe->book2D("ForJetsEtEtaPhi", "FORWARD JET E_{T}",
00319                                         JETETABINS, JETETAMIN, JETETAMAX,
00320                                         PHIBINS, PHIMIN, PHIMAX); 
00321     l1GctTauJetsEtEtaPhi_ = dbe->book2D("TauJetsEtEtaPhi", "TAU JET E_{T}", 
00322                                         EMETABINS, EMETAMIN, EMETAMAX,
00323                                         PHIBINS, PHIMIN, PHIMAX); 
00324     l1GctIsoEmRankEtaPhi_ = dbe->book2D("IsoEmRankEtaPhi", "ISO EM E_{T}", 
00325                                         EMETABINS, EMETAMIN, EMETAMAX,
00326                                         PHIBINS, PHIMIN, PHIMAX);                   
00327     l1GctNonIsoEmRankEtaPhi_ = dbe->book2D("NonIsoEmRankEtaPhi", "NON-ISO EM E_{T}",
00328                                            EMETABINS, EMETAMIN, EMETAMAX,
00329                                            PHIBINS, PHIMIN, PHIMAX); 
00330     l1GctAllJetsOccEtaPhi_ = dbe->book2D("AllJetsOccEtaPhi", "CENTRAL AND FORWARD JET OCCUPANCY",
00331                                         JETETABINS, JETETAMIN, JETETAMAX,
00332                                         PHIBINS, PHIMIN, PHIMAX);
00333     l1GctCenJetsOccEtaPhi_ = dbe->book2D("CenJetsOccEtaPhi", "CENTRAL JET OCCUPANCY",
00334                                          JETETABINS, JETETAMIN, JETETAMAX,
00335                                          PHIBINS, PHIMIN, PHIMAX); 
00336     l1GctForJetsOccEtaPhi_ = dbe->book2D("ForJetsOccEtaPhi", "FORWARD JET OCCUPANCY",
00337                                          JETETABINS, JETETAMIN, JETETAMAX,
00338                                          PHIBINS, PHIMIN, PHIMAX);
00339     l1GctTauJetsOccEtaPhi_ = dbe->book2D("TauJetsOccEtaPhi", "TAU JET OCCUPANCY",
00340                                          EMETABINS, EMETAMIN, EMETAMAX,
00341                                          PHIBINS, PHIMIN, PHIMAX); 
00342     l1GctIsoEmOccEtaPhi_ = dbe->book2D("IsoEmOccEtaPhi", "ISO EM OCCUPANCY",
00343                                        EMETABINS, EMETAMIN, EMETAMAX,
00344                                        PHIBINS, PHIMIN, PHIMAX); 
00345     l1GctNonIsoEmOccEtaPhi_ = dbe->book2D("NonIsoEmOccEtaPhi", "NON-ISO EM OCCUPANCY",
00346                                           EMETABINS, EMETAMIN, EMETAMAX,
00347                                           PHIBINS, PHIMIN, PHIMAX); 
00348   
00349     l1GctHFRing1PosEtaNegEta_ = dbe->book2D("HFRing1Corr", "HF RING1 E_{T} CORRELATION +/-  #eta",
00350                                             R3BINS, R3MIN, R3MAX, R3BINS, R3MIN, R3MAX); 
00351     l1GctHFRing2PosEtaNegEta_ = dbe->book2D("HFRing2Corr", "HF RING2 E_{T} CORRELATION +/-  #eta",
00352                                             R3BINS, R3MIN, R3MAX, R3BINS, R3MIN, R3MAX);
00353     l1GctHFRing1TowerCountPosEtaNegEta_ = dbe->book2D("HFRing1TowerCountCorr", "HF RING1 TOWER COUNT CORRELATION +/-  #eta",
00354                                                       R3BINS, R3MIN, R3MAX, R3BINS, R3MIN, R3MAX);
00355     l1GctHFRing2TowerCountPosEtaNegEta_ = dbe->book2D("HFRing2TowerCountCorr", "HF RING2 TOWER COUNT CORRELATION +/-  #eta",
00356                                                       R3BINS, R3MIN, R3MAX, R3BINS, R3MIN, R3MAX);
00357 
00358     //HF Ring stuff
00359     l1GctHFRing1TowerCountPosEta_ = dbe->book1D("HFRing1TowerCountPosEta", "HF RING1 TOWER COUNT  #eta  +", R3BINS, R3MIN, R3MAX);
00360     l1GctHFRing1TowerCountNegEta_ = dbe->book1D("HFRing1TowerCountNegEta", "HF RING1 TOWER COUNT  #eta  -", R3BINS, R3MIN, R3MAX);
00361     l1GctHFRing2TowerCountPosEta_ = dbe->book1D("HFRing2TowerCountPosEta", "HF RING2 TOWER COUNT  #eta  +", R3BINS, R3MIN, R3MAX);
00362     l1GctHFRing2TowerCountNegEta_ = dbe->book1D("HFRing2TowerCountNegEta", "HF RING2 TOWER COUNT  #eta  -", R3BINS, R3MIN, R3MAX);
00363 
00364     l1GctHFRing1ETSumPosEta_ = dbe->book1D("HFRing1ETSumPosEta", "HF RING1 E_{T}  #eta  +", R3BINS, R3MIN, R3MAX);
00365     l1GctHFRing1ETSumNegEta_ = dbe->book1D("HFRing1ETSumNegEta", "HF RING1 E_{T}  #eta  -", R3BINS, R3MIN, R3MAX);
00366     l1GctHFRing2ETSumPosEta_ = dbe->book1D("HFRing2ETSumPosEta", "HF RING2 E_{T}  #eta  +", R3BINS, R3MIN, R3MAX);
00367     l1GctHFRing2ETSumNegEta_ = dbe->book1D("HFRing2ETSumNegEta", "HF RING2 E_{T}  #eta  -", R3BINS, R3MIN, R3MAX);
00368     l1GctHFRingRatioPosEta_  = dbe->book1D("HFRingRatioPosEta", "HF RING E_{T} RATIO  #eta  +", R5BINS, R5MIN, R5MAX);
00369     l1GctHFRingRatioNegEta_  = dbe->book1D("HFRingRatioNegEta", "HF RING E_{T} RATIO  #eta  -", R5BINS, R5MIN, R5MAX);
00370 
00371     l1GctHFRingTowerCountOccBx_ = dbe->book2D("HFRingTowerCountOccBx", "HF RING TOWER COUNT PER BX",BXBINS, BXMIN, BXMAX, R3BINS, R3MIN, R3MAX);
00372     l1GctHFRingETSumOccBx_ = dbe->book2D("HFRingETSumOccBx", "HF RING E_{T} PER BX",BXBINS, BXMIN, BXMAX, R3BINS, R3MIN, R3MAX);
00373     
00374     // Rank histograms
00375     l1GctCenJetsRank_  = dbe->book1D("CenJetsRank", "CENTRAL JET E_{T}", R6BINS, R6MIN, R6MAX);
00376     l1GctForJetsRank_  = dbe->book1D("ForJetsRank", "FORWARD JET E_{T}", R6BINS, R6MIN, R6MAX);
00377     l1GctTauJetsRank_  = dbe->book1D("TauJetsRank", "TAU JET E_{T}", R6BINS, R6MIN, R6MAX);
00378     l1GctIsoEmRank_    = dbe->book1D("IsoEmRank", "ISO EM E_{T}", R6BINS, R6MIN, R6MAX);
00379     l1GctNonIsoEmRank_ = dbe->book1D("NonIsoEmRank", "NON-ISO EM E_{T}", R6BINS, R6MIN, R6MAX);
00380 
00381     l1GctAllJetsOccRankBx_ = dbe->book2D("AllJetsOccRankBx","ALL JETS E_{T} PER BX",BXBINS,BXMIN,BXMAX,R6BINS,R6MIN,R6MAX);
00382     l1GctAllEmOccRankBx_   = dbe->book2D("AllEmOccRankBx","ALL EM E_{T} PER BX",BXBINS,BXMIN,BXMAX,R6BINS,R6MIN,R6MAX);
00383 
00384     // Energy sums
00385     l1GctEtMiss_    = dbe->book1D("EtMiss", "MET", R12BINS, R12MIN, R12MAX);
00386     l1GctEtMissPhi_ = dbe->book1D("EtMissPhi", "MET  #phi", METPHIBINS, METPHIMIN, METPHIMAX);
00387     l1GctEtMissOf_  = dbe->book1D("EtMissOf", "MET OVERFLOW", OFBINS, OFMIN, OFMAX);
00388     l1GctEtMissOccBx_ = dbe->book2D("EtMissOccBx","MET PER BX",BXBINS,BXMIN,BXMAX,R12BINS,R12MIN,R12MAX);
00389     l1GctHtMiss_    = dbe->book1D("HtMiss", "MHT", R7BINS, R7MIN, R7MAX);
00390     l1GctHtMissPhi_ = dbe->book1D("HtMissPhi", "MHT  #phi", MHTPHIBINS, MHTPHIMIN, MHTPHIMAX);
00391     l1GctHtMissOf_  = dbe->book1D("HtMissOf", "MHT OVERFLOW", OFBINS, OFMIN, OFMAX);
00392     l1GctHtMissOccBx_ = dbe->book2D("HtMissOccBx","MHT PER BX",BXBINS,BXMIN,BXMAX,R7BINS,R7MIN,R7MAX);
00393     l1GctEtMissHtMissCorr_ = dbe->book2D("EtMissHtMissCorr", "MET MHT CORRELATION",
00394                                          R6BINS, R12MIN, R12MAX,
00395                                          R6BINS, R7MIN, R7MAX); 
00396     l1GctEtMissHtMissCorrPhi_ = dbe->book2D("EtMissHtMissPhiCorr", "MET MHT  #phi  CORRELATION",
00397                                             METPHIBINS, METPHIMIN, METPHIMAX,
00398                                             MHTPHIBINS, MHTPHIMIN, MHTPHIMAX);
00399     l1GctEtTotal_   = dbe->book1D("EtTotal", "SUM E_{T}", R12BINS, R12MIN, R12MAX);
00400     l1GctEtTotalOf_ = dbe->book1D("EtTotalOf", "SUM E_{T} OVERFLOW", OFBINS, OFMIN, OFMAX);
00401     l1GctEtTotalOccBx_ = dbe->book2D("EtTotalOccBx","SUM E_{T} PER BX",BXBINS,BXMIN,BXMAX,R12BINS,R12MIN,R12MAX);
00402     l1GctEtHad_     = dbe->book1D("EtHad", "H_{T}", R12BINS, R12MIN, R12MAX);
00403     l1GctEtHadOf_   = dbe->book1D("EtHadOf", "H_{T} OVERFLOW", OFBINS, OFMIN, OFMAX);
00404     l1GctEtHadOccBx_ = dbe->book2D("EtHadOccBx","H_{T} PER BX",BXBINS,BXMIN,BXMAX,R12BINS,R12MIN,R12MAX);
00405     l1GctEtTotalEtHadCorr_ = dbe->book2D("EtTotalEtHadCorr", "Sum E_{T} H_{T} CORRELATION",
00406                                          R6BINS, R12MIN, R12MAX,
00407                                          R6BINS, R12MIN, R12MAX); 
00408   }
00409 
00410 }
00411 
00412 
00413 void L1TGCT::endJob(void)
00414 {
00415   if (verbose_)
00416     edm::LogInfo("L1TGCT") << "L1TGCT: end job...." << std::endl;
00417   edm::LogInfo("EndJob") << "analyzed " << nev_ << " events";
00418 
00419   if (outputFile_.size() != 0 && dbe) {
00420     dbe->save(outputFile_);
00421   }
00422 
00423   return;
00424 }
00425 
00426 void L1TGCT::analyze(const edm::Event & e, const edm::EventSetup & c)
00427 {
00428   nev_++;
00429   if (verbose_) {
00430     edm::LogInfo("L1TGCT") << "L1TGCT: analyze...." << std::endl;
00431   }
00432 
00433   
00434   // filter according trigger type
00435   //  enum ExperimentType {
00436   //        Undefined          =  0,
00437   //        PhysicsTrigger     =  1,
00438   //        CalibrationTrigger =  2,
00439   //        RandomTrigger      =  3,
00440   //        Reserved           =  4,
00441   //        TracedEvent        =  5,
00442   //        TestTrigger        =  6,
00443   //        ErrorTrigger       = 15
00444 
00445   // fill a histogram with the trigger type, for normalization fill also last bin
00446   // ErrorTrigger + 1
00447   double triggerType = static_cast<double> (e.experimentType()) + 0.001;
00448   double triggerTypeLast = static_cast<double> (edm::EventAuxiliary::ExperimentType::ErrorTrigger)
00449                           + 0.001;
00450   triggerType_->Fill(triggerType);
00451   triggerType_->Fill(triggerTypeLast + 1);
00452 
00453   // filter only if trigger type is greater than 0, negative values disable filtering
00454   if (filterTriggerType_ >= 0) {
00455 
00456       // now filter, for real data only
00457       if (e.isRealData()) {
00458           if (!(e.experimentType() == filterTriggerType_)) {
00459 
00460               edm::LogInfo("L1TGCT") << "\n Event of TriggerType "
00461                       << e.experimentType() << " rejected" << std::endl;
00462               return;
00463 
00464           }
00465       }
00466 
00467   }
00468 
00469   // Get all the collections
00470   edm::Handle < L1GctEmCandCollection > l1IsoEm;
00471   edm::Handle < L1GctEmCandCollection > l1NonIsoEm;
00472   edm::Handle < L1GctJetCandCollection > l1CenJets;
00473   edm::Handle < L1GctJetCandCollection > l1ForJets;
00474   edm::Handle < L1GctJetCandCollection > l1TauJets;
00475   edm::Handle < L1GctHFRingEtSumsCollection > l1HFSums; 
00476   edm::Handle < L1GctHFBitCountsCollection > l1HFCounts;
00477   edm::Handle < L1GctEtMissCollection >  l1EtMiss;
00478   edm::Handle < L1GctHtMissCollection >  l1HtMiss;
00479   edm::Handle < L1GctEtHadCollection >   l1EtHad;
00480   edm::Handle < L1GctEtTotalCollection > l1EtTotal;
00481 
00482   e.getByLabel(gctIsoEmSource_, l1IsoEm);
00483   e.getByLabel(gctNonIsoEmSource_, l1NonIsoEm);
00484   e.getByLabel(gctCenJetsSource_, l1CenJets);
00485   e.getByLabel(gctForJetsSource_, l1ForJets);
00486   e.getByLabel(gctTauJetsSource_, l1TauJets);
00487   e.getByLabel(gctEnergySumsSource_, l1HFSums);
00488   e.getByLabel(gctEnergySumsSource_, l1HFCounts);  
00489   e.getByLabel(gctEnergySumsSource_, l1EtMiss);
00490   e.getByLabel(gctEnergySumsSource_, l1HtMiss);
00491   e.getByLabel(gctEnergySumsSource_, l1EtHad);
00492   e.getByLabel(gctEnergySumsSource_, l1EtTotal);
00493 
00494 
00495   // Fill histograms
00496 
00497   // Central jets
00498   if (l1CenJets.isValid()) {
00499     for (L1GctJetCandCollection::const_iterator cj = l1CenJets->begin();cj != l1CenJets->end(); cj++) {
00500       // only plot central BX
00501       if (cj->bx()==0) {
00502         l1GctCenJetsRank_->Fill(cj->rank());
00503         // only plot eta and phi maps for non-zero candidates
00504         if (cj->rank()) {
00505           l1GctAllJetsEtEtaPhi_->Fill(cj->regionId().ieta(),cj->regionId().iphi(),cj->rank());
00506           l1GctAllJetsOccEtaPhi_->Fill(cj->regionId().ieta(),cj->regionId().iphi());
00507           l1GctCenJetsEtEtaPhi_->Fill(cj->regionId().ieta(),cj->regionId().iphi(),cj->rank());
00508           l1GctCenJetsOccEtaPhi_->Fill(cj->regionId().ieta(),cj->regionId().iphi());
00509         }
00510       }
00511       if (cj->rank()) l1GctAllJetsOccRankBx_->Fill(cj->bx(),cj->rank()); // for all BX
00512     }
00513   } else {    
00514     edm::LogWarning("DataNotFound") << " Could not find l1CenJets label was " << gctCenJetsSource_ ;
00515   }
00516 
00517   // Forward jets
00518   if (l1ForJets.isValid()) {
00519     for (L1GctJetCandCollection::const_iterator fj = l1ForJets->begin(); fj != l1ForJets->end(); fj++) {
00520       // only plot central BX
00521       if (fj->bx()==0) {
00522         l1GctForJetsRank_->Fill(fj->rank());
00523         // only plot eta and phi maps for non-zero candidates
00524         if (fj->rank()) {
00525           l1GctAllJetsEtEtaPhi_->Fill(fj->regionId().ieta(),fj->regionId().iphi(),fj->rank());
00526           l1GctAllJetsOccEtaPhi_->Fill(fj->regionId().ieta(),fj->regionId().iphi());
00527           l1GctForJetsEtEtaPhi_->Fill(fj->regionId().ieta(),fj->regionId().iphi(),fj->rank());
00528           l1GctForJetsOccEtaPhi_->Fill(fj->regionId().ieta(),fj->regionId().iphi());    
00529         }
00530       }
00531       if (fj->rank()) l1GctAllJetsOccRankBx_->Fill(fj->bx(),fj->rank()); // for all BX
00532     }
00533   } else {    
00534     edm::LogWarning("DataNotFound") << " Could not find l1ForJets label was " << gctForJetsSource_ ;
00535   }
00536 
00537   // Tau jets
00538   if (l1TauJets.isValid()) {
00539     for (L1GctJetCandCollection::const_iterator tj = l1TauJets->begin(); tj != l1TauJets->end(); tj++) {
00540       // only plot central BX
00541       if (tj->bx()==0) {
00542         l1GctTauJetsRank_->Fill(tj->rank());
00543         // only plot eta and phi maps for non-zero candidates
00544         if (tj->rank()) {
00545           l1GctTauJetsEtEtaPhi_->Fill(tj->regionId().ieta(),tj->regionId().iphi(),tj->rank());
00546           l1GctTauJetsOccEtaPhi_->Fill(tj->regionId().ieta(),tj->regionId().iphi());
00547         }
00548       }
00549       if (tj->rank()) l1GctAllJetsOccRankBx_->Fill(tj->bx(),tj->rank()); // for all BX
00550     }
00551   } else {    
00552     edm::LogWarning("DataNotFound") << " Could not find l1TauJets label was " << gctTauJetsSource_ ;
00553   }
00554 
00555   // Missing ET
00556   if (l1EtMiss.isValid()) { 
00557     for (L1GctEtMissCollection::const_iterator met = l1EtMiss->begin(); met != l1EtMiss->end(); met++) {
00558       // only plot central BX
00559       if (met->bx()==0) {
00560         if (met->overFlow() == 0 && met->et() > 0) {
00561           //Avoid problems with met=0 candidates affecting MET_PHI plots
00562           l1GctEtMiss_->Fill(met->et());
00563           l1GctEtMissPhi_->Fill(met->phi());
00564         }
00565         l1GctEtMissOf_->Fill(met->overFlow());
00566       }
00567       if (met->overFlow() == 0 && met->et() > 0) l1GctEtMissOccBx_->Fill(met->bx(),met->et()); // for all BX
00568     }
00569   } else {
00570     edm::LogWarning("DataNotFound") << " Could not find l1EtMiss label was " << gctEnergySumsSource_ ;    
00571   }
00572 
00573   // Missing HT
00574   if (l1HtMiss.isValid()) { 
00575     for (L1GctHtMissCollection::const_iterator mht = l1HtMiss->begin(); mht != l1HtMiss->end(); mht++) {
00576       // only plot central BX
00577       if (mht->bx()==0) {
00578         if (mht->overFlow() == 0 && mht->et() > 0) {
00579           //Avoid problems with mht=0 candidates affecting MHT_PHI plots
00580           l1GctHtMiss_->Fill(mht->et());
00581           l1GctHtMissPhi_->Fill(mht->phi());
00582         }
00583         l1GctHtMissOf_->Fill(mht->overFlow());
00584       }
00585       if (mht->overFlow() == 0 && mht->et() > 0) l1GctHtMissOccBx_->Fill(mht->bx(),mht->et()); // for all BX
00586     }
00587   } else {
00588     edm::LogWarning("DataNotFound") << " Could not find l1HtMiss label was " << gctEnergySumsSource_ ;    
00589   }
00590 
00591   // Missing ET HT correlations
00592   if (l1HtMiss.isValid() && l1EtMiss.isValid()) { 
00593     if (l1HtMiss->size() == l1EtMiss->size()) {
00594       for (unsigned i=0; i<l1HtMiss->size(); i++) {
00595         if (l1HtMiss->at(i).overFlow() == 0 && l1EtMiss->at(i).overFlow() == 0 && 
00596             l1HtMiss->at(i).bx() == 0 && l1EtMiss->at(i).bx() == 0) {
00597           // Avoid problems overflows and only plot central BX
00598           l1GctEtMissHtMissCorr_->Fill(l1EtMiss->at(i).et(),l1HtMiss->at(i).et());
00599           if (l1HtMiss->at(i).et() && l1EtMiss->at(i).et()){ // Don't plot phi if one or other is zero
00600             l1GctEtMissHtMissCorrPhi_->Fill(l1EtMiss->at(i).phi(),l1HtMiss->at(i).phi());
00601           }
00602         }
00603       }
00604     }
00605   } else {
00606     edm::LogWarning("DataNotFound") << " Could not find l1EtMiss or l1HtMiss label was " << gctEnergySumsSource_ ;    
00607   }
00608 
00609   // HT 
00610   if (l1EtHad.isValid()) {
00611     for (L1GctEtHadCollection::const_iterator ht = l1EtHad->begin(); ht != l1EtHad->end(); ht++) {
00612       // only plot central BX
00613       if (ht->bx()==0) {
00614         l1GctEtHad_->Fill(ht->et());
00615         l1GctEtHadOf_->Fill(ht->overFlow());
00616       }
00617       l1GctEtHadOccBx_->Fill(ht->bx(),ht->et()); // for all BX
00618     }
00619   } else {
00620     edm::LogWarning("DataNotFound") << " Could not find l1EtHad label was " << gctEnergySumsSource_ ;    
00621   }
00622 
00623   // Total ET
00624   if (l1EtTotal.isValid()) {
00625     for (L1GctEtTotalCollection::const_iterator et = l1EtTotal->begin(); et != l1EtTotal->end(); et++) {
00626       // only plot central BX
00627       if (et->bx()==0) {
00628         l1GctEtTotal_->Fill(et->et());
00629         l1GctEtTotalOf_->Fill(et->overFlow());
00630       }
00631       l1GctEtTotalOccBx_->Fill(et->bx(),et->et()); // for all BX
00632     }
00633   } else {
00634     edm::LogWarning("DataNotFound") << " Could not find l1EtTotal label was " << gctEnergySumsSource_ ;    
00635   }
00636 
00637   // Total ET HT correlations
00638   if (l1EtTotal.isValid() && l1EtHad.isValid()) { 
00639     if (l1EtTotal->size() == l1EtHad->size()) {
00640       for (unsigned i=0; i<l1EtHad->size(); i++) {
00641         if (l1EtHad->at(i).overFlow() == 0 && l1EtTotal->at(i).overFlow() == 0 && 
00642             l1EtHad->at(i).bx() == 0 && l1EtTotal->at(i).bx() == 0) {
00643           // Avoid problems overflows and only plot central BX
00644           l1GctEtTotalEtHadCorr_->Fill(l1EtTotal->at(i).et(),l1EtHad->at(i).et());
00645         }
00646       }
00647     }
00648   } else {
00649     edm::LogWarning("DataNotFound") << " Could not find l1EtTotal or l1EtHad label was " << gctEnergySumsSource_ ;    
00650   }
00651 
00652   //HF Ring Et Sums
00653   if (l1HFSums.isValid()) {
00654     for (L1GctHFRingEtSumsCollection::const_iterator hfs=l1HFSums->begin(); hfs!=l1HFSums->end(); hfs++){ 
00655       // only plot central BX
00656       if (hfs->bx()==0) {
00657         // Individual ring Et sums
00658         l1GctHFRing1ETSumPosEta_->Fill(hfs->etSum(0));
00659         l1GctHFRing1ETSumNegEta_->Fill(hfs->etSum(1));
00660         l1GctHFRing2ETSumPosEta_->Fill(hfs->etSum(2));
00661         l1GctHFRing2ETSumNegEta_->Fill(hfs->etSum(3));
00662         // Ratio of ring Et sums
00663         if (hfs->etSum(2)!=0) l1GctHFRingRatioPosEta_->Fill((hfs->etSum(0))/(hfs->etSum(2)));
00664         if (hfs->etSum(3)!=0) l1GctHFRingRatioNegEta_->Fill((hfs->etSum(1))/(hfs->etSum(3)));
00665         // Correlate positive and neagative eta
00666         l1GctHFRing1PosEtaNegEta_->Fill(hfs->etSum(0),hfs->etSum(1));
00667         l1GctHFRing2PosEtaNegEta_->Fill(hfs->etSum(2),hfs->etSum(3));
00668       }
00669       // Occupancy vs BX
00670       for (unsigned i=0; i<4; i++){
00671         l1GctHFRingETSumOccBx_->Fill(hfs->bx(),hfs->etSum(i));
00672       }
00673     }
00674   } else {    
00675     edm::LogWarning("DataNotFound") << " Could not find l1HFSums label was " << gctEnergySumsSource_ ;
00676   }
00677 
00678   // HF Ring Counts
00679   if (l1HFCounts.isValid()) {
00680     for (L1GctHFBitCountsCollection::const_iterator hfc=l1HFCounts->begin(); hfc!=l1HFCounts->end(); hfc++){ 
00681       // only plot central BX
00682       if (hfc->bx()==0) {
00683         // Individual ring counts
00684         l1GctHFRing1TowerCountPosEta_->Fill(hfc->bitCount(0));
00685         l1GctHFRing1TowerCountNegEta_->Fill(hfc->bitCount(1));
00686         l1GctHFRing2TowerCountPosEta_->Fill(hfc->bitCount(2));
00687         l1GctHFRing2TowerCountNegEta_->Fill(hfc->bitCount(3));
00688         // Correlate positive and negative eta
00689         l1GctHFRing1TowerCountPosEtaNegEta_->Fill(hfc->bitCount(0),hfc->bitCount(1));
00690         l1GctHFRing2TowerCountPosEtaNegEta_->Fill(hfc->bitCount(2),hfc->bitCount(3));
00691       }
00692       // Occupancy vs BX
00693       for (unsigned i=0; i<4; i++){
00694         l1GctHFRingTowerCountOccBx_->Fill(hfc->bx(),hfc->bitCount(i));
00695       }
00696     }
00697   } else {    
00698     edm::LogWarning("DataNotFound") << " Could not find l1HFCounts label was " << gctEnergySumsSource_ ;
00699   }
00700   
00701   // Isolated EM
00702   if (l1IsoEm.isValid()) {
00703     for (L1GctEmCandCollection::const_iterator ie=l1IsoEm->begin(); ie!=l1IsoEm->end(); ie++) {
00704       // only plot central BX
00705       if (ie->bx()==0) {
00706         l1GctIsoEmRank_->Fill(ie->rank());
00707         // only plot eta and phi maps for non-zero candidates
00708         if (ie->rank()){ 
00709           l1GctIsoEmRankEtaPhi_->Fill(ie->regionId().ieta(),ie->regionId().iphi(),ie->rank());
00710           l1GctIsoEmOccEtaPhi_->Fill(ie->regionId().ieta(),ie->regionId().iphi());
00711         }
00712       }
00713       if (ie->rank()) l1GctAllEmOccRankBx_->Fill(ie->bx(),ie->rank()); // for all BX
00714     }
00715   } else {
00716     edm::LogWarning("DataNotFound") << " Could not find l1IsoEm label was " << gctIsoEmSource_ ;
00717   } 
00718 
00719   // Non-isolated EM
00720   if (l1NonIsoEm.isValid()) { 
00721     for (L1GctEmCandCollection::const_iterator ne=l1NonIsoEm->begin(); ne!=l1NonIsoEm->end(); ne++) {
00722       // only plot central BX
00723       if (ne->bx()==0) {
00724         l1GctNonIsoEmRank_->Fill(ne->rank());
00725         // only plot eta and phi maps for non-zero candidates
00726         if (ne->rank()){ 
00727           l1GctNonIsoEmRankEtaPhi_->Fill(ne->regionId().ieta(),ne->regionId().iphi(),ne->rank());
00728           l1GctNonIsoEmOccEtaPhi_->Fill(ne->regionId().ieta(),ne->regionId().iphi());
00729         }
00730       }
00731       if (ne->rank()) l1GctAllEmOccRankBx_->Fill(ne->bx(),ne->rank()); // for all BX
00732     }
00733   } else {
00734     edm::LogWarning("DataNotFound") << " Could not find l1NonIsoEm label was " << gctNonIsoEmSource_ ;
00735   }     
00736 }
00737 
00738