CMS 3D CMS Logo

CSCFakeDBPedestals.h
Go to the documentation of this file.
1 #ifndef _CSCFAKEDBPEDESTALS_H
2 #define _CSCFAKEDBPEDESTALS_H
3 
4 #include <memory>
13 
15 
19 
21  public:
23  ~CSCFakeDBPedestals() override;
24 
25  inline static CSCDBPedestals * prefillDBPedestals();
26 
27  typedef std::shared_ptr<CSCDBPedestals> Pointer;
28 
29  Pointer produceDBPedestals(const CSCDBPedestalsRcd&);
30 
31  private:
32  // ----------member data ---------------------------
34 
35  Pointer cndbPedestals ;
36 };
37 
38 #include<fstream>
39 #include<vector>
40 #include<iostream>
41 
42 // to workaround plugin library
44 {
45  int seed;
46  float meanped,meanrms;
47  const int MAX_SIZE = 217728; //or 252288 for ME4/2 chambers
48  const int PED_FACTOR=10;
49  const int RMS_FACTOR=1000;
50 
51  CSCDBPedestals * cndbpedestals = new CSCDBPedestals();
52  cndbpedestals->pedestals.resize(MAX_SIZE);
53 
54  seed = 10000;
55  srand(seed);
56  meanped=600.0, meanrms=1.5;
57  cndbpedestals->factor_ped = int (PED_FACTOR);
58  cndbpedestals->factor_rms = int (RMS_FACTOR);
59 
60  for(int i=0; i<MAX_SIZE;i++){
61  cndbpedestals->pedestals[i].ped=(short int) (((double)rand()/((double)(RAND_MAX)+(double)(1)))*100+meanped*PED_FACTOR+0.5);
62  cndbpedestals->pedestals[i].rms= (short int) (((double)rand()/((double)(RAND_MAX)+(double)(1)))+meanrms*RMS_FACTOR+0.5);
63  }
64  return cndbpedestals;
65 }
66 
67 #endif
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
std::shared_ptr< CSCDBPedestals > Pointer
static CSCDBPedestals * prefillDBPedestals()
~CSCFakeDBPedestals() override
CSCFakeDBPedestals(const edm::ParameterSet &)
Pointer produceDBPedestals(const CSCDBPedestalsRcd &)
PedestalContainer pedestals
Signal rand(Signal arg)
Definition: vlib.cc:442