CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
SiPixelGenError Class Reference

#include <SiPixelGenError.h>

Public Member Functions

float fbin (int i)
 Return lower bound of Qbin definition. More...
 
float lorxbias ()
 signed lorentz x-bias (microns) More...
 
float lorxwidth ()
 signed lorentz x-width (microns) More...
 
float lorybias ()
 signed lorentz y-bias (microns) More...
 
float lorywidth ()
 signed lorentz y-width (microns) More...
 
int qbin (int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
 
int qbin (int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, float &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
 
int qbin (int id)
 
 SiPixelGenError (const std::vector< SiPixelGenErrorStore > &thePixelTemp)
 Constructor for cases in which template store already exists. More...
 
float xsize ()
 pixel x-size (microns) More...
 
float ysize ()
 pixel y-size (microns) More...
 
float zsize ()
 pixel z-size or thickness (microns) More...
 

Static Public Member Functions

static void postInit (std::vector< SiPixelGenErrorStore > &thePixelTemp_)
 
static bool pushfile (int filenum, std::vector< SiPixelGenErrorStore > &pixelTemp, std::string dir="")
 
static bool pushfile (const SiPixelGenErrorDBObject &dbobject, std::vector< SiPixelGenErrorStore > &pixelTemp)
 

Private Attributes

float fbin_ [3]
 The QBin definitions in Q_clus/Q_avg. More...
 
int id_current_
 current id More...
 
int index_id_
 current index More...
 
float lorxbias_
 Lorentz x-width. More...
 
float lorxwidth_
 Lorentz x-width. More...
 
float lorybias_
 Lorentz y-width (sign corrected for fpix frame) More...
 
float lorywidth_
 Lorentz y-width (sign corrected for fpix frame) More...
 
const std::vector
< SiPixelGenErrorStore > & 
thePixelTemp_
 
float xsize_
 Pixel x-size. More...
 
float ysize_
 Pixel y-size. More...
 
float zsize_
 Pixel z-size (thickness) More...
 

Detailed Description

A Generic Algorithm info management class. SiPixelGenError contains thePixelTemp (a std::vector of SiPixelGenErrorStore, each of which is a collection of many SiPixelGenErrorEntries). Each SiPixelGenErrorStore corresponds to a given detector condition, and is valid for a range of runs. We allow more than one Store since the may change over time.

This class reads templates from files via pushfile() method.

The main functionality of SiPixelGenError is qbin(), which produces algorithm info on the fly, given a specific track's alpha and beta.

Definition at line 113 of file SiPixelGenError.h.

Constructor & Destructor Documentation

SiPixelGenError::SiPixelGenError ( const std::vector< SiPixelGenErrorStore > &  thePixelTemp)
inline

Constructor for cases in which template store already exists.

Definition at line 115 of file SiPixelGenError.h.

Member Function Documentation

float SiPixelGenError::fbin ( int  i)
inline

Return lower bound of Qbin definition.

Definition at line 191 of file SiPixelGenError.h.

References cms::cuda::assert(), Exception, fbin_, and mps_fire::i.

float SiPixelGenError::lorxbias ( )
inline

signed lorentz x-bias (microns)

Definition at line 189 of file SiPixelGenError.h.

References lorxbias_.

float SiPixelGenError::lorxwidth ( )
inline

signed lorentz x-width (microns)

Definition at line 187 of file SiPixelGenError.h.

References lorxwidth_.

Referenced by SiPixelGenErrorDBObjectReader::analyze(), PixelCPEGenericForBricked::localPosition(), and PixelCPEGeneric::localPosition().

float SiPixelGenError::lorybias ( )
inline

signed lorentz y-bias (microns)

Definition at line 188 of file SiPixelGenError.h.

References lorybias_.

float SiPixelGenError::lorywidth ( )
inline

signed lorentz y-width (microns)

Definition at line 186 of file SiPixelGenError.h.

References lorywidth_.

Referenced by SiPixelGenErrorDBObjectReader::analyze(), PixelCPEGenericForBricked::localPosition(), and PixelCPEGeneric::localPosition().

void SiPixelGenError::postInit ( std::vector< SiPixelGenErrorStore > &  thePixelTemp_)
static

Definition at line 473 of file SiPixelGenError.cc.

References edm::for().

473  {
474  for (auto& templ : thePixelTemp_) {
475  for (auto iy = 0; iy < templ.head.NTy; ++iy)
476  templ.cotbetaY[iy] = templ.enty[iy].cotbeta;
477  for (auto iy = 0; iy < templ.head.NTyx; ++iy)
478  templ.cotbetaX[iy] = templ.entx[iy][0].cotbeta;
479  for (auto ix = 0; ix < templ.head.NTxx; ++ix)
480  templ.cotalphaX[ix] = templ.entx[0][ix].cotalpha;
481  }
482 }
const std::vector< SiPixelGenErrorStore > & thePixelTemp_
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)
bool SiPixelGenError::pushfile ( int  filenum,
std::vector< SiPixelGenErrorStore > &  pixelTemp,
std::string  dir = "" 
)
static

This routine initializes the global GenError structures from an external file generror_summary_zpNNNN where NNNN are four digits of filenum.

Parameters
filenum- an integer NNNN used in the filename generror_summary_zpNNNN

Definition at line 55 of file SiPixelGenError.cc.

References SiPixelGenErrorHeader::Bfield, c, SiPixelGenErrorEntry::cotalpha, SiPixelGenErrorStore::cotalphaX, SiPixelGenErrorEntry::cotbeta, SiPixelGenErrorStore::cotbetaX, SiPixelGenErrorStore::cotbetaY, SiPixelGenErrorHeader::Dtype, SiPixelGenErrorEntry::dxone, SiPixelGenErrorEntry::dxtwo, SiPixelGenErrorEntry::dyone, SiPixelGenErrorEntry::dytwo, ENDL, SiPixelGenErrorStore::entx, SiPixelGenErrorStore::enty, SiPixelGenErrorHeader::fbin, mergeVDriftHistosByStation::file, SiPixelGenErrorHeader::fluence, SiPixelGenErrorStore::head, mps_fire::i, SiPixelGenErrorHeader::ID, recoMuon::in, dqmiolumiharvest::j, isotrackApplyRegressor::k, LOGERROR, LOGINFO, SiPixelGenErrorHeader::lorxbias, SiPixelGenErrorHeader::lorxwidth, SiPixelGenErrorHeader::lorybias, SiPixelGenErrorHeader::lorywidth, SiPixelGenErrorHeader::NTxx, SiPixelGenErrorHeader::NTy, SiPixelGenErrorHeader::NTyx, SiPixelGenErrorEntry::pixmax, SiPixelGenErrorEntry::qavg, SiPixelGenErrorEntry::qmin, SiPixelGenErrorEntry::qmin2, SiPixelGenErrorHeader::qscale, SiPixelGenErrorEntry::runnum, SiPixelGenErrorHeader::s50, SiPixelGenErrorHeader::ss50, AlCaHLTBitMon_QueryRunRegistry::string, SiPixelGenErrorEntry::sxone, SiPixelGenErrorEntry::sxtwo, SiPixelGenErrorEntry::syone, SiPixelGenErrorEntry::sytwo, SiPixelGenErrorHeader::temperature, SiPixelGenErrorHeader::templ_version, SiPixelGenErrorHeader::title, SiPixelGenErrorHeader::Vbias, SiPixelGenErrorEntry::xavggen, SiPixelGenErrorEntry::xrmsgen, SiPixelGenErrorHeader::xsize, SiPixelGenErrorEntry::yavggen, SiPixelGenErrorEntry::yrmsgen, SiPixelGenErrorHeader::ysize, and SiPixelGenErrorHeader::zsize.

Referenced by SiPixelGenErrorDBObjectReader::analyze(), PixelCPEFast::PixelCPEFast(), and PixelCPEGeneric::PixelCPEGeneric().

55  {
56  // Add info stored in external file numbered filenum to theGenErrorStore
57 
58  // Local variables
59  int i, j, k;
60  float costrk[3] = {0, 0, 0};
61  const char* tempfile;
62  // char title[80]; remove this
63  char c;
64  const int code_version = {1};
65 
66  // Create a filename for this run
67 
68  std::ostringstream tout;
69 
70  // Create different path in CMSSW than standalone
71 
72 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
73  tout << dir << "generror_summary_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out"
74  << std::ends;
75  std::string tempf = tout.str();
76  edm::FileInPath file(tempf.c_str());
77  tempfile = (file.fullPath()).c_str();
78 #else
79  tout << "generror_summary_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends;
80  std::string tempf = tout.str();
81  tempfile = tempf.c_str();
82 #endif
83 
84  // open the Generic file
85 
86  std::ifstream in_file(tempfile, std::ios::in);
87 
88  if (in_file.is_open()) {
89  // Create a local GenError storage entry
90 
91  SiPixelGenErrorStore theCurrentTemp;
92 
93  // Read-in a header string first and print it
94 
95  for (i = 0; (c = in_file.get()) != '\n'; ++i) {
96  if (i < 79) {
97  theCurrentTemp.head.title[i] = c;
98  }
99  }
100  if (i > 78) {
101  i = 78;
102  }
103  theCurrentTemp.head.title[i + 1] = '\0';
104  LOGINFO("SiPixelGenError") << "Loading Pixel GenError File - " << theCurrentTemp.head.title << ENDL;
105 
106  // next, the header information
107 
108  in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >>
109  theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx >> theCurrentTemp.head.Dtype >>
110  theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >>
111  theCurrentTemp.head.qscale >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >>
112  theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >>
113  theCurrentTemp.head.zsize >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >>
114  theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >>
115  theCurrentTemp.head.fbin[2];
116 
117  if (in_file.fail()) {
118  LOGERROR("SiPixelGenError") << "Error reading file, no GenError load" << ENDL;
119  return false;
120  }
121 
122  LOGINFO("SiPixelGenError") << "GenError ID = " << theCurrentTemp.head.ID << ", GenError Version "
123  << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield
124  << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx
125  << ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype
126  << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature "
127  << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence
128  << ", Q-scaling factor " << theCurrentTemp.head.qscale << ", 1/2 multi dcol threshold "
129  << theCurrentTemp.head.s50 << ", 1/2 single dcol threshold " << theCurrentTemp.head.ss50
130  << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", y Lorentz Bias "
131  << theCurrentTemp.head.lorybias << ", x Lorentz width " << theCurrentTemp.head.lorxwidth
132  << ", x Lorentz Bias " << theCurrentTemp.head.lorxbias
133  << ", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0] << ", "
134  << theCurrentTemp.head.fbin[1] << ", " << theCurrentTemp.head.fbin[2]
135  << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size "
136  << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL;
137 
138  if (theCurrentTemp.head.templ_version < code_version) {
139  LOGERROR("SiPixelGenError") << "code expects version " << code_version << ", no GenError load" << ENDL;
140  return false;
141  }
142 
143 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
144 
145  // next, layout the 1-d/2-d structures needed to store GenError info
146 
147  theCurrentTemp.cotbetaY = new float[theCurrentTemp.head.NTy];
148  theCurrentTemp.cotbetaX = new float[theCurrentTemp.head.NTyx];
149  theCurrentTemp.cotalphaX = new float[theCurrentTemp.head.NTxx];
150 
151  theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]);
152 
153  theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]);
154 
155 #endif
156 
157  // next, loop over all y-angle entries
158 
159  for (i = 0; i < theCurrentTemp.head.NTy; ++i) {
160  in_file >> theCurrentTemp.enty[i].runnum >> costrk[0] >> costrk[1] >> costrk[2];
161 
162  if (in_file.fail()) {
163  LOGERROR("SiPixelGenError") << "Error reading file 1, no GenError load, run # " << theCurrentTemp.enty[i].runnum
164  << ENDL;
165  return false;
166  }
167 
168  // Calculate the alpha, beta, and cot(beta) for this entry
169 
170  theCurrentTemp.enty[i].cotalpha = costrk[0] / costrk[2];
171 
172  theCurrentTemp.enty[i].cotbeta = costrk[1] / costrk[2];
173 
174  in_file >> theCurrentTemp.enty[i].qavg >> theCurrentTemp.enty[i].pixmax >> theCurrentTemp.enty[i].dyone >>
175  theCurrentTemp.enty[i].syone >> theCurrentTemp.enty[i].dxone >> theCurrentTemp.enty[i].sxone;
176 
177  if (in_file.fail()) {
178  LOGERROR("SiPixelGenError") << "Error reading file 2, no GenError load, run # " << theCurrentTemp.enty[i].runnum
179  << ENDL;
180  return false;
181  }
182 
183  in_file >> theCurrentTemp.enty[i].dytwo >> theCurrentTemp.enty[i].sytwo >> theCurrentTemp.enty[i].dxtwo >>
184  theCurrentTemp.enty[i].sxtwo >> theCurrentTemp.enty[i].qmin >> theCurrentTemp.enty[i].qmin2;
185 
186  if (in_file.fail()) {
187  LOGERROR("SiPixelGenError") << "Error reading file 3, no GenError load, run # " << theCurrentTemp.enty[i].runnum
188  << ENDL;
189  return false;
190  }
191 
192  if (theCurrentTemp.enty[i].qmin <= 0.) {
193  LOGERROR("SiPixelGenError") << "Error in GenError ID " << theCurrentTemp.head.ID
194  << " qmin = " << theCurrentTemp.enty[i].qmin << ", run # "
195  << theCurrentTemp.enty[i].runnum << ENDL;
196  return false;
197  }
198 
199  for (j = 0; j < 4; ++j) {
200  in_file >> theCurrentTemp.enty[i].yavggen[j] >> theCurrentTemp.enty[i].yrmsgen[j] >>
201  theCurrentTemp.enty[i].xavggen[j] >> theCurrentTemp.enty[i].xrmsgen[j];
202 
203  if (in_file.fail()) {
204  LOGERROR("SiPixelGenError") << "Error reading file 14a, no GenError load, run # "
205  << theCurrentTemp.enty[i].runnum << ENDL;
206  return false;
207  }
208  }
209  }
210 
211  // next, loop over all barrel x-angle entries
212 
213  for (k = 0; k < theCurrentTemp.head.NTyx; ++k) {
214  for (i = 0; i < theCurrentTemp.head.NTxx; ++i) {
215  in_file >> theCurrentTemp.entx[k][i].runnum >> costrk[0] >> costrk[1] >> costrk[2];
216 
217  if (in_file.fail()) {
218  LOGERROR("SiPixelGenError") << "Error reading file 17, no GenError load, run # "
219  << theCurrentTemp.entx[k][i].runnum << ENDL;
220  return false;
221  }
222 
223  // Calculate the alpha, beta, and cot(beta) for this entry
224 
225  theCurrentTemp.entx[k][i].cotalpha = costrk[0] / costrk[2];
226 
227  theCurrentTemp.entx[k][i].cotbeta = costrk[1] / costrk[2];
228 
229  in_file >> theCurrentTemp.entx[k][i].qavg >> theCurrentTemp.entx[k][i].pixmax >>
230  theCurrentTemp.entx[k][i].dyone >> theCurrentTemp.entx[k][i].syone >> theCurrentTemp.entx[k][i].dxone >>
231  theCurrentTemp.entx[k][i].sxone;
232 
233  if (in_file.fail()) {
234  LOGERROR("SiPixelGenError") << "Error reading file 18, no GenError load, run # "
235  << theCurrentTemp.entx[k][i].runnum << ENDL;
236  return false;
237  }
238 
239  in_file >> theCurrentTemp.entx[k][i].dytwo >> theCurrentTemp.entx[k][i].sytwo >>
240  theCurrentTemp.entx[k][i].dxtwo >> theCurrentTemp.entx[k][i].sxtwo >> theCurrentTemp.entx[k][i].qmin >>
241  theCurrentTemp.entx[k][i].qmin2;
242  // >> theCurrentTemp.entx[k][i].mpvvav >> theCurrentTemp.entx[k][i].sigmavav >> theCurrentTemp.entx[k][i].kappavav;
243 
244  if (in_file.fail()) {
245  LOGERROR("SiPixelGenError") << "Error reading file 19, no GenError load, run # "
246  << theCurrentTemp.entx[k][i].runnum << ENDL;
247  return false;
248  }
249 
250  for (j = 0; j < 4; ++j) {
251  in_file >> theCurrentTemp.entx[k][i].yavggen[j] >> theCurrentTemp.entx[k][i].yrmsgen[j] >>
252  theCurrentTemp.entx[k][i].xavggen[j] >> theCurrentTemp.entx[k][i].xrmsgen[j];
253 
254  if (in_file.fail()) {
255  LOGERROR("SiPixelGenError") << "Error reading file 30a, no GenError load, run # "
256  << theCurrentTemp.entx[k][i].runnum << ENDL;
257  return false;
258  }
259  }
260  }
261  }
262 
263  in_file.close();
264 
265  // Add this info to the store
266 
267  pixelTemp.push_back(theCurrentTemp);
268 
269  postInit(pixelTemp);
270 
271  return true;
272 
273  } else {
274  // If file didn't open, report this
275 
276  LOGERROR("SiPixelGenError") << "Error opening File" << tempfile << ENDL;
277  return false;
278  }
279 
280 } // TempInit
SiPixelGenErrorEntry enty[100]
60 x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 60 slice...
float qavg
average cluster charge for this set of track angles (now includes threshold effects) ...
float ss50
1/2 of the single hit dcol threshold in electrons
float qmin
minimum cluster charge for valid hit (keeps 99.9% of simulated hits)
const edm::EventSetup & c
float Bfield
Bfield in Tesla.
int runnum
&lt; Basic template entry corresponding to a single set of track angles
float yrmsgen[4]
generic algorithm: average y-rms of reconstruction binned in 4 charge bins
float dxone
mean offset/correction for one pixel x-clusters
#define LOGINFO(x)
float Vbias
detector bias potential in Volts
float xrmsgen[4]
generic algorithm: average x-rms of reconstruction binned in 4 charge bins
int NTxx
number of Template x-entries in each slice
float fbin[3]
The QBin definitions in Q_clus/Q_avg.
float syone
rms for one pixel y-clusters
float zsize
pixel size (for future use in upgraded geometry)
float s50
1/2 of the multihit dcol threshold in electrons
float cotalpha
cot(alpha) is proportional to cluster length in x and is basis of interpolation
float lorxbias
estimate of x-lorentz bias
float temperature
detector temperature in deg K
float xsize
pixel size (for future use in upgraded geometry)
static void postInit(std::vector< SiPixelGenErrorStore > &thePixelTemp_)
int templ_version
Version number of the template to ensure code compatibility.
float cotbeta
cot(beta) is proportional to cluster length in y and is basis of interpolation
int ID
&lt; template header structure
float sxone
rms for one pixel x-clusters
float fluence
radiation fluence in n_eq/cm^2
#define LOGERROR(x)
float dytwo
mean offset/correction for one double-pixel y-clusters
int NTy
number of Template y entries
float qscale
Charge scaling to match cmssw and pixelav.
float dxtwo
mean offset/correction for one double-pixel x-clusters
SiPixelGenErrorHeader head
&lt; template storage structure
float ysize
pixel size (for future use in upgraded geometry)
char title[80]
template title
float sytwo
rms for one double-pixel y-clusters
float lorywidth
estimate of y-lorentz width for optimal resolution
float cotalphaX[80]
60 y templates spanning cluster lengths from 0px to +18px
#define ENDL
float yavggen[4]
generic algorithm: average y-bias of reconstruction binned in 4 charge bins
float dyone
mean offset/correction for one pixel y-clusters
int Dtype
detector type (0=BPix, 1=FPix)
int NTyx
number of Template y-slices of x entries
SiPixelGenErrorEntry entx[80][80]
float xavggen[4]
generic algorithm: average x-bias of reconstruction binned in 4 charge bins
float pixmax
maximum charge for individual pixels in cluster
float sxtwo
rms for one double-pixel x-clusters
float lorybias
estimate of y-lorentz bias
float lorxwidth
estimate of x-lorentz width for optimal resolution
bool SiPixelGenError::pushfile ( const SiPixelGenErrorDBObject dbobject,
std::vector< SiPixelGenErrorStore > &  pixelTemp 
)
static

