Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:56

0001 /*----------------------------------------------------------------------
0002 
0003 Toy EDProducers and EDProducts for testing purposes only.
0004 
0005 ----------------------------------------------------------------------*/
0006 
0007 #include <stdexcept>
0008 #include <string>
0009 #include <iostream>
0010 #include <fstream>
0011 #include "FWCore/Framework/interface/EDAnalyzer.h"
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/Framework/interface/MakerMacros.h"
0015 
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 
0019 #include "CondFormats/CSCObjects/interface/CSCDBGasGainCorrection.h"
0020 #include "CondFormats/DataRecord/interface/CSCDBGasGainCorrectionRcd.h"
0021 
0022 namespace edmtest
0023 {
0024   class CSCGasGainCorrectionDBReadAnalyzer : public edm::EDAnalyzer
0025   {
0026   public:
0027     explicit  CSCGasGainCorrectionDBReadAnalyzer(edm::ParameterSet const& p) 
0028     { }
0029     explicit  CSCGasGainCorrectionDBReadAnalyzer(int i) 
0030     { }
0031     virtual ~ CSCGasGainCorrectionDBReadAnalyzer() { }
0032     virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
0033   private:
0034   };
0035   
0036   void
0037   CSCGasGainCorrectionDBReadAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context)
0038   {
0039     //const float epsilon = 1.E-09; // some 'small' value to test for non-positive values.
0040     //*    const float epsilon = 20; // some 'small' value to test 
0041 
0042     using namespace edm::eventsetup;
0043     std::ofstream DBGasGainCorrectionFile("dbGasGainCorrection.dat",std::ios::out);
0044     int counter=0;
0045 
0046     std::cout <<" I AM IN RUN NUMBER "<<e.id().run() <<std::endl;
0047     std::cout <<" ---EVENT NUMBER "<<e.id().event() <<std::endl;
0048 
0049     edm::ESHandle<CSCDBGasGainCorrection> pGasGainCorr;
0050     context.get<CSCDBGasGainCorrectionRcd>().get(pGasGainCorr);
0051     
0052     const CSCDBGasGainCorrection* myGasGainCorr=pGasGainCorr.product();
0053     CSCDBGasGainCorrection::GasGainContainer::const_iterator it;
0054 
0055     for( it=myGasGainCorr->gasGainCorr.begin();it!=myGasGainCorr->gasGainCorr.end(); ++it ){    
0056       counter++;
0057       DBGasGainCorrectionFile<<counter<<"  "<<it->gainCorr<<std::endl;
0058       //* if ( it->gainCorr <= epsilon ) DBGasGainCorrectionFile << " ERROR? Gain Correction <= " << epsilon << std::endl;
0059     }
0060   }
0061   DEFINE_FWK_MODULE(CSCChipSpeedCorrectionDBReadAnalyzer);
0062 }
0063