CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CalibMuon/RPCCalibration/src/RPCFakeCalibration.cc

Go to the documentation of this file.
00001 #include "CalibMuon/RPCCalibration/interface/RPCFakeCalibration.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "FWCore/Framework/interface/Frameworkfwd.h"
00004 #include "FWCore/Framework/interface/EDAnalyzer.h"
00005 #include "FWCore/Framework/interface/Event.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include "DataFormats/Common/interface/Handle.h"
00009 #include "FWCore/Framework/interface/ESHandle.h"
00010 #include "FWCore/ServiceRegistry/interface/Service.h"
00011 #include "FWCore/Framework/interface/Event.h"
00012 #include "FWCore/Framework/interface/EventSetup.h"
00013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00014 #include "CalibMuon/RPCCalibration/interface/RPCCalibSetUp.h"
00015 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
00016 #include "CondFormats/RPCObjects/interface/RPCStripNoises.h"
00017 #include "CondFormats/DataRecord/interface/RPCStripNoisesRcd.h"
00018 
00019 #include <cmath>
00020 #include <math.h>
00021 #include <iostream>
00022 #include <memory>
00023 #include <fstream>
00024 
00025 RPCFakeCalibration::RPCFakeCalibration( const edm::ParameterSet& pset ) : RPCPerformanceESSource(pset) {
00026   edm::LogInfo("RPCFakeCalibration::RPCFakeCalibration");
00027   theRPCCalibSetUp  =  new RPCCalibSetUp(pset);
00028 }
00029 
00030 RPCStripNoises * RPCFakeCalibration::makeNoise() { 
00031   RPCStripNoises * obj = new RPCStripNoises();
00032   
00033   std::map< int, std::vector<double> >::iterator itc;
00034   for(itc = (theRPCCalibSetUp->_clsMap).begin();itc != (theRPCCalibSetUp->_clsMap).end();++itc){
00035     for(unsigned int n = 0; n < (itc->second).size();++n){
00036       (obj->v_cls).push_back((itc->second)[n]);
00037     }
00038   }
00039   
00040   RPCStripNoises::NoiseItem tipoprova;
00041   for(std::map<uint32_t, std::vector<float> >::iterator it = (theRPCCalibSetUp->_mapDetIdNoise).begin();
00042       it != (theRPCCalibSetUp->_mapDetIdNoise).end(); it++){
00043     
00044     tipoprova.dpid = it->first;
00045     tipoprova.time =  theRPCCalibSetUp->getTime(it->first);
00046 
00047     for(unsigned int k = 0; k < 96; ++k){
00048       tipoprova.noise = ((it->second))[k];
00049       tipoprova.eff = (theRPCCalibSetUp->getEff(it->first))[k];
00050       (obj->v_noises).push_back(tipoprova);
00051     }
00052   }
00053 
00054   return obj;
00055 }
00056 
00057 RPCClusterSize* RPCFakeCalibration::makeCls() {
00058   RPCClusterSize * obj = new RPCClusterSize();
00059   RPCClusterSize::ClusterSizeItem rpcClsItem;
00060   
00061   for(std::map<uint32_t, std::vector<double> >::iterator it 
00062         = (theRPCCalibSetUp->_mapDetClsMap).begin();
00063       it != (theRPCCalibSetUp->_mapDetClsMap).end(); it++){
00064     
00065     rpcClsItem.dpid =  it->first;
00066     
00067     for(unsigned int k = 0; k < 100; k++){
00068       
00069       
00070             rpcClsItem.clusterSize = (theRPCCalibSetUp->getCls(it->first))[k];
00071             (obj->v_cls).push_back(rpcClsItem);
00072     }
00073   }
00074   return obj;
00075 }