CMS 3D CMS Logo

L1TECALTPG.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1TECALTPG.cc
00003  *
00004  * $Date: 2008/03/20 19:38:25 $
00005  * $Revision: 1.13 $
00006  * \author J. Berryhill
00007  *
00008  * - initial version stolen from GCTMonnitor (thanks!) (wittich 02/07)
00009  *
00010  * $Log: L1TECALTPG.cc,v $
00011  * Revision 1.13  2008/03/20 19:38:25  berryhil
00012  *
00013  *
00014  * organized message logger
00015  *
00016  * Revision 1.12  2008/03/18 20:31:20  berryhil
00017  *
00018  *
00019  * update of ecal tpg dqm
00020  *
00021  * Revision 1.11  2008/03/14 20:35:46  berryhil
00022  *
00023  *
00024  * stripped out obsolete parameter settings
00025  *
00026  * rpc tpg restored with correct dn access and dbe handling
00027  *
00028  * Revision 1.10  2008/03/12 17:24:24  berryhil
00029  *
00030  *
00031  * eliminated log files, truncated HCALTPGXana histo output
00032  *
00033  * Revision 1.9  2008/03/01 00:40:00  lat
00034  * DQM core migration.
00035  *
00036  * Revision 1.8  2007/12/21 17:41:20  berryhil
00037  *
00038  *
00039  * try/catch removal
00040  *
00041  * Revision 1.7  2007/11/19 15:08:22  lorenzo
00042  * changed top folder name
00043  *
00044  * Revision 1.6  2007/08/29 14:02:47  wittich
00045  * split into barrel and endcap
00046  *
00047  * Revision 1.5  2007/05/25 15:45:48  berryhil
00048  *
00049  *
00050  *
00051  * added exception handling for each edm Handle
00052  * updated cfg and cff to reflect recent usage at point 5
00053  *
00054  * Revision 1.4  2007/02/22 19:43:53  berryhil
00055  *
00056  *
00057  *
00058  * InputTag parameters added for all modules
00059  *
00060  * Revision 1.3  2007/02/20 22:49:00  wittich
00061  * - change from getByType to getByLabel in ECAL TPG,
00062  *   and make it configurable.
00063  * - fix problem in the GCT with incorrect labels. Not the ultimate
00064  *   solution - will probably have to go to many labels.
00065  *
00066  * Revision 1.2  2007/02/19 22:07:26  wittich
00067  * - Added three monitorables to the ECAL TPG monitoring (from GCTMonitor)
00068  * - other minor tweaks in GCT, etc
00069  *
00070  */
00071 
00072 #include "DQM/L1TMonitor/interface/L1TECALTPG.h"
00073 
00074 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00075 #include "DQMServices/Core/interface/DQMStore.h"
00076 
00077 // end of header files 
00078 using namespace edm;
00079 
00080 // Local definitions for the limits of the histograms
00081 const unsigned int RTPBINS = 101;
00082 const float RTPMIN = -0.5;
00083 const float RTPMAX = 100.5;
00084 
00085 const unsigned int TPPHIBINS = 72;
00086 const float TPPHIMIN = 0.5;
00087 const float TPPHIMAX = 72.5;
00088 
00089 const unsigned int TPETABINS = 65;
00090 const float TPETAMIN = -32.5;
00091 const float TPETAMAX = 32.5;
00092 
00093 
00094 L1TECALTPG::L1TECALTPG(const ParameterSet & ps):
00095   ecaltpgSourceB_(ps.getParameter<edm::InputTag>("ecaltpgSourceB")),
00096   ecaltpgSourceE_(ps.getParameter<edm::InputTag>("ecaltpgSourceE"))
00097 {
00098 
00099   // verbosity switch
00100   verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
00101 
00102   // ecal endcap switch
00103   enableEE_ = ps.getUntrackedParameter < bool > ("enableEE", false);
00104 
00105   if (verbose_)
00106     std::cout << "L1TECALTPG: constructor...." << std::endl;
00107 
00108 
00109   dbe = NULL;
00110   if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
00111     dbe = Service < DQMStore > ().operator->();
00112     dbe->setVerbose(0);
00113   }
00114 
00115   outputFile_ =
00116       ps.getUntrackedParameter < std::string > ("outputFile", "");
00117   if (outputFile_.size() != 0) {
00118     std::cout << "L1T Monitoring histograms will be saved to " 
00119               << outputFile_ << std::endl;
00120   }
00121 
00122   bool disable =
00123       ps.getUntrackedParameter < bool > ("disableROOToutput", false);
00124   if (disable) {
00125     outputFile_ = "";
00126   }
00127 
00128 
00129   if (dbe != NULL) {
00130     dbe->setCurrentFolder("L1T/L1TECALTPG");
00131   }
00132 
00133 
00134 }
00135 
00136 L1TECALTPG::~L1TECALTPG()
00137 {
00138 }
00139 
00140 void L1TECALTPG::beginJob(const EventSetup & c)
00141 {
00142 
00143   nev_ = 0;
00144 
00145   // get hold of back-end interface
00146   DQMStore *dbe = 0;
00147   dbe = Service < DQMStore > ().operator->();
00148 
00149   if (dbe) {
00150     dbe->setCurrentFolder("L1T/L1TECALTPG");
00151     dbe->rmdir("L1T/L1TECALTPG");
00152   }
00153 
00154 
00155   if (dbe) {
00156     dbe->setCurrentFolder("L1T/L1TECALTPG");
00157     ecalTpEtEtaPhiB_ = 
00158       dbe->book2D("EcalTpEtEtaPhiB", "ECAL TP E_{T} Barrel", TPPHIBINS, 
00159                   TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00160     ecalTpOccEtaPhiB_ =
00161         dbe->book2D("EcalTpOccEtaPhiB", "ECAL TP OCCUPANCY Barrel", TPPHIBINS,
00162                     TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00163     ecalTpRankB_ =
00164       dbe->book1D("EcalTpRankB", "ECAL TP RANK Barrel", RTPBINS, RTPMIN,
00165                   RTPMAX);
00166 
00167     ecalTpEtEtaPhiE_ = 
00168       dbe->book2D("EcalTpEtEtaPhiE", "ECAL TP E_{T} Endcap", TPPHIBINS, 
00169                   TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00170     ecalTpOccEtaPhiE_ =
00171         dbe->book2D("EcalTpOccEtaPhiE", "ECAL TP OCCUPANCY Endcap", TPPHIBINS,
00172                     TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00173     ecalTpRankE_ =
00174       dbe->book1D("EcalTpRankE", "ECAL TP RANK Endcap", RTPBINS, RTPMIN,
00175                   RTPMAX);
00176 
00177   }
00178 }
00179 
00180 
00181 void L1TECALTPG::endJob(void)
00182 {
00183   if (verbose_)
00184     std::cout << "L1TECALTPG: end job...." << std::endl;
00185   LogInfo("EndJob") << "analyzed " << nev_ << " events";
00186 
00187   if (outputFile_.size() != 0 && dbe)
00188     dbe->save(outputFile_);
00189 
00190   return;
00191 }
00192 
00193 void L1TECALTPG::analyze(const Event & e, const EventSetup & c)
00194 {
00195   nev_++;
00196   if (verbose_) {
00197     std::cout << "L1TECALTPG: analyze...." << std::endl;
00198   }
00199 
00200   // Get the ECAL TPGs
00201   edm::Handle < EcalTrigPrimDigiCollection > eeTP;
00202   edm::Handle < EcalTrigPrimDigiCollection > ebTP;
00203   //  e.getByType(ebTP);
00204   e.getByLabel(ecaltpgSourceB_,ebTP);
00205   e.getByLabel(ecaltpgSourceE_,eeTP);
00206   
00207   if (!eeTP.isValid() && enableEE_) 
00208   {
00209     edm::LogInfo("DataNotFound") << "can't find EcalTrigPrimCollection with "
00210       " endcap label " << ecaltpgSourceE_.label() ;
00211     return;
00212   }  
00213   if (!ebTP.isValid()) 
00214   {
00215     edm::LogInfo("DataNotFound") << "can't find EcalTrigPrimCollection with "
00216       " barrel label " << ecaltpgSourceB_.label() ;
00217     return;
00218   }
00219 
00220   // Fill the ECAL TPG histograms
00221   if ( verbose_ ) {
00222     std::cout << "L1TECALTPG: barrel size is " << ebTP->size() << std::endl;
00223     std::cout << "L1TECALTPG: endcap size is " << eeTP->size() << std::endl;
00224   }
00225   
00226   for (EcalTrigPrimDigiCollection::const_iterator iebTP = ebTP->begin();
00227        iebTP != ebTP->end(); iebTP++) {
00228     if ( verbose_ ) {
00229       std::cout << "barrel: " << iebTP->id().iphi() << ", " 
00230                 << iebTP->id().ieta()
00231                 << std::endl;
00232     }
00233     ecalTpEtEtaPhiB_->Fill(iebTP->id().iphi(), iebTP->id().ieta(),
00234                           iebTP->compressedEt());
00235     ecalTpOccEtaPhiB_->Fill(iebTP->id().iphi(), iebTP->id().ieta());
00236     ecalTpRankB_->Fill(iebTP->compressedEt());
00237 
00238   }
00239   
00240   if (enableEE_){
00241   // endcap
00242   for (EcalTrigPrimDigiCollection::const_iterator ieeTP = eeTP->begin();
00243        ieeTP != eeTP->end(); ieeTP++) {
00244     if ( verbose_ ) {
00245       std::cout << "endcap: " << ieeTP->id().iphi() << ", " 
00246                 << ieeTP->id().ieta()
00247                 << std::endl;
00248     }
00249     ecalTpEtEtaPhiE_->Fill(ieeTP->id().iphi(), ieeTP->id().ieta(),
00250                           ieeTP->compressedEt());
00251     ecalTpOccEtaPhiE_->Fill(ieeTP->id().iphi(), ieeTP->id().ieta());
00252     ecalTpRankE_->Fill(ieeTP->compressedEt());
00253 
00254   }
00255   }
00256 
00257 }

Generated on Tue Jun 9 17:33:11 2009 for CMSSW by  doxygen 1.5.4