This routine initializes the global GenError structures from an SiPixelGenErrorDBObject

Parameters
dbobject- db storing multiple generic calibrations

SiPixelGenErrorStore theCurrentTemp; // not on the stack...

Definition at line 289 of file SiPixelGenError.cc.

References SiPixelGenErrorDBObject::char2float::c, EcalCondDB::db, ENDL, SiPixelGenErrorDBObject::char2float::f, SiPixelGenErrorDBObject::fail(), mps_fire::i, SiPixelGenErrorDBObject::incrementIndex(), SiPixelGenErrorDBObject::index(), dqmiolumiharvest::j, isotrackApplyRegressor::k, LOGERROR, LOGINFO, visualization-live-secondInstance_cfg::m, SiPixelGenErrorDBObject::numOfTempl(), SiPixelGenErrorDBObject::sVector(), and groupFilesInBlocks::temp.

289  {
290  // Add GenError stored in external dbobject to theGenErrorStore
291 
292  // Local variables
293  int i, j, k;
294  float costrk[3] = {0, 0, 0};
295  // const char *tempfile;
296  const int code_version = {1};
297 
298  // We must create a new object because dbobject must be a const and our stream must not be
299  SiPixelGenErrorDBObject db = dbobject;
300 
301  // Create a local GenError storage entry
303  auto tmpPtr = std::make_unique<SiPixelGenErrorStore>(); // must be allocated on the heap instead
304  auto& theCurrentTemp = *tmpPtr;
305 
306  // Fill the GenError storage for each GenError calibration stored in the db
307  for (int m = 0; m < db.numOfTempl(); ++m) {
308  // Read-in a header string first and print it
309 
311  for (i = 0; i < 20; ++i) {
312  temp.f = db.sVector()[db.index()];
313  theCurrentTemp.head.title[4 * i] = temp.c[0];
314  theCurrentTemp.head.title[4 * i + 1] = temp.c[1];
315  theCurrentTemp.head.title[4 * i + 2] = temp.c[2];
316  theCurrentTemp.head.title[4 * i + 3] = temp.c[3];
317  db.incrementIndex(1);
318  }
319 
320  theCurrentTemp.head.title[79] = '\0';
321  LOGINFO("SiPixelGenError") << "Loading Pixel GenError File - " << theCurrentTemp.head.title << ENDL;
322 
323  // next, the header information
324 
325  db >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >>
326  theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx >> theCurrentTemp.head.Dtype >>
327  theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >>
328  theCurrentTemp.head.qscale >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >>
329  theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >>
330  theCurrentTemp.head.zsize >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >>
331  theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >>
332  theCurrentTemp.head.fbin[2];
333 
334  if (db.fail()) {
335  LOGERROR("SiPixelGenError") << "Error reading file, no GenError load" << ENDL;
336  return false;
337  }
338 
339  LOGINFO("SiPixelGenError") << "GenError ID = " << theCurrentTemp.head.ID << ", GenError Version "
340  << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield
341  << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx
342  << ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype
343  << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature "
344  << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence
345  << ", Q-scaling factor " << theCurrentTemp.head.qscale << ", 1/2 multi dcol threshold "
346  << theCurrentTemp.head.s50 << ", 1/2 single dcol threshold " << theCurrentTemp.head.ss50
347  << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", y Lorentz Bias "
348  << theCurrentTemp.head.lorybias << ", x Lorentz width " << theCurrentTemp.head.lorxwidth
349  << ", x Lorentz Bias " << theCurrentTemp.head.lorxbias
350  << ", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0] << ", "
351  << theCurrentTemp.head.fbin[1] << ", " << theCurrentTemp.head.fbin[2]
352  << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size "
353  << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL;
354 
355  LOGINFO("SiPixelGenError") << "Loading Pixel GenError - " << theCurrentTemp.head.title << " version "
356  << theCurrentTemp.head.templ_version << " code v." << code_version << ENDL;
357  if (theCurrentTemp.head.templ_version < code_version) {
358  LOGERROR("SiPixelGenError") << "code expects version " << code_version << ", no GenError load" << ENDL;
359  return false;
360  }
361 
362 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
363 
364  // next, layout the 1-d/2-d structures needed to store GenError
365 
366  // &&& Who is going to delete these? Are we leaking memory?
367  theCurrentTemp.cotbetaY = new float[theCurrentTemp.head.NTy];
368  theCurrentTemp.cotbetaX = new float[theCurrentTemp.head.NTyx];
369  theCurrentTemp.cotalphaX = new float[theCurrentTemp.head.NTxx];
370 
371  theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]);
372 
373  theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]);
374 
375 #endif
376 
377  // next, loop over all barrel y-angle entries
378 
379  for (i = 0; i < theCurrentTemp.head.NTy; ++i) {
380  db >> theCurrentTemp.enty[i].runnum >> costrk[0] >> costrk[1] >> costrk[2];
381 
382  if (db.fail()) {
383  LOGERROR("SiPixelGenError") << "Error reading file 1, no GenError load, run # " << theCurrentTemp.enty[i].runnum
384  << ENDL;
385  return false;
386  }
387 
388  // Calculate the alpha, beta, and cot(beta) for this entry
389 
390  theCurrentTemp.enty[i].cotalpha = costrk[0] / costrk[2];
391 
392  theCurrentTemp.enty[i].cotbeta = costrk[1] / costrk[2];
393 
394  db >> theCurrentTemp.enty[i].qavg >> theCurrentTemp.enty[i].pixmax >> theCurrentTemp.enty[i].dyone >>
395  theCurrentTemp.enty[i].syone >> theCurrentTemp.enty[i].dxone >> theCurrentTemp.enty[i].sxone;
396 
397  if (db.fail()) {
398  LOGERROR("SiPixelGenError") << "Error reading file 2, no GenError load, run # " << theCurrentTemp.enty[i].runnum
399  << ENDL;
400  return false;
401  }
402 
403  db >> theCurrentTemp.enty[i].dytwo >> theCurrentTemp.enty[i].sytwo >> theCurrentTemp.enty[i].dxtwo >>
404  theCurrentTemp.enty[i].sxtwo >> theCurrentTemp.enty[i].qmin >> theCurrentTemp.enty[i].qmin2;
405 
406  for (j = 0; j < 4; ++j) {
407  db >> theCurrentTemp.enty[i].yavggen[j] >> theCurrentTemp.enty[i].yrmsgen[j] >>
408  theCurrentTemp.enty[i].xavggen[j] >> theCurrentTemp.enty[i].xrmsgen[j];
409 
410  if (db.fail()) {
411  LOGERROR("SiPixelGenError") << "Error reading file 14a, no GenError load, run # "
412  << theCurrentTemp.enty[i].runnum << ENDL;
413  return false;
414  }
415  }
416  }
417 
418  // next, loop over all barrel x-angle entries
419 
420  for (k = 0; k < theCurrentTemp.head.NTyx; ++k) {
421  for (i = 0; i < theCurrentTemp.head.NTxx; ++i) {
422  db >> theCurrentTemp.entx[k][i].runnum >> costrk[0] >> costrk[1] >> costrk[2];
423 
424  if (db.fail()) {
425  LOGERROR("SiPixelGenError") << "Error reading file 17, no GenError load, run # "
426  << theCurrentTemp.entx[k][i].runnum << ENDL;
427  return false;
428  }
429 
430  // Calculate the alpha, beta, and cot(beta) for this entry
431 
432  theCurrentTemp.entx[k][i].cotalpha = costrk[0] / costrk[2];
433 
434  theCurrentTemp.entx[k][i].cotbeta = costrk[1] / costrk[2];
435 
436  db >> theCurrentTemp.entx[k][i].qavg >> theCurrentTemp.entx[k][i].pixmax >> theCurrentTemp.entx[k][i].dyone >>
437  theCurrentTemp.entx[k][i].syone >> theCurrentTemp.entx[k][i].dxone >> theCurrentTemp.entx[k][i].sxone;
438 
439  if (db.fail()) {
440  LOGERROR("SiPixelGenError") << "Error reading file 18, no GenError load, run # "
441  << theCurrentTemp.entx[k][i].runnum << ENDL;
442  return false;
443  }
444 
445  db >> theCurrentTemp.entx[k][i].dytwo >> theCurrentTemp.entx[k][i].sytwo >> theCurrentTemp.entx[k][i].dxtwo >>
446  theCurrentTemp.entx[k][i].sxtwo >> theCurrentTemp.entx[k][i].qmin >> theCurrentTemp.entx[k][i].qmin2;
447 
448  for (j = 0; j < 4; ++j) {
449  db >> theCurrentTemp.entx[k][i].yavggen[j] >> theCurrentTemp.entx[k][i].yrmsgen[j] >>
450  theCurrentTemp.entx[k][i].xavggen[j] >> theCurrentTemp.entx[k][i].xrmsgen[j];
451 
452  if (db.fail()) {
453  LOGERROR("SiPixelGenError") << "Error reading file 30a, no GenError load, run # "
454  << theCurrentTemp.entx[k][i].runnum << ENDL;
455  return false;
456  }
457  }
458  }
459  }
460 
461  // Add this GenError to the store
462 
463  pixelTemp.push_back(theCurrentTemp);
464 
465  postInit(pixelTemp);
466  }
467  return true;
468 
469 } // TempInit
#define LOGINFO(x)
tuple db
Definition: EcalCondDB.py:153
static void postInit(std::vector< SiPixelGenErrorStore > &thePixelTemp_)
std::vector< float > sVector() const
#define LOGERROR(x)
#define ENDL
int SiPixelGenError::qbin ( int  id,
float  cotalpha,
float  cotbeta,
float  locBz,
float  locBx,
float  qclus,
bool  irradiationCorrections,
int &  pixmx,
float &  sigmay,
float &  deltay,
float &  sigmax,
float &  deltax,
float &  sy1,
float &  dy1,
float &  sy2,
float &  dy2,
float &  sx1,
float &  dx1,
float &  sx2,
float &  dx2 
)

