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