CMS 3D CMS Logo

HOCalibAnalyzer.cc
Go to the documentation of this file.
1 //April 2015 : Removal of itrg1, itrg2, but addition of isect2, same is true in HOCalibVariables.h
2 // -*- C++ -*-
3 //
4 // Package: HOCalibAnalyzer
5 // Class: HOCalibAnalyzer
6 //
19 //
20 // Original Author: Gobinda Majumder
21 // Created: Sat Jul 7 09:51:31 CEST 2007
22 //
23 //
24 
25 // system include files
26 #include <memory>
27 
28 // user include files
31 
34 
36 //#include "DataFormats/HOCalibHit/interface/HOCalibVariables.h"
43 
44 #include "TMath.h"
45 #include "TFile.h"
46 #include "TH1F.h"
47 #include "TH2F.h"
48 #include "TTree.h"
49 #include "TProfile.h"
50 #include "TPostScript.h"
51 #include "TCanvas.h"
52 #include "TF1.h"
53 #include "TStyle.h"
54 #include "TMinuit.h"
55 #include "TMath.h"
56 
57 #include <string>
58 
59 #include <iostream>
60 #include <fstream>
61 #include <iomanip>
62 //#include <sstream>
63 
64 //
65 // Look for nearby pixel through eta, phi informations for pixel cross-talk
66 // 1. Look PIXEL code from (eta,phi)
67 // 2. Go to nearby pixel code
68 // 3. Come back to (eta,phi) from pixel code
69 // Though it works, it is a very ugly/crude way to get cross talk, need better algorithms
70 //
71 
72 static const int mapx1[6][3] = {{1, 4, 8}, {12, 7, 3}, {5, 9, 13}, {11, 6, 2}, {16, 15, 14}, {19, 18, 17}};
73 
74 static const int mapx2[6][3] = {{1, 4, 8}, {12, 7, 3}, {5, 9, 13}, {11, 6, 2}, {16, 15, 14}, {-1, -1, -1}};
75 
76 static const int mapx0p[9][2] = {{3, 1}, {7, 4}, {6, 5}, {12, 8}, {0, 0}, {11, 9}, {16, 13}, {15, 14}, {19, 17}};
77 static const int mapx0m[9][2] = {{17, 19}, {14, 15}, {13, 16}, {9, 11}, {0, 0}, {8, 12}, {5, 6}, {4, 7}, {1, 3}};
78 
79 static const int etamap[4][21] = {{-1, 0, 3, 1, 0, 2, 3, 1, 0, 2, -1, 3, 1, 2, 4, 4, 4, -1, -1, -1, -1}, //etamap2
80  {-1, 0, 3, 1, 0, 2, 3, 1, 0, 2, -1, 3, 1, 2, 4, 4, 4, 5, 5, 5, -1}, //etamap1
81  {-1, 0, -1, 0, 1, 2, 2, 1, 3, 5, -1, 5, 3, 6, 7, 7, 6, 8, -1, 8, -1}, //etamap0p
82  {-1, 8, -1, 8, 7, 6, 6, 7, 5, 3, -1, 3, 5, 2, 1, 1, 2, 0, -1, 0, -1}}; //etamap0m
83 
84 static const int phimap[4][21] = {{-1, 0, 2, 2, 1, 0, 1, 1, 2, 1, -1, 0, 0, 2, 2, 1, 0, 2, 1, 0, -1}, //phimap2
85  {-1, 0, 2, 2, 1, 0, 1, 1, 2, 1, -1, 0, 0, 2, 2, 1, 0, 2, 1, 0, -1}, //phimap1
86  {-1, 1, -1, 0, 1, 1, 0, 0, 1, 1, -1, 0, 0, 1, 1, 0, 0, 1, -1, 0, -1}, //phimap0p
87  {-1, 0, -1, 1, 0, 0, 1, 1, 0, 0, -1, 1, 1, 0, 0, 1, 1, 0, -1, 1, -1}}; //phimap0m
88 //swapped phi map for R0+/R0- (15/03/07)
89 
90 static const int npixleft[21] = {0, 0, 1, 2, 0, 4, 5, 6, 0, 8, 0, 0, 11, 0, 13, 14, 15, 0, 17, 18, 0};
91 static const int npixrigh[21] = {0, 2, 3, 0, 5, 6, 7, 0, 9, 0, 0, 12, 0, 14, 15, 16, 0, 18, 19, 0, 0};
92 static const int npixlebt[21] = {0, 0, 0, 0, 0, 1, 2, 3, 0, 4, 0, 6, 7, 8, 9, 0, 11, 13, 14, 15, 0};
93 static const int npixribt[21] = {0, 0, 0, 0, 1, 2, 3, 0, 4, 5, 0, 7, 0, 9, 0, 11, 12, 14, 15, 16, 0};
94 static const int npixleup[21] = {0, 4, 5, 6, 8, 9, 0, 11, 0, 13, 0, 15, 16, 0, 17, 18, 19, 0, 0, 0, 0};
95 static const int npixriup[21] = {0, 5, 6, 7, 9, 0, 11, 12, 13, 14, 0, 16, 0, 17, 18, 19, 0, 0, 0, 0, 0};
96 
97 static const int netamx = 30;
98 static const int nphimx = 72;
99 static const int nbgpr = 3;
100 static const int nsgpr = 7;
101 
104 std::vector<float> sig_reg[netamx][nphimx + 1];
105 std::vector<float> cro_ssg[netamx][nphimx + 1];
106 
107 //#define CORREL
108 //
109 // class decleration
110 //
111 
112 Double_t gausX(Double_t* x, Double_t* par) { return par[0] * (TMath::Gaus(x[0], par[1], par[2], kTRUE)); }
113 
114 Double_t langaufun(Double_t* x, Double_t* par) {
115  //Fit parameters:
116  //par[0]*par[1]=Width (scale) parameter of Landau density
117  //par[1]=Most Probable (MP, location) parameter of Landau density
118  //par[2]=Total area (integral -inf to inf, normalization constant)
119  //par[3]=Width (sigma) of convoluted Gaussian function
120  //
121  //In the Landau distribution (represented by the CERNLIB approximation),
122  //the maximum is located at x=-0.22278298 with the location parameter=0.
123  //This shift is corrected within this function, so that the actual
124  //maximum is identical to the MP parameter.
125  // /*
126  // Numeric constants
127  Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
128  Double_t mpshift = -0.22278298; // Landau maximum location
129 
130  // Control constants
131  Double_t np = 100.0; // number of convolution steps
132  Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
133 
134  // Variables
135  Double_t xx;
136  Double_t mpc;
137  Double_t fland;
138  Double_t sum = 0.0;
139  Double_t xlow, xupp;
140  Double_t step;
141 
142  // MP shift correction
143  mpc = par[1] - mpshift * par[0] * par[1];
144 
145  // Range of convolution integral
146  xlow = x[0] - sc * par[3];
147  xupp = x[0] + sc * par[3];
148 
149  step = (xupp - xlow) / np;
150 
151  // Convolution integral of Landau and Gaussian by sum
152  for (double ij = 1.0; ij <= np / 2; ij++) {
153  xx = xlow + (ij - .5) * step;
154  fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0];
155  sum += fland * TMath::Gaus(x[0], xx, par[3]);
156  xx = xupp - (ij - .5) * step;
157  fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0];
158  sum += fland * TMath::Gaus(x[0], xx, par[3]);
159  }
160 
161  return (par[2] * step * sum * invsq2pi / par[3]);
162 }
163 
164 Double_t totalfunc(Double_t* x, Double_t* par) { return gausX(x, par) + langaufun(x, &par[3]); }
165 
166 void fcnbg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) {
167  double fval = -par[0];
168  for (unsigned ij = 0; ij < cro_ssg[ietafit][iphifit].size(); ij++) {
169  double xval = (double)cro_ssg[ietafit][iphifit][ij];
170  fval += std::log(std::max(1.e-30, par[0] * TMath::Gaus(xval, par[1], par[2], true)));
171  // fval +=std::log(par[0]*TMath::Gaus(xval, par[1], par[2], 1));
172  }
173  f = -fval;
174 }
175 
176 void fcnsg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) {
177  double xval[2];
178  double fval = -(par[0] + par[5]);
179  for (unsigned ij = 0; ij < sig_reg[ietafit][iphifit].size(); ij++) {
180  xval[0] = (double)sig_reg[ietafit][iphifit][ij];
181  fval += std::log(totalfunc(xval, par));
182  }
183  f = -fval;
184 }
185 
186 void set_mean(double& x, bool mdigi) {
187  if (mdigi) {
188  x = std::min(x, 0.5);
189  x = std::max(x, -0.5);
190  } else {
191  x = std::min(x, 0.1);
192  x = std::max(x, -0.1);
193  }
194 }
195 
196 void set_sigma(double& x, bool mdigi) {
197  if (mdigi) {
198  x = std::min(x, 1.2);
199  x = std::max(x, -1.2);
200  } else {
201  x = std::min(x, 0.24);
202  x = std::max(x, 0.03);
203  }
204 }
205 
207 public:
208  explicit HOCalibAnalyzer(const edm::ParameterSet&);
209  ~HOCalibAnalyzer() override;
210 
211 private:
212  void beginJob() override;
213  void analyze(const edm::Event&, const edm::EventSetup&) override;
214  void endJob() override;
215 
216  int getHOieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; }
217  int invert_HOieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; }
218 
219  TFile* theFile;
223 
225  bool m_hotime;
226  bool m_hbtime;
227  bool m_correl;
229  bool m_hbinfo;
232  bool m_figure;
233  bool m_cosmic;
234  bool m_histfit;
236  double m_sigma;
237 
238  static const int ncut = 13;
239  static const int mypow_2_ncut = 8192; // 2^13, should be changed to match ncut
240 
241  int ipass;
242 
243  TTree* T1;
244 
245  TH2F* ho_entry;
246  TH2F* ho_energy;
247  TH2F* ho_energy2;
248  TH2F* ho_rms;
250 
251  TH1F* muonnm;
252  TH1F* muonmm;
253  TH1F* muonth;
254  TH1F* muonph;
255  TH1F* muonch;
256 
257  TH1F* sel_muonnm;
258  TH1F* sel_muonmm;
259  TH1F* sel_muonth;
260  TH1F* sel_muonph;
261  TH1F* sel_muonch;
262 
263  TProfile* hotime[netamx][nphimx];
264  TProfile* hopedtime[netamx][nphimx];
265  TProfile* hbtime[netamx][nphimx];
266 
272 
275 
276  TH1F* mncorrsglb;
277  TH1F* mncorrsgrb;
278  TH1F* mncorrsglu;
279  TH1F* mncorrsgru;
280  TH1F* mncorrsgall;
281 
282  TH1F* mncorrsgl;
283  TH1F* mncorrsgr;
284 
285  TH1F* rmscorrsglb;
286  TH1F* rmscorrsgrb;
287  TH1F* rmscorrsglu;
288  TH1F* rmscorrsgru;
290 
291  TH1F* rmscorrsgl;
292  TH1F* rmscorrsgr;
293 
294  TH1F* nevcorrsglb;
295  TH1F* nevcorrsgrb;
296  TH1F* nevcorrsglu;
297  TH1F* nevcorrsgru;
299 
300  TH1F* nevcorrsgl;
301  TH1F* nevcorrsgr;
302 
304  TH1F* mncorrsgc;
305  TH1F* rmscorrsgc;
306  TH1F* nevcorrsgc;
307 
308  TH1F* sigrsg[netamx][nphimx + 1];
309  TH1F* crossg[netamx][nphimx + 1];
310  float invang[netamx][nphimx + 1];
311 
312  TH1F* mnsigrsg;
313  TH1F* mncrossg;
314 
315  TH1F* rmssigrsg;
316  TH1F* rmscrossg;
317 
318  TH1F* nevsigrsg;
319  TH1F* nevcrossg;
320 
321  TH1F* ho_sig2p[9];
322  TH1F* ho_sig1p[9];
323  TH1F* ho_sig00[9];
324  TH1F* ho_sig1m[9];
325  TH1F* ho_sig2m[9];
326 
327  TH1F* hbhe_sig[9];
328 
329  static const int ringmx = 5;
330  static const int sectmx = 12;
331  static const int routmx = 36;
332  static const int rout12mx = 24;
333  static const int neffip = 6;
334 
335  TProfile* com_hotime[ringmx][sectmx];
337 
338  TProfile* com_hbtime[ringmx][sectmx];
339 
345 
348 
350 
351  TH1F* com_sigrsg[ringmx][routmx + 1];
352  TH1F* com_crossg[ringmx][routmx + 1];
353  float com_invang[ringmx][routmx + 1];
354 
355  TH1F* ped_evt;
356  TH1F* ped_mean;
357  TH1F* ped_width;
358  TH1F* fit_chi;
359  TH1F* sig_evt;
360  TH1F* fit_sigevt;
361  TH1F* fit_bkgevt;
362  TH1F* sig_mean;
363  TH1F* sig_diff;
364  TH1F* sig_width;
365  TH1F* sig_sigma;
366  TH1F* sig_meanerr;
368  TH1F* sig_signf;
369 
372  TH1F* ped_rms;
373  TH1F* sig_rms;
374 
376 
378  TH1F* stat_eta[netamx];
380  TH1F* peak_eta[netamx];
381 
383  // TH1F* stat_hpdrm[ringmx];
384  // TH1F* statmn_hpdrm[ringmx];
386 
390 
391  TH2F* sig_effi[neffip];
392  TH2F* mean_energy;
393 
394  double fitprm[nsgpr][netamx];
395 
396  TProfile* sigvsevt[15][ncut];
397 
398  // int irun, ievt, itrg1, itrg2, isect, nrecht, nfound, nlost, ndof, nmuon;
399  unsigned ievt, hoflag;
401 
403  hosig[9], hocorsig[18], hocro, hbhesig[9], caloen[3];
405 
406  int Nevents;
407  int nbn;
408  float alow;
409  float ahigh;
410  float binwid;
411  int irunold;
412 
416  // ----------member data ---------------------------
417 };
418 
419 const int HOCalibAnalyzer::ringmx;
420 const int HOCalibAnalyzer::sectmx;
421 const int HOCalibAnalyzer::routmx;
422 const int HOCalibAnalyzer::rout12mx;
423 const int HOCalibAnalyzer::neffip;
424 
425 //
426 // constants, enums and typedefs
427 //
428 
429 //
430 // static data member definitions
431 //
432 
433 //
434 // constructors and destructor
435 //
436 
438 // It is very likely you want the following in your configuration
439 // hoCalibVariableCollectionTag = cms.InputTag('hoCalibProducer', 'HOCalibVariableCollection')
440 {
441  tok_ho_ = consumes<HOCalibVariableCollection>(iConfig.getParameter<edm::InputTag>("hoCalibVariableCollectionTag"));
442  tok_allho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInputTag"));
443  //now do what ever initialization is needed
444  ipass = 0;
445  Nevents = 0;
446 
447  theRootFileName = iConfig.getUntrackedParameter<std::string>("RootFileName", "test.root");
448  theoutputtxtFile = iConfig.getUntrackedParameter<std::string>("txtFileName", "test.txt");
449  theoutputpsFile = iConfig.getUntrackedParameter<std::string>("psFileName", "test.ps");
450 
451  m_allHOsignal = iConfig.getUntrackedParameter<bool>("allsignal", false);
452  m_hbinfo = iConfig.getUntrackedParameter<bool>("hbinfo", false);
453  m_hbtime = iConfig.getUntrackedParameter<bool>("hbtime", false);
454  m_hotime = iConfig.getUntrackedParameter<bool>("hotime", false);
455  m_correl = iConfig.getUntrackedParameter<bool>("correl", false);
456  m_checkmap = iConfig.getUntrackedParameter<bool>("checkmap", false);
457  m_combined = iConfig.getUntrackedParameter<bool>("combined", false);
458  m_constant = iConfig.getUntrackedParameter<bool>("get_constant", false);
459  m_figure = iConfig.getUntrackedParameter<bool>("get_figure", true);
460  m_histfit = iConfig.getUntrackedParameter<bool>("histFit", true);
461  m_pedsuppr = iConfig.getUntrackedParameter<bool>("pedSuppr", true);
462  m_cosmic = iConfig.getUntrackedParameter<bool>("cosmic", true);
463  m_sigma = iConfig.getUntrackedParameter<double>("sigma", 0.05);
464 
466 
467  theFile = new TFile(theRootFileName.c_str(), "RECREATE");
468  theFile->cd();
469 
470  T1 = new TTree("T1", "DT+CSC+HO");
471 
472  T1->Branch("irun", &irun, "irun/I");
473  T1->Branch("ievt", &ievt, "ievt/i");
474 
475  // T1->Branch("itrg1",&itrg1,"itrg1/I");
476  // T1->Branch("itrg2",&itrg2,"itrg2/I");
477 
478  T1->Branch("isect", &isect, "isect/I");
479  T1->Branch("isect2", &isect2, "isect2/I");
480  T1->Branch("ndof", &ndof, "ndof/I");
481  T1->Branch("nmuon", &nmuon, "nmuon/I");
482 
483  T1->Branch("ilumi", &ilumi, "ilumi/I");
484  if (!m_cosmic) {
485  T1->Branch("inslumi", &inslumi, "inslumi/F");
486  T1->Branch("nprim", &nprim, "nprim/I");
487  T1->Branch("tkpt03", &tkpt03, " tkpt03/F");
488  T1->Branch("ecal03", &ecal03, " ecal03/F");
489  T1->Branch("hcal03", &hcal03, " hcal03/F");
490  }
491 
492  T1->Branch("trkdr", &trkdr, "trkdr/F");
493  T1->Branch("trkdz", &trkdz, "trkdz/F");
494 
495  T1->Branch("trkvx", &trkvx, "trkvx/F");
496  T1->Branch("trkvy", &trkvy, "trkvy/F");
497  T1->Branch("trkvz", &trkvz, "trkvz/F");
498  T1->Branch("trkmm", &trkmm, "trkmm/F");
499  T1->Branch("trkth", &trkth, "trkth/F");
500  T1->Branch("trkph", &trkph, "trkph/F");
501 
502  T1->Branch("chisq", &chisq, "chisq/F");
503  T1->Branch("therr", &therr, "therr/F");
504  T1->Branch("pherr", &pherr, "pherr/F");
505  T1->Branch("hodx", &hodx, "hodx/F");
506  T1->Branch("hody", &hody, "hody/F");
507  T1->Branch("hoang", &hoang, "hoang/F");
508 
509  T1->Branch("momatho", &momatho, "momatho/F");
510  T1->Branch("hoflag", &hoflag, "hoflag/i");
511  T1->Branch("htime", &htime, "htime/F");
512  T1->Branch("hosig", hosig, "hosig[9]/F");
513  T1->Branch("hocro", &hocro, "hocro/F");
514  T1->Branch("hocorsig", hocorsig, "hocorsig[18]/F");
515  T1->Branch("caloen", caloen, "caloen[3]/F");
516 
517  if (m_hbinfo) { // #ifdef HBINFO
518  T1->Branch("hbhesig", hbhesig, "hbhesig[9]/F");
519  } //m_hbinfo #endif
520 
521  char name[200];
522  char title[200];
523 
524  if (m_allHOsignal) {
525  ho_entry = fs->make<TH2F>(
526  "ho_entry", "ho entry", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5);
527 
528  ho_energy = fs->make<TH2F>(
529  "ho_energy", "ho energy (GeV)", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5);
530 
531  ho_energy2 = fs->make<TH2F>("ho_energy2",
532  "ho energy2 (GeV*GeV)",
533  netamx + 1,
534  -netamx / 2 - 0.5,
535  netamx / 2 + 0.5,
536  nphimx,
537  0.5,
538  nphimx + 0.5);
539 
540  ho_rms = fs->make<TH2F>(
541  "ho_rms", "ho rms (GeV)", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5);
542 
543  for (int ij = 0; ij < netamx; ij++) {
544  int ieta = getHOieta(ij);
545  for (int jk = 0; jk < nphimx; jk++) {
546  sprintf(name, "ho_indenergy_%i_%i", ij, jk);
547  sprintf(title, "ho IndEnergy (GeV) i#eta=%i i#phi=%i", ieta, jk + 1);
548  ho_indenergy[ij][jk] = fs->make<TH1F>(name, title, 120, -5., 55.);
549  }
550  }
551  }
552 
553  muonnm = fs->make<TH1F>("muonnm", "No of muon", 10, -0.5, 9.5);
554  muonmm = fs->make<TH1F>("muonmm", "P_{mu}", 200, -100., 100.);
555  muonth = fs->make<TH1F>("muonth", "{Theta}_{mu}", 180, 0., 180.);
556  muonph = fs->make<TH1F>("muonph", "{Phi}_{mu}", 180, -180., 180.);
557  muonch = fs->make<TH1F>("muonch", "{chi^2}/ndf", 100, 0., 1000.);
558 
559  sel_muonnm = fs->make<TH1F>("sel_muonnm", "No of muon(sel)", 10, -0.5, 9.5);
560  sel_muonmm = fs->make<TH1F>("sel_muonmm", "P_{mu}(sel)", 200, -100., 100.);
561  sel_muonth = fs->make<TH1F>("sel_muonth", "{Theta}_{mu}(sel)", 180, 0., 180.);
562  sel_muonph = fs->make<TH1F>("sel_muonph", "{Phi}_{mu}(sel)", 180, -180., 180.);
563  sel_muonch = fs->make<TH1F>("sel_muonch", "{chi^2}/ndf(sel)", 100, 0., 1000.);
564 
565  int nbin = 50; //40;// 45; //50; //55; //60; //55; //45; //40; //50;
566  alow = -2.0; // -1.85; //-1.90; // -1.95; // -2.0;
567  ahigh = 8.0; // 8.15; // 8.10; // 8.05; // 8.0;
568 
569  float tmpwid = (ahigh - alow) / nbin;
570  nbn = int(-alow / tmpwid) + 1;
571  if (nbn < 0)
572  nbn = 0;
573  if (nbn > nbin)
574  nbn = nbin;
575 
576  edm::LogInfo("HOCalib") << "nbin " << nbin << " " << alow << " " << ahigh << " " << tmpwid << " " << nbn;
577 
578  for (int ij = 0; ij < 15; ij++) {
579  sprintf(title, "sigvsndof_ring%i", ij + 1);
580  sigvsevt[ij][0] = fs->make<TProfile>(title, title, 50, 0., 50., -9., 20.);
581 
582  sprintf(title, "sigvschisq_ring%i", ij + 1);
583  sigvsevt[ij][1] = fs->make<TProfile>(title, title, 50, 0., 30., -9., 20.);
584 
585  sprintf(title, "sigvsth_ring%i", ij + 1);
586  sigvsevt[ij][2] = fs->make<TProfile>(title, title, 50, .7, 2.4, -9., 20.);
587 
588  sprintf(title, "sigvsph_ring%i", ij + 1);
589  sigvsevt[ij][3] = fs->make<TProfile>(title, title, 50, -2.4, -0.7, -9., 20.);
590 
591  sprintf(title, "sigvstherr_ring%i", ij + 1);
592  sigvsevt[ij][4] = fs->make<TProfile>(title, title, 50, 0., 0.2, -9., 20.);
593 
594  sprintf(title, "sigvspherr_ring%i", ij + 1);
595  sigvsevt[ij][5] = fs->make<TProfile>(title, title, 50, 0., 0.2, -9., 20.);
596 
597  sprintf(title, "sigvsdircos_ring%i", ij + 1);
598  sigvsevt[ij][6] = fs->make<TProfile>(title, title, 50, 0.5, 1., -9., 20.);
599 
600  sprintf(title, "sigvstrkmm_ring%i", ij + 1);
601  sigvsevt[ij][7] = fs->make<TProfile>(title, title, 50, 0., 50., -9., 20.);
602 
603  sprintf(title, "sigvsnmuon_ring%i", ij + 1);
604  sigvsevt[ij][8] = fs->make<TProfile>(title, title, 5, 0.5, 5.5, -9., 20.);
605 
606  sprintf(title, "sigvserr_ring%i", ij + 1);
607  sigvsevt[ij][9] = fs->make<TProfile>(title, title, 50, 0., .3, -9., 20.);
608 
609  sprintf(title, "sigvsaccx_ring%i", ij + 1);
610  sigvsevt[ij][10] = fs->make<TProfile>(title, title, 100, -25., 25., -9., 20.);
611 
612  sprintf(title, "sigvsaccy_ring%i", ij + 1);
613  sigvsevt[ij][11] = fs->make<TProfile>(title, title, 100, -25., 25., -9., 20.);
614 
615  sprintf(title, "sigvscalo_ring%i", ij + 1);
616  sigvsevt[ij][12] = fs->make<TProfile>(title, title, 100, 0., 15., -9., 20.);
617  }
618 
619  for (int jk = 0; jk < netamx; jk++) {
620  int ieta = (jk < 15) ? jk + 1 : 14 - jk;
621  for (int ij = 0; ij < nphimx + 1; ij++) {
622  if (ij == nphimx) {
623  sprintf(title, "sig_eta%i_allphi", ieta);
624  } else {
625  sprintf(title, "sig_eta%i_phi%i", ieta, ij + 1);
626  }
627  sigrsg[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
628  if (ij == nphimx) {
629  sprintf(title, "ped_eta%i_allphi", ieta);
630  } else {
631  sprintf(title, "ped_eta%i_phi%i", ieta, ij + 1);
632  }
633  crossg[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
634  }
635 
636  for (int ij = 0; ij < nphimx; ij++) {
637  if (m_hotime) { //#ifdef HOTIME
638  sprintf(title, "hotime_eta%i_phi%i", (jk <= 14) ? jk + 1 : 14 - jk, ij + 1);
639  hotime[jk][ij] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
640 
641  sprintf(title, "hopedtime_eta%i_phi%i", (jk <= 14) ? jk + 1 : 14 - jk, ij + 1);
642  hopedtime[jk][ij] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
643 
644  } //m_hotime #endif
645  if (m_hbtime) { //#ifdef HBTIME
646  sprintf(title, "hbtime_eta%i_phi%i", (jk <= 15) ? jk + 1 : 15 - jk, ij + 1);
647  hbtime[jk][ij] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
648  } //m_hbtime #endif
649 
650  if (m_correl) { //#ifdef CORREL
651  sprintf(title, "corrsg_eta%i_phi%i_leftbottom", ieta, ij + 1);
652  corrsglb[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
653 
654  sprintf(title, "corrsg_eta%i_phi%i_rightbottom", ieta, ij + 1);
655  corrsgrb[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
656 
657  sprintf(title, "corrsg_eta%i_phi%i_leftup", ieta, ij + 1);
658  corrsglu[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
659 
660  sprintf(title, "corrsg_eta%i_phi%i_rightup", ieta, ij + 1);
661  corrsgru[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
662 
663  sprintf(title, "corrsg_eta%i_phi%i_all", ieta, ij + 1);
664  corrsgall[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
665 
666  sprintf(title, "corrsg_eta%i_phi%i_left", ieta, ij + 1);
667  corrsgl[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
668 
669  sprintf(title, "corrsg_eta%i_phi%i_right", ieta, ij + 1);
670  corrsgr[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
671  } //m_correl #endif
672  if (m_checkmap) { // #ifdef CHECKMAP
673  sprintf(title, "corrsg_eta%i_phi%i_centrl", ieta, ij + 1);
674  corrsgc[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
675  } //m_checkmap #endif
676  }
677  }
678 
679  mnsigrsg = fs->make<TH1F>(
680  "mnsigrsg", "mnsigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5);
681  rmssigrsg = fs->make<TH1F>(
682  "rmssigrsg", "rmssigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5);
683  nevsigrsg = fs->make<TH1F>(
684  "nevsigrsg", "nevsigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5);
685 
686  mncrossg = fs->make<TH1F>(
687  "mncrossg", "mncrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5);
688  rmscrossg = fs->make<TH1F>(
689  "rmscrossg", "rmscrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5);
690  nevcrossg = fs->make<TH1F>(
691  "nevcrossg", "nevcrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5);
692 
693  for (int ij = 0; ij < neffip; ij++) {
694  if (ij == 0) {
695  sprintf(title, "Total projected muon in tower");
696  sprintf(name, "total_evt");
697  } else {
698  sprintf(title, "Efficiency with sig >%i #sigma", ij);
699  sprintf(name, "Effi_with_gt%i_sig", ij);
700  }
701  sig_effi[ij] =
702  fs->make<TH2F>(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5);
703  }
704 
705  sprintf(title, "Mean Energy of all towers");
706  sprintf(name, "mean_energy");
707  mean_energy = fs->make<TH2F>(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5);
708 
709  if (m_correl) { //#ifdef CORREL
710  mncorrsglb = fs->make<TH1F>("mncorrsglb", "mncorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
711  rmscorrsglb = fs->make<TH1F>("rmscorrsglb", "rmscorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
712  nevcorrsglb = fs->make<TH1F>("nevcorrsglb", "nevcorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
713 
714  mncorrsgrb = fs->make<TH1F>("mncorrsgrb", "mncorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
715  rmscorrsgrb = fs->make<TH1F>("rmscorrsgrb", "rmscorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
716  nevcorrsgrb = fs->make<TH1F>("nevcorrsgrb", "nevcorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
717 
718  mncorrsglu = fs->make<TH1F>("mncorrsglu", "mncorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
719  rmscorrsglu = fs->make<TH1F>("rmscorrsglu", "rmscorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
720  nevcorrsglu = fs->make<TH1F>("nevcorrsglu", "nevcorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
721 
722  mncorrsgru = fs->make<TH1F>("mncorrsgru", "mncorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
723  rmscorrsgru = fs->make<TH1F>("rmscorrsgru", "rmscorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
724  nevcorrsgru = fs->make<TH1F>("nevcorrsgru", "nevcorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
725 
726  mncorrsgall = fs->make<TH1F>("mncorrsgall", "mncorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
727  rmscorrsgall = fs->make<TH1F>("rmscorrsgall", "rmscorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
728  nevcorrsgall = fs->make<TH1F>("nevcorrsgall", "nevcorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
729 
730  mncorrsgl = fs->make<TH1F>("mncorrsgl", "mncorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
731  rmscorrsgl = fs->make<TH1F>("rmscorrsgl", "rmscorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
732  nevcorrsgl = fs->make<TH1F>("nevcorrsgl", "nevcorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
733 
734  mncorrsgr = fs->make<TH1F>("mncorrsgr", "mncorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
735  rmscorrsgr = fs->make<TH1F>("rmscorrsgr", "rmscorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
736  nevcorrsgr = fs->make<TH1F>("nevcorrsgr", "nevcorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
737  } //m_correl #endif
738 
739  if (m_checkmap) { //#ifdef CHECKMAP
740  mncorrsgc = fs->make<TH1F>("mncorrsgc", "mncorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
741  rmscorrsgc = fs->make<TH1F>("rmscorrsgc", "rmscorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
742  nevcorrsgc = fs->make<TH1F>("nevcorrsgc", "nevcorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5);
743  } //m_checkmap #endif
744 
745  if (m_combined) { //#ifdef COMBINED
746  for (int jk = 0; jk < ringmx; jk++) {
747  for (int ij = 0; ij < routmx + 1; ij++) {
748  if (jk != 2 && ij > rout12mx)
749  continue;
750  int phmn = 3 * ij - 1;
751  int phmx = 3 * ij + 1;
752  if (jk == 2) {
753  phmn = 2 * ij - 1;
754  phmx = 2 * ij;
755  }
756  if (phmn <= 0)
757  phmn = nphimx + phmn;
758  if (phmx <= 0)
759  phmx = nphimx + phmx;
760 
761  if ((jk == 2 && ij == routmx) || (jk != 2 && ij == rout12mx)) {
762  sprintf(title, "sig_ring%i_allrm", jk - 2);
763  sprintf(name, "sig_ring%i_allrm", jk - 2);
764  } else {
765  sprintf(title, "sig_ring%i_phi%i-%i", jk - 2, phmn, phmx);
766  sprintf(name, "sig_ring%i_rout%i", jk - 2, ij + 1);
767  }
768  com_sigrsg[jk][ij] = fs->make<TH1F>(name, title, nbin, alow, ahigh);
769  if ((jk == 2 && ij == routmx) || (jk != 2 && ij == rout12mx)) {
770  sprintf(title, "ped_ring%i_allrm", jk - 2);
771  sprintf(name, "ped_ring%i_allrm", jk - 2);
772  } else {
773  sprintf(title, "ped_ring%i_phi%i-%i", jk - 2, phmn, phmx);
774  sprintf(name, "ped_ring%i_rout%i", jk - 2, ij + 1);
775  }
776  com_crossg[jk][ij] = fs->make<TH1F>(name, title, nbin, alow, ahigh);
777  }
778 
779  for (int ij = 0; ij < sectmx; ij++) {
780  if (m_hotime) { //#ifdef HOTIME
781  sprintf(title, "com_hotime_ring%i_sect%i", jk - 2, ij + 1);
782  com_hotime[jk][ij] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
783 
784  sprintf(title, "com_hopedtime_ring%i_sect%i", jk - 2, ij + 1);
785  com_hopedtime[jk][ij] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
786  } //m_hotime #endif
787  if (m_hbtime) { //#ifdef HBTIME
788  sprintf(title, "_com_hbtime_ring%i_serrct%i", jk - 2, ij + 1);
789  com_hbtime[jk][ij] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
790  } //m_hbtime #endif
791 
792  if (m_correl) { //#ifdef CORREL
793  sprintf(title, "com_corrsg_ring%i_sect%i_leftbottom", jk - 2, ij + 1);
794  com_corrsglb[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
795 
796  sprintf(title, "com_corrsg_ring%i_sect%i_rightbottom", jk - 2, ij + 1);
797  com_corrsgrb[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
798 
799  sprintf(title, "com_corrsg_ring%i_sect%i_leftup", jk - 2, ij + 1);
800  com_corrsglu[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
801 
802  sprintf(title, "com_corrsg_ring%i_sect%i_rightup", jk - 2, ij + 1);
803  com_corrsgru[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
804 
805  sprintf(title, "com_corrsg_ring%i_sect%i_all", jk - 2, ij + 1);
806  com_corrsgall[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
807 
808  sprintf(title, "com_corrsg_ring%i_sect%i_left", jk - 2, ij + 1);
809  com_corrsgl[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
810 
811  sprintf(title, "com_corrsg_ring%i_sect%i_right", jk - 2, ij + 1);
812  com_corrsgr[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
813  } //m_correl #endif
814 
815  if (m_checkmap) { // #ifdef CHECKMAP
816  sprintf(title, "com_corrsg_ring%i_sect%i_centrl", jk - 2, ij + 1);
817  com_corrsgc[jk][ij] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
818  } //m_checkmap #endif
819  }
820  }
821  } //m_combined #endif
822 
823  for (int ij = -1; ij <= 1; ij++) {
824  for (int jk = -1; jk <= 1; jk++) {
825  int kl = 3 * (ij + 1) + jk + 1;
826 
827  sprintf(title, "hosct2p_eta%i_phi%i", ij, jk);
828  ho_sig2p[kl] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
829 
830  sprintf(title, "hosct1p_eta%i_phi%i", ij, jk);
831  ho_sig1p[kl] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
832 
833  sprintf(title, "hosct00_eta%i_phi%i", ij, jk);
834  ho_sig00[kl] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
835 
836  sprintf(title, "hosct1m_eta%i_phi%i", ij, jk);
837  ho_sig1m[kl] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
838 
839  sprintf(title, "hosct2m_eta%i_phi%i", ij, jk);
840  ho_sig2m[kl] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
841 
842  if (m_hbinfo) { // #ifdef HBINFO
843  sprintf(title, "hbhesig_eta%i_phi%i", ij, jk);
844  hbhe_sig[kl] = fs->make<TH1F>(title, title, 51, -10.5, 40.5);
845  } //m_hbinfo #endif
846  }
847  }
848 
849  if (m_constant) {
850  ped_evt = fs->make<TH1F>("ped_evt", "ped_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
851  ped_mean = fs->make<TH1F>("ped_mean", "ped_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
852  ped_width = fs->make<TH1F>("ped_width", "ped_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
853 
854  fit_chi = fs->make<TH1F>("fit_chi", "fit_chi", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
855  sig_evt = fs->make<TH1F>("sig_evt", "sig_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
856  fit_sigevt = fs->make<TH1F>("fit_sigevt", "fit_sigevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
857  fit_bkgevt = fs->make<TH1F>("fit_bkgevt", "fit_bkgevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
858  sig_mean = fs->make<TH1F>("sig_mean", "sig_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
859  sig_diff = fs->make<TH1F>("sig_diff", "sig_diff", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
860  sig_width = fs->make<TH1F>("sig_width", "sig_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
861  sig_sigma = fs->make<TH1F>("sig_sigma", "sig_sigma", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
862  sig_meanerr = fs->make<TH1F>("sig_meanerr", "sig_meanerr", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
863  sig_meanerrp = fs->make<TH1F>("sig_meanerrp", "sig_meanerrp", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
864  sig_signf = fs->make<TH1F>("sig_signf", "sig_signf", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
865 
866  ped_statmean = fs->make<TH1F>("ped_statmean", "ped_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
867  sig_statmean = fs->make<TH1F>("sig_statmean", "sig_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
868  ped_rms = fs->make<TH1F>("ped_rms", "ped_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
869  sig_rms = fs->make<TH1F>("sig_rms", "sig_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5);
870 
871  const_eta_phi = fs->make<TH2F>(
872  "const_eta_phi", "const_eta_phi", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2., nphimx, 0.5, nphimx + 0.5);
873 
874  for (int ij = 0; ij < netamx; ij++) {
875  int ieta = (ij < 15) ? ij + 1 : 14 - ij;
876  sprintf(title, "Cont_Eta_%i", ieta);
877  const_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx + 0.5);
878 
879  sprintf(title, "Peak_Eta_%i", ieta);
880  peak_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx + 0.5);
881  }
882 
883  for (int ij = 0; ij < ringmx; ij++) {
884  int iring = ij - 2;
885  int iread = (ij == 2) ? routmx : rout12mx;
886  sprintf(title, "Cont_hpdrm_%i", iring);
887  const_hpdrm[ij] = fs->make<TH1F>(title, title, iread, 0.5, iread + 0.5);
888 
889  sprintf(title, "Peak_hpdrm_%i", iring);
890  peak_hpdrm[ij] = fs->make<TH1F>(title, title, iread, 0.5, iread + 0.5);
891  }
892 
893  mean_phi_hst = fs->make<TH1F>("mean_phi_hst", "mean_phi_hst", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2.);
894  mean_phi_ave = fs->make<TH1F>("mean_phi_ave", "mean_phi_ave", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2.);
895 
896  mean_eta_ave = fs->make<TH1F>("mean_eta_ave", "mean_eta_ave", nphimx, 0.5, nphimx + 0.5);
897 
898  } //m_constant
899 
900  for (int ij = 0; ij < netamx; ij++) {
901  int ieta = (ij < 15) ? ij + 1 : 14 - ij;
902 
903  sprintf(title, "Stat_Eta_%i", ieta);
904  stat_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx + 0.5);
905 
906  sprintf(title, "#mu(stat)_Eta_%i", ieta);
907  statmn_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx + 0.5);
908  }
909 
910  for (int jk = 0; jk < netamx; jk++) {
911  for (int ij = 0; ij < nphimx; ij++) {
912  invang[jk][ij] = 0.0;
913  }
914  }
915  for (int jk = 0; jk < ringmx; jk++) {
916  for (int ij = 0; ij < routmx + 1; ij++) {
917  com_invang[jk][ij] = 0.0;
918  }
919  }
920 }
921 
923  // do anything here that needs to be done at desctruction time
924  // (e.g. close files, deallocate resources etc.)
925 
926  theFile->cd();
927  theFile->Write();
928  theFile->Close();
929  edm::LogInfo("HOCalib") << " Ttoal events = " << Nevents << " Selected events # is " << ipass;
930 }
931 
932 //
933 // member functions
934 //
935 
936 // ------------ method called to for each event ------------
938  // calcualte these once (and avoid the pow(int,int) ambiguities for c++)
939  int mypow_2_0 = 1; // 2^0
940  int mypow_2_1 = 2; // 2^1
941  int mypow_2_2 = 4; // 2^2
942 
943  int mypow_2_3 = 8; // 2^3
944  int mypow_2_4 = 16; // 2^4
945  int mypow_2_5 = 32; // 2^5
946  int mypow_2_6 = 64; // 2^6
947  int mypow_2_7 = 128; // 2^7
948  int mypow_2_8 = 256; // 2^8
949  int mypow_2_9 = 512; // 2^9
950  int mypow_2_10 = 1024; // 2^10
951  int mypow_2_11 = 2048; // 2^11
952  int mypow_2_12 = 4096; // 2^12
953 
954  /*
955  //FIXGM Put this is initialiser
956  int mapx1[6][3]={{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {19,18,17}};
957  // int etamap1[21]={-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, 5,5,5, -1};
958  // int phimap1[21]={-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0,-1};
959 
960  int mapx2[6][3]={{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {-1,-1,-1}};
961  // int etamap2[21]={-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, -1,-1,-1, -1};
962  // int phimap2[21]={-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2, 1, 0, -1};
963 
964  int mapx0p[9][2]={{3,1}, {7,4}, {6,5}, {12,8}, {0,0}, {11,9}, {16,13}, {15,14}, {19,17}};
965  int mapx0m[9][2]={{17,19}, {14,15}, {13,16}, {9,11}, {0,0}, {8,12}, {5,6}, {4,7}, {1,3}};
966 
967  // int etamap0p[21]={-1, 0,-1,0, 1,2,2, 1,3,5, -1, 5,3,6, 7,7,6, 8,-1,8, -1};
968  // int phimap0p[21]={-1, 1,-1,0, 1,1,0, 0,1,1, -1, 0,0,1, 1,0,0, 1,-1,0, -1};
969 
970  // int etamap0m[21]={-1, 8,-1,8, 7,6,6, 7,5,3, -1, 3,5,2, 1,1,2, 0,-1,0, -1};
971  // int phimap0m[21]={-1, 0,-1,1, 0,0,1, 1,0,0, -1, 1,1,0, 0,1,1, 0,-1,1, -1};
972 
973  int etamap[4][21]={{-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, -1,-1,-1, -1}, //etamap2
974  {-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, 5,5,5, -1}, //etamap1
975  {-1, 0,-1,0, 1,2,2, 1,3,5, -1, 5,3,6, 7,7,6, 8,-1,8, -1}, //etamap0p
976  {-1, 8,-1,8, 7,6,6, 7,5,3, -1, 3,5,2, 1,1,2, 0,-1,0, -1}}; //etamap0m
977 
978  int phimap[4][21] ={{-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0, -1}, //phimap2
979  {-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0, -1}, //phimap1
980  {-1, 1,-1,0, 1,1,0, 0,1,1, -1, 0,0,1, 1,0,0, 1,-1,0, -1}, //phimap0p
981  {-1, 0,-1,1, 0,0,1, 1,0,0, -1, 1,1,0, 0,1,1, 0,-1,1, -1}}; //phimap0m
982  //swapped phi map for R0+/R0- (15/03/07)
983  for (int ij=0; ij<4; ij++) {
984  for (int jk=0; jk<21; jk++) {
985  edm::LogInfo("HOCalib") <<"ieta "<<ij<<" "<<jk<<" "<<etamap[ij][jk];
986  }
987  }
988 
989  // Character convention for R+/-1/2
990  // int npixleft[21] = {-1, F, Q,-1, M, D, J,-1, T,-1, C,-1, R, P, H,-1, N, G};
991  // int npixrigh[21] = { Q, S,-1, D, J, L,-1, K,-1, E,-1, P, H, B,-1, G, A,-1};
992 
993  // int npixlb1[21]={-1,-1,-1,-1, F, Q, S,-1, M, J, L, T, K,-1, C, R, P, H};
994  // int npixrb1[21]={-1,-1,-1, F, Q, S,-1, M, D, L,-1, K,-1, C, E, P, H, B};
995  // int npixlu1[21]={ M, D, J, T, K,-1, C,-1, R, H, B,-1, N, G, A,-1,-1,-1};
996  // int npixru1[21]={ D, J, L, K,-1, C, E, R, P, B,-1, N, G, A,-1,-1,-1,-1};
997 
998  int npixleft[21]={0, 0, 1, 2, 0, 4, 5, 6, 0, 8, 0, 0,11, 0,13,14,15, 0,17,18,0};
999  int npixrigh[21]={0, 2, 3, 0, 5, 6, 7, 0, 9, 0, 0,12, 0,14,15,16, 0,18,19, 0,0};
1000  int npixlebt[21]={0, 0, 0, 0, 0, 1, 2, 3, 0, 4, 0, 6, 7, 8, 9, 0,11,13,14,15,0};
1001  int npixribt[21]={0, 0, 0, 0, 1, 2, 3, 0, 4, 5, 0, 7, 0, 9, 0,11,12,14,15,16,0};
1002  int npixleup[21]={0, 4, 5, 6, 8, 9, 0,11, 0,13, 0,15,16, 0,17,18,19, 0, 0, 0,0};
1003  int npixriup[21]={0, 5, 6, 7, 9, 0,11,12,13,14, 0,16, 0,17,18,19, 0, 0, 0, 0,0};
1004  */
1005 
1006  int iaxxx = 0;
1007  int ibxxx = 0;
1008 
1009  Nevents++;
1010 
1011  using namespace edm;
1012 
1013  float pival = acos(-1.);
1014  irunold = irun = iEvent.id().run();
1015  ievt = iEvent.id().event();
1016  ilumi = iEvent.luminosityBlock();
1017 
1018  if (m_allHOsignal) {
1020  iEvent.getByToken(tok_allho_, hoht);
1021  if (hoht.isValid() && !(*hoht).empty()) {
1022  ho_entry->Fill(-1., -1.); //Count of total number of entries
1023  for (HORecHitCollection::const_iterator ij = (*hoht).begin(); ij != (*hoht).end(); ij++) {
1024  HcalDetId id = (*ij).id();
1025  int tmpeta = id.ieta();
1026  int tmpphi = id.iphi();
1027  float signal = (*ij).energy();
1028  ho_entry->Fill(tmpeta, tmpphi);
1029  ho_energy->Fill(tmpeta, tmpphi, signal);
1030  ho_energy2->Fill(tmpeta, tmpphi, signal * signal);
1031 
1032  int inveta = invert_HOieta(tmpeta);
1033  ho_indenergy[inveta][tmpphi - 1]->Fill(signal);
1034  }
1035  }
1036  }
1037 
1039  bool isCosMu = true;
1040  try {
1041  iEvent.getByToken(tok_ho_, HOCalib);
1042 
1043  } catch (cms::Exception& iEvent) {
1044  isCosMu = false;
1045  }
1046  if (Nevents % 5000 == 1)
1047  edm::LogInfo("HOCalib") << "nmuon event # " << Nevents << " Run # " << iEvent.id().run() << " Evt # "
1048  << iEvent.id().event() << " " << ipass;
1049 
1050  if (isCosMu && !(*HOCalib).empty()) {
1051  nmuon = (*HOCalib).size();
1052  for (HOCalibVariableCollection::const_iterator hoC = (*HOCalib).begin(); hoC != (*HOCalib).end(); hoC++) {
1053  // itrg1 = (*hoC).trig1;
1054  // itrg2 = (*hoC).trig2;
1055  trkdr = (*hoC).trkdr;
1056  trkdz = (*hoC).trkdz;
1057 
1058  trkvx = (*hoC).trkvx;
1059  trkvy = (*hoC).trkvy;
1060  trkvz = (*hoC).trkvz;
1061 
1062  trkmm = (*hoC).trkmm;
1063  trkth = (*hoC).trkth;
1064  trkph = (*hoC).trkph;
1065 
1066  ndof = (int)(*hoC).ndof;
1067  // nrecht = (int)(*hoC).nrecht;
1068  chisq = (*hoC).chisq;
1069  momatho = (*hoC).momatho;
1070 
1071  therr = (*hoC).therr;
1072  pherr = (*hoC).pherr;
1073  trkph = (*hoC).trkph;
1074 
1075  if (!m_cosmic) {
1076  nprim = (*hoC).nprim;
1077  inslumi = (*hoC).inslumi;
1078  tkpt03 = (*hoC).tkpt03;
1079  ecal03 = (*hoC).ecal03;
1080  hcal03 = (*hoC).hcal03;
1081  }
1082 
1083  isect = (*hoC).isect;
1084  isect2 = (*hoC).isect2;
1085  hodx = (*hoC).hodx;
1086  hody = (*hoC).hody;
1087  hoang = (*hoC).hoang;
1088  htime = (*hoC).htime;
1089  hoflag = (*hoC).hoflag;
1090  for (int ij = 0; ij < 9; ij++) {
1091  hosig[ij] = (*hoC).hosig[ij];
1092  } //edm::LogInfo("HOCalib")<<"hosig "<<i<<" "<<hosig[ij];}
1093  for (int ij = 0; ij < 18; ij++) {
1094  hocorsig[ij] = (*hoC).hocorsig[ij];
1095  } // edm::LogInfo("HOCalib")<<"hocorsig "<<i<<" "<<hocorsig[ij];}
1096  hocro = (*hoC).hocro;
1097  for (int ij = 0; ij < 3; ij++) {
1098  caloen[ij] = (*hoC).caloen[ij];
1099  }
1100 
1101  if (m_hbinfo) {
1102  for (int ij = 0; ij < 9; ij++) {
1103  hbhesig[ij] = (*hoC).hbhesig[ij];
1104  }
1105  } // edm::LogInfo("HOCalib")<<"hbhesig "<<ij<<" "<<hbhesig[ij];}}
1106 
1107  T1->Fill();
1108 
1109  int ipsall = 0;
1110  int ips0 = 0;
1111  int ips1 = 0;
1112  int ips2 = 0;
1113  int ips3 = 0;
1114  int ips4 = 0;
1115  int ips5 = 0;
1116  int ips6 = 0;
1117  int ips7 = 0;
1118  int ips8 = 0;
1119  int ips9 = 0;
1120  int ips10 = 0;
1121  int ips11 = 0;
1122  int ips12 = 0;
1123 
1124  // int iselect3 = 0;
1125  // if (ndof >=15 && chisq <30) iselect3 = 1;
1126 
1127  if (isect < 0)
1128  continue; //FIXGM Is it proper place ?
1129  if (fabs(trkth - pival / 2) < 0.000001)
1130  continue; //22OCT07
1131 
1132  int ieta = int((abs(isect) % 10000) / 100.) - 50; //an offset to acodate -ve eta values
1133  if (abs(ieta) >= 16)
1134  continue;
1135  int iphi = abs(isect) % 100;
1136 
1137  int tmpsect = int((iphi + 1) / 6.) + 1;
1138  if (tmpsect > 12)
1139  tmpsect = 1;
1140 
1141  int iring = 0;
1142  int tmpeta = ieta + 4; //For pixel mapping
1143  if (ieta >= -15 && ieta <= -11) {
1144  iring = -2;
1145  tmpeta = -11 - ieta;
1146  } //abs(ieta)-11;}
1147  if (ieta >= -10 && ieta <= -5) {
1148  iring = -1;
1149  tmpeta = -5 - ieta;
1150  } // abs(ieta)-5;}
1151  if (ieta >= 5 && ieta <= 10) {
1152  iring = 1;
1153  tmpeta = ieta - 5;
1154  }
1155  if (ieta >= 11 && ieta <= 15) {
1156  iring = 2;
1157  tmpeta = ieta - 11;
1158  }
1159 
1160  int iring2 = iring + 2;
1161 
1162  int tmprout = (iring == 0) ? int((iphi + 1) / 2.) + 1 : int((iphi + 1) / 3.) + 1;
1163  int tmproutmx = (iring == 0) ? routmx : rout12mx;
1164  if (tmprout > tmproutmx)
1165  tmprout = 1;
1166 
1167  // CRUZET1
1168  if (m_cosmic) {
1169  /* GMA temoparily change to increase event size at 3 & 9 O'clock position */
1170  if (abs(ndof) >= 20 && abs(ndof) < 40) {
1171  ips0 = (int)mypow_2_0;
1172  ipsall += ips0;
1173  }
1174  if (chisq > 0 && chisq < 15) {
1175  ips1 = (int)mypow_2_1;
1176  ipsall += ips1;
1177  } //18Jan2008
1178  if (fabs(trkth - pival / 2) < 21.5) {
1179  ips2 = (int)mypow_2_2;
1180  ipsall += ips2;
1181  } //No nead for pp evt
1182  if (fabs(trkph + pival / 2) < 21.5) {
1183  ips3 = (int)mypow_2_3;
1184  ipsall += ips3;
1185  } //No nead for pp evt
1186 
1187  if (therr < 0.02) {
1188  ips4 = (int)mypow_2_4;
1189  ipsall += ips4;
1190  }
1191  if (pherr < 0.0002) {
1192  ips5 = (int)mypow_2_5;
1193  ipsall += ips5;
1194  }
1195  if (fabs(hoang) > 0.30) {
1196  ips6 = (int)mypow_2_6;
1197  ipsall += ips6;
1198  }
1199  if (fabs(trkmm) > 0.100) {
1200  ips7 = (int)mypow_2_7;
1201  ipsall += ips7;
1202  }
1203  // if (nmuon ==1) {ips8 = (int)mypow_2_8; ipsall +=ips8;}
1204  if (nmuon >= 1 && nmuon <= 4) {
1205  ips8 = (int)mypow_2_8;
1206  ipsall += ips8;
1207  }
1208 
1209  if (iring2 == 2) {
1210  if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) {
1211  ips10 = (int)mypow_2_10;
1212  ipsall += ips10;
1213  }
1214 
1215  if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) {
1216  ips11 = (int)mypow_2_11;
1217  ipsall += ips11;
1218  }
1219 
1220  } else {
1221  if (fabs(hodx) < 100 && fabs(hodx) > 2) {
1222  ips10 = (int)mypow_2_10;
1223  ipsall += ips10;
1224  }
1225 
1226  if (fabs(hody) < 100 && fabs(hody) > 2) {
1227  ips11 = (int)mypow_2_11;
1228  ipsall += ips11;
1229  }
1230  }
1231  if (caloen[0] == 0) {
1232  ips12 = (int)mypow_2_12;
1233  ipsall += ips12;
1234  }
1235  } else {
1236  //csa08
1237  if (abs(ndof) >= 20 && abs(ndof) < 40) {
1238  ips0 = (int)mypow_2_0;
1239  ipsall += ips0;
1240  }
1241  if (chisq > 0 && chisq < 15) {
1242  ips1 = (int)mypow_2_1;
1243  ipsall += ips1;
1244  } //18Jan2008
1245  if (fabs(trkth - pival / 2) < 21.5) {
1246  ips2 = (int)mypow_2_2;
1247  ipsall += ips2;
1248  } //No nead for pp evt
1249  if (fabs(trkph + pival / 2) < 21.5) {
1250  ips3 = (int)mypow_2_3;
1251  ipsall += ips3;
1252  } //No nead for pp evt
1253 
1254  if (therr < 0.02) {
1255  ips4 = (int)mypow_2_4;
1256  ipsall += ips4;
1257  }
1258  if (pherr < 0.0002) {
1259  ips5 = (int)mypow_2_5;
1260  ipsall += ips5;
1261  }
1262  if (fabs(hoang) > 0.30) {
1263  ips6 = (int)mypow_2_6;
1264  ipsall += ips6;
1265  }
1266  if (fabs(trkmm) > 4.0) {
1267  ips7 = (int)mypow_2_7;
1268  ipsall += ips7;
1269  }
1270  if (nmuon >= 1 && nmuon <= 2) {
1271  ips8 = (int)mypow_2_8;
1272  ipsall += ips8;
1273  }
1274 
1275  if (iring2 == 2) {
1276  if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) {
1277  ips10 = (int)mypow_2_10;
1278  ipsall += ips10;
1279  }
1280 
1281  if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) {
1282  ips11 = (int)mypow_2_11;
1283  ipsall += ips11;
1284  }
1285 
1286  } else {
1287  if (fabs(hodx) < 100 && fabs(hodx) > 2) {
1288  ips10 = (int)mypow_2_10;
1289  ipsall += ips10;
1290  }
1291 
1292  if (fabs(hody) < 100 && fabs(hody) > 2) {
1293  ips11 = (int)mypow_2_11;
1294  ipsall += ips11;
1295  }
1296  }
1297  // if (m_cosmic || (caloen[0] >0.5 && caloen[0]<5.0)) {ips12=(int)pow_2_12;ipsall +=ips12;}
1298  if (ndof > 0 && caloen[0] < 5.0) {
1299  ips12 = (int)mypow_2_12;
1300  ipsall += ips12;
1301  }
1302  /* */
1303  }
1304 
1305  if (htime > -40 && htime < 60) {
1306  ips9 = (int)mypow_2_9;
1307  ipsall += ips9;
1308  }
1309 
1310  if (ipsall - ips0 == mypow_2_ncut - mypow_2_0 - 1)
1311  sigvsevt[iring2][0]->Fill(abs(ndof), hosig[4]);
1312  if (ipsall - ips1 == mypow_2_ncut - mypow_2_1 - 1)
1313  sigvsevt[iring2][1]->Fill(chisq, hosig[4]);
1314  if (ipsall - ips2 == mypow_2_ncut - mypow_2_2 - 1)
1315  sigvsevt[iring2][2]->Fill(trkth, hosig[4]);
1316  if (ipsall - ips3 == mypow_2_ncut - mypow_2_3 - 1)
1317  sigvsevt[iring2][3]->Fill(trkph, hosig[4]);
1318  if (ipsall - ips4 == mypow_2_ncut - mypow_2_4 - 1)
1319  sigvsevt[iring2][4]->Fill(therr, hosig[4]);
1320  if (ipsall - ips5 == mypow_2_ncut - mypow_2_5 - 1)
1321  sigvsevt[iring2][5]->Fill(pherr, hosig[4]);
1322  if (ipsall - ips6 == mypow_2_ncut - mypow_2_6 - 1)
1323  sigvsevt[iring2][6]->Fill(hoang, hosig[4]);
1324  if (ipsall - ips7 == mypow_2_ncut - mypow_2_7 - 1)
1325  sigvsevt[iring2][7]->Fill(fabs(trkmm), hosig[4]);
1326  if (ipsall - ips8 == mypow_2_ncut - mypow_2_8 - 1)
1327  sigvsevt[iring2][8]->Fill(nmuon, hosig[4]);
1328  if (ipsall - ips9 == mypow_2_ncut - mypow_2_9 - 1)
1329  sigvsevt[iring2][9]->Fill(htime, hosig[4]);
1330  if (ipsall - ips10 == mypow_2_ncut - mypow_2_10 - 1)
1331  sigvsevt[iring2][10]->Fill(hodx, hosig[4]);
1332  if (ipsall - ips11 == mypow_2_ncut - mypow_2_11 - 1)
1333  sigvsevt[iring2][11]->Fill(hody, hosig[4]);
1334  if (!m_cosmic) {
1335  if (ipsall - ips12 == mypow_2_ncut - mypow_2_12 - 1)
1336  sigvsevt[iring2][12]->Fill(caloen[0], hosig[4]);
1337  }
1338 
1339  sigvsevt[iring2 + 5][0]->Fill(abs(ndof), hosig[4]);
1340  if (ips0 > 0) {
1341  sigvsevt[iring2 + 5][1]->Fill(chisq, hosig[4]);
1342  if (ips1 > 0) {
1343  sigvsevt[iring2 + 5][2]->Fill(trkth, hosig[4]);
1344  if (ips2 > 0) {
1345  sigvsevt[iring2 + 5][3]->Fill(trkph, hosig[4]);
1346  if (ips3 > 0) {
1347  sigvsevt[iring2 + 5][4]->Fill(therr, hosig[4]);
1348  if (ips4 > 0) {
1349  sigvsevt[iring2 + 5][5]->Fill(pherr, hosig[4]);
1350  if (ips5 > 0) {
1351  sigvsevt[iring2 + 5][6]->Fill(hoang, hosig[4]);
1352  if (ips6 > 0) {
1353  sigvsevt[iring2 + 5][7]->Fill(fabs(trkmm), hosig[4]);
1354  if (ips7 > 0) {
1355  sigvsevt[iring2 + 5][8]->Fill(nmuon, hosig[4]);
1356  if (ips8 > 0) {
1357  sigvsevt[iring2 + 5][9]->Fill(htime, hosig[4]);
1358  if (ips9 > 0) {
1359  sigvsevt[iring2 + 5][10]->Fill(hodx, hosig[4]);
1360  if (ips10 > 0) {
1361  sigvsevt[iring2 + 5][11]->Fill(hody, hosig[4]);
1362  if (ips11 > 0) {
1363  if (!m_cosmic)
1364  sigvsevt[iring2 + 5][12]->Fill(caloen[0], hosig[4]);
1365  }
1366  }
1367  }
1368  }
1369  }
1370  }
1371  }
1372  }
1373  }
1374  }
1375  }
1376  }
1377 
1378  sigvsevt[iring2 + 10][0]->Fill(abs(ndof), hosig[4]);
1379  sigvsevt[iring2 + 10][1]->Fill(chisq, hosig[4]);
1380  sigvsevt[iring2 + 10][2]->Fill(trkth, hosig[4]);
1381  sigvsevt[iring2 + 10][3]->Fill(trkph, hosig[4]);
1382  sigvsevt[iring2 + 10][4]->Fill(therr, hosig[4]);
1383  sigvsevt[iring2 + 10][5]->Fill(pherr, hosig[4]);
1384  sigvsevt[iring2 + 10][6]->Fill(hoang, hosig[4]);
1385  sigvsevt[iring2 + 10][7]->Fill(fabs(trkmm), hosig[4]);
1386  sigvsevt[iring2 + 10][8]->Fill(nmuon, hosig[4]);
1387  sigvsevt[iring2 + 10][9]->Fill(htime, hosig[4]);
1388  sigvsevt[iring2 + 10][10]->Fill(hodx, hosig[4]);
1389  sigvsevt[iring2 + 10][11]->Fill(hody, hosig[4]);
1390  if (!m_cosmic)
1391  sigvsevt[iring2 + 10][12]->Fill(caloen[0], hosig[4]);
1392 
1393  int iselect = (ipsall == mypow_2_ncut - 1) ? 1 : 0;
1394 
1395  if (hocro != -100.0 && hocro < -50.0)
1396  hocro += 100.;
1397 
1398  muonnm->Fill(nmuon);
1399  muonmm->Fill(trkmm);
1400  muonth->Fill(trkth * 180 / pival);
1401  muonph->Fill(trkph * 180 / pival);
1402  muonch->Fill(chisq);
1403 
1404  if (iselect == 1) {
1405  ipass++;
1406  sel_muonnm->Fill(nmuon);
1407  sel_muonmm->Fill(trkmm);
1408  sel_muonth->Fill(trkth * 180 / pival);
1409  sel_muonph->Fill(trkph * 180 / pival);
1410  sel_muonch->Fill(chisq);
1411  }
1412 
1413  // if (iselect3) T1->Fill();
1414 
1415  int tmpphi = (iphi + 1) % 3; //pixel mapping
1416  int npixel = 0;
1417  int itag = -1;
1418  int iflip = 0;
1419  int fact = 2;
1420 
1421  if (iring == 0) {
1422  tmpphi = (iphi + 1) % 2;
1423  if (tmpsect == 2 || tmpsect == 3 || tmpsect == 6 || tmpsect == 7 || tmpsect == 10 || tmpsect == 11) {
1424  npixel = mapx0p[tmpeta][tmpphi];
1425  itag = 2;
1426  } else {
1427  npixel = mapx0m[tmpeta][tmpphi];
1428  itag = 3;
1429  }
1430  } else {
1431  fact = 3;
1432  if (tmpsect % 2 == 1)
1433  iflip = 1;
1434  if (abs(iring) == 1) {
1435  npixel = mapx1[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)];
1436  itag = 1;
1437  } else {
1438  npixel = mapx2[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)];
1439  itag = 0;
1440  }
1441  }
1442 
1443  int tmpeta1 = (ieta > 0) ? ieta - 1 : -ieta + 14;
1444 
1445  int iselect2 = 0;
1446  if (hosig[4] != -100) {
1447  if (m_cosmic) {
1448  if (caloen[2] <= 0.0)
1449  iselect2 = 1;
1450  } else {
1451  if (caloen[2] <= 3.0)
1452  iselect2 = 1;
1453  }
1454  }
1455 
1456  // edm::LogInfo("HOCalib") <<"cosmic "<<hosig[4]<<" "<<caloen[3]<<" "<<int(iselect2)<<" "<<int(m_cosmic);
1457 
1458  if (iselect2 == 1) {
1459  int tmpphi2 = (iphi + 6 <= nphimx) ? iphi + 5 : iphi + 5 - nphimx;
1460 
1461  int tmprout2 = (iring == 0) ? int((tmpphi2 + 2) / 2.) + 1 : int((tmpphi2 + 2) / 3.) + 1;
1462  if (tmprout2 > tmproutmx)
1463  tmprout2 = 1;
1464 
1465  if (cro_ssg[tmpeta1][tmpphi2].size() < 4000) {
1466  if (hocro > alow && hocro < ahigh) {
1467  if (!m_histfit)
1468  cro_ssg[tmpeta1][tmpphi2].push_back(hocro);
1469  crossg[tmpeta1][tmpphi2]->Fill(hocro);
1470  }
1471  }
1472 
1473  if (tmpphi2 >= 0 && tmpphi2 < nphimx) {
1474  crossg[tmpeta1][nphimx]->Fill(hocro);
1475  }
1476  if (m_combined) {
1477  com_crossg[iring2][tmprout2 - 1]->Fill(hocro);
1478  com_crossg[iring2][tmproutmx]->Fill(hocro);
1479  }
1480  }
1481 
1482  if (iselect == 1) {
1483  for (int ij = 0; ij < neffip; ij++) {
1484  if (ij == 0) {
1485  sig_effi[ij]->Fill(ieta, iphi, 1.);
1486  } else {
1487  if (hosig[4] > ij * m_sigma) {
1488  sig_effi[ij]->Fill(ieta, iphi, 1.);
1489  }
1490  }
1491  }
1492 
1493  //Histogram filling for noise study: phi shift according to DTChamberAnalysis
1494  int tmpphi1 = iphi - 1;
1495 
1496  if (sig_reg[tmpeta1][tmpphi1].size() < 4000) {
1497  if (hosig[4] > -50 && hosig[4] < 15) {
1498  sigrsg[tmpeta1][tmpphi1]->Fill(hosig[4]);
1499  if (!m_histfit && hosig[4] <= ahigh / 2.)
1500  sig_reg[tmpeta1][tmpphi1].push_back(hosig[4]);
1501  invang[tmpeta1][tmpphi1] += 1. / fabs(hoang);
1502  }
1503  }
1504 
1505  if (tmpphi1 >= 0 && tmpphi1 < nphimx) { //GREN
1506  sigrsg[tmpeta1][nphimx]->Fill(hosig[4]);
1507  invang[tmpeta1][nphimx] += 1. / fabs(hoang);
1508  }
1509 
1510  if (m_combined) { //#ifdef COMBINED
1511  com_sigrsg[iring2][tmprout - 1]->Fill(hosig[4]);
1512  com_invang[iring2][tmprout - 1] += 1. / fabs(hoang);
1513 
1514  com_sigrsg[iring2][tmproutmx]->Fill(hosig[4]);
1515  com_invang[iring2][tmproutmx] += 1. / fabs(hoang);
1516  } //m_combined #endif
1517 
1518  if (m_checkmap || m_correl) { //#ifdef CHECKMAP
1519  tmpeta = etamap[itag][npixel];
1520  tmpphi = phimap[itag][npixel];
1521  if (tmpeta >= 0 && tmpphi >= 0) {
1522  if (iflip != 0)
1523  tmpphi = abs(tmpphi - 2);
1524  if (int((hocorsig[fact * tmpeta + tmpphi] - hosig[4]) * 10000) / 10000. != 0) {
1525  iaxxx++;
1526  edm::LogInfo("HOCalib") << "iring2xxx " << irun << " " << ievt << " " << isect << " " << iring << " "
1527  << tmpsect << " " << ieta << " " << iphi << " " << npixel << " " << tmpeta << " "
1528  << tmpphi << " " << tmpeta1 << " " << tmpphi1 << " itag " << itag << " " << iflip
1529  << " " << fact << " " << hocorsig[fact * tmpeta + tmpphi] << " "
1530  << fact * tmpeta + tmpphi << " " << hosig[4] << " " << hodx << " " << hody;
1531 
1532  for (int ij = 0; ij < 18; ij++) {
1533  edm::LogInfo("HOCalib") << " " << ij << " " << hocorsig[ij];
1534  }
1535  edm::LogInfo("HOCalib") << " ix " << iaxxx << " " << ibxxx;
1536  } else {
1537  ibxxx++;
1538  }
1539 
1540  corrsgc[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1541  if (m_combined) { //#ifdef COMBINED
1542  com_corrsgc[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1543  } //m_combined #endif
1544  }
1545  } //m_checkmap #endif
1546 
1547  if (m_correl) { //#ifdef CORREL
1548  float allcorsig = 0.0;
1549 
1550  tmpeta = etamap[itag][npixleft[npixel]];
1551  tmpphi = phimap[itag][npixleft[npixel]];
1552 
1553  if (tmpeta >= 0 && tmpphi >= 0) {
1554  if (iflip != 0)
1555  tmpphi = abs(tmpphi - 2);
1556  corrsgl[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1557  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1558  if (m_combined) { //#ifdef COMBINED
1559  com_corrsgl[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1560  } //m_combined #endif
1561  }
1562 
1563  tmpeta = etamap[itag][npixrigh[npixel]];
1564  tmpphi = phimap[itag][npixrigh[npixel]];
1565  if (tmpeta >= 0 && tmpphi >= 0) {
1566  if (iflip != 0)
1567  tmpphi = abs(tmpphi - 2);
1568  corrsgr[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1569  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1570  if (m_combined) { // #ifdef COMBINED
1571  com_corrsgr[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1572  } //m_combined #endif
1573  }
1574 
1575  tmpeta = etamap[itag][npixlebt[npixel]];
1576  tmpphi = phimap[itag][npixlebt[npixel]];
1577  if (tmpeta >= 0 && tmpphi >= 0) {
1578  if (iflip != 0)
1579  tmpphi = abs(tmpphi - 2);
1580  corrsglb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1581  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1582  if (m_combined) { //#ifdef COMBINED
1583  com_corrsglb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1584  } //m_combined #endif
1585  }
1586 
1587  tmpeta = etamap[itag][npixribt[npixel]];
1588  tmpphi = phimap[itag][npixribt[npixel]];
1589  if (tmpeta >= 0 && tmpphi >= 0) {
1590  if (iflip != 0)
1591  tmpphi = abs(tmpphi - 2);
1592  corrsgrb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1593  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1594  if (m_combined) { // #ifdef COMBINED
1595  com_corrsgrb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1596  } //m_combined #endif
1597  }
1598 
1599  tmpeta = etamap[itag][npixleup[npixel]];
1600  tmpphi = phimap[itag][npixleup[npixel]];
1601  if (tmpeta >= 0 && tmpphi >= 0) {
1602  if (iflip != 0)
1603  tmpphi = abs(tmpphi - 2);
1604  corrsglu[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1605  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1606  if (m_combined) { // #ifdef COMBINED
1607  com_corrsglu[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1608  } //m_combined #endif
1609  }
1610 
1611  tmpeta = etamap[itag][npixriup[npixel]];
1612  tmpphi = phimap[itag][npixriup[npixel]];
1613  if (tmpeta >= 0 && tmpphi >= 0) {
1614  if (iflip != 0)
1615  tmpphi = abs(tmpphi - 2);
1616  corrsgru[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1617  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1618  if (m_combined) { // #ifdef COMBINED
1619  com_corrsgru[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1620  } //m_combined #endif
1621  }
1622  corrsgall[tmpeta1][tmpphi1]->Fill(allcorsig);
1623  if (m_combined) { // #ifdef COMBINED
1624  com_corrsgall[iring2][tmpsect - 1]->Fill(allcorsig);
1625  } //m_combined #endif
1626 
1627  } //m_correl #endif
1628  for (int k = 0; k < 9; k++) {
1629  switch (iring) {
1630  case 2:
1631  ho_sig2p[k]->Fill(hosig[k]);
1632  break;
1633  case 1:
1634  ho_sig1p[k]->Fill(hosig[k]);
1635  break;
1636  case 0:
1637  ho_sig00[k]->Fill(hosig[k]);
1638  break;
1639  case -1:
1640  ho_sig1m[k]->Fill(hosig[k]);
1641  break;
1642  case -2:
1643  ho_sig2m[k]->Fill(hosig[k]);
1644  break;
1645  }
1646  if (m_hbinfo) { // #ifdef HBINFO
1647  hbhe_sig[k]->Fill(hbhesig[k]);
1648  // edm::LogInfo("HOCalib") <<"hbhe "<<k<<" "<<hbhesig[k];
1649  } //m_hbinfo #endif
1650  }
1651  } //if (iselect==1)
1652 
1653  } //for (HOCalibVariableCollection::const_iterator hoC=(*HOCalib).begin(); hoC!=(*HOCalib).end(); hoC++){
1654 
1655  } //if (isCosMu)
1656 }
1657 
1658 // ------------ method called once each job just before starting event loop ------------
1660 
1661 // ------------ method called once each job just after ending the event loop ------------
1663  theFile->cd();
1664 
1665  if (m_allHOsignal) {
1666  for (int jk = 0; jk < ho_energy->GetNbinsX(); jk++) {
1667  for (int kl = 0; kl < ho_energy->GetNbinsY(); kl++) {
1668  double entry = ho_entry->GetBinContent(jk + 1, kl + 1);
1669  if (entry < 1.)
1670  entry = 1.;
1671 
1672  double energy = ho_energy->GetBinContent(jk + 1, kl + 1) / entry;
1673  double energy2 = ho_energy2->GetBinContent(jk + 1, kl + 1) / entry;
1674  double rms = sqrt(energy2 - energy * energy);
1675 
1676  double xval = ho_energy->GetXaxis()->GetBinCenter(jk + 1);
1677  double yval = ho_energy->GetYaxis()->GetBinCenter(kl + 1);
1678 
1679  ho_rms->Fill(xval, yval, rms);
1680  }
1681  }
1682  }
1683 
1684  for (int ij = 0; ij < nphimx; ij++) {
1685  for (int jk = 0; jk < netamx; jk++) {
1686  nevsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetEntries());
1687  mnsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetMean());
1688  rmssigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetRMS());
1689 
1690  nevcrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetEntries());
1691  mncrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetMean());
1692  rmscrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetRMS());
1693 
1694  if (m_correl) { //#ifdef CORREL
1695 
1696  nevcorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetEntries());
1697  mncorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetMean());
1698  rmscorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetRMS());
1699 
1700  nevcorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetEntries());
1701  mncorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetMean());
1702  rmscorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetRMS());
1703 
1704  nevcorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetEntries());
1705  mncorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetMean());
1706  rmscorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetRMS());
1707 
1708  nevcorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetEntries());
1709  mncorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetMean());
1710  rmscorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetRMS());
1711 
1712  nevcorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetEntries());
1713  mncorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetMean());
1714  rmscorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetRMS());
1715 
1716  nevcorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetEntries());
1717  mncorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetMean());
1718  rmscorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetRMS());
1719 
1720  nevcorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetEntries());
1721  mncorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetMean());
1722  rmscorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetRMS());
1723  } //m_correl #endif
1724  if (m_checkmap) { //#ifdef CHECKMAP
1725  nevcorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetEntries());
1726  mncorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetMean());
1727  rmscorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetRMS());
1728  } //m_checkmap #endif
1729  }
1730  }
1731 
1732  if (m_combined) { // #ifdef COMBINED
1733  for (int jk = 0; jk < ringmx; jk++) {
1734  for (int ij = 0; ij < routmx; ij++) {
1735  if (jk != 2 && ij >= rout12mx)
1736  continue;
1737  nevsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetEntries());
1738  mnsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetMean());
1739  rmssigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetRMS());
1740 
1741  nevcrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetEntries());
1742  mncrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetMean());
1743  rmscrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetRMS());
1744  }
1745  }
1746 
1747  for (int ij = 0; ij < sectmx; ij++) {
1748  for (int jk = 0; jk < ringmx; jk++) {
1749  if (m_correl) { // #ifdef CORREL
1750  nevcorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetEntries());
1751  mncorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetMean());
1752  rmscorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetRMS());
1753 
1754  nevcorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetEntries());
1755  mncorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetMean());
1756  rmscorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetRMS());
1757 
1758  nevcorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetEntries());
1759  mncorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetMean());
1760  rmscorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetRMS());
1761 
1762  nevcorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetEntries());
1763  mncorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetMean());
1764  rmscorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetRMS());
1765 
1766  nevcorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetEntries());
1767  mncorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetMean());
1768  rmscorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetRMS());
1769 
1770  nevcorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetEntries());
1771  mncorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetMean());
1772  rmscorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetRMS());
1773 
1774  nevcorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetEntries());
1775  mncorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetMean());
1776  rmscorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetRMS());
1777  } //m_correl #endif
1778  if (m_checkmap) { // #ifdef CHECKMAP
1779  nevcorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetEntries());
1780  mncorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetMean());
1781  rmscorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetRMS());
1782  } //m_checkmap #endif
1783  }
1784  }
1785  } //m_combined #endif
1786 
1787  for (int ij = 1; ij < neffip; ij++) {
1788  sig_effi[ij]->Divide(sig_effi[0]);
1789  }
1790  for (int ij = 0; ij < netamx; ij++) {
1791  for (int jk = 0; jk < nphimx; jk++) {
1792  int ieta = (ij < 15) ? ij + 1 : 14 - ij;
1793  int iphi = jk + 1;
1794  double signal = sigrsg[ij][jk]->GetMean();
1795  mean_energy->Fill(ieta, iphi, signal);
1796  }
1797  }
1798 
1799  int irunold = irun;
1800 
1801  gStyle->SetOptLogy(0);
1802  gStyle->SetTitleFillColor(10);
1803  gStyle->SetStatColor(10);
1804 
1805  gStyle->SetCanvasColor(10);
1806  gStyle->SetOptStat(0); //1110);
1807  gStyle->SetOptTitle(1);
1808 
1809  gStyle->SetTitleColor(10);
1810  gStyle->SetTitleFontSize(0.09);
1811  gStyle->SetTitleOffset(-0.05);
1812  gStyle->SetTitleBorderSize(1);
1813 
1814  gStyle->SetPadColor(10);
1815  gStyle->SetPadBorderMode(0);
1816  gStyle->SetStatColor(10);
1817  gStyle->SetPadBorderMode(0);
1818  gStyle->SetStatBorderSize(1);
1819  gStyle->SetStatFontSize(.07);
1820 
1821  gStyle->SetStatStyle(1001);
1822  gStyle->SetOptFit(101);
1823  gStyle->SetCanvasColor(10);
1824  gStyle->SetCanvasBorderMode(0);
1825 
1826  gStyle->SetStatX(.99);
1827  gStyle->SetStatY(.99);
1828  gStyle->SetStatW(.45);
1829  gStyle->SetStatH(.16);
1830  gStyle->SetLabelSize(0.075, "XY");
1831  gStyle->SetLabelOffset(0.21, "XYZ");
1832  gStyle->SetTitleSize(0.065, "XY");
1833  gStyle->SetTitleOffset(0.06, "XYZ");
1834  gStyle->SetPadTopMargin(.09);
1835  gStyle->SetPadBottomMargin(0.11);
1836  gStyle->SetPadLeftMargin(0.12);
1837  gStyle->SetPadRightMargin(0.15);
1838  gStyle->SetPadGridX(true);
1839  gStyle->SetPadGridY(true);
1840  gStyle->SetGridStyle(2);
1841  gStyle->SetNdivisions(303, "XY");
1842 
1843  gStyle->SetMarkerSize(0.60);
1844  gStyle->SetMarkerColor(2);
1845  gStyle->SetMarkerStyle(20);
1846  gStyle->SetTitleFontSize(0.07);
1847 
1848  char out_file[200];
1849  int xsiz = 700;
1850  int ysiz = 500;
1851 
1852  // TCanvas *c2 = new TCanvas("c2", "Statistics and efficiency", xsiz, ysiz);
1853  // c2->Divide(2,1); //(3,2);
1854  // for (int ij=0; ij<neffip; ij=ij+3) {
1855  // sig_effi[ij]->GetXaxis()->SetTitle("#eta");
1856  // sig_effi[ij]->GetXaxis()->SetTitleSize(0.075);
1857  // sig_effi[ij]->GetXaxis()->SetTitleOffset(0.65); //0.85
1858  // sig_effi[ij]->GetXaxis()->CenterTitle();
1859  // sig_effi[ij]->GetXaxis()->SetLabelSize(0.055);
1860  // sig_effi[ij]->GetXaxis()->SetLabelOffset(0.001);
1861 
1862  // sig_effi[ij]->GetYaxis()->SetTitle("#phi");
1863  // sig_effi[ij]->GetYaxis()->SetTitleSize(0.075);
1864  // sig_effi[ij]->GetYaxis()->SetTitleOffset(0.9);
1865  // sig_effi[ij]->GetYaxis()->CenterTitle();
1866  // sig_effi[ij]->GetYaxis()->SetLabelSize(0.055);
1867  // sig_effi[ij]->GetYaxis()->SetLabelOffset(0.01);
1868 
1869  // c2->cd(int(ij/3.)+1); sig_effi[ij]->Draw("colz");
1870  // }
1871  // sprintf(out_file, "comb_hosig_evt_%i.jpg",irunold);
1872  // c2->SaveAs(out_file);
1873 
1874  // gStyle->SetTitleFontSize(0.045);
1875  // gStyle->SetPadRightMargin(0.1);
1876  // gStyle->SetPadLeftMargin(0.1);
1877  // gStyle->SetPadBottomMargin(0.12);
1878 
1879  // TCanvas *c1 = new TCanvas("c1", "Mean signal in each tower", xsiz, ysiz);
1880 
1881  // mean_energy->GetXaxis()->SetTitle("#eta");
1882  // mean_energy->GetXaxis()->SetTitleSize(0.075);
1883  // mean_energy->GetXaxis()->SetTitleOffset(0.65); //0.6
1884  // mean_energy->GetXaxis()->CenterTitle();
1885  // mean_energy->GetXaxis()->SetLabelSize(0.045);
1886  // mean_energy->GetXaxis()->SetLabelOffset(0.001);
1887 
1888  // mean_energy->GetYaxis()->SetTitle("#phi");
1889  // mean_energy->GetYaxis()->SetTitleSize(0.075);
1890  // mean_energy->GetYaxis()->SetTitleOffset(0.5);
1891  // mean_energy->GetYaxis()->CenterTitle();
1892  // mean_energy->GetYaxis()->SetLabelSize(0.045);
1893  // mean_energy->GetYaxis()->SetLabelOffset(0.01);
1894 
1895  // mean_energy->Draw("colz");
1896  // sprintf(out_file, "homean_energy_%i.jpg",irunold);
1897  // c1->SaveAs(out_file);
1898 
1899  // delete c1;
1900  // delete c2;
1901 
1902  gStyle->SetPadBottomMargin(0.14);
1903  gStyle->SetPadLeftMargin(0.17);
1904  gStyle->SetPadRightMargin(0.03);
1905 
1906  gStyle->SetOptStat(1110);
1907 
1908  const int nsample = 8;
1909  TF1* gx0[nsample] = {nullptr};
1910  TF1* ped0fun[nsample] = {nullptr};
1911  TF1* signal[nsample] = {nullptr};
1912  TF1* pedfun[nsample] = {nullptr};
1913  TF1* sigfun[nsample] = {nullptr};
1914  TF1* signalx[nsample] = {nullptr};
1915 
1916  TH1F* signall[nsample] = {nullptr};
1917  TH1F* pedstll[nsample] = {nullptr};
1918 
1919  if (m_constant) {
1920  gStyle->SetOptFit(101);
1921  gStyle->SetCanvasBorderMode(0);
1922  gStyle->SetPadBorderMode(0);
1923  gStyle->SetStatBorderSize(1);
1924  gStyle->SetStatStyle(1001);
1925  gStyle->SetTitleColor(10);
1926  gStyle->SetTitleFontSize(0.09);
1927  gStyle->SetTitleOffset(-0.05);
1928  gStyle->SetTitleBorderSize(1);
1929 
1930  gStyle->SetCanvasColor(10);
1931  gStyle->SetPadColor(10);
1932  gStyle->SetStatColor(10);
1933  gStyle->SetStatFontSize(.07);
1934  gStyle->SetStatX(0.99);
1935  gStyle->SetStatY(0.99);
1936  gStyle->SetStatW(0.30);
1937  gStyle->SetStatH(0.10);
1938  gStyle->SetTitleSize(0.065, "XYZ");
1939  gStyle->SetLabelSize(0.075, "XYZ");
1940  gStyle->SetLabelOffset(0.012, "XYZ");
1941  gStyle->SetPadGridX(true);
1942  gStyle->SetPadGridY(true);
1943  gStyle->SetGridStyle(3);
1944  gStyle->SetNdivisions(101, "XY");
1945  gStyle->SetOptLogy(0);
1946  int iiter = 0;
1947 
1948  std::ofstream file_out(theoutputtxtFile.c_str());
1949  // TPostScript* ps=0;
1950  int ips = 111;
1951  TPostScript ps(theoutputpsFile.c_str(), ips);
1952  ps.Range(20, 28);
1953 
1954  xsiz = 900; //900;
1955  ysiz = 1200; //600;
1956  TCanvas* c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz);
1957 
1958  // Fix is done for eta-phi
1959 
1960  float mean_eta[netamx];
1961  float mean_phi[nphimx];
1962  float rms_eta[netamx];
1963  float rms_phi[nphimx];
1964 
1965  for (int ij = 0; ij < nphimx; ++ij) {
1966  mean_phi[ij] = 0;
1967  rms_phi[ij] = 0;
1968  }
1969  for (int ij = 0; ij < netamx; ++ij) {
1970  mean_eta[ij] = 0;
1971  rms_eta[ij] = 0;
1972  }
1973 
1974  int mxeta = 0;
1975  int mxphi = 0;
1976  int mneta = 0;
1977  int mnphi = 0;
1978 
1979  //iijj = 0 : Merging all ring
1980  // = 1 : Individual HPD
1981  //iijj = 2 : merging all phi
1982  // = 3 : Individual tower
1983 
1984  for (int iijj = 0; iijj < 4; iijj++) {
1985  // if ((!mx_combined) && iijj==1) continue; //Use this only for combined data
1986  if (iijj == 0) {
1987  mxeta = ringmx;
1988  mxphi = 1;
1989  mneta = 0;
1990  mnphi = 0;
1991  } else if (iijj == 1) {
1992  mxeta = ringmx;
1993  mxphi = routmx;
1994  mneta = 0;
1995  mnphi = 0;
1996  } else if (iijj == 2) {
1997  mxeta = netamx;
1998  mxphi = 1;
1999  mneta = 0;
2000  mnphi = 0;
2001  } else if (iijj == 3) {
2002  mxeta = netamx;
2003  mxphi = nphimx;
2004  mneta = 0;
2005  mnphi = 0;
2006  }
2007 
2008  for (int jk = mneta; jk < mxeta; jk++) {
2009  for (int ij = mnphi; ij < mxphi; ij++) {
2010  if (iijj == 1)
2011  continue;
2012  if ((iijj == 0 || iijj == 1) && jk != 2 && ij >= rout12mx)
2013  continue;
2014  int izone = iiter % nsample;
2015 
2016  if (iijj == 0) {
2017  int iread = (jk == 2) ? routmx : rout12mx;
2018  signall[izone] = (TH1F*)com_sigrsg[jk][iread]->Clone("hnew");
2019  pedstll[izone] = (TH1F*)com_crossg[jk][iread]->Clone("hnew");
2020  } else if (iijj == 1) {
2021  signall[izone] = (TH1F*)com_sigrsg[jk][ij]->Clone("hnew");
2022  pedstll[izone] = (TH1F*)com_crossg[jk][ij]->Clone("hnew");
2023  } else if (iijj == 2) {
2024  signall[izone] = (TH1F*)sigrsg[jk][nphimx]->Clone("hnew");
2025  pedstll[izone] = (TH1F*)crossg[jk][nphimx]->Clone("hnew");
2026  } else if (iijj == 3) {
2027  signall[izone] = (TH1F*)sigrsg[jk][ij]->Clone("hnew");
2028  pedstll[izone] = (TH1F*)crossg[jk][ij]->Clone("hnew");
2029  }
2030 
2031  pedstll[izone]->SetLineWidth(2);
2032  signall[izone]->SetLineWidth(2);
2033  pedstll[izone]->SetLineColor(2);
2034  signall[izone]->SetLineColor(4);
2035  pedstll[izone]->SetNdivisions(506, "XY");
2036  signall[izone]->SetNdivisions(506, "XY");
2037 
2038  signall[izone]->GetXaxis()->SetLabelSize(.065);
2039  signall[izone]->GetYaxis()->SetLabelSize(.06);
2040  signall[izone]->GetXaxis()->SetTitle("Signal (GeV)");
2041 
2042  signall[izone]->GetXaxis()->SetTitleSize(.065);
2043  signall[izone]->GetXaxis()->CenterTitle();
2044 
2045  if (izone == 0) { //iiter%8 ==0) {
2046  ps.NewPage();
2047  c0->Divide(4, 4); //c0->Divide(2,4); // c0->Divide(1,2);
2048  }
2049  c0->cd(2 * izone + 1); // (iiter%8)+1); //c0->cd(iiter%8+1);
2050 
2051  /*
2052  if (iijj==0 && izone==0) {
2053  gStyle->SetOptLogy(1);
2054  gStyle->SetOptStat(0);
2055  gStyle->SetOptFit(0);
2056  c0->Divide(3,2);
2057  }
2058 
2059  if (iijj>0) {
2060  gStyle->SetOptLogy(0);
2061  gStyle->SetOptStat(1110);
2062  gStyle->SetOptFit(101);
2063 
2064  if (iiter==0) {
2065  int ips=111;
2066  ps = new TPostScript(theoutputpsFile.c_str(),ips);
2067  ps.Range(20,28);
2068  xsiz = 900; //900;
2069  ysiz = 1200; //600;
2070  c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz);
2071  }
2072  if (izone==0) {
2073  ps.NewPage();
2074  c0->Divide(4,4);
2075  }
2076  }
2077  if (iijj==0) {c0->cd(izone+1); } else { c0->cd(2*izone+1);}
2078  */
2079 
2080  float mean = pedstll[izone]->GetMean();
2081  float rms = pedstll[izone]->GetRMS();
2082 
2083  if (rms < 0.10)
2084  rms = 0.10;
2085  if (rms > 0.15)
2086  rms = 0.15;
2087  if (mean > 0.20)
2088  mean = 0.20;
2089  if (mean < -0.20)
2090  mean = -0.20;
2091 
2092  float xmn = mean - 6. * rms;
2093  float xmx = mean + 6. * rms;
2094 
2095  binwid = pedstll[izone]->GetBinWidth(1);
2096  if (xmx > pedstll[izone]->GetXaxis()->GetXmax())
2097  xmx = pedstll[izone]->GetXaxis()->GetXmax() - 0.5 * binwid;
2098  if (xmn < pedstll[izone]->GetXaxis()->GetXmin())
2099  xmn = pedstll[izone]->GetXaxis()->GetXmin() + 0.5 * binwid;
2100 
2101  float height = pedstll[izone]->GetEntries();
2102 
2103  double par[nbgpr] = {height, mean, 0.75 * rms};
2104 
2105  double gaupr[nbgpr];
2106  double parer[nbgpr];
2107 
2108  ietafit = jk;
2109  iphifit = ij;
2110  pedstll[izone]->GetXaxis()->SetLabelSize(.065);
2111  pedstll[izone]->GetYaxis()->SetLabelSize(.06);
2112 
2113  // if (iijj==0) {
2114  // pedstll[izone]->GetXaxis()->SetRangeUser(alow, ahigh);
2115  // } else {
2116  pedstll[izone]->GetXaxis()->SetRangeUser(xmn, xmx);
2117  // }
2118 
2119  if (iijj == 0) {
2120  pedstll[izone]->GetXaxis()->SetTitle("Pedestal/Signal (GeV)");
2121  } else {
2122  pedstll[izone]->GetXaxis()->SetTitle("Pedestal (GeV)");
2123  }
2124  pedstll[izone]->GetXaxis()->SetTitleSize(.065);
2125  pedstll[izone]->GetXaxis()->CenterTitle();
2126  // pedstll[izone]->SetLineWidth(2);
2127 
2128  pedstll[izone]->Draw();
2129  if (m_pedsuppr) {
2130  gaupr[0] = 0;
2131  gaupr[1] = 0.0; // pedmean[ietafit][iphifit];
2132  gaupr[2] = 0.15; //GMA need from database
2133  parer[0] = parer[1] = parer[2] = 0;
2134  } else {
2135  if (pedstll[izone]->GetEntries() > 5) {
2136  if ((iijj != 3) || m_histfit) {
2137  char temp[20];
2138  sprintf(temp, "gx0_%i", izone);
2139  gx0[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
2140  gx0[izone]->SetParameters(par);
2141  gx0[izone]->SetLineWidth(1);
2142  pedstll[izone]->Fit(gx0[izone], "R+");
2143 
2144  for (int k = 0; k < nbgpr; k++) {
2145  parer[k] = gx0[izone]->GetParError(k);
2146  gaupr[k] = gx0[izone]->GetParameter(k);
2147  }
2148  } else {
2149  double strt[nbgpr] = {height, mean, 0.75 * rms};
2150  double step[nbgpr] = {1.0, 0.001, 0.001};
2151  double alowmn[nbgpr] = {0.5 * height, mean - rms, 0.3 * rms};
2152  double ahighmn[nbgpr] = {1.5 * height, mean + rms, 1.5 * rms};
2153 
2154  TMinuit* gMinuit = new TMinuit(nbgpr);
2155  gMinuit->SetFCN(fcnbg);
2156 
2157  double arglist[10];
2158  int ierflg = 0;
2159  arglist[0] = 0.5;
2160  gMinuit->mnexcm("SET ERR", arglist, 1, ierflg);
2161  char name[100];
2162  for (int k = 0; k < nbgpr; k++) {
2163  sprintf(name, "pedpar%i", k);
2164  gMinuit->mnparm(k, name, strt[k], step[k], alowmn[k], ahighmn[k], ierflg);
2165  }
2166 
2167  arglist[0] = 0;
2168  gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg);
2169 
2170  arglist[0] = 0;
2171  gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg);
2172 
2173  TString chnam;
2174  double parv, err, xlo, xup, plerr, mierr, eparab, gcc;
2175  int iuit;
2176 
2177  for (int k = 0; k < nbgpr; k++) {
2178  if (step[k] > -10) {
2179  gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit);
2180  gMinuit->mnerrs(k, plerr, mierr, eparab, gcc);
2181  // edm::LogInfo("HOCalib") <<"k "<< k<<" "<<chnam<<" "<<parv<<" "<<err<<" "<<xlo<<" "<<xup<<" "<<plerr<<" "<<mierr<<" "<<eparab;
2182  if (k == 0) {
2183  gaupr[k] = parv * binwid;
2184  parer[k] = err * binwid;
2185  } else {
2186  gaupr[k] = parv;
2187  parer[k] = err;
2188  }
2189  }
2190  }
2191 
2192  // gx0[izone]->SetParameters(gaupr);
2193 
2194  char temp[20];
2195  sprintf(temp, "ped0fun_%i", izone);
2196  ped0fun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
2197  ped0fun[izone]->SetParameters(gaupr);
2198  ped0fun[izone]->SetLineColor(3);
2199  ped0fun[izone]->SetLineWidth(1);
2200  ped0fun[izone]->Draw("same");
2201 
2202  delete gMinuit;
2203  }
2204  } else {
2205  for (int k = 0; k < nbgpr; k++) {
2206  gaupr[k] = par[k];
2207  }
2208  gaupr[2] = 0.15;
2209  }
2210  }
2211  // if (iijj!=0)
2212  c0->cd(2 * izone + 2);
2213  if (signall[izone]->GetEntries() > 5) {
2214  Double_t parall[nsgpr];
2215  double parserr[nsgpr];
2216  double fitres[nsgpr];
2217  double pedht = 0;
2218 
2219  char temp[20];
2220  sprintf(temp, "signal_%i", izone);
2221  xmn = signall[izone]->GetXaxis()->GetXmin();
2222  xmx = 0.5 * signall[izone]->GetXaxis()->GetXmax();
2223  signal[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr);
2224  xmx *= 2.0;
2225  if ((iijj != 3) || m_histfit) {
2226  pedht = (signall[izone]->GetBinContent(nbn - 1) + signall[izone]->GetBinContent(nbn) +
2227  signall[izone]->GetBinContent(nbn + 1)) /
2228  3.;
2229 
2230  if (m_pedsuppr) {
2231  parall[1] = 0.0; // pedmean[ietafit][iphifit];
2232  parall[2] = 0.15;
2233  } else {
2234  for (int lm = 0; lm < nbgpr; lm++) {
2235  parall[lm] = gaupr[lm];
2236  }
2237  }
2238 
2239  set_mean(parall[1], false);
2240  set_sigma(parall[2], false);
2241 
2242  parall[0] = 0.9 * pedht; //GM for Z-mumu, there is almost no pedestal
2243  parall[3] = 0.14;
2244  double area = binwid * signall[izone]->GetEntries();
2245  parall[5] = area;
2246 
2247  if (iijj == 3) {
2248  parall[4] = fitprm[4][jk];
2249  parall[6] = fitprm[6][jk];
2250  } else {
2251  parall[4] = signall[izone]->GetMean();
2252  parall[6] = parall[2];
2253  }
2254 
2255  signal[izone]->SetParameters(parall);
2256  signal[izone]->FixParameter(1, parall[1]);
2257  signal[izone]->FixParameter(2, parall[2]);
2258  signal[izone]->SetParLimits(0, 0.00, 2.0 * pedht + 0.1);
2259  signal[izone]->FixParameter(3, 0.14);
2260 
2261  signal[izone]->SetParLimits(5, 0.40 * area, 1.15 * area);
2262  // if (m_histfit) { //GMA
2263  if (iijj == 3) {
2264  signal[izone]->SetParLimits(4, 0.2 * fitprm[4][jk], 2.0 * fitprm[4][jk]);
2265  signal[izone]->SetParLimits(6, 0.2 * fitprm[6][jk], 2.0 * fitprm[6][jk]);
2266  } else {
2267  signal[izone]->SetParLimits(4, 0.1, 1.0);
2268  signal[izone]->SetParLimits(6, 0.035, 0.3);
2269  }
2270  signal[izone]->SetParNames("const", "mean", "sigma", "Width", "MP", "Area", "GSigma");
2271  signall[izone]->Fit(signal[izone], "0R+");
2272 
2273  signall[izone]->GetXaxis()->SetRangeUser(xmn, xmx);
2274  for (int k = 0; k < nsgpr; k++) {
2275  fitres[k] = fitprm[k][jk] = signal[izone]->GetParameter(k);
2276  parserr[k] = signal[izone]->GetParError(k);
2277  }
2278 
2279  } else {
2280  double pedhtx = 0;
2281  for (unsigned i = 0; i < sig_reg[ietafit][iphifit].size(); i++) {
2282  if (sig_reg[ietafit][iphifit][ij] > gaupr[1] - 3 * gaupr[2] &&
2283  sig_reg[ietafit][iphifit][ij] < gaupr[1] + gaupr[2])
2284  pedhtx++;
2285  }
2286 
2287  set_mean(gaupr[1], false);
2288  set_sigma(gaupr[2], false);
2289 
2290  TString name[nsgpr] = {"const", "mean", "sigma", "Width", "MP", "Area", "GSigma"};
2291  double strt[nsgpr] = {0.9 * pedhtx,
2292  gaupr[1],
2293  gaupr[2],
2294  fitprm[3][jk],
2295  fitprm[4][jk],
2296  signall[izone]->GetEntries(),
2297  fitprm[6][jk]};
2298  double alowmn[nsgpr] = {
2299  0.1 * pedhtx - 0.1, gaupr[1] - 0.1, gaupr[2] - 0.1, 0.07, 0.2 * strt[4], 0.1 * strt[5], 0.2 * strt[6]};
2300  double ahighmn[nsgpr] = {
2301  1.2 * pedhtx + 0.1, gaupr[1] + 0.1, gaupr[2] + 0.1, 0.20, 2.5 * strt[4], 1.5 * strt[5], 2.2 * strt[6]};
2302  double step[nsgpr] = {1.0, 0.0, 0.0, 0.0, 0.001, 1.0, 0.002};
2303 
2304  TMinuit* gMinuit = new TMinuit(nsgpr);
2305  gMinuit->SetFCN(fcnsg);
2306 
2307  double arglist[10];
2308  int ierflg = 0;
2309  arglist[0] = 0.5;
2310  gMinuit->mnexcm("SET ERR", arglist, 1, ierflg);
2311 
2312  for (int k = 0; k < nsgpr; k++) {
2313  gMinuit->mnparm(k, name[k], strt[k], step[k], alowmn[k], ahighmn[k], ierflg);
2314  }
2315 
2316  arglist[0] = 0;
2317  gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg);
2318 
2319  arglist[0] = 0;
2320  gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg);
2321 
2322  TString chnam;
2323  double parv, err, xlo, xup, plerr, mierr, eparab, gcc;
2324  int iuit;
2325 
2326  for (int k = 0; k < nsgpr; k++) {
2327  if (step[k] > -10) {
2328  gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit);
2329  gMinuit->mnerrs(k, plerr, mierr, eparab, gcc);
2330  if (k == 0 || k == 5) {
2331  fitres[k] = parv * binwid;
2332  parserr[k] = err * binwid;
2333  } else {
2334  fitres[k] = parv;
2335  parserr[k] = err;
2336  }
2337  }
2338  }
2339 
2340  delete gMinuit;
2341  }
2342 
2343  // if (iijj==0) {
2344  // signall[izone]->Draw("same");
2345  // } else {
2346  signall[izone]->Draw();
2347  // }
2348 
2349  sprintf(temp, "pedfun_%i", izone);
2350  pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
2351  pedfun[izone]->SetParameters(fitres);
2352  pedfun[izone]->SetLineColor(3);
2353  pedfun[izone]->SetLineWidth(1);
2354  pedfun[izone]->Draw("same");
2355 
2356  sprintf(temp, "signalfun_%i", izone);
2357  sigfun[izone] = new TF1(temp, langaufun, xmn, xmx, nsgpr - nbgpr);
2358  sigfun[izone]->SetParameters(&fitres[3]);
2359  sigfun[izone]->SetLineWidth(1);
2360  sigfun[izone]->SetLineColor(4);
2361  sigfun[izone]->Draw("same");
2362 
2363  sprintf(temp, "total_%i", izone);
2364  signalx[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr);
2365  signalx[izone]->SetParameters(fitres);
2366  signalx[izone]->SetLineWidth(1);
2367  signalx[izone]->Draw("same");
2368 
2369  int kl = (jk < 15) ? jk + 1 : 14 - jk;
2370 
2371  edm::LogInfo("HOCalib") << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3)
2372  << ij + 1 << " " << std::setw(5) << pedstll[izone]->GetEntries() << " "
2373  << std::setw(6) << pedstll[izone]->GetMean() << " " << std::setw(6)
2374  << pedstll[izone]->GetRMS() << " " << std::setw(5) << signall[izone]->GetEntries()
2375  << " " << std::setw(6) << signall[izone]->GetMean() << " " << std::setw(6)
2376  << signall[izone]->GetRMS() << " " << std::setw(6) << signal[izone]->GetChisquare()
2377  << " " << std::setw(3) << signal[izone]->GetNDF();
2378 
2379  file_out << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " "
2380  << std::setw(5) << pedstll[izone]->GetEntries() << " " << std::setw(6) << pedstll[izone]->GetMean()
2381  << " " << std::setw(6) << pedstll[izone]->GetRMS() << " " << std::setw(5)
2382  << signall[izone]->GetEntries() << " " << std::setw(6) << signall[izone]->GetMean() << " "
2383  << std::setw(6) << signall[izone]->GetRMS() << " " << std::setw(6) << signal[izone]->GetChisquare()
2384  << " " << std::setw(3) << signal[izone]->GetNDF() << std::endl;
2385 
2386  file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << fitres[0] << " " << fitres[1] << " "
2387  << fitres[2] << " " << fitres[3] << " " << fitres[4] << " " << fitres[5] << " " << fitres[6]
2388  << std::endl;
2389  file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << parserr[0] << " " << parserr[1] << " "
2390  << parserr[2] << " " << parserr[3] << " " << parserr[4] << " " << parserr[5] << " " << parserr[6]
2391  << std::endl;
2392 
2393  int ieta = (jk < 15) ? (15 + jk) : (29 - jk);
2394  int ifl = nphimx * ieta + ij;
2395 
2396  if (iijj == 3) {
2397  ped_evt->Fill(ifl, pedstll[izone]->GetEntries());
2398  ped_mean->Fill(ifl, gaupr[1]);
2399  ped_width->Fill(ifl, gaupr[2]);
2400  fit_chi->Fill(ifl, signal[izone]->GetChisquare());
2401  sig_evt->Fill(ifl, signall[izone]->GetEntries());
2402  fit_sigevt->Fill(ifl, fitres[5]);
2403  fit_bkgevt->Fill(ifl, fitres[0] * sqrt(2 * acos(-1.)) * gaupr[2]);
2404  sig_mean->Fill(ifl, fitres[4]);
2405  sig_diff->Fill(ifl, fitres[4] - fitres[1]);
2406  sig_width->Fill(ifl, fitres[3]);
2407  sig_sigma->Fill(ifl, fitres[6]);
2408  sig_meanerr->Fill(ifl, parserr[4]);
2409  if (fitres[4] - fitres[1] != 0)
2410  sig_meanerrp->Fill(ifl, 100 * parserr[4] / (fitres[4] - fitres[1]));
2411  if (gaupr[2] != 0)
2412  sig_signf->Fill(ifl, (fitres[4] - fitres[1]) / gaupr[2]);
2413 
2414  ped_statmean->Fill(ifl, pedstll[izone]->GetMean());
2415  sig_statmean->Fill(ifl, signall[izone]->GetMean());
2416  ped_rms->Fill(ifl, pedstll[izone]->GetRMS());
2417  sig_rms->Fill(ifl, signall[izone]->GetRMS());
2418  }
2419 
2420  if ((iijj == 2) || (iijj == 3) || (iijj == 1)) {
2421  if (signall[izone]->GetEntries() > 5 && fitres[4] > 0.1) {
2422  //GMA need to put this==1 in future
2423  float fact = 0.812;
2424  if (abs(kl) <= 4)
2425  fact = 0.895;
2426  fact *= 0.19; //conversion factor for GeV/fC
2427 
2428  float fact2 = 0;
2429  if (iijj == 2)
2430  fact2 = invang[jk][nphimx];
2431  if (iijj == 3)
2432  fact2 = invang[jk][ij];
2433  if (iijj == 1)
2434  fact2 = com_invang[jk][ij];
2435 
2436  float calibc = fact * fact2 / (fitres[4] * signall[izone]->GetEntries());
2437  float caliberr = TMath::Abs(calibc * parserr[4] / std::max(0.001, fitres[4]));
2438 
2439  if (iijj == 2) {
2440  int ieta = (jk < 15) ? jk + 1 : 14 - jk;
2441  mean_phi_hst->Fill(ieta, calibc);
2442  mean_phi_hst->SetBinError(mean_phi_hst->FindBin(ieta), caliberr);
2443  file_out << "intieta " << jk << " " << ij << " " << ieta << " " << mean_phi_hst->FindBin(double(ieta))
2444  << " " << calibc << " " << caliberr << std::endl;
2445  } else if (iijj == 3) {
2446  const_eta[jk]->Fill(ij + 1, calibc);
2447  const_eta[jk]->SetBinError(const_eta[jk]->FindBin(ij + 1), caliberr);
2448 
2449  peak_eta[jk]->Fill(ij + 1, fitres[4]);
2450  peak_eta[jk]->SetBinError(peak_eta[jk]->FindBin(ij + 1), parserr[4]);
2451 
2452  int ieta = (jk < 15) ? jk + 1 : 14 - jk;
2453  const_eta_phi->Fill(ieta, ij + 1, calibc);
2454  file_out << "intietax " << jk << " " << ij << " " << ieta << " "
2455  << const_eta_phi->FindBin(ieta, ij + 1) << std::endl;
2456  if (caliberr > 0) {
2457  const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), caliberr);
2458 
2459  mean_eta[ij] += calibc / (caliberr * caliberr);
2460  mean_phi[jk] += calibc / (caliberr * caliberr);
2461 
2462  rms_eta[ij] += 1. / (caliberr * caliberr);
2463  rms_phi[jk] += 1. / (caliberr * caliberr);
2464 
2465  } else {
2466  const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), 0.0);
2467  }
2468  } else if (iijj == 1) {
2469  const_hpdrm[jk]->Fill(ij + 1, calibc);
2470  const_hpdrm[jk]->SetBinError(const_hpdrm[jk]->FindBin(ij + 1), caliberr);
2471 
2472  peak_hpdrm[jk]->Fill(ij + 1, fitres[4]);
2473  peak_hpdrm[jk]->SetBinError(peak_hpdrm[jk]->FindBin(ij + 1), parserr[4]);
2474  }
2475 
2476  file_out << "HO 4 " << iijj << " " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " "
2477  << std::setw(7) << calibc << " " << std::setw(7) << caliberr << std::endl;
2478  }
2479  }
2480 
2481  } else { //if (signall[izone]->GetEntries() >10) {
2482  signall[izone]->Draw();
2483  float varx = 0.000;
2484  int kl = (jk < 15) ? jk + 1 : 14 - jk;
2485  file_out << "histinfo" << iijj << " nof " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " "
2486  << std::setw(5) << pedstll[izone]->GetEntries() << " " << std::setw(6) << pedstll[izone]->GetMean()
2487  << " " << std::setw(6) << pedstll[izone]->GetRMS() << " " << std::setw(5)
2488  << signall[izone]->GetEntries() << " " << std::setw(6) << signall[izone]->GetMean() << " "
2489  << std::setw(6) << signall[izone]->GetRMS() << " " << std::setw(6) << varx << " " << std::setw(3)
2490  << varx << std::endl;
2491 
2492  file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx
2493  << " " << varx << " " << varx << " " << varx << " " << varx << std::endl;
2494  file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx
2495  << " " << varx << " " << varx << " " << varx << " " << varx << std::endl;
2496  }
2497  iiter++;
2498  if (iiter % nsample == 0) {
2499  c0->Update();
2500 
2501  for (int kl = 0; kl < nsample; kl++) {
2502  if (gx0[kl]) {
2503  delete gx0[kl];
2504  gx0[kl] = nullptr;
2505  }
2506  if (ped0fun[kl]) {
2507  delete ped0fun[kl];
2508  ped0fun[kl] = nullptr;
2509  }
2510  if (signal[kl]) {
2511  delete signal[kl];
2512  signal[kl] = nullptr;
2513  }
2514  if (pedfun[kl]) {
2515  delete pedfun[kl];
2516  pedfun[kl] = nullptr;
2517  }
2518  if (sigfun[kl]) {
2519  delete sigfun[kl];
2520  sigfun[kl] = nullptr;
2521  }
2522  if (signalx[kl]) {
2523  delete signalx[kl];
2524  signalx[kl] = nullptr;
2525  }
2526  if (signall[kl]) {
2527  delete signall[kl];
2528  signall[kl] = nullptr;
2529  }
2530  if (pedstll[kl]) {
2531  delete pedstll[kl];
2532  pedstll[kl] = nullptr;
2533  }
2534  }
2535  }
2536  } //for (int jk=0; jk<netamx; jk++) {
2537  } //for (int ij=0; ij<nphimx; ij++) {
2538 
2539  // if (iijj==0) {
2540  // sprintf(out_file, "comb_hosig_allring_%i.jpg", irunold);
2541  // c0->SaveAs(out_file);
2542  // iiter = 0;
2543  // } else {
2544  // // c0->Update();
2545  // }
2546 
2547  // iiter = 0;
2548  } //end of iijj
2549  if (iiter % nsample != 0) {
2550  c0->Update();
2551  for (int kl = 0; kl < nsample; kl++) {
2552  if (gx0[kl]) {
2553  delete gx0[kl];
2554  gx0[kl] = nullptr;
2555  }
2556  if (ped0fun[kl]) {
2557  delete ped0fun[kl];
2558  ped0fun[kl] = nullptr;
2559  }
2560  if (signal[kl]) {
2561  delete signal[kl];
2562  signal[kl] = nullptr;
2563  }
2564  if (pedfun[kl]) {
2565  delete pedfun[kl];
2566  pedfun[kl] = nullptr;
2567  }
2568  if (sigfun[kl]) {
2569  delete sigfun[kl];
2570  sigfun[kl] = nullptr;
2571  }
2572  if (signalx[kl]) {
2573  delete signalx[kl];
2574  signalx[kl] = nullptr;
2575  }
2576  if (signall[kl]) {
2577  delete signall[kl];
2578  signall[kl] = nullptr;
2579  }
2580  if (pedstll[kl]) {
2581  delete pedstll[kl];
2582  pedstll[kl] = nullptr;
2583  }
2584  }
2585  }
2586 
2587  delete c0;
2588 
2589  xsiz = 600; //int xsiz = 600;
2590  ysiz = 800; //int ysiz = 800;
2591 
2592  gStyle->SetTitleFontSize(0.05);
2593  gStyle->SetTitleSize(0.025, "XYZ");
2594  gStyle->SetLabelSize(0.025, "XYZ");
2595  gStyle->SetStatFontSize(.045);
2596 
2597  gStyle->SetOptStat(0);
2598  ps.NewPage();
2599  TCanvas* c1 = new TCanvas("c1", " Pedestal vs signal", xsiz, ysiz);
2600  ped_evt->Draw();
2601  c1->Update();
2602 
2603  ps.NewPage();
2604  ped_statmean->Draw();
2605  c1->Update();
2606 
2607  ps.NewPage();
2608  ped_rms->Draw();
2609  c1->Update();
2610 
2611  ps.NewPage();
2612  ped_mean->Draw();
2613  c1->Update();
2614 
2615  ps.NewPage();
2616  ped_width->Draw();
2617  c1->Update();
2618 
2619  ps.NewPage();
2620  sig_evt->Draw();
2621  c1->Update();
2622 
2623  ps.NewPage();
2624  sig_statmean->Draw();
2625  c1->Update();
2626 
2627  ps.NewPage();
2628  sig_rms->Draw();
2629  c1->Update();
2630 
2631  ps.NewPage();
2632  fit_chi->Draw();
2633  c1->Update();
2634 
2635  ps.NewPage();
2636  fit_sigevt->Draw();
2637  c1->Update();
2638 
2639  ps.NewPage();
2640  fit_bkgevt->Draw();
2641  c1->Update();
2642 
2643  ps.NewPage();
2644  sig_mean->Draw();
2645  c1->Update();
2646 
2647  ps.NewPage();
2648  sig_width->Draw();
2649  c1->Update();
2650 
2651  ps.NewPage();
2652  sig_sigma->Draw();
2653  c1->Update();
2654 
2655  ps.NewPage();
2656  sig_meanerr->Draw();
2657  c1->Update();
2658 
2659  ps.NewPage();
2660  sig_meanerrp->Draw();
2661  c1->Update();
2662 
2663  ps.NewPage();
2664  sig_signf->Draw();
2665  c1->Update();
2666 
2667  ps.Close();
2668  delete c1;
2669 
2670  file_out.close();
2671 
2672  if (m_figure) {
2673  xsiz = 700;
2674  ysiz = 450;
2675 
2676  gStyle->SetTitleFontSize(0.09);
2677  gStyle->SetPadBottomMargin(0.17);
2678  gStyle->SetPadLeftMargin(0.18);
2679  gStyle->SetPadRightMargin(0.01);
2680  gStyle->SetOptLogy(0);
2681  gStyle->SetOptStat(0);
2682 
2683  TCanvas* c2 = new TCanvas("c2", "runfile", xsiz, ysiz);
2684  c2->Divide(5, 3);
2685 
2686  for (int side = 0; side < 2; side++) {
2687  gStyle->SetNdivisions(303, "XY");
2688  gStyle->SetPadRightMargin(0.01);
2689  int nmn = 0;
2690  int nmx = netamx / 2;
2691  if (side == 1) {
2692  nmn = netamx / 2;
2693  nmx = netamx;
2694  }
2695 
2696  int nzone = 0;
2697 
2698  for (int ij = nmn; ij < nmx; ij++) {
2699  c2->cd(nzone + 1);
2700  const_eta[ij]->GetXaxis()->SetTitle("#phi index");
2701  const_eta[ij]->GetXaxis()->SetTitleSize(.08);
2702  const_eta[ij]->GetXaxis()->CenterTitle();
2703  const_eta[ij]->GetXaxis()->SetTitleOffset(0.9);
2704  const_eta[ij]->GetXaxis()->SetLabelSize(.085);
2705  const_eta[ij]->GetXaxis()->SetLabelOffset(.01);
2706 
2707  const_eta[ij]->GetYaxis()->SetLabelSize(.08);
2708  const_eta[ij]->GetYaxis()->SetLabelOffset(.01);
2709  const_eta[ij]->GetYaxis()->SetTitle("GeV/MIP-GeV!!");
2710 
2711  const_eta[ij]->GetYaxis()->SetTitleSize(.085);
2712  const_eta[ij]->GetYaxis()->CenterTitle();
2713  const_eta[ij]->GetYaxis()->SetTitleOffset(1.3);
2714  const_eta[ij]->SetMarkerSize(0.60);
2715  const_eta[ij]->SetMarkerColor(2);
2716  const_eta[ij]->SetMarkerStyle(20);
2717 
2718  const_eta[ij]->Draw();
2719  nzone++;
2720  }
2721 
2722  sprintf(out_file, "calibho_%i_side%i.eps", irunold, side);
2723  c2->SaveAs(out_file);
2724 
2725  sprintf(out_file, "calibho_%i_side%i.jpg", irunold, side);
2726  c2->SaveAs(out_file);
2727 
2728  nzone = 0;
2729  for (int ij = nmn; ij < nmx; ij++) {
2730  c2->cd(nzone + 1);
2731  peak_eta[ij]->GetXaxis()->SetTitle("#phi index");
2732  peak_eta[ij]->GetXaxis()->SetTitleSize(.08);
2733  peak_eta[ij]->GetXaxis()->CenterTitle();
2734  peak_eta[ij]->GetXaxis()->SetTitleOffset(0.90);
2735  peak_eta[ij]->GetXaxis()->SetLabelSize(.08);
2736  peak_eta[ij]->GetXaxis()->SetLabelOffset(.01);
2737 
2738  peak_eta[ij]->GetYaxis()->SetLabelSize(.08);
2739  peak_eta[ij]->GetYaxis()->SetLabelOffset(.01);
2740  peak_eta[ij]->GetYaxis()->SetTitle("GeV");
2741 
2742  peak_eta[ij]->GetYaxis()->SetTitleSize(.085);
2743  peak_eta[ij]->GetYaxis()->CenterTitle();
2744  peak_eta[ij]->GetYaxis()->SetTitleOffset(1.3);
2745 
2746  peak_eta[ij]->SetMarkerSize(0.60);
2747  peak_eta[ij]->SetMarkerColor(2);
2748  peak_eta[ij]->SetMarkerStyle(20);
2749 
2750  peak_eta[ij]->Draw();
2751  nzone++;
2752  }
2753 
2754  sprintf(out_file, "peakho_%i_side%i.eps", irunold, side);
2755  c2->SaveAs(out_file);
2756 
2757  sprintf(out_file, "peakho_%i_side%i.jpg", irunold, side);
2758  c2->SaveAs(out_file);
2759  }
2760  delete c2;
2761 
2762  // if (m_combined) {
2763  gStyle->SetTitleFontSize(0.045);
2764  gStyle->SetPadRightMargin(0.13);
2765  gStyle->SetPadBottomMargin(0.15);
2766  gStyle->SetPadLeftMargin(0.1);
2767  gStyle->SetOptStat(0);
2768  xsiz = 700;
2769  ysiz = 600;
2770  TCanvas* c1 = new TCanvas("c1", "Fitted const in each tower", xsiz, ysiz);
2771  const_eta_phi->GetXaxis()->SetTitle("#eta");
2772  const_eta_phi->GetXaxis()->SetTitleSize(0.065);
2773  const_eta_phi->GetXaxis()->SetTitleOffset(0.85); //6);
2774  const_eta_phi->GetXaxis()->CenterTitle();
2775  const_eta_phi->GetXaxis()->SetLabelSize(0.045);
2776  const_eta_phi->GetXaxis()->SetLabelOffset(0.01);
2777 
2778  const_eta_phi->GetYaxis()->SetTitle("#phi");
2779  const_eta_phi->GetYaxis()->SetTitleSize(0.075);
2780  const_eta_phi->GetYaxis()->SetTitleOffset(0.5);
2781  const_eta_phi->GetYaxis()->CenterTitle();
2782  const_eta_phi->GetYaxis()->SetLabelSize(0.045);
2783  const_eta_phi->GetYaxis()->SetLabelOffset(0.01);
2784 
2785  const_eta_phi->Draw("colz");
2786  sprintf(out_file, "high_hoconst_eta_phi_%i.jpg", irunold);
2787  c1->SaveAs(out_file);
2788 
2789  delete c1;
2790 
2791  for (int jk = 0; jk < netamx; jk++) {
2792  int ieta = (jk < 15) ? jk + 1 : 14 - jk;
2793  if (rms_phi[jk] > 0) {
2794  mean_phi_ave->Fill(ieta, mean_phi[jk] / rms_phi[jk]);
2795  mean_phi_ave->SetBinError(mean_phi_ave->FindBin(ieta), pow(double(rms_phi[jk]), -0.5));
2796  }
2797  }
2798 
2799  for (int ij = 0; ij < nphimx; ij++) {
2800  if (rms_eta[ij] > 0) {
2801  mean_eta_ave->Fill(ij + 1, mean_eta[ij] / rms_eta[ij]);
2802  mean_eta_ave->SetBinError(mean_eta_ave->FindBin(ij + 1), pow(double(rms_eta[ij]), -0.5));
2803  }
2804  }
2805 
2806  ysiz = 450;
2807  gStyle->SetPadLeftMargin(0.13);
2808  gStyle->SetPadRightMargin(0.03);
2809 
2810  TCanvas* c2y = new TCanvas("c2", "Avearge signal in eta and phi", xsiz, ysiz);
2811  c2y->Divide(2, 1);
2812  mean_eta_ave->GetXaxis()->SetTitle("#phi");
2813  mean_eta_ave->GetXaxis()->SetTitleSize(0.085);
2814  mean_eta_ave->GetXaxis()->SetTitleOffset(0.65);
2815  mean_eta_ave->GetXaxis()->CenterTitle();
2816  mean_eta_ave->GetXaxis()->SetLabelSize(0.05);
2817  mean_eta_ave->GetXaxis()->SetLabelOffset(0.001);
2818 
2819  mean_eta_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP");
2820  mean_eta_ave->GetYaxis()->SetTitleSize(0.055);
2821  mean_eta_ave->GetYaxis()->SetTitleOffset(1.3);
2822  mean_eta_ave->GetYaxis()->CenterTitle();
2823  mean_eta_ave->GetYaxis()->SetLabelSize(0.045);
2824  mean_eta_ave->GetYaxis()->SetLabelOffset(0.01);
2825  mean_eta_ave->SetMarkerSize(0.60);
2826  mean_eta_ave->SetMarkerColor(2);
2827  mean_eta_ave->SetMarkerStyle(20);
2828 
2829  c2y->cd(1);
2830  mean_eta_ave->Draw();
2831 
2832  mean_phi_ave->GetXaxis()->SetTitle("#eta");
2833  mean_phi_ave->GetXaxis()->SetTitleSize(0.085);
2834  mean_phi_ave->GetXaxis()->SetTitleOffset(0.65); //55);
2835  mean_phi_ave->GetXaxis()->CenterTitle();
2836  mean_phi_ave->GetXaxis()->SetLabelSize(0.05);
2837  mean_phi_ave->GetXaxis()->SetLabelOffset(0.001);
2838 
2839  mean_phi_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP");
2840  mean_phi_ave->GetYaxis()->SetTitleSize(0.055);
2841  mean_phi_ave->GetYaxis()->SetTitleOffset(1.3);
2842  mean_phi_ave->GetYaxis()->CenterTitle();
2843  mean_phi_ave->GetYaxis()->SetLabelSize(0.045);
2844  mean_phi_ave->GetYaxis()->SetLabelOffset(0.01);
2845  mean_phi_ave->SetMarkerSize(0.60);
2846  mean_phi_ave->SetMarkerColor(2);
2847  mean_phi_ave->SetMarkerStyle(20);
2848 
2849  c2y->cd(2);
2850  mean_phi_ave->Draw();
2851 
2852  sprintf(out_file, "high_hoaverage_eta_phi_%i.jpg", irunold);
2853  c2y->SaveAs(out_file);
2854 
2855  delete c2y;
2856  // } else { //m_combined
2857 
2858  xsiz = 800;
2859  ysiz = 450;
2860  TCanvas* c3 = new TCanvas("c3", "Avearge signal in eta and phi", xsiz, ysiz);
2861  c3->Divide(2, 1);
2862  mean_phi_hst->GetXaxis()->SetTitle("#eta");
2863  mean_phi_hst->GetXaxis()->SetTitleSize(0.065);
2864  mean_phi_hst->GetXaxis()->SetTitleOffset(0.9);
2865  mean_phi_hst->GetXaxis()->CenterTitle();
2866  mean_phi_hst->GetXaxis()->SetLabelSize(0.065);
2867  mean_phi_hst->GetXaxis()->SetLabelOffset(0.001);
2868 
2869  mean_phi_hst->GetYaxis()->SetTitle("GeV/MIP");
2870  mean_phi_hst->GetYaxis()->SetTitleSize(0.055);
2871  mean_phi_hst->GetYaxis()->SetTitleOffset(0.9);
2872  mean_phi_hst->GetYaxis()->CenterTitle();
2873  mean_phi_hst->GetYaxis()->SetLabelSize(0.065);
2874  mean_phi_hst->GetYaxis()->SetLabelOffset(0.01);
2875 
2876  mean_phi_hst->SetMarkerColor(4);
2877  mean_phi_hst->SetMarkerSize(0.8);
2878  mean_phi_hst->SetMarkerStyle(20);
2879  mean_phi_hst->Draw();
2880 
2881  sprintf(out_file, "low_mean_phi_hst_%i.jpg", irunold);
2882  c3->SaveAs(out_file);
2883 
2884  delete c3;
2885 
2886  // } //m_combined
2887 
2888  gStyle->SetOptLogy(1);
2889  gStyle->SetPadTopMargin(.1);
2890  gStyle->SetPadLeftMargin(.15);
2891  xsiz = 800;
2892  ysiz = 500;
2893  TCanvas* c0x = new TCanvas("c0x", "Signal in each ring", xsiz, ysiz);
2894 
2895  c0x->Divide(3, 2);
2896  for (int ij = 0; ij < ringmx; ij++) {
2897  int iread = (ij == 2) ? routmx : rout12mx;
2898  com_sigrsg[ij][iread]->GetXaxis()->SetTitle("Signal/ped (GeV)");
2899 
2900  com_sigrsg[ij][iread]->GetXaxis()->SetTitleSize(0.060);
2901  com_sigrsg[ij][iread]->GetXaxis()->SetTitleOffset(1.05);
2902  com_sigrsg[ij][iread]->GetXaxis()->CenterTitle();
2903  com_sigrsg[ij][iread]->GetXaxis()->SetLabelSize(0.065);
2904  com_sigrsg[ij][iread]->GetXaxis()->SetLabelOffset(0.01);
2905 
2906  com_sigrsg[ij][iread]->GetYaxis()->SetLabelSize(0.065);
2907  com_sigrsg[ij][iread]->GetYaxis()->SetLabelOffset(0.01);
2908 
2909  com_sigrsg[ij][iread]->SetLineWidth(3);
2910  com_sigrsg[ij][iread]->SetLineColor(4);
2911 
2912  c0x->cd(ij + 1);
2913  com_sigrsg[ij][iread]->Draw();
2914 
2915  com_crossg[ij][iread]->SetLineWidth(2);
2916  com_crossg[ij][iread]->SetLineColor(2);
2917  com_crossg[ij][iread]->Draw("same");
2918  }
2919  sprintf(out_file, "hosig_ring_%i.jpg", irunold);
2920  c0x->SaveAs(out_file);
2921  delete c0x;
2922 
2923  gStyle->SetTitleFontSize(0.06);
2924  gStyle->SetOptStat(0);
2925  gStyle->SetOptLogy(0);
2926 
2927  TCanvas* c0 = new TCanvas("c0", "Signal in each ring", xsiz, ysiz);
2928 
2929  c0->Divide(3, 2);
2930  for (int jk = 0; jk < ringmx; jk++) {
2931  peak_hpdrm[jk]->GetXaxis()->SetTitle("RM #");
2932  peak_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070);
2933  peak_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.0);
2934  peak_hpdrm[jk]->GetXaxis()->CenterTitle();
2935  peak_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065);
2936  peak_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01);
2937 
2938  peak_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)/MIP");
2939 
2940  peak_hpdrm[jk]->GetYaxis()->SetTitleSize(0.07);
2941  peak_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.3);
2942  peak_hpdrm[jk]->GetYaxis()->CenterTitle();
2943  peak_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065);
2944  peak_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01);
2945  // peak_hpdrm[jk]->SetLineWidth(3);
2946  // peak_hpdrm[jk]->SetLineColor(4);
2947  peak_hpdrm[jk]->SetMarkerSize(0.60);
2948  peak_hpdrm[jk]->SetMarkerColor(2);
2949  peak_hpdrm[jk]->SetMarkerStyle(20);
2950 
2951  c0->cd(jk + 1);
2952  peak_hpdrm[jk]->Draw();
2953  }
2954  sprintf(out_file, "comb_peak_hpdrm_%i.jpg", irunold);
2955  c0->SaveAs(out_file);
2956 
2957  delete c0;
2958 
2959  TCanvas* c1y = new TCanvas("c1y", "Signal in each ring", xsiz, ysiz);
2960 
2961  c1y->Divide(3, 2);
2962  for (int jk = 0; jk < ringmx; jk++) {
2963  const_hpdrm[jk]->GetXaxis()->SetTitle("RM #");
2964  const_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070);
2965  const_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.3);
2966  const_hpdrm[jk]->GetXaxis()->CenterTitle();
2967  const_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065);
2968  const_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01);
2969 
2970  const_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)");
2971  const_hpdrm[jk]->GetYaxis()->SetTitleSize(0.065);
2972  const_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.0);
2973  const_hpdrm[jk]->GetYaxis()->CenterTitle();
2974  const_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065);
2975  const_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01);
2976  // const_hpdrm[jk]->SetLineWidth(3);
2977  // const_hpdrm[jk]->SetLineColor(4);
2978  const_hpdrm[jk]->SetMarkerSize(0.60);
2979  const_hpdrm[jk]->SetMarkerColor(2);
2980  const_hpdrm[jk]->SetMarkerStyle(20);
2981 
2982  c1y->cd(jk + 1);
2983  const_hpdrm[jk]->Draw();
2984  }
2985 
2986  sprintf(out_file, "comb_const_hpdrm_%i.jpg", irunold);
2987  c1y->SaveAs(out_file);
2988 
2989  delete c1y;
2990 
2991  } //if (m_figure) {
2992 
2993  // ps.Close();
2994  // file_out.close();
2995 
2996  } // if (m_constant){
2997 
2998  if (m_figure) {
2999  for (int ij = 0; ij < nphimx; ij++) {
3000  for (int jk = 0; jk < netamx; jk++) {
3001  stat_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetEntries());
3002  statmn_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetMean());
3003  }
3004  }
3005 
3006  xsiz = 700;
3007  ysiz = 450;
3008  gStyle->SetTitleFontSize(0.09);
3009  gStyle->SetPadBottomMargin(0.14);
3010  gStyle->SetPadLeftMargin(0.17);
3011  gStyle->SetPadRightMargin(0.01);
3012  gStyle->SetNdivisions(303, "XY");
3013  gStyle->SetOptLogy(1);
3014 
3015  TCanvas* c2x = new TCanvas("c2x", "runfile", xsiz, ysiz);
3016  c2x->Divide(5, 3);
3017  for (int side = 0; side < 2; side++) {
3018  int nmn = 0;
3019  int nmx = netamx / 2;
3020  if (side == 1) {
3021  nmn = netamx / 2;
3022  nmx = netamx;
3023  }
3024  int nzone = 0;
3025  char name[200];
3026 
3027  for (int ij = nmn; ij < nmx; ij++) {
3028  int ieta = (ij < 15) ? ij + 1 : 14 - ij;
3029  c2x->cd(nzone + 1);
3030  sprintf(name, "GeV(#eta=%i)", ieta);
3031  sigrsg[ij][nphimx]->GetXaxis()->SetTitle(name);
3032  sigrsg[ij][nphimx]->GetXaxis()->SetTitleSize(.08);
3033  sigrsg[ij][nphimx]->GetXaxis()->CenterTitle();
3034  sigrsg[ij][nphimx]->GetXaxis()->SetTitleOffset(0.90);
3035  sigrsg[ij][nphimx]->GetXaxis()->SetLabelSize(.08);
3036  sigrsg[ij][nphimx]->GetXaxis()->SetLabelOffset(.01);
3037 
3038  sigrsg[ij][nphimx]->GetYaxis()->SetLabelSize(.08);
3039  sigrsg[ij][nphimx]->GetYaxis()->SetLabelOffset(.01);
3040  sigrsg[ij][nphimx]->SetLineWidth(2);
3041  sigrsg[ij][nphimx]->SetLineColor(4);
3042  sigrsg[ij][nphimx]->Draw();
3043  crossg[ij][nphimx]->SetLineWidth(2);
3044  crossg[ij][nphimx]->SetLineColor(2);
3045  crossg[ij][nphimx]->Draw("same");
3046  nzone++;
3047  }
3048 
3049  sprintf(out_file, "sig_ho_%i_side%i.eps", irunold, side);
3050  c2x->SaveAs(out_file);
3051 
3052  sprintf(out_file, "sig_ho_%i_side%i.jpg", irunold, side);
3053  c2x->SaveAs(out_file);
3054  }
3055 
3056  gStyle->SetOptLogy(0);
3057  c2x = new TCanvas("c2x", "runfile", xsiz, ysiz);
3058  c2x->Divide(5, 3);
3059  for (int side = 0; side < 2; side++) {
3060  int nmn = 0;
3061  int nmx = netamx / 2;
3062  if (side == 1) {
3063  nmn = netamx / 2;
3064  nmx = netamx;
3065  }
3066  int nzone = 0;
3067 
3068  nzone = 0;
3069  for (int ij = nmn; ij < nmx; ij++) {
3070  c2x->cd(nzone + 1);
3071  statmn_eta[ij]->SetLineWidth(2);
3072  statmn_eta[ij]->SetLineColor(4);
3073  statmn_eta[ij]->GetXaxis()->SetTitle("#phi index");
3074  statmn_eta[ij]->GetXaxis()->SetTitleSize(.08);
3075  statmn_eta[ij]->GetXaxis()->CenterTitle();
3076  statmn_eta[ij]->GetXaxis()->SetTitleOffset(0.9);
3077  statmn_eta[ij]->GetYaxis()->SetLabelSize(.08);
3078  statmn_eta[ij]->GetYaxis()->SetLabelOffset(.01);
3079  statmn_eta[ij]->GetXaxis()->SetLabelSize(.08);
3080  statmn_eta[ij]->GetXaxis()->SetLabelOffset(.01);
3081  statmn_eta[ij]->GetYaxis()->SetTitle("GeV");
3082  statmn_eta[ij]->GetYaxis()->SetTitleSize(.075);
3083  statmn_eta[ij]->GetYaxis()->CenterTitle();
3084  statmn_eta[ij]->GetYaxis()->SetTitleOffset(1.30);
3085 
3086  statmn_eta[ij]->Draw();
3087  nzone++;
3088  }
3089 
3090  sprintf(out_file, "statmnho_%i_side%i.eps", irunold, side);
3091  c2x->SaveAs(out_file);
3092 
3093  sprintf(out_file, "statmnho_%i_side%i.jpg", irunold, side);
3094  c2x->SaveAs(out_file);
3095 
3096  gStyle->SetOptLogy(1);
3097  gStyle->SetNdivisions(203, "XY");
3098 
3099  nzone = 0;
3100  for (int ij = nmn; ij < nmx; ij++) {
3101  c2x->cd(nzone + 1);
3102  stat_eta[ij]->SetLineWidth(2);
3103  stat_eta[ij]->SetLineColor(4);
3104  stat_eta[ij]->GetXaxis()->SetTitle("#phi index");
3105  stat_eta[ij]->GetXaxis()->SetTitleSize(.08);
3106  stat_eta[ij]->GetXaxis()->CenterTitle();
3107  stat_eta[ij]->GetXaxis()->SetTitleOffset(0.80);
3108  stat_eta[ij]->GetXaxis()->SetLabelSize(.08);
3109  stat_eta[ij]->GetXaxis()->SetLabelOffset(.01);
3110  stat_eta[ij]->GetYaxis()->SetLabelSize(.08);
3111  stat_eta[ij]->GetYaxis()->SetLabelOffset(.01);
3112 
3113  stat_eta[ij]->Draw();
3114  nzone++;
3115  }
3116 
3117  sprintf(out_file, "statho_%i_side%i.eps", irunold, side);
3118  c2x->SaveAs(out_file);
3119 
3120  sprintf(out_file, "statho_%i_side%i.jpg", irunold, side);
3121  c2x->SaveAs(out_file);
3122  }
3123  delete c2x;
3124 
3125  } //if (m_figure) {
3126 
3127  if (!m_constant) { //m_constant
3128  for (int jk = 0; jk < netamx; jk++) {
3129  for (int ij = 0; ij < nphimx; ij++) {
3130  if (crossg[jk][ij]) {
3131  delete crossg[jk][ij];
3132  }
3133  if (sigrsg[jk][ij]) {
3134  delete sigrsg[jk][ij];
3135  }
3136  }
3137  }
3138  }
3139 }
3140 
3141 //define this as a plug-in
3143 
3144 /*
3145 75minute
3146 112MB data
3147 1M events
3148 
3149 */
HOCalibAnalyzer::sectmx
static const int sectmx
Definition: HOCalibAnalyzer.cc:330
HOCalibAnalyzer::mean_phi_ave
TH1F * mean_phi_ave
Definition: HOCalibAnalyzer.cc:388
HOCalibAnalyzer::mncorrsgru
TH1F * mncorrsgru
Definition: HOCalibAnalyzer.cc:279
HOCalibAnalyzer::HOCalibAnalyzer
HOCalibAnalyzer(const edm::ParameterSet &)
Definition: HOCalibAnalyzer.cc:437
HOCalibAnalyzer::nmuon
int nmuon
Definition: HOCalibAnalyzer.cc:400
HOCalibAnalyzer::hbhesig
float hbhesig[9]
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::m_allHOsignal
bool m_allHOsignal
Definition: HOCalibAnalyzer.cc:224
HOCalibAnalyzer::tkpt03
float tkpt03
Definition: HOCalibAnalyzer.cc:404
totalfunc
Double_t totalfunc(Double_t *x, Double_t *par)
Definition: HOCalibAnalyzer.cc:164
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
HOCalibAnalyzer::hotime
TProfile * hotime[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:263
mps_fire.i
i
Definition: mps_fire.py:428
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HOCalibAnalyzer::com_crossg
TH1F * com_crossg[ringmx][routmx+1]
Definition: HOCalibAnalyzer.cc:352
HOCalibAnalyzer::m_figure
bool m_figure
Definition: HOCalibAnalyzer.cc:232
MessageLogger.h
HOCalibAnalyzer::ipass
int ipass
Definition: HOCalibAnalyzer.cc:241
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
HOCalibAnalyzer::theRootFileName
std::string theRootFileName
Definition: HOCalibAnalyzer.cc:220
HOCalibAnalyzer::sel_muonnm
TH1F * sel_muonnm
Definition: HOCalibAnalyzer.cc:257
HOCalibAnalyzer::peak_hpdrm
TH1F * peak_hpdrm[ringmx]
Definition: HOCalibAnalyzer.cc:385
HOCalibAnalyzer::mypow_2_ncut
static const int mypow_2_ncut
Definition: HOCalibAnalyzer.cc:239
HOCalibAnalyzer::~HOCalibAnalyzer
~HOCalibAnalyzer() override
Definition: HOCalibAnalyzer.cc:922
netamx
static const int netamx
Definition: HOCalibAnalyzer.cc:97
HOCalibAnalyzer::m_pedsuppr
bool m_pedsuppr
Definition: HOCalibAnalyzer.cc:235
HOCalibAnalyzer::corrsglb
TH1F * corrsglb[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:267
HOCalibAnalyzer::ho_sig1m
TH1F * ho_sig1m[9]
Definition: HOCalibAnalyzer.cc:324
HOCalibAnalyzer::routmx
static const int routmx
Definition: HOCalibAnalyzer.cc:331
fcnsg
void fcnsg(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t flag)
Definition: HOCalibAnalyzer.cc:176
HOCalibAnalyzer::sel_muonph
TH1F * sel_muonph
Definition: HOCalibAnalyzer.cc:260
step
step
Definition: StallMonitor.cc:94
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HOCalibAnalyzer::rmscorrsgc
TH1F * rmscorrsgc
Definition: HOCalibAnalyzer.cc:305
HOCalibAnalyzer::theoutputtxtFile
std::string theoutputtxtFile
Definition: HOCalibAnalyzer.cc:221
HOCalibAnalyzer::rmscorrsgr
TH1F * rmscorrsgr
Definition: HOCalibAnalyzer.cc:292
HOCalibAnalyzer::ho_energy
TH2F * ho_energy
Definition: HOCalibAnalyzer.cc:246
HOCalibAnalyzer::ho_indenergy
TH1F * ho_indenergy[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:249
min
T min(T a, T b)
Definition: MathUtil.h:58
HOCalibAnalyzer::alow
float alow
Definition: HOCalibAnalyzer.cc:408
HOCalibAnalyzer::mean_eta_ave
TH1F * mean_eta_ave
Definition: HOCalibAnalyzer.cc:387
edm::EDGetTokenT< HOCalibVariableCollection >
HOCalibAnalyzer::corrsgall
TH1F * corrsgall[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:271
edm
HLT enums.
Definition: AlignableModifier.h:19
mps_splice.entry
entry
Definition: mps_splice.py:68
mapx0m
static const int mapx0m[9][2]
Definition: HOCalibAnalyzer.cc:77
nbgpr
static const int nbgpr
Definition: HOCalibAnalyzer.cc:99
fitWZ.arglist
arglist
Definition: fitWZ.py:39
np
int np
Definition: AMPTWrapper.h:43
ietafit
int ietafit
Definition: HOCalibAnalyzer.cc:102
HOCalibAnalyzer::sig_sigma
TH1F * sig_sigma
Definition: HOCalibAnalyzer.cc:365
HOCalibAnalyzer::hodx
float hodx
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::statmn_eta
TH1F * statmn_eta[netamx]
Definition: HOCalibAnalyzer.cc:379
HOCalibAnalyzer::rmscorrsglb
TH1F * rmscorrsglb
Definition: HOCalibAnalyzer.cc:285
HOCalibAnalyzer::nevcorrsglu
TH1F * nevcorrsglu
Definition: HOCalibAnalyzer.cc:296
HOCalibAnalyzer::com_hopedtime
TProfile * com_hopedtime[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:336
HOCalibAnalyzer::sel_muonch
TH1F * sel_muonch
Definition: HOCalibAnalyzer.cc:261
HOCalibAnalyzer::mncrossg
TH1F * mncrossg
Definition: HOCalibAnalyzer.cc:313
HOCalibAnalyzer::com_sigrsg
TH1F * com_sigrsg[ringmx][routmx+1]
Definition: HOCalibAnalyzer.cc:351
HOCalibAnalyzer::trkvx
float trkvx
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::ho_sig2m
TH1F * ho_sig2m[9]
Definition: HOCalibAnalyzer.cc:325
HOCalibAnalyzer::ped_mean
TH1F * ped_mean
Definition: HOCalibAnalyzer.cc:356
HOCalibAnalyzer::invang
float invang[netamx][nphimx+1]
Definition: HOCalibAnalyzer.cc:310
HOCalibAnalyzer::com_hbtime
TProfile * com_hbtime[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:338
HOCalibAnalyzer::sig_meanerrp
TH1F * sig_meanerrp
Definition: HOCalibAnalyzer.cc:367
HOCalibAnalyzer::ped_statmean
TH1F * ped_statmean
Definition: HOCalibAnalyzer.cc:370
etamap
static const int etamap[4][21]
Definition: HOCalibAnalyzer.cc:79
HOCalibAnalyzer::m_histfit
bool m_histfit
Definition: HOCalibAnalyzer.cc:234
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HOCalibAnalyzer::com_corrsglb
TH1F * com_corrsglb[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:340
EDAnalyzer.h
HOCalibAnalyzer::isect
int isect
Definition: HOCalibAnalyzer.cc:400
HOCalibAnalyzer::com_corrsgc
TH1F * com_corrsgc[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:349
nsgpr
static const int nsgpr
Definition: HOCalibAnalyzer.cc:100
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
HOCalibAnalyzer::pherr
float pherr
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::com_corrsgrb
TH1F * com_corrsgrb[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:341
HOCalibAnalyzer::chisq
float chisq
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::corrsgrb
TH1F * corrsgrb[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:268
tools.TF1
TF1
Definition: tools.py:23
HOCalibAnalyzer::m_combined
bool m_combined
Definition: HOCalibAnalyzer.cc:230
HOCalibAnalyzer::com_corrsgr
TH1F * com_corrsgr[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:347
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
edm::Handle
Definition: AssociativeIterator.h:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
HOCalibAnalyzer::mncorrsgrb
TH1F * mncorrsgrb
Definition: HOCalibAnalyzer.cc:277
HOCalibAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: HOCalibAnalyzer.cc:937
HOCalibAnalyzer::sig_statmean
TH1F * sig_statmean
Definition: HOCalibAnalyzer.cc:371
fitWZ.gMinuit
gMinuit
Definition: fitWZ.py:36
HOCalibAnalyzer::com_corrsgru
TH1F * com_corrsgru[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:343
sig_reg
std::vector< float > sig_reg[netamx][nphimx+1]
Definition: HOCalibAnalyzer.cc:104
HOCalibAnalyzer::rmscorrsgl
TH1F * rmscorrsgl
Definition: HOCalibAnalyzer.cc:291
mapx0p
static const int mapx0p[9][2]
Definition: HOCalibAnalyzer.cc:76
iphifit
int iphifit
Definition: HOCalibAnalyzer.cc:103
HOCalibAnalyzer::ho_sig1p
TH1F * ho_sig1p[9]
Definition: HOCalibAnalyzer.cc:322
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
HOCalibAnalyzer::sig_diff
TH1F * sig_diff
Definition: HOCalibAnalyzer.cc:363
HOCalibAnalyzer::corrsglu
TH1F * corrsglu[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:269
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HOCalibAnalyzer::hoflag
unsigned hoflag
Definition: HOCalibAnalyzer.cc:399
HOCalibAnalyzer::mncorrsglb
TH1F * mncorrsglb
Definition: HOCalibAnalyzer.cc:276
HOCalibAnalyzer::rmscorrsglu
TH1F * rmscorrsglu
Definition: HOCalibAnalyzer.cc:287
HOCalibAnalyzer::neffip
static const int neffip
Definition: HOCalibAnalyzer.cc:333
HOCalibAnalyzer::muonph
TH1F * muonph
Definition: HOCalibAnalyzer.cc:254
HOCalibAnalyzer::rmscrossg
TH1F * rmscrossg
Definition: HOCalibAnalyzer.cc:316
HOCalibAnalyzer::com_hotime
TProfile * com_hotime[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:335
MakerMacros.h
HOCalibAnalyzer::nevcorrsgall
TH1F * nevcorrsgall
Definition: HOCalibAnalyzer.cc:298
HOCalibAnalyzer::ndof
int ndof
Definition: HOCalibAnalyzer.cc:400
HOCalibAnalyzer::nevcrossg
TH1F * nevcrossg
Definition: HOCalibAnalyzer.cc:319
HOCalibAnalyzer::theFile
TFile * theFile
Definition: HOCalibAnalyzer.cc:219
HOCalibAnalyzer::nevcorrsglb
TH1F * nevcorrsglb
Definition: HOCalibAnalyzer.cc:294
fcnbg
void fcnbg(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t flag)
Definition: HOCalibAnalyzer.cc:166
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HOCalibAnalyzer::com_invang
float com_invang[ringmx][routmx+1]
Definition: HOCalibAnalyzer.cc:353
HOCalibAnalyzer::binwid
float binwid
Definition: HOCalibAnalyzer.cc:410
Abs
T Abs(T a)
Definition: MathUtil.h:49
HOCalibAnalyzer::const_eta
TH1F * const_eta[netamx]
Definition: HOCalibAnalyzer.cc:377
HOCalibAnalyzer::sig_rms
TH1F * sig_rms
Definition: HOCalibAnalyzer.cc:373
HOCalibAnalyzer::muonch
TH1F * muonch
Definition: HOCalibAnalyzer.cc:255
HOCalibAnalyzer::rmscorrsgall
TH1F * rmscorrsgall
Definition: HOCalibAnalyzer.cc:289
HOCalibAnalyzer::sig_width
TH1F * sig_width
Definition: HOCalibAnalyzer.cc:364
HOCalibAnalyzer::sig_evt
TH1F * sig_evt
Definition: HOCalibAnalyzer.cc:359
Service.h
HOCalibAnalyzer::ped_width
TH1F * ped_width
Definition: HOCalibAnalyzer.cc:357
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
phimap
static const int phimap[4][21]
Definition: HOCalibAnalyzer.cc:84
HOCalibAnalyzer::ho_sig2p
TH1F * ho_sig2p[9]
Definition: HOCalibAnalyzer.cc:321
HOCalibAnalyzer::mncorrsglu
TH1F * mncorrsglu
Definition: HOCalibAnalyzer.cc:278
HOCalibAnalyzer::stat_eta
TH1F * stat_eta[netamx]
Definition: HOCalibAnalyzer.cc:378
HOCalibAnalyzer::fit_bkgevt
TH1F * fit_bkgevt
Definition: HOCalibAnalyzer.cc:361
HOCalibAnalyzer::m_hotime
bool m_hotime
Definition: HOCalibAnalyzer.cc:225
HOCalibAnalyzer::m_hbtime
bool m_hbtime
Definition: HOCalibAnalyzer.cc:226
HOCalibAnalyzer::caloen
float caloen[3]
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::irun
int irun
Definition: HOCalibAnalyzer.cc:400
HOCalibAnalyzer::fit_sigevt
TH1F * fit_sigevt
Definition: HOCalibAnalyzer.cc:360
HOCalibAnalyzer::nevcorrsgrb
TH1F * nevcorrsgrb
Definition: HOCalibAnalyzer.cc:295
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HOCalibAnalyzer::mncorrsgl
TH1F * mncorrsgl
Definition: HOCalibAnalyzer.cc:282
HOCalibAnalyzer::sig_mean
TH1F * sig_mean
Definition: HOCalibAnalyzer.cc:362
HOCalibAnalyzer::com_corrsglu
TH1F * com_corrsglu[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:342
HOCalibAnalyzer::ho_entry
TH2F * ho_entry
Definition: HOCalibAnalyzer.cc:245
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HOCalibAnalyzer::nbn
int nbn
Definition: HOCalibAnalyzer.cc:407
HOCalibAnalyzer::ped_evt
TH1F * ped_evt
Definition: HOCalibAnalyzer.cc:355
HOCalibAnalyzer::rmscorrsgru
TH1F * rmscorrsgru
Definition: HOCalibAnalyzer.cc:288
HOCalibAnalyzer::fit_chi
TH1F * fit_chi
Definition: HOCalibAnalyzer.cc:358
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HOCalibAnalyzer::nevcorrsgl
TH1F * nevcorrsgl
Definition: HOCalibAnalyzer.cc:300
HOCalibAnalyzer::const_hpdrm
TH1F * const_hpdrm[ringmx]
Definition: HOCalibAnalyzer.cc:382
TFileService.h
npixleft
static const int npixleft[21]
Definition: HOCalibAnalyzer.cc:90
HOCalibAnalyzer::trkth
float trkth
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::hocro
float hocro
Definition: HOCalibAnalyzer.cc:402
cro_ssg
std::vector< float > cro_ssg[netamx][nphimx+1]
Definition: HOCalibAnalyzer.cc:105
HOCalibAnalyzer::sigrsg
TH1F * sigrsg[netamx][nphimx+1]
Definition: HOCalibAnalyzer.cc:308
set_mean
void set_mean(double &x, bool mdigi)
Definition: HOCalibAnalyzer.cc:186
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HcalDetId::ieta
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
HOCalibAnalyzer::trkph
float trkph
Definition: HOCalibAnalyzer.cc:402
edm::ParameterSet
Definition: ParameterSet.h:47
langaufun
Double_t langaufun(Double_t *x, Double_t *par)
Definition: HOCalibAnalyzer.cc:114
HOCalibAnalyzer::muonth
TH1F * muonth
Definition: HOCalibAnalyzer.cc:253
HOCalibAnalyzer::sel_muonmm
TH1F * sel_muonmm
Definition: HOCalibAnalyzer.cc:258
HOCalibAnalyzer::hocorsig
float hocorsig[18]
Definition: HOCalibAnalyzer.cc:402
Event.h
HOCalibAnalyzer::sig_effi
TH2F * sig_effi[neffip]
Definition: HOCalibAnalyzer.cc:391
HOCalibAnalyzer::inslumi
float inslumi
Definition: HOCalibAnalyzer.cc:402
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HOCalibAnalyzer::hoCalibVariableCollectionTag
edm::InputTag hoCalibVariableCollectionTag
Definition: HOCalibAnalyzer.cc:413
HOCalibAnalyzer::trkvz
float trkvz
Definition: HOCalibAnalyzer.cc:402
npixriup
static const int npixriup[21]
Definition: HOCalibAnalyzer.cc:95
HOCalibAnalyzer::m_hbinfo
bool m_hbinfo
Definition: HOCalibAnalyzer.cc:229
fact
const double fact
Definition: NuclearInteractionFTFSimulator.cc:74
HOCalibAnalyzer::hopedtime
TProfile * hopedtime[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:264
HOCalibAnalyzer::invert_HOieta
int invert_HOieta(int ieta)
Definition: HOCalibAnalyzer.cc:217
npixlebt
static const int npixlebt[21]
Definition: HOCalibAnalyzer.cc:92
HOCalibAnalyzer::hcal03
float hcal03
Definition: HOCalibAnalyzer.cc:404
HcalDetId
Definition: HcalDetId.h:12
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
HOCalibAnalyzer::hbtime
TProfile * hbtime[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:265
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
HOCalibAnalyzer::const_eta_phi
TH2F * const_eta_phi
Definition: HOCalibAnalyzer.cc:375
HOCalibAnalyzer::rmssigrsg
TH1F * rmssigrsg
Definition: HOCalibAnalyzer.cc:315
HOCalibAnalyzer::tok_ho_
edm::EDGetTokenT< HOCalibVariableCollection > tok_ho_
Definition: HOCalibAnalyzer.cc:414
mapx2
static const int mapx2[6][3]
Definition: HOCalibAnalyzer.cc:74
HOCalibAnalyzer::trkdz
float trkdz
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::m_constant
bool m_constant
Definition: HOCalibAnalyzer.cc:231
DeadROCCounter.out_file
out_file
Definition: DeadROCCounter.py:50
HOCalibAnalyzer::m_cosmic
bool m_cosmic
Definition: HOCalibAnalyzer.cc:233
HOCalibAnalyzer::trkvy
float trkvy
Definition: HOCalibAnalyzer.cc:402
edm::EventSetup
Definition: EventSetup.h:57
HOCalibAnalyzer::corrsgru
TH1F * corrsgru[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:270
HOCalibAnalyzer::beginJob
void beginJob() override
Definition: HOCalibAnalyzer.cc:1659
nphimx
static const int nphimx
Definition: HOCalibAnalyzer.cc:98
HOCalibAnalyzer::ahigh
float ahigh
Definition: HOCalibAnalyzer.cc:409
HOCalibAnalyzer::isect2
int isect2
Definition: HOCalibAnalyzer.cc:400
npixrigh
static const int npixrigh[21]
Definition: HOCalibAnalyzer.cc:91
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
HOCalibAnalyzer::com_corrsgall
TH1F * com_corrsgall[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:344
HOCalibAnalyzer::nprim
int nprim
Definition: HOCalibAnalyzer.cc:400
HOCalibAnalyzer::nevcorrsgc
TH1F * nevcorrsgc
Definition: HOCalibAnalyzer.cc:306
HOCalibAnalyzer::corrsgc
TH1F * corrsgc[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:303
InputTag.h
HOCalibAnalyzer::sig_meanerr
TH1F * sig_meanerr
Definition: HOCalibAnalyzer.cc:366
HOCalibAnalyzer::ievt
unsigned ievt
Definition: HOCalibAnalyzer.cc:399
gausX
Double_t gausX(Double_t *x, Double_t *par)
Definition: HOCalibAnalyzer.cc:112
HOCalibAnalyzer::muonnm
TH1F * muonnm
Definition: HOCalibAnalyzer.cc:251
HOCalibAnalyzer
Definition: HOCalibAnalyzer.cc:206
set_sigma
void set_sigma(double &x, bool mdigi)
Definition: HOCalibAnalyzer.cc:196
HOCalibAnalyzer::ho_sig00
TH1F * ho_sig00[9]
Definition: HOCalibAnalyzer.cc:323
HOCalibAnalyzer::ho_rms
TH2F * ho_rms
Definition: HOCalibAnalyzer.cc:248
HOCalibAnalyzer::fitprm
double fitprm[nsgpr][netamx]
Definition: HOCalibAnalyzer.cc:394
HOCalibAnalyzer::ecal03
float ecal03
Definition: HOCalibAnalyzer.cc:404
HOCalibVariables.h
HOCalibAnalyzer::corrsgl
TH1F * corrsgl[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:273
HOCalibAnalyzer::nevcorrsgr
TH1F * nevcorrsgr
Definition: HOCalibAnalyzer.cc:301
HOCalibAnalyzer::m_correl
bool m_correl
Definition: HOCalibAnalyzer.cc:227
Frameworkfwd.h
HOCalibAnalyzer::sigvsevt
TProfile * sigvsevt[15][ncut]
Definition: HOCalibAnalyzer.cc:396
HOCalibAnalyzer::therr
float therr
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::rmscorrsgrb
TH1F * rmscorrsgrb
Definition: HOCalibAnalyzer.cc:286
HOCalibAnalyzer::mean_phi_hst
TH1F * mean_phi_hst
Definition: HOCalibAnalyzer.cc:389
HOCalibAnalyzer::sig_signf
TH1F * sig_signf
Definition: HOCalibAnalyzer.cc:368
HOCalibAnalyzer::trkmm
float trkmm
Definition: HOCalibAnalyzer.cc:402
genVertex_cff.x
x
Definition: genVertex_cff.py:12
HOCalibAnalyzer::irunold
int irunold
Definition: HOCalibAnalyzer.cc:411
HOCalibAnalyzer::getHOieta
int getHOieta(int ij)
Definition: HOCalibAnalyzer.cc:216
HOCalibAnalyzer::htime
float htime
Definition: HOCalibAnalyzer.cc:402
ZMuMuCategoriesSequences_cff.nbin
nbin
Definition: ZMuMuCategoriesSequences_cff.py:25
HOCalibAnalyzer::ncut
static const int ncut
Definition: HOCalibAnalyzer.cc:238
HOCalibAnalyzer::nevcorrsgru
TH1F * nevcorrsgru
Definition: HOCalibAnalyzer.cc:297
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
mapx1
static const int mapx1[6][3]
Definition: HOCalibAnalyzer.cc:72
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HcalRecHitCollections.h
fftjetpileupestimator_calo_uncalib_cfi.c0
c0
Definition: fftjetpileupestimator_calo_uncalib_cfi.py:8
HOCalibAnalyzer::mean_energy
TH2F * mean_energy
Definition: HOCalibAnalyzer.cc:392
HOCalibAnalyzer::com_corrsgl
TH1F * com_corrsgl[ringmx][sectmx]
Definition: HOCalibAnalyzer.cc:346
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
HOCalibAnalyzer::mncorrsgr
TH1F * mncorrsgr
Definition: HOCalibAnalyzer.cc:283
HOCalibAnalyzer::ped_rms
TH1F * ped_rms
Definition: HOCalibAnalyzer.cc:372
HOCalibAnalyzer::momatho
float momatho
Definition: HOCalibAnalyzer.cc:404
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
HOCalibAnalyzer::Nevents
int Nevents
Definition: HOCalibAnalyzer.cc:406
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
HOCalibAnalyzer::nevsigrsg
TH1F * nevsigrsg
Definition: HOCalibAnalyzer.cc:318
HOCalibAnalyzer::mncorrsgall
TH1F * mncorrsgall
Definition: HOCalibAnalyzer.cc:280
HOCalibAnalyzer::ilumi
int ilumi
Definition: HOCalibAnalyzer.cc:400
HOCalibAnalyzer::ringmx
static const int ringmx
Definition: HOCalibAnalyzer.cc:329
HOCalibAnalyzer::trkdr
float trkdr
Definition: HOCalibAnalyzer.cc:402
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HOCalibAnalyzer::corrsgr
TH1F * corrsgr[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:274
edm::Event
Definition: Event.h:73
HOCalibAnalyzer::hody
float hody
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::theoutputpsFile
std::string theoutputpsFile
Definition: HOCalibAnalyzer.cc:222
HOCalibAnalyzer::mnsigrsg
TH1F * mnsigrsg
Definition: HOCalibAnalyzer.cc:312
HOCalibAnalyzer::sel_muonth
TH1F * sel_muonth
Definition: HOCalibAnalyzer.cc:259
HOCalibAnalyzer::rout12mx
static const int rout12mx
Definition: HOCalibAnalyzer.cc:332
HOCalibAnalyzer::hosig
float hosig[9]
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::m_sigma
double m_sigma
Definition: HOCalibAnalyzer.cc:236
HOCalibAnalyzer::ho_energy2
TH2F * ho_energy2
Definition: HOCalibAnalyzer.cc:247
HOCalibAnalyzer::hbhe_sig
TH1F * hbhe_sig[9]
Definition: HOCalibAnalyzer.cc:327
custom_jme_cff.area
area
Definition: custom_jme_cff.py:140
HOCalibAnalyzer::crossg
TH1F * crossg[netamx][nphimx+1]
Definition: HOCalibAnalyzer.cc:309
edm::InputTag
Definition: InputTag.h:15
npixribt
static const int npixribt[21]
Definition: HOCalibAnalyzer.cc:93
HOCalibAnalyzer::mncorrsgc
TH1F * mncorrsgc
Definition: HOCalibAnalyzer.cc:304
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
HOCalibAnalyzer::muonmm
TH1F * muonmm
Definition: HOCalibAnalyzer.cc:252
HOCalibAnalyzer::tok_allho_
edm::EDGetTokenT< HORecHitCollection > tok_allho_
Definition: HOCalibAnalyzer.cc:415
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
HOCalibAnalyzer::T1
TTree * T1
Definition: HOCalibAnalyzer.cc:243
HOCalibAnalyzer::m_checkmap
bool m_checkmap
Definition: HOCalibAnalyzer.cc:228
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HOCalibAnalyzer::peak_eta
TH1F * peak_eta[netamx]
Definition: HOCalibAnalyzer.cc:380
HOCalibAnalyzer::hoang
float hoang
Definition: HOCalibAnalyzer.cc:402
HOCalibAnalyzer::endJob
void endJob() override
Definition: HOCalibAnalyzer.cc:1662
npixleup
static const int npixleup[21]
Definition: HOCalibAnalyzer.cc:94