CMS 3D CMS Logo

CSCFakeDBCrosstalk.h
Go to the documentation of this file.
1 #ifndef _CSCFAKEDBCROSSTALK_H
2 #define _CSCFAKEDBCROSSTALK_H
3 
12 #include <memory>
13 
15 
19 
21 public:
23  ~CSCFakeDBCrosstalk() override;
24 
25  inline static CSCDBCrosstalk *prefillDBCrosstalk();
26 
27  typedef std::unique_ptr<CSCDBCrosstalk> Pointer;
28 
30 
31 private:
32  // ----------member data ---------------------------
34  const edm::IOVSyncValue &,
35  edm::ValidityInterval &) override;
37 };
38 
39 #include <fstream>
40 #include <iostream>
41 #include <vector>
42 
43 // to workaround plugin library
45  int seed;
46  float mean, min;
47  int ii, jj, iii, jjj;
48  const int MAX_SIZE = 217728; // or 252288 for ME4/2 chambers
49  const int SLOPE_FACTOR = 10000000;
50  const int INTERCEPT_FACTOR = 100000;
51 
52  CSCDBCrosstalk *cndbcrosstalk = new CSCDBCrosstalk();
53  cndbcrosstalk->crosstalk.resize(MAX_SIZE);
54 
55  seed = 10000;
56  srand(seed);
57  mean = -0.0009, min = 0.035;
58  ii = 0, jj = 0, iii = 0, jjj = 0;
59 
60  cndbcrosstalk->factor_slope = int(SLOPE_FACTOR);
61  cndbcrosstalk->factor_intercept = int(INTERCEPT_FACTOR);
62 
63  for (int i = 0; i < MAX_SIZE; i++) {
64  cndbcrosstalk->crosstalk[i].xtalk_slope_right =
65  (short int)((-((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 10000 + mean) * SLOPE_FACTOR + 0.5);
66  cndbcrosstalk->crosstalk[i].xtalk_intercept_right =
67  (short int)((((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 100 + min) * INTERCEPT_FACTOR + 0.5);
68  cndbcrosstalk->crosstalk[i].xtalk_slope_left =
69  (short int)((-((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 10000 + mean) * SLOPE_FACTOR + 0.5);
70  cndbcrosstalk->crosstalk[i].xtalk_intercept_left =
71  (short int)((((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 100 + min) * INTERCEPT_FACTOR + 0.5);
72 
73  // 80 strips per chamber
74  if (i < 34561 && i % 80 == 0) {
75  cndbcrosstalk->crosstalk[i].xtalk_slope_left = 0;
76  cndbcrosstalk->crosstalk[i].xtalk_intercept_left = 0;
77  }
78 
79  if (i != 0 && i < 34561 && (i + 1) % 80 == 0) {
80  cndbcrosstalk->crosstalk[i].xtalk_slope_right = 0;
81  cndbcrosstalk->crosstalk[i].xtalk_intercept_right = 0;
82  }
83 
84  // 64 strips per chamber
85  if (i > 34560 && i < 48385 && i % 64 == 0) {
86  cndbcrosstalk->crosstalk[i].xtalk_slope_left = 0;
87  cndbcrosstalk->crosstalk[i].xtalk_intercept_left = 0;
88  }
89 
90  if (i > 34560 && i < 48385 && (i + 1) % 64 == 0) {
91  cndbcrosstalk->crosstalk[i].xtalk_slope_right = 0;
92  cndbcrosstalk->crosstalk[i].xtalk_intercept_right = 0;
93  }
94 
95  // 80 strips per chamber again
96  if (i > 48384 && i < 143425) {
97  ii++;
98  if (i > 48384 && i < 143425 && ii % 80 == 0) {
99  cndbcrosstalk->crosstalk[i].xtalk_slope_left = 0;
100  cndbcrosstalk->crosstalk[i].xtalk_intercept_left = 0;
101  }
102  }
103 
104  if (i > 48384 && i < 143425) {
105  jj++;
106  if (i > 48384 && i < 143425 && (jj + 1) % 80 == 0) {
107  cndbcrosstalk->crosstalk[i].xtalk_slope_right = 0;
108  cndbcrosstalk->crosstalk[i].xtalk_intercept_right = 0;
109  }
110  }
111 
112  // 64 strips per chamber again
113  if (i > 143424 && i < 157249 && i % 64 == 0) {
114  cndbcrosstalk->crosstalk[i].xtalk_slope_left = 0;
115  cndbcrosstalk->crosstalk[i].xtalk_intercept_left = 0;
116  }
117 
118  if (i > 143424 && i < 157249 && (i + 1) % 64 == 0) {
119  cndbcrosstalk->crosstalk[i].xtalk_slope_right = 0;
120  cndbcrosstalk->crosstalk[i].xtalk_intercept_right = 0;
121  }
122 
123  // 80 strips per chamber last time
124  if (i > 157248) {
125  iii++;
126  if (i > 157248 && iii % 80 == 0) {
127  cndbcrosstalk->crosstalk[i].xtalk_slope_left = 0;
128  cndbcrosstalk->crosstalk[i].xtalk_intercept_left = 0;
129  }
130  }
131 
132  if (i > 157248) {
133  jjj++;
134  if (i > 157248 && (jjj + 1) % 80 == 0) {
135  cndbcrosstalk->crosstalk[i].xtalk_slope_right = 0;
136  cndbcrosstalk->crosstalk[i].xtalk_intercept_right = 0;
137  }
138  }
139  }
140  return cndbcrosstalk;
141 }
142 
143 #endif
CSCFakeDBCrosstalk::Pointer
std::unique_ptr< CSCDBCrosstalk > Pointer
Definition: CSCFakeDBCrosstalk.h:27
mps_fire.i
i
Definition: mps_fire.py:428
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
ESHandle.h
min
T min(T a, T b)
Definition: MathUtil.h:58
edm::ValidityInterval
Definition: ValidityInterval.h:28
ESProducer.h
CSCDBCrosstalk.h
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
CSCDBCrosstalkRcd
Definition: CSCDBCrosstalkRcd.h:5
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
CSCDetId.h
fileCollector.seed
seed
Definition: fileCollector.py:127
CSCDBCrosstalk
Definition: CSCDBCrosstalk.h:9
MakerMacros.h
CSCDBCrosstalk::factor_slope
int factor_slope
Definition: CSCDBCrosstalk.h:22
CSCFakeDBCrosstalk::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: CSCFakeDBCrosstalk.cc:20
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
EventSetupRecordIntervalFinder.h
SourceFactory.h
CSCFakeDBCrosstalk::produceDBCrosstalk
Pointer produceDBCrosstalk(const CSCDBCrosstalkRcd &)
Definition: CSCFakeDBCrosstalk.cc:16
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
createfilelist.int
int
Definition: createfilelist.py:10
CSCFakeDBCrosstalk::~CSCFakeDBCrosstalk
~CSCFakeDBCrosstalk() override
Definition: CSCFakeDBCrosstalk.cc:13
CSCDBCrosstalkRcd.h
CSCFakeDBCrosstalk::prefillDBCrosstalk
static CSCDBCrosstalk * prefillDBCrosstalk()
Definition: CSCFakeDBCrosstalk.h:44
CSCDBCrosstalk::crosstalk
CrosstalkContainer crosstalk
Definition: CSCDBCrosstalk.h:28
Frameworkfwd.h
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
EventSetup.h
CSCFakeDBCrosstalk
Definition: CSCFakeDBCrosstalk.h:20
edm::ESProducer
Definition: ESProducer.h:104
CSCFakeDBCrosstalk::cndbCrosstalk
Pointer cndbCrosstalk
Definition: CSCFakeDBCrosstalk.h:36
ParameterSet.h
CSCFakeDBCrosstalk::CSCFakeDBCrosstalk
CSCFakeDBCrosstalk(const edm::ParameterSet &)
Definition: CSCFakeDBCrosstalk.cc:6
CSCDBCrosstalk::factor_intercept
int factor_intercept
Definition: CSCDBCrosstalk.h:23
cuy.ii
ii
Definition: cuy.py:590