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 = int((iphi + 1) / 3.) + 1;
1163  int tmproutmx = routmx;
1164  if (iring == 0) {
1165  tmprout = int((iphi + 1) / 2.) + 1;
1166  if (tmprout > routmx)
1167  tmprout = 1;
1168  } else {
1169  if (tmprout > rout12mx)
1170  tmprout = 1;
1171  tmproutmx = rout12mx;
1172  }
1173 
1174  // CRUZET1
1175  if (m_cosmic) {
1176  /* GMA temoparily change to increase event size at 3 & 9 O'clock position */
1177  if (abs(ndof) >= 20 && abs(ndof) < 40) {
1178  ips0 = (int)mypow_2_0;
1179  ipsall += ips0;
1180  }
1181  if (chisq > 0 && chisq < 15) {
1182  ips1 = (int)mypow_2_1;
1183  ipsall += ips1;
1184  } //18Jan2008
1185  if (fabs(trkth - pival / 2) < 21.5) {
1186  ips2 = (int)mypow_2_2;
1187  ipsall += ips2;
1188  } //No nead for pp evt
1189  if (fabs(trkph + pival / 2) < 21.5) {
1190  ips3 = (int)mypow_2_3;
1191  ipsall += ips3;
1192  } //No nead for pp evt
1193 
1194  if (therr < 0.02) {
1195  ips4 = (int)mypow_2_4;
1196  ipsall += ips4;
1197  }
1198  if (pherr < 0.0002) {
1199  ips5 = (int)mypow_2_5;
1200  ipsall += ips5;
1201  }
1202  if (fabs(hoang) > 0.30) {
1203  ips6 = (int)mypow_2_6;
1204  ipsall += ips6;
1205  }
1206  if (fabs(trkmm) > 0.100) {
1207  ips7 = (int)mypow_2_7;
1208  ipsall += ips7;
1209  }
1210  // if (nmuon ==1) {ips8 = (int)mypow_2_8; ipsall +=ips8;}
1211  if (nmuon >= 1 && nmuon <= 4) {
1212  ips8 = (int)mypow_2_8;
1213  ipsall += ips8;
1214  }
1215 
1216  if (iring2 == 2) {
1217  if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) {
1218  ips10 = (int)mypow_2_10;
1219  ipsall += ips10;
1220  }
1221 
1222  if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) {
1223  ips11 = (int)mypow_2_11;
1224  ipsall += ips11;
1225  }
1226 
1227  } else {
1228  if (fabs(hodx) < 100 && fabs(hodx) > 2) {
1229  ips10 = (int)mypow_2_10;
1230  ipsall += ips10;
1231  }
1232 
1233  if (fabs(hody) < 100 && fabs(hody) > 2) {
1234  ips11 = (int)mypow_2_11;
1235  ipsall += ips11;
1236  }
1237  }
1238  if (caloen[0] == 0) {
1239  ips12 = (int)mypow_2_12;
1240  ipsall += ips12;
1241  }
1242  } else {
1243  //csa08
1244  if (abs(ndof) >= 20 && abs(ndof) < 40) {
1245  ips0 = (int)mypow_2_0;
1246  ipsall += ips0;
1247  }
1248  if (chisq > 0 && chisq < 15) {
1249  ips1 = (int)mypow_2_1;
1250  ipsall += ips1;
1251  } //18Jan2008
1252  if (fabs(trkth - pival / 2) < 21.5) {
1253  ips2 = (int)mypow_2_2;
1254  ipsall += ips2;
1255  } //No nead for pp evt
1256  if (fabs(trkph + pival / 2) < 21.5) {
1257  ips3 = (int)mypow_2_3;
1258  ipsall += ips3;
1259  } //No nead for pp evt
1260 
1261  if (therr < 0.02) {
1262  ips4 = (int)mypow_2_4;
1263  ipsall += ips4;
1264  }
1265  if (pherr < 0.0002) {
1266  ips5 = (int)mypow_2_5;
1267  ipsall += ips5;
1268  }
1269  if (fabs(hoang) > 0.30) {
1270  ips6 = (int)mypow_2_6;
1271  ipsall += ips6;
1272  }
1273  if (fabs(trkmm) > 4.0) {
1274  ips7 = (int)mypow_2_7;
1275  ipsall += ips7;
1276  }
1277  if (nmuon >= 1 && nmuon <= 2) {
1278  ips8 = (int)mypow_2_8;
1279  ipsall += ips8;
1280  }
1281 
1282  if (iring2 == 2) {
1283  if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) {
1284  ips10 = (int)mypow_2_10;
1285  ipsall += ips10;
1286  }
1287 
1288  if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) {
1289  ips11 = (int)mypow_2_11;
1290  ipsall += ips11;
1291  }
1292 
1293  } else {
1294  if (fabs(hodx) < 100 && fabs(hodx) > 2) {
1295  ips10 = (int)mypow_2_10;
1296  ipsall += ips10;
1297  }
1298 
1299  if (fabs(hody) < 100 && fabs(hody) > 2) {
1300  ips11 = (int)mypow_2_11;
1301  ipsall += ips11;
1302  }
1303  }
1304  // if (m_cosmic || (caloen[0] >0.5 && caloen[0]<5.0)) {ips12=(int)pow_2_12;ipsall +=ips12;}
1305  if (ndof > 0 && caloen[0] < 5.0) {
1306  ips12 = (int)mypow_2_12;
1307  ipsall += ips12;
1308  }
1309  /* */
1310  }
1311 
1312  if (htime > -40 && htime < 60) {
1313  ips9 = (int)mypow_2_9;
1314  ipsall += ips9;
1315  }
1316 
1317  if (ipsall - ips0 == mypow_2_ncut - mypow_2_0 - 1)
1318  sigvsevt[iring2][0]->Fill(abs(ndof), hosig[4]);
1319  if (ipsall - ips1 == mypow_2_ncut - mypow_2_1 - 1)
1320  sigvsevt[iring2][1]->Fill(chisq, hosig[4]);
1321  if (ipsall - ips2 == mypow_2_ncut - mypow_2_2 - 1)
1322  sigvsevt[iring2][2]->Fill(trkth, hosig[4]);
1323  if (ipsall - ips3 == mypow_2_ncut - mypow_2_3 - 1)
1324  sigvsevt[iring2][3]->Fill(trkph, hosig[4]);
1325  if (ipsall - ips4 == mypow_2_ncut - mypow_2_4 - 1)
1326  sigvsevt[iring2][4]->Fill(therr, hosig[4]);
1327  if (ipsall - ips5 == mypow_2_ncut - mypow_2_5 - 1)
1328  sigvsevt[iring2][5]->Fill(pherr, hosig[4]);
1329  if (ipsall - ips6 == mypow_2_ncut - mypow_2_6 - 1)
1330  sigvsevt[iring2][6]->Fill(hoang, hosig[4]);
1331  if (ipsall - ips7 == mypow_2_ncut - mypow_2_7 - 1)
1332  sigvsevt[iring2][7]->Fill(fabs(trkmm), hosig[4]);
1333  if (ipsall - ips8 == mypow_2_ncut - mypow_2_8 - 1)
1334  sigvsevt[iring2][8]->Fill(nmuon, hosig[4]);
1335  if (ipsall - ips9 == mypow_2_ncut - mypow_2_9 - 1)
1336  sigvsevt[iring2][9]->Fill(htime, hosig[4]);
1337  if (ipsall - ips10 == mypow_2_ncut - mypow_2_10 - 1)
1338  sigvsevt[iring2][10]->Fill(hodx, hosig[4]);
1339  if (ipsall - ips11 == mypow_2_ncut - mypow_2_11 - 1)
1340  sigvsevt[iring2][11]->Fill(hody, hosig[4]);
1341  if (!m_cosmic) {
1342  if (ipsall - ips12 == mypow_2_ncut - mypow_2_12 - 1)
1343  sigvsevt[iring2][12]->Fill(caloen[0], hosig[4]);
1344  }
1345 
1346  sigvsevt[iring2 + 5][0]->Fill(abs(ndof), hosig[4]);
1347  if (ips0 > 0) {
1348  sigvsevt[iring2 + 5][1]->Fill(chisq, hosig[4]);
1349  if (ips1 > 0) {
1350  sigvsevt[iring2 + 5][2]->Fill(trkth, hosig[4]);
1351  if (ips2 > 0) {
1352  sigvsevt[iring2 + 5][3]->Fill(trkph, hosig[4]);
1353  if (ips3 > 0) {
1354  sigvsevt[iring2 + 5][4]->Fill(therr, hosig[4]);
1355  if (ips4 > 0) {
1356  sigvsevt[iring2 + 5][5]->Fill(pherr, hosig[4]);
1357  if (ips5 > 0) {
1358  sigvsevt[iring2 + 5][6]->Fill(hoang, hosig[4]);
1359  if (ips6 > 0) {
1360  sigvsevt[iring2 + 5][7]->Fill(fabs(trkmm), hosig[4]);
1361  if (ips7 > 0) {
1362  sigvsevt[iring2 + 5][8]->Fill(nmuon, hosig[4]);
1363  if (ips8 > 0) {
1364  sigvsevt[iring2 + 5][9]->Fill(htime, hosig[4]);
1365  if (ips9 > 0) {
1366  sigvsevt[iring2 + 5][10]->Fill(hodx, hosig[4]);
1367  if (ips10 > 0) {
1368  sigvsevt[iring2 + 5][11]->Fill(hody, hosig[4]);
1369  if (ips11 > 0) {
1370  if (!m_cosmic)
1371  sigvsevt[iring2 + 5][12]->Fill(caloen[0], hosig[4]);
1372  }
1373  }
1374  }
1375  }
1376  }
1377  }
1378  }
1379  }
1380  }
1381  }
1382  }
1383  }
1384 
1385  sigvsevt[iring2 + 10][0]->Fill(abs(ndof), hosig[4]);
1386  sigvsevt[iring2 + 10][1]->Fill(chisq, hosig[4]);
1387  sigvsevt[iring2 + 10][2]->Fill(trkth, hosig[4]);
1388  sigvsevt[iring2 + 10][3]->Fill(trkph, hosig[4]);
1389  sigvsevt[iring2 + 10][4]->Fill(therr, hosig[4]);
1390  sigvsevt[iring2 + 10][5]->Fill(pherr, hosig[4]);
1391  sigvsevt[iring2 + 10][6]->Fill(hoang, hosig[4]);
1392  sigvsevt[iring2 + 10][7]->Fill(fabs(trkmm), hosig[4]);
1393  sigvsevt[iring2 + 10][8]->Fill(nmuon, hosig[4]);
1394  sigvsevt[iring2 + 10][9]->Fill(htime, hosig[4]);
1395  sigvsevt[iring2 + 10][10]->Fill(hodx, hosig[4]);
1396  sigvsevt[iring2 + 10][11]->Fill(hody, hosig[4]);
1397  if (!m_cosmic)
1398  sigvsevt[iring2 + 10][12]->Fill(caloen[0], hosig[4]);
1399 
1400  int iselect = (ipsall == mypow_2_ncut - 1) ? 1 : 0;
1401 
1402  if (hocro != -100.0 && hocro < -50.0)
1403  hocro += 100.;
1404 
1405  muonnm->Fill(nmuon);
1406  muonmm->Fill(trkmm);
1407  muonth->Fill(trkth * 180 / pival);
1408  muonph->Fill(trkph * 180 / pival);
1409  muonch->Fill(chisq);
1410 
1411  if (iselect == 1) {
1412  ipass++;
1413  sel_muonnm->Fill(nmuon);
1414  sel_muonmm->Fill(trkmm);
1415  sel_muonth->Fill(trkth * 180 / pival);
1416  sel_muonph->Fill(trkph * 180 / pival);
1417  sel_muonch->Fill(chisq);
1418  }
1419 
1420  // if (iselect3) T1->Fill();
1421 
1422  int tmpphi = (iphi + 1) % 3; //pixel mapping
1423  int npixel = 0;
1424  int itag = -1;
1425  int iflip = 0;
1426  int fact = 2;
1427 
1428  if (iring == 0) {
1429  tmpphi = (iphi + 1) % 2;
1430  if (tmpsect == 2 || tmpsect == 3 || tmpsect == 6 || tmpsect == 7 || tmpsect == 10 || tmpsect == 11) {
1431  npixel = mapx0p[tmpeta][tmpphi];
1432  itag = 2;
1433  } else {
1434  npixel = mapx0m[tmpeta][tmpphi];
1435  itag = 3;
1436  }
1437  } else {
1438  fact = 3;
1439  if (tmpsect % 2 == 1)
1440  iflip = 1;
1441  if (abs(iring) == 1) {
1442  npixel = mapx1[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)];
1443  itag = 1;
1444  } else {
1445  npixel = mapx2[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)];
1446  itag = 0;
1447  }
1448  }
1449 
1450  int tmpeta1 = (ieta > 0) ? ieta - 1 : -ieta + 14;
1451 
1452  //Histogram filling for noise study: phi shift according to DTChamberAnalysis
1453  int tmpphi1 = iphi - 1; //(iphi+6 <=nphimx) ? iphi+5 : iphi+5-nphimx;
1454 
1455  int iselect2 = 0;
1456  if (hosig[4] != -100) {
1457  if (m_cosmic) {
1458  if (caloen[2] <= 0.0)
1459  iselect2 = 1;
1460  } else {
1461  if (caloen[2] <= 3.0)
1462  iselect2 = 1;
1463  }
1464  }
1465 
1466  // edm::LogInfo("HOCalib") <<"cosmic "<<hosig[4]<<" "<<caloen[3]<<" "<<int(iselect2)<<" "<<int(m_cosmic);
1467 
1468  if (iselect2 == 1) {
1469  int tmpphi2 = iphi - 1;
1470  tmpphi2 = (iphi + 6 <= nphimx) ? iphi + 5 : iphi + 5 - nphimx;
1471 
1472  int tmpsect2 = int((tmpphi2 + 2) / 6.) + 1;
1473  if (tmpsect2 > 12)
1474  tmpsect2 = 1;
1475 
1476  int tmprout2 = int((tmpphi2 + 2) / 3.) + 1;
1477  if (iring == 0) {
1478  tmprout2 = int((tmpphi2 + 2) / 2.) + 1;
1479  if (tmprout2 > routmx)
1480  tmprout2 = 1;
1481  } else {
1482  if (tmprout2 > rout12mx)
1483  tmprout2 = 1;
1484  }
1485 
1486  if (cro_ssg[tmpeta1][tmpphi2].size() < 4000) {
1487  if (hocro > alow && hocro < ahigh) {
1488  if (!m_histfit)
1489  cro_ssg[tmpeta1][tmpphi2].push_back(hocro);
1490  crossg[tmpeta1][tmpphi2]->Fill(hocro);
1491  }
1492  }
1493 
1494  if (tmpphi2 >= 0 && tmpphi2 < nphimx) {
1495  crossg[tmpeta1][nphimx]->Fill(hocro);
1496  }
1497  if (m_combined) {
1498  com_crossg[iring2][tmprout2 - 1]->Fill(hocro);
1499  com_crossg[iring2][tmproutmx]->Fill(hocro);
1500  }
1501  }
1502 
1503  if (iselect == 1) {
1504  for (int ij = 0; ij < neffip; ij++) {
1505  if (ij == 0) {
1506  sig_effi[ij]->Fill(ieta, iphi, 1.);
1507  } else {
1508  if (hosig[4] > ij * m_sigma) {
1509  sig_effi[ij]->Fill(ieta, iphi, 1.);
1510  }
1511  }
1512  }
1513 
1514  tmpphi1 = iphi - 1;
1515 
1516  if (sig_reg[tmpeta1][tmpphi1].size() < 4000) {
1517  if (hosig[4] > -50 && hosig[4] < 15) {
1518  sigrsg[tmpeta1][tmpphi1]->Fill(hosig[4]);
1519  if (!m_histfit && hosig[4] <= ahigh / 2.)
1520  sig_reg[tmpeta1][tmpphi1].push_back(hosig[4]);
1521  invang[tmpeta1][tmpphi1] += 1. / fabs(hoang);
1522  }
1523  }
1524 
1525  if (tmpphi1 >= 0 && tmpphi1 < nphimx) { //GREN
1526  sigrsg[tmpeta1][nphimx]->Fill(hosig[4]);
1527  invang[tmpeta1][nphimx] += 1. / fabs(hoang);
1528  }
1529 
1530  if (m_combined) { //#ifdef COMBINED
1531  com_sigrsg[iring2][tmprout - 1]->Fill(hosig[4]);
1532  com_invang[iring2][tmprout - 1] += 1. / fabs(hoang);
1533 
1534  com_sigrsg[iring2][tmproutmx]->Fill(hosig[4]);
1535  com_invang[iring2][tmproutmx] += 1. / fabs(hoang);
1536  } //m_combined #endif
1537 
1538  if (m_checkmap || m_correl) { //#ifdef CHECKMAP
1539  tmpeta = etamap[itag][npixel];
1540  tmpphi = phimap[itag][npixel];
1541  if (tmpeta >= 0 && tmpphi >= 0) {
1542  if (iflip != 0)
1543  tmpphi = abs(tmpphi - 2);
1544  if (int((hocorsig[fact * tmpeta + tmpphi] - hosig[4]) * 10000) / 10000. != 0) {
1545  iaxxx++;
1546  edm::LogInfo("HOCalib") << "iring2xxx " << irun << " " << ievt << " " << isect << " " << iring << " "
1547  << tmpsect << " " << ieta << " " << iphi << " " << npixel << " " << tmpeta << " "
1548  << tmpphi << " " << tmpeta1 << " " << tmpphi1 << " itag " << itag << " " << iflip
1549  << " " << fact << " " << hocorsig[fact * tmpeta + tmpphi] << " "
1550  << fact * tmpeta + tmpphi << " " << hosig[4] << " " << hodx << " " << hody;
1551 
1552  for (int ij = 0; ij < 18; ij++) {
1553  edm::LogInfo("HOCalib") << " " << ij << " " << hocorsig[ij];
1554  }
1555  edm::LogInfo("HOCalib") << " ix " << iaxxx << " " << ibxxx;
1556  } else {
1557  ibxxx++;
1558  }
1559 
1560  corrsgc[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1561  if (m_combined) { //#ifdef COMBINED
1562  com_corrsgc[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1563  } //m_combined #endif
1564  }
1565  } //m_checkmap #endif
1566 
1567  if (m_correl) { //#ifdef CORREL
1568  float allcorsig = 0.0;
1569 
1570  tmpeta = etamap[itag][npixleft[npixel]];
1571  tmpphi = phimap[itag][npixleft[npixel]];
1572 
1573  if (tmpeta >= 0 && tmpphi >= 0) {
1574  if (iflip != 0)
1575  tmpphi = abs(tmpphi - 2);
1576  corrsgl[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1577  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1578  if (m_combined) { //#ifdef COMBINED
1579  com_corrsgl[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1580  } //m_combined #endif
1581  }
1582 
1583  tmpeta = etamap[itag][npixrigh[npixel]];
1584  tmpphi = phimap[itag][npixrigh[npixel]];
1585  if (tmpeta >= 0 && tmpphi >= 0) {
1586  if (iflip != 0)
1587  tmpphi = abs(tmpphi - 2);
1588  corrsgr[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1589  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1590  if (m_combined) { // #ifdef COMBINED
1591  com_corrsgr[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1592  } //m_combined #endif
1593  }
1594 
1595  tmpeta = etamap[itag][npixlebt[npixel]];
1596  tmpphi = phimap[itag][npixlebt[npixel]];
1597  if (tmpeta >= 0 && tmpphi >= 0) {
1598  if (iflip != 0)
1599  tmpphi = abs(tmpphi - 2);
1600  corrsglb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1601  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1602  if (m_combined) { //#ifdef COMBINED
1603  com_corrsglb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1604  } //m_combined #endif
1605  }
1606 
1607  tmpeta = etamap[itag][npixribt[npixel]];
1608  tmpphi = phimap[itag][npixribt[npixel]];
1609  if (tmpeta >= 0 && tmpphi >= 0) {
1610  if (iflip != 0)
1611  tmpphi = abs(tmpphi - 2);
1612  corrsgrb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1613  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1614  if (m_combined) { // #ifdef COMBINED
1615  com_corrsgrb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1616  } //m_combined #endif
1617  }
1618 
1619  tmpeta = etamap[itag][npixleup[npixel]];
1620  tmpphi = phimap[itag][npixleup[npixel]];
1621  if (tmpeta >= 0 && tmpphi >= 0) {
1622  if (iflip != 0)
1623  tmpphi = abs(tmpphi - 2);
1624  corrsglu[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1625  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1626  if (m_combined) { // #ifdef COMBINED
1627  com_corrsglu[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1628  } //m_combined #endif
1629  }
1630 
1631  tmpeta = etamap[itag][npixriup[npixel]];
1632  tmpphi = phimap[itag][npixriup[npixel]];
1633  if (tmpeta >= 0 && tmpphi >= 0) {
1634  if (iflip != 0)
1635  tmpphi = abs(tmpphi - 2);
1636  corrsgru[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1637  allcorsig += hocorsig[fact * tmpeta + tmpphi];
1638  if (m_combined) { // #ifdef COMBINED
1639  com_corrsgru[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]);
1640  } //m_combined #endif
1641  }
1642  corrsgall[tmpeta1][tmpphi1]->Fill(allcorsig);
1643  if (m_combined) { // #ifdef COMBINED
1644  com_corrsgall[iring2][tmpsect - 1]->Fill(allcorsig);
1645  } //m_combined #endif
1646 
1647  } //m_correl #endif
1648  for (int k = 0; k < 9; k++) {
1649  switch (iring) {
1650  case 2:
1651  ho_sig2p[k]->Fill(hosig[k]);
1652  break;
1653  case 1:
1654  ho_sig1p[k]->Fill(hosig[k]);
1655  break;
1656  case 0:
1657  ho_sig00[k]->Fill(hosig[k]);
1658  break;
1659  case -1:
1660  ho_sig1m[k]->Fill(hosig[k]);
1661  break;
1662  case -2:
1663  ho_sig2m[k]->Fill(hosig[k]);
1664  break;
1665  }
1666  if (m_hbinfo) { // #ifdef HBINFO
1667  hbhe_sig[k]->Fill(hbhesig[k]);
1668  // edm::LogInfo("HOCalib") <<"hbhe "<<k<<" "<<hbhesig[k];
1669  } //m_hbinfo #endif
1670  }
1671  } //if (iselect==1)
1672 
1673  } //for (HOCalibVariableCollection::const_iterator hoC=(*HOCalib).begin(); hoC!=(*HOCalib).end(); hoC++){
1674 
1675  } //if (isCosMu)
1676 }
1677 
1678 // ------------ method called once each job just before starting event loop ------------
1680 
1681 // ------------ method called once each job just after ending the event loop ------------
1683  theFile->cd();
1684 
1685  if (m_allHOsignal) {
1686  for (int jk = 0; jk < ho_energy->GetNbinsX(); jk++) {
1687  for (int kl = 0; kl < ho_energy->GetNbinsY(); kl++) {
1688  double entry = ho_entry->GetBinContent(jk + 1, kl + 1);
1689  if (entry < 1.)
1690  entry = 1.;
1691 
1692  double energy = ho_energy->GetBinContent(jk + 1, kl + 1) / entry;
1693  double energy2 = ho_energy2->GetBinContent(jk + 1, kl + 1) / entry;
1694  double rms = sqrt(energy2 - energy * energy);
1695 
1696  double xval = ho_energy->GetXaxis()->GetBinCenter(jk + 1);
1697  double yval = ho_energy->GetYaxis()->GetBinCenter(kl + 1);
1698 
1699  ho_rms->Fill(xval, yval, rms);
1700  }
1701  }
1702  }
1703 
1704  for (int ij = 0; ij < nphimx; ij++) {
1705  for (int jk = 0; jk < netamx; jk++) {
1706  nevsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetEntries());
1707  mnsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetMean());
1708  rmssigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetRMS());
1709 
1710  nevcrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetEntries());
1711  mncrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetMean());
1712  rmscrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetRMS());
1713 
1714  if (m_correl) { //#ifdef CORREL
1715 
1716  nevcorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetEntries());
1717  mncorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetMean());
1718  rmscorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetRMS());
1719 
1720  nevcorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetEntries());
1721  mncorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetMean());
1722  rmscorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetRMS());
1723 
1724  nevcorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetEntries());
1725  mncorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetMean());
1726  rmscorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetRMS());
1727 
1728  nevcorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetEntries());
1729  mncorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetMean());
1730  rmscorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetRMS());
1731 
1732  nevcorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetEntries());
1733  mncorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetMean());
1734  rmscorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetRMS());
1735 
1736  nevcorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetEntries());
1737  mncorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetMean());
1738  rmscorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetRMS());
1739 
1740  nevcorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetEntries());
1741  mncorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetMean());
1742  rmscorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetRMS());
1743  } //m_correl #endif
1744  if (m_checkmap) { //#ifdef CHECKMAP
1745  nevcorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetEntries());
1746  mncorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetMean());
1747  rmscorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetRMS());
1748  } //m_checkmap #endif
1749  }
1750  }
1751 
1752  if (m_combined) { // #ifdef COMBINED
1753  for (int jk = 0; jk < ringmx; jk++) {
1754  for (int ij = 0; ij < routmx; ij++) {
1755  if (jk != 2 && ij >= rout12mx)
1756  continue;
1757  nevsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetEntries());
1758  mnsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetMean());
1759  rmssigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetRMS());
1760 
1761  nevcrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetEntries());
1762  mncrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetMean());
1763  rmscrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetRMS());
1764  }
1765  }
1766 
1767  for (int ij = 0; ij < sectmx; ij++) {
1768  for (int jk = 0; jk < ringmx; jk++) {
1769  if (m_correl) { // #ifdef CORREL
1770  nevcorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetEntries());
1771  mncorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetMean());
1772  rmscorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetRMS());
1773 
1774  nevcorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetEntries());
1775  mncorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetMean());
1776  rmscorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetRMS());
1777 
1778  nevcorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetEntries());
1779  mncorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetMean());
1780  rmscorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetRMS());
1781 
1782  nevcorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetEntries());
1783  mncorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetMean());
1784  rmscorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetRMS());
1785 
1786  nevcorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetEntries());
1787  mncorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetMean());
1788  rmscorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetRMS());
1789 
1790  nevcorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetEntries());
1791  mncorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetMean());
1792  rmscorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetRMS());
1793 
1794  nevcorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetEntries());
1795  mncorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetMean());
1796  rmscorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetRMS());
1797  } //m_correl #endif
1798  if (m_checkmap) { // #ifdef CHECKMAP
1799  nevcorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetEntries());
1800  mncorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetMean());
1801  rmscorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetRMS());
1802  } //m_checkmap #endif
1803  }
1804  }
1805  } //m_combined #endif
1806 
1807  for (int ij = 1; ij < neffip; ij++) {
1808  sig_effi[ij]->Divide(sig_effi[0]);
1809  }
1810  for (int ij = 0; ij < netamx; ij++) {
1811  for (int jk = 0; jk < nphimx; jk++) {
1812  int ieta = (ij < 15) ? ij + 1 : 14 - ij;
1813  int iphi = jk + 1;
1814  double signal = sigrsg[ij][jk]->GetMean();
1815  mean_energy->Fill(ieta, iphi, signal);
1816  }
1817  }
1818 
1819  int irunold = irun;
1820 
1821  gStyle->SetOptLogy(0);
1822  gStyle->SetTitleFillColor(10);
1823  gStyle->SetStatColor(10);
1824 
1825  gStyle->SetCanvasColor(10);
1826  gStyle->SetOptStat(0); //1110);
1827  gStyle->SetOptTitle(1);
1828 
1829  gStyle->SetTitleColor(10);
1830  gStyle->SetTitleFontSize(0.09);
1831  gStyle->SetTitleOffset(-0.05);
1832  gStyle->SetTitleBorderSize(1);
1833 
1834  gStyle->SetPadColor(10);
1835  gStyle->SetPadBorderMode(0);
1836  gStyle->SetStatColor(10);
1837  gStyle->SetPadBorderMode(0);
1838  gStyle->SetStatBorderSize(1);
1839  gStyle->SetStatFontSize(.07);
1840 
1841  gStyle->SetStatStyle(1001);
1842  gStyle->SetOptFit(101);
1843  gStyle->SetCanvasColor(10);
1844  gStyle->SetCanvasBorderMode(0);
1845 
1846  gStyle->SetStatX(.99);
1847  gStyle->SetStatY(.99);
1848  gStyle->SetStatW(.45);
1849  gStyle->SetStatH(.16);
1850  gStyle->SetLabelSize(0.075, "XY");
1851  gStyle->SetLabelOffset(0.21, "XYZ");
1852  gStyle->SetTitleSize(0.065, "XY");
1853  gStyle->SetTitleOffset(0.06, "XYZ");
1854  gStyle->SetPadTopMargin(.09);
1855  gStyle->SetPadBottomMargin(0.11);
1856  gStyle->SetPadLeftMargin(0.12);
1857  gStyle->SetPadRightMargin(0.15);
1858  gStyle->SetPadGridX(true);
1859  gStyle->SetPadGridY(true);
1860  gStyle->SetGridStyle(2);
1861  gStyle->SetNdivisions(303, "XY");
1862 
1863  gStyle->SetMarkerSize(0.60);
1864  gStyle->SetMarkerColor(2);
1865  gStyle->SetMarkerStyle(20);
1866  gStyle->SetTitleFontSize(0.07);
1867 
1868  char out_file[200];
1869  int xsiz = 700;
1870  int ysiz = 500;
1871 
1872  // TCanvas *c2 = new TCanvas("c2", "Statistics and efficiency", xsiz, ysiz);
1873  // c2->Divide(2,1); //(3,2);
1874  // for (int ij=0; ij<neffip; ij=ij+3) {
1875  // sig_effi[ij]->GetXaxis()->SetTitle("#eta");
1876  // sig_effi[ij]->GetXaxis()->SetTitleSize(0.075);
1877  // sig_effi[ij]->GetXaxis()->SetTitleOffset(0.65); //0.85
1878  // sig_effi[ij]->GetXaxis()->CenterTitle();
1879  // sig_effi[ij]->GetXaxis()->SetLabelSize(0.055);
1880  // sig_effi[ij]->GetXaxis()->SetLabelOffset(0.001);
1881 
1882  // sig_effi[ij]->GetYaxis()->SetTitle("#phi");
1883  // sig_effi[ij]->GetYaxis()->SetTitleSize(0.075);
1884  // sig_effi[ij]->GetYaxis()->SetTitleOffset(0.9);
1885  // sig_effi[ij]->GetYaxis()->CenterTitle();
1886  // sig_effi[ij]->GetYaxis()->SetLabelSize(0.055);
1887  // sig_effi[ij]->GetYaxis()->SetLabelOffset(0.01);
1888 
1889  // c2->cd(int(ij/3.)+1); sig_effi[ij]->Draw("colz");
1890  // }
1891  // sprintf(out_file, "comb_hosig_evt_%i.jpg",irunold);
1892  // c2->SaveAs(out_file);
1893 
1894  // gStyle->SetTitleFontSize(0.045);
1895  // gStyle->SetPadRightMargin(0.1);
1896  // gStyle->SetPadLeftMargin(0.1);
1897  // gStyle->SetPadBottomMargin(0.12);
1898 
1899  // TCanvas *c1 = new TCanvas("c1", "Mean signal in each tower", xsiz, ysiz);
1900 
1901  // mean_energy->GetXaxis()->SetTitle("#eta");
1902  // mean_energy->GetXaxis()->SetTitleSize(0.075);
1903  // mean_energy->GetXaxis()->SetTitleOffset(0.65); //0.6
1904  // mean_energy->GetXaxis()->CenterTitle();
1905  // mean_energy->GetXaxis()->SetLabelSize(0.045);
1906  // mean_energy->GetXaxis()->SetLabelOffset(0.001);
1907 
1908  // mean_energy->GetYaxis()->SetTitle("#phi");
1909  // mean_energy->GetYaxis()->SetTitleSize(0.075);
1910  // mean_energy->GetYaxis()->SetTitleOffset(0.5);
1911  // mean_energy->GetYaxis()->CenterTitle();
1912  // mean_energy->GetYaxis()->SetLabelSize(0.045);
1913  // mean_energy->GetYaxis()->SetLabelOffset(0.01);
1914 
1915  // mean_energy->Draw("colz");
1916  // sprintf(out_file, "homean_energy_%i.jpg",irunold);
1917  // c1->SaveAs(out_file);
1918 
1919  // delete c1;
1920  // delete c2;
1921 
1922  gStyle->SetPadBottomMargin(0.14);
1923  gStyle->SetPadLeftMargin(0.17);
1924  gStyle->SetPadRightMargin(0.03);
1925 
1926  gStyle->SetOptStat(1110);
1927 
1928  const int nsample = 8;
1929  TF1* gx0[nsample] = {nullptr};
1930  TF1* ped0fun[nsample] = {nullptr};
1931  TF1* signal[nsample] = {nullptr};
1932  TF1* pedfun[nsample] = {nullptr};
1933  TF1* sigfun[nsample] = {nullptr};
1934  TF1* signalx[nsample] = {nullptr};
1935 
1936  TH1F* signall[nsample] = {nullptr};
1937  TH1F* pedstll[nsample] = {nullptr};
1938 
1939  if (m_constant) {
1940  gStyle->SetOptFit(101);
1941  gStyle->SetCanvasBorderMode(0);
1942  gStyle->SetPadBorderMode(0);
1943  gStyle->SetStatBorderSize(1);
1944  gStyle->SetStatStyle(1001);
1945  gStyle->SetTitleColor(10);
1946  gStyle->SetTitleFontSize(0.09);
1947  gStyle->SetTitleOffset(-0.05);
1948  gStyle->SetTitleBorderSize(1);
1949 
1950  gStyle->SetCanvasColor(10);
1951  gStyle->SetPadColor(10);
1952  gStyle->SetStatColor(10);
1953  gStyle->SetStatFontSize(.07);
1954  gStyle->SetStatX(0.99);
1955  gStyle->SetStatY(0.99);
1956  gStyle->SetStatW(0.30);
1957  gStyle->SetStatH(0.10);
1958  gStyle->SetTitleSize(0.065, "XYZ");
1959  gStyle->SetLabelSize(0.075, "XYZ");
1960  gStyle->SetLabelOffset(0.012, "XYZ");
1961  gStyle->SetPadGridX(true);
1962  gStyle->SetPadGridY(true);
1963  gStyle->SetGridStyle(3);
1964  gStyle->SetNdivisions(101, "XY");
1965  gStyle->SetOptLogy(0);
1966  int iiter = 0;
1967 
1968  std::ofstream file_out(theoutputtxtFile.c_str());
1969  // TPostScript* ps=0;
1970  int ips = 111;
1971  TPostScript ps(theoutputpsFile.c_str(), ips);
1972  ps.Range(20, 28);
1973 
1974  xsiz = 900; //900;
1975  ysiz = 1200; //600;
1976  TCanvas* c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz);
1977 
1978  // Fix is done for eta-phi
1979 
1980  float mean_eta[netamx];
1981  float mean_phi[nphimx];
1982  float rms_eta[netamx];
1983  float rms_phi[nphimx];
1984 
1985  for (int ij = 0; ij < nphimx; ++ij) {
1986  mean_phi[ij] = 0;
1987  rms_phi[ij] = 0;
1988  }
1989  for (int ij = 0; ij < netamx; ++ij) {
1990  mean_eta[ij] = 0;
1991  rms_eta[ij] = 0;
1992  }
1993 
1994  int mxeta = 0;
1995  int mxphi = 0;
1996  int mneta = 0;
1997  int mnphi = 0;
1998 
1999  //iijj = 0 : Merging all ring
2000  // = 1 : Individual HPD
2001  //iijj = 2 : merging all phi
2002  // = 3 : Individual tower
2003 
2004  for (int iijj = 0; iijj < 4; iijj++) {
2005  // if ((!mx_combined) && iijj==1) continue; //Use this only for combined data
2006  if (iijj == 0) {
2007  mxeta = ringmx;
2008  mxphi = 1;
2009  mneta = 0;
2010  mnphi = 0;
2011  } else if (iijj == 1) {
2012  mxeta = ringmx;
2013  mxphi = routmx;
2014  mneta = 0;
2015  mnphi = 0;
2016  } else if (iijj == 2) {
2017  mxeta = netamx;
2018  mxphi = 1;
2019  mneta = 0;
2020  mnphi = 0;
2021  } else if (iijj == 3) {
2022  mxeta = netamx;
2023  mxphi = nphimx;
2024  mneta = 0;
2025  mnphi = 0;
2026  }
2027 
2028  for (int jk = mneta; jk < mxeta; jk++) {
2029  for (int ij = mnphi; ij < mxphi; ij++) {
2030  if (iijj == 1)
2031  continue;
2032  if ((iijj == 0 || iijj == 1) && jk != 2 && ij >= rout12mx)
2033  continue;
2034  int izone = iiter % nsample;
2035 
2036  if (iijj == 0) {
2037  int iread = (jk == 2) ? routmx : rout12mx;
2038  signall[izone] = (TH1F*)com_sigrsg[jk][iread]->Clone("hnew");
2039  pedstll[izone] = (TH1F*)com_crossg[jk][iread]->Clone("hnew");
2040  } else if (iijj == 1) {
2041  signall[izone] = (TH1F*)com_sigrsg[jk][ij]->Clone("hnew");
2042  pedstll[izone] = (TH1F*)com_crossg[jk][ij]->Clone("hnew");
2043  } else if (iijj == 2) {
2044  signall[izone] = (TH1F*)sigrsg[jk][nphimx]->Clone("hnew");
2045  pedstll[izone] = (TH1F*)crossg[jk][nphimx]->Clone("hnew");
2046  } else if (iijj == 3) {
2047  signall[izone] = (TH1F*)sigrsg[jk][ij]->Clone("hnew");
2048  pedstll[izone] = (TH1F*)crossg[jk][ij]->Clone("hnew");
2049  }
2050 
2051  pedstll[izone]->SetLineWidth(2);
2052  signall[izone]->SetLineWidth(2);
2053  pedstll[izone]->SetLineColor(2);
2054  signall[izone]->SetLineColor(4);
2055  pedstll[izone]->SetNdivisions(506, "XY");
2056  signall[izone]->SetNdivisions(506, "XY");
2057 
2058  signall[izone]->GetXaxis()->SetLabelSize(.065);
2059  signall[izone]->GetYaxis()->SetLabelSize(.06);
2060  signall[izone]->GetXaxis()->SetTitle("Signal (GeV)");
2061 
2062  signall[izone]->GetXaxis()->SetTitleSize(.065);
2063  signall[izone]->GetXaxis()->CenterTitle();
2064 
2065  if (izone == 0) { //iiter%8 ==0) {
2066  ps.NewPage();
2067  c0->Divide(4, 4); //c0->Divide(2,4); // c0->Divide(1,2);
2068  }
2069  c0->cd(2 * izone + 1); // (iiter%8)+1); //c0->cd(iiter%8+1);
2070 
2071  /*
2072  if (iijj==0 && izone==0) {
2073  gStyle->SetOptLogy(1);
2074  gStyle->SetOptStat(0);
2075  gStyle->SetOptFit(0);
2076  c0->Divide(3,2);
2077  }
2078 
2079  if (iijj>0) {
2080  gStyle->SetOptLogy(0);
2081  gStyle->SetOptStat(1110);
2082  gStyle->SetOptFit(101);
2083 
2084  if (iiter==0) {
2085  int ips=111;
2086  ps = new TPostScript(theoutputpsFile.c_str(),ips);
2087  ps.Range(20,28);
2088  xsiz = 900; //900;
2089  ysiz = 1200; //600;
2090  c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz);
2091  }
2092  if (izone==0) {
2093  ps.NewPage();
2094  c0->Divide(4,4);
2095  }
2096  }
2097  if (iijj==0) {c0->cd(izone+1); } else { c0->cd(2*izone+1);}
2098  */
2099 
2100  float mean = pedstll[izone]->GetMean();
2101  float rms = pedstll[izone]->GetRMS();
2102 
2103  if (rms < 0.10)
2104  rms = 0.10;
2105  if (rms > 0.15)
2106  rms = 0.15;
2107  if (mean > 0.20)
2108  mean = 0.20;
2109  if (mean < -0.20)
2110  mean = -0.20;
2111 
2112  float xmn = mean - 6. * rms;
2113  float xmx = mean + 6. * rms;
2114 
2115  binwid = pedstll[izone]->GetBinWidth(1);
2116  if (xmx > pedstll[izone]->GetXaxis()->GetXmax())
2117  xmx = pedstll[izone]->GetXaxis()->GetXmax() - 0.5 * binwid;
2118  if (xmn < pedstll[izone]->GetXaxis()->GetXmin())
2119  xmn = pedstll[izone]->GetXaxis()->GetXmin() + 0.5 * binwid;
2120 
2121  float height = pedstll[izone]->GetEntries();
2122 
2123  double par[nbgpr] = {height, mean, 0.75 * rms};
2124 
2125  double gaupr[nbgpr];
2126  double parer[nbgpr];
2127 
2128  ietafit = jk;
2129  iphifit = ij;
2130  pedstll[izone]->GetXaxis()->SetLabelSize(.065);
2131  pedstll[izone]->GetYaxis()->SetLabelSize(.06);
2132 
2133  // if (iijj==0) {
2134  // pedstll[izone]->GetXaxis()->SetRangeUser(alow, ahigh);
2135  // } else {
2136  pedstll[izone]->GetXaxis()->SetRangeUser(xmn, xmx);
2137  // }
2138 
2139  if (iijj == 0) {
2140  pedstll[izone]->GetXaxis()->SetTitle("Pedestal/Signal (GeV)");
2141  } else {
2142  pedstll[izone]->GetXaxis()->SetTitle("Pedestal (GeV)");
2143  }
2144  pedstll[izone]->GetXaxis()->SetTitleSize(.065);
2145  pedstll[izone]->GetXaxis()->CenterTitle();
2146  // pedstll[izone]->SetLineWidth(2);
2147 
2148  pedstll[izone]->Draw();
2149  if (m_pedsuppr) {
2150  gaupr[0] = 0;
2151  gaupr[1] = 0.0; // pedmean[ietafit][iphifit];
2152  gaupr[2] = 0.15; //GMA need from database
2153  parer[0] = parer[1] = parer[2] = 0;
2154  } else {
2155  if (pedstll[izone]->GetEntries() > 5) {
2156  if ((iijj != 3) || m_histfit) {
2157  char temp[20];
2158  sprintf(temp, "gx0_%i", izone);
2159  gx0[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
2160  gx0[izone]->SetParameters(par);
2161  gx0[izone]->SetLineWidth(1);
2162  pedstll[izone]->Fit(gx0[izone], "R+");
2163 
2164  for (int k = 0; k < nbgpr; k++) {
2165  parer[k] = gx0[izone]->GetParError(k);
2166  gaupr[k] = gx0[izone]->GetParameter(k);
2167  }
2168  } else {
2169  double strt[nbgpr] = {height, mean, 0.75 * rms};
2170  double step[nbgpr] = {1.0, 0.001, 0.001};
2171  double alowmn[nbgpr] = {0.5 * height, mean - rms, 0.3 * rms};
2172  double ahighmn[nbgpr] = {1.5 * height, mean + rms, 1.5 * rms};
2173 
2174  TMinuit* gMinuit = new TMinuit(nbgpr);
2175  gMinuit->SetFCN(fcnbg);
2176 
2177  double arglist[10];
2178  int ierflg = 0;
2179  arglist[0] = 0.5;
2180  gMinuit->mnexcm("SET ERR", arglist, 1, ierflg);
2181  char name[100];
2182  for (int k = 0; k < nbgpr; k++) {
2183  sprintf(name, "pedpar%i", k);
2184  gMinuit->mnparm(k, name, strt[k], step[k], alowmn[k], ahighmn[k], ierflg);
2185  }
2186 
2187  arglist[0] = 0;
2188  gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg);
2189 
2190  arglist[0] = 0;
2191  gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg);
2192 
2193  TString chnam;
2194  double parv, err, xlo, xup, plerr, mierr, eparab, gcc;
2195  int iuit;
2196 
2197  for (int k = 0; k < nbgpr; k++) {
2198  if (step[k] > -10) {
2199  gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit);
2200  gMinuit->mnerrs(k, plerr, mierr, eparab, gcc);
2201  // edm::LogInfo("HOCalib") <<"k "<< k<<" "<<chnam<<" "<<parv<<" "<<err<<" "<<xlo<<" "<<xup<<" "<<plerr<<" "<<mierr<<" "<<eparab;
2202  if (k == 0) {
2203  gaupr[k] = parv * binwid;
2204  parer[k] = err * binwid;
2205  } else {
2206  gaupr[k] = parv;
2207  parer[k] = err;
2208  }
2209  }
2210  }
2211 
2212  // gx0[izone]->SetParameters(gaupr);
2213 
2214  char temp[20];
2215  sprintf(temp, "ped0fun_%i", izone);
2216  ped0fun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
2217  ped0fun[izone]->SetParameters(gaupr);
2218  ped0fun[izone]->SetLineColor(3);
2219  ped0fun[izone]->SetLineWidth(1);
2220  ped0fun[izone]->Draw("same");
2221 
2222  delete gMinuit;
2223  }
2224  } else {
2225  for (int k = 0; k < nbgpr; k++) {
2226  gaupr[k] = par[k];
2227  }
2228  gaupr[2] = 0.15;
2229  }
2230  }
2231  // if (iijj!=0)
2232  c0->cd(2 * izone + 2);
2233  if (signall[izone]->GetEntries() > 5) {
2234  Double_t parall[nsgpr];
2235  double parserr[nsgpr];
2236  double fitres[nsgpr];
2237  double pedht = 0;
2238 
2239  char temp[20];
2240  sprintf(temp, "signal_%i", izone);
2241  xmn = signall[izone]->GetXaxis()->GetXmin();
2242  xmx = 0.5 * signall[izone]->GetXaxis()->GetXmax();
2243  signal[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr);
2244  xmx *= 2.0;
2245  if ((iijj != 3) || m_histfit) {
2246  pedht = (signall[izone]->GetBinContent(nbn - 1) + signall[izone]->GetBinContent(nbn) +
2247  signall[izone]->GetBinContent(nbn + 1)) /
2248  3.;
2249 
2250  if (m_pedsuppr) {
2251  parall[1] = 0.0; // pedmean[ietafit][iphifit];
2252  parall[2] = 0.15;
2253  } else {
2254  for (int lm = 0; lm < nbgpr; lm++) {
2255  parall[lm] = gaupr[lm];
2256  }
2257  }
2258 
2259  set_mean(parall[1], false);
2260  set_sigma(parall[2], false);
2261 
2262  parall[0] = 0.9 * pedht; //GM for Z-mumu, there is almost no pedestal
2263  parall[3] = 0.14;
2264  double area = binwid * signall[izone]->GetEntries();
2265  parall[5] = area;
2266 
2267  if (iijj == 3) {
2268  parall[4] = fitprm[4][jk];
2269  parall[6] = fitprm[6][jk];
2270  } else {
2271  parall[4] = signall[izone]->GetMean();
2272  parall[6] = parall[2];
2273  }
2274 
2275  signal[izone]->SetParameters(parall);
2276  signal[izone]->FixParameter(1, parall[1]);
2277  signal[izone]->FixParameter(2, parall[2]);
2278  signal[izone]->SetParLimits(0, 0.00, 2.0 * pedht + 0.1);
2279  signal[izone]->FixParameter(3, 0.14);
2280 
2281  signal[izone]->SetParLimits(5, 0.40 * area, 1.15 * area);
2282  // if (m_histfit) { //GMA
2283  if (iijj == 3) {
2284  signal[izone]->SetParLimits(4, 0.2 * fitprm[4][jk], 2.0 * fitprm[4][jk]);
2285  signal[izone]->SetParLimits(6, 0.2 * fitprm[6][jk], 2.0 * fitprm[6][jk]);
2286  } else {
2287  signal[izone]->SetParLimits(4, 0.1, 1.0);
2288  signal[izone]->SetParLimits(6, 0.035, 0.3);
2289  }
2290  signal[izone]->SetParNames("const", "mean", "sigma", "Width", "MP", "Area", "GSigma");
2291  signall[izone]->Fit(signal[izone], "0R+");
2292 
2293  signall[izone]->GetXaxis()->SetRangeUser(xmn, xmx);
2294  for (int k = 0; k < nsgpr; k++) {
2295  fitres[k] = fitprm[k][jk] = signal[izone]->GetParameter(k);
2296  parserr[k] = signal[izone]->GetParError(k);
2297  }
2298 
2299  } else {
2300  double pedhtx = 0;
2301  for (unsigned i = 0; i < sig_reg[ietafit][iphifit].size(); i++) {
2302  if (sig_reg[ietafit][iphifit][ij] > gaupr[1] - 3 * gaupr[2] &&
2303  sig_reg[ietafit][iphifit][ij] < gaupr[1] + gaupr[2])
2304  pedhtx++;
2305  }
2306 
2307  set_mean(gaupr[1], false);
2308  set_sigma(gaupr[2], false);
2309 
2310  TString name[nsgpr] = {"const", "mean", "sigma", "Width", "MP", "Area", "GSigma"};
2311  double strt[nsgpr] = {0.9 * pedhtx,
2312  gaupr[1],
2313  gaupr[2],
2314  fitprm[3][jk],
2315  fitprm[4][jk],
2316  signall[izone]->GetEntries(),
2317  fitprm[6][jk]};
2318  double alowmn[nsgpr] = {
2319  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]};
2320  double ahighmn[nsgpr] = {
2321  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]};
2322  double step[nsgpr] = {1.0, 0.0, 0.0, 0.0, 0.001, 1.0, 0.002};
2323 
2324  TMinuit* gMinuit = new TMinuit(nsgpr);
2325  gMinuit->SetFCN(fcnsg);
2326 
2327  double arglist[10];
2328  int ierflg = 0;
2329  arglist[0] = 0.5;
2330  gMinuit->mnexcm("SET ERR", arglist, 1, ierflg);
2331 
2332  for (int k = 0; k < nsgpr; k++) {
2333  gMinuit->mnparm(k, name[k], strt[k], step[k], alowmn[k], ahighmn[k], ierflg);
2334  }
2335 
2336  arglist[0] = 0;
2337  gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg);
2338 
2339  arglist[0] = 0;
2340  gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg);
2341 
2342  TString chnam;
2343  double parv, err, xlo, xup, plerr, mierr, eparab, gcc;
2344  int iuit;
2345 
2346  for (int k = 0; k < nsgpr; k++) {
2347  if (step[k] > -10) {
2348  gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit);
2349  gMinuit->mnerrs(k, plerr, mierr, eparab, gcc);
2350  if (k == 0 || k == 5) {
2351  fitres[k] = parv * binwid;
2352  parserr[k] = err * binwid;
2353  } else {
2354  fitres[k] = parv;
2355  parserr[k] = err;
2356  }
2357  }
2358  }
2359 
2360  delete gMinuit;
2361  }
2362 
2363  // if (iijj==0) {
2364  // signall[izone]->Draw("same");
2365  // } else {
2366  signall[izone]->Draw();
2367  // }
2368 
2369  sprintf(temp, "pedfun_%i", izone);
2370  pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
2371  pedfun[izone]->SetParameters(fitres);
2372  pedfun[izone]->SetLineColor(3);
2373  pedfun[izone]->SetLineWidth(1);
2374  pedfun[izone]->Draw("same");
2375 
2376  sprintf(temp, "signalfun_%i", izone);
2377  sigfun[izone] = new TF1(temp, langaufun, xmn, xmx, nsgpr - nbgpr);
2378  sigfun[izone]->SetParameters(&fitres[3]);
2379  sigfun[izone]->SetLineWidth(1);
2380  sigfun[izone]->SetLineColor(4);
2381  sigfun[izone]->Draw("same");
2382 
2383  sprintf(temp, "total_%i", izone);
2384  signalx[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr);
2385  signalx[izone]->SetParameters(fitres);
2386  signalx[izone]->SetLineWidth(1);
2387  signalx[izone]->Draw("same");
2388 
2389  int kl = (jk < 15) ? jk + 1 : 14 - jk;
2390 
2391  edm::LogInfo("HOCalib") << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3)
2392  << ij + 1 << " " << std::setw(5) << pedstll[izone]->GetEntries() << " "
2393  << std::setw(6) << pedstll[izone]->GetMean() << " " << std::setw(6)
2394  << pedstll[izone]->GetRMS() << " " << std::setw(5) << signall[izone]->GetEntries()
2395  << " " << std::setw(6) << signall[izone]->GetMean() << " " << std::setw(6)
2396  << signall[izone]->GetRMS() << " " << std::setw(6) << signal[izone]->GetChisquare()
2397  << " " << std::setw(3) << signal[izone]->GetNDF();
2398 
2399  file_out << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " "
2400  << std::setw(5) << pedstll[izone]->GetEntries() << " " << std::setw(6) << pedstll[izone]->GetMean()
2401  << " " << std::setw(6) << pedstll[izone]->GetRMS() << " " << std::setw(5)
2402  << signall[izone]->GetEntries() << " " << std::setw(6) << signall[izone]->GetMean() << " "
2403  << std::setw(6) << signall[izone]->GetRMS() << " " << std::setw(6) << signal[izone]->GetChisquare()
2404  << " " << std::setw(3) << signal[izone]->GetNDF() << std::endl;
2405 
2406  file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << fitres[0] << " " << fitres[1] << " "
2407  << fitres[2] << " " << fitres[3] << " " << fitres[4] << " " << fitres[5] << " " << fitres[6]
2408  << std::endl;
2409  file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << parserr[0] << " " << parserr[1] << " "
2410  << parserr[2] << " " << parserr[3] << " " << parserr[4] << " " << parserr[5] << " " << parserr[6]
2411  << std::endl;
2412 
2413  double diff = fitres[4] - fitres[1];
2414  if (diff <= 0)
2415  diff = 0.000001;
2416  double error = parserr[4] * parserr[4] + parer[2] * parer[2];
2417  error = pow(error, 0.5);
2418 
2419  int ieta = (jk < 15) ? (15 + jk) : (29 - jk);
2420  int ifl = nphimx * ieta + ij;
2421 
2422  if (iijj == 3) {
2423  ped_evt->Fill(ifl, pedstll[izone]->GetEntries());
2424  ped_mean->Fill(ifl, gaupr[1]);
2425  ped_width->Fill(ifl, gaupr[2]);
2426  fit_chi->Fill(ifl, signal[izone]->GetChisquare());
2427  sig_evt->Fill(ifl, signall[izone]->GetEntries());
2428  fit_sigevt->Fill(ifl, fitres[5]);
2429  fit_bkgevt->Fill(ifl, fitres[0] * sqrt(2 * acos(-1.)) * gaupr[2]);
2430  sig_mean->Fill(ifl, fitres[4]);
2431  sig_diff->Fill(ifl, fitres[4] - fitres[1]);
2432  sig_width->Fill(ifl, fitres[3]);
2433  sig_sigma->Fill(ifl, fitres[6]);
2434  sig_meanerr->Fill(ifl, parserr[4]);
2435  if (fitres[4] - fitres[1] != 0)
2436  sig_meanerrp->Fill(ifl, 100 * parserr[4] / (fitres[4] - fitres[1]));
2437  if (gaupr[2] != 0)
2438  sig_signf->Fill(ifl, (fitres[4] - fitres[1]) / gaupr[2]);
2439 
2440  ped_statmean->Fill(ifl, pedstll[izone]->GetMean());
2441  sig_statmean->Fill(ifl, signall[izone]->GetMean());
2442  ped_rms->Fill(ifl, pedstll[izone]->GetRMS());
2443  sig_rms->Fill(ifl, signall[izone]->GetRMS());
2444  }
2445 
2446  if ((iijj == 2) || (iijj == 3) || (iijj == 1)) {
2447  if (signall[izone]->GetEntries() > 5 && fitres[4] > 0.1) {
2448  //GMA need to put this==1 in future
2449  float fact = 0.812;
2450  if (abs(kl) <= 4)
2451  fact = 0.895;
2452  fact *= 0.19; //conversion factor for GeV/fC
2453 
2454  float fact2 = 0;
2455  if (iijj == 2)
2456  fact2 = invang[jk][nphimx];
2457  if (iijj == 3)
2458  fact2 = invang[jk][ij];
2459  if (iijj == 1)
2460  fact2 = com_invang[jk][ij];
2461 
2462  float calibc = fact * fact2 / (fitres[4] * signall[izone]->GetEntries());
2463  float caliberr = TMath::Abs(calibc * parserr[4] / std::max(0.001, fitres[4]));
2464 
2465  if (iijj == 2) {
2466  int ieta = (jk < 15) ? jk + 1 : 14 - jk;
2467  mean_phi_hst->Fill(ieta, calibc);
2468  mean_phi_hst->SetBinError(mean_phi_hst->FindBin(ieta), caliberr);
2469  file_out << "intieta " << jk << " " << ij << " " << ieta << " " << mean_phi_hst->FindBin(double(ieta))
2470  << " " << calibc << " " << caliberr << std::endl;
2471  } else if (iijj == 3) {
2472  const_eta[jk]->Fill(ij + 1, calibc);
2473  const_eta[jk]->SetBinError(const_eta[jk]->FindBin(ij + 1), caliberr);
2474 
2475  peak_eta[jk]->Fill(ij + 1, fitres[4]);
2476  peak_eta[jk]->SetBinError(peak_eta[jk]->FindBin(ij + 1), parserr[4]);
2477 
2478  int ieta = (jk < 15) ? jk + 1 : 14 - jk;
2479  const_eta_phi->Fill(ieta, ij + 1, calibc);
2480  file_out << "intietax " << jk << " " << ij << " " << ieta << " "
2481  << const_eta_phi->FindBin(ieta, ij + 1) << std::endl;
2482  if (caliberr > 0) {
2483  const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), caliberr);
2484 
2485  mean_eta[ij] += calibc / (caliberr * caliberr);
2486  mean_phi[jk] += calibc / (caliberr * caliberr);
2487 
2488  rms_eta[ij] += 1. / (caliberr * caliberr);
2489  rms_phi[jk] += 1. / (caliberr * caliberr);
2490 
2491  } else {
2492  const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), 0.0);
2493  }
2494  } else if (iijj == 1) {
2495  const_hpdrm[jk]->Fill(ij + 1, calibc);
2496  const_hpdrm[jk]->SetBinError(const_hpdrm[jk]->FindBin(ij + 1), caliberr);
2497 
2498  peak_hpdrm[jk]->Fill(ij + 1, fitres[4]);
2499  peak_hpdrm[jk]->SetBinError(peak_hpdrm[jk]->FindBin(ij + 1), parserr[4]);
2500  }
2501 
2502  file_out << "HO 4 " << iijj << " " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " "
2503  << std::setw(7) << calibc << " " << std::setw(7) << caliberr << std::endl;
2504  }
2505  }
2506 
2507  } else { //if (signall[izone]->GetEntries() >10) {
2508  signall[izone]->Draw();
2509  float varx = 0.000;
2510  int kl = (jk < 15) ? jk + 1 : 14 - jk;
2511  file_out << "histinfo" << iijj << " nof " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " "
2512  << std::setw(5) << pedstll[izone]->GetEntries() << " " << std::setw(6) << pedstll[izone]->GetMean()
2513  << " " << std::setw(6) << pedstll[izone]->GetRMS() << " " << std::setw(5)
2514  << signall[izone]->GetEntries() << " " << std::setw(6) << signall[izone]->GetMean() << " "
2515  << std::setw(6) << signall[izone]->GetRMS() << " " << std::setw(6) << varx << " " << std::setw(3)
2516  << varx << std::endl;
2517 
2518  file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx
2519  << " " << varx << " " << varx << " " << varx << " " << varx << std::endl;
2520  file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx
2521  << " " << varx << " " << varx << " " << varx << " " << varx << std::endl;
2522  }
2523  iiter++;
2524  if (iiter % nsample == 0) {
2525  c0->Update();
2526 
2527  for (int kl = 0; kl < nsample; kl++) {
2528  if (gx0[kl]) {
2529  delete gx0[kl];
2530  gx0[kl] = nullptr;
2531  }
2532  if (ped0fun[kl]) {
2533  delete ped0fun[kl];
2534  ped0fun[kl] = nullptr;
2535  }
2536  if (signal[kl]) {
2537  delete signal[kl];
2538  signal[kl] = nullptr;
2539  }
2540  if (pedfun[kl]) {
2541  delete pedfun[kl];
2542  pedfun[kl] = nullptr;
2543  }
2544  if (sigfun[kl]) {
2545  delete sigfun[kl];
2546  sigfun[kl] = nullptr;
2547  }
2548  if (signalx[kl]) {
2549  delete signalx[kl];
2550  signalx[kl] = nullptr;
2551  }
2552  if (signall[kl]) {
2553  delete signall[kl];
2554  signall[kl] = nullptr;
2555  }
2556  if (pedstll[kl]) {
2557  delete pedstll[kl];
2558  pedstll[kl] = nullptr;
2559  }
2560  }
2561  }
2562  } //for (int jk=0; jk<netamx; jk++) {
2563  } //for (int ij=0; ij<nphimx; ij++) {
2564 
2565  // if (iijj==0) {
2566  // sprintf(out_file, "comb_hosig_allring_%i.jpg", irunold);
2567  // c0->SaveAs(out_file);
2568  // iiter = 0;
2569  // } else {
2570  // // c0->Update();
2571  // }
2572 
2573  // iiter = 0;
2574  } //end of iijj
2575  if (iiter % nsample != 0) {
2576  c0->Update();
2577  for (int kl = 0; kl < nsample; kl++) {
2578  if (gx0[kl]) {
2579  delete gx0[kl];
2580  gx0[kl] = nullptr;
2581  }
2582  if (ped0fun[kl]) {
2583  delete ped0fun[kl];
2584  ped0fun[kl] = nullptr;
2585  }
2586  if (signal[kl]) {
2587  delete signal[kl];
2588  signal[kl] = nullptr;
2589  }
2590  if (pedfun[kl]) {
2591  delete pedfun[kl];
2592  pedfun[kl] = nullptr;
2593  }
2594  if (sigfun[kl]) {
2595  delete sigfun[kl];
2596  sigfun[kl] = nullptr;
2597  }
2598  if (signalx[kl]) {
2599  delete signalx[kl];
2600  signalx[kl] = nullptr;
2601  }
2602  if (signall[kl]) {
2603  delete signall[kl];
2604  signall[kl] = nullptr;
2605  }
2606  if (pedstll[kl]) {
2607  delete pedstll[kl];
2608  pedstll[kl] = nullptr;
2609  }
2610  }
2611  }
2612 
2613  delete c0;
2614 
2615  xsiz = 600; //int xsiz = 600;
2616  ysiz = 800; //int ysiz = 800;
2617 
2618  gStyle->SetTitleFontSize(0.05);
2619  gStyle->SetTitleSize(0.025, "XYZ");
2620  gStyle->SetLabelSize(0.025, "XYZ");
2621  gStyle->SetStatFontSize(.045);
2622 
2623  gStyle->SetOptStat(0);
2624  ps.NewPage();
2625  TCanvas* c1 = new TCanvas("c1", " Pedestal vs signal", xsiz, ysiz);
2626  ped_evt->Draw();
2627  c1->Update();
2628 
2629  ps.NewPage();
2630  ped_statmean->Draw();
2631  c1->Update();
2632 
2633  ps.NewPage();
2634  ped_rms->Draw();
2635  c1->Update();
2636 
2637  ps.NewPage();
2638  ped_mean->Draw();
2639  c1->Update();
2640 
2641  ps.NewPage();
2642  ped_width->Draw();
2643  c1->Update();
2644 
2645  ps.NewPage();
2646  sig_evt->Draw();
2647  c1->Update();
2648 
2649  ps.NewPage();
2650  sig_statmean->Draw();
2651  c1->Update();
2652 
2653  ps.NewPage();
2654  sig_rms->Draw();
2655  c1->Update();
2656 
2657  ps.NewPage();
2658  fit_chi->Draw();
2659  c1->Update();
2660 
2661  ps.NewPage();
2662  fit_sigevt->Draw();
2663  c1->Update();
2664 
2665  ps.NewPage();
2666  fit_bkgevt->Draw();
2667  c1->Update();
2668 
2669  ps.NewPage();
2670  sig_mean->Draw();
2671  c1->Update();
2672 
2673  ps.NewPage();
2674  sig_width->Draw();
2675  c1->Update();
2676 
2677  ps.NewPage();
2678  sig_sigma->Draw();
2679  c1->Update();
2680 
2681  ps.NewPage();
2682  sig_meanerr->Draw();
2683  c1->Update();
2684 
2685  ps.NewPage();
2686  sig_meanerrp->Draw();
2687  c1->Update();
2688 
2689  ps.NewPage();
2690  sig_signf->Draw();
2691  c1->Update();
2692 
2693  ps.Close();
2694  delete c1;
2695 
2696  file_out.close();
2697 
2698  if (m_figure) {
2699  xsiz = 700;
2700  ysiz = 450;
2701 
2702  gStyle->SetTitleFontSize(0.09);
2703  gStyle->SetPadBottomMargin(0.17);
2704  gStyle->SetPadLeftMargin(0.18);
2705  gStyle->SetPadRightMargin(0.01);
2706  gStyle->SetOptLogy(0);
2707  gStyle->SetOptStat(0);
2708 
2709  TCanvas* c2 = new TCanvas("c2", "runfile", xsiz, ysiz);
2710  c2->Divide(5, 3);
2711 
2712  for (int side = 0; side < 2; side++) {
2713  gStyle->SetNdivisions(303, "XY");
2714  gStyle->SetPadRightMargin(0.01);
2715  int nmn = 0;
2716  int nmx = netamx / 2;
2717  if (side == 1) {
2718  nmn = netamx / 2;
2719  nmx = netamx;
2720  }
2721 
2722  int nzone = 0;
2723 
2724  for (int ij = nmn; ij < nmx; ij++) {
2725  c2->cd(nzone + 1);
2726  const_eta[ij]->GetXaxis()->SetTitle("#phi index");
2727  const_eta[ij]->GetXaxis()->SetTitleSize(.08);
2728  const_eta[ij]->GetXaxis()->CenterTitle();
2729  const_eta[ij]->GetXaxis()->SetTitleOffset(0.9);
2730  const_eta[ij]->GetXaxis()->SetLabelSize(.085);
2731  const_eta[ij]->GetXaxis()->SetLabelOffset(.01);
2732 
2733  const_eta[ij]->GetYaxis()->SetLabelSize(.08);
2734  const_eta[ij]->GetYaxis()->SetLabelOffset(.01);
2735  const_eta[ij]->GetYaxis()->SetTitle("GeV/MIP-GeV!!");
2736 
2737  const_eta[ij]->GetYaxis()->SetTitleSize(.085);
2738  const_eta[ij]->GetYaxis()->CenterTitle();
2739  const_eta[ij]->GetYaxis()->SetTitleOffset(1.3);
2740  const_eta[ij]->SetMarkerSize(0.60);
2741  const_eta[ij]->SetMarkerColor(2);
2742  const_eta[ij]->SetMarkerStyle(20);
2743 
2744  const_eta[ij]->Draw();
2745  nzone++;
2746  }
2747 
2748  sprintf(out_file, "calibho_%i_side%i.eps", irunold, side);
2749  c2->SaveAs(out_file);
2750 
2751  sprintf(out_file, "calibho_%i_side%i.jpg", irunold, side);
2752  c2->SaveAs(out_file);
2753 
2754  nzone = 0;
2755  for (int ij = nmn; ij < nmx; ij++) {
2756  c2->cd(nzone + 1);
2757  peak_eta[ij]->GetXaxis()->SetTitle("#phi index");
2758  peak_eta[ij]->GetXaxis()->SetTitleSize(.08);
2759  peak_eta[ij]->GetXaxis()->CenterTitle();
2760  peak_eta[ij]->GetXaxis()->SetTitleOffset(0.90);
2761  peak_eta[ij]->GetXaxis()->SetLabelSize(.08);
2762  peak_eta[ij]->GetXaxis()->SetLabelOffset(.01);
2763 
2764  peak_eta[ij]->GetYaxis()->SetLabelSize(.08);
2765  peak_eta[ij]->GetYaxis()->SetLabelOffset(.01);
2766  peak_eta[ij]->GetYaxis()->SetTitle("GeV");
2767 
2768  peak_eta[ij]->GetYaxis()->SetTitleSize(.085);
2769  peak_eta[ij]->GetYaxis()->CenterTitle();
2770  peak_eta[ij]->GetYaxis()->SetTitleOffset(1.3);
2771 
2772  peak_eta[ij]->SetMarkerSize(0.60);
2773  peak_eta[ij]->SetMarkerColor(2);
2774  peak_eta[ij]->SetMarkerStyle(20);
2775 
2776  peak_eta[ij]->Draw();
2777  nzone++;
2778  }
2779 
2780  sprintf(out_file, "peakho_%i_side%i.eps", irunold, side);
2781  c2->SaveAs(out_file);
2782 
2783  sprintf(out_file, "peakho_%i_side%i.jpg", irunold, side);
2784  c2->SaveAs(out_file);
2785  }
2786  delete c2;
2787 
2788  // if (m_combined) {
2789  gStyle->SetTitleFontSize(0.045);
2790  gStyle->SetPadRightMargin(0.13);
2791  gStyle->SetPadBottomMargin(0.15);
2792  gStyle->SetPadLeftMargin(0.1);
2793  gStyle->SetOptStat(0);
2794  xsiz = 700;
2795  ysiz = 600;
2796  TCanvas* c1 = new TCanvas("c1", "Fitted const in each tower", xsiz, ysiz);
2797  const_eta_phi->GetXaxis()->SetTitle("#eta");
2798  const_eta_phi->GetXaxis()->SetTitleSize(0.065);
2799  const_eta_phi->GetXaxis()->SetTitleOffset(0.85); //6);
2800  const_eta_phi->GetXaxis()->CenterTitle();
2801  const_eta_phi->GetXaxis()->SetLabelSize(0.045);
2802  const_eta_phi->GetXaxis()->SetLabelOffset(0.01);
2803 
2804  const_eta_phi->GetYaxis()->SetTitle("#phi");
2805  const_eta_phi->GetYaxis()->SetTitleSize(0.075);
2806  const_eta_phi->GetYaxis()->SetTitleOffset(0.5);
2807  const_eta_phi->GetYaxis()->CenterTitle();
2808  const_eta_phi->GetYaxis()->SetLabelSize(0.045);
2809  const_eta_phi->GetYaxis()->SetLabelOffset(0.01);
2810 
2811  const_eta_phi->Draw("colz");
2812  sprintf(out_file, "high_hoconst_eta_phi_%i.jpg", irunold);
2813  c1->SaveAs(out_file);
2814 
2815  delete c1;
2816 
2817  for (int jk = 0; jk < netamx; jk++) {
2818  int ieta = (jk < 15) ? jk + 1 : 14 - jk;
2819  if (rms_phi[jk] > 0) {
2820  mean_phi_ave->Fill(ieta, mean_phi[jk] / rms_phi[jk]);
2821  mean_phi_ave->SetBinError(mean_phi_ave->FindBin(ieta), pow(double(rms_phi[jk]), -0.5));
2822  }
2823  }
2824 
2825  for (int ij = 0; ij < nphimx; ij++) {
2826  if (rms_eta[ij] > 0) {
2827  mean_eta_ave->Fill(ij + 1, mean_eta[ij] / rms_eta[ij]);
2828  mean_eta_ave->SetBinError(mean_eta_ave->FindBin(ij + 1), pow(double(rms_eta[ij]), -0.5));
2829  }
2830  }
2831 
2832  ysiz = 450;
2833  gStyle->SetPadLeftMargin(0.13);
2834  gStyle->SetPadRightMargin(0.03);
2835 
2836  TCanvas* c2y = new TCanvas("c2", "Avearge signal in eta and phi", xsiz, ysiz);
2837  c2y->Divide(2, 1);
2838  mean_eta_ave->GetXaxis()->SetTitle("#phi");
2839  mean_eta_ave->GetXaxis()->SetTitleSize(0.085);
2840  mean_eta_ave->GetXaxis()->SetTitleOffset(0.65);
2841  mean_eta_ave->GetXaxis()->CenterTitle();
2842  mean_eta_ave->GetXaxis()->SetLabelSize(0.05);
2843  mean_eta_ave->GetXaxis()->SetLabelOffset(0.001);
2844 
2845  mean_eta_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP");
2846  mean_eta_ave->GetYaxis()->SetTitleSize(0.055);
2847  mean_eta_ave->GetYaxis()->SetTitleOffset(1.3);
2848  mean_eta_ave->GetYaxis()->CenterTitle();
2849  mean_eta_ave->GetYaxis()->SetLabelSize(0.045);
2850  mean_eta_ave->GetYaxis()->SetLabelOffset(0.01);
2851  mean_eta_ave->SetMarkerSize(0.60);
2852  mean_eta_ave->SetMarkerColor(2);
2853  mean_eta_ave->SetMarkerStyle(20);
2854 
2855  c2y->cd(1);
2856  mean_eta_ave->Draw();
2857 
2858  mean_phi_ave->GetXaxis()->SetTitle("#eta");
2859  mean_phi_ave->GetXaxis()->SetTitleSize(0.085);
2860  mean_phi_ave->GetXaxis()->SetTitleOffset(0.65); //55);
2861  mean_phi_ave->GetXaxis()->CenterTitle();
2862  mean_phi_ave->GetXaxis()->SetLabelSize(0.05);
2863  mean_phi_ave->GetXaxis()->SetLabelOffset(0.001);
2864 
2865  mean_phi_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP");
2866  mean_phi_ave->GetYaxis()->SetTitleSize(0.055);
2867  mean_phi_ave->GetYaxis()->SetTitleOffset(1.3);
2868  mean_phi_ave->GetYaxis()->CenterTitle();
2869  mean_phi_ave->GetYaxis()->SetLabelSize(0.045);
2870  mean_phi_ave->GetYaxis()->SetLabelOffset(0.01);
2871  mean_phi_ave->SetMarkerSize(0.60);
2872  mean_phi_ave->SetMarkerColor(2);
2873  mean_phi_ave->SetMarkerStyle(20);
2874 
2875  c2y->cd(2);
2876  mean_phi_ave->Draw();
2877 
2878  sprintf(out_file, "high_hoaverage_eta_phi_%i.jpg", irunold);
2879  c2y->SaveAs(out_file);
2880 
2881  delete c2y;
2882  // } else { //m_combined
2883 
2884  xsiz = 800;
2885  ysiz = 450;
2886  TCanvas* c3 = new TCanvas("c3", "Avearge signal in eta and phi", xsiz, ysiz);
2887  c3->Divide(2, 1);
2888  mean_phi_hst->GetXaxis()->SetTitle("#eta");
2889  mean_phi_hst->GetXaxis()->SetTitleSize(0.065);
2890  mean_phi_hst->GetXaxis()->SetTitleOffset(0.9);
2891  mean_phi_hst->GetXaxis()->CenterTitle();
2892  mean_phi_hst->GetXaxis()->SetLabelSize(0.065);
2893  mean_phi_hst->GetXaxis()->SetLabelOffset(0.001);
2894 
2895  mean_phi_hst->GetYaxis()->SetTitle("GeV/MIP");
2896  mean_phi_hst->GetYaxis()->SetTitleSize(0.055);
2897  mean_phi_hst->GetYaxis()->SetTitleOffset(0.9);
2898  mean_phi_hst->GetYaxis()->CenterTitle();
2899  mean_phi_hst->GetYaxis()->SetLabelSize(0.065);
2900  mean_phi_hst->GetYaxis()->SetLabelOffset(0.01);
2901 
2902  mean_phi_hst->SetMarkerColor(4);
2903  mean_phi_hst->SetMarkerSize(0.8);
2904  mean_phi_hst->SetMarkerStyle(20);
2905  mean_phi_hst->Draw();
2906 
2907  sprintf(out_file, "low_mean_phi_hst_%i.jpg", irunold);
2908  c3->SaveAs(out_file);
2909 
2910  delete c3;
2911 
2912  // } //m_combined
2913 
2914  gStyle->SetOptLogy(1);
2915  gStyle->SetPadTopMargin(.1);
2916  gStyle->SetPadLeftMargin(.15);
2917  xsiz = 800;
2918  ysiz = 500;
2919  TCanvas* c0x = new TCanvas("c0x", "Signal in each ring", xsiz, ysiz);
2920 
2921  c0x->Divide(3, 2);
2922  for (int ij = 0; ij < ringmx; ij++) {
2923  int iread = (ij == 2) ? routmx : rout12mx;
2924  com_sigrsg[ij][iread]->GetXaxis()->SetTitle("Signal/ped (GeV)");
2925 
2926  com_sigrsg[ij][iread]->GetXaxis()->SetTitleSize(0.060);
2927  com_sigrsg[ij][iread]->GetXaxis()->SetTitleOffset(1.05);
2928  com_sigrsg[ij][iread]->GetXaxis()->CenterTitle();
2929  com_sigrsg[ij][iread]->GetXaxis()->SetLabelSize(0.065);
2930  com_sigrsg[ij][iread]->GetXaxis()->SetLabelOffset(0.01);
2931 
2932  com_sigrsg[ij][iread]->GetYaxis()->SetLabelSize(0.065);
2933  com_sigrsg[ij][iread]->GetYaxis()->SetLabelOffset(0.01);
2934 
2935  com_sigrsg[ij][iread]->SetLineWidth(3);
2936  com_sigrsg[ij][iread]->SetLineColor(4);
2937 
2938  c0x->cd(ij + 1);
2939  com_sigrsg[ij][iread]->Draw();
2940 
2941  com_crossg[ij][iread]->SetLineWidth(2);
2942  com_crossg[ij][iread]->SetLineColor(2);
2943  com_crossg[ij][iread]->Draw("same");
2944  }
2945  sprintf(out_file, "hosig_ring_%i.jpg", irunold);
2946  c0x->SaveAs(out_file);
2947  delete c0x;
2948 
2949  gStyle->SetTitleFontSize(0.06);
2950  gStyle->SetOptStat(0);
2951  gStyle->SetOptLogy(0);
2952 
2953  TCanvas* c0 = new TCanvas("c0", "Signal in each ring", xsiz, ysiz);
2954 
2955  c0->Divide(3, 2);
2956  for (int jk = 0; jk < ringmx; jk++) {
2957  peak_hpdrm[jk]->GetXaxis()->SetTitle("RM #");
2958  peak_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070);
2959  peak_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.0);
2960  peak_hpdrm[jk]->GetXaxis()->CenterTitle();
2961  peak_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065);
2962  peak_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01);
2963 
2964  peak_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)/MIP");
2965 
2966  peak_hpdrm[jk]->GetYaxis()->SetTitleSize(0.07);
2967  peak_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.3);
2968  peak_hpdrm[jk]->GetYaxis()->CenterTitle();
2969  peak_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065);
2970  peak_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01);
2971  // peak_hpdrm[jk]->SetLineWidth(3);
2972  // peak_hpdrm[jk]->SetLineColor(4);
2973  peak_hpdrm[jk]->SetMarkerSize(0.60);
2974  peak_hpdrm[jk]->SetMarkerColor(2);
2975  peak_hpdrm[jk]->SetMarkerStyle(20);
2976 
2977  c0->cd(jk + 1);
2978  peak_hpdrm[jk]->Draw();
2979  }
2980  sprintf(out_file, "comb_peak_hpdrm_%i.jpg", irunold);
2981  c0->SaveAs(out_file);
2982 
2983  delete c0;
2984 
2985  TCanvas* c1y = new TCanvas("c1y", "Signal in each ring", xsiz, ysiz);
2986 
2987  c1y->Divide(3, 2);
2988  for (int jk = 0; jk < ringmx; jk++) {
2989  const_hpdrm[jk]->GetXaxis()->SetTitle("RM #");
2990  const_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070);
2991  const_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.3);
2992  const_hpdrm[jk]->GetXaxis()->CenterTitle();
2993  const_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065);
2994  const_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01);
2995 
2996  const_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)");
2997  const_hpdrm[jk]->GetYaxis()->SetTitleSize(0.065);
2998  const_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.0);
2999  const_hpdrm[jk]->GetYaxis()->CenterTitle();
3000  const_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065);
3001  const_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01);
3002  // const_hpdrm[jk]->SetLineWidth(3);
3003  // const_hpdrm[jk]->SetLineColor(4);
3004  const_hpdrm[jk]->SetMarkerSize(0.60);
3005  const_hpdrm[jk]->SetMarkerColor(2);
3006  const_hpdrm[jk]->SetMarkerStyle(20);
3007 
3008  c1y->cd(jk + 1);
3009  const_hpdrm[jk]->Draw();
3010  }
3011 
3012  sprintf(out_file, "comb_const_hpdrm_%i.jpg", irunold);
3013  c1y->SaveAs(out_file);
3014 
3015  delete c1y;
3016 
3017  } //if (m_figure) {
3018 
3019  // ps.Close();
3020  // file_out.close();
3021 
3022  } // if (m_constant){
3023 
3024  if (m_figure) {
3025  for (int ij = 0; ij < nphimx; ij++) {
3026  for (int jk = 0; jk < netamx; jk++) {
3027  stat_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetEntries());
3028  statmn_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetMean());
3029  }
3030  }
3031 
3032  xsiz = 700;
3033  ysiz = 450;
3034  gStyle->SetTitleFontSize(0.09);
3035  gStyle->SetPadBottomMargin(0.14);
3036  gStyle->SetPadLeftMargin(0.17);
3037  gStyle->SetPadRightMargin(0.01);
3038  gStyle->SetNdivisions(303, "XY");
3039  gStyle->SetOptLogy(1);
3040 
3041  TCanvas* c2x = new TCanvas("c2x", "runfile", xsiz, ysiz);
3042  c2x->Divide(5, 3);
3043  for (int side = 0; side < 2; side++) {
3044  int nmn = 0;
3045  int nmx = netamx / 2;
3046  if (side == 1) {
3047  nmn = netamx / 2;
3048  nmx = netamx;
3049  }
3050  int nzone = 0;
3051  char name[200];
3052 
3053  for (int ij = nmn; ij < nmx; ij++) {
3054  int ieta = (ij < 15) ? ij + 1 : 14 - ij;
3055  c2x->cd(nzone + 1);
3056  sprintf(name, "GeV(#eta=%i)", ieta);
3057  sigrsg[ij][nphimx]->GetXaxis()->SetTitle(name);
3058  sigrsg[ij][nphimx]->GetXaxis()->SetTitleSize(.08);
3059  sigrsg[ij][nphimx]->GetXaxis()->CenterTitle();
3060  sigrsg[ij][nphimx]->GetXaxis()->SetTitleOffset(0.90);
3061  sigrsg[ij][nphimx]->GetXaxis()->SetLabelSize(.08);
3062  sigrsg[ij][nphimx]->GetXaxis()->SetLabelOffset(.01);
3063 
3064  sigrsg[ij][nphimx]->GetYaxis()->SetLabelSize(.08);
3065  sigrsg[ij][nphimx]->GetYaxis()->SetLabelOffset(.01);
3066  sigrsg[ij][nphimx]->SetLineWidth(2);
3067  sigrsg[ij][nphimx]->SetLineColor(4);
3068  sigrsg[ij][nphimx]->Draw();
3069  crossg[ij][nphimx]->SetLineWidth(2);
3070  crossg[ij][nphimx]->SetLineColor(2);
3071  crossg[ij][nphimx]->Draw("same");
3072  nzone++;
3073  }
3074 
3075  sprintf(out_file, "sig_ho_%i_side%i.eps", irunold, side);
3076  c2x->SaveAs(out_file);
3077 
3078  sprintf(out_file, "sig_ho_%i_side%i.jpg", irunold, side);
3079  c2x->SaveAs(out_file);
3080  }
3081 
3082  gStyle->SetOptLogy(0);
3083  c2x = new TCanvas("c2x", "runfile", xsiz, ysiz);
3084  c2x->Divide(5, 3);
3085  for (int side = 0; side < 2; side++) {
3086  int nmn = 0;
3087  int nmx = netamx / 2;
3088  if (side == 1) {
3089  nmn = netamx / 2;
3090  nmx = netamx;
3091  }
3092  int nzone = 0;
3093 
3094  nzone = 0;
3095  for (int ij = nmn; ij < nmx; ij++) {
3096  c2x->cd(nzone + 1);
3097  statmn_eta[ij]->SetLineWidth(2);
3098  statmn_eta[ij]->SetLineColor(4);
3099  statmn_eta[ij]->GetXaxis()->SetTitle("#phi index");
3100  statmn_eta[ij]->GetXaxis()->SetTitleSize(.08);
3101  statmn_eta[ij]->GetXaxis()->CenterTitle();
3102  statmn_eta[ij]->GetXaxis()->SetTitleOffset(0.9);
3103  statmn_eta[ij]->GetYaxis()->SetLabelSize(.08);
3104  statmn_eta[ij]->GetYaxis()->SetLabelOffset(.01);
3105  statmn_eta[ij]->GetXaxis()->SetLabelSize(.08);
3106  statmn_eta[ij]->GetXaxis()->SetLabelOffset(.01);
3107  statmn_eta[ij]->GetYaxis()->SetTitle("GeV");
3108  statmn_eta[ij]->GetYaxis()->SetTitleSize(.075);
3109  statmn_eta[ij]->GetYaxis()->CenterTitle();
3110  statmn_eta[ij]->GetYaxis()->SetTitleOffset(1.30);
3111 
3112  statmn_eta[ij]->Draw();
3113  nzone++;
3114  }
3115 
3116  sprintf(out_file, "statmnho_%i_side%i.eps", irunold, side);
3117  c2x->SaveAs(out_file);
3118 
3119  sprintf(out_file, "statmnho_%i_side%i.jpg", irunold, side);
3120  c2x->SaveAs(out_file);
3121 
3122  gStyle->SetOptLogy(1);
3123  gStyle->SetNdivisions(203, "XY");
3124 
3125  nzone = 0;
3126  for (int ij = nmn; ij < nmx; ij++) {
3127  c2x->cd(nzone + 1);
3128  stat_eta[ij]->SetLineWidth(2);
3129  stat_eta[ij]->SetLineColor(4);
3130  stat_eta[ij]->GetXaxis()->SetTitle("#phi index");
3131  stat_eta[ij]->GetXaxis()->SetTitleSize(.08);
3132  stat_eta[ij]->GetXaxis()->CenterTitle();
3133  stat_eta[ij]->GetXaxis()->SetTitleOffset(0.80);
3134  stat_eta[ij]->GetXaxis()->SetLabelSize(.08);
3135  stat_eta[ij]->GetXaxis()->SetLabelOffset(.01);
3136  stat_eta[ij]->GetYaxis()->SetLabelSize(.08);
3137  stat_eta[ij]->GetYaxis()->SetLabelOffset(.01);
3138 
3139  stat_eta[ij]->Draw();
3140  nzone++;
3141  }
3142 
3143  sprintf(out_file, "statho_%i_side%i.eps", irunold, side);
3144  c2x->SaveAs(out_file);
3145 
3146  sprintf(out_file, "statho_%i_side%i.jpg", irunold, side);
3147  c2x->SaveAs(out_file);
3148  }
3149  delete c2x;
3150 
3151  } //if (m_figure) {
3152 
3153  if (!m_constant) { //m_constant
3154  for (int jk = 0; jk < netamx; jk++) {
3155  for (int ij = 0; ij < nphimx; ij++) {
3156  if (crossg[jk][ij]) {
3157  delete crossg[jk][ij];
3158  }
3159  if (sigrsg[jk][ij]) {
3160  delete sigrsg[jk][ij];
3161  }
3162  }
3163  }
3164  }
3165 }
3166 
3167 //define this as a plug-in
3169 
3170 /*
3171 75minute
3172 112MB data
3173 1M events
3174 
3175 */
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
change_name.diff
diff
Definition: change_name.py:13
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
HOCalibAnalyzer::hotime
TProfile * hotime[netamx][nphimx]
Definition: HOCalibAnalyzer.cc:263
mps_fire.i
i
Definition: mps_fire.py:355
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
edm::LogInfo
Definition: MessageLogger.h:254
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
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
relativeConstraints.error
error
Definition: relativeConstraints.py:53
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:29
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
vertices_cff.x
x
Definition: vertices_cff.py:29
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:36
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
runTheMatrix.err
err
Definition: runTheMatrix.py:288
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:1679
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
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
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
HOCalibAnalyzer::ievt
unsigned ievt
Definition: HOCalibAnalyzer.cc:399
gausX
Double_t gausX(Double_t *x, Double_t *par)
Definition: HOCalibAnalyzer.cc:112
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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
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
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:30
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:169
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:1682
npixleup
static const int npixleup[21]
Definition: HOCalibAnalyzer.cc:94