CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CalibMuon/CSCCalibration/interface/CSCFakeDBNoiseMatrix.h

Go to the documentation of this file.
00001 #ifndef _CSCFAKEDBNOISEMATRIX_H
00002 #define _CSCFAKEDBNOISEMATRIX_H
00003 
00004 #include <memory>
00005 #include "FWCore/Framework/interface/SourceFactory.h"
00006 #include "FWCore/Framework/interface/Frameworkfwd.h"
00007 #include "FWCore/Framework/interface/ESProducer.h"
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 #include "FWCore/Framework/interface/EventSetup.h"
00013 
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 
00016 #include "CondFormats/CSCObjects/interface/CSCDBNoiseMatrix.h"
00017 #include "CondFormats/DataRecord/interface/CSCDBNoiseMatrixRcd.h"
00018 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
00019 #include <boost/shared_ptr.hpp>
00020 
00021 class CSCFakeDBNoiseMatrix: public edm::ESProducer, public edm::EventSetupRecordIntervalFinder  {
00022    public:
00023       CSCFakeDBNoiseMatrix(const edm::ParameterSet&);
00024       ~CSCFakeDBNoiseMatrix();
00025 
00026       inline static CSCDBNoiseMatrix * prefillDBNoiseMatrix(); 
00027 
00028       typedef boost::shared_ptr<CSCDBNoiseMatrix> Pointer;
00029 
00030       Pointer produceDBNoiseMatrix(const CSCDBNoiseMatrixRcd&);
00031 
00032    private:
00033       // ----------member data ---------------------------
00034     void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue&, edm::ValidityInterval & );
00035     Pointer cndbNoiseMatrix ;
00036 
00037 };
00038 
00039 #include<fstream>
00040 #include<vector>
00041 #include<iostream>
00042 
00043 // to workaround plugin library
00044 inline CSCDBNoiseMatrix *  CSCFakeDBNoiseMatrix::prefillDBNoiseMatrix()
00045 {
00046   int seed;
00047   const int MAX_SIZE = 252288; //or 252288 for ME4/2 chambers
00048   const int FACTOR=1000;
00049   
00050   CSCDBNoiseMatrix * cndbmatrix = new CSCDBNoiseMatrix();
00051   cndbmatrix->matrix.resize(MAX_SIZE);
00052 
00053   seed = 10000; 
00054   srand(seed);
00055   cndbmatrix->factor_noise = int (FACTOR);
00056   
00057   for(int i=0; i<MAX_SIZE;i++){
00058     cndbmatrix->matrix[i].elem33 = (short int) (10.0*FACTOR+0.5);
00059     cndbmatrix->matrix[i].elem34 = (short int) (4.0*FACTOR+0.5);
00060     cndbmatrix->matrix[i].elem35 = (short int) (3.0*FACTOR+0.5);
00061     cndbmatrix->matrix[i].elem44 = (short int) (10.0*FACTOR+0.5);
00062     cndbmatrix->matrix[i].elem45 = (short int) (8.0*FACTOR+0.5);
00063     cndbmatrix->matrix[i].elem46 = (short int) (2.0*FACTOR+0.5);
00064     cndbmatrix->matrix[i].elem55 = (short int) (10.0*FACTOR+0.5);
00065     cndbmatrix->matrix[i].elem56 = (short int) (5.0*FACTOR+0.5);
00066     cndbmatrix->matrix[i].elem57 = (short int) (3.0*FACTOR+0.5);
00067     cndbmatrix->matrix[i].elem66 = (short int) (10.0*FACTOR+0.5);
00068     cndbmatrix->matrix[i].elem67 = (short int) (4.0*FACTOR+0.5);
00069     cndbmatrix->matrix[i].elem77 = (short int) (10.0*FACTOR+0.5);
00070   }
00071   return cndbmatrix;
00072 }  
00073 
00074 #endif
00075