Definition at line 538 of file SiPixelGenError.cc.

References funct::abs(), cms::cuda::assert(), gather_cfg::cout, Exception, validate-o2o-wbm::f, mps_fire::i, gpuClustering::id, dqmiolumiharvest::j, cuda_std::lower_bound(), PixelTestBeamValidation_cfi::Ny, and mathSSE::sqrt().

Referenced by PixelCPEFast::errorFromTemplates(), PixelCPEGenericForBricked::localPosition(), PixelCPEGeneric::localPosition(), and qbin().

557  {
558  // Interpolate for a new set of track angles
559 
560  // Find the index corresponding to id
561 
562  if (id != id_current_) {
563  index_id_ = -1;
564  for (int i = 0; i < (int)thePixelTemp_.size(); ++i) {
565  if (id == thePixelTemp_[i].head.ID) {
566  index_id_ = i;
567  id_current_ = id;
568  lorywidth_ = thePixelTemp_[i].head.lorywidth;
569  lorxwidth_ = thePixelTemp_[i].head.lorxwidth;
570  lorybias_ = thePixelTemp_[i].head.lorybias;
571  lorxbias_ = thePixelTemp_[i].head.lorxbias;
572  for (int j = 0; j < 3; ++j) {
573  fbin_[j] = thePixelTemp_[i].head.fbin[j];
574  }
575 
576  // Pixel sizes to the private variables
577 
578  xsize_ = thePixelTemp_[i].head.xsize;
579  ysize_ = thePixelTemp_[i].head.ysize;
580  zsize_ = thePixelTemp_[i].head.zsize;
581 
582  break;
583  }
584  }
585  }
586 
587  int index = index_id_;
588 
589 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
590  if (index < 0 || index >= (int)thePixelTemp_.size()) {
591  throw cms::Exception("DataCorrupt") << "SiPixelGenError::qbin can't find needed GenError ID = " << id << std::endl;
592  }
593 #else
594  assert(index >= 0 && index < (int)thePixelTemp_.size());
595 #endif
596 
597  //
598 
599  auto const& templ = thePixelTemp_[index];
600 
601  // Interpolate the absolute value of cot(beta)
602 
603  auto acotb = std::abs(cotbeta);
604 
605  // qcorrect corrects the cot(alpha)=0 cluster charge for non-zero cot(alpha)
606 
607  auto cotalpha0 = thePixelTemp_[index].enty[0].cotalpha;
608  auto qcorrect =
609  std::sqrt((1.f + cotbeta * cotbeta + cotalpha * cotalpha) / (1.f + cotbeta * cotbeta + cotalpha0 * cotalpha0));
610 
611  // for some cosmics, the ususal gymnastics are incorrect
612 
613  float cota = cotalpha;
614  float cotb = acotb;
615  bool flip_y;
616  bool flip_x;
617  // for some cosmics, the ususal gymnastics are incorrect
618  flip_x = false;
619  flip_y = false;
620  switch (thePixelTemp_[index_id_].head.Dtype) {
621  case 0:
622  if (cotbeta < 0.f) {
623  flip_y = true;
624  }
625  break;
626  case 1:
627  if (locBz < 0.f) {
628  cotb = cotbeta;
629  } else {
630  cotb = -cotbeta;
631  flip_y = true;
632  }
633  break;
634  case 2:
635  case 3:
636  case 4:
637  case 5:
638  if (locBx * locBz < 0.f) {
639  cota = -cotalpha;
640  flip_x = true;
641  }
642  if (locBx > 0.f) {
643  cotb = cotbeta;
644  } else {
645  cotb = -cotbeta;
646  flip_y = true;
647  }
648  break;
649  default:
650 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
651  throw cms::Exception("DataCorrupt")
652  << "SiPixelGenError::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
653 #else
654  std::cout << "SiPixelGenError::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
655 #endif
656  }
657 
658  // Copy the charge scaling factor to the private variable
659 
660  if (flip_y) {
661  lorybias_ = -lorybias_;
663  }
664  if (flip_x) {
665  lorxbias_ = -lorxbias_;
667  }
668 
669  auto qscale = thePixelTemp_[index].head.qscale;
670 
671  /*
672  lorywidth = thePixelTemp_[index].head.lorywidth;
673  if(locBz > 0.f) {lorywidth = -lorywidth;}
674  lorxwidth = thePixelTemp_[index].head.lorxwidth;
675  */
676 
677  auto Ny = thePixelTemp_[index].head.NTy;
678  auto Nyx = thePixelTemp_[index].head.NTyx;
679  auto Nxx = thePixelTemp_[index].head.NTxx;
680 
681 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
682  if (Ny < 2 || Nyx < 1 || Nxx < 2) {
683  throw cms::Exception("DataCorrupt") << "GenError ID = " << id_current_ << "has too few entries: Ny/Nyx/Nxx = " << Ny
684  << "/" << Nyx << "/" << Nxx << std::endl;
685  }
686 #else
687  assert(Ny > 1 && Nyx > 0 && Nxx > 1);
688 #endif
689 
690  // next, loop over all y-angle entries
691 
692  auto ilow = 0;
693  auto ihigh = 0;
694  auto yratio = 0.f;
695 
696  {
697  auto j = std::lower_bound(templ.cotbetaY, templ.cotbetaY + Ny, cotb);
698  if (j == templ.cotbetaY + Ny) {
699  --j;
700  yratio = 1.f;
701  } else if (j == templ.cotbetaY) {
702  ++j;
703  yratio = 0.f;
704  } else {
705  yratio = (cotb - (*(j - 1))) / ((*j) - (*(j - 1)));
706  }
707 
708  ihigh = j - templ.cotbetaY;
709  ilow = ihigh - 1;
710  }
711 
712  // Interpolate/store all y-related quantities (flip displacements when flip_y)
713 
714  auto qavg = (1.f - yratio) * thePixelTemp_[index].enty[ilow].qavg + yratio * thePixelTemp_[index].enty[ihigh].qavg;
715  qavg *= qcorrect;
716  auto qmin = (1.f - yratio) * thePixelTemp_[index].enty[ilow].qmin + yratio * thePixelTemp_[index].enty[ihigh].qmin;
717  qmin *= qcorrect;
718  auto qmin2 = (1.f - yratio) * thePixelTemp_[index].enty[ilow].qmin2 + yratio * thePixelTemp_[index].enty[ihigh].qmin2;
719  qmin2 *= qcorrect;
720 
721 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
722  if (qavg <= 0.f || qmin <= 0.f) {
723  throw cms::Exception("DataCorrupt")
724  << "SiPixelGenError::qbin, qavg or qmin <= 0,"
725  << " Probably someone called the generic pixel reconstruction with an illegal trajectory state" << std::endl;
726  }
727 #else
728  assert(qavg > 0.f && qmin > 0.f);
729 #endif
730 
731  // Scale the input charge to account for differences between pixelav and CMSSW simulation or data
732 
733  auto qtotal = qscale * qclus;
734 
735  // uncertainty and final corrections depend upon total charge bin
736 
737  auto fq = qtotal / qavg;
738  int binq;
739  if (fq > fbin_[0]) {
740  binq = 0;
741  } else {
742  if (fq > fbin_[1]) {
743  binq = 1;
744  } else {
745  if (fq > fbin_[2]) {
746  binq = 2;
747  } else {
748  binq = 3;
749  }
750  }
751  }
752 
753  auto yrmsgen = (1.f - yratio) * thePixelTemp_[index].enty[ilow].yrmsgen[binq] +
754  yratio * thePixelTemp_[index].enty[ihigh].yrmsgen[binq];
755  sy1 = (1.f - yratio) * thePixelTemp_[index].enty[ilow].syone + yratio * thePixelTemp_[index].enty[ihigh].syone;
756  sy2 = (1.f - yratio) * thePixelTemp_[index].enty[ilow].sytwo + yratio * thePixelTemp_[index].enty[ihigh].sytwo;
757 
758  if (irradiationCorrections) {
759  auto yavggen = (1.f - yratio) * thePixelTemp_[index].enty[ilow].yavggen[binq] +
760  yratio * thePixelTemp_[index].enty[ihigh].yavggen[binq];
761  if (flip_y) {
762  yavggen = -yavggen;
763  }
764  deltay = yavggen;
765  dy1 = (1.f - yratio) * thePixelTemp_[index].enty[ilow].dyone + yratio * thePixelTemp_[index].enty[ihigh].dyone;
766  if (flip_y) {
767  dy1 = -dy1;
768  }
769  dy2 = (1.f - yratio) * thePixelTemp_[index].enty[ilow].dytwo + yratio * thePixelTemp_[index].enty[ihigh].dytwo;
770  if (flip_y) {
771  dy2 = -dy2;
772  }
773  }
774 
775  // next, loop over all x-angle entries, first, find relevant y-slices
776 
777  auto iylow = 0;
778  auto iyhigh = 0;
779  auto yxratio = 0.f;
780 
781  {
782  auto j = std::lower_bound(templ.cotbetaX, templ.cotbetaX + Nyx, acotb);
783  if (j == templ.cotbetaX + Nyx) {
784  --j;
785  yxratio = 1.f;
786  } else if (j == templ.cotbetaX) {
787  ++j;
788  yxratio = 0.f;
789  } else {
790  yxratio = (acotb - (*(j - 1))) / ((*j) - (*(j - 1)));
791  }
792 
793  iyhigh = j - templ.cotbetaX;
794  iylow = iyhigh - 1;
795  }
796 
797  auto xxratio = 0.f;
798 
799  {
800  auto j = std::lower_bound(templ.cotalphaX, templ.cotalphaX + Nxx, cota);
801  if (j == templ.cotalphaX + Nxx) {
802  --j;
803  xxratio = 1.f;
804  } else if (j == templ.cotalphaX) {
805  ++j;
806  xxratio = 0.f;
807  } else {
808  xxratio = (cota - (*(j - 1))) / ((*j) - (*(j - 1)));
809  }
810 
811  ihigh = j - templ.cotalphaX;
812  ilow = ihigh - 1;
813  }
814 
815  sx1 =
816  (1.f - xxratio) * thePixelTemp_[index].entx[0][ilow].sxone + xxratio * thePixelTemp_[index].entx[0][ihigh].sxone;
817  sx2 =
818  (1.f - xxratio) * thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio * thePixelTemp_[index].entx[0][ihigh].sxtwo;
819 
820  // pixmax is the maximum allowed pixel charge (used for truncation)
821 
822  pixmx = (1.f - yxratio) * ((1.f - xxratio) * thePixelTemp_[index].entx[iylow][ilow].pixmax +
823  xxratio * thePixelTemp_[index].entx[iylow][ihigh].pixmax) +
824  yxratio * ((1.f - xxratio) * thePixelTemp_[index].entx[iyhigh][ilow].pixmax +
825  xxratio * thePixelTemp_[index].entx[iyhigh][ihigh].pixmax);
826 
827  auto xrmsgen = (1.f - yxratio) * ((1.f - xxratio) * thePixelTemp_[index].entx[iylow][ilow].xrmsgen[binq] +
828  xxratio * thePixelTemp_[index].entx[iylow][ihigh].xrmsgen[binq]) +
829  yxratio * ((1.f - xxratio) * thePixelTemp_[index].entx[iyhigh][ilow].xrmsgen[binq] +
830  xxratio * thePixelTemp_[index].entx[iyhigh][ihigh].xrmsgen[binq]);
831 
832  if (irradiationCorrections) {
833  auto xavggen = (1.f - yxratio) * ((1.f - xxratio) * thePixelTemp_[index].entx[iylow][ilow].xavggen[binq] +
834  xxratio * thePixelTemp_[index].entx[iylow][ihigh].xavggen[binq]) +
835  yxratio * ((1.f - xxratio) * thePixelTemp_[index].entx[iyhigh][ilow].xavggen[binq] +
836  xxratio * thePixelTemp_[index].entx[iyhigh][ihigh].xavggen[binq]);
837  if (flip_x) {
838  xavggen = -xavggen;
839  }
840  deltax = xavggen;
841  dx1 = (1.f - xxratio) * thePixelTemp_[index].entx[0][ilow].dxone +
842  xxratio * thePixelTemp_[index].entx[0][ihigh].dxone;
843  if (flip_x) {
844  dx1 = -dx1;
845  }
846  dx2 = (1.f - xxratio) * thePixelTemp_[index].entx[0][ilow].dxtwo +
847  xxratio * thePixelTemp_[index].entx[0][ihigh].dxtwo;
848  if (flip_x) {
849  dx2 = -dx2;
850  }
851  }
852 
853  // Take the errors and bias from the correct charge bin
854 
855  sigmay = yrmsgen;
856 
857  sigmax = xrmsgen;
858 
859  // If the charge is too small (then flag it)
860 
861  if (qtotal < 0.95f * qmin) {
862  binq = 5;
863  } else {
864  if (qtotal < 0.95f * qmin2) {
865  binq = 4;
866  }
867  }
868 
869  return binq;
870 
871 } // qbin
const std::vector< SiPixelGenErrorStore > & thePixelTemp_
float xsize_
Pixel x-size.
float lorxbias_
Lorentz x-width.
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
uint16_t *__restrict__ id
float ysize_
Pixel y-size.
assert(be >=bs)
T sqrt(T t)
Definition: SSEVec.h:19
float fbin_[3]
The QBin definitions in Q_clus/Q_avg.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float zsize_
Pixel z-size (thickness)
float lorxwidth_
Lorentz x-width.
int id_current_
current id
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
tuple cout
Definition: gather_cfg.py:144
float lorybias_
Lorentz y-width (sign corrected for fpix frame)
int index_id_
current index
int SiPixelGenError::qbin ( int  id,
float  cotalpha,
float  cotbeta,
float  locBz,
float  locBx,
float  qclus,
float &  pixmx,
float &  sigmay,
float &  deltay,
float &  sigmax,
float &  deltax,
float &  sy1,
float &  dy1,
float &  sy2,
float &  dy2,
float &  sx1,
float &  dx1,
float &  sx2,
float &  dx2 
)

