Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:46

0001 void cfebConnectMacro(){
0002 //proccess in batch mode. this takes a VERY long time out of batch mode
0003 gROOT->SetBatch();
0004 //contains several functions used in other macros as well
0005 gROOT->ProcessLine(".L GenFuncMacro.C");
0006 
0007 //get myFile. this is for batch processecing 
0008 //copies the name of any file beginning with "c" from the /tmp/csccalib directory. 
0009 char *myFileName;  //new file name for directory name
0010 char *myFilePath; //for accessing file by root 
0011 void *dirp = gSystem->OpenDirectory("/tmp/csccalib"); //read tmp directory
0012 char *afile; //temp file name
0013 while(afile = gSystem->GetDirEntry(dirp)) { //parse directory
0014    char *bfile[0] = afile[0]; //new temp file name
0015    if (bfile[0]=='c') { //if file begins with c
0016      printf("file: %s\n",afile); //check name
0017      myFileName = afile; //set for out of scope processing
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 //open file generated from analyzer
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   // int idArray[9];
0082   // GetChamberIDs(idArray, nCham);
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