CMS 3D CMS Logo

CSCFakeGainsConditions.cc
Go to the documentation of this file.
1 
3 
5 {
6  cngains = new CSCGains();
7  const CSCDetId& detId = CSCDetId();
8 
9  int max_istrip,id_layer,max_ring,max_cham;
10  seed = 10000;
11  srand(seed);
12  mean=6.8, min=-10.0, minchi=1.0, M=1000;
13 
14 
15  //endcap=1 to 2,station=1 to 4, ring=1 to 4,chamber=1 to 36,layer=1 to 6
16 
17  for(int iendcap=detId.minEndcapId(); iendcap<=detId.maxEndcapId(); iendcap++){
18  for(int istation=detId.minStationId() ; istation<=detId.maxStationId(); istation++){
19  max_ring=detId.maxRingId();
20  //station 4 ring 4 not there(36 chambers*2 missing)
21  //3 rings max this way of counting (ME1a & b)
22  if(istation==1) max_ring=3;
23  if(istation==2) max_ring=2;
24  if(istation==3) max_ring=2;
25  if(istation==4) max_ring=1;
26 
27  for(int iring=detId.minRingId(); iring<=max_ring; iring++){
28  max_istrip=80;
29  max_cham=detId.maxChamberId();
30  if(istation==1 && iring==1) max_cham=36;
31  if(istation==1 && iring==2) max_cham=36;
32  if(istation==1 && iring==3) max_cham=36;
33  if(istation==2 && iring==1) max_cham=18;
34  if(istation==2 && iring==2) max_cham=36;
35  if(istation==3 && iring==1) max_cham=18;
36  if(istation==3 && iring==2) max_cham=36;
37  if(istation==4 && iring==1) max_cham=18;
38 
39  for(int ichamber=detId.minChamberId(); ichamber<=max_cham; ichamber++){
40  for(int ilayer=detId.minLayerId(); ilayer<=detId.maxLayerId(); ilayer++){
41  //station 1 ring 3 has 64 strips per layer instead of 80
42  if(istation==1 && iring==3) max_istrip=64;
43 
44  std::vector<CSCGains::Item> itemvector;
45  itemvector.resize(max_istrip);
46  id_layer = 100000*iendcap + 10000*istation + 1000*iring + 10*ichamber + ilayer;
47 
48  for(int istrip=0;istrip<max_istrip;istrip++){
49  //itemvector[istrip].gain_slope = 7.55;
50  //itemvector[istrip].gain_intercept= -10.00;
51  //itemvector[istrip].gain_chi2 = 2.00;
52  itemvector[istrip].gain_slope=((double)rand()/((double)(RAND_MAX)+(double)(1)))+mean;
53  itemvector[istrip].gain_intercept=((double)rand()/((double)(RAND_MAX)+(double)(1)))+min;
54  itemvector[istrip].gain_chi2=((double)rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
55  cngains->gains[id_layer]=itemvector;
56  }
57  }
58  }
59  }
60  }
61  }
62 }
63 
65 {
66  //the following line is needed to tell the framework what
67  // data is being produced
68  prefillGains();
70  findingRecord<CSCGainsRcd>();
71  //now do what ever other initialization is needed
72 }
73 
74 
76 {
77 
78  // do anything here that needs to be done at desctruction time
79  // (e.g. close files, deallocate resources etc.)
80  delete cngains;
81 }
82 
83 
84 //
85 // member functions
86 //
87 
88 // ------------ method called to produce the data ------------
91 {
92  return cngains;
93 }
94 
96  edm::ValidityInterval & oValidity)
97  {
99 
100  }
ReturnType produceGains(const CSCGainsRcd &)
static int minRingId()
Definition: CSCDetId.h:240
GainsMap gains
Definition: CSCGains.h:26
static int minEndcapId()
Definition: CSCDetId.h:236
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
static int maxStationId()
Definition: CSCDetId.h:239
static int maxRingId()
Definition: CSCDetId.h:241
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
static int minChamberId()
Definition: CSCDetId.h:242
static const IOVSyncValue & beginOfTime()
static int minStationId()
Definition: CSCDetId.h:238
static int maxEndcapId()
Definition: CSCDetId.h:237
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
CSCFakeGainsConditions(const edm::ParameterSet &)
static int minLayerId()
Definition: CSCDetId.h:244
static int maxChamberId()
Definition: CSCDetId.h:243
Signal rand(Signal arg)
Definition: vlib.cc:442
static int maxLayerId()
Definition: CSCDetId.h:245