CMS 3D CMS Logo

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

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