CMS 3D CMS Logo

EcalGetLaserData Class Reference

#include <CondTools/Ecal/interface/EcalGetLaserData.h>

Inheritance diagram for EcalGetLaserData:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup)
 EcalGetLaserData (const edm::ParameterSet &iConfig)
 ~EcalGetLaserData ()

Private Member Functions

virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()

Private Attributes

std::map< std::string,
unsigned long long > 
m_cacheIDs
std::map< std::string,
std::string > 
m_records


Detailed Description

Definition at line 40 of file EcalGetLaserData.h.


Constructor & Destructor Documentation

EcalGetLaserData::EcalGetLaserData ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 58 of file EcalGetLaserData.cc.

References edm::ParameterSet::getParameter(), i, m_cacheIDs, m_records, ecalRecalibSequence_cff::record, ecalRecalibSequence_cff::tag, and HLT_VtxMuL3::toGet.

00058                                                                  :
00059   // m_timetype(iConfig.getParameter<std::string>("timetype")),
00060   m_cacheIDs(),
00061   m_records()
00062 {
00063   std::string container;
00064   std::string tag;
00065   std::string record;
00066 
00067   //m_firstRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("firstRun").c_str());
00068   //m_lastRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("lastRun").c_str());
00069 
00070   typedef std::vector< edm::ParameterSet > Parameters;
00071   Parameters toGet = iConfig.getParameter<Parameters>("toGet");
00072   for(Parameters::iterator i = toGet.begin(); i != toGet.end(); ++i) {
00073     container = i->getParameter<std::string>("container");
00074     record = i->getParameter<std::string>("record");
00075     m_cacheIDs.insert( std::make_pair(container, 0) );
00076     m_records.insert( std::make_pair(container, record) );
00077 
00078   } //now do what ever initialization is needed
00079 
00080 }

EcalGetLaserData::~EcalGetLaserData (  ) 

Definition at line 83 of file EcalGetLaserData.cc.

00084 {
00085  
00086    // do anything here that needs to be done at desctruction time
00087    // (e.g. close files, deallocate resources etc.)
00088 
00089 }


Member Function Documentation

void EcalGetLaserData::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 98 of file EcalGetLaserData.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::EventSetup::get(), EcalLaserAPDPNRatios::getLaserMap(), EcalCondObjectContainer< T >::getMap(), EcalLaserAPDPNRatios::getTimeMap(), EEDetId::hashedIndex(), EBDetId::hashedIndex(), i, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, m_records, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2, edm::ESHandle< T >::product(), ecalRecalibSequence_cff::record, HLT_VtxMuL3::recordName, EcalCondObjectContainer< T >::size(), EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2, cond::timestamp, EEDetId::validDetId(), and edm::Timestamp::value().

