CMS 3D CMS Logo

CSCFakePedestalsConditions.cc
Go to the documentation of this file.
1 
3 
5  const CSCDetId &detId = CSCDetId();
6  CSCPedestals *cnpedestals = new CSCPedestals();
7 
8  int max_istrip, id_layer, max_ring, max_cham;
9  seed = 10000;
10  srand(seed);
11  meanped = 600.0, meanrms = 1.5, M = 1000;
12 
13  // endcap=1 to 2,station=1 to 4, ring=1 to 4,chamber=1 to 36,layer=1 to 6
14 
15  for (int iendcap = detId.minEndcapId(); iendcap <= detId.maxEndcapId(); iendcap++) {
16  for (int istation = detId.minStationId(); istation <= detId.maxStationId(); istation++) {
17  max_ring = detId.maxRingId();
18  // station 4 ring 4 not there(36 chambers*2 missing)
19  // 3 rings max this way of counting (ME1a & b)
20  if (istation == 1)
21  max_ring = 3;
22  if (istation == 2)
23  max_ring = 2;
24  if (istation == 3)
25  max_ring = 2;
26  if (istation == 4)
27  max_ring = 1;
28 
29  for (int iring = detId.minRingId(); iring <= max_ring; iring++) {
30  max_istrip = 80;
31  max_cham = detId.maxChamberId();
32  if (istation == 1 && iring == 1)
33  max_cham = 36;
34  if (istation == 1 && iring == 2)
35  max_cham = 36;
36  if (istation == 1 && iring == 3)
37  max_cham = 36;
38  if (istation == 2 && iring == 1)
39  max_cham = 18;
40  if (istation == 2 && iring == 2)
41  max_cham = 36;
42  if (istation == 3 && iring == 1)
43  max_cham = 18;
44  if (istation == 3 && iring == 2)
45  max_cham = 36;
46  if (istation == 4 && iring == 1)
47  max_cham = 18;
48 
49  for (int ichamber = detId.minChamberId(); ichamber <= max_cham; ichamber++) {
50  for (int ilayer = detId.minLayerId(); ilayer <= detId.maxLayerId(); ilayer++) {
51  // station 1 ring 3 has 64 strips per layer instead of 80
52  if (istation == 1 && iring == 3)
53  max_istrip = 64;
54 
55  std::vector<CSCPedestals::Item> itemvector;
56  itemvector.resize(max_istrip);
57  id_layer = 100000 * iendcap + 10000 * istation + 1000 * iring + 10 * ichamber + ilayer;
58 
59  for (int istrip = 0; istrip < max_istrip; istrip++) {
60  itemvector[istrip].ped = ((double)rand() / ((double)(RAND_MAX) + (double)(1))) * 100 + meanped;
61  itemvector[istrip].rms = ((double)rand() / ((double)(RAND_MAX) + (double)(1))) + meanrms;
62  cnpedestals->pedestals[id_layer] = itemvector;
63  }
64  }
65  }
66  }
67  }
68  }
69  return cnpedestals;
70 }
71 
73  // the following line is needed to tell the framework what
74  // data is being produced
76  findingRecord<CSCPedestalsRcd>();
77  // now do what ever other initialization is needed
78 }
79 
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83 }
84 
85 //
86 // member functions
87 //
88 
89 // ------------ method called to produce the data ------------
92 }
93 
95  const edm::IOVSyncValue &,
96  edm::ValidityInterval &oValidity) {
98 }
CSCFakePedestalsConditions::CSCFakePedestalsConditions
CSCFakePedestalsConditions(const edm::ParameterSet &)
Definition: CSCFakePedestalsConditions.cc:72
CSCDetId::maxStationId
static int maxStationId()
Definition: CSCDetId.h:222
CSCFakePedestalsConditions::ReturnType
std::unique_ptr< CSCPedestals > ReturnType
Definition: CSCFakePedestalsConditions.h:31
CSCPedestals
Definition: CSCPedestals.h:10
CSCFakePedestalsConditions::producePedestals
ReturnType producePedestals(const CSCPedestalsRcd &)
Definition: CSCFakePedestalsConditions.cc:90
CSCFakePedestalsConditions::M
long int M
Definition: CSCFakePedestalsConditions.h:27
CSCFakePedestalsConditions::prefillPedestals
CSCPedestals * prefillPedestals()
Definition: CSCFakePedestalsConditions.cc:4
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ValidityInterval
Definition: ValidityInterval.h:28
CSCDetId::minChamberId
static int minChamberId()
Definition: CSCDetId.h:225
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
CSCDetId::minStationId
static int minStationId()
Definition: CSCDetId.h:221
CSCFakePedestalsConditions::meanped
float meanped
Definition: CSCFakePedestalsConditions.h:25
CSCPedestalsRcd
Definition: CSCPedestalsRcd.h:5
CSCDetId::minEndcapId
static int minEndcapId()
Definition: CSCDetId.h:219
CSCDetId::maxRingId
static int maxRingId()
Definition: CSCDetId.h:224
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
CSCDetId::minLayerId
static int minLayerId()
Definition: CSCDetId.h:227
CSCFakePedestalsConditions.h
edm::ParameterSet
Definition: ParameterSet.h:47
CSCPedestals::pedestals
PedestalMap pedestals
Definition: CSCPedestals.h:25
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
CSCDetId
Definition: CSCDetId.h:26
CSCDetId::maxChamberId
static int maxChamberId()
Definition: CSCDetId.h:226
CSCDetId::maxEndcapId
static int maxEndcapId()
Definition: CSCDetId.h:220
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
CSCFakePedestalsConditions::seed
int seed
Definition: CSCFakePedestalsConditions.h:26
CSCFakePedestalsConditions::~CSCFakePedestalsConditions
~CSCFakePedestalsConditions() override
Definition: CSCFakePedestalsConditions.cc:80
CSCDetId::maxLayerId
static int maxLayerId()
Definition: CSCDetId.h:228
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
CSCFakePedestalsConditions::meanrms
float meanrms
Definition: CSCFakePedestalsConditions.h:25
CSCFakePedestalsConditions::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: CSCFakePedestalsConditions.cc:94
CSCDetId::minRingId
static int minRingId()
Definition: CSCDetId.h:223