1 #ifndef _CSCGASGAINCORRECTIONDBCONDITIONS_H
2 #define _CSCGASGAINCORRECTIONDBCONDITIONS_H
58 printf(
"\n Generating fake DB constants for MC\n");
60 printf(
"\n Reading gas gain corrections from file %s \n",filename.data());
65 const int MAX_SIZE = 55944;
70 itemvector.resize(MAX_SIZE);
74 for (
int i=0;
i<MAX_SIZE;
i++){
75 itemvector[
i].gainCorr = 1.;
91 float truncated_mean ;
92 float gas_gain_correction;
96 for (
int j=0;
j<MAX_SIZE;
j++) {
97 gains[
j].gas_gain_index = -999;
98 gains[
j].endcap = -999;
99 gains[
j].station = -999;
100 gains[
j].ring = -999;
101 gains[
j].chamber = -999;
102 gains[
j].layer = -999;
103 gains[
j].hvsegment = -999;
104 gains[
j].cfeb = -999;
105 gains[
j].nentries = -999;
106 gains[
j].mean = -999.;
107 gains[
j].truncated_mean = -999.;
108 gains[
j].gas_gain_correction= -999.;
111 FILE *
fin = fopen(filename.data(),
"r");
117 int check = fscanf(fin,
"%d %d %d %d %d %d %d %d %d %f %f %f \n",
118 &gains[linecounter].gas_gain_index ,
119 &gains[linecounter].
endcap ,
121 &gains[linecounter].
ring ,
122 &gains[linecounter].chamber ,
123 &gains[linecounter].layer ,
124 &gains[linecounter].hvsegment ,
125 &gains[linecounter].cfeb ,
126 &gains[linecounter].nentries ,
127 &gains[linecounter].
mean ,
128 &gains[linecounter].truncated_mean ,
129 &gains[linecounter].gas_gain_correction);
132 printf(
"The input file format is not as expected\n");
142 if (linecounter == MAX_SIZE) {
143 std::cout <<
"Total number of gas gains read in = " << linecounter << std::endl;
145 std::cout <<
"ERROR: Total number of gas-gains read in = " << linecounter
146 <<
" while total number expected = " << MAX_SIZE << std::endl;
150 for (
int i=0;
i<MAX_SIZE;
i++){
152 itemvector[
i].gainCorr = 0.;
154 if (gains[
i].gas_gain_correction > 0.) {
155 itemvector[
i].gainCorr = gains[
i].gas_gain_correction;
158 std::cout <<
"ERROR: gas_gain_correction < 0 for index " << gains[
i].gas_gain_index << std::endl;
const CSCDBGasGainCorrection * ReturnType
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
CSCDBGasGainCorrection * cndbGasGainCorr
std::string dataCorrFileName
GasGainContainer gasGainCorr
CSCGasGainCorrectionDBConditions(const edm::ParameterSet &)
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
static CSCDBGasGainCorrection * prefillDBGasGainCorrection(bool isForMC, std::string dataCorrFileName)
ReturnType produceDBGasGainCorrection(const CSCDBGasGainCorrectionRcd &)
~CSCGasGainCorrectionDBConditions()
std::vector< Item > GasGainContainer