00099 {
00100   using namespace edm;
00101   
00102   // loop on offline DB conditions to be transferred as from config file 
00103   std::string container;
00104   std::string record;
00105   typedef std::map<std::string, std::string>::const_iterator recordIter;
00106   for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
00107     container = (*i).first;
00108     record = (*i).second;
00109     
00110     std::string recordName = m_records[container];
00111 
00112     
00113     if (container == "EcalLaserAPDPNRatios") {
00114       
00115       // get from offline DB the last valid laser set 
00116       edm::ESHandle<EcalLaserAPDPNRatios> handle;
00117       evtSetup.get<EcalLaserAPDPNRatiosRcd>().get(handle);
00118 
00119       // this is the offline object 
00120       EcalLaserAPDPNRatios::EcalLaserTimeStamp timestamp;
00121       EcalLaserAPDPNRatios::EcalLaserAPDPNpair apdpnpair;
00122             
00123       const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = handle.product()->getLaserMap(); 
00124       const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = handle.product()->getTimeMap(); 
00125 
00126       // loop through ecal barrel
00127       for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
00128         if(iEta==0) continue;
00129         for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
00130           
00131           EBDetId ebdetid(iEta,iPhi);
00132           int hi = ebdetid.hashedIndex();
00133           
00134           if (hi< (int)laserRatiosMap.size()) {
00135             apdpnpair = laserRatiosMap[hi];
00136             std::cout << "A sample value of APDPN pair EB : " 
00137                       << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 << endl;            
00138           } else {
00139             edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << endl;     
00140           }
00141           
00142         }
00143       }  
00144 
00145       // loop through ecal endcap      
00146       for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00147         for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00148 
00149           if (!EEDetId::validDetId(iX,iY,1))
00150             continue;
00151           
00152           EEDetId eedetidpos(iX,iY,1);
00153           int hi = eedetidpos.hashedIndex();
00154           
00155           if (hi< (int)laserRatiosMap.size()) {
00156             apdpnpair = laserRatiosMap[hi];
00157             std::cout << "A sample value of APDPN pair EE+ : " 
00158                       << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 << endl;
00159           } else {
00160             edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << endl;     
00161           }
00162           
00163           if (!EEDetId::validDetId(iX,iY,-1))
00164             continue;
00165           EEDetId eedetidneg(iX,iY,1);
00166           hi = eedetidneg.hashedIndex();
00167           
00168           if (hi< (int)laserRatiosMap.size()) {
00169             apdpnpair = laserRatiosMap[hi];
00170             std::cout << "A sample value of APDPN pair EE- : " 
00171                       << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 << endl;
00172           } else {
00173             edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << endl;     
00174           }
00175         }
00176       }
00177       
00178       for(int i=0; i<92; i++){
00179         timestamp = laserTimeMap[i];  
00180         std::cout << "A value of timestamp pair : "  
00181                   << i << " " << timestamp.t1.value() << " , " << timestamp.t2.value() << endl; 
00182       }
00183       
00184       std::cout <<".. just retrieved the last valid record from DB "<< endl;
00185 
00186     } else if(container == "EcalLaserAPDPNRatiosRef") { 
00187 
00188       // get from offline DB the last valid laser set 
00189       edm::ESHandle<EcalLaserAPDPNRatiosRef> handle;
00190       evtSetup.get<EcalLaserAPDPNRatiosRefRcd>().get(handle);
00191 
00192       EcalLaserAPDPNref apdpnref;      
00193       const EcalLaserAPDPNRatiosRefMap& laserRefMap = handle.product()->getMap(); 
00194       
00195       // first barrel
00196       for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
00197         if(iEta==0) continue;
00198         for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
00199           
00200           EBDetId ebdetid(iEta,iPhi);
00201           int hi = ebdetid.hashedIndex();
00202           
00203           if (hi< (int)laserRefMap.size()) {
00204             apdpnref = laserRefMap[hi];
00205             cout << "A sample value of APDPN Reference value EB : "  
00206                  << hi << " : " << apdpnref << endl;              
00207           } else { 
00208             edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << endl;     
00209           }               
00210         }
00211       }
00212       
00213       // now for endcap
00214       for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00215         for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00216 
00217           if (!EEDetId::validDetId(iX,iY,1))
00218             continue;
00219           
00220           EEDetId eedetidpos(iX,iY,1);
00221           int hi = eedetidpos.hashedIndex();
00222           
00223           if (hi< (int)laserRefMap.size()) {
00224             apdpnref = laserRefMap[hi];
00225             cout << "A sample value of APDPN Reference value EE+ : "  
00226                  << hi << " : " << apdpnref << endl;                              
00227             
00228           } else { 
00229             edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << endl;     
00230           }
00231           
00232           if (!EEDetId::validDetId(iX,iY,-1))
00233             continue;
00234           EEDetId eedetidneg(iX,iY,-1);
00235           hi = eedetidneg.hashedIndex();
00236           
00237           if (hi< (int)laserRefMap.size()) {
00238             apdpnref = laserRefMap[hi];
00239             cout << "A sample value of APDPN Reference value EE- : "  
00240                  << hi << " : " << apdpnref << endl;             
00241           } else { 
00242             edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << endl;     
00243           }           
00244         }
00245       }
00246       
00247       cout << "... just retrieved the last valid record from DB "<< endl;
00248       
00249     } else if (container == "EcalLaserAlphas") { 
00250 
00251       // get from offline DB the last valid laser set 
00252       edm::ESHandle<EcalLaserAlphas> handle;
00253       evtSetup.get<EcalLaserAlphasRcd>().get(handle);
00254 
00255       // this is the offline object 
00256       EcalLaserAlpha alpha;     
00257       const EcalLaserAlphaMap& laserAlphaMap = handle.product()->getMap(); // map of apdpns
00258 
00259       // first barrel
00260       for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
00261         if(iEta==0) continue;
00262         for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
00263           
00264           EBDetId ebdetid(iEta,iPhi);
00265           int hi = ebdetid.hashedIndex();
00266           
00267           if (hi< (int)laserAlphaMap.size()) {
00268             alpha = laserAlphaMap[hi];
00269             cout << " A sample value of Alpha value EB : " << hi << " : " << alpha << endl;
00270           } else {
00271             edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << endl;     
00272           }       
00273         }
00274       }
00275       
00276       // next endcap
00277       for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00278         for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00279 
00280           if (!EEDetId::validDetId(iX,iY,1))
00281             continue;
00282 
00283           EEDetId eedetidpos(iX,iY,1);
00284           int hi = eedetidpos.hashedIndex();
00285           
00286           if (hi< (int)laserAlphaMap.size()) {
00287             alpha = laserAlphaMap[hi];
00288             cout << " A sample value of Alpha value EE+ : " << hi << " : " << alpha << endl;  
00289           } else {
00290             edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << endl;     
00291           }                   
00292           
00293 
00294           if (!EEDetId::validDetId(iX,iY,-1))
00295             continue;
00296           EEDetId eedetidneg(iX,iY,-1);
00297           hi = eedetidneg.hashedIndex();
00298           
00299           if (hi< (int)laserAlphaMap.size()) {
00300             alpha = laserAlphaMap[hi];
00301             cout << " A sample value of Alpha value EE- : " << hi << " : " << alpha << endl;
00302           } else {
00303             edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << endl;     
00304           }       
00305         }
00306       }
00307       
00308       cout <<"... just retrieved the last valid record from DB "<< endl;
00309 
00310     } else {
00311       edm::LogError("EcalGetLaserData") << "Cannot retrieve for container: " 
00312                                         << container << std::endl;           
00313     }
00314     
00315   }
00316 
00317 }

void EcalGetLaserData::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 322 of file EcalGetLaserData.cc.

00323 {
00324 }

void EcalGetLaserData::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 328 of file EcalGetLaserData.cc.

00328                          {
00329 }


Member Data Documentation

std::map<std::string, unsigned long long> EcalGetLaserData::m_cacheIDs [private]

Definition at line 52 of file EcalGetLaserData.h.

Referenced by EcalGetLaserData().

std::map<std::string, std::string> EcalGetLaserData::m_records [private]

Definition at line 53 of file EcalGetLaserData.h.

Referenced by analyze(), and EcalGetLaserData().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:39 2009 for CMSSW by  doxygen 1.5.4