Definition at line 873 of file SiPixelGenError.cc.

References qbin().

891  {
892  // Interpolate for a new set of track angles
893 
894  bool irradiationCorrections = true;
895  int ipixmx, ibin;
896 
897  ibin = SiPixelGenError::qbin(id,
898  cotalpha,
899  cotbeta,
900  locBz,
901  locBx,
902  qclus,
903  irradiationCorrections,
904  ipixmx,
905  sigmay,
906  deltay,
907  sigmax,
908  deltax,
909  sy1,
910  dy1,
911  sy2,
912  dy2,
913  sx1,
914  dx1,
915  sx2,
916  dx2);
917 
918  pixmx = (float)ipixmx;
919 
920  return ibin;
921 }
int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
int SiPixelGenError::qbin ( int  id)

Interpolate beta/alpha angles to produce an expected average charge. Return int (0-4) describing the charge of the cluster [0: 1.5<Q/Qavg, 1: 1<Q/Qavg<1.5, 2: 0.85<Q/Qavg<1, 3: 0.95Qmin<Q<0.85Qavg, 4: Q<0.95Qmin].

Parameters
id- (input) index of the GenError to use
cotalpha- (input) the cotangent of the alpha track angle (see CMS IN 2004/014)
cotbeta- (input) the cotangent of the beta track angle (see CMS IN 2004/014)
locBz- (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) for FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0
qclus- (input) the cluster charge in electrons
pixmax- (output) the maximum pixel charge in electrons (truncation value)
sigmay- (output) the estimated y-error for CPEGeneric in microns
deltay- (output) the estimated y-bias for CPEGeneric in microns
sigmax- (output) the estimated x-error for CPEGeneric in microns
deltax- (output) the estimated x-bias for CPEGeneric in microns
sy1- (output) the estimated y-error for 1 single-pixel clusters in microns
dy1- (output) the estimated y-bias for 1 single-pixel clusters in microns
sy2- (output) the estimated y-error for 1 double-pixel clusters in microns
dy2- (output) the estimated y-bias for 1 double-pixel clusters in microns
sx1- (output) the estimated x-error for 1 single-pixel clusters in microns
dx1- (output) the estimated x-bias for 1 single-pixel clusters in microns
sx2- (output) the estimated x-error for 1 double-pixel clusters in microns
dx2- (output) the estimated x-bias for 1 double-pixel clusters in microns

