00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <memory>
00024
00025
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "FWCore/Framework/interface/EDAnalyzer.h"
00028
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/MakerMacros.h"
00031
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033
00034 #include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h"
00035
00036 #include "FWCore/ServiceRegistry/interface/Service.h"
00037 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00038
00039 #include "TMath.h"
00040 #include "TFile.h"
00041 #include "TH1F.h"
00042 #include "TH2F.h"
00043 #include "TTree.h"
00044 #include "TProfile.h"
00045 #include "TPostScript.h"
00046 #include "TCanvas.h"
00047 #include "TF1.h"
00048 #include "TStyle.h"
00049 #include "TMinuit.h"
00050 #include "TMath.h"
00051
00052 #include <string>
00053
00054 #include <iostream>
00055 #include <fstream>
00056 #include <iomanip>
00057
00058
00059
00060 using namespace std;
00061 using namespace edm;
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 static const int mapx1[6][3]={{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {19,18,17}};
00073
00074 static const int mapx2[6][3]={{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {-1,-1,-1}};
00075
00076 static const int mapx0p[9][2]={{3,1}, {7,4}, {6,5}, {12,8}, {0,0}, {11,9}, {16,13}, {15,14}, {19,17}};
00077 static const int mapx0m[9][2]={{17,19}, {14,15}, {13,16}, {9,11}, {0,0}, {8,12}, {5,6}, {4,7}, {1,3}};
00078
00079 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},
00080 {-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, 5,5,5, -1},
00081 {-1, 0,-1,0, 1,2,2, 1,3,5, -1, 5,3,6, 7,7,6, 8,-1,8, -1},
00082 {-1, 8,-1,8, 7,6,6, 7,5,3, -1, 3,5,2, 1,1,2, 0,-1,0, -1}};
00083
00084 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},
00085 {-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0, -1},
00086 {-1, 1,-1,0, 1,1,0, 0,1,1, -1, 0,0,1, 1,0,0, 1,-1,0, -1},
00087 {-1, 0,-1,1, 0,0,1, 1,0,0, -1, 1,1,0, 0,1,1, 0,-1,1, -1}};
00088
00089
00090 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};
00091 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};
00092 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};
00093 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};
00094 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};
00095 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};
00096
00097 static const int netamx=30;
00098 static const int nphimx =72;
00099 const int nbgpr = 3;
00100 const int nsgpr = 7;
00101
00102 int ietafit;
00103 int iphifit;
00104 vector<float>sig_reg[netamx][nphimx+1];
00105 vector<float>cro_ssg[netamx][nphimx+1];
00106
00107
00108
00109
00110
00111
00112
00113 Double_t gausX(Double_t* x, Double_t* par){
00114 return par[0]*(TMath::Gaus(x[0], par[1], par[2], kTRUE));
00115 }
00116
00117 Double_t langaufun(Double_t *x, Double_t *par) {
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 Double_t invsq2pi = 0.3989422804014;
00132 Double_t mpshift = -0.22278298;
00133
00134
00135 Double_t np = 100.0;
00136 Double_t sc = 5.0;
00137
00138
00139 Double_t xx;
00140 Double_t mpc;
00141 Double_t fland;
00142 Double_t sum = 0.0;
00143 Double_t xlow,xupp;
00144 Double_t step;
00145 Double_t i;
00146
00147
00148
00149 mpc = par[1] - mpshift * par[0]*par[1];
00150
00151
00152 xlow = x[0] - sc * par[3];
00153 xupp = x[0] + sc * par[3];
00154
00155 step = (xupp-xlow) / np;
00156
00157
00158 for(i=1.0; i<=np/2; i++) {
00159 xx = xlow + (i-.5) * step;
00160 fland = TMath::Landau(xx,mpc,par[0]*par[1], kTRUE);
00161 sum += fland * TMath::Gaus(x[0],xx,par[3]);
00162 xx = xupp - (i-.5) * step;
00163 fland = TMath::Landau(xx,mpc,par[0]*par[1], kTRUE);
00164 sum += fland * TMath::Gaus(x[0],xx,par[3]);
00165 }
00166
00167 return (par[2] * step * sum * invsq2pi / par[3]);
00168 }
00169
00170 Double_t totalfunc(Double_t* x, Double_t* par){
00171 return gausX(x, par) + langaufun(x, &par[3]);
00172 }
00173
00174 void fcnbg(Int_t &npar, Double_t* gin, Double_t &f, Double_t* par, Int_t flag) {
00175
00176 double fval = -par[0];
00177 for (unsigned i=0; i<cro_ssg[ietafit][iphifit].size(); i++) {
00178 double xval = (double)cro_ssg[ietafit][iphifit][i];
00179 fval +=log(max(1.e-30,par[0]*TMath::Gaus(xval, par[1], par[2], 1)));
00180
00181 }
00182 f = -fval;
00183 }
00184
00185 void fcnsg(Int_t &npar, Double_t* gin, Double_t &f, Double_t* par, Int_t flag) {
00186
00187 double xval[2];
00188 double fval = -(par[0]+par[5]);
00189 for (unsigned i=0; i<sig_reg[ietafit][iphifit].size(); i++) {
00190 xval[0] = (double)sig_reg[ietafit][iphifit][i];
00191 fval +=log(totalfunc(xval, par));
00192 }
00193 f = -fval;
00194 }
00195
00196 void set_mean(double& x, bool mdigi) {
00197 if(mdigi) {
00198 x = min(x, 0.5);
00199 x = max(x, -0.5);
00200 } else {
00201 x = min(x, 0.1);
00202 x = max(x, -0.1);
00203 }
00204 }
00205
00206 void set_sigma(double& x, bool mdigi) {
00207 if(mdigi) {
00208 x = min(x, 1.2);
00209 x = max(x, -1.2);
00210 } else {
00211 x = min(x, 0.24);
00212 x = max(x, -0.24);
00213 }
00214 }
00215
00216
00217
00218 class HOCalibAnalyzer : public edm::EDAnalyzer {
00219 public:
00220 explicit HOCalibAnalyzer(const edm::ParameterSet&);
00221 ~HOCalibAnalyzer();
00222
00223
00224 private:
00225
00226 virtual void beginJob() ;
00227 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00228 virtual void endJob() ;
00229
00230 TFile* theFile;
00231 std::string theRootFileName;
00232 std::string theoutputtxtFile;
00233 std::string theoutputpsFile;
00234
00235 bool m_hotime;
00236 bool m_hbtime;
00237 bool m_correl;
00238 bool m_checkmap;
00239 bool m_hbinfo;
00240 bool m_combined;
00241 bool m_constant;
00242 bool m_figure;
00243 bool m_digiInput;
00244 bool m_cosmic;
00245 bool m_histfit;
00246 bool m_pedsuppr;
00247 double m_sigma;
00248
00249 static const int ncut = 13;
00250 static const int mypow_2_ncut = 8192;
00251
00252 int ipass;
00253
00254 TTree* T1;
00255
00256 TH1F* muonnm;
00257 TH1F* muonmm;
00258 TH1F* muonth;
00259 TH1F* muonph;
00260 TH1F* muonch;
00261
00262 TH1F* sel_muonnm;
00263 TH1F* sel_muonmm;
00264 TH1F* sel_muonth;
00265 TH1F* sel_muonph;
00266 TH1F* sel_muonch;
00267
00268
00269 TProfile* hotime[netamx][nphimx];
00270 TProfile* hopedtime[netamx][nphimx];
00271
00272
00273 TProfile* hbtime[netamx][nphimx];
00274
00275
00276
00277
00278
00279 TH1F* corrsglb[netamx][nphimx];
00280 TH1F* corrsgrb[netamx][nphimx];
00281 TH1F* corrsglu[netamx][nphimx];
00282 TH1F* corrsgru[netamx][nphimx];
00283 TH1F* corrsgall[netamx][nphimx];
00284
00285 TH1F* corrsgl[netamx][nphimx];
00286 TH1F* corrsgr[netamx][nphimx];
00287
00288 TH1F* mncorrsglb;
00289 TH1F* mncorrsgrb;
00290 TH1F* mncorrsglu;
00291 TH1F* mncorrsgru;
00292 TH1F* mncorrsgall;
00293
00294 TH1F* mncorrsgl;
00295 TH1F* mncorrsgr;
00296
00297 TH1F* rmscorrsglb;
00298 TH1F* rmscorrsgrb;
00299 TH1F* rmscorrsglu;
00300 TH1F* rmscorrsgru;
00301 TH1F* rmscorrsgall;
00302
00303 TH1F* rmscorrsgl;
00304 TH1F* rmscorrsgr;
00305
00306 TH1F* nevcorrsglb;
00307 TH1F* nevcorrsgrb;
00308 TH1F* nevcorrsglu;
00309 TH1F* nevcorrsgru;
00310 TH1F* nevcorrsgall;
00311
00312 TH1F* nevcorrsgl;
00313 TH1F* nevcorrsgr;
00314
00315
00316
00317 TH1F* corrsgc[netamx][nphimx];
00318 TH1F* mncorrsgc;
00319 TH1F* rmscorrsgc;
00320 TH1F* nevcorrsgc;
00321
00322
00323
00324 TH1F* sigrsg[netamx][nphimx+1];
00325 TH1F* crossg[netamx][nphimx+1];
00326 float invang[netamx][nphimx+1];
00327
00328 TH1F* mnsigrsg;
00329 TH1F* mncrossg;
00330
00331 TH1F* rmssigrsg;
00332 TH1F* rmscrossg;
00333
00334 TH1F* nevsigrsg;
00335 TH1F* nevcrossg;
00336
00337 TH1F* ho_sig2p[9];
00338 TH1F* ho_sig1p[9];
00339 TH1F* ho_sig00[9];
00340 TH1F* ho_sig1m[9];
00341 TH1F* ho_sig2m[9];
00342
00343
00344 TH1F* hbhe_sig[9];
00345
00346
00347
00348
00349 static const int ringmx=5;
00350 static const int sectmx=12;
00351 static const int routmx=36;
00352 static const int rout12mx=24;
00353 static const int neffip=6;
00354
00355
00356 TProfile* com_hotime[ringmx][sectmx];
00357 TProfile* com_hopedtime[ringmx][sectmx];
00358
00359
00360 TProfile* com_hbtime[ringmx][sectmx];
00361
00362
00363 TH1F* com_corrsglb[ringmx][sectmx];
00364 TH1F* com_corrsgrb[ringmx][sectmx];
00365 TH1F* com_corrsglu[ringmx][sectmx];
00366 TH1F* com_corrsgru[ringmx][sectmx];
00367 TH1F* com_corrsgall[ringmx][sectmx];
00368
00369 TH1F* com_corrsgl[ringmx][sectmx];
00370 TH1F* com_corrsgr[ringmx][sectmx];
00371
00372
00373 TH1F* com_corrsgc[ringmx][sectmx];
00374
00375
00376 TH1F* com_sigrsg[ringmx][routmx+1];
00377 TH1F* com_crossg[ringmx][routmx+1];
00378 float com_invang[ringmx][routmx+1];
00379
00380
00381
00382
00383 TH1F* ped_evt;
00384 TH1F* ped_mean;
00385 TH1F* ped_width;
00386 TH1F* fit_chi;
00387 TH1F* sig_evt;
00388 TH1F* fit_sigevt;
00389 TH1F* fit_bkgevt;
00390 TH1F* sig_mean;
00391 TH1F* sig_diff;
00392 TH1F* sig_width;
00393 TH1F* sig_sigma;
00394 TH1F* sig_meanerr;
00395 TH1F* sig_meanerrp;
00396 TH1F* sig_signf;
00397
00398 TH1F* ped_statmean;
00399 TH1F* sig_statmean;
00400 TH1F* ped_rms;
00401 TH1F* sig_rms;
00402
00403 TH2F* const_eta_phi;
00404
00405 TH1F* const_eta[netamx];
00406 TH1F* stat_eta[netamx];
00407 TH1F* statmn_eta[netamx];
00408 TH1F* peak_eta[netamx];
00409
00410 TH1F* const_hpdrm[ringmx];
00411
00412
00413 TH1F* peak_hpdrm[ringmx];
00414
00415 TH1F* mean_eta_ave;
00416 TH1F* mean_phi_ave;
00417 TH1F* mean_phi_hst;
00418
00419 TH2F* sig_effi[neffip];
00420 TH2F* mean_energy;
00421
00422 double fitprm[nsgpr][netamx];
00423
00424
00425 TProfile* sigvsevt[15][ncut];
00426
00427
00428
00429 int irun, ievt, itrg1, itrg2, isect, ndof, nmuon;
00430 float trkdr, trkdz, trkvx, trkvy, trkvz, trkmm, trkth, trkph, chisq, therr, pherr, hodx, hody,
00431 hoang, htime, hosig[9], hocorsig[18], hocro, hbhesig[9], caloen[3];
00432
00433 int Nevents;
00434 int nbn;
00435 float alow;
00436 float ahigh;
00437 float binwid;
00438 int irunold;
00439
00440
00441
00442 };
00443
00444 const int HOCalibAnalyzer::ringmx;
00445 const int HOCalibAnalyzer::sectmx;
00446 const int HOCalibAnalyzer::routmx;
00447 const int HOCalibAnalyzer::rout12mx;
00448 const int HOCalibAnalyzer::neffip;
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461 HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig)
00462 {
00463
00464 ipass = 0;
00465 Nevents = 0;
00466
00467 theRootFileName = iConfig.getUntrackedParameter<string>("RootFileName", "test.root");
00468 theoutputtxtFile = iConfig.getUntrackedParameter<string>("txtFileName", "test.txt");
00469 theoutputpsFile = iConfig.getUntrackedParameter<string>("psFileName", "test.ps");
00470
00471 m_hbinfo = iConfig.getUntrackedParameter<bool>("hbinfo", false);
00472 m_hbtime = iConfig.getUntrackedParameter<bool>("hbtime", false);
00473 m_hotime = iConfig.getUntrackedParameter<bool>("hotime", false);
00474 m_correl = iConfig.getUntrackedParameter<bool>("correl", false);
00475 m_checkmap = iConfig.getUntrackedParameter<bool>("checkmap", false);
00476 m_combined = iConfig.getUntrackedParameter<bool>("combined", false);
00477 m_constant = iConfig.getUntrackedParameter<bool>("get_constant", false);
00478 m_figure = iConfig.getUntrackedParameter<bool>("get_figure", true);
00479 m_digiInput = iConfig.getUntrackedParameter<bool>("digiInput", true);
00480 m_histfit = iConfig.getUntrackedParameter<bool>("histFit", true);
00481 m_pedsuppr = iConfig.getUntrackedParameter<bool>("pedSuppr", true);
00482 m_cosmic = iConfig.getUntrackedParameter<bool>("cosmic", true);
00483 m_sigma = iConfig.getUntrackedParameter<double>("sigma", 1.0);
00484
00485 edm::Service<TFileService> fs;
00486
00487 theFile = new TFile(theRootFileName.c_str(), "RECREATE");
00488 theFile->cd();
00489
00490 T1 = new TTree("T1", "DT+CSC+HO");
00491
00492 T1->Branch("irun",&irun,"irun/I");
00493 T1->Branch("ievt",&ievt,"ievt/I");
00494 T1->Branch("itrg1",&itrg1,"itrg1/I");
00495 T1->Branch("itrg2",&itrg2,"itrg2/I");
00496
00497 T1->Branch("isect",&isect,"isect/I");
00498
00499 T1->Branch("ndof",&ndof,"ndof/I");
00500 T1->Branch("nmuon",&nmuon,"nmuon/I");
00501
00502 T1->Branch("trkdr",&trkdr,"trkdr/F");
00503 T1->Branch("trkdz",&trkdz,"trkdz/F");
00504
00505 T1->Branch("trkvx",&trkvx,"trkvx/F");
00506 T1->Branch("trkvy",&trkvy,"trkvy/F");
00507 T1->Branch("trkvz",&trkvz,"trkvz/F");
00508 T1->Branch("trkmm",&trkmm,"trkmm/F");
00509 T1->Branch("trkth",&trkth,"trkth/F");
00510 T1->Branch("trkph",&trkph,"trkph/F");
00511
00512 T1->Branch("chisq",&chisq,"chisq/F");
00513 T1->Branch("therr",&therr,"therr/F");
00514 T1->Branch("pherr",&pherr,"pherr/F");
00515 T1->Branch("hodx",&hodx,"hodx/F");
00516 T1->Branch("hody",&hody,"hody/F");
00517 T1->Branch("hoang",&hoang,"hoang/F");
00518
00519 T1->Branch("htime",&htime,"htime/F");
00520 T1->Branch("hosig",hosig,"hosig[9]/F");
00521 T1->Branch("hocro",&hocro,"hocro/F");
00522 T1->Branch("hocorsig",hocorsig,"hocorsig[18]/F");
00523 T1->Branch("caloen",caloen,"caloen[3]/F");
00524
00525 if (m_hbinfo) {
00526 T1->Branch("hbhesig",hbhesig,"hbhesig[9]/F");
00527 }
00528
00529 muonnm = fs->make<TH1F>("muonnm", "No of muon", 10, -0.5, 9.5);
00530 muonmm = fs->make<TH1F>("muonmm", "P_{mu}", 200, -100., 100.);
00531 muonth = fs->make<TH1F>("muonth", "{Theta}_{mu}", 180, 0., 180.);
00532 muonph = fs->make<TH1F>("muonph", "{Phi}_{mu}", 180, -180., 180.);
00533 muonch = fs->make<TH1F>("muonch", "{chi^2}/ndf", 100, 0., 1000.);
00534
00535 sel_muonnm = fs->make<TH1F>("sel_muonnm", "No of muon(sel)", 10, -0.5, 9.5);
00536 sel_muonmm = fs->make<TH1F>("sel_muonmm", "P_{mu}(sel)", 200, -100., 100.);
00537 sel_muonth = fs->make<TH1F>("sel_muonth", "{Theta}_{mu}(sel)", 180, 0., 180.);
00538 sel_muonph = fs->make<TH1F>("sel_muonph", "{Phi}_{mu}(sel)", 180, -180., 180.);
00539 sel_muonch = fs->make<TH1F>("sel_muonch", "{chi^2}/ndf(sel)", 100, 0., 1000.);
00540
00541
00542 int nbin = 50;
00543 alow = -2.0;
00544 ahigh = 8.0;
00545
00546 if (m_digiInput) {alow = -10.0; ahigh = 40.;}
00547
00548 float tmpwid = (ahigh-alow)/nbin;
00549 nbn = int(-alow/tmpwid)+1;
00550 if (nbn <0) nbn = 0;
00551 if (nbn>nbin) nbn = nbin;
00552
00553 char name[200];
00554 char title[200];
00555
00556 cout <<"nbin "<< nbin<<" "<<alow<<" "<<ahigh<<" "<<tmpwid<<" "<<nbn<<endl;
00557
00558 for (int i=0; i<15; i++) {
00559
00560 sprintf(title, "sigvsndof_ring%i", i+1);
00561 sigvsevt[i][0] = fs->make<TProfile>(title, title, 50, 0., 50.,-9., 20.);
00562
00563 sprintf(title, "sigvschisq_ring%i", i+1);
00564 sigvsevt[i][1] = fs->make<TProfile>(title, title, 50, 0., 30.,-9., 20.);
00565
00566 sprintf(title, "sigvsth_ring%i", i+1);
00567 sigvsevt[i][2] = fs->make<TProfile>(title, title, 50, .7, 2.4,-9., 20.);
00568
00569 sprintf(title, "sigvsph_ring%i", i+1);
00570 sigvsevt[i][3] = fs->make<TProfile>(title, title, 50, -2.4, -0.7,-9., 20.);
00571
00572 sprintf(title, "sigvstherr_ring%i", i+1);
00573 sigvsevt[i][4] = fs->make<TProfile>(title, title, 50, 0., 0.2,-9., 20.);
00574
00575 sprintf(title, "sigvspherr_ring%i", i+1);
00576 sigvsevt[i][5] = fs->make<TProfile>(title, title, 50, 0., 0.2,-9., 20.);
00577
00578 sprintf(title, "sigvsdircos_ring%i", i+1);
00579 sigvsevt[i][6] = fs->make<TProfile>(title, title, 50, 0.5, 1.,-9., 20.);
00580
00581 sprintf(title, "sigvstrkmm_ring%i", i+1);
00582 sigvsevt[i][7] = fs->make<TProfile>(title, title, 50, 0., 50.,-9., 20.);
00583
00584 sprintf(title, "sigvsnmuon_ring%i", i+1);
00585 sigvsevt[i][8] = fs->make<TProfile>(title, title, 5, 0.5, 5.5,-9., 20.);
00586
00587 sprintf(title, "sigvserr_ring%i", i+1);
00588 sigvsevt[i][9] = fs->make<TProfile>(title, title, 50, 0., .3, -9., 20.);
00589
00590 sprintf(title, "sigvsaccx_ring%i", i+1);
00591 sigvsevt[i][10] = fs->make<TProfile>(title, title, 100, -25., 25., -9., 20.);
00592
00593 sprintf(title, "sigvsaccy_ring%i", i+1);
00594 sigvsevt[i][11] = fs->make<TProfile>(title, title, 100, -25., 25., -9., 20.);
00595
00596 sprintf(title, "sigvscalo_ring%i", i+1);
00597 sigvsevt[i][12] = fs->make<TProfile>(title, title, 100, 0., 15., -9., 20.);
00598 }
00599
00600 for (int j=0; j<netamx; j++) {
00601 int ieta = (j<15) ? j+1 : 14-j;
00602 for (int i=0;i<nphimx+1;i++) {
00603 if (i==nphimx) {
00604 sprintf(title, "sig_eta%i_allphi", ieta);
00605 } else {
00606 sprintf(title, "sig_eta%i_phi%i", ieta,i+1);
00607 }
00608 sigrsg[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00609 if (i==nphimx) {
00610 sprintf(title, "ped_eta%i_allphi", ieta);
00611 } else {
00612 sprintf(title, "ped_eta%i_phi%i", ieta,i+1);
00613 }
00614 crossg[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00615 }
00616
00617 for (int i=0;i<nphimx;i++) {
00618 if (m_hotime) {
00619 sprintf(title, "hotime_eta%i_phi%i", (j<=14) ? j+1 : 14-j, i+1);
00620 hotime[j][i] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
00621
00622 sprintf(title, "hopedtime_eta%i_phi%i", (j<=14) ? j+1 : 14-j, i+1);
00623 hopedtime[j][i] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
00624
00625 }
00626 if (m_hbtime) {
00627 sprintf(title, "hbtime_eta%i_phi%i", (j<=15) ? j+1 : 15-j, i+1);
00628 hbtime[j][i] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
00629 }
00630
00631 if (m_correl) {
00632 sprintf(title, "corrsg_eta%i_phi%i_leftbottom", ieta,i+1);
00633 corrsglb[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00634
00635 sprintf(title, "corrsg_eta%i_phi%i_rightbottom", ieta,i+1);
00636 corrsgrb[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00637
00638 sprintf(title, "corrsg_eta%i_phi%i_leftup", ieta,i+1);
00639 corrsglu[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00640
00641 sprintf(title, "corrsg_eta%i_phi%i_rightup", ieta,i+1);
00642 corrsgru[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00643
00644 sprintf(title, "corrsg_eta%i_phi%i_all", ieta,i+1);
00645 corrsgall[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00646
00647 sprintf(title, "corrsg_eta%i_phi%i_left", ieta,i+1);
00648 corrsgl[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00649
00650 sprintf(title, "corrsg_eta%i_phi%i_right", ieta,i+1);
00651 corrsgr[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00652 }
00653 if (m_checkmap) {
00654 sprintf(title, "corrsg_eta%i_phi%i_centrl", ieta,i+1);
00655 corrsgc[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00656 }
00657 }
00658 }
00659
00660 mnsigrsg = fs->make<TH1F>("mnsigrsg","mnsigrsg", netamx*nphimx+ringmx*routmx, -0.5, netamx*nphimx+ringmx*routmx -0.5);
00661 rmssigrsg = fs->make<TH1F>("rmssigrsg","rmssigrsg", netamx*nphimx+ringmx*routmx, -0.5, netamx*nphimx+ringmx*routmx -0.5);
00662 nevsigrsg = fs->make<TH1F>("nevsigrsg","nevsigrsg", netamx*nphimx+ringmx*routmx, -0.5, netamx*nphimx+ringmx*routmx -0.5);
00663
00664 mncrossg = fs->make<TH1F>("mncrossg","mncrossg", netamx*nphimx+ringmx*routmx, -0.5, netamx*nphimx+ringmx*routmx -0.5);
00665 rmscrossg = fs->make<TH1F>("rmscrossg","rmscrossg", netamx*nphimx+ringmx*routmx, -0.5, netamx*nphimx+ringmx*routmx -0.5);
00666 nevcrossg = fs->make<TH1F>("nevcrossg","nevcrossg", netamx*nphimx+ringmx*routmx, -0.5, netamx*nphimx+ringmx*routmx -0.5);
00667
00668
00669 for (int i=0; i<neffip; i++) {
00670 if (i==0) {
00671 sprintf(title, "Total projected muon in tower");
00672 sprintf(name, "total_evt");
00673 } else {
00674 sprintf(title, "Efficiency with sig >%i #sigma", i);
00675 sprintf(name, "Effi_with_gt%i_sig", i);
00676 }
00677 sig_effi[i] = fs->make<TH2F>(name, title, netamx+1, -netamx/2-0.5, netamx/2+0.5, nphimx, 0.5, nphimx+0.5);
00678 }
00679
00680 sprintf(title, "Mean Energy of all towers");
00681 sprintf(name, "mean_energy");
00682 mean_energy = fs->make<TH2F>(name, title, netamx+1, -netamx/2-0.5, netamx/2+0.5, nphimx, 0.5, nphimx+0.5);
00683
00684 if (m_correl) {
00685 mncorrsglb = fs->make<TH1F>("mncorrsglb","mncorrsglb", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00686 rmscorrsglb = fs->make<TH1F>("rmscorrsglb","rmscorrsglb", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00687 nevcorrsglb = fs->make<TH1F>("nevcorrsglb","nevcorrsglb", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00688
00689 mncorrsgrb = fs->make<TH1F>("mncorrsgrb","mncorrsgrb", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00690 rmscorrsgrb = fs->make<TH1F>("rmscorrsgrb","rmscorrsgrb", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00691 nevcorrsgrb = fs->make<TH1F>("nevcorrsgrb","nevcorrsgrb", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00692
00693 mncorrsglu = fs->make<TH1F>("mncorrsglu","mncorrsglu", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00694 rmscorrsglu = fs->make<TH1F>("rmscorrsglu","rmscorrsglu", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00695 nevcorrsglu = fs->make<TH1F>("nevcorrsglu","nevcorrsglu", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00696
00697 mncorrsgru = fs->make<TH1F>("mncorrsgru","mncorrsgru", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00698 rmscorrsgru = fs->make<TH1F>("rmscorrsgru","rmscorrsgru", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00699 nevcorrsgru = fs->make<TH1F>("nevcorrsgru","nevcorrsgru", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00700
00701 mncorrsgall = fs->make<TH1F>("mncorrsgall","mncorrsgall", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00702 rmscorrsgall = fs->make<TH1F>("rmscorrsgall","rmscorrsgall", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00703 nevcorrsgall = fs->make<TH1F>("nevcorrsgall","nevcorrsgall", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00704
00705 mncorrsgl = fs->make<TH1F>("mncorrsgl","mncorrsgl", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00706 rmscorrsgl = fs->make<TH1F>("rmscorrsgl","rmscorrsgl", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00707 nevcorrsgl = fs->make<TH1F>("nevcorrsgl","nevcorrsgl", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00708
00709 mncorrsgr = fs->make<TH1F>("mncorrsgr","mncorrsgr", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00710 rmscorrsgr = fs->make<TH1F>("rmscorrsgr","rmscorrsgr", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00711 nevcorrsgr = fs->make<TH1F>("nevcorrsgr","nevcorrsgr", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00712 }
00713
00714 if (m_checkmap) {
00715 mncorrsgc = fs->make<TH1F>("mncorrsgc","mncorrsgc", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00716 rmscorrsgc = fs->make<TH1F>("rmscorrsgc","rmscorrsgc", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00717 nevcorrsgc = fs->make<TH1F>("nevcorrsgc","nevcorrsgc", netamx*nphimx+60, -0.5, netamx*nphimx+59.5);
00718 }
00719
00720 if (m_combined) {
00721 for (int j=0; j<ringmx; j++) {
00722
00723 for (int i=0;i<routmx+1;i++) {
00724 if (j!=2 && i>rout12mx) continue;
00725 int phmn = 3*i-1;
00726 int phmx = 3*i+1;
00727 if (j==2) {phmn = 2*i-1; phmx=2*i;}
00728 if (phmn <=0) phmn = nphimx+phmn;
00729 if (phmx <=0) phmx = nphimx+phmx;
00730
00731 if ((j==2 && i==routmx) || (j!=2 && i==rout12mx)) {
00732 sprintf(title, "sig_ring%i_allrm", j-2);
00733 sprintf(name, "sig_ring%i_allrm", j-2);
00734 } else {
00735 sprintf(title, "sig_ring%i_phi%i-%i", j-2,phmn,phmx);
00736 sprintf(name, "sig_ring%i_rout%i", j-2,i+1);
00737 }
00738 com_sigrsg[j][i] = fs->make<TH1F>(name, title, nbin, alow, ahigh);
00739 if ((j==2 && i==routmx) || (j!=2 && i==rout12mx)) {
00740 sprintf(title, "ped_ring%i_allrm", j-2);
00741 sprintf(name, "ped_ring%i_allrm", j-2);
00742 } else {
00743 sprintf(title, "ped_ring%i_phi%i-%i", j-2,phmn, phmx);
00744 sprintf(name, "ped_ring%i_rout%i", j-2,i+1);
00745 }
00746 com_crossg[j][i] = fs->make<TH1F>(name, title, nbin, alow, ahigh);
00747 }
00748
00749 for (int i=0;i<sectmx;i++) {
00750 if (m_hotime) {
00751 sprintf(title, "com_hotime_ring%i_sect%i", j-2, i+1);
00752 com_hotime[j][i] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
00753
00754 sprintf(title, "com_hopedtime_ring%i_sect%i", j-2, i+1);
00755 com_hopedtime[j][i] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
00756 }
00757 if (m_hbtime){
00758 sprintf(title, "_com_hbtime_ring%i_serrct%i", j-2, i+1);
00759 com_hbtime[j][i] = fs->make<TProfile>(title, title, 10, -0.5, 9.5, -1.0, 30.0);
00760 }
00761
00762 if (m_correl) {
00763 sprintf(title, "com_corrsg_ring%i_sect%i_leftbottom", j-2,i+1);
00764 com_corrsglb[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00765
00766 sprintf(title, "com_corrsg_ring%i_sect%i_rightbottom", j-2,i+1);
00767 com_corrsgrb[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00768
00769 sprintf(title, "com_corrsg_ring%i_sect%i_leftup", j-2,i+1);
00770 com_corrsglu[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00771
00772 sprintf(title, "com_corrsg_ring%i_sect%i_rightup", j-2,i+1);
00773 com_corrsgru[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00774
00775 sprintf(title, "com_corrsg_ring%i_sect%i_all", j-2,i+1);
00776 com_corrsgall[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00777
00778 sprintf(title, "com_corrsg_ring%i_sect%i_left", j-2,i+1);
00779 com_corrsgl[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00780
00781 sprintf(title, "com_corrsg_ring%i_sect%i_right", j-2,i+1);
00782 com_corrsgr[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00783 }
00784
00785 if (m_checkmap) {
00786 sprintf(title, "com_corrsg_ring%i_sect%i_centrl", j-2,i+1);
00787 com_corrsgc[j][i] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00788 }
00789 }
00790 }
00791 }
00792
00793 for (int i=-1; i<=1; i++) {
00794 for (int j=-1; j<=1; j++) {
00795 int k = 3*(i+1)+j+1;
00796
00797 sprintf(title, "hosct2p_eta%i_phi%i", i, j);
00798 ho_sig2p[k] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00799
00800 sprintf(title, "hosct1p_eta%i_phi%i", i, j);
00801 ho_sig1p[k] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00802
00803 sprintf(title, "hosct00_eta%i_phi%i", i, j);
00804 ho_sig00[k] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00805
00806 sprintf(title, "hosct1m_eta%i_phi%i", i, j);
00807 ho_sig1m[k] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00808
00809 sprintf(title, "hosct2m_eta%i_phi%i", i, j);
00810 ho_sig2m[k] = fs->make<TH1F>(title, title, nbin, alow, ahigh);
00811
00812 if (m_hbinfo) {
00813 sprintf(title, "hbhesig_eta%i_phi%i", i, j);
00814 hbhe_sig[k] = fs->make<TH1F>(title, title, 51, -10.5, 40.5);
00815 }
00816 }
00817 }
00818
00819 if (m_constant) {
00820 ped_evt = fs->make<TH1F>("ped_evt", "ped_evt", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00821 ped_mean = fs->make<TH1F>("ped_mean", "ped_mean", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00822 ped_width = fs->make<TH1F>("ped_width", "ped_width", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00823
00824 fit_chi = fs->make<TH1F>("fit_chi", "fit_chi", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00825 sig_evt = fs->make<TH1F>("sig_evt", "sig_evt", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00826 fit_sigevt = fs->make<TH1F>("fit_sigevt", "fit_sigevt", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00827 fit_bkgevt = fs->make<TH1F>("fit_bkgevt", "fit_bkgevt", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00828 sig_mean = fs->make<TH1F>("sig_mean", "sig_mean", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00829 sig_diff = fs->make<TH1F>("sig_diff", "sig_diff", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00830 sig_width = fs->make<TH1F>("sig_width", "sig_width", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00831 sig_sigma = fs->make<TH1F>("sig_sigma", "sig_sigma", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00832 sig_meanerr = fs->make<TH1F>("sig_meanerr", "sig_meanerr", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00833 sig_meanerrp = fs->make<TH1F>("sig_meanerrp", "sig_meanerrp", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00834 sig_signf = fs->make<TH1F>("sig_signf", "sig_signf", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00835
00836 ped_statmean = fs->make<TH1F>("ped_statmean", "ped_statmean", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00837 sig_statmean = fs->make<TH1F>("sig_statmean", "sig_statmean", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00838 ped_rms = fs->make<TH1F>("ped_rms", "ped_rms", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00839 sig_rms = fs->make<TH1F>("sig_rms", "sig_rms", netamx*nphimx, -0.5, netamx*nphimx-0.5);
00840
00841 const_eta_phi = fs->make<TH2F>("const_eta_phi", "const_eta_phi", netamx+1, -(netamx+1)/2., (netamx+1)/2., nphimx, 0.5, nphimx+0.5);
00842
00843 for (int ij=0; ij<netamx; ij++) {
00844 int ieta = (ij<15) ? ij+1 : 14-ij;
00845 sprintf(title, "Cont_Eta_%i", ieta);
00846 const_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx+0.5);
00847
00848 sprintf(title, "Peak_Eta_%i", ieta);
00849 peak_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx+0.5);
00850 }
00851
00852 for (int ij=0; ij<ringmx; ij++) {
00853 int iring = ij-2;
00854 int iread = (ij==2) ? routmx : rout12mx;
00855 sprintf(title, "Cont_hpdrm_%i", iring);
00856 const_hpdrm[ij] = fs->make<TH1F>(title, title, iread, 0.5, iread+0.5);
00857
00858 sprintf(title, "Peak_hpdrm_%i", iring);
00859 peak_hpdrm[ij] = fs->make<TH1F>(title, title, iread, 0.5, iread+0.5);
00860 }
00861
00862 mean_phi_hst = fs->make<TH1F>("mean_phi_hst", "mean_phi_hst", netamx+1, -(netamx+1)/2., (netamx+1)/2.);
00863 mean_phi_ave = fs->make<TH1F>("mean_phi_ave", "mean_phi_ave", netamx+1, -(netamx+1)/2., (netamx+1)/2.);
00864
00865 mean_eta_ave = fs->make<TH1F>("mean_eta_ave", "mean_eta_ave", nphimx, 0.5, nphimx+0.5);
00866
00867 }
00868
00869 for (int ij=0; ij<netamx; ij++) {
00870 int ieta = (ij<15) ? ij+1 : 14-ij;
00871
00872 sprintf(title, "Stat_Eta_%i", ieta);
00873 stat_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx+0.5);
00874
00875 sprintf(title, "#mu(stat)_Eta_%i", ieta);
00876 statmn_eta[ij] = fs->make<TH1F>(title, title, nphimx, 0.5, nphimx+0.5);
00877 }
00878
00879 for (int j=0; j<netamx; j++) {
00880 for (int i=0; i<nphimx; i++) {
00881 invang[j][i] = 0.0;
00882 }
00883 }
00884 for (int j=0; j<ringmx; j++) {
00885 for (int i=0;i<routmx+1;i++) {
00886 com_invang[j][i] = 0.0;
00887 }
00888 }
00889
00890 }
00891
00892
00893 HOCalibAnalyzer::~HOCalibAnalyzer()
00894 {
00895
00896
00897
00898
00899 theFile->cd();
00900 theFile->Write();
00901 theFile->Close();
00902 cout <<" Selected events # is "<<ipass<<endl;
00903 }
00904
00905
00906
00907
00908
00909
00910
00911 void
00912 HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00913 {
00914
00915
00916 int mypow_2_0 = 0;
00917 int mypow_2_1 = 2;
00918 int mypow_2_2 = 4;
00919
00920 int mypow_2_3 = 8;
00921 int mypow_2_4 = 16;
00922 int mypow_2_5 = 32;
00923 int mypow_2_6 = 64;
00924 int mypow_2_7 = 128;
00925 int mypow_2_8 = 256;
00926 int mypow_2_9 = 512;
00927 int mypow_2_10 = 1024;
00928 int mypow_2_11 = 2048;
00929 int mypow_2_12 = 4096;
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983 int iaxxx = 0;
00984 int ibxxx = 0;
00985
00986 Nevents++;
00987
00988 using namespace edm;
00989
00990 float pival = acos(-1.);
00991 irunold = irun = iEvent.id().run();
00992 ievt = iEvent.id().event();
00993
00994
00995
00996 edm::Handle<HOCalibVariableCollection>HOCalib;
00997 bool isCosMu = true;
00998 try {
00999 iEvent.getByType(HOCalib);
01000
01001
01002 } catch ( cms::Exception &iEvent ) { isCosMu = false; }
01003
01004 if (isCosMu && (*HOCalib).size() >0 ) {
01005 nmuon = (*HOCalib).size();
01006 if (Nevents%5000==1) cout <<"nmuon event # "<<Nevents<<" Run # "<<iEvent.id().run()<<" Evt # "<<iEvent.id().event()<<" "<<nmuon<<endl;
01007
01008 for (HOCalibVariableCollection::const_iterator hoC=(*HOCalib).begin(); hoC!=(*HOCalib).end(); hoC++){
01009 itrg1 = (*hoC).trig1;
01010 itrg2 = (*hoC).trig2;
01011
01012 trkdr = (*hoC).trkdr;
01013 trkdz = (*hoC).trkdz;
01014
01015 trkvx = (*hoC).trkvx;
01016 trkvy = (*hoC).trkvy;
01017 trkvz = (*hoC).trkvz;
01018
01019 trkmm = (*hoC).trkmm;
01020 trkth = (*hoC).trkth;
01021 trkph = (*hoC).trkph;
01022
01023 ndof = (int)(*hoC).ndof;
01024
01025 chisq = (*hoC).chisq;
01026
01027 therr = (*hoC).therr;
01028 pherr = (*hoC).pherr;
01029 trkph = (*hoC).trkph;
01030
01031 isect = (*hoC).isect;
01032 hodx = (*hoC).hodx;
01033 hody = (*hoC).hody;
01034 hoang = (*hoC).hoang;
01035 htime = (*hoC).htime;
01036 for (int i=0; i<9; i++) { hosig[i] = (*hoC).hosig[i];}
01037 for (int i=0; i<18; i++) { hocorsig[i] = (*hoC).hocorsig[i];}
01038 hocro = (*hoC).hocro;
01039 for (int i=0; i<3; i++) { caloen[i] = (*hoC).caloen[i];}
01040
01041 if (m_hbinfo) { for (int i=0; i<9; i++) { hbhesig[i] = (*hoC).hbhesig[i];}}
01042
01043
01044 int ipsall=0;
01045 int ips0=0;
01046 int ips1=0;
01047 int ips2=0;
01048 int ips3=0;
01049 int ips4=0;
01050 int ips5=0;
01051 int ips6=0;
01052 int ips7=0;
01053 int ips8=0;
01054 int ips9=0;
01055 int ips10 =0;
01056 int ips11 =0;
01057 int ips12 = 0;
01058
01059 int iselect3 = 0;
01060 if (ndof >=15 && chisq <30) iselect3 = 1;
01061
01062 if (isect <0) continue;
01063 if (fabs(trkth-pival/2)<0.000001) continue;
01064
01065 int ieta = int((abs(isect)%10000)/100.)-30;
01066 if (abs(ieta)>=16) continue;
01067 int iphi = abs(isect)%100;
01068
01069 int tmpsect = int((iphi + 1)/6.) + 1;
01070 if (tmpsect >12) tmpsect = 1;
01071
01072 int iring = 0;
01073 int tmpeta = ieta + 4;
01074 if (ieta >=-15 && ieta <=-11) {iring = -2; tmpeta =-11-ieta; }
01075 if (ieta >=-10 && ieta <=-5) {iring = -1; tmpeta =-5-ieta; }
01076 if (ieta >= 5 && ieta <= 10) {iring = 1; tmpeta =ieta-5; }
01077 if (ieta >= 11 && ieta <= 15) {iring = 2; tmpeta =ieta-11;}
01078
01079 int iring2 = iring + 2;
01080
01081 int tmprout = int((iphi + 1)/3.) + 1;
01082 int tmproutmx =routmx;
01083 if (iring==0) {
01084 tmprout = int((iphi + 1)/2.) + 1;
01085 if (tmprout >routmx) tmprout = 1;
01086 } else {
01087 if (tmprout >rout12mx) tmprout = 1;
01088 tmproutmx =rout12mx;
01089 }
01090
01091
01092 if (m_cosmic) {
01093
01094 if (abs(ndof) >=20 && abs(ndof) <40) {ips0 = (int)mypow_2_0; ipsall += ips0;}
01095 if (chisq >0 && chisq<15) {ips1 = (int)mypow_2_1; ipsall +=ips1;}
01096 if (fabs(trkth-pival/2) <21.5) {ips2 = (int)mypow_2_2; ipsall +=ips2;}
01097 if (fabs(trkph+pival/2) <21.5) {ips3 = (int)mypow_2_3; ipsall +=ips3;}
01098
01099 if (therr <0.02) {ips4 = (int)mypow_2_4; ipsall +=ips4;}
01100 if (pherr <0.0002) {ips5 = (int)mypow_2_5; ipsall +=ips5;}
01101 if (fabs(hoang) >0.30) {ips6 = (int)mypow_2_6; ipsall +=ips6;}
01102 if (fabs(trkmm) >0.100) {ips7 = (int)mypow_2_7; ipsall +=ips7;}
01103
01104 if (nmuon >=1 && nmuon <=4) {ips8 = (int)mypow_2_8; ipsall +=ips8;}
01105
01106 if (iring2==2) {
01107 if (fabs(hodx)<100 && fabs(hodx)>2 && fabs(hocorsig[8]) <40 && fabs(hocorsig[8]) >2 )
01108 {ips10=(int)mypow_2_10;ipsall +=ips10;}
01109
01110 if (fabs(hody)<100 && fabs(hody)>2 && fabs(hocorsig[9]) <40 && fabs(hocorsig[9]) >2 )
01111 {ips11=(int)mypow_2_11;ipsall +=ips11;}
01112
01113 } else {
01114 if (fabs(hodx)<100 && fabs(hodx)>2 )
01115 {ips10=(int)mypow_2_10;ipsall +=ips10;}
01116
01117 if (fabs(hody)<100 && fabs(hody)>2)
01118 {ips11=(int)mypow_2_11;ipsall +=ips11;}
01119 }
01120 if (caloen[0] ==0) { ips12=(int)mypow_2_12;ipsall +=ips12;}
01121 } else {
01122
01123 if (abs(ndof) >=20 && abs(ndof) <40) {ips0 = (int)mypow_2_0; ipsall += ips0;}
01124 if (chisq >0 && chisq<15) {ips1 = (int)mypow_2_1; ipsall +=ips1;}
01125 if (fabs(trkth-pival/2) <21.5) {ips2 = (int)mypow_2_2; ipsall +=ips2;}
01126 if (fabs(trkph+pival/2) <21.5) {ips3 = (int)mypow_2_3; ipsall +=ips3;}
01127
01128 if (therr <0.02) {ips4 = (int)mypow_2_4; ipsall +=ips4;}
01129 if (pherr <0.0002) {ips5 = (int)mypow_2_5; ipsall +=ips5;}
01130 if (fabs(hoang) >0.30) {ips6 = (int)mypow_2_6; ipsall +=ips6;}
01131 if (fabs(trkmm) >4.0) {ips7 = (int)mypow_2_7; ipsall +=ips7;}
01132 if (nmuon >=1 && nmuon <=2) {ips8 = (int)mypow_2_8; ipsall +=ips8;}
01133
01134 if (iring2==2) {
01135 if (fabs(hodx)<100 && fabs(hodx)>2 && fabs(hocorsig[8]) <40 && fabs(hocorsig[8]) >2 )
01136 {ips10=(int)mypow_2_10;ipsall +=ips10;}
01137
01138 if (fabs(hody)<100 && fabs(hody)>2 && fabs(hocorsig[9]) <40 && fabs(hocorsig[9]) >2 )
01139 {ips11=(int)mypow_2_11;ipsall +=ips11;}
01140
01141 } else {
01142 if (fabs(hodx)<100 && fabs(hodx)>2 )
01143 {ips10=(int)mypow_2_10;ipsall +=ips10;}
01144
01145 if (fabs(hody)<100 && fabs(hody)>2)
01146 {ips11=(int)mypow_2_11;ipsall +=ips11;}
01147 }
01148
01149 if (ndof >0 && caloen[0]<5.0) {ips12=(int)mypow_2_12;ipsall +=ips12;}
01150
01151 }
01152
01153 if (m_digiInput) {
01154 if (htime >2.5 && htime <6.5) {ips9=(int)mypow_2_9;ipsall +=ips9;}
01155 } else {
01156 if (htime >-40 && htime <60) {ips9=(int)mypow_2_9;ipsall +=ips9;}
01157 }
01158
01159 if (ipsall-ips0==mypow_2_ncut-mypow_2_0-1) sigvsevt[iring2][0]->Fill(abs(ndof), hosig[4]);
01160 if (ipsall-ips1==mypow_2_ncut-mypow_2_1-1) sigvsevt[iring2][1]->Fill(chisq, hosig[4]);
01161 if (ipsall-ips2==mypow_2_ncut-mypow_2_2-1) sigvsevt[iring2][2]->Fill(trkth, hosig[4]);
01162 if (ipsall-ips3==mypow_2_ncut-mypow_2_3-1) sigvsevt[iring2][3]->Fill(trkph, hosig[4]);
01163 if (ipsall-ips4==mypow_2_ncut-mypow_2_4-1) sigvsevt[iring2][4]->Fill(therr, hosig[4]);
01164 if (ipsall-ips5==mypow_2_ncut-mypow_2_5-1) sigvsevt[iring2][5]->Fill(pherr, hosig[4]);
01165 if (ipsall-ips6==mypow_2_ncut-mypow_2_6-1) sigvsevt[iring2][6]->Fill(hoang, hosig[4]);
01166 if (ipsall-ips7==mypow_2_ncut-mypow_2_7-1) sigvsevt[iring2][7]->Fill(fabs(trkmm), hosig[4]);
01167 if (ipsall-ips8==mypow_2_ncut-mypow_2_8-1) sigvsevt[iring2][8]->Fill(nmuon, hosig[4]);
01168 if (ipsall-ips9==mypow_2_ncut-mypow_2_9-1) sigvsevt[iring2][9]->Fill(htime, hosig[4]);
01169 if (ipsall-ips10==mypow_2_ncut-mypow_2_10-1) sigvsevt[iring2][10]->Fill(hodx, hosig[4]);
01170 if (ipsall-ips11==mypow_2_ncut-mypow_2_11-1) sigvsevt[iring2][11]->Fill(hody, hosig[4]);
01171 if (!m_cosmic) {
01172 if (ipsall-ips12==mypow_2_ncut-mypow_2_12-1) sigvsevt[iring2][12]->Fill(caloen[0], hosig[4]);
01173 }
01174
01175 sigvsevt[iring2+5][0]->Fill(abs(ndof), hosig[4]);
01176 if (ips0 >0) {
01177 sigvsevt[iring2+5][1]->Fill(chisq, hosig[4]);
01178 if (ips1 >0) {
01179 sigvsevt[iring2+5][2]->Fill(trkth, hosig[4]);
01180 if (ips2 >0) {
01181 sigvsevt[iring2+5][3]->Fill(trkph, hosig[4]);
01182 if (ips3 >0) {
01183 sigvsevt[iring2+5][4]->Fill(therr, hosig[4]);
01184 if (ips4 >0) {
01185 sigvsevt[iring2+5][5]->Fill(pherr, hosig[4]);
01186 if (ips5 >0) {
01187 sigvsevt[iring2+5][6]->Fill(hoang, hosig[4]);
01188 if (ips6 >0) {
01189 sigvsevt[iring2+5][7]->Fill(fabs(trkmm), hosig[4]);
01190 if (ips7 >0) {
01191 sigvsevt[iring2+5][8]->Fill(nmuon, hosig[4]);
01192 if (ips8 >0) {
01193 sigvsevt[iring2+5][9]->Fill(htime, hosig[4]);
01194 if (ips9 >0) {
01195 sigvsevt[iring2+5][10]->Fill(hodx, hosig[4]);
01196 if (ips10>0) {
01197 sigvsevt[iring2+5][11]->Fill(hody, hosig[4]);
01198 if (ips11>0) {
01199 if (!m_cosmic) sigvsevt[iring2+5][12]->Fill(caloen[0], hosig[4]);
01200 }
01201 }
01202 }
01203 }
01204 }
01205 }
01206 }
01207 }
01208 }
01209 }
01210 }
01211 }
01212
01213 sigvsevt[iring2+10][0]->Fill(abs(ndof), hosig[4]);
01214 sigvsevt[iring2+10][1]->Fill(chisq, hosig[4]);
01215 sigvsevt[iring2+10][2]->Fill(trkth, hosig[4]);
01216 sigvsevt[iring2+10][3]->Fill(trkph, hosig[4]);
01217 sigvsevt[iring2+10][4]->Fill(therr, hosig[4]);
01218 sigvsevt[iring2+10][5]->Fill(pherr, hosig[4]);
01219 sigvsevt[iring2+10][6]->Fill(hoang, hosig[4]);
01220 sigvsevt[iring2+10][7]->Fill(fabs(trkmm), hosig[4]);
01221 sigvsevt[iring2+10][8]->Fill(nmuon, hosig[4]);
01222 sigvsevt[iring2+10][9]->Fill(htime, hosig[4]);
01223 sigvsevt[iring2+10][10]->Fill(hodx, hosig[4]);
01224 sigvsevt[iring2+10][11]->Fill(hody, hosig[4]);
01225 if (!m_cosmic) sigvsevt[iring2+10][12]->Fill(caloen[0], hosig[4]);
01226
01227 int iselect = (ipsall == mypow_2_ncut - 1) ? 1 : 0;
01228
01229 if (hocro !=-100.0 && hocro <-50.0) hocro +=100.;
01230
01231 muonnm->Fill(nmuon);
01232 muonmm->Fill(trkmm);
01233 muonth->Fill(trkth*180/pival);
01234 muonph->Fill(trkph*180/pival);
01235 muonch->Fill(chisq);
01236
01237 if (iselect==1) {
01238 ipass++;
01239 sel_muonnm->Fill(nmuon);
01240 sel_muonmm->Fill(trkmm);
01241 sel_muonth->Fill(trkth*180/pival);
01242 sel_muonph->Fill(trkph*180/pival);
01243 sel_muonch->Fill(chisq);
01244 }
01245
01246 if (iselect3) T1->Fill();
01247
01248 int tmpphi = (iphi + 1)%3;
01249 int npixel = 0;
01250 int itag = -1;
01251 int iflip = 0;
01252 int fact = 2;
01253
01254 if (iring ==0) {
01255 tmpphi = (iphi+1)%2;
01256 if (tmpsect==2 || tmpsect==3 || tmpsect==6 || tmpsect==7 || tmpsect==10 || tmpsect==11) {
01257 npixel = mapx0p[tmpeta][tmpphi];
01258 itag = 2;
01259 } else {
01260 npixel = mapx0m[tmpeta][tmpphi];
01261 itag = 3;
01262 }
01263 } else {
01264 fact = 3;
01265 if (tmpsect%2==1) iflip =1;
01266 if (abs(iring)==1) {
01267 npixel = mapx1[tmpeta][(iflip==0) ? tmpphi : abs(tmpphi-2)];
01268 itag = 1;
01269 } else {
01270 npixel = mapx2[tmpeta][(iflip==0) ? tmpphi : abs(tmpphi-2)];
01271 itag = 0;
01272 }
01273 }
01274
01275 int tmpeta1 = (ieta>0) ? ieta -1 : -ieta +14;
01276
01277
01278 int tmpphi1 = iphi -1 ;
01279
01280 int iselect2=0;
01281 if (hosig[4]!=-100) {
01282 if (m_cosmic) {
01283 if (caloen[2]<=0.0) iselect2=1;
01284 } else {
01285 if (caloen[2]<=3.0) iselect2=1;
01286 }
01287 }
01288
01289
01290
01291
01292 if (iselect2==1) {
01293 int tmpphi2 = iphi - 1;
01294 if (!m_digiInput) { tmpphi2 = (iphi+6 <=nphimx) ? iphi+5 : iphi+5-nphimx;}
01295
01296 int tmpsect2 = int((tmpphi2 + 2)/6.) + 1;
01297 if (tmpsect2 >12) tmpsect2 = 1;
01298
01299 int tmprout2 = int((tmpphi2 + 2)/3.) + 1;
01300 if (iring==0) {
01301 tmprout2 = int((tmpphi2 + 2)/2.) + 1;
01302 if (tmprout2 >routmx) tmprout2 = 1;
01303 } else {
01304 if (tmprout2 >rout12mx) tmprout2 = 1;
01305 }
01306
01307 if (cro_ssg[tmpeta1][tmpphi2].size()<4000) {
01308 if (hocro>alow && hocro<ahigh) {
01309 if (!m_histfit) cro_ssg[tmpeta1][tmpphi2].push_back(hocro);
01310 crossg[tmpeta1][tmpphi2]->Fill(hocro);
01311 }
01312 }
01313
01314 if (tmpphi2 >=0 && tmpphi2 <nphimx) {
01315 crossg[tmpeta1][nphimx]->Fill(hocro);
01316 }
01317 if (m_combined) {
01318 com_crossg[iring2][tmprout2-1]->Fill(hocro);
01319 com_crossg[iring2][tmproutmx]->Fill(hocro);
01320 }
01321 }
01322
01323 if (iselect==1) {
01324 for (int ij=0; ij<neffip; ij++) {
01325 if (ij==0) {
01326 sig_effi[ij]->Fill(ieta, iphi, 1.);
01327 } else {
01328 if (hosig[4] >ij*m_sigma) {
01329 sig_effi[ij]->Fill(ieta, iphi, 1.);
01330 }
01331 }
01332 }
01333
01334 tmpphi1 = iphi - 1;
01335
01336 if (sig_reg[tmpeta1][tmpphi1].size()<4000 ) {
01337 if (hosig[4]>-50&& hosig[4] <15) {
01338 sigrsg[tmpeta1][tmpphi1]->Fill(hosig[4]);
01339 if (!m_histfit && hosig[4]<=ahigh/2.) sig_reg[tmpeta1][tmpphi1].push_back(hosig[4]);
01340 invang[tmpeta1][tmpphi1] += 1./fabs(hoang);
01341 }
01342 }
01343
01344 if (tmpphi1 >=0 && tmpphi1 <nphimx) {
01345 sigrsg[tmpeta1][nphimx]->Fill(hosig[4]);
01346 invang[tmpeta1][nphimx] += 1./fabs(hoang);
01347 }
01348
01349 if (m_combined) {
01350 com_sigrsg[iring2][tmprout-1]->Fill(hosig[4]);
01351 com_invang[iring2][tmprout-1] += 1./fabs(hoang);
01352
01353 com_sigrsg[iring2][tmproutmx]->Fill(hosig[4]);
01354 com_invang[iring2][tmproutmx] += 1./fabs(hoang);
01355 }
01356
01357 if (m_checkmap || m_correl) {
01358 tmpeta = etamap[itag][npixel];
01359 tmpphi = phimap[itag][npixel];
01360 if (tmpeta>=0 && tmpphi >=0) {
01361 if (iflip !=0) tmpphi = abs(tmpphi-2);
01362 if (int((hocorsig[fact*tmpeta+tmpphi]-hosig[4])*10000)/10000.!=0) {
01363 iaxxx++;
01364 cout<<"iring2xxx "<<irun<<" "<<ievt<<" "<<isect<<" "<<iring<<" "<<tmpsect<<" "<<ieta<<" "<<iphi<<" "<<npixel<<" "<<tmpeta<<" "<<tmpphi<<" "<<tmpeta1<<" "<<tmpphi1<<" itag "<<itag<<" "<<iflip<<" "<<fact<<" "<<hocorsig[fact*tmpeta+tmpphi]<<" "<<fact*tmpeta+tmpphi<<" "<<hosig[4]<<" "<<hodx<<" "<<hody<<endl;
01365
01366 for (int i=0; i<18; i++) {cout <<" "<<i<<" "<<hocorsig[i];}
01367 cout<<" ix "<<iaxxx<<" "<<ibxxx<<endl;
01368 } else { ibxxx++; }
01369
01370 corrsgc[tmpeta1][tmpphi1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01371 if (m_combined) {
01372 com_corrsgc[iring2][tmpsect-1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01373 }
01374 }
01375 }
01376
01377 if (m_correl) {
01378 float allcorsig = 0.0;
01379
01380 tmpeta = etamap[itag][npixleft[npixel]];
01381 tmpphi = phimap[itag][npixleft[npixel]];
01382
01383 if (tmpeta>=0 && tmpphi >=0) {
01384 if (iflip !=0) tmpphi = abs(tmpphi-2);
01385 corrsgl[tmpeta1][tmpphi1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01386 allcorsig +=hocorsig[fact*tmpeta+tmpphi];
01387 if (m_combined) {
01388 com_corrsgl[iring2][tmpsect-1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01389 }
01390 }
01391
01392 tmpeta = etamap[itag][npixrigh[npixel]];
01393 tmpphi = phimap[itag][npixrigh[npixel]];
01394 if (tmpeta>=0 && tmpphi >=0) {
01395 if (iflip !=0) tmpphi = abs(tmpphi-2);
01396 corrsgr[tmpeta1][tmpphi1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01397 allcorsig +=hocorsig[fact*tmpeta+tmpphi];
01398 if (m_combined) {
01399 com_corrsgr[iring2][tmpsect-1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01400 }
01401 }
01402
01403 tmpeta = etamap[itag][npixlebt[npixel]];
01404 tmpphi = phimap[itag][npixlebt[npixel]];
01405 if (tmpeta>=0 && tmpphi >=0) {
01406 if (iflip !=0) tmpphi = abs(tmpphi-2);
01407 corrsglb[tmpeta1][tmpphi1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01408 allcorsig +=hocorsig[fact*tmpeta+tmpphi];
01409 if (m_combined){
01410 com_corrsglb[iring2][tmpsect-1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01411 }
01412 }
01413
01414 tmpeta = etamap[itag][npixribt[npixel]];
01415 tmpphi = phimap[itag][npixribt[npixel]];
01416 if (tmpeta>=0 && tmpphi >=0) {
01417 if (iflip !=0) tmpphi = abs(tmpphi-2);
01418 corrsgrb[tmpeta1][tmpphi1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01419 allcorsig +=hocorsig[fact*tmpeta+tmpphi];
01420 if (m_combined) {
01421 com_corrsgrb[iring2][tmpsect-1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01422 }
01423 }
01424
01425 tmpeta = etamap[itag][npixleup[npixel]];
01426 tmpphi = phimap[itag][npixleup[npixel]];
01427 if (tmpeta>=0 && tmpphi >=0) {
01428 if (iflip !=0) tmpphi = abs(tmpphi-2);
01429 corrsglu[tmpeta1][tmpphi1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01430 allcorsig +=hocorsig[fact*tmpeta+tmpphi];
01431 if (m_combined) {
01432 com_corrsglu[iring2][tmpsect-1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01433 }
01434 }
01435
01436 tmpeta = etamap[itag][npixriup[npixel]];
01437 tmpphi = phimap[itag][npixriup[npixel]];
01438 if (tmpeta>=0 && tmpphi >=0) {
01439 if (iflip !=0) tmpphi = abs(tmpphi-2);
01440 corrsgru[tmpeta1][tmpphi1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01441 allcorsig +=hocorsig[fact*tmpeta+tmpphi];
01442 if (m_combined) {
01443 com_corrsgru[iring2][tmpsect-1]->Fill(hocorsig[fact*tmpeta+tmpphi]);
01444 }
01445 }
01446 corrsgall[tmpeta1][tmpphi1]->Fill(allcorsig);
01447 if (m_combined) {
01448 com_corrsgall[iring2][tmpsect-1]->Fill(allcorsig);
01449 }
01450
01451
01452 }
01453 for (int k=0; k<9; k++) {
01454 switch (iring)
01455 {
01456 case 2 : ho_sig2p[k]->Fill(hosig[k]); break;
01457 case 1 : ho_sig1p[k]->Fill(hosig[k]); break;
01458 case 0 : ho_sig00[k]->Fill(hosig[k]); break;
01459 case -1 : ho_sig1m[k]->Fill(hosig[k]); break;
01460 case -2 : ho_sig2m[k]->Fill(hosig[k]); break;
01461 }
01462 if (m_hbinfo) {
01463 hbhe_sig[k]->Fill(hbhesig[k]);
01464
01465 }
01466 }
01467 }
01468 }
01469
01470 }
01471
01472 #ifdef THIS_IS_AN_EVENT_EXAMPLE
01473 Handle<ExampleData> pIn;
01474 iEvent.getByLabel("example",pIn);
01475 #endif
01476
01477 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
01478 ESHandle<SetupData> pSetup;
01479 iSetup.get<SetupRecord>().get(pSetup);
01480 #endif
01481 }
01482
01483
01484
01485 void
01486 HOCalibAnalyzer::beginJob()
01487 {
01488 }
01489
01490
01491 void
01492 HOCalibAnalyzer::endJob() {
01493
01494 theFile->cd();
01495
01496 for (int i=0; i<nphimx; i++) {
01497 for (int j=0; j<netamx; j++) {
01498
01499 nevsigrsg->Fill(netamx*i+j, sigrsg[j][i]->GetEntries());
01500 mnsigrsg->Fill(netamx*i+j, sigrsg[j][i]->GetMean());
01501 rmssigrsg->Fill(netamx*i+j, sigrsg[j][i]->GetRMS());
01502
01503 nevcrossg->Fill(netamx*i+j, crossg[j][i]->GetEntries());
01504 mncrossg->Fill(netamx*i+j, crossg[j][i]->GetMean());
01505 rmscrossg->Fill(netamx*i+j, crossg[j][i]->GetRMS());
01506
01507 if (m_correl) {
01508
01509 nevcorrsglb->Fill(netamx*i+j, corrsglb[j][i]->GetEntries());
01510 mncorrsglb->Fill(netamx*i+j, corrsglb[j][i]->GetMean());
01511 rmscorrsglb->Fill(netamx*i+j, corrsglb[j][i]->GetRMS());
01512
01513 nevcorrsgrb->Fill(netamx*i+j, corrsgrb[j][i]->GetEntries());
01514 mncorrsgrb->Fill(netamx*i+j, corrsgrb[j][i]->GetMean());
01515 rmscorrsgrb->Fill(netamx*i+j, corrsgrb[j][i]->GetRMS());
01516
01517 nevcorrsglu->Fill(netamx*i+j, corrsglu[j][i]->GetEntries());
01518 mncorrsglu->Fill(netamx*i+j, corrsglu[j][i]->GetMean());
01519 rmscorrsglu->Fill(netamx*i+j, corrsglu[j][i]->GetRMS());
01520
01521 nevcorrsgru->Fill(netamx*i+j, corrsgru[j][i]->GetEntries());
01522 mncorrsgru->Fill(netamx*i+j, corrsgru[j][i]->GetMean());
01523 rmscorrsgru->Fill(netamx*i+j, corrsgru[j][i]->GetRMS());
01524
01525 nevcorrsgall->Fill(netamx*i+j, corrsgall[j][i]->GetEntries());
01526 mncorrsgall->Fill(netamx*i+j, corrsgall[j][i]->GetMean());
01527 rmscorrsgall->Fill(netamx*i+j, corrsgall[j][i]->GetRMS());
01528
01529 nevcorrsgl->Fill(netamx*i+j, corrsgl[j][i]->GetEntries());
01530 mncorrsgl->Fill(netamx*i+j, corrsgl[j][i]->GetMean());
01531 rmscorrsgl->Fill(netamx*i+j, corrsgl[j][i]->GetRMS());
01532
01533 nevcorrsgr->Fill(netamx*i+j, corrsgr[j][i]->GetEntries());
01534 mncorrsgr->Fill(netamx*i+j, corrsgr[j][i]->GetMean());
01535 rmscorrsgr->Fill(netamx*i+j, corrsgr[j][i]->GetRMS());
01536 }
01537 if (m_checkmap) {
01538 nevcorrsgc->Fill(netamx*i+j, corrsgc[j][i]->GetEntries());
01539 mncorrsgc->Fill(netamx*i+j, corrsgc[j][i]->GetMean());
01540 rmscorrsgc->Fill(netamx*i+j, corrsgc[j][i]->GetRMS());
01541 }
01542 }
01543 }
01544
01545 if (m_combined) {
01546 for (int j=0; j<ringmx; j++) {
01547 for (int i=0; i<routmx; i++) {
01548 if (j!=2 && i>=rout12mx) continue;
01549 nevsigrsg->Fill(netamx*nphimx+ringmx*i+j, com_sigrsg[j][i]->GetEntries());
01550 mnsigrsg->Fill(netamx*nphimx+ringmx*i+j, com_sigrsg[j][i]->GetMean());
01551 rmssigrsg->Fill(netamx*nphimx+ringmx*i+j, com_sigrsg[j][i]->GetRMS());
01552
01553 nevcrossg->Fill(netamx*nphimx+ringmx*i+j, com_crossg[j][i]->GetEntries());
01554 mncrossg->Fill(netamx*nphimx+ringmx*i+j, com_crossg[j][i]->GetMean());
01555 rmscrossg->Fill(netamx*nphimx+ringmx*i+j, com_crossg[j][i]->GetRMS());
01556 }
01557 }
01558
01559 for (int i=0; i<sectmx; i++) {
01560 for (int j=0; j<ringmx; j++) {
01561 if (m_correl) {
01562 nevcorrsglb->Fill(netamx*nphimx+ringmx*i+j, com_corrsglb[j][i]->GetEntries());
01563 mncorrsglb->Fill(netamx*nphimx+ringmx*i+j, com_corrsglb[j][i]->GetMean());
01564 rmscorrsglb->Fill(netamx*nphimx+ringmx*i+j, com_corrsglb[j][i]->GetRMS());
01565
01566 nevcorrsgrb->Fill(netamx*nphimx+ringmx*i+j, com_corrsgrb[j][i]->GetEntries());
01567 mncorrsgrb->Fill(netamx*nphimx+ringmx*i+j, com_corrsgrb[j][i]->GetMean());
01568 rmscorrsgrb->Fill(netamx*nphimx+ringmx*i+j, com_corrsgrb[j][i]->GetRMS());
01569
01570 nevcorrsglu->Fill(netamx*nphimx+ringmx*i+j, com_corrsglu[j][i]->GetEntries());
01571 mncorrsglu->Fill(netamx*nphimx+ringmx*i+j, com_corrsglu[j][i]->GetMean());
01572 rmscorrsglu->Fill(netamx*nphimx+ringmx*i+j, com_corrsglu[j][i]->GetRMS());
01573
01574 nevcorrsgru->Fill(netamx*nphimx+ringmx*i+j, com_corrsgru[j][i]->GetEntries());
01575 mncorrsgru->Fill(netamx*nphimx+ringmx*i+j, com_corrsgru[j][i]->GetMean());
01576 rmscorrsgru->Fill(netamx*nphimx+ringmx*i+j, com_corrsgru[j][i]->GetRMS());
01577
01578 nevcorrsgall->Fill(netamx*nphimx+ringmx*i+j, com_corrsgall[j][i]->GetEntries());
01579 mncorrsgall->Fill(netamx*nphimx+ringmx*i+j, com_corrsgall[j][i]->GetMean());
01580 rmscorrsgall->Fill(netamx*nphimx+ringmx*i+j, com_corrsgall[j][i]->GetRMS());
01581
01582 nevcorrsgl->Fill(netamx*nphimx+ringmx*i+j, com_corrsgl[j][i]->GetEntries());
01583 mncorrsgl->Fill(netamx*nphimx+ringmx*i+j, com_corrsgl[j][i]->GetMean());
01584 rmscorrsgl->Fill(netamx*nphimx+ringmx*i+j, com_corrsgl[j][i]->GetRMS());
01585
01586 nevcorrsgr->Fill(netamx*nphimx+ringmx*i+j, com_corrsgr[j][i]->GetEntries());
01587 mncorrsgr->Fill(netamx*nphimx+ringmx*i+j, com_corrsgr[j][i]->GetMean());
01588 rmscorrsgr->Fill(netamx*nphimx+ringmx*i+j, com_corrsgr[j][i]->GetRMS());
01589 }
01590 if (m_checkmap) {
01591 nevcorrsgc->Fill(netamx*nphimx+ringmx*i+j, com_corrsgc[j][i]->GetEntries());
01592 mncorrsgc->Fill(netamx*nphimx+ringmx*i+j, com_corrsgc[j][i]->GetMean());
01593 rmscorrsgc->Fill(netamx*nphimx+ringmx*i+j, com_corrsgc[j][i]->GetRMS());
01594 }
01595 }
01596 }
01597 }
01598
01599
01600 for (int i=1; i<neffip; i++) {
01601 sig_effi[i]->Divide(sig_effi[0]);
01602 }
01603 for (int ij=0; ij<netamx; ij++) {
01604 for (int jk = 0; jk <nphimx; jk++) {
01605 int ieta = (ij<15) ? ij+1 : 14-ij;
01606 int iphi = jk+1;
01607 double signal = sigrsg[ij][jk]->GetMean();
01608 mean_energy->Fill(ieta, iphi, signal);
01609 }
01610 }
01611
01612 int irunold = irun;
01613
01614
01615 gStyle->SetOptLogy(0);
01616 gStyle->SetTitleFillColor(10);
01617 gStyle->SetStatColor(10);
01618
01619 gStyle->SetCanvasColor(10);
01620 gStyle->SetOptStat(0);
01621 gStyle->SetOptTitle(1);
01622
01623 gStyle->SetTitleColor(10);
01624 gStyle->SetTitleFontSize(0.09);
01625 gStyle->SetTitleOffset(-0.05);
01626 gStyle->SetTitleBorderSize(1);
01627
01628 gStyle->SetPadColor(10);
01629 gStyle->SetPadBorderMode(0);
01630 gStyle->SetStatColor(10);
01631 gStyle->SetPadBorderMode(0);
01632 gStyle->SetStatBorderSize(1);
01633 gStyle->SetStatFontSize(.07);
01634
01635 gStyle->SetStatStyle(1001);
01636 gStyle->SetOptFit(101);
01637 gStyle->SetCanvasColor(10);
01638 gStyle->SetCanvasBorderMode(0);
01639
01640 gStyle->SetStatX(.99);
01641 gStyle->SetStatY(.99);
01642 gStyle->SetStatW(.45);
01643 gStyle->SetStatH(.16);
01644 gStyle->SetLabelSize(0.075,"XY");
01645 gStyle->SetLabelOffset(0.21,"XYZ");
01646 gStyle->SetTitleSize(0.065,"XY");
01647 gStyle->SetTitleOffset(0.06,"XYZ");
01648 gStyle->SetPadTopMargin(.09);
01649 gStyle->SetPadBottomMargin(0.11);
01650 gStyle->SetPadLeftMargin(0.12);
01651 gStyle->SetPadRightMargin(0.15);
01652 gStyle->SetPadGridX(3);
01653 gStyle->SetPadGridY(3);
01654 gStyle->SetGridStyle(2);
01655 gStyle->SetNdivisions(303,"XY");
01656
01657 gStyle->SetMarkerSize(0.60);
01658 gStyle->SetMarkerColor(2);
01659 gStyle->SetMarkerStyle(20);
01660 gStyle->SetTitleFontSize(0.07);
01661
01662 char out_file[200];
01663 int xsiz = 700;
01664 int ysiz = 500;
01665
01666 TCanvas *c2 = new TCanvas("c2", "Statistics and efficiency", xsiz, ysiz);
01667 c2->Divide(2,1);
01668 for (int ij=0; ij<neffip; ij=ij+3) {
01669 sig_effi[ij]->GetXaxis()->SetTitle("#eta");
01670 sig_effi[ij]->GetXaxis()->SetTitleSize(0.075);
01671 sig_effi[ij]->GetXaxis()->SetTitleOffset(0.65);
01672 sig_effi[ij]->GetXaxis()->CenterTitle();
01673 sig_effi[ij]->GetXaxis()->SetLabelSize(0.055);
01674 sig_effi[ij]->GetXaxis()->SetLabelOffset(0.001);
01675
01676 sig_effi[ij]->GetYaxis()->SetTitle("#phi");
01677 sig_effi[ij]->GetYaxis()->SetTitleSize(0.075);
01678 sig_effi[ij]->GetYaxis()->SetTitleOffset(0.9);
01679 sig_effi[ij]->GetYaxis()->CenterTitle();
01680 sig_effi[ij]->GetYaxis()->SetLabelSize(0.055);
01681 sig_effi[ij]->GetYaxis()->SetLabelOffset(0.01);
01682
01683 c2->cd(int(ij/3.)+1); sig_effi[ij]->Draw("colz");
01684 }
01685 sprintf(out_file, "comb_hosig_evt_%i.jpg",irunold);
01686 c2->SaveAs(out_file);
01687
01688 gStyle->SetTitleFontSize(0.045);
01689 gStyle->SetPadRightMargin(0.1);
01690 gStyle->SetPadLeftMargin(0.1);
01691 gStyle->SetPadBottomMargin(0.12);
01692
01693 TCanvas *c1 = new TCanvas("c1", "Mean signal in each tower", xsiz, ysiz);
01694
01695 mean_energy->GetXaxis()->SetTitle("#eta");
01696 mean_energy->GetXaxis()->SetTitleSize(0.075);
01697 mean_energy->GetXaxis()->SetTitleOffset(0.65);
01698 mean_energy->GetXaxis()->CenterTitle();
01699 mean_energy->GetXaxis()->SetLabelSize(0.045);
01700 mean_energy->GetXaxis()->SetLabelOffset(0.001);
01701
01702 mean_energy->GetYaxis()->SetTitle("#phi");
01703 mean_energy->GetYaxis()->SetTitleSize(0.075);
01704 mean_energy->GetYaxis()->SetTitleOffset(0.5);
01705 mean_energy->GetYaxis()->CenterTitle();
01706 mean_energy->GetYaxis()->SetLabelSize(0.045);
01707 mean_energy->GetYaxis()->SetLabelOffset(0.01);
01708
01709 mean_energy->Draw("colz");
01710 sprintf(out_file, "homean_energy_%i.jpg",irunold);
01711 c1->SaveAs(out_file);
01712
01713 delete c1;
01714 delete c2;
01715
01716 gStyle->SetPadBottomMargin(0.14);
01717 gStyle->SetPadLeftMargin(0.17);
01718 gStyle->SetPadRightMargin(0.03);
01719
01720 gStyle->SetOptStat(1110);
01721
01722 const int nsample =8;
01723 TF1* gx0[nsample]={0};
01724 TF1* ped0fun[nsample]={0};
01725 TF1* signal[nsample]={0};
01726 TF1* pedfun[nsample]={0};
01727 TF1* sigfun[nsample]={0};
01728 TF1* signalx[nsample]={0};
01729
01730 TH1F* signall[nsample]={0};
01731 TH1F* pedstll[nsample]={0};
01732
01733 if (m_constant) {
01734
01735 gStyle->SetOptFit(101);
01736 gStyle->SetCanvasBorderMode(0);
01737 gStyle->SetPadBorderMode(0);
01738 gStyle->SetStatBorderSize(1);
01739 gStyle->SetStatStyle(1001);
01740 gStyle->SetTitleColor(10);
01741 gStyle->SetTitleFontSize(0.09);
01742 gStyle->SetTitleOffset(-0.05);
01743 gStyle->SetTitleBorderSize(1);
01744
01745 gStyle->SetCanvasColor(10);
01746 gStyle->SetPadColor(10);
01747 gStyle->SetStatColor(10);
01748 gStyle->SetStatFontSize(.07);
01749 gStyle->SetStatX(0.99);
01750 gStyle->SetStatY(0.99);
01751 gStyle->SetStatW(0.30);
01752 gStyle->SetStatH(0.10);
01753 gStyle->SetTitleSize(0.065,"XYZ");
01754 gStyle->SetLabelSize(0.075,"XYZ");
01755 gStyle->SetLabelOffset(0.012,"XYZ");
01756 gStyle->SetPadGridX(1);
01757 gStyle->SetPadGridY(1);
01758 gStyle->SetGridStyle(3);
01759 gStyle->SetNdivisions(101,"XY");
01760 gStyle->SetOptLogy(0);
01761 int iiter = 0;
01762
01763
01764 ofstream file_out(theoutputtxtFile.c_str());
01765
01766 int ips=111;
01767 TPostScript ps(theoutputpsFile.c_str(),ips);
01768 ps.Range(20,28);
01769
01770 xsiz = 900;
01771 ysiz = 1200;
01772 TCanvas *c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz);
01773
01774 float mean_eta[nphimx];
01775 float mean_phi[netamx];
01776 float rms_eta[nphimx];
01777 float rms_phi[netamx];
01778
01779 for (int ij=0; ij<nphimx; ij++) {mean_phi[ij] = rms_phi[ij] =0;}
01780 for (int ij=0; ij<netamx; ij++) {mean_eta[ij] = rms_eta[ij] =0;}
01781
01782 int mxeta = 0;
01783 int mxphi = 0;
01784 int mneta = 0;
01785 int mnphi = 0;
01786
01787
01788
01789
01790
01791
01792 for (int iijj = 0; iijj <4; iijj++) {
01793
01794 if (iijj==0){
01795 mxeta = ringmx; mxphi = 1; mneta = 0; mnphi = 0;
01796 } else if (iijj==1) {
01797 mxeta = ringmx; mxphi = routmx;
01798 mneta = 0; mnphi = 0;
01799 } else if (iijj==2) {
01800 mxeta = netamx; mxphi = 1; mneta = 0; mnphi = 0;
01801 } else if (iijj==3) {
01802 mxeta = netamx; mxphi = nphimx;
01803 mneta = 0; mnphi = 0;
01804 }
01805
01806 for (int jk=mneta; jk<mxeta; jk++) {
01807 for (int ij=mnphi; ij<mxphi; ij++) {
01808 if (iijj==1) continue;
01809 if ((iijj==0 || iijj==1) && jk !=2 && ij >=rout12mx) continue;
01810 int izone = iiter%nsample;
01811
01812 if (iijj==0) {
01813 int iread = (jk==2) ? routmx : rout12mx;
01814 signall[izone] = (TH1F*)com_sigrsg[jk][iread]->Clone("hnew");
01815 pedstll[izone] = (TH1F*)com_crossg[jk][iread]->Clone("hnew");
01816 } else if (iijj==1) {
01817 signall[izone] = (TH1F*)com_sigrsg[jk][ij]->Clone("hnew");
01818 pedstll[izone] = (TH1F*)com_crossg[jk][ij]->Clone("hnew");
01819 } else if (iijj==2) {
01820 signall[izone] = (TH1F*)sigrsg[jk][nphimx]->Clone("hnew");
01821 pedstll[izone] = (TH1F*)crossg[jk][nphimx]->Clone("hnew");
01822 } else if (iijj==3) {
01823 signall[izone] = (TH1F*)sigrsg[jk][ij]->Clone("hnew");
01824 pedstll[izone] = (TH1F*)crossg[jk][ij]->Clone("hnew");
01825 }
01826
01827 pedstll[izone]->SetLineWidth(2);
01828 signall[izone]->SetLineWidth(2);
01829 pedstll[izone]->SetLineColor(2);
01830 signall[izone]->SetLineColor(4);
01831 pedstll[izone]->SetNdivisions(506,"XY");
01832 signall[izone]->SetNdivisions(506,"XY");
01833
01834 signall[izone]->GetXaxis()->SetLabelSize(.065);
01835 signall[izone]->GetYaxis()->SetLabelSize(.06);
01836 if (m_digiInput) {
01837 signall[izone]->GetXaxis()->SetTitle("Signal (fC)");
01838 } else {
01839 signall[izone]->GetXaxis()->SetTitle("Signal (GeV)");
01840 }
01841 signall[izone]->GetXaxis()->SetTitleSize(.065);
01842 signall[izone]->GetXaxis()->CenterTitle();
01843
01844 if (izone==0) {
01845 ps.NewPage();
01846 c0->Divide(4,4);
01847 }
01848 c0->cd(2*izone+1);
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879 float mean = pedstll[izone]->GetMean();
01880 float rms = pedstll[izone]->GetRMS();
01881 if (m_digiInput) {
01882 if (rms <0.6) rms = 0.6;
01883 if (rms >1.2) rms = 1.2;
01884 if (mean >1.2) mean = 1.2;
01885 if (mean <-1.2) mean = -1.2;
01886 } else {
01887 if (rms <0.10) rms = 0.10;
01888 if (rms >0.15) rms=0.15;
01889 if (mean >0.20) mean = 0.20;
01890 if (mean <-0.20) mean = -0.20;
01891 }
01892 float xmn = mean-6.*rms;
01893 float xmx = mean+6.*rms;
01894
01895 binwid = pedstll[izone]->GetBinWidth(1);
01896 if (xmx > pedstll[izone]->GetXaxis()->GetXmax()) xmx = pedstll[izone]->GetXaxis()->GetXmax()-0.5*binwid;
01897 if (xmn < pedstll[izone]->GetXaxis()->GetXmin()) xmn = pedstll[izone]->GetXaxis()->GetXmin()+0.5*binwid;
01898
01899 float height = pedstll[izone]->GetEntries();
01900
01901 double par[nbgpr] ={height, mean, 0.75*rms};
01902
01903 double gaupr[nbgpr];
01904 double parer[nbgpr];
01905
01906 ietafit = jk;
01907 iphifit = ij;
01908 pedstll[izone]->GetXaxis()->SetLabelSize(.065);
01909 pedstll[izone]->GetYaxis()->SetLabelSize(.06);
01910
01911
01912
01913
01914 pedstll[izone]->GetXaxis()->SetRangeUser(xmn, xmx);
01915
01916
01917 if (m_digiInput) {
01918 if (iijj==0) {
01919 pedstll[izone]->GetXaxis()->SetTitle("Pedestal/Signal (fC)");
01920 } else {
01921 pedstll[izone]->GetXaxis()->SetTitle("Pedestal (fC)");
01922 }
01923 } else {
01924 if (iijj==0) {
01925 pedstll[izone]->GetXaxis()->SetTitle("Pedestal/Signal (GeV)");
01926 } else {
01927 pedstll[izone]->GetXaxis()->SetTitle("Pedestal (GeV)");
01928 }
01929 }
01930 pedstll[izone]->GetXaxis()->SetTitleSize(.065);
01931 pedstll[izone]->GetXaxis()->CenterTitle();
01932
01933
01934 pedstll[izone]->Draw();
01935 if (m_pedsuppr && !m_digiInput) {
01936 gaupr[0] = 0;
01937 gaupr[1] = 0.0;
01938 if (m_digiInput) {
01939 gaupr[2] = 0.90;
01940 } else {
01941 gaupr[2] = 0.15;
01942 }
01943 parer[0] = parer[1] = parer[2] = 0;
01944 } else {
01945
01946 if (pedstll[izone]->GetEntries() >5) {
01947
01948 if ((iijj!=3) || m_histfit) {
01949 char temp[20];
01950 sprintf(temp, "gx0_%i",izone);
01951 gx0[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
01952 gx0[izone]->SetParameters(par);
01953 gx0[izone]->SetLineWidth(1);
01954 pedstll[izone]->Fit(gx0[izone], "R+");
01955
01956 for (int k=0; k<nbgpr; k++) {
01957 parer[k] = gx0[izone]->GetParError(k);
01958 gaupr[k] = gx0[izone]->GetParameter(k);
01959 }
01960 } else {
01961 double strt[nbgpr] = {height, mean, 0.75*rms};
01962 double step[nbgpr] = {1.0, 0.001, 0.001};
01963 double alowmn[nbgpr] = {0.5*height, mean-rms, 0.3*rms};
01964 double ahighmn[nbgpr] ={1.5*height, mean+rms, 1.5*rms};
01965
01966 TMinuit *gMinuit = new TMinuit(nbgpr);
01967 gMinuit->SetFCN(fcnbg);
01968
01969 double arglist[10];
01970 int ierflg = 0;
01971 arglist[0] =0.5;
01972 gMinuit->mnexcm("SET ERR", arglist, 1, ierflg);
01973 char name[100];
01974 for (int k=0; k<nbgpr; k++) {
01975 sprintf(name, "pedpar%i",k);
01976 gMinuit->mnparm(k, name, strt[k], step[k], alowmn[k], ahighmn[k],ierflg);
01977 }
01978
01979 arglist[0] = 0;
01980 gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg);
01981
01982 arglist[0] = 0;
01983 gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg);
01984
01985 TString chnam;
01986 double parv,err,xlo,xup, plerr, mierr, eparab, gcc;
01987 int iuit;
01988
01989 for (int k=0; k<nbgpr; k++) {
01990 if (step[k] >-10) {
01991 gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit);
01992 gMinuit->mnerrs(k, plerr, mierr, eparab, gcc);
01993
01994 if (k==0) {
01995 gaupr[k] = parv*binwid;
01996 parer[k] = err*binwid;
01997 } else {
01998 gaupr[k] = parv;
01999 parer[k] = err;
02000 }
02001 }
02002 }
02003
02004
02005
02006 char temp[20];
02007 sprintf(temp, "ped0fun_%i",izone);
02008 ped0fun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
02009 ped0fun[izone]->SetParameters(gaupr);
02010 ped0fun[izone]->SetLineColor(3);
02011 ped0fun[izone]->SetLineWidth(1);
02012 ped0fun[izone]->Draw("same");
02013
02014 delete gMinuit;
02015 }
02016 } else {
02017 for (int k=0; k<nbgpr; k++) {gaupr[k] = par[k]; }
02018 if (m_digiInput) { gaupr[2] = 0.90; } else { gaupr[2] = 0.15;}
02019 }
02020 }
02021
02022 c0->cd(2*izone+2);
02023 if (signall[izone]->GetEntries() >5) {
02024 Double_t parall[nsgpr];
02025 double parserr[nsgpr];
02026 double fitres[nsgpr];
02027 double pedht = 0;
02028
02029 char temp[20];
02030 sprintf(temp, "signal_%i",izone);
02031 xmn = signall[izone]->GetXaxis()->GetXmin();
02032 xmx = 0.5*signall[izone]->GetXaxis()->GetXmax();
02033 signal[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr);
02034 xmx *=2.0;
02035 if ((iijj!=3) || m_histfit) {
02036 pedht = (signall[izone]->GetBinContent(nbn-1)+
02037 signall[izone]->GetBinContent(nbn)+
02038 signall[izone]->GetBinContent(nbn+1))/3.;
02039
02040 if (m_pedsuppr && !m_digiInput) {
02041 parall[1] = 0.0;
02042 if (m_digiInput) { parall[2] = 0.90; } else { parall[2] = 0.15;}
02043 } else {
02044 for (int i=0; i<nbgpr; i++) {parall[i] = gaupr[i];}
02045 }
02046
02047 set_mean(parall[1], m_digiInput);
02048 set_sigma(parall[2], m_digiInput);
02049
02050 parall[0] = 0.9*pedht;
02051 parall[3] = 0.14;
02052 double area = binwid*signall[izone]->GetEntries();
02053 parall[5]= area;
02054
02055 if (iijj==3) {
02056 parall[4] = fitprm[4][jk];
02057 parall[6] = fitprm[6][jk];
02058 } else {
02059 parall[4] = signall[izone]->GetMean();
02060 parall[6]=parall[2];
02061 }
02062
02063 signal[izone]->SetParameters(parall);
02064 signal[izone]->FixParameter(1, parall[1]);
02065 signal[izone]->FixParameter(2, parall[2]);
02066 signal[izone]->SetParLimits(0, 0.00, 2.0*pedht+0.1);
02067 signal[izone]->FixParameter(3, 0.14);
02068
02069 signal[izone]->SetParLimits(5, 0.40*area, 1.15*area);
02070
02071 if (iijj==3) {
02072 signal[izone]->SetParLimits(4, 0.2*fitprm[4][jk], 2.0*fitprm[4][jk]);
02073 signal[izone]->SetParLimits(6, 0.2*fitprm[6][jk], 2.0*fitprm[6][jk]);
02074 } else {
02075 if (m_digiInput) {
02076 signal[izone]->SetParLimits(4, 0.6, 6.0);
02077 signal[izone]->SetParLimits(6, 0.60, 3.0);
02078 } else {
02079 signal[izone]->SetParLimits(4, 0.1, 1.0);
02080 signal[izone]->SetParLimits(6, 0.035, 0.3);
02081 }
02082 }
02083 signal[izone]->SetParNames("const", "mean", "sigma","Width","MP","Area","GSigma");
02084 signall[izone]->Fit(signal[izone], "0R+");
02085
02086 signall[izone]->GetXaxis()->SetRangeUser(xmn,xmx);
02087 for (int k=0; k<nsgpr; k++) {
02088 fitres[k] = fitprm[k][jk] = signal[izone]->GetParameter(k);
02089 parserr[k] = signal[izone]->GetParError(k);
02090 }
02091
02092 } else {
02093 double pedhtx = 0;
02094 for (unsigned i =0; i<sig_reg[ietafit][iphifit].size(); i++) {
02095 if (sig_reg[ietafit][iphifit][i] >gaupr[1]-3*gaupr[2] && sig_reg[ietafit][iphifit][i]<gaupr[1]+gaupr[2]) pedhtx++;
02096 }
02097
02098 set_mean(gaupr[1], m_digiInput);
02099 set_sigma(gaupr[2], m_digiInput);
02100
02101 TString name[nsgpr] = {"const", "mean", "sigma","Width","MP","Area","GSigma"};
02102 double strt[nsgpr] = {0.9*pedhtx, gaupr[1], gaupr[2], fitprm[3][jk], fitprm[4][jk], signall[izone]->GetEntries(), fitprm[6][jk]};
02103 double alowmn[nsgpr] = {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]};
02104 double ahighmn[nsgpr] ={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]};
02105 double step[nsgpr] = {1.0, 0.0, 0.0, 0.0, 0.001, 1.0, 0.002};
02106
02107 TMinuit *gMinuit = new TMinuit(nsgpr);
02108 gMinuit->SetFCN(fcnsg);
02109
02110 double arglist[10];
02111 int ierflg = 0;
02112 arglist[0] =0.5;
02113 gMinuit->mnexcm("SET ERR", arglist, 1, ierflg);
02114
02115 for (int k=0; k<nsgpr; k++) {
02116 gMinuit->mnparm(k, name[k], strt[k], step[k], alowmn[k], ahighmn[k],ierflg);
02117 }
02118
02119 arglist[0] = 0;
02120 gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg);
02121
02122 arglist[0] = 0;
02123 gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg);
02124
02125 TString chnam;
02126 double parv,err,xlo,xup, plerr, mierr, eparab, gcc;
02127 int iuit;
02128
02129 for (int k=0; k<nsgpr; k++) {
02130 if (step[k] >-10) {
02131 gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit);
02132 gMinuit->mnerrs(k, plerr, mierr, eparab, gcc);
02133 if (k==0 || k==5) {
02134 fitres[k] = parv*binwid;
02135 parserr[k]= err*binwid;
02136 } else {
02137 fitres[k] = parv;
02138 parserr[k]= err;
02139 }
02140
02141 }
02142 }
02143
02144 delete gMinuit;
02145 }
02146
02147
02148
02149
02150 signall[izone]->Draw();
02151
02152
02153 sprintf(temp, "pedfun_%i",izone);
02154 pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr);
02155 pedfun[izone]->SetParameters(fitres);
02156 pedfun[izone]->SetLineColor(3);
02157 pedfun[izone]->SetLineWidth(1);
02158 pedfun[izone]->Draw("same");
02159
02160 sprintf(temp, "signalfun_%i",izone);
02161 sigfun[izone] = new TF1(temp, langaufun, xmn, xmx, nsgpr-nbgpr);
02162 sigfun[izone]->SetParameters(&fitres[3]);
02163 sigfun[izone]->SetLineWidth(1);
02164 sigfun[izone]->SetLineColor(4);
02165 sigfun[izone]->Draw("same");
02166
02167 sprintf(temp, "total_%i",izone);
02168 signalx[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr);
02169 signalx[izone]->SetParameters(fitres);
02170 signalx[izone]->SetLineWidth(1);
02171 signalx[izone]->Draw("same");
02172
02173 int kl = (jk<15) ? jk+1 : 14-jk;
02174
02175 cout<<"histinfo"<<iijj<<" fit "
02176 <<std::setw(3)<< kl<<" "
02177 <<std::setw(3)<< ij+1<<" "
02178 <<std::setw(5)<<pedstll[izone]->GetEntries()<<" "
02179 <<std::setw(6)<<pedstll[izone]->GetMean()<<" "
02180 <<std::setw(6)<<pedstll[izone]->GetRMS()<<" "
02181 <<std::setw(5)<<signall[izone]->GetEntries()<<" "
02182 <<std::setw(6)<<signall[izone]->GetMean()<<" "
02183 <<std::setw(6)<<signall[izone]->GetRMS()<<" "
02184 <<std::setw(6)<< signal[izone]->GetChisquare()<<" "
02185 <<std::setw(3)<< signal[izone]->GetNDF()<<endl;
02186
02187 file_out<<"histinfo"<<iijj<<" fit "
02188 <<std::setw(3)<< kl<<" "
02189 <<std::setw(3)<< ij+1<<" "
02190 <<std::setw(5)<<pedstll[izone]->GetEntries()<<" "
02191 <<std::setw(6)<<pedstll[izone]->GetMean()<<" "
02192 <<std::setw(6)<<pedstll[izone]->GetRMS()<<" "
02193 <<std::setw(5)<<signall[izone]->GetEntries()<<" "
02194 <<std::setw(6)<<signall[izone]->GetMean()<<" "
02195 <<std::setw(6)<<signall[izone]->GetRMS()<<" "
02196 <<std::setw(6)<< signal[izone]->GetChisquare()<<" "
02197 <<std::setw(3)<< signal[izone]->GetNDF()<<endl;
02198
02199 file_out <<"fitres x"<<iijj<<" "<<kl<<" "<<ij+1<<" "<< fitres[0]<<" "<< fitres[1]<<" "<< fitres[2]<<" "<< fitres[3]<<" "<< fitres[4]<<" "<< fitres[5]<<" "<< fitres[6]<<endl;
02200 file_out <<"parserr"<<iijj<<" "<<kl<<" "<<ij+1<<" "<< parserr[0]<<" "<< parserr[1]<<" "<< parserr[2]<<" "<< parserr[3]<<" "<< parserr[4]<<" "<< parserr[5]<<" "<< parserr[6]<<endl;
02201
02202 double diff=fitres[4]-fitres[1];
02203 if (diff <=0) diff = 0.000001;
02204 double error=parserr[4]*parserr[4]+parer[2]*parer[2];
02205 error = pow(error,0.5);
02206
02207 int ieta = (jk<15) ? (15+jk) : (29-jk);
02208 int ifl = nphimx*ieta + ij;
02209
02210 if (iijj==3) {
02211 ped_evt->Fill(ifl,pedstll[izone]->GetEntries());
02212 ped_mean->Fill(ifl,gaupr[1]);
02213 ped_width->Fill(ifl,gaupr[2]);
02214 fit_chi->Fill(ifl,signal[izone]->GetChisquare());
02215 sig_evt->Fill(ifl, signall[izone]->GetEntries());
02216 fit_sigevt->Fill(ifl, fitres[5]);
02217 fit_bkgevt->Fill(ifl, fitres[0]*sqrt(2*acos(-1.))*gaupr[2]);
02218 sig_mean->Fill(ifl, fitres[4]);
02219 sig_diff->Fill(ifl, fitres[4]-fitres[1]);
02220 sig_width->Fill(ifl, fitres[3]);
02221 sig_sigma->Fill(ifl, fitres[6]);
02222 sig_meanerr->Fill(ifl, parserr[4]);
02223 if (fitres[4]-fitres[1] !=0) sig_meanerrp->Fill(ifl, 100*parserr[4]/(fitres[4]-fitres[1]));
02224 if (gaupr[2]!=0) sig_signf->Fill(ifl,(fitres[4]-fitres[1])/gaupr[2]);
02225
02226 ped_statmean->Fill(ifl,pedstll[izone]->GetMean());
02227 sig_statmean->Fill(ifl,signall[izone]->GetMean());
02228 ped_rms->Fill(ifl,pedstll[izone]->GetRMS());
02229 sig_rms->Fill(ifl,signall[izone]->GetRMS());
02230 }
02231
02232 if ((iijj==2) || (iijj==3) || (iijj==1)) {
02233 if (signall[izone]->GetEntries() >5 && fitres[4]>0.1) {
02234
02235 float fact=0.812;
02236 if (abs(kl)<=4) fact=0.895;
02237 if (!m_digiInput) fact *=0.19;
02238
02239 float fact2 = 0;
02240 if (iijj==2) fact2 = invang[jk][nphimx];
02241 if (iijj==3) fact2 = invang[jk][ij];
02242 if (iijj==1) fact2 = com_invang[jk][ij];
02243
02244 float calibc = fact*fact2/(fitres[4]*signall[izone]->GetEntries());
02245 float caliberr= TMath::Abs(calibc*parserr[4]/max(0.001,fitres[4]));
02246
02247 if (iijj==2) {
02248 int ieta = (jk<15) ? jk+1 : 14-jk;
02249 mean_phi_hst->Fill(ieta, calibc);
02250 mean_phi_hst->SetBinError(mean_phi_hst->FindBin(ieta), caliberr);
02251 file_out<<"intieta "<<jk<<" "<<ij<<" "<<ieta<<" "<<mean_phi_hst->FindBin(double(ieta))<<" "<<calibc<<" "<<caliberr<<endl;
02252 } else if (iijj==3) {
02253 const_eta[jk]->Fill(ij+1,calibc);
02254 const_eta[jk]->SetBinError(const_eta[jk]->FindBin(ij+1), caliberr);
02255
02256 peak_eta[jk]->Fill(ij+1,fitres[4]);
02257 peak_eta[jk]->SetBinError(peak_eta[jk]->FindBin(ij+1),parserr[4]);
02258
02259 int ieta = (jk<15) ? jk+1 : 14-jk;
02260 const_eta_phi->Fill(ieta, ij+1,calibc);
02261 file_out<<"intietax "<<jk<<" "<<ij<<" "<<ieta<<" "<<const_eta_phi->FindBin(ieta, ij+1)<<endl;
02262 if (caliberr >0) {
02263 const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij+1),caliberr);
02264
02265 mean_eta[ij] +=calibc/(caliberr*caliberr);
02266 mean_phi[jk] +=calibc/(caliberr*caliberr);
02267
02268 rms_eta[ij] +=1./(caliberr*caliberr);
02269 rms_phi[jk] +=1./(caliberr*caliberr);
02270
02271 } else {
02272 const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij+1), 0.0);
02273 }
02274 } else if (iijj==1) {
02275 const_hpdrm[jk]->Fill(ij+1,calibc);
02276 const_hpdrm[jk]->SetBinError(const_hpdrm[jk]->FindBin(ij+1), caliberr);
02277
02278 peak_hpdrm[jk]->Fill(ij+1,fitres[4]);
02279 peak_hpdrm[jk]->SetBinError(peak_hpdrm[jk]->FindBin(ij+1),parserr[4]);
02280 }
02281
02282 file_out<<"HO 4 "<<iijj<<" "<< std::setw(3)<<kl<<" "<<std::setw(3)<<ij+1<<" "
02283 <<std::setw(7)<<calibc<<" "<<std::setw(7)<<caliberr<<endl;
02284 }
02285 }
02286
02287 } else {
02288 signall[izone]->Draw();
02289 float varx = 0.000;
02290 int kl = (jk<15) ? jk+1 : 14-jk;
02291 file_out<<"histinfo"<<iijj<<" nof "
02292 <<std::setw(3)<< kl<<" "
02293 <<std::setw(3)<< ij+1<<" "
02294 <<std::setw(5)<<pedstll[izone]->GetEntries()<<" "
02295 <<std::setw(6)<<pedstll[izone]->GetMean()<<" "
02296 <<std::setw(6)<<pedstll[izone]->GetRMS()<<" "
02297 <<std::setw(5)<<signall[izone]->GetEntries()<<" "
02298 <<std::setw(6)<<signall[izone]->GetMean()<<" "
02299 <<std::setw(6)<<signall[izone]->GetRMS()<<" "
02300 <<std::setw(6)<< varx<<" "
02301 <<std::setw(3)<< varx<<endl;
02302
02303 file_out <<"fitres x"<<iijj<<" "<<kl<<" "<<ij+1<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<endl;
02304 file_out <<"parserr"<<iijj<<" "<<kl<<" "<<ij+1<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<" "<< varx<<endl;
02305
02306 }
02307 iiter++;
02308 if (iiter%nsample==0) {
02309 c0->Update();
02310
02311 for (int kl=0; kl<nsample; kl++) {
02312 if (gx0[kl]) {delete gx0[kl];gx0[kl] = 0;}
02313 if (ped0fun[kl]) {delete ped0fun[kl];ped0fun[kl] = 0;}
02314 if (signal[kl]) {delete signal[kl];signal[kl] = 0;}
02315 if (pedfun[kl]) {delete pedfun[kl];pedfun[kl] = 0;}
02316 if (sigfun[kl]) {delete sigfun[kl];sigfun[kl] = 0;}
02317 if (signalx[kl]) {delete signalx[kl];signalx[kl] = 0;}
02318 if (signall[kl]) {delete signall[kl];signall[kl] = 0;}
02319 if (pedstll[kl]) {delete pedstll[kl];pedstll[kl] = 0;}
02320 }
02321
02322 }
02323 }
02324 }
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335 }
02336 if (iiter%nsample!=0) {
02337 c0->Update();
02338 for (int kl=0; kl<nsample; kl++) {
02339 if (gx0[kl]) {delete gx0[kl];gx0[kl] = 0;}
02340 if (ped0fun[kl]) {delete ped0fun[kl];ped0fun[kl] = 0;}
02341 if (signal[kl]) {delete signal[kl];signal[kl] = 0;}
02342 if (pedfun[kl]) {delete pedfun[kl];pedfun[kl] = 0;}
02343 if (sigfun[kl]) {delete sigfun[kl];sigfun[kl] = 0;}
02344 if (signalx[kl]) {delete signalx[kl];signalx[kl] = 0;}
02345 if (signall[kl]) {delete signall[kl];signall[kl] = 0;}
02346 if (pedstll[kl]) {delete pedstll[kl];pedstll[kl] = 0;}
02347 }
02348 }
02349
02350 delete c0;
02351
02352 xsiz = 600;
02353 ysiz = 800;
02354
02355 gStyle->SetTitleFontSize(0.05);
02356 gStyle->SetTitleSize(0.025,"XYZ");
02357 gStyle->SetLabelSize(0.025,"XYZ");
02358 gStyle->SetStatFontSize(.045);
02359
02360 gStyle->SetOptStat(0);
02361 ps.NewPage(); TCanvas *c1 = new TCanvas("c1", " Pedestal vs signal", xsiz, ysiz);
02362 ped_evt->Draw(); c1->Update();
02363
02364 ps.NewPage();
02365 ped_statmean->Draw(); c1->Update();
02366
02367 ps.NewPage();
02368 ped_rms->Draw(); c1->Update();
02369
02370 ps.NewPage();
02371 ped_mean->Draw(); c1->Update();
02372
02373 ps.NewPage();
02374 ped_width->Draw(); c1->Update();
02375
02376 ps.NewPage();
02377 sig_evt->Draw(); c1->Update();
02378
02379 ps.NewPage();
02380 sig_statmean->Draw(); c1->Update();
02381
02382 ps.NewPage();
02383 sig_rms->Draw(); c1->Update();
02384
02385 ps.NewPage();
02386 fit_chi->Draw(); c1->Update();
02387
02388 ps.NewPage();
02389 fit_sigevt->Draw(); c1->Update();
02390
02391 ps.NewPage();
02392 fit_bkgevt->Draw(); c1->Update();
02393
02394 ps.NewPage();
02395 sig_mean->Draw(); c1->Update();
02396
02397 ps.NewPage();
02398 sig_width->Draw(); c1->Update();
02399
02400 ps.NewPage();
02401 sig_sigma->Draw(); c1->Update();
02402
02403 ps.NewPage();
02404 sig_meanerr->Draw(); c1->Update();
02405
02406 ps.NewPage();
02407 sig_meanerrp->Draw(); c1->Update();
02408
02409 ps.NewPage();
02410 sig_signf->Draw(); c1->Update();
02411
02412 ps.Close();
02413 delete c1;
02414
02415 file_out.close();
02416
02417 if (m_figure) {
02418 xsiz = 700;
02419 ysiz = 450;
02420
02421 gStyle->SetTitleFontSize(0.09);
02422 gStyle->SetPadBottomMargin(0.17);
02423 gStyle->SetPadLeftMargin(0.18);
02424 gStyle->SetPadRightMargin(0.01);
02425 gStyle->SetOptLogy(0);
02426 gStyle->SetOptStat(0);
02427
02428 TCanvas *c2 = new TCanvas("c2", "runfile", xsiz, ysiz);
02429 c2->Divide(5,3);
02430
02431 for (int side=0; side <2; side++) {
02432 gStyle->SetNdivisions(303,"XY");
02433 gStyle->SetPadRightMargin(0.01);
02434 int nmn = 0;
02435 int nmx = netamx/2;
02436 if (side==1) {
02437 nmn = netamx/2;
02438 nmx = netamx;
02439 }
02440
02441 int nzone = 0;
02442
02443 for (int ij=nmn; ij<nmx; ij++) {
02444
02445 c2->cd(nzone+1);
02446 const_eta[ij]->GetXaxis()->SetTitle("#phi index");
02447 const_eta[ij]->GetXaxis()->SetTitleSize(.08);
02448 const_eta[ij]->GetXaxis()->CenterTitle();
02449 const_eta[ij]->GetXaxis()->SetTitleOffset(0.9);
02450 const_eta[ij]->GetXaxis()->SetLabelSize(.085);
02451 const_eta[ij]->GetXaxis()->SetLabelOffset(.01);
02452
02453 const_eta[ij]->GetYaxis()->SetLabelSize(.08);
02454 const_eta[ij]->GetYaxis()->SetLabelOffset(.01);
02455 if (m_digiInput) {
02456 const_eta[ij]->GetYaxis()->SetTitle("GeV/fC");
02457 } else {
02458 const_eta[ij]->GetYaxis()->SetTitle("GeV/MIP-GeV!!");
02459 }
02460
02461 const_eta[ij]->GetYaxis()->SetTitleSize(.085);
02462 const_eta[ij]->GetYaxis()->CenterTitle();
02463 const_eta[ij]->GetYaxis()->SetTitleOffset(1.3);
02464 const_eta[ij]->SetMarkerSize(0.60);
02465 const_eta[ij]->SetMarkerColor(2);
02466 const_eta[ij]->SetMarkerStyle(20);
02467
02468
02469 const_eta[ij]->Draw();
02470 nzone++;
02471 }
02472
02473 sprintf(out_file, "calibho_%i_side%i.eps", irunold, side);
02474 c2->SaveAs(out_file);
02475
02476 sprintf(out_file, "calibho_%i_side%i.jpg", irunold, side);
02477 c2->SaveAs(out_file);
02478
02479 nzone = 0;
02480 for (int ij=nmn; ij<nmx; ij++) {
02481 c2->cd(nzone+1);
02482 peak_eta[ij]->GetXaxis()->SetTitle("#phi index");
02483 peak_eta[ij]->GetXaxis()->SetTitleSize(.08);
02484 peak_eta[ij]->GetXaxis()->CenterTitle();
02485 peak_eta[ij]->GetXaxis()->SetTitleOffset(0.90);
02486 peak_eta[ij]->GetXaxis()->SetLabelSize(.08);
02487 peak_eta[ij]->GetXaxis()->SetLabelOffset(.01);
02488
02489 peak_eta[ij]->GetYaxis()->SetLabelSize(.08);
02490 peak_eta[ij]->GetYaxis()->SetLabelOffset(.01);
02491 if (m_digiInput) {
02492 peak_eta[ij]->GetYaxis()->SetTitle("fC");
02493 } else {
02494 peak_eta[ij]->GetYaxis()->SetTitle("GeV");
02495 }
02496
02497 peak_eta[ij]->GetYaxis()->SetTitleSize(.085);
02498 peak_eta[ij]->GetYaxis()->CenterTitle();
02499 peak_eta[ij]->GetYaxis()->SetTitleOffset(1.3);
02500
02501 peak_eta[ij]->SetMarkerSize(0.60);
02502 peak_eta[ij]->SetMarkerColor(2);
02503 peak_eta[ij]->SetMarkerStyle(20);
02504
02505 peak_eta[ij]->Draw();
02506 nzone++;
02507 }
02508
02509 sprintf(out_file, "peakho_%i_side%i.eps", irunold, side);
02510 c2->SaveAs(out_file);
02511
02512 sprintf(out_file, "peakho_%i_side%i.jpg", irunold, side);
02513 c2->SaveAs(out_file);
02514 }
02515 delete c2;
02516
02517
02518 gStyle->SetTitleFontSize(0.045);
02519 gStyle->SetPadRightMargin(0.13);
02520 gStyle->SetPadBottomMargin(0.15);
02521 gStyle->SetPadLeftMargin(0.1);
02522 gStyle->SetOptStat(0);
02523 xsiz = 700;
02524 ysiz = 600;
02525 TCanvas *c1 = new TCanvas("c1", "Fitted const in each tower", xsiz, ysiz);
02526 const_eta_phi->GetXaxis()->SetTitle("#eta");
02527 const_eta_phi->GetXaxis()->SetTitleSize(0.065);
02528 const_eta_phi->GetXaxis()->SetTitleOffset(0.85);
02529 const_eta_phi->GetXaxis()->CenterTitle();
02530 const_eta_phi->GetXaxis()->SetLabelSize(0.045);
02531 const_eta_phi->GetXaxis()->SetLabelOffset(0.01);
02532
02533 const_eta_phi->GetYaxis()->SetTitle("#phi");
02534 const_eta_phi->GetYaxis()->SetTitleSize(0.075);
02535 const_eta_phi->GetYaxis()->SetTitleOffset(0.5);
02536 const_eta_phi->GetYaxis()->CenterTitle();
02537 const_eta_phi->GetYaxis()->SetLabelSize(0.045);
02538 const_eta_phi->GetYaxis()->SetLabelOffset(0.01);
02539
02540 const_eta_phi->Draw("colz");
02541 sprintf(out_file, "high_hoconst_eta_phi_%i.jpg",irunold);
02542 c1->SaveAs(out_file);
02543
02544 delete c1;
02545
02546 for (int jk=0; jk<netamx; jk++) {
02547 int ieta = (jk<15) ? jk+1 : 14-jk;
02548 if (rms_phi[jk]>0) {
02549 mean_phi_ave->Fill(ieta, mean_phi[jk]/rms_phi[jk]);
02550 mean_phi_ave->SetBinError(mean_phi_ave->FindBin(ieta), pow(double(rms_phi[jk]), -0.5));
02551 }
02552 }
02553
02554 for (int ij=0; ij<nphimx; ij++) {
02555 if (rms_eta[ij] >0) {
02556 mean_eta_ave->Fill(ij+1, mean_eta[ij]/rms_eta[ij]);
02557 mean_eta_ave->SetBinError(mean_eta_ave->FindBin(ij+1), pow(double(rms_eta[ij]), -0.5));
02558 }
02559 }
02560
02561 ysiz =450;
02562 gStyle->SetPadLeftMargin(0.13);
02563 gStyle->SetPadRightMargin(0.03);
02564
02565
02566 TCanvas *c2y = new TCanvas("c2", "Avearge signal in eta and phi", xsiz, ysiz);
02567 c2y->Divide(2,1);
02568 mean_eta_ave->GetXaxis()->SetTitle("#phi");
02569 mean_eta_ave->GetXaxis()->SetTitleSize(0.085);
02570 mean_eta_ave->GetXaxis()->SetTitleOffset(0.65);
02571 mean_eta_ave->GetXaxis()->CenterTitle();
02572 mean_eta_ave->GetXaxis()->SetLabelSize(0.05);
02573 mean_eta_ave->GetXaxis()->SetLabelOffset(0.001);
02574
02575 mean_eta_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP");
02576 mean_eta_ave->GetYaxis()->SetTitleSize(0.055);
02577 mean_eta_ave->GetYaxis()->SetTitleOffset(1.3);
02578 mean_eta_ave->GetYaxis()->CenterTitle();
02579 mean_eta_ave->GetYaxis()->SetLabelSize(0.045);
02580 mean_eta_ave->GetYaxis()->SetLabelOffset(0.01);
02581 mean_eta_ave->SetMarkerSize(0.60);
02582 mean_eta_ave->SetMarkerColor(2);
02583 mean_eta_ave->SetMarkerStyle(20);
02584
02585 c2y->cd(1); mean_eta_ave->Draw();
02586
02587 mean_phi_ave->GetXaxis()->SetTitle("#eta");
02588 mean_phi_ave->GetXaxis()->SetTitleSize(0.085);
02589 mean_phi_ave->GetXaxis()->SetTitleOffset(0.65);
02590 mean_phi_ave->GetXaxis()->CenterTitle();
02591 mean_phi_ave->GetXaxis()->SetLabelSize(0.05);
02592 mean_phi_ave->GetXaxis()->SetLabelOffset(0.001);
02593
02594 mean_phi_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP");
02595 mean_phi_ave->GetYaxis()->SetTitleSize(0.055);
02596 mean_phi_ave->GetYaxis()->SetTitleOffset(1.3);
02597 mean_phi_ave->GetYaxis()->CenterTitle();
02598 mean_phi_ave->GetYaxis()->SetLabelSize(0.045);
02599 mean_phi_ave->GetYaxis()->SetLabelOffset(0.01);
02600 mean_phi_ave->SetMarkerSize(0.60);
02601 mean_phi_ave->SetMarkerColor(2);
02602 mean_phi_ave->SetMarkerStyle(20);
02603
02604 c2y->cd(2); mean_phi_ave->Draw();
02605
02606 sprintf(out_file, "high_hoaverage_eta_phi_%i.jpg",irunold);
02607 c2y->SaveAs(out_file);
02608
02609 delete c2y;
02610
02611
02612 xsiz = 800;
02613 ysiz = 450;
02614 TCanvas *c3 = new TCanvas("c3", "Avearge signal in eta and phi", xsiz, ysiz);
02615 c3->Divide(2,1);
02616 mean_phi_hst->GetXaxis()->SetTitle("#eta");
02617 mean_phi_hst->GetXaxis()->SetTitleSize(0.065);
02618 mean_phi_hst->GetXaxis()->SetTitleOffset(0.9);
02619 mean_phi_hst->GetXaxis()->CenterTitle();
02620 mean_phi_hst->GetXaxis()->SetLabelSize(0.065);
02621 mean_phi_hst->GetXaxis()->SetLabelOffset(0.001);
02622
02623 mean_phi_hst->GetYaxis()->SetTitle("GeV/MIP");
02624 mean_phi_hst->GetYaxis()->SetTitleSize(0.055);
02625 mean_phi_hst->GetYaxis()->SetTitleOffset(0.9);
02626 mean_phi_hst->GetYaxis()->CenterTitle();
02627 mean_phi_hst->GetYaxis()->SetLabelSize(0.065);
02628 mean_phi_hst->GetYaxis()->SetLabelOffset(0.01);
02629
02630 mean_phi_hst->SetMarkerColor(4);
02631 mean_phi_hst->SetMarkerSize(0.8);
02632 mean_phi_hst->SetMarkerStyle(20);
02633 mean_phi_hst->Draw();
02634
02635 sprintf(out_file, "low_mean_phi_hst_%i.jpg",irunold);
02636 c3->SaveAs(out_file);
02637
02638 delete c3;
02639
02640
02641
02642
02643 gStyle->SetOptLogy(1);
02644 gStyle->SetPadTopMargin(.1);
02645 gStyle->SetPadLeftMargin(.15);
02646 xsiz = 800;
02647 ysiz = 500;
02648 TCanvas *c0x = new TCanvas("c0x", "Signal in each ring", xsiz, ysiz);
02649
02650 c0x->Divide(3,2);
02651 for (int ij=0; ij<ringmx; ij++) {
02652 int iread = (ij==2) ? routmx : rout12mx;
02653 if (m_digiInput) {
02654 com_sigrsg[ij][iread]->GetXaxis()->SetTitle("Signal/ped (fC)");
02655 } else {
02656 com_sigrsg[ij][iread]->GetXaxis()->SetTitle("Signal/ped (GeV)");
02657 }
02658 com_sigrsg[ij][iread]->GetXaxis()->SetTitleSize(0.060);
02659 com_sigrsg[ij][iread]->GetXaxis()->SetTitleOffset(1.05);
02660 com_sigrsg[ij][iread]->GetXaxis()->CenterTitle();
02661 com_sigrsg[ij][iread]->GetXaxis()->SetLabelSize(0.065);
02662 com_sigrsg[ij][iread]->GetXaxis()->SetLabelOffset(0.01);
02663
02664 com_sigrsg[ij][iread]->GetYaxis()->SetLabelSize(0.065);
02665 com_sigrsg[ij][iread]->GetYaxis()->SetLabelOffset(0.01);
02666
02667
02668 com_sigrsg[ij][iread]->SetLineWidth(3);
02669 com_sigrsg[ij][iread]->SetLineColor(4);
02670
02671 c0x->cd(ij+1); com_sigrsg[ij][iread]->Draw();
02672
02673 com_crossg[ij][iread]->SetLineWidth(2);
02674 com_crossg[ij][iread]->SetLineColor(2);
02675 com_crossg[ij][iread]->Draw("same");
02676 }
02677 sprintf(out_file, "hosig_ring_%i.jpg",irunold);
02678 c0x->SaveAs(out_file);
02679 delete c0x;
02680
02681 gStyle->SetTitleFontSize(0.06);
02682 gStyle->SetOptStat(0);
02683 gStyle->SetOptLogy(0);
02684
02685 TCanvas *c0 = new TCanvas("c0", "Signal in each ring", xsiz, ysiz);
02686
02687 c0->Divide(3,2);
02688 for (int jk=0; jk<ringmx; jk++) {
02689 peak_hpdrm[jk]->GetXaxis()->SetTitle("RM #");
02690 peak_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070);
02691 peak_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.0);
02692 peak_hpdrm[jk]->GetXaxis()->CenterTitle();
02693 peak_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065);
02694 peak_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01);
02695
02696 peak_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)/MIP");
02697
02698 peak_hpdrm[jk]->GetYaxis()->SetTitleSize(0.07);
02699 peak_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.3);
02700 peak_hpdrm[jk]->GetYaxis()->CenterTitle();
02701 peak_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065);
02702 peak_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01);
02703
02704
02705 peak_hpdrm[jk]->SetMarkerSize(0.60);
02706 peak_hpdrm[jk]->SetMarkerColor(2);
02707 peak_hpdrm[jk]->SetMarkerStyle(20);
02708
02709
02710 c0->cd(jk+1); peak_hpdrm[jk]->Draw();
02711 }
02712 sprintf(out_file, "comb_peak_hpdrm_%i.jpg",irunold);
02713 c0->SaveAs(out_file);
02714
02715 delete c0;
02716
02717 TCanvas *c1y = new TCanvas("c1y", "Signal in each ring", xsiz, ysiz);
02718
02719 c1y->Divide(3,2);
02720 for (int jk=0; jk<ringmx; jk++) {
02721 const_hpdrm[jk]->GetXaxis()->SetTitle("RM #");
02722 const_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070);
02723 const_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.3);
02724 const_hpdrm[jk]->GetXaxis()->CenterTitle();
02725 const_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065);
02726 const_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01);
02727
02728 if (m_digiInput) {
02729 const_hpdrm[jk]->GetYaxis()->SetTitle("Peak(fC)");
02730 } else {
02731 const_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)");
02732 }
02733 const_hpdrm[jk]->GetYaxis()->SetTitleSize(0.065);
02734 const_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.0);
02735 const_hpdrm[jk]->GetYaxis()->CenterTitle();
02736 const_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065);
02737 const_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01);
02738
02739
02740 const_hpdrm[jk]->SetMarkerSize(0.60);
02741 const_hpdrm[jk]->SetMarkerColor(2);
02742 const_hpdrm[jk]->SetMarkerStyle(20);
02743
02744 c1y->cd(jk+1); const_hpdrm[jk]->Draw();
02745 }
02746
02747 sprintf(out_file, "comb_const_hpdrm_%i.jpg",irunold);
02748 c1y->SaveAs(out_file);
02749
02750 delete c1y;
02751
02752 }
02753
02754
02755
02756
02757 }
02758
02759
02760 if (m_figure) {
02761 for (int ij=0; ij<nphimx; ij++) {
02762 for (int jk=0; jk<netamx; jk++) {
02763 stat_eta[jk]->Fill(ij+1,sigrsg[jk][ij]->GetEntries());
02764 statmn_eta[jk]->Fill(ij+1,sigrsg[jk][ij]->GetMean());
02765 }
02766 }
02767
02768 xsiz = 700;
02769 ysiz = 450;
02770 gStyle->SetTitleFontSize(0.09);
02771 gStyle->SetPadBottomMargin(0.14);
02772 gStyle->SetPadLeftMargin(0.17);
02773 gStyle->SetPadRightMargin(0.01);
02774 gStyle->SetNdivisions(303,"XY");
02775 gStyle->SetOptLogy(1);
02776
02777 TCanvas *c2x = new TCanvas("c2x", "runfile", xsiz, ysiz);
02778 c2x->Divide(5,3);
02779 for (int side=0; side <2; side++) {
02780 int nmn = 0;
02781 int nmx = netamx/2;
02782 if (side==1) {
02783 nmn = netamx/2;
02784 nmx = netamx;
02785 }
02786 int nzone = 0;
02787 char name[200];
02788
02789 for (int ij=nmn; ij<nmx; ij++) {
02790 int ieta = (ij<15) ? ij+1 : 14-ij;
02791 c2x->cd(nzone+1);
02792 if (m_digiInput) {
02793 sprintf(name,"fC(#eta=%i)",ieta);
02794 } else {
02795 sprintf(name,"GeV(#eta=%i)",ieta);
02796 }
02797 sigrsg[ij][nphimx]->GetXaxis()->SetTitle(name);
02798 sigrsg[ij][nphimx]->GetXaxis()->SetTitleSize(.08);
02799 sigrsg[ij][nphimx]->GetXaxis()->CenterTitle();
02800 sigrsg[ij][nphimx]->GetXaxis()->SetTitleOffset(0.90);
02801 sigrsg[ij][nphimx]->GetXaxis()->SetLabelSize(.08);
02802 sigrsg[ij][nphimx]->GetXaxis()->SetLabelOffset(.01);
02803
02804 sigrsg[ij][nphimx]->GetYaxis()->SetLabelSize(.08);
02805 sigrsg[ij][nphimx]->GetYaxis()->SetLabelOffset(.01);
02806 sigrsg[ij][nphimx]->SetLineWidth(2);
02807 sigrsg[ij][nphimx]->SetLineColor(4);
02808 sigrsg[ij][nphimx]->Draw();
02809 crossg[ij][nphimx]->SetLineWidth(2);
02810 crossg[ij][nphimx]->SetLineColor(2);
02811 crossg[ij][nphimx]->Draw("same");
02812 nzone++;
02813 }
02814
02815 sprintf(out_file, "sig_ho_%i_side%i.eps", irunold, side);
02816 c2x->SaveAs(out_file);
02817
02818 sprintf(out_file, "sig_ho_%i_side%i.jpg", irunold, side);
02819 c2x->SaveAs(out_file);
02820 }
02821
02822 gStyle->SetOptLogy(0);
02823 c2x = new TCanvas("c2x", "runfile", xsiz, ysiz);
02824 c2x->Divide(5,3);
02825 for (int side=0; side <2; side++) {
02826 int nmn = 0;
02827 int nmx = netamx/2;
02828 if (side==1) {
02829 nmn = netamx/2;
02830 nmx = netamx;
02831 }
02832 int nzone = 0;
02833
02834 nzone = 0;
02835 for (int ij=nmn; ij<nmx; ij++) {
02836 c2x->cd(nzone+1);
02837 statmn_eta[ij]->SetLineWidth(2);
02838 statmn_eta[ij]->SetLineColor(4);
02839 statmn_eta[ij]->GetXaxis()->SetTitle("#phi index");
02840 statmn_eta[ij]->GetXaxis()->SetTitleSize(.08);
02841 statmn_eta[ij]->GetXaxis()->CenterTitle();
02842 statmn_eta[ij]->GetXaxis()->SetTitleOffset(0.9);
02843 statmn_eta[ij]->GetYaxis()->SetLabelSize(.08);
02844 statmn_eta[ij]->GetYaxis()->SetLabelOffset(.01);
02845 statmn_eta[ij]->GetXaxis()->SetLabelSize(.08);
02846 statmn_eta[ij]->GetXaxis()->SetLabelOffset(.01);
02847 if (m_digiInput) {
02848 statmn_eta[ij]->GetYaxis()->SetTitle("fC");
02849 } else {
02850 statmn_eta[ij]->GetYaxis()->SetTitle("GeV");
02851 }
02852 statmn_eta[ij]->GetYaxis()->SetTitleSize(.075);
02853 statmn_eta[ij]->GetYaxis()->CenterTitle();
02854 statmn_eta[ij]->GetYaxis()->SetTitleOffset(1.30);
02855
02856 statmn_eta[ij]->Draw();
02857 nzone++;
02858 }
02859
02860 sprintf(out_file, "statmnho_%i_side%i.eps", irunold, side);
02861 c2x->SaveAs(out_file);
02862
02863 sprintf(out_file, "statmnho_%i_side%i.jpg", irunold, side);
02864 c2x->SaveAs(out_file);
02865
02866 gStyle->SetOptLogy(1);
02867 gStyle->SetNdivisions(203,"XY");
02868
02869 nzone = 0;
02870 for (int ij=nmn; ij<nmx; ij++) {
02871 c2x->cd(nzone+1);
02872 stat_eta[ij]->SetLineWidth(2);
02873 stat_eta[ij]->SetLineColor(4);
02874 stat_eta[ij]->GetXaxis()->SetTitle("#phi index");
02875 stat_eta[ij]->GetXaxis()->SetTitleSize(.08);
02876 stat_eta[ij]->GetXaxis()->CenterTitle();
02877 stat_eta[ij]->GetXaxis()->SetTitleOffset(0.80);
02878 stat_eta[ij]->GetXaxis()->SetLabelSize(.08);
02879 stat_eta[ij]->GetXaxis()->SetLabelOffset(.01);
02880 stat_eta[ij]->GetYaxis()->SetLabelSize(.08);
02881 stat_eta[ij]->GetYaxis()->SetLabelOffset(.01);
02882
02883 stat_eta[ij]->Draw();
02884 nzone++;
02885 }
02886
02887 sprintf(out_file, "statho_%i_side%i.eps", irunold, side);
02888 c2x->SaveAs(out_file);
02889
02890 sprintf(out_file, "statho_%i_side%i.jpg", irunold, side);
02891 c2x->SaveAs(out_file);
02892 }
02893 delete c2x;
02894
02895 }
02896
02897 if (!m_constant) {
02898 for (int j=0; j<netamx; j++) {
02899 for (int i=0; i<nphimx; i++) {
02900 if (crossg[j][i]) { delete crossg[j][i];}
02901 if (sigrsg[j][i]) { delete sigrsg[j][i];}
02902 }
02903 }
02904 }
02905 }
02906
02907
02908 DEFINE_FWK_MODULE(HOCalibAnalyzer);
02909
02910
02911