CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/L1TMonitor/src/L1TCSCTPG.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1TCSCTPG.cc
00003  *
00004  * $Date: 2009/11/19 14:36:35 $
00005  * $Revision: 1.12 $
00006  * \author J. Berryhill
00007  *
00008  */
00009 
00010 #include "DQM/L1TMonitor/interface/L1TCSCTPG.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012 
00013 using namespace std;
00014 using namespace edm;
00015 
00016 L1TCSCTPG::L1TCSCTPG(const ParameterSet& ps)
00017   : csctpgSource_( ps.getParameter< InputTag >("csctpgSource") )
00018 {
00019 
00020   // verbosity switch
00021   verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00022 
00023   if(verbose_) cout << "L1TCSCTPG: constructor...." << endl;
00024 
00025 
00026   dbe = NULL;
00027   if ( ps.getUntrackedParameter<bool>("DQMStore", false) ) 
00028   {
00029     dbe = Service<DQMStore>().operator->();
00030     dbe->setVerbose(0);
00031   }
00032 
00033   outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
00034   if ( outputFile_.size() != 0 ) {
00035     cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
00036   }
00037 
00038   bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
00039   if(disable){
00040     outputFile_="";
00041   }
00042 
00043 
00044   if ( dbe !=NULL ) {
00045     dbe->setCurrentFolder("L1T/L1TCSCTPG");
00046   }
00047 
00048 
00049 }
00050 
00051 L1TCSCTPG::~L1TCSCTPG()
00052 {
00053 }
00054 
00055 void L1TCSCTPG::beginJob(void)
00056 {
00057 
00058   nev_ = 0;
00059 
00060   // get hold of back-end interface
00061   DQMStore* dbe = 0;
00062   dbe = Service<DQMStore>().operator->();
00063 
00064   if ( dbe ) {
00065     dbe->setCurrentFolder("L1T/L1TCSCTPG");
00066     dbe->rmdir("L1T/L1TCSCTPG");
00067   }
00068 
00069 
00070   if ( dbe ) 
00071   {
00072     dbe->setCurrentFolder("L1T/L1TCSCTPG");
00073     
00074     csctpgpattern = dbe->book1D("CSC TPG hit pattern", 
00075        "CSC TPG hit pattern", 8, -0.5, 7.5 ) ;
00076     csctpgquality = dbe->book1D("CSC TPG quality", 
00077        "CSC TPG quality", 16, 0.5, 16.5 ) ;
00078     csctpgwg = dbe->book1D("CSC TPG wire group", 
00079        "CSC TPG wire group", 116, -0.5, 115.5 ) ;
00080     csctpgstrip = dbe->book1D("CSC TPG strip", 
00081        "CSC TPG strip", 160, -0.5, 159.5 ) ;
00082     csctpgstriptype = dbe->book1D("CSC TPG strip type", 
00083        "CSC TPG strip type", 2, 0.5, 1.5 ) ;
00084     csctpgbend = dbe->book1D("CSC TPG bend", 
00085        "CSC TPG bend", 3, 0.5, 2.5 ) ;
00086     csctpgbx = dbe->book1D("CSC TPG bx", 
00087        "CSC TPG bx", 20, -0.5, 19.5 ) ;
00088 
00089 
00090   }  
00091 }
00092 
00093 
00094 void L1TCSCTPG::endJob(void)
00095 {
00096   if(verbose_) cout << "L1TCSCTPG: end job...." << endl;
00097   LogInfo("EndJob") << "analyzed " << nev_ << " events"; 
00098 
00099  if ( outputFile_.size() != 0  && dbe ) dbe->save(outputFile_);
00100 
00101  return;
00102 }
00103 
00104 void L1TCSCTPG::analyze(const Event& e, const EventSetup& c)
00105 {
00106   nev_++; 
00107   if(verbose_) cout << "L1TCSCTPG: analyze...." << endl;
00108 
00109 
00110   Handle<CSCCorrelatedLCTDigiCollection> pCSCTPGcorrlcts;
00111   e.getByLabel(csctpgSource_,pCSCTPGcorrlcts);
00112     
00113   if (!pCSCTPGcorrlcts.isValid()) {
00114     edm::LogInfo("DataNotFound") << "can't find CSCCorrelatedLCTDigiCollection with label "
00115                                << csctpgSource_.label() ;
00116     return;
00117   }
00118   
00119 
00120   for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator cscItr1 = pCSCTPGcorrlcts->begin();
00121        cscItr1 != pCSCTPGcorrlcts->end();
00122        cscItr1++)
00123     {
00124      CSCCorrelatedLCTDigiCollection::Range range1 = pCSCTPGcorrlcts->get((*cscItr1).first);
00125      for (CSCCorrelatedLCTDigiCollection::const_iterator lctItr1 = range1.first;
00126            lctItr1 != range1.second;
00127            lctItr1++) 
00128         {
00129 
00130 
00131      csctpgpattern->Fill(lctItr1->getCLCTPattern());
00132     if (verbose_)
00133        {     
00134      std::cout << "CSC TPG CLCT pattern " << lctItr1->getCLCTPattern()  
00135             << std::endl;
00136        }
00137 
00138      csctpgquality->Fill(lctItr1->getQuality());     
00139      if (verbose_)
00140        {
00141      std::cout << "CSC LCT quality " << lctItr1->getQuality()  
00142             << std::endl;
00143        }
00144 
00145      csctpgwg->Fill(lctItr1->getKeyWG());     
00146      if (verbose_)
00147         {
00148      std::cout << "CSC LCT wire group " << lctItr1->getKeyWG()  
00149             << std::endl;
00150         }
00151 
00152      csctpgstrip->Fill(lctItr1->getStrip());     
00153      if (verbose_)
00154         {     
00155      std::cout << "CSC LCT strip " << lctItr1->getStrip()  
00156             << std::endl;
00157         }
00158 
00159      csctpgstriptype->Fill(lctItr1->getStripType());    
00160      if (verbose_)
00161        { 
00162      std::cout << "CSC LCT strip type" << lctItr1->getStripType()  
00163             << std::endl;
00164        }
00165 
00166      csctpgbend->Fill(lctItr1->getBend());     
00167      if (verbose_)
00168        {
00169      std::cout << "CSC LCT bend " << lctItr1->getBend()  
00170             << std::endl;
00171        }
00172 
00173      csctpgbx->Fill(lctItr1->getBX());
00174      if (verbose_)
00175         {     
00176      std::cout << "CSC LCT bx " << lctItr1->getBX()  
00177             << std::endl;
00178         }
00179 
00180      }
00181     }
00182 
00183    
00184  
00185 }
00186