Definition at line 508 of file SiPixelGenError.cc.

References mps_fire::i, and gpuClustering::id.

508  {
509  // Find the index corresponding to id
510 
511  if (id != id_current_) {
512  index_id_ = -1;
513  for (int i = 0; i < (int)thePixelTemp_.size(); ++i) {
514  if (id == thePixelTemp_[i].head.ID) {
515  index_id_ = i;
516  id_current_ = id;
517  //
518  lorywidth_ = thePixelTemp_[i].head.lorywidth;
519  lorxwidth_ = thePixelTemp_[i].head.lorxwidth;
520  lorybias_ = thePixelTemp_[i].head.lorybias;
521  lorxbias_ = thePixelTemp_[i].head.lorxbias;
522 
523  //for(int j=0; j<3; ++j) {fbin_[j] = thePixelTemp_[i].head.fbin[j];}
524 
525  // Pixel sizes to the private variables
526  xsize_ = thePixelTemp_[i].head.xsize;
527  ysize_ = thePixelTemp_[i].head.ysize;
528  zsize_ = thePixelTemp_[i].head.zsize;
529 
530  break;
531  }
532  }
533  }
534  return index_id_;
535 }
const std::vector< SiPixelGenErrorStore > & thePixelTemp_
float xsize_
Pixel x-size.
float lorxbias_
Lorentz x-width.
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
uint16_t *__restrict__ id
float ysize_
Pixel y-size.
float zsize_
Pixel z-size (thickness)
float lorxwidth_
Lorentz x-width.
int id_current_
current id
float lorybias_
Lorentz y-width (sign corrected for fpix frame)
int index_id_
current index
float SiPixelGenError::xsize ( )
inline

