CMS 3D CMS Logo

L1THCALTPG.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1THCALTPG.cc
00003  *
00004  * $Date: 2008/03/20 19:38:25 $
00005  * $Revision: 1.12 $
00006  * \author J. Berryhill
00007  *
00008  * $Log: L1THCALTPG.cc,v $
00009  * Revision 1.12  2008/03/20 19:38:25  berryhil
00010  *
00011  *
00012  * organized message logger
00013  *
00014  * Revision 1.11  2008/03/14 20:35:46  berryhil
00015  *
00016  *
00017  * stripped out obsolete parameter settings
00018  *
00019  * rpc tpg restored with correct dn access and dbe handling
00020  *
00021  * Revision 1.10  2008/03/12 17:24:24  berryhil
00022  *
00023  *
00024  * eliminated log files, truncated HCALTPGXana histo output
00025  *
00026  * Revision 1.9  2008/03/01 00:40:00  lat
00027  * DQM core migration.
00028  *
00029  * Revision 1.8  2007/12/21 17:41:21  berryhil
00030  *
00031  *
00032  * try/catch removal
00033  *
00034  * Revision 1.7  2007/12/05 16:48:53  berryhil
00035  *
00036  *
00037  * plug in L1THCALTPG, L1TECALTPG, L1TGCT, L1TRCT, GCTMonitor
00038  *
00039  * Revision 1.6  2007/11/19 15:08:22  lorenzo
00040  * changed top folder name
00041  *
00042  * Revision 1.5  2007/07/19 16:48:23  berryhil
00043  *
00044  *
00045  *
00046  * seal plugin re-migration
00047  * add status digis to L1TCSCTF
00048  * HCALTPG data format migration (fiberChan)
00049  * GT data format migration (PSB)
00050  *
00051  * Revision 1.4  2007/06/12 19:32:53  berryhil
00052  *
00053  *
00054  * config files now include hcal tpg monitoring modules
00055  *
00056  * Revision 1.3  2007/02/23 22:00:16  wittich
00057  * add occ (weighted and unweighted) and rank histos
00058  *
00059  *
00060  */
00061 
00062 #include "DQM/L1TMonitor/interface/L1THCALTPG.h"
00063 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00064 #include "DQMServices/Core/interface/DQMStore.h"
00065 
00066 using namespace edm;
00067 
00068 
00069 // Local definitions for the limits of the histograms
00070 const unsigned int RTPBINS = 101;
00071 const float RTPMIN = -0.5;
00072 const float RTPMAX = 100.5;
00073 
00074 const unsigned int TPPHIBINS = 72;
00075 const float TPPHIMIN = 0.5;
00076 const float TPPHIMAX = 72.5;
00077 
00078 const unsigned int TPETABINS = 65;
00079 const float TPETAMIN = -32.5;
00080 const float TPETAMAX = 32.5;
00081 
00082 
00083 L1THCALTPG::L1THCALTPG(const ParameterSet& ps)
00084   : hcaltpgSource_( ps.getParameter< InputTag >("hcaltpgSource") )
00085 {
00086 
00087   // verbosity switch
00088   verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00089 
00090   if(verbose_) std::cout << "L1THCALTPG: constructor...." << std::endl;
00091 
00092 
00093   dbe = NULL;
00094   if ( ps.getUntrackedParameter<bool>("DQMStore", false) ) 
00095   {
00096     dbe = Service<DQMStore>().operator->();
00097     dbe->setVerbose(0);
00098   }
00099 
00100   outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
00101   if ( outputFile_.size() != 0 ) {
00102     std::cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << std::endl;
00103   }
00104 
00105   bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
00106   if(disable){
00107     outputFile_="";
00108   }
00109 
00110 
00111   if ( dbe !=NULL ) {
00112     dbe->setCurrentFolder("L1T/L1THCALTPG");
00113   }
00114 
00115 
00116 }
00117 
00118 L1THCALTPG::~L1THCALTPG()
00119 {
00120 }
00121 
00122 void L1THCALTPG::beginJob(const EventSetup& c)
00123 {
00124 
00125   nev_ = 0;
00126 
00127   // get hold of back-end interface
00128   DQMStore* dbe = 0;
00129   dbe = Service<DQMStore>().operator->();
00130 
00131   if ( dbe ) {
00132     dbe->setCurrentFolder("L1T/L1THCALTPG");
00133     dbe->rmdir("L1T/L1THCALTPG");
00134   }
00135 
00136 
00137   if ( dbe ) 
00138   {
00139     dbe->setCurrentFolder("L1T/L1THCALTPG");
00140     hcalTpEtEtaPhi_ = 
00141       dbe->book2D("HcalTpEtEtaPhi", "HCAL TP E_{T}", TPPHIBINS, TPPHIMIN,
00142                   TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00143     hcalTpOccEtaPhi_ =
00144         dbe->book2D("HcalTpOccEtaPhi", "HCAL TP OCCUPANCY", TPPHIBINS,
00145                     TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00146     hcalTpRank_ =
00147       dbe->book1D("HcalTpRank", "HCAL TP RANK", RTPBINS, RTPMIN, RTPMAX);
00148     
00149   }  
00150 }
00151 
00152 
00153 void L1THCALTPG::endJob(void)
00154 {
00155   if(verbose_) std::cout << "L1THCALTPG: end job...." << std::endl;
00156   LogInfo("EndJob") << "analyzed " << nev_ << " events"; 
00157 
00158  if ( outputFile_.size() != 0  && dbe ) dbe->save(outputFile_);
00159 
00160  return;
00161 }
00162 
00163 void L1THCALTPG::analyze(const Event& e, const EventSetup& c)
00164 {
00165   nev_++; 
00166   if(verbose_) std::cout << "L1THCALTPG: analyze...." << std::endl;
00167 
00168   edm::Handle<HcalTrigPrimDigiCollection> hcalTpgs;
00169   e.getByLabel(hcaltpgSource_, hcalTpgs);
00170   
00171   if (!hcalTpgs.isValid()) {
00172     edm::LogInfo("DataNotFound") << "can't find HCAL TPG's with label "
00173                                << hcaltpgSource_.label() ;
00174     return;
00175   }
00176 //
00177 //  std::cout << "--> event  " << hcalTpgs->size() << std::endl;
00178 //   int j = 0;
00179   for ( HcalTrigPrimDigiCollection::const_iterator i = hcalTpgs->begin();
00180         i != hcalTpgs->end(); ++i ) {
00181 
00182     if (verbose_)
00183       {
00184   std::cout << "size  " <<  i->size() << std::endl;
00185   std::cout << "iphi  " <<  i->id().iphi() << std::endl;
00186   std::cout << "ieta  " <<  i->id().ieta() << std::endl;
00187   std::cout << "compressed Et  " <<  i->SOI_compressedEt() << std::endl;
00188   std::cout << "FG bit  " <<  i->SOI_fineGrain() << std::endl;
00189   std::cout << "raw  " <<  i->t0().raw() << std::endl;
00190   std::cout << "raw Et " <<  i->t0().compressedEt() << std::endl;
00191   std::cout << "raw FG " <<  i->t0().fineGrain() << std::endl;
00192   //  std::cout << "raw fiber " <<  i->t0().fiber() << std::endl;
00193   //  std::cout << "raw fiberChan " <<  i->t0().fiberChan() << std::endl;
00194   //  std::cout << "raw fiberAndChan " <<  i->t0().fiberAndChan() << std::endl;
00195       }
00196 
00197    int e = i->SOI_compressedEt();
00198     if ( e != 0 ) {
00199       // occupancy maps (weighted and unweighted
00200       hcalTpOccEtaPhi_->Fill(i->id().iphi(), i->id().ieta());
00201       hcalTpEtEtaPhi_ ->Fill(i->id().iphi(), i->id().ieta(),
00202                              i->SOI_compressedEt());
00203       // et
00204       hcalTpRank_->Fill(i->SOI_compressedEt());
00205       //std::cout << j++ << " : " << i->SOI_compressedEt() << std::endl;
00206     }
00207   }
00208 
00209 }
00210 

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