#include #include using namespace std; #include #include #include #include #include #include #include #include #include //#include #include #include #include #include #include #include #include #include #include #include #include "TLorentzVector.h" #include "TVector3.h" #include "TLorentzRotation.h" #include #include "Nice3D2D.c" #include "Nicer1D.c" void check_fcal(TString m_badlist = "", int m_energy = 3, int m_type = 1){ bool CalIssue = kFALSE; cout << endl << "Checking FCAL for:" << endl; cout << " 1/ All FCAL, m_type = 1" << endl; cout << " 2/ Suspicious gain, m_type = 2" << endl; cout << " 3/ Suspicious blocks, m_type == 3" << endl; gROOT->Reset(); gROOT->SetStyle("Bold"); gStyle->SetCanvasColor(0); gStyle->SetLabelColor(1); gStyle->SetLabelColor(1,"Y"); gStyle->SetHistLineColor(1); gStyle->SetHistLineWidth(1); gStyle->SetNdivisions(505); gStyle->SetNdivisions(505,"Y"); //gROOT->Macro("setcolor2.c"); gStyle->SetHistFillColor(999); gROOT->SetStyle("Plain"); // white as bg gStyle->SetOptStat("111111"); gStyle->SetFrameLineWidth(1); gStyle->SetTitleFontSize(0.1); gStyle->SetTitleBorderSize(0); //Definitions Double_t smallBetween1 = .1; Double_t smallBetween2 = .1; Double_t smallBetween3 = .1; Double_t smallBetween4 = .1; Double_t small = .00001; TLine TLine; TLatex *t = new TLatex(); t->SetTextSize(0.03); t->SetTextFont(42); t->SetTextAlign(12); t->SetTextColor(1); //t->SetTextFont(12); TCanvas *C1; TPad *SmallC; TGaxis *XAxis,*YAxis; TLatex XTitle,YTitle,XtopTitle; TLegend *legend; ifstream in; ofstream out; TString cleg = ""; TString path = "./"; TString file = ""; int badblk[2800]; for (int i = 0; i < 2800; i ++) badblk[i] = 0; in.open(m_badlist); while (in.good()) { int blk = -1; in >> blk; if (blk > 0) { badblk[blk] = 1; } } in.close(); const int kBlocksWide = 59; const int kBlocksTall = 59; int kMaxChannels = kBlocksWide * kBlocksTall; double kMidBlock = ( kBlocksWide - 1 ) / 2; double kBeamHoleSize = 3; double blockSize=4.0157; double radius=1.20471*100.; double blockLength=45.; double innerRadius = ( kBeamHoleSize - 1 ) / 2. * blockSize * sqrt(2.)*1.01; bool m_activeBlock[kBlocksTall][kBlocksWide]; TVector2 m_positionOnFace[kBlocksTall][kBlocksWide]; double BlockGain[kBlocksTall][kBlocksWide],BlockWidth[kBlocksTall][kBlocksWide],BlockMean[kBlocksTall][kBlocksWide]; int m_numActiveBlocks = 0; int m_numDeadBlocks = 0; double BlockGainActive[2800]; int OuterChannelNum[2800]; int nOuter = 0; double channelNum[2800]; int m_channelNumber[kBlocksTall][kBlocksWide]; int m_row[kMaxChannels]; int m_column[kMaxChannels]; for (int i = 0; i < 2800; i ++) channelNum[i] = i + 1; TProfile * hCurrentGainConstants = (TProfile *) gDirectory->Get("FCAL_Pi0/CurrentGainConstants"); TH1F * h1D = new TH1F("h1D", Form(";#font[42]{Pattern for E^{cluster}_{max} #geq %d GeV, block #};#font[42]{Counts [a.u.]}", m_energy), 2800, -0.5, 2799.5); Nicer1D(h1D, 0.05, 42, 505, 1.2, 0.7); TH2F * h2D = (TH2F *) gDirectory->Get(Form("XY/xy_%dGeV", m_energy)); if (m_energy == 0) h2D = (TH2F *) gDirectory->Get("XY/xy_all"); Nice3D2D(h2D, 0.05, 0.05, 42, 505, 1.1, 0.9, 1.25, "", "#font[42]{x [cm]}", "#font[42]{y [cm]}", "#font[42]{Entries #}"); smallBetween1 = .1; smallBetween2 = .175; smallBetween3 = .05; smallBetween4 = .125; cleg = Form("FCAL-2D-pattern-for-Emax-larger-than-%dGeV", m_energy); C1 = new TCanvas(cleg, cleg, 10, 10, 800, 800); gPad->SetLeftMargin(smallBetween1); gPad->SetRightMargin(smallBetween2); gPad->SetTopMargin(smallBetween3); gPad->SetBottomMargin(smallBetween4); h2D->Draw("colz"); gPad->SetLogz(); t->DrawLatex(-125, 132.5, Form("Pattern for E^{cluster}_{max} #geq %d GeV", m_energy)); for (int row = 0; row < kBlocksTall; row ++) { for (int col = 0; col < kBlocksWide; col ++) { m_positionOnFace[row][col] =TVector2( ( col - kMidBlock ) * blockSize,( row - kMidBlock ) * blockSize ); double thisRadius = m_positionOnFace[row][col].Mod(); if (innerRadius < thisRadius && thisRadius < radius) { double gain = hCurrentGainConstants->GetBinContent(m_numActiveBlocks + 1); double x_center = m_positionOnFace[row][col].X(); double y_center = m_positionOnFace[row][col].Y(); int xbin = h2D->GetXaxis()->FindBin(x_center); int ybin = h2D->GetXaxis()->FindBin(y_center); double co = h2D->GetBinContent(xbin, ybin); double x0 = x_center - blockSize / 2.0; double x1 = x_center + blockSize / 2.0; double y0 = y_center - blockSize / 2.0; double y1 = y_center + blockSize / 2.0; t->SetTextSize(0.01); if (m_type == 1) { t->DrawLatex(x_center, y_center, Form("#font[42]{%d}", m_numActiveBlocks)); TLine.SetLineWidth(1); TLine.SetLineColor(1); TLine.DrawLine(x0, y0, x1, y0); TLine.DrawLine(x0, y1, x1, y1); TLine.DrawLine(x0, y0, x0, y1); TLine.DrawLine(x1, y0, x1, y1); h1D->SetBinContent(m_numActiveBlocks + 1, co); } else if ( (m_type == 2 && (gain > 1.55 || gain < 0.55) && gain != 1.05) || (m_type == 3) ) { if (m_type == 2 && gain > 1.55) { TLine.SetLineWidth(2); TLine.SetLineColor(2); TLine.DrawLine(x0, y0, x1, y0); TLine.DrawLine(x0, y1, x1, y1); TLine.DrawLine(x0, y0, x0, y1); TLine.DrawLine(x1, y0, x1, y1); t->DrawLatex(x_center, y_center, Form("#font[42]{%d}", m_numActiveBlocks)); h1D->SetBinContent(m_numActiveBlocks + 1, co); } else if (m_type == 2 && gain < 0.55) { TLine.SetLineWidth(2); TLine.SetLineColor(1); TLine.DrawLine(x0, y0, x1, y0); TLine.DrawLine(x0, y1, x1, y1); TLine.DrawLine(x0, y0, x0, y1); TLine.DrawLine(x1, y0, x1, y1); t->DrawLatex(x_center, y_center, Form("#font[42]{%d}", m_numActiveBlocks)); h1D->SetBinContent(m_numActiveBlocks + 1, co); } else if (m_type == 3 && badblk[m_numActiveBlocks] != 0) { TLine.SetLineWidth(2); TLine.SetLineColor(3); TLine.DrawLine(x0, y0, x1, y0); TLine.DrawLine(x0, y1, x1, y1); TLine.DrawLine(x0, y0, x0, y1); TLine.DrawLine(x1, y0, x1, y1); t->DrawLatex(x_center, y_center, Form("#font[42]{%d}", m_numActiveBlocks)); h1D->SetBinContent(m_numActiveBlocks + 1, co); } } m_numActiveBlocks++; } } } C1->Print(path + cleg + ".pdf"); C1->Print(path + cleg + ".png"); smallBetween1 = .075; smallBetween2 = .025; smallBetween3 = .025; smallBetween4 = .15; cleg = Form("FCAL-1D-pattern-for-Emax-larger-than-%dGeV", m_energy); C1 = new TCanvas(cleg, cleg, 10, 10, 1600, 800); gPad->SetLeftMargin(smallBetween1); gPad->SetRightMargin(smallBetween2); gPad->SetTopMargin(smallBetween3); gPad->SetBottomMargin(smallBetween4); h1D->SetLineWidth(3); h1D->SetMinimum(1); h1D->Draw("colz"); gPad->SetLogy(); C1->Print(path + cleg + ".pdf"); C1->Print(path + cleg + ".png"); }