CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/CondTools/RPC/src/RPCDBPerformanceHandler.cc

Go to the documentation of this file.
00001 #include <memory>
00002 
00003 // user include files
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/Framework/interface/EDAnalyzer.h"
00006 
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/MakerMacros.h"
00009 
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 //
00012 // class decleration
00013 //
00014 #include "CondTools/RPC/interface/RPCDBPerformanceHandler.h"
00015 #include <iostream>
00016 #include <fstream>
00017 
00018 #include "DataFormats/Common/interface/Handle.h"
00019 #include "FWCore/Framework/interface/ESHandle.h"
00020 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00021 #include "DataFormats/Common/interface/Handle.h"
00022 #include "FWCore/Framework/interface/ESHandle.h"
00023 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00024 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00025 #include "FWCore/ServiceRegistry/interface/Service.h"
00026 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00027 #include "FWCore/Framework/interface/Event.h"
00028 #include "FWCore/Framework/interface/EventSetup.h"
00029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00030 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00031 
00032 #include "CondTools/RPC/interface/RPCDBSimSetUp.h"
00033 
00034 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
00035 #include "CondFormats/RPCObjects/interface/RPCStripNoises.h"
00036 #include "CondFormats/DataRecord/interface/RPCStripNoisesRcd.h"
00037 
00038 #include <cmath>
00039 #include <math.h>
00040 #include <fstream>
00041 #include <sstream>
00042 #include <iostream>
00043 #include<cstring>
00044 #include<string>
00045 #include<vector>
00046 #include<stdlib.h>
00047 #include <utility>
00048 #include <map>
00049 
00050 using namespace edm;
00051 
00052 RPCDBPerformanceHandler::RPCDBPerformanceHandler(const edm::ParameterSet& pset) :
00053   m_since(pset.getUntrackedParameter<int >("firstSince")),
00054   dataTag(   pset.getParameter<std::string>  (  "tag" ) ){
00055   theRPCSimSetUp  =  new RPCDBSimSetUp(pset);
00056 }
00057 
00058 RPCDBPerformanceHandler::~RPCDBPerformanceHandler(){}
00059 
00060 
00061 void RPCDBPerformanceHandler::getNewObjects(){
00062 
00063   std::cout << " - > getNewObjects\n" << 
00064     //check whats already inside of database
00065     "got offlineInfo"<<
00066     tagInfo().name << ", size " << tagInfo().size 
00067             << ", last object valid since " 
00068             << tagInfo().lastInterval.first << std::endl;
00069 
00070   RPCStripNoises* obj = new RPCStripNoises();
00071 
00072   std::map< int, std::vector<double> >::iterator itc;
00073   for(itc = (theRPCSimSetUp->_clsMap).begin();itc != (theRPCSimSetUp->_clsMap).end();++itc){
00074     for(unsigned int n = 0; n < (itc->second).size();++n){
00075       (obj->v_cls).push_back((itc->second)[n]);
00076     }
00077   }
00078 
00079   RPCStripNoises::NoiseItem tipoprova;
00080 
00081   int i = 0;
00082   for(std::map<uint32_t, std::vector<float> >::iterator it = (theRPCSimSetUp->_mapDetIdNoise).begin(); 
00083       it != (theRPCSimSetUp->_mapDetIdNoise).end(); it++){
00084 
00085     tipoprova.dpid = it->first;
00086     tipoprova.time =  theRPCSimSetUp->getTime(it->first);
00087 
00088     for(unsigned int k = 0; k < 96; ++k){
00089 
00090       tipoprova.noise = ((it->second))[k];
00091       tipoprova.eff = (theRPCSimSetUp->getEff(it->first))[k];
00092       (obj->v_noises).push_back(tipoprova);
00093     }
00094     
00095     edm::LogError("RPCStripNoisesBuilder")<<"[RPCStripNoisesBuilder::analyze] detid already exists"<<std::endl;
00096     
00097     i++;
00098   }
00099 
00100   // prepare for transfer:
00101   m_to_transfer.push_back( std::make_pair((RPCStripNoises*)obj,m_since) );
00102  
00103 }
00104 
00105 std::string RPCDBPerformanceHandler::id() const {
00106   return dataTag;
00107 }
00108 
00109 
00110 
00111 
00112