File indexing completed on 2024-04-06 12:22:51
0001 void xTalkMacro(){
0002
0003 gROOT->SetBatch();
0004
0005 gROOT->ProcessLine(".L GenFuncMacro.C");
0006
0007
0008
0009 char *myFileName;
0010 char *myFilePath;
0011 void *dirp = gSystem->OpenDirectory("/tmp/csccalib");
0012 char *afile;
0013 while(afile = gSystem->GetDirEntry(dirp)) {
0014 char *bfile[0] = afile[0];
0015 if (bfile[0]=='c') {
0016 printf("file: %s\n",afile);
0017 myFileName = afile;
0018 }
0019 myFilePath = Form("/tmp/csccalib/%s", myFileName);
0020 }
0021
0022
0023
0024 int nDDU = 1;
0025 int nCham = 1;
0026 int nLayer = 6;
0027
0028
0029 gStyle->SetCanvasColor(0);
0030 gStyle->SetPadColor(0);
0031 gStyle->SetPadBorderMode(0);
0032 gStyle->SetCanvasBorderMode(0);
0033 gStyle->SetFrameBorderMode(0);
0034 gStyle->SetStatH(0.2);
0035 gStyle->SetStatW(0.3);
0036
0037
0038 directoryCheck();
0039
0040 std::cout << "opening: " << myFileName << std::endl;
0041 TFile *myFile = TFile::Open(myFilePath);
0042
0043
0044 TCanvas *ChamberEntryCanvas = new TCanvas("ChamberDummyCanvas", "ChamberDummyCanvas");
0045 TH1F *ChamberEntryGraph = new TH1F ("ChamberGraph", "ChamberGraph",480,0,480);
0046 ChamberEntryCanvas->cd();
0047 Calibration->Draw("cham>>ChamberGraph");
0048 int NEntries = ChamberEntryGraph->GetEntries();
0049
0050
0051 nCham = (NEntries/480);
0052 std::cout << "number of chambers is: " << nCham << std::endl;
0053
0054 if (nCham == 0){
0055 std::cout << "no chambers, quitting." << std::endl;
0056 gROOT->ProcessLine(".q");
0057 }
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 gSystem->cd("/afs/cern.ch/cms/CSC/html/csccalib/");
0077
0078 makeDirectory("images");
0079
0080 gSystem->cd("images");
0081
0082 makeDirectory("Crosstalk");
0083
0084 gSystem->cd("../");
0085
0086
0087 gSystem->cd("images/Crosstalk/");
0088 makeDirectory(myFileName);
0089
0090 gSystem->cd(myFileName);
0091
0092
0093
0094 TCanvas *Maxdummy = new TCanvas("Maxdummy", "Maxdummy");
0095 Maxdummy->Divide(1,2);
0096 Maxdummy->cd(1);
0097 Calibration->Draw("MaxPed");
0098 Maxdummy->cd(2);
0099 Calibration->Draw("MaxRMS");
0100
0101 gSystem->cd("../../../");
0102
0103
0104 pedRMSFlagGraph(myFileName, myFilePath);
0105
0106 gStyle->SetOptStat(0);
0107 pedRMSGraphs(nDDU,nCham,nLayer, myFileName, myFilePath);
0108
0109 pedMeanGraphs(nDDU,nCham,nLayer, myFileName, myFilePath);
0110 gStyle->SetOptStat(1);
0111
0112 pedNoiseFlagGraph(myFileName, myFilePath);
0113
0114
0115 gSystem->cd("/afs/cern.ch/user/c/csccalib/scratch0/CMSSW_1_5_1/src/OnlineDB/CSCCondDB/test");
0116 std::cout << "now in : " << gSystem->pwd() << std::endl;
0117
0118
0119
0120 myFile->Close();
0121 myFilePath = Form("/tmp/csccalib/%s", myFileName);
0122 std::cout << "just before PulseGraphs" << std::endl;
0123 std::cout << " fileName: " << myFileName << std::endl;
0124 std::cout << " filePath: " << myFilePath << std::endl;
0125 PulseGraphs(myFileName, myFilePath);
0126 gROOT->ProcessLine(".q");
0127 }
0128
0129
0130
0131
0132
0133 void GetChamberIDs(int IDArray[9]){
0134 TCanvas *IDcanv = new TCanvas ("idGraph", "idGraph");
0135 IDcanv->cd();
0136 TH1F *idDummy = new TH1F("idDummy", "idDummy", 480, 111000, 250000);
0137 idDummy->Draw();
0138 for (int chamber=0; chamber<9; ++chamber){
0139 TString idCut = Form ("cham==%d", chamber);
0140 Calibration->Project("idDummy", "id", idCut);
0141 Int_t idNum = idDummy->GetMean();
0142 IDArray[chamber]=idNum;
0143 }
0144 idDummy->Draw();
0145 }
0146
0147 void pedRMSGraphs(int nDDU, int nCham, int nLayer, TString myFileName, TString myFilePath){
0148
0149 gSystem->cd("images/Crosstalk");
0150 gSystem->cd(myFileName);
0151 makeDirectory("pedRMSGraphs");
0152 gSystem->cd("pedRMSGraphs");
0153 makeDirectory("pedRMSStrips");
0154 makeDirectory("pedRMSLayerMean");
0155
0156
0157 TObjArray CANV_PEDRMS_STRIP_ARRAY(nCham*nDDU);
0158 TObjArray CANV_PEDRMS_MEAN_ARRAY(nCham*nDDU);
0159
0160
0161
0162 TLine *horiz_low_pedrms = new TLine(0,0,80,0);
0163 TLine *horiz_high_pedrms = new TLine(0,5,80,5);
0164 TLine *vert_low_pedrms = new TLine(5, 0, 5, 200);
0165 TLine *vert_high_pedrms = new TLine(0, 0, 0, 200);
0166
0167 horiz_low_pedrms->SetLineStyle(3);
0168 horiz_high_pedrms->SetLineStyle(3);
0169 vert_low_pedrms->SetLineStyle(3);
0170 vert_high_pedrms->SetLineStyle(3);
0171
0172 horiz_low_pedrms->SetLineColor(6);
0173 horiz_low_pedrms->SetLineWidth(2);
0174 horiz_high_pedrms->SetLineColor(6);
0175 horiz_high_pedrms->SetLineWidth(2);
0176
0177 vert_low_pedrms->SetLineColor(6);
0178 vert_low_pedrms->SetLineWidth(2);
0179 vert_high_pedrms->SetLineColor(6);
0180 vert_high_pedrms->SetLineWidth(2);
0181
0182
0183
0184 TH1F *cha[480];
0185 TH2F *lay[2880];
0186
0187 for(int i=0; i<nDDU; ++i){
0188 int idArray[9];
0189 GetChamberIDs(idArray);
0190
0191 for (int j=0; j<nCham; ++j){
0192
0193 gStyle->SetMarkerStyle(20);
0194 gStyle->SetMarkerSize(0.8);
0195
0196
0197 Int_t chamber_id_int = idArray[j];
0198
0199 Float_t chamber_maxRMSval = Calibration->GetLeaf("MaxRMS")->GetValue(j);
0200
0201 Float_t chamber_axisMax = chamber_maxRMSval + (.1)*chamber_maxRMSval;
0202 if (chamber_axisMax < 5.5){
0203 chamber_axisMax = 5.5;
0204 }
0205
0206
0207 TString CANV_PEDRMS_MEAN_NAME = Form("ChamberID_%d_RMS", chamber_id_int);
0208 TCanvas* canv_rms1 ;
0209 canv_rms1 = new TCanvas(CANV_PEDRMS_MEAN_NAME,CANV_PEDRMS_MEAN_NAME, 200, 10, 1200, 800);
0210 canv_rms1->SetCanvasSize(1200,800);
0211
0212
0213 CANV_PEDRMS_MEAN_ARRAY.Add(canv_rms1);
0214
0215
0216 TString CANV_PEDRMS_STRIP_NAME = Form("ChamberID_%d_RMS_per_Layer", chamber_id_int);
0217
0218 TCanvas* canv_rms2;
0219 canv_rms2 = new TCanvas(CANV_PEDRMS_STRIP_NAME,CANV_PEDRMS_STRIP_NAME, 200, 10, 1200, 800);
0220 canv_rms2->SetCanvasSize(1200,800);
0221 canv_rms2->Divide(2,3);
0222 CANV_PEDRMS_STRIP_ARRAY.Add(canv_rms2);
0223
0224
0225
0226 int chamber_access_int =( (nCham*i)+ j);
0227
0228
0229 TString hist_name= Form("cha[%d]", chamber_access_int);
0230 cha[j] = new TH1F(hist_name, "rms mean plot", 100, -0.5, chamber_axisMax);
0231
0232 TCanvas *thisCanv_mean = CANV_PEDRMS_MEAN_ARRAY[chamber_access_int];
0233 thisCanv_mean->cd();
0234
0235 TString xAxisTitle = Form("Mean RMS for Chamber %d",chamber_id_int);
0236 cha[j]->GetXaxis()->SetTitle(xAxisTitle);
0237
0238 const char val[7];
0239
0240 sprintf(val, "cham==%d", j);
0241 const char *val_ = val;
0242
0243 Calibration->UseCurrentStyle();
0244
0245
0246 cha[j]->Draw();
0247
0248 Calibration->Project(hist_name, "pedRMS", val_);
0249
0250
0251 Double_t yMaxVal = cha[j]->GetMaximum();
0252 Double_t yMaxRan = yMaxVal + (yMaxVal*.1);
0253
0254
0255 vert_low_pedrms->SetY2(yMaxRan);
0256 vert_high_pedrms->SetY2(yMaxRan);
0257
0258
0259 cha[j]->SetAxisRange(0,yMaxRan,"Y");
0260 vert_low_pedrms->Draw();
0261 vert_high_pedrms->Draw();
0262
0263 thisCanv_mean->Update();
0264 gSystem->cd("pedRMSLayerMean");
0265 TString canvName = CANV_PEDRMS_MEAN_ARRAY[chamber_access_int]->GetName();
0266 PrintAsGif(thisCanv_mean, canvName);
0267 gSystem->cd("../");
0268
0269 int NStrips = 0;
0270 int xStripMax = 1;
0271
0272 TCanvas *StripEntryCanvas = new TCanvas("StripDummyCanvas", "StripDummyCanvas");
0273 TH1F *StripEntryDummy = new TH1F("StripEntryDummy", "StripEntryDummy",10,0,100);
0274 TString chamVar = Form("cham==%d",j);
0275 StripEntryCanvas->cd();
0276 Calibration->Draw("strip>>StripEntryDummy", chamVar);
0277
0278 NStrips= StripEntryDummy->GetEntries();
0279
0280 if (NStrips==480){
0281 xStripMax=80;
0282 }if (NStrips==384){
0283 xStripMax=64;
0284 }
0285
0286 for (int k=0; k<nLayer; ++k){
0287 int layer_access_int = ( (nCham*nLayer*i) + (nLayer*j) + k );
0288
0289 TString hist_name_= Form("lay[%d]",layer_access_int);
0290
0291 lay[layer_access_int] = new TH2F(hist_name_,"RMS strip plot", xStripMax, 0, xStripMax, 10, -0.5, chamber_axisMax);
0292
0293
0294 TCanvas *thisCanv_rms_strip = CANV_PEDRMS_STRIP_ARRAY[chamber_access_int];
0295 thisCanv_rms_strip -> cd(k+1);
0296
0297 lay[layer_access_int]->SetMarkerStyle(20);
0298 TString new_title2 = Form("Layer_%d", k+1);
0299 lay[layer_access_int]->SetTitle(new_title2);
0300
0301 TString newTitle = Form("strip RMS in chamber %d, per layer",chamber_id_int,k);
0302
0303 thisCanv_rms_strip->SetTitle(newTitle);
0304 lay[layer_access_int]->GetXaxis()->SetTitle("Strip");
0305 lay[layer_access_int]->GetYaxis()->SetTitle("RMS");
0306
0307 lay[layer_access_int]->GetXaxis()->SetTitleSize(0.070);
0308 lay[layer_access_int]->GetXaxis()->SetTitleOffset(0.5);
0309 lay[layer_access_int]->GetYaxis()->SetTitleSize(0.070);
0310 lay[layer_access_int]->GetXaxis()->SetTitleOffset(0.5);
0311
0312 lay[layer_access_int]->GetXaxis()->SetLabelSize(0.07);
0313 lay[layer_access_int]->GetYaxis()->SetLabelSize(0.07);
0314
0315 horiz_low_pedrms->SetX2(xStripMax);
0316 horiz_high_pedrms->SetX2(xStripMax);
0317
0318 TString graph_name_TH2F = Form("lay[%d]" ,layer_access_int);
0319
0320 const char valu[17];
0321 sprintf(valu, "cham==%d&&layer==%d",j,k);
0322 const char *valu_ = valu;
0323
0324 Calibration->UseCurrentStyle();
0325 lay[layer_access_int]->Draw();
0326 Calibration->Project(hist_name_, "pedRMS:strip", valu_);
0327 horiz_low_pedrms->Draw();
0328 horiz_high_pedrms->Draw();
0329
0330 thisCanv_rms_strip->Update();
0331
0332 }
0333
0334 gSystem->cd("pedRMSStrips");
0335 TString canvName = CANV_PEDRMS_STRIP_ARRAY[chamber_access_int]->GetName();
0336 PrintAsGif(thisCanv_rms_strip, canvName);
0337 gSystem->cd("../");
0338
0339 }
0340 }
0341 gSystem->cd("../../../../");
0342 directoryCheck();
0343 }
0344
0345 void pedMeanGraphs(int nDDU, int nCham, int nLayer, TString myFileName, TString myFilePath){
0346 gSystem->cd("images/Crosstalk");
0347 gSystem->cd(myFileName);
0348 makeDirectory("pedMeanGraphs");
0349 gSystem->cd("pedMeanGraphs");
0350 makeDirectory("pedMeanStrips");
0351 makeDirectory("pedMeanLayerMean");
0352
0353
0354 TObjArray CANV_PEDMEAN_STRIP_ARRAY(nCham*nDDU);
0355 TObjArray CANV_PEDMEAN_MEAN_ARRAY(nCham*nDDU);
0356
0357
0358 TLine *horiz_low_pedmean = new TLine(0,400,80,400);
0359 TLine *horiz_high_pedmean = new TLine(0,800,80,800);
0360 TLine *vert_low_pedmean = new TLine(400, 0, 400, 200);
0361 TLine *vert_high_pedmean = new TLine(800, 0, 800, 200);
0362
0363 horiz_low_pedmean->SetLineStyle(3);
0364 horiz_high_pedmean->SetLineStyle(3);
0365 vert_low_pedmean->SetLineStyle(3);
0366 vert_high_pedmean->SetLineStyle(3);
0367
0368 horiz_low_pedmean->SetLineColor(6);
0369 horiz_low_pedmean->SetLineWidth(2);
0370 horiz_high_pedmean->SetLineColor(6);
0371 horiz_high_pedmean->SetLineWidth(2);
0372
0373 vert_low_pedmean->SetLineColor(6);
0374 vert_low_pedmean->SetLineWidth(2);
0375 vert_high_pedmean->SetLineColor(6);
0376 vert_high_pedmean->SetLineWidth(2);
0377
0378 TH1F *chamber[480];
0379 TH2F *layer[2880];
0380 for(int i=0; i<nDDU; ++i){
0381 int idArray[9];
0382 GetChamberIDs(idArray);
0383 for (int j=0; j<nCham; ++j){
0384
0385 gStyle->SetMarkerStyle(20);
0386 gStyle->SetMarkerSize(1.0);
0387
0388 Int_t chamber_id_int = idArray[j];
0389
0390 Float_t chamber_maxPedval = Calibration->GetLeaf("MaxPed")->GetValue(j);
0391 Float_t chamber_axisMax = chamber_maxPedval + (.1)*chamber_maxPedval;
0392
0393 if (chamber_axisMax<900.0){
0394 chamber_axisMax = 900.0;
0395 }
0396
0397
0398 TString CANV_PEDMEAN_MEAN_NAME = Form("ChamberID_%d_ped_Mean",chamber_id_int);
0399 TCanvas* canv_mean1;
0400 canv_mean1 = new TCanvas(CANV_PEDMEAN_MEAN_NAME,CANV_PEDMEAN_MEAN_NAME, 200, 10, 1200, 800);
0401 CANV_PEDMEAN_MEAN_ARRAY.Add(canv_mean1);
0402
0403 TString CANV_PEDMEAN_STRIP_NAME = Form("ChamberID_%d_ped_Mean_per_Layer",chamber_id_int);
0404 TCanvas* canv_mean2;
0405 canv_mean2= new TCanvas(CANV_PEDMEAN_STRIP_NAME,CANV_PEDMEAN_STRIP_NAME, 200, 10, 1200, 800);
0406 canv_mean2->SetCanvasSize(1200,800);
0407 canv_mean2->Divide(2,3);
0408 CANV_PEDMEAN_STRIP_ARRAY.Add(canv_mean2);
0409
0410
0411 int chamber_access_int =( (nCham*i)+ j);
0412 TString hist_name= Form("chamber[%d]",chamber_access_int);
0413 chamber[j] = new TH1F(hist_name, "mean mean plot", 100, 300, chamber_axisMax);
0414
0415 TCanvas *thisCanv_meanMean = CANV_PEDMEAN_MEAN_ARRAY[chamber_access_int];
0416 thisCanv_meanMean->SetCanvasSize(1200,800);
0417 thisCanv_meanMean->cd();
0418
0419 const char value[7];
0420 sprintf(value, "cham==%d", j);
0421 const char *value_ = value;
0422
0423 TString new_title1_mean = Form("Mean_ChamberID_%d_DDU_%d", chamber_id_int, i+1);
0424 chamber[j]->SetTitle(new_title1_mean);
0425
0426 TString new_title1_mean = Form("ChamberID_%d_DDU_%d_Mean", chamber_id_int, i+1);
0427 TString xAxisTitle = Form("Mean Pedestal for Chamber %d",chamber_id_int);
0428
0429 chamber[j]->SetTitle(new_title1_mean);
0430 chamber[j]->GetXaxis()->SetTitle(xAxisTitle);
0431
0432 Calibration->UseCurrentStyle();
0433 chamber[j]->Draw();
0434 Calibration->Project(hist_name, "pedMean", value_);
0435
0436 Double_t yMaxVal = chamber[j]->GetMaximum();
0437 Double_t yMaxRan = yMaxVal + (yMaxVal*.1);
0438
0439 vert_low_pedmean->SetY2(yMaxRan);
0440 vert_high_pedmean->SetY2(yMaxRan);
0441
0442 chamber[j]->SetAxisRange(0,yMaxRan,"Y");
0443
0444 vert_low_pedmean->Draw();
0445 vert_high_pedmean->Draw();
0446
0447 thisCanv_meanMean->Update();
0448
0449 gSystem->cd("pedMeanLayerMean");
0450 TString canvName = CANV_PEDMEAN_MEAN_ARRAY[chamber_access_int]->GetName();
0451 PrintAsGif(thisCanv_meanMean, canvName);
0452 gSystem->cd("../");
0453
0454 int NStrips = 0;
0455 int xStripMax = 1;
0456
0457 TCanvas *StripEntryCanvas = new TCanvas("StripDummyCanvas", "StripDummyCanvas");
0458 TH1F *StripEntryDummy = new TH1F("StripEntryDummy", "StripEntryDummy",10,0,100);
0459 TString chamVar = Form("cham==%d",j);
0460 StripEntryCanvas->cd();
0461 Calibration->Draw("strip>>StripEntryDummy", chamVar);
0462
0463 NStrips=StripEntryDummy->GetEntries();
0464
0465 if (NStrips==480){
0466 xStripMax=80;
0467 }if (NStrips==384){
0468 xStripMax=64;
0469 }
0470
0471 for (int k=0; k<nLayer; ++k){
0472 gStyle->SetMarkerStyle(20);
0473 gStyle->SetMarkerSize(1.0);
0474 int layer_access_int = ( (nCham*nLayer*i) + (nLayer*j) + k );
0475
0476 TString hist_name_mean= Form("layer[%d]",layer_access_int);
0477 layer[layer_access_int] = new TH2F(hist_name_mean,"MEAN strip plot", xStripMax, 0, xStripMax, 100, 300, chamber_axisMax);
0478
0479 TCanvas *thisCanv_mean_strip=CANV_PEDMEAN_STRIP_ARRAY[chamber_access_int];
0480 thisCanv_mean_strip-> cd(k+1);
0481
0482 layer[layer_access_int]->GetXaxis()->SetTitle("Strip");
0483 layer[layer_access_int]->GetXaxis()->SetTitleSize(0.070);
0484 layer[layer_access_int]->GetXaxis()->SetTitleOffset(0.5);
0485
0486 layer[layer_access_int]->GetYaxis()->SetTitle("Pedestal Mean");
0487 layer[layer_access_int]->GetYaxis()->SetTitleSize(0.070);
0488 layer[layer_access_int]->GetYaxis()->SetTitleOffset(0.5);
0489
0490 const char value2[17];
0491 sprintf(value2, "cham==%d&&layer==%d",j,k);
0492 const char *value2_ = value2;
0493
0494 layer[layer_access_int]->SetMarkerStyle(20);
0495
0496 horiz_low_pedmean->SetX2(xStripMax);
0497 horiz_high_pedmean->SetX2(xStripMax);
0498
0499 Calibration->UseCurrentStyle();
0500 layer[layer_access_int]->Draw();
0501 Calibration->Project(hist_name_mean, "pedMean:strip", value2_);
0502 horiz_low_pedmean->Draw("same");
0503 horiz_high_pedmean->Draw("same");
0504
0505 }
0506
0507 gSystem->cd("pedMeanStrips");
0508 TString canvName = CANV_PEDMEAN_STRIP_ARRAY[chamber_access_int]->GetName();
0509 PrintAsGif(thisCanv_mean_strip, canvName);
0510 gSystem->cd("../");
0511 }
0512 }
0513
0514 gSystem->cd("../../../../");
0515 directoryCheck();
0516 }
0517
0518 void pedRMSFlagGraph(TString myFileName, TString myFilePath){
0519 gStyle->SetOptStat(0);
0520 gSystem->cd("images/Crosstalk");
0521 gSystem->cd(myFileName);
0522
0523
0524 TCanvas *flagRMSCanv = new TCanvas("flagRMSCanv", "flagRMSCanv", 200,10,800,800);
0525 flagRMSCanv->SetCanvasSize(1200,800);
0526 flagRMSGraph_1D = new TH1F("flagRMSGraph_1D", "flagRMSGraph_1D", 5, 0, 5);
0527 flagRMSGraph_1D->GetYaxis()->SetTitle("Number");
0528 flagRMSGraph_1D->GetYaxis()->SetLabelSize(0.035);
0529 flagRMSGraph_1D->GetXaxis()->SetTitle("Flag");
0530 flagRMSGraph_1D->GetXaxis()->SetLabelSize(0.035);
0531
0532 TLegend *LegRMS = new TLegend(0.85,0.8,0.98,0.98);
0533 LegRMS->SetHeader("RMS Flags Definitions");
0534 LegRMS->SetFillColor(0);
0535 LegRMS->SetTextSize(0);
0536
0537 Calibration->UseCurrentStyle();
0538 Calibration->Draw("flagRMS>>flagRMSGraph_1D");
0539
0540 LegRMS->AddEntry("", "1: Good");
0541 LegRMS->AddEntry("", "2: High CFEB Noise");
0542 LegRMS->AddEntry("", "3: Too low Noise");
0543 LegRMS->AddEntry("", "4: Too high Noise");
0544 LegRMS->Draw("same");
0545
0546 flagRMSCanv->Update();
0547
0548
0549
0550 PrintAsGif(flagRMSCanv, "flagRMS");
0551
0552
0553
0554 gStyle->SetOptStat(0);
0555
0556
0557
0558 TCanvas *flagRMSStripCanv = new TCanvas("flagRMSStripCanv", "flagRMSStripCanv", 200,10,800,800);
0559 flagRMSStripCanv->SetCanvasSize(1200,800);
0560
0561
0562 TLegend *LegRMSStrip = new TLegend(0.85,0.8,0.98,0.98);
0563 LegRMSStrip->SetHeader("RMS Flags Definitions");
0564 LegRMSStrip->SetFillColor(0);
0565 LegRMSStrip->SetTextSize(0);
0566
0567
0568 flagRMSGraph_2D_Strip = new TH2F("flagRMSGraph_2D_Strip", "flagRMSGraph_2D_Strip", 80, 0, 80, 6, 0, 6);
0569
0570 flagRMSGraph_2D_Strip0 = new TH2F("flagRMSGraph_2D_Strip0", "flagRMSGraph_2D_Strip0", 80, 0, 80, 6, 0, 6);
0571
0572 flagRMSGraph_2D_Strip1 = new TH2F("flagRMSGraph_2D_Strip1", "flagRMSGraph_2D_Strip1", 80, 0, 80, 6, 0, 6);
0573 flagRMSGraph_2D_Strip2 = new TH2F("flagRMSGraph_2D_Strip2", "flagRMSGraph_2D_Strip2", 80, 0, 80, 6, 0, 6);
0574 flagRMSGraph_2D_Strip3 = new TH2F("flagRMSGraph_2D_Strip3", "flagRMSGraph_2D_Strip3", 80, 0, 80, 6, 0, 6);
0575 flagRMSGraph_2D_Strip4 = new TH2F("flagRMSGraph_2D_Strip4", "flagRMSGraph_2D_Strip4", 80, 0, 80, 6, 0, 6);
0576 flagRMSGraph_2D_Strip5 = new TH2F("flagRMSGraph_2D_Strip5", "flagRMSGraph_2D_Strip5", 80, 0, 80, 6, 0, 6);
0577 flagRMSGraph_2D_Strip6 = new TH2F("flagRMSGraph_2D_Strip6", "flagRMSGraph_2D_Strip6", 80, 0, 80, 6, 0, 6);
0578
0579
0580 Calibration->Project("flagRMSGraph_2D_Strip0","flagRMS:strip");
0581 Double_t binMaxValStrip = flagRMSGraph_2D_Strip0->GetMaximum();
0582
0583 flagRMSGraph_2D_Strip->SetMaximum(binMaxValStrip);
0584
0585
0586 Calibration->Project("flagRMSGraph_2D_Strip1","flagRMS:strip", "flagRMS==1","box");
0587 Calibration->Project("flagRMSGraph_2D_Strip2","flagRMS:strip", "flagRMS==2","box");
0588 Calibration->Project("flagRMSGraph_2D_Strip3","flagRMS:strip", "flagRMS==3","box");
0589 Calibration->Project("flagRMSGraph_2D_Strip4","flagRMS:strip", "flagRMS==4","box");
0590 Calibration->Project("flagRMSGraph_2D_Strip5","flagRMS:strip", "flagRMS==5","box");
0591
0592
0593 flagRMSGraph_2D_Strip1->SetFillColor(1);
0594 flagRMSGraph_2D_Strip2->SetFillColor(2);
0595 flagRMSGraph_2D_Strip3->SetFillColor(3);
0596 flagRMSGraph_2D_Strip4->SetFillColor(4);
0597
0598 flagRMSStripCanv->cd();
0599 flagRMSGraph_2D_Strip->GetYaxis()->SetTitle("Flag");
0600 flagRMSGraph_2D_Strip->GetXaxis()->SetTitle("Strip, all Chambers");
0601
0602
0603 flagRMSGraph_2D_Strip->Draw("box");
0604
0605 flagRMSGraph_2D_Strip1->Draw("samebox");
0606 flagRMSGraph_2D_Strip2->Draw("samebox");
0607 flagRMSGraph_2D_Strip3->Draw("samebox");
0608 flagRMSGraph_2D_Strip4->Draw("samebox");
0609 flagRMSGraph_2D_Strip5->Draw("samebox");
0610 flagRMSGraph_2D_Strip6->Draw("samebox");
0611
0612
0613 LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip1, "Good", "f");
0614 LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip2, "High CFEB Noise", "f");
0615 LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip3, "Too low Noise", "f");
0616 LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip4, "Too high Noise", "f");
0617 LegRMSStrip->Draw("same");
0618
0619 PrintAsGif(flagRMSStripCanv, "flagRMSStrip");
0620
0621
0622 TCanvas *flagRMSChamberCanv = new TCanvas("flagRMSChamberCanv", "flagRMSChamberCanv", 200,10,800,800);
0623 flagRMSChamberCanv->SetCanvasSize(1200,800);
0624
0625
0626 TLegend *LegRMSChamber = new TLegend(0.85,0.8,0.98,0.98);
0627 LegRMSChamber->SetHeader("RMS Flags Definitions");
0628 LegRMSChamber->SetFillColor(0);
0629 LegRMSChamber->SetTextSize(0);
0630
0631
0632 flagRMSGraph_2D_Chamber = new TH2F("flagRMSGraph_2D_Chamber", "flagRMSGraph_2D_Chamber", 9, 0, 9, 6, 0, 6);
0633
0634 flagRMSGraph_2D_Chamber0 = new TH2F("flagRMSGraph_2D_Chamber0", "flagRMSGraph_2D_Chamber0", 9, 0, 9, 6, 0, 6);
0635
0636 flagRMSGraph_2D_Chamber1 = new TH2F("flagRMSGraph_2D_Chamber1", "flagRMSGraph_2D_Chamber1", 9, 0, 9, 6, 0, 6);
0637 flagRMSGraph_2D_Chamber2 = new TH2F("flagRMSGraph_2D_Chamber2", "flagRMSGraph_2D_Chamber2", 9, 0, 9, 6, 0, 6);
0638 flagRMSGraph_2D_Chamber3 = new TH2F("flagRMSGraph_2D_Chamber3", "flagRMSGraph_2D_Chamber3", 9, 0, 9, 6, 0, 6);
0639 flagRMSGraph_2D_Chamber4 = new TH2F("flagRMSGraph_2D_Chamber4", "flagRMSGraph_2D_Chamber4", 9, 0, 9, 6, 0, 6);
0640 flagRMSGraph_2D_Chamber5 = new TH2F("flagRMSGraph_2D_Chamber5", "flagRMSGraph_2D_Chamber5", 9, 0, 9, 6, 0, 6);
0641 flagRMSGraph_2D_Chamber6 = new TH2F("flagRMSGraph_2D_Chamber6", "flagRMSGraph_2D_Chamber6", 9, 0, 9, 6, 0, 6);
0642
0643
0644 Calibration->Project("flagRMSGraph_2D_Chamber0","flagRMS:cham");
0645 Double_t binMaxValCham = flagRMSGraph_2D_Chamber0->GetMaximum();
0646
0647 flagRMSGraph_2D_Chamber->SetMaximum(binMaxValCham);
0648
0649
0650 Calibration->Project("flagRMSGraph_2D_Chamber1","flagRMS:cham", "flagRMS==1", "box");
0651 Calibration->Project("flagRMSGraph_2D_Chamber2","flagRMS:cham", "flagRMS==2", "box");
0652 Calibration->Project("flagRMSGraph_2D_Chamber3","flagRMS:cham", "flagRMS==3", "box");
0653 Calibration->Project("flagRMSGraph_2D_Chamber4","flagRMS:cham", "flagRMS==4", "box");
0654 Calibration->Project("flagRMSGraph_2D_Chamber5","flagRMS:cham", "flagRMS==5", "box");
0655
0656
0657 flagRMSGraph_2D_Chamber1->SetFillColor(1);
0658 flagRMSGraph_2D_Chamber2->SetFillColor(2);
0659 flagRMSGraph_2D_Chamber3->SetFillColor(3);
0660 flagRMSGraph_2D_Chamber4->SetFillColor(4);
0661
0662 int idArray[9];
0663 GetChamberIDs(idArray);
0664 for (int chamNum = 0; chamNum<9; ++chamNum){
0665 int chamNumPlus = chamNum + 1;
0666
0667 Int_t chamber_id_int = idArray[chamNum];
0668 std::stringstream chamber_id_stream;
0669 chamber_id_stream << chamber_id_int;
0670 TString chamber_id_str = chamber_id_stream.str();
0671 if (chamber_id_str.BeginsWith("220")==0 ){
0672 chamber_id_str=0;
0673 }else{
0674 chamber_id_str.Remove(8,8);
0675 chamber_id_str.Remove(0,3);
0676 }
0677 flagRMSGraph_2D_Chamber->GetXaxis()->SetBinLabel(chamNumPlus,chamber_id_str);
0678 }
0679
0680 flagRMSChamberCanv->cd();
0681 flagRMSGraph_2D_Chamber->GetYaxis()->SetTitle("Flag");
0682 flagRMSGraph_2D_Chamber->GetXaxis()->SetTitle("Chamber");
0683
0684
0685 flagRMSGraph_2D_Chamber->Draw("box");
0686
0687 flagRMSGraph_2D_Chamber1->Draw("samebox");
0688 flagRMSGraph_2D_Chamber2->Draw("samebox");
0689 flagRMSGraph_2D_Chamber3->Draw("samebox");
0690 flagRMSGraph_2D_Chamber4->Draw("samebox");
0691 flagRMSGraph_2D_Chamber5->Draw("samebox");
0692 flagRMSGraph_2D_Chamber6->Draw("samebox");
0693
0694
0695 LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber1, "Good", "f");
0696 LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber2, "High CFEB Noise", "f");
0697 LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber3, "Too low Noise", "f");
0698 LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber4, "Too high Noise", "f");
0699 LegRMSChamber->Draw("same");
0700
0701
0702 PrintAsGif(flagRMSChamberCanv, "flagRMSChamber");
0703
0704
0705
0706 TCanvas *flagRMSLayerCanv = new TCanvas("flagRMSLayerCanv", "flagRMSLayerCanv", 200,10,800,800);
0707 flagRMSLayerCanv->SetCanvasSize(1200,800);
0708
0709
0710 TLegend *LegRMSLayer = new TLegend(0.85,0.8,0.98,0.98);
0711 LegRMSLayer->SetHeader("RMS Flags Definitions");
0712 LegRMSLayer->SetFillColor(0);
0713 LegRMSLayer->SetTextSize(0);
0714
0715
0716 flagRMSGraph_2D_Layer = new TH2F("flagRMSGraph_2D_Layer", "flagRMSGraph_2D_Layer", 6, 0, 6, 6, 0, 6);
0717
0718 flagRMSGraph_2D_Layer0 = new TH2F("flagRMSGraph_2D_Layer0", "flagRMSGraph_2D_Layer0", 6, 0, 6, 6, 0, 6);
0719
0720 flagRMSGraph_2D_Layer1 = new TH2F("flagRMSGraph_2D_Layer1", "flagRMSGraph_2D_Layer1", 6, 0, 6, 6, 0, 6);
0721 flagRMSGraph_2D_Layer2 = new TH2F("flagRMSGraph_2D_Layer2", "flagRMSGraph_2D_Layer2", 6, 0, 6, 6, 0, 6);
0722 flagRMSGraph_2D_Layer3 = new TH2F("flagRMSGraph_2D_Layer3", "flagRMSGraph_2D_Layer3", 6, 0, 6, 6, 0, 6);
0723 flagRMSGraph_2D_Layer4 = new TH2F("flagRMSGraph_2D_Layer4", "flagRMSGraph_2D_Layer4", 6, 0, 6, 6, 0, 6);
0724 flagRMSGraph_2D_Layer5 = new TH2F("flagRMSGraph_2D_Layer5", "flagRMSGraph_2D_Layer5", 6, 0, 6, 6, 0, 6);
0725 flagRMSGraph_2D_Layer6 = new TH2F("flagRMSGraph_2D_Layer6", "flagRMSGraph_2D_Layer6", 6, 0, 6, 6, 0, 6);
0726
0727
0728 Calibration->Project("flagRMSGraph_2D_Layer0","flagRMS:layer");
0729 Double_t binMaxValLayer = flagRMSGraph_2D_Layer0->GetMaximum();
0730
0731 flagRMSGraph_2D_Layer->SetMaximum(binMaxValLayer);
0732
0733
0734 Calibration->Project("flagRMSGraph_2D_Layer1","flagRMS:layer", "flagRMS==1", "box");
0735 Calibration->Project("flagRMSGraph_2D_Layer2","flagRMS:layer", "flagRMS==2", "box");
0736 Calibration->Project("flagRMSGraph_2D_Layer3","flagRMS:layer", "flagRMS==3", "box");
0737 Calibration->Project("flagRMSGraph_2D_Layer4","flagRMS:layer", "flagRMS==4", "box");
0738 Calibration->Project("flagRMSGraph_2D_Layer5","flagRMS:layer", "flagRMS==5", "box");
0739
0740
0741 flagRMSGraph_2D_Layer1->SetFillColor(1);
0742 flagRMSGraph_2D_Layer2->SetFillColor(2);
0743 flagRMSGraph_2D_Layer3->SetFillColor(3);
0744 flagRMSGraph_2D_Layer4->SetFillColor(4);
0745
0746
0747 flagRMSLayerCanv->cd();
0748 flagRMSGraph_2D_Layer->GetYaxis()->SetTitle("Flag");
0749 flagRMSGraph_2D_Layer->GetXaxis()->SetTitle("Layer, all Chambers");
0750
0751
0752 flagRMSGraph_2D_Layer->Draw("box");
0753
0754 flagRMSGraph_2D_Layer1->Draw("samebox");
0755 flagRMSGraph_2D_Layer2->Draw("samebox");
0756 flagRMSGraph_2D_Layer3->Draw("samebox");
0757 flagRMSGraph_2D_Layer4->Draw("samebox");
0758 flagRMSGraph_2D_Layer5->Draw("samebox");
0759 flagRMSGraph_2D_Layer6->Draw("samebox");
0760
0761
0762 LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer1, "Good", "f");
0763 LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer2, "High CFEB Noise", "f");
0764 LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer3, "Too low Noise", "f");
0765 LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer4, "Too high Noise", "f");
0766 LegRMSLayer->Draw("same");
0767
0768 PrintAsGif(flagRMSLayerCanv, "flagRMSLayer");
0769
0770 gSystem->cd("../../../");
0771 gStyle->SetOptStat(1);
0772 }
0773
0774 void pedNoiseFlagGraph(TString myFileName, TString myFilePath){
0775
0776 gStyle->SetOptStat(0);
0777 gSystem->cd("images/Crosstalk");
0778 gSystem->cd(myFileName);
0779
0780
0781 TCanvas *flagMeanCanv = new TCanvas("flagMeanCanv", "flagMeanCanv", 200,10,800,800);
0782 flagMeanCanv->SetCanvasSize(1200,800);
0783 flagMeanGraph_1D = new TH1F("flagMeanGraph_1D", "flagMeanGraph_1D", 5, 0, 5);
0784 flagMeanGraph_1D->GetYaxis()->SetTitle("Number");
0785 flagMeanGraph_1D->GetYaxis()->SetLabelSize(0.035);
0786 flagMeanGraph_1D->GetXaxis()->SetTitle("Flag");
0787 flagMeanGraph_1D->GetXaxis()->SetLabelSize(0.035);
0788
0789 TLegend *LegMean = new TLegend(0.85,0.8,0.98,0.98);
0790 LegMean->SetHeader("Mean Flags Definitions");
0791 LegMean->SetFillColor(0);
0792 LegMean->SetTextSize(0);
0793
0794 Calibration->UseCurrentStyle();
0795 Calibration->Draw("flagNoise>>flagMeanGraph_1D");
0796
0797 LegMean->AddEntry(flagMeanGraph_1D, "1: Normal Pedestal", "f");
0798 LegMean->AddEntry(flagMeanGraph_1D, "2: Low Failure", "f");
0799 LegMean->AddEntry(flagMeanGraph_1D, "3: Low Warning", "f");
0800 LegMean->AddEntry(flagMeanGraph_1D, "4: High Warning", "f");
0801 LegMean->AddEntry(flagMeanGraph_1D, "5: High Failure", "f");
0802
0803 LegMean->Draw("same");
0804
0805 flagMeanCanv->Update();
0806
0807
0808 PrintAsGif(flagMeanCanv, "flagMean");
0809
0810
0811
0812 gStyle->SetOptStat(0);
0813
0814
0815
0816 TCanvas *flagMeanStripCanv = new TCanvas("flagMeanStripCanv", "flagMeanStripCanv", 200,10,800,800);
0817 flagMeanStripCanv->SetCanvasSize(1200,800);
0818
0819
0820 TLegend *LegMeanStrip = new TLegend(0.85,0.8,0.98,0.98);
0821 LegMeanStrip->SetHeader("Mean Flags Definitions");
0822 LegMeanStrip->SetFillColor(0);
0823 LegMeanStrip->SetTextSize(0);
0824
0825
0826 flagMeanGraph_2D_Strip = new TH2F("flagMeanGraph_2D_Strip", "flagMeanGraph_2D_Strip", 80, 0, 80, 6, 0, 6);
0827
0828 flagMeanGraph_2D_Strip0 = new TH2F("flagMeanGraph_2D_Strip0", "flagMeanGraph_2D_Strip0", 80, 0, 80, 6, 0, 6);
0829
0830 flagMeanGraph_2D_Strip1 = new TH2F("flagMeanGraph_2D_Strip1", "flagMeanGraph_2D_Strip1", 80, 0, 80, 6, 0, 6);
0831 flagMeanGraph_2D_Strip2 = new TH2F("flagMeanGraph_2D_Strip2", "flagMeanGraph_2D_Strip2", 80, 0, 80, 6, 0, 6);
0832 flagMeanGraph_2D_Strip3 = new TH2F("flagMeanGraph_2D_Strip3", "flagMeanGraph_2D_Strip3", 80, 0, 80, 6, 0, 6);
0833 flagMeanGraph_2D_Strip4 = new TH2F("flagMeanGraph_2D_Strip4", "flagMeanGraph_2D_Strip4", 80, 0, 80, 6, 0, 6);
0834 flagMeanGraph_2D_Strip5 = new TH2F("flagMeanGraph_2D_Strip5", "flagMeanGraph_2D_Strip5", 80, 0, 80, 6, 0, 6);
0835 flagMeanGraph_2D_Strip6 = new TH2F("flagMeanGraph_2D_Strip6", "flagMeanGraph_2D_Strip6", 80, 0, 80, 6, 0, 6);
0836
0837
0838 Calibration->Project("flagMeanGraph_2D_Strip0","flagNoise:strip");
0839 Double_t binMaxValStrip = flagMeanGraph_2D_Strip0->GetMaximum();
0840
0841 flagMeanGraph_2D_Strip->SetMaximum(binMaxValStrip);
0842
0843
0844 Calibration->Project("flagMeanGraph_2D_Strip1","flagNoise:strip", "flagNoise==1","box");
0845 Calibration->Project("flagMeanGraph_2D_Strip2","flagNoise:strip", "flagNoise==2","box");
0846 Calibration->Project("flagMeanGraph_2D_Strip3","flagNoise:strip", "flagNoise==3","box");
0847 Calibration->Project("flagMeanGraph_2D_Strip4","flagNoise:strip", "flagNoise==4","box");
0848 Calibration->Project("flagMeanGraph_2D_Strip5","flagNoise:strip", "flagNoise==5","box");
0849
0850
0851 flagMeanGraph_2D_Strip1->SetFillColor(1);
0852 flagMeanGraph_2D_Strip2->SetFillColor(2);
0853 flagMeanGraph_2D_Strip3->SetFillColor(3);
0854 flagMeanGraph_2D_Strip4->SetFillColor(4);
0855 flagMeanGraph_2D_Strip5->SetFillColor(5);
0856
0857
0858 flagMeanStripCanv->cd();
0859 flagMeanGraph_2D_Strip->GetYaxis()->SetTitle("Flag");
0860 flagMeanGraph_2D_Strip->GetXaxis()->SetTitle("Strip, all Chambers");
0861
0862
0863 flagMeanGraph_2D_Strip->Draw("box");
0864
0865 flagMeanGraph_2D_Strip1->Draw("samebox");
0866 flagMeanGraph_2D_Strip2->Draw("samebox");
0867 flagMeanGraph_2D_Strip3->Draw("samebox");
0868 flagMeanGraph_2D_Strip4->Draw("samebox");
0869 flagMeanGraph_2D_Strip5->Draw("samebox");
0870 flagMeanGraph_2D_Strip6->Draw("samebox");
0871
0872
0873 LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip1, "1: Normal Pedestal", "f");
0874 LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip2, "2: Low Failure", "f");
0875 LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip3, "3: Low Warning", "f");
0876 LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip4, "4: High Warning", "f");
0877 LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip5, "5: High Failure", "f");
0878 LegMeanStrip->Draw("same");
0879
0880
0881 PrintAsGif(flagMeanStripCanv, "flagMeanStrip");
0882
0883
0884 TCanvas *flagMeanChamberCanv = new TCanvas("flagMeanChamberCanv", "flagMeanChamberCanv", 200,10,800,800);
0885 flagMeanChamberCanv->SetCanvasSize(1200,800);
0886
0887
0888 TLegend *LegMeanChamber = new TLegend(0.85,0.8,0.98,0.98);
0889 LegMeanChamber->SetHeader("Mean Flags Definitions");
0890 LegMeanChamber->SetFillColor(0);
0891 LegMeanChamber->SetTextSize(0);
0892
0893
0894 flagMeanGraph_2D_Chamber = new TH2F("flagMeanGraph_2D_Chamber", "flagMeanGraph_2D_Chamber", 9, 0, 9, 6, 0, 6);
0895
0896 flagMeanGraph_2D_Chamber0 = new TH2F("flagMeanGraph_2D_Chamber0", "flagMeanGraph_2D_Chamber0", 9, 0, 9, 6, 0, 6);
0897
0898 flagMeanGraph_2D_Chamber1 = new TH2F("flagMeanGraph_2D_Chamber1", "flagMeanGraph_2D_Chamber1", 9, 0, 9, 6, 0, 6);
0899 flagMeanGraph_2D_Chamber2 = new TH2F("flagMeanGraph_2D_Chamber2", "flagMeanGraph_2D_Chamber2", 9, 0, 9, 6, 0, 6);
0900 flagMeanGraph_2D_Chamber3 = new TH2F("flagMeanGraph_2D_Chamber3", "flagMeanGraph_2D_Chamber3", 9, 0, 9, 6, 0, 6);
0901 flagMeanGraph_2D_Chamber4 = new TH2F("flagMeanGraph_2D_Chamber4", "flagMeanGraph_2D_Chamber4", 9, 0, 9, 6, 0, 6);
0902 flagMeanGraph_2D_Chamber5 = new TH2F("flagMeanGraph_2D_Chamber5", "flagMeanGraph_2D_Chamber5", 9, 0, 9, 6, 0, 6);
0903 flagMeanGraph_2D_Chamber6 = new TH2F("flagMeanGraph_2D_Chamber6", "flagMeanGraph_2D_Chamber6", 9, 0, 9, 6, 0, 6);
0904
0905
0906 Calibration->Project("flagMeanGraph_2D_Chamber0","flagNoise:cham");
0907 Double_t binMaxValCham = flagMeanGraph_2D_Chamber0->GetMaximum();
0908
0909 flagMeanGraph_2D_Chamber->SetMaximum(binMaxValCham);
0910
0911
0912 Calibration->Project("flagMeanGraph_2D_Chamber1","flagNoise:cham", "flagNoise==1", "box");
0913 Calibration->Project("flagMeanGraph_2D_Chamber2","flagNoise:cham", "flagNoise==2", "box");
0914 Calibration->Project("flagMeanGraph_2D_Chamber3","flagNoise:cham", "flagNoise==3", "box");
0915 Calibration->Project("flagMeanGraph_2D_Chamber4","flagNoise:cham", "flagNoise==4", "box");
0916 Calibration->Project("flagMeanGraph_2D_Chamber5","flagNoise:cham", "flagNoise==5", "box");
0917
0918
0919 flagMeanGraph_2D_Chamber1->SetFillColor(1);
0920 flagMeanGraph_2D_Chamber2->SetFillColor(2);
0921 flagMeanGraph_2D_Chamber3->SetFillColor(3);
0922 flagMeanGraph_2D_Chamber4->SetFillColor(4);
0923 flagMeanGraph_2D_Chamber5->SetFillColor(5);
0924
0925 int idArray[9];
0926 GetChamberIDs(idArray);
0927 for (int chamNum = 0; chamNum<9; ++chamNum){
0928 int chamNumPlus = chamNum + 1;
0929
0930 Int_t chamber_id_int = idArray[chamNum];
0931 std::stringstream chamber_id_stream;
0932 chamber_id_stream << chamber_id_int;
0933 TString chamber_id_str = chamber_id_stream.str();
0934 if (chamber_id_str.BeginsWith("220")==0 ){
0935 chamber_id_str=0;
0936 }else{
0937 chamber_id_str.Remove(8,8);
0938 chamber_id_str.Remove(0,3);
0939 }
0940 flagMeanGraph_2D_Chamber->GetXaxis()->SetBinLabel(chamNumPlus,chamber_id_str);
0941 }
0942
0943 flagMeanChamberCanv->cd();
0944 flagMeanGraph_2D_Chamber->GetYaxis()->SetTitle("Flag");
0945 flagMeanGraph_2D_Chamber->GetXaxis()->SetTitle("Chamber");
0946
0947 flagMeanGraph_2D_Chamber->Draw("box");
0948
0949 flagMeanGraph_2D_Chamber1->Draw("samebox");
0950 flagMeanGraph_2D_Chamber2->Draw("samebox");
0951 flagMeanGraph_2D_Chamber3->Draw("samebox");
0952 flagMeanGraph_2D_Chamber4->Draw("samebox");
0953 flagMeanGraph_2D_Chamber5->Draw("samebox");
0954 flagMeanGraph_2D_Chamber6->Draw("samebox");
0955
0956
0957 LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber1, "1: Normal Pedestal", "f");
0958 LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber2, "2: Low Failure", "f");
0959 LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber3, "3: Low Warning", "f");
0960 LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber4, "4: High Warning", "f");
0961 LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber5, "5: High Failure", "f");
0962 LegMeanChamber->Draw("same");
0963
0964
0965 PrintAsGif(flagMeanChamberCanv, "flagMeanChamber");
0966
0967
0968
0969 TCanvas *flagMeanLayerCanv = new TCanvas("flagMeanLayerCanv", "flagMeanLayerCanv", 200,10,800,800);
0970 flagMeanLayerCanv->SetCanvasSize(1200,800);
0971
0972
0973 TLegend *LegMeanLayer = new TLegend(0.85,0.8,0.98,0.98);
0974 LegMeanLayer->SetHeader("Mean Flags Definitions");
0975 LegMeanLayer->SetFillColor(0);
0976 LegMeanLayer->SetTextSize(0);
0977
0978
0979 flagMeanGraph_2D_Layer = new TH2F("flagMeanGraph_2D_Layer", "flagMeanGraph_2D_Layer", 6, 0, 6, 6, 0, 6);
0980
0981 flagMeanGraph_2D_Layer0 = new TH2F("flagMeanGraph_2D_Layer0", "flagMeanGraph_2D_Layer0", 6, 0, 6, 6, 0, 6);
0982
0983 flagMeanGraph_2D_Layer1 = new TH2F("flagMeanGraph_2D_Layer1", "flagMeanGraph_2D_Layer1", 6, 0, 6, 6, 0, 6);
0984 flagMeanGraph_2D_Layer2 = new TH2F("flagMeanGraph_2D_Layer2", "flagMeanGraph_2D_Layer2", 6, 0, 6, 6, 0, 6);
0985 flagMeanGraph_2D_Layer3 = new TH2F("flagMeanGraph_2D_Layer3", "flagMeanGraph_2D_Layer3", 6, 0, 6, 6, 0, 6);
0986 flagMeanGraph_2D_Layer4 = new TH2F("flagMeanGraph_2D_Layer4", "flagMeanGraph_2D_Layer4", 6, 0, 6, 6, 0, 6);
0987 flagMeanGraph_2D_Layer5 = new TH2F("flagMeanGraph_2D_Layer5", "flagMeanGraph_2D_Layer5", 6, 0, 6, 6, 0, 6);
0988 flagMeanGraph_2D_Layer6 = new TH2F("flagMeanGraph_2D_Layer6", "flagMeanGraph_2D_Layer6", 6, 0, 6, 6, 0, 6);
0989
0990
0991 Calibration->Project("flagMeanGraph_2D_Layer0","flagNoise:layer");
0992 Double_t binMaxValLayer = flagMeanGraph_2D_Layer0->GetMaximum();
0993
0994 flagMeanGraph_2D_Layer->SetMaximum(binMaxValLayer);
0995
0996
0997 Calibration->Project("flagMeanGraph_2D_Layer1","flagNoise:layer", "flagNoise==1", "box");
0998 Calibration->Project("flagMeanGraph_2D_Layer2","flagNoise:layer", "flagNoise==2", "box");
0999 Calibration->Project("flagMeanGraph_2D_Layer3","flagNoise:layer", "flagNoise==3", "box");
1000 Calibration->Project("flagMeanGraph_2D_Layer4","flagNoise:layer", "flagNoise==4", "box");
1001 Calibration->Project("flagMeanGraph_2D_Layer5","flagNoise:layer", "flagNoise==5", "box");
1002
1003
1004 flagMeanGraph_2D_Layer1->SetFillColor(1);
1005 flagMeanGraph_2D_Layer2->SetFillColor(2);
1006 flagMeanGraph_2D_Layer3->SetFillColor(3);
1007 flagMeanGraph_2D_Layer4->SetFillColor(4);
1008 flagMeanGraph_2D_Layer5->SetFillColor(5);
1009
1010 flagMeanLayerCanv->cd();
1011 flagMeanGraph_2D_Layer->GetYaxis()->SetTitle("Flag");
1012 flagMeanGraph_2D_Layer->GetXaxis()->SetTitle("Layer, per Chamber");
1013
1014
1015 flagMeanGraph_2D_Layer->Draw("box");
1016
1017 flagMeanGraph_2D_Layer1->Draw("samebox");
1018 flagMeanGraph_2D_Layer2->Draw("samebox");
1019 flagMeanGraph_2D_Layer3->Draw("samebox");
1020 flagMeanGraph_2D_Layer4->Draw("samebox");
1021 flagMeanGraph_2D_Layer5->Draw("samebox");
1022 flagMeanGraph_2D_Layer6->Draw("samebox");
1023
1024
1025 LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer1, "1: Normal Pedestal", "f");
1026 LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer2, "2: Low Failure", "f");
1027 LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer3, "3: Low Warning", "f");
1028 LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer4, "4: High Warning", "f");
1029 LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer5, "5: High Failure", "f");
1030 LegMeanChamber->Draw("same");
1031
1032 PrintAsGif(flagMeanLayerCanv, "flagMeanLayer");
1033
1034 gSystem->cd("../../../");
1035 gStyle->SetOptStat(1);
1036 }
1037
1038 void PulseGraphs(TString myFileName, TString myFilePath){
1039 TFile *myfile = TFile::Open(myFilePath);
1040 std::cout << "begginng of PulseGraphs, now in : " << gSystem->pwd() << std::endl;
1041 std::cout << "opening file: " << myFilePath << std::endl;
1042
1043 gSystem->cd("/afs/cern.ch/cms/CSC/html/csccalib/");
1044 gSystem->cd("images/Crosstalk");
1045 gSystem->cd(myFileName);
1046 makeDirectory("PulseGraphs");
1047
1048 TCanvas *canv_pulse;
1049 TH2F *gPulse;
1050 TString cname="Pulse_Graph_all_chambers";
1051 TString ctitle="Pulse Graph over all Chambers";
1052 canv_pulse = new TCanvas(cname,ctitle,1100,700);
1053 gPulse = (TH2F*)myfile->Get("pulse");
1054 gPulse->GetXaxis()->SetLabelSize(0.07);
1055 gPulse->GetYaxis()->SetLabelSize(0.07);
1056 gPulse->GetXaxis()->SetTitleSize(0.07);
1057 gPulse->GetXaxis()->SetTitleOffset(0.7);
1058 gPulse->GetXaxis()->SetTitle("Time (ns)");
1059 gPulse->GetYaxis()->SetTitle("ADC Count");
1060 canv_pulse->cd();
1061 gPulse->Draw();
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106 gSystem->cd("PulseGraphs");
1107 TString PulseGraphCanvName = canv_pulse->GetName();
1108 PrintAsGif(canv_pulse,PulseGraphCanvName);
1109
1110 gSystem->cd("/afs/cern.ch/user/c/csccalib/scratch0/CMSSW_1_5_1/src/OnlineDB/CSCCondDB/test");
1111 directoryCheck();
1112 myfile->Close();
1113 }
1114
1115 void PeakGraphs(TString myFileName, TString myFilePath, int nCham){
1116 std::cout << "begginng of PeakGraphs, now in : " << gSystem->pwd() << std::endl;
1117 std::cout << "opening file: " << myFilePath << std::endl;
1118 gSystem->cd("/afs/cern.ch/cms/CSC/html/csccalib/");
1119
1120 gSystem->cd("images/Crosstalk");
1121 gSystem->cd(myFileName);
1122 makeDirectory("PeakADCTimingGraphs");
1123
1124 TLine *vert_min_Time = new TLine(250, 0, 250, 200);
1125 TLine *vert_max_Time = new TLine(360, 0, 360, 200);
1126 TLine *vert_min_ADC = new TLine(700, 0, 700, 200);
1127 TLine *vert_max_ADC = new TLine(1200, 0, 1200, 200);
1128
1129 vert_min_Time->SetLineStyle(3);
1130 vert_min_Time->SetLineColor(6);
1131 vert_min_Time->SetLineWidth(2);
1132
1133 vert_max_Time->SetLineStyle(3);
1134 vert_max_Time->SetLineColor(6);
1135 vert_max_Time->SetLineWidth(2);
1136
1137 vert_min_ADC->SetLineStyle(3);
1138 vert_min_ADC->SetLineColor(6);
1139 vert_min_ADC->SetLineWidth(2);
1140
1141 vert_max_ADC->SetLineStyle(3);
1142 vert_max_ADC->SetLineColor(6);
1143 vert_max_ADC->SetLineWidth(2);
1144
1145
1146 TCanvas *PeakCanv = new TCanvas("Peak Timing", "Peak Time and ADC for all Chambers", 200, 10, 1200, 800);
1147 PeakCanv->Divide(2,1);
1148 PeakCanv->SetCanvasSize(1200,800);
1149
1150 PeakCanv->cd(1);
1151 TH1F *PeakADC = new TH1F("PeakADC", "Peak ADC over all Chambers", 100, 600, 1400);
1152 PeakADC->Draw();
1153 PeakADC->GetXaxis()->SetTitle("ADC Count at Peak Time");
1154 PeakADC->GetXaxis()->SetTitleSize(0.070);
1155 PeakADC->GetXaxis()->SetTitleOffset(0.5);
1156 Calibration->Project("PeakADC", "maxADC");
1157
1158 Double_t yMaxValADC = PeakADC->GetMaximum();
1159 Double_t yMaxRanADC = yMaxValADC + (yMaxValADC*.1);
1160 vert_max_ADC->SetY2(yMaxRanADC);
1161 vert_min_ADC->SetY2(yMaxRanADC);
1162 PeakADC->SetAxisRange(0,yMaxRanADC,"Y");
1163 vert_max_ADC->Draw();
1164 vert_min_ADC->Draw();
1165
1166 PeakCanv->cd(2);
1167 TH1F *PeakTime = new TH1F("PeakTime", "Peak Time over all Chambers", 100, 200, 400);
1168 PeakTime->Draw();
1169 PeakTime->GetXaxis()->SetTitle("Peak Time (ns)");
1170 PeakTime->GetXaxis()->SetTitleSize(0.070);
1171 PeakTime->GetXaxis()->SetTitleOffset(0.5);
1172 Calibration->Project("PeakTime", "peakTime");
1173
1174 Double_t yMaxValTime = PeakTime->GetMaximum();
1175 Double_t yMaxRanTime = yMaxValTime + (yMaxValTime*.1);
1176 vert_max_Time->SetY2(yMaxRanTime);
1177 vert_min_Time->SetY2(yMaxRanTime);
1178 PeakTime->SetAxisRange(0,yMaxRanTime,"Y");
1179 vert_max_Time->Draw();
1180 vert_min_Time->Draw();
1181
1182
1183 PeakCanv->Update();
1184 PrintAsGif(PeakCanv, "PeakTimingADC");
1185
1186
1187 TObjArray PeakGraphCanvArray(nCham);
1188
1189 TH1F *PeakADCGraphs[9];
1190 TH1F *PeakTimeGraphs[9];
1191
1192 int idArray[9];
1193 GetChamberIDs(idArray);
1194 for (int cham_num=0; cham_num < nCham; ++cham_num){
1195 gSystem->cd("PeakADCTimingGraphs");
1196 Int_t chamber_id_int = idArray[cham_num];
1197
1198 Float_t MaxPeakTimeVal = Calibration->GetLeaf("MaxPeakTime")->GetValue(cham_num);
1199 Float_t MinPeakTimeVal = Calibration->GetLeaf("MinPeakTime")->GetValue(cham_num);
1200 Float_t MaxPeakADCVal = Calibration->GetLeaf("MaxPeakADC")->GetValue(cham_num);
1201 Float_t MinPeakADCVal = Calibration->GetLeaf("MinPeakADC")->GetValue(cham_num);
1202
1203 Float_t MaxPeakTimeValue = MaxPeakTimeVal + (.1)*MaxPeakTimeVal;
1204 if (MaxPeakTimeValue < 400.0){
1205 MaxPeakTimeValue = 400.0;
1206 }
1207 Float_t MinPeakTimeValue = MinPeakTimeVal + (.1)*MinPeakTimeVal;
1208 if (MinPeakTimeValue > 200.0){
1209 MinPeakTimeValue = 200.0;
1210 }
1211 Float_t MaxPeakADCValue = MaxPeakADCVal + (.1)*MaxPeakADCVal;
1212 if (MaxPeakADCValue < 1300.0){
1213 MaxPeakADCValue = 1300.0;
1214 }
1215 Float_t MinPeakADCValue = MinPeakADCVal + (.1)*MinPeakADCVal;
1216 if (MinPeakADCValue < 600.0){
1217 MinPeakADCValue = 600.0;
1218 }
1219
1220 TString PeakGraphCanvName = Form ("Chamber_%d_Peak_Graphs", chamber_id_int);
1221 TCanvas *canv_peak = new TCanvas(PeakGraphCanvName,PeakGraphCanvName, 200, 10, 1200, 800);
1222 canv_peak->Divide(2,1);
1223 canv_peak->SetCanvasSize(1200,800);
1224
1225 canv_peak->cd(1);
1226 TString hist_name = Form("PeakADCGraph_Chamber_%d", chamber_id_int);
1227 PeakADCGraphs[cham_num] = new TH1F(hist_name, "peakADC Plot", 50, MinPeakADCValue, MaxPeakADCValue);
1228 PeakADCGraphs[cham_num]->Draw();
1229
1230 TString xTitleName = Form("ADC Count at Peak Time for chamber %d", chamber_id_int);
1231 PeakADCGraphs[cham_num]->GetXaxis()->SetTitle(xTitleName);
1232 PeakADCGraphs[cham_num]->GetXaxis()->SetTitleSize(0.050);
1233 PeakADCGraphs[cham_num]->GetXaxis()->SetTitleOffset(0.5);
1234
1235 const char value[7];
1236 sprintf(value, "cham==%d", cham_num);
1237 const char *value_ = value;
1238 Calibration->Project(hist_name, "maxADC", value_);
1239
1240 Double_t yMaxValADC = PeakADCGraphs[cham_num]->GetMaximum();
1241 Double_t yMaxRanADC = yMaxValADC + (yMaxValADC*.1);
1242 vert_max_ADC->SetY2(yMaxRanADC);
1243 vert_min_ADC->SetY2(yMaxRanADC);
1244 PeakADCGraphs[cham_num]->SetAxisRange(0,yMaxRanADC,"Y");
1245 vert_max_ADC->Draw();
1246 vert_min_ADC->Draw();
1247
1248 canv_peak->cd(2);
1249 TString hist_name_ = Form("PeakTimeGraph_Chamber_%d", chamber_id_int);
1250 PeakTimeGraphs[cham_num] = new TH1F(hist_name_, "peakTime Plot", 50, MinPeakTimeValue, MaxPeakTimeValue);
1251 PeakTimeGraphs[cham_num]->Draw();
1252
1253 PeakTimeGraphs[cham_num]->GetXaxis()->SetTitle("Peak Time in nano seconds");
1254 PeakTimeGraphs[cham_num]->GetXaxis()->SetTitleSize(0.070);
1255 PeakTimeGraphs[cham_num]->GetXaxis()->SetTitleOffset(0.5);
1256
1257 const char valu[7];
1258 sprintf(valu, "cham==%d", cham_num);
1259 const char *valu_ = valu;
1260 Calibration->Project(hist_name_, "peakTime", valu_);
1261
1262 Double_t yMaxValTime = PeakTimeGraphs[cham_num]->GetMaximum();
1263 Double_t yMaxRanTime = yMaxValTime + (yMaxValTime*.1);
1264 vert_max_Time->SetY2(yMaxRanTime);
1265 vert_min_Time->SetY2(yMaxRanTime);
1266 PeakTimeGraphs[cham_num]->SetAxisRange(0,yMaxRanTime,"Y");
1267 vert_max_Time->Draw();
1268 vert_min_Time->Draw();
1269
1270 canv_peak->Update();
1271
1272 PeakGraphCanvArray.Add(canv_peak);
1273
1274 PrintAsGif(canv_peak, PeakGraphCanvName);
1275 }
1276 gSystem->cd("/afs/cern.ch/user/c/csccalib/scratch0/CMSSW_1_5_1/src/OnlineDB/CSCCondDB/test");
1277 directoryCheck();
1278 }