Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef SiStripTemplate_h
00017 #define SiStripTemplate_h 1
00018
00019 #include "SiStripTemplateDefs.h"
00020
00021 #include<vector>
00022 #include<cassert>
00023 #include "boost/multi_array.hpp"
00024
00025 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00026 #include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h"
00027 #include "FWCore/Utilities/interface/Exception.h"
00028 #endif
00029
00030 struct SiStripTemplateEntry {
00031 int runnum;
00032 float alpha;
00033 float cotalpha;
00034 float beta;
00035 float cotbeta;
00036 float costrk[3];
00037 float qavg;
00038 float sxmax;
00039 float dxone;
00040 float sxone;
00041 float qmin;
00042 float qmin2;
00043 float clslenx;
00044 float mpvvav;
00045 float sigmavav;
00046 float kappavav;
00047 float mpvvav2;
00048 float sigmavav2;
00049 float kappavav2;
00050 float xpar[2][5];
00051 float xtemp[9][TSXSIZE];
00052 float xavg[4];
00053 float xrms[4];
00054 float xgx0[4];
00055 float xgsig[4];
00056 float xflpar[4][6];
00057 float chi2xavg[4];
00058 float chi2xmin[4];
00059 float chi2xavgone;
00060 float chi2xminone;
00061 float xavgc2m[4];
00062 float xrmsc2m[4];
00063 float xgx0c2m[4];
00064 float xgsigc2m[4];
00065 float chi2xavgc2m[4];
00066 float chi2xminc2m[4];
00067 float xavggen[4];
00068 float xrmsgen[4];
00069 float xgx0gen[4];
00070 float xgsiggen[4];
00071 float xavgbcn[4];
00072 float xrmsbcn[4];
00073 float xgx0bcn[4];
00074 float xgsigbcn[4];
00075 float qbfrac[3];
00076 float fracxone;
00077 float qavg_avg;
00078 float qavg_spare;
00079 float spare[7];
00080 } ;
00081
00082
00083
00084
00085 struct SiStripTemplateHeader {
00086 char title[80];
00087 int ID;
00088 int templ_version;
00089 float Bfield;
00090 int NTy;
00091 int NTyx;
00092 int NTxx;
00093 int Dtype;
00094 float Vbias;
00095 float temperature;
00096 float fluence;
00097 float qscale;
00098 float s50;
00099 float lorywidth;
00100 float lorxwidth;
00101 float xsize;
00102 float ysize;
00103 float zsize;
00104 } ;
00105
00106
00107
00108 struct SiStripTemplateStore {
00109 SiStripTemplateHeader head;
00110 #ifndef SI_STRIP_TEMPLATE_USE_BOOST
00111 SiStripTemplateEntry enty[31];
00112 SiStripTemplateEntry entx[5][73];
00113 #else
00114 boost::multi_array<SiStripTemplateEntry,1> enty;
00115 boost::multi_array<SiStripTemplateEntry,2> entx;
00116 #endif
00117 } ;
00118
00119
00120
00138
00139 class SiStripTemplate {
00140 public:
00141 SiStripTemplate() {id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.;}
00142 bool pushfile(int filenum);
00143
00144
00145 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00146 bool pushfile(const SiPixelTemplateDBObject& dbobject);
00147 #endif
00148
00149
00150
00151 bool interpolate(int id, float cotalpha, float cotbeta, float locBy);
00152
00153
00154 bool interpolate(int id, float cotalpha, float cotbeta);
00155
00156
00157 void xtemp(int fxbin, int lxbin, float xtemplate[41][BSXSIZE]);
00158
00159
00160 void sxtemp(float xhit, std::vector<float>& cluster);
00161
00162
00163 int cxtemp();
00164
00165
00166 void xtemp3d_int(int nxpix, int& nxbins);
00167
00168 void xtemp3d(int j, int k, std::vector<float>& xtemplate);
00169
00170
00171 void xsigma2(int fxstrp, int lxstrp, float sxthr, float xsum[BSXSIZE], float xsig2[BSXSIZE]);
00172
00173
00174 float xflcorr(int binq, float qflx);
00175
00176
00177 int qbin(int id, float cotalpha, float cotbeta, float qclus);
00178
00179
00180 void vavilov_pars(double& mpv, double& sigma, double& kappa);
00181
00182
00183 void vavilov2_pars(double& mpv, double& sigma, double& kappa);
00184
00185
00186 float qavg() {return qavg_;}
00187 float qscale() {return qscale_;}
00188 float s50() {return s50_;}
00189 float sxmax() {return sxmax_;}
00190 float dxone() {return dxone_;}
00191 float sxone() {return sxone_;}
00192 float qmin() {return qmin_;}
00193 float qmin(int i) {
00194 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00195 if(i < 0 || i > 1) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::qmin called with illegal index = " << i << std::endl;}
00196 #else
00197 assert(i>=0 && i<2);
00198 #endif
00199 if(i==0){return qmin_;}else{return qmin2_;}}
00200 float clslenx() {return clslenx_;}
00201 float yratio() {return yratio_;}
00202 float yxratio() {return yxratio_;}
00203 float xxratio() {return xxratio_;}
00204 float xavg(int i) {
00205 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00206 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavg called with illegal index = " << i << std::endl;}
00207 #else
00208 assert(i>=0 && i<4);
00209 #endif
00210 return xavg_[i];}
00211 float xrms(int i) {
00212 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00213 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrms called with illegal index = " << i << std::endl;}
00214 #else
00215 assert(i>=0 && i<4);
00216 #endif
00217 return xrms_[i];}
00218 float xgx0(int i) {
00219 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00220 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0 called with illegal index = " << i << std::endl;}
00221 #else
00222 assert(i>=0 && i<4);
00223 #endif
00224 return xgx0_[i];}
00225 float xgsig(int i) {
00226 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00227 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsig called with illegal index = " << i << std::endl;}
00228 #else
00229 assert(i>=0 && i<4);
00230 #endif
00231 return xgsig_[i];}
00232 float chi2xavg(int i) {
00233 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00234 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::chi2xavg called with illegal index = " << i << std::endl;}
00235 #else
00236 assert(i>=0 && i<4);
00237 #endif
00238 return chi2xavg_[i];}
00239 float chi2xmin(int i) {
00240 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00241 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::chi2xmin called with illegal index = " << i << std::endl;}
00242 #else
00243 assert(i>=0 && i<4);
00244 #endif
00245 return chi2xmin_[i];}
00246 float xavgc2m(int i) {
00247 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00248 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavgc2m called with illegal index = " << i << std::endl;}
00249 #else
00250 assert(i>=0 && i<4);
00251 #endif
00252 return xavgc2m_[i];}
00253 float xrmsc2m(int i) {
00254 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00255 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrmsc2m called with illegal index = " << i << std::endl;}
00256 #else
00257 assert(i>=0 && i<4);
00258 #endif
00259 return xrmsc2m_[i];}
00260 float xgx0c2m(int i) {
00261 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00262 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0cm2 called with illegal index = " << i << std::endl;}
00263 #else
00264 assert(i>=0 && i<4);
00265 #endif
00266 return xgx0c2m_[i];}
00267 float xgsigc2m(int i) {
00268 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00269 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsigc2m called with illegal index = " << i << std::endl;}
00270 #else
00271 assert(i>=0 && i<4);
00272 #endif
00273 return xgsigc2m_[i];}
00274 float chi2xavgc2m(int i) {
00275 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00276 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xavgc2m called with illegal index = " << i << std::endl;}
00277 #else
00278 assert(i>=0 && i<4);
00279 #endif
00280 return chi2xavgc2m_[i];}
00281 float chi2xminc2m(int i) {
00282 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00283 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xminc2m called with illegal index = " << i << std::endl;}
00284 #else
00285 assert(i>=0 && i<4);
00286 #endif
00287 return chi2xminc2m_[i];}
00288 float xavgbcn(int i) {
00289 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00290 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavgbcn called with illegal index = " << i << std::endl;}
00291 #else
00292 assert(i>=0 && i<4);
00293 #endif
00294 return xavgbcn_[i];}
00295 float xrmsbcn(int i) {
00296 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00297 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrmsbcn called with illegal index = " << i << std::endl;}
00298 #else
00299 assert(i>=0 && i<4);
00300 #endif
00301 return xrmsbcn_[i];}
00302 float xgx0bcn(int i) {
00303 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00304 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0cm2 called with illegal index = " << i << std::endl;}
00305 #else
00306 assert(i>=0 && i<4);
00307 #endif
00308 return xgx0bcn_[i];}
00309 float xgsigbcn(int i) {
00310 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
00311 if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsigbcn called with illegal index = " << i << std::endl;}
00312 #else
00313 assert(i>=0 && i<4);
00314 #endif
00315 return xgsigbcn_[i];}
00316 float chi2xavgone() {return chi2xavgone_;}
00317 float chi2xminone() {return chi2xminone_;}
00318 float lorxwidth() {return lorxwidth_;}
00319 float mpvvav() {return mpvvav_;}
00320 float sigmavav() {return sigmavav_;}
00321 float kappavav() {return kappavav_;}
00322 float xsize() {return xsize_;}
00323 float ysize() {return ysize_;}
00324 float zsize() {return zsize_;}
00325
00326
00327
00328
00329 private:
00330
00331
00332
00333 int id_current_;
00334 int index_id_;
00335 float cota_current_;
00336 float cotb_current_;
00337 float abs_cotb_;
00338 bool success_;
00339
00340
00341
00342
00343 float qavg_;
00344 float pixmax_;
00345 float qscale_;
00346 float s50_;
00347 float sxmax_;
00348 float sxparmax_;
00349 float syparmax_;
00350 float dxone_;
00351 float sxone_;
00352 float dxtwo_;
00353 float sxtwo_;
00354 float qmin_;
00355 float clslenx_;
00356 float xparly0_[2][5];
00357 float xparhy0_[2][5];
00358 float yratio_;
00359 float yxratio_;
00360 float xxratio_;
00361 float xpar0_[2][5];
00362 float xparl_[2][5];
00363 float xparh_[2][5];
00364 float xtemp_[9][BSXSIZE];
00365 float xavg_[4];
00366 float xrms_[4];
00367 float xgx0_[4];
00368 float xgsig_[4];
00369 float xflparll_[4][6];
00370 float xflparlh_[4][6];
00371 float xflparhl_[4][6];
00372 float xflparhh_[4][6];
00373 float xavgc2m_[4];
00374 float xrmsc2m_[4];
00375 float xgx0c2m_[4];
00376 float xgsigc2m_[4];
00377 float chi2xavg_[4];
00378 float chi2xmin_[4];
00379 float chi2xavgc2m_[4];
00380 float chi2xminc2m_[4];
00381 float xavgbcn_[4];
00382 float xrmsbcn_[4];
00383 float xgx0bcn_[4];
00384 float xgsigbcn_[4];
00385 float chi2xavgone_;
00386 float chi2xminone_;
00387 float qmin2_;
00388 float mpvvav_;
00389 float sigmavav_;
00390 float kappavav_;
00391 float mpvvav2_;
00392 float sigmavav2_;
00393 float kappavav2_;
00394 float lorxwidth_;
00395 float xsize_;
00396 float ysize_;
00397 float zsize_;
00398 float qavg_avg_;
00399 float nxbins_;
00400 boost::multi_array<float,2> temp2dx_;
00401
00402
00403
00404
00405 std::vector< SiStripTemplateStore > theStripTemp_;
00406 } ;
00407
00408
00409 #endif