File indexing completed on 2023-03-17 11:14:58
0001 void cfebConnectMacro(){
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 int nDDU = 1;
0023 int nCham = 1;
0024 int nLayer = 6;
0025
0026 gStyle->SetCanvasColor(0);
0027 gStyle->SetPadColor(0);
0028 gStyle->SetPadBorderMode(0);
0029 gStyle->SetCanvasBorderMode(0);
0030 gStyle->SetFrameBorderMode(0);
0031 gStyle->SetStatH(0.2);
0032 gStyle->SetStatW(0.3);
0033
0034 directoryCheck();
0035
0036
0037 std::cout << "opening: " << myFileName << std::endl;
0038 TFile *myFile = TFile::Open(myFilePath);
0039
0040 Calibration->Draw("cham");
0041 int nCham = htemp->GetXaxis()->GetXmax();
0042
0043 gSystem->cd("/afs/cern.ch/cms/CSC/html/csccalib/");
0044 makeDirectory("images");
0045 gSystem->cd("images");
0046 makeDirectory("CFEBConnectivity");
0047 gSystem->cd("CFEBConnectivity");
0048
0049 makeDirectory(myFileName);
0050
0051 directoryCheck();
0052
0053 DifferenceGraphs(nDDU, nCham, nLayer, myFileName);
0054 gROOT->ProcessLine(".q");
0055 gSystem->cd("../../");
0056 }
0057
0058 void GetChamberIDs(int IDArray[9], int nCham){
0059 TCanvas *IDcanv = new TCanvas ("idGraph", "idGraph");
0060 IDcanv->cd();
0061 TH1F *idDummy = new TH1F("idDummy", "idDummy", 10, 220000000, 221000000);
0062 idDummy->Draw();
0063 for (int chamber=0; chamber<nCham; ++chamber){
0064 TString idCut = Form ("cham==%d", chamber);
0065 Calibration->Project("idDummy", "id", idCut);
0066 Int_t idNum = idDummy->GetMean();
0067 IDArray[chamber]=idNum;
0068 }
0069 }
0070
0071 DifferenceGraphs(int nDDU, int nCham, int nLayer, TString fileName) {
0072 directoryCheck();
0073
0074 gSystem->cd("CFEBConnectivity");
0075 gSystem->cd(fileName);
0076
0077 TH1F *diffGraph;
0078 TCanvas *diffCanv;
0079
0080 for(int i=0; i<nDDU; ++i){
0081
0082
0083 for (int j=0; j<nCham; ++j){
0084 TString canvName = Form ("%d_DiffCanv", j);
0085 diffCanv = new TCanvas (canvName, canvName, 1000, 700);
0086 diffCanv->Divide(3,2);
0087 for (int k=0; k<nLayer; ++k){
0088 TString diffCut = Form ("cham==%d&&layer==%d",j,k);
0089 diffGraph = new TH1F ("diffGraph", "diffGraph", 100,800,1000);
0090 diffCanv->cd(k+1);
0091 diffGraph->Draw();
0092 Calibration->Project("diffGraph", "diff", diffCut);
0093 diffGraph->Draw();
0094 }
0095 diffCanv->Update();
0096 PrintAsGif(diffCanv, canvName);
0097 }
0098 }
0099
0100 directoryCheck();
0101 }
0102