pixel x-size (microns)

Definition at line 202 of file SiPixelGenError.h.

References xsize_.

float SiPixelGenError::ysize ( )
inline

pixel y-size (microns)

Definition at line 203 of file SiPixelGenError.h.

References ysize_.

float SiPixelGenError::zsize ( )
inline

pixel z-size or thickness (microns)

Definition at line 204 of file SiPixelGenError.h.

References zsize_.

Member Data Documentation

float SiPixelGenError::fbin_[3]
private

The QBin definitions in Q_clus/Q_avg.

Definition at line 218 of file SiPixelGenError.h.

Referenced by fbin().

int SiPixelGenError::id_current_
private

current id

Definition at line 209 of file SiPixelGenError.h.

int SiPixelGenError::index_id_
private

current index

Definition at line 210 of file SiPixelGenError.h.

float SiPixelGenError::lorxbias_
private

Lorentz x-width.

Definition at line 216 of file SiPixelGenError.h.

Referenced by lorxbias().

float SiPixelGenError::lorxwidth_
private

Lorentz x-width.

Definition at line 214 of file SiPixelGenError.h.

Referenced by lorxwidth().

float SiPixelGenError::lorybias_
private

Lorentz y-width (sign corrected for fpix frame)

Definition at line 217 of file SiPixelGenError.h.

Referenced by lorybias().

float SiPixelGenError::lorywidth_
private

Lorentz y-width (sign corrected for fpix frame)

Definition at line 215 of file SiPixelGenError.h.

Referenced by lorywidth().

const std::vector<SiPixelGenErrorStore>& SiPixelGenError::thePixelTemp_
private

Definition at line 225 of file SiPixelGenError.h.

float SiPixelGenError::xsize_
private

Pixel x-size.

Definition at line 219 of file SiPixelGenError.h.

Referenced by xsize().

float SiPixelGenError::ysize_
private

Pixel y-size.

Definition at line 220 of file SiPixelGenError.h.

Referenced by ysize().

float SiPixelGenError::zsize_
private

Pixel z-size (thickness)

Definition at line 221 of file SiPixelGenError.h.

Referenced by zsize().