CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CondTools/SiStrip/plugins/SiStripFedCablingReader.cc

Go to the documentation of this file.
00001 #include "CondTools/SiStrip/plugins/SiStripFedCablingReader.h"
00002 #include "CalibFormats/SiStripObjects/interface/SiStripFecCabling.h"
00003 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00004 #include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h"
00005 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
00006 #include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h"
00007 #include "CalibTracker/Records/interface/SiStripFecCablingRcd.h"
00008 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00009 #include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 #include <iostream>
00013 #include <sstream>
00014 
00015 // -----------------------------------------------------------------------------
00016 // 
00017 SiStripFedCablingReader::SiStripFedCablingReader( const edm::ParameterSet& pset ) :
00018   printFecCabling_( pset.getUntrackedParameter<bool>("PrintFecCabling",false) ),
00019   printDetCabling_( pset.getUntrackedParameter<bool>("PrintDetCabling",false) ),
00020   printRegionCabling_( pset.getUntrackedParameter<bool>("PrintRegionCabling",false) )
00021 {;}
00022 
00023 // -----------------------------------------------------------------------------
00024 // 
00025 void SiStripFedCablingReader::beginRun( const edm::Run& run, 
00026                                         const edm::EventSetup& setup ) {
00027 
00028   edm::eventsetup::EventSetupRecordKey FedRecordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiStripFedCablingRcd"));
00029   edm::eventsetup::EventSetupRecordKey FecRecordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiStripFecCablingRcd"));
00030   edm::eventsetup::EventSetupRecordKey DetRecordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiStripDetCablingRcd"));
00031   edm::eventsetup::EventSetupRecordKey RegRecordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiStripRegionCablingRcd"));
00032 
00033   bool FedRcdfound=setup.find(FedRecordKey) != 0?true:false;  
00034   bool FecRcdfound=setup.find(FecRecordKey) != 0?true:false;  
00035   bool DetRcdfound=setup.find(DetRecordKey) != 0?true:false;  
00036   bool RegRcdfound=setup.find(RegRecordKey) != 0?true:false;  
00037 
00038   edm::ESHandle<SiStripFedCabling> fed;
00039   if(FedRcdfound){
00040     edm::LogVerbatim("SiStripFedCablingReader") 
00041       << "[SiStripFedCablingReader::" << __func__ << "]"
00042       << " Retrieving FED cabling...";
00043     setup.get<SiStripFedCablingRcd>().get( fed ); 
00044   }
00045 
00046   edm::ESHandle<SiStripFecCabling> fec;
00047   if(FecRcdfound){
00048     edm::LogVerbatim("SiStripFedCablingReader") 
00049       << "[SiStripFedCablingReader::" << __func__ << "]"
00050       << " Retrieving FEC cabling...";
00051       setup.get<SiStripFecCablingRcd>().get( fec ); 
00052   }
00053 
00054   edm::ESHandle<SiStripDetCabling> det;
00055   if(DetRcdfound){
00056     edm::LogVerbatim("SiStripFedCablingReader") 
00057       << "[SiStripFedCablingReader::" << __func__ << "]"
00058       << " Retrieving DET cabling...";
00059     setup.get<SiStripDetCablingRcd>().get( det ); 
00060   }
00061 
00062   edm::ESHandle<SiStripRegionCabling> region;
00063   if(RegRcdfound){
00064     edm::LogVerbatim("SiStripFedCablingReader") 
00065       << "[SiStripFedCablingReader::" << __func__ << "]"
00066       << " Retrieving REGION cabling...";
00067     setup.get<SiStripRegionCablingRcd>().get( region ); 
00068   }
00069 
00070   if ( !fed.isValid() ) {
00071     edm::LogError("SiStripFedCablingReader") 
00072       << " Invalid handle to FED cabling object: ";
00073     return;
00074   }
00075 
00076   {
00077     std::stringstream ss;
00078     ss << "[SiStripFedCablingReader::" << __func__ << "]"
00079        << " VERBOSE DEBUG" << std::endl;
00080     if(FedRcdfound)fed->print( ss );
00081     ss << std::endl;
00082     if ( FecRcdfound && printFecCabling_ && fec.isValid() ) { fec->print( ss ); }
00083     ss << std::endl;
00084     if ( DetRcdfound && printDetCabling_ && det.isValid() ) { det->print( ss ); }
00085     ss << std::endl;
00086     if ( RegRcdfound && printRegionCabling_ && region.isValid() ) { region->print( ss ); }
00087     ss << std::endl;
00088     edm::LogVerbatim("SiStripFedCablingReader") << ss.str();
00089   }
00090   
00091   if(FedRcdfound){
00092     std::stringstream ss;
00093     ss << "[SiStripFedCablingReader::" << __func__ << "]"
00094        << " TERSE DEBUG" << std::endl;
00095     fed->terse( ss );
00096     ss << std::endl;
00097     edm::LogVerbatim("SiStripFedCablingReader") << ss.str();
00098   }
00099   
00100   if(FedRcdfound){
00101     std::stringstream ss;
00102     ss << "[SiStripFedCablingReader::" << __func__ << "]"
00103        << " SUMMARY DEBUG" << std::endl;
00104     fed->summary( ss );
00105     ss << std::endl;
00106     edm::LogVerbatim("SiStripFedCablingReader") << ss.str();
00107   }
00108   
00109 }