Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
/*
TkHistoMapDisplay macro to display TkHistoMap.
A canvas is created for each subdetector, containing the histograms of all the layers of the subdetector.
To each histogram can be overlapped the histgram that contains the detids, to easily discover problems.

usage

.L TkHistoMapDisplay.C

a) To create only display of the interesting histomap:

TkHistoMapDisplay("filaname","dirpat","mapName") like TkHistoMapDisplay("test.root","DQMData/Zmap","Zmap")

b) To overlap also the detids (very time expensive)

TkHistoMapDisplay("filaname","dirpat","mapName","filename of the reference file") like TkHistoMapDisplay("test.root","DQMData/Zmap","Zmap","test.root")

c) To overlap also the detids of a single subdetector

TkHistoMapDisplay("filaname","dirpat","mapName","filename of the reference file","subdetname") like TkHistoMapDisplay("test.root","DQMData/Zmap","Zmap","test.root","TIB")
*/

#include "TCanvas.h"
#include "TFile.h"
#include "TProfile2D.h"
#include "TString.h"
#include <iostream>

TFile *_file,*_reffile, *_afile;
TCanvas *CTIB, *CTOB, *CTEC, *CTID;
TProfile2D* h;

void plotTIB(TString fullPath, TString Option){
  std::cout<< fullPath+TString("_TIB") << std::endl;
  CTIB->cd(1);
  h=(TProfile2D*) _afile->Get(fullPath+TString("_TIB_L1"));
  h->Draw(Option);
  CTIB->cd(2);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TIB_L2"));
  h->Draw(Option);
  CTIB->cd(3);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TIB_L3"));
  h->Draw(Option);
  CTIB->cd(4);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TIB_L4"));
  h->Draw(Option);
}

void plotTOB(TString fullPath, TString Option){
  std::cout<< fullPath+TString("_TOB") << std::endl;
  CTOB->cd(1);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L1"));
  h->Draw(Option);
  CTOB->cd(2);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L2"));
  h->Draw(Option);
  CTOB->cd(3);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L3"));
  h->Draw(Option);
  CTOB->cd(4);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L4"));
  h->Draw(Option);
  CTOB->cd(5);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L5"));
  h->Draw(Option);
  CTOB->cd(6);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L6"));
  h->Draw(Option);
}

void plotTID(TString fullPath, TString Option){
  std::cout<< fullPath+TString("_TID") << std::endl;
  CTID->cd(1);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TID_D1"));
  h->Draw(Option);
  CTID->cd(2);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TID_D2"));
  h->Draw(Option);
  CTID->cd(3);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TID_D3"));
  h->Draw(Option);
}

void plotTEC(TString fullPath, TString Option){
  std::cout<< fullPath+TString("_TEC") << std::endl;
  CTEC->cd(1);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W1"));
  h->Draw(Option);
  CTEC->cd(2);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W2"));
  h->Draw(Option);
  CTEC->cd(3);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W3"));
  h->Draw(Option);
  CTEC->cd(4);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W4"));
  h->Draw(Option);
  CTEC->cd(5);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W5"));
  h->Draw(Option);
  CTEC->cd(6);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W6"));
  h->Draw(Option);
  CTEC->cd(7);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W7"));
  h->Draw(Option);
  CTEC->cd(8);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W8"));
  h->Draw(Option);
  CTEC->cd(9);
  h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W9"));
  h->Draw(Option);
}

void TkHistoMapDisplay(TString File="", TString path="", TString TkmapName="", TString referenceFile="", TString refSubDet="", TString opt=""){

  std::cout << "File " << File.Data() << " reference " << referenceFile.Data()<< std::endl;


  _file=new TFile(File);
  
  CTIB=new TCanvas("TIB","TIB");
  CTOB=new TCanvas("TOB","TOB");
  CTID=new TCanvas("TID","TID");
  CTEC=new TCanvas("TEC","TEC");
  CTIB->Divide(2,2);
  CTOB->Divide(2,3);
  CTID->Divide(1,3);
  CTEC->Divide(3,3);
  
  _afile=_file;
  gStyle->SetOptStat(0);
  gStyle->SetPalette(1,0);
  if(opt=="")
    opt="COLZ";
  plotTIB(path+TString("/")+TkmapName, opt);
  plotTOB(path+TString("/")+TkmapName, opt);
  plotTID(path+TString("/")+TkmapName, opt);
  plotTEC(path+TString("/")+TkmapName, opt);
  
  
  if(referenceFile!=TString("")){
    
    path="DQMData/detId";
    TkmapName="detId";
    
    _reffile=new TFile(referenceFile);

    std::cout<< _reffile << std::endl;
    _afile=_reffile;
    std::cout<< _reffile << std::endl;
    gStyle->SetOptStat(0);

    if(refSubDet=="" || refSubDet=="TIB")
      plotTIB(path+TString("/")+TkmapName, "TEXTsames");
    if(refSubDet=="" || refSubDet=="TOB")
      plotTOB(path+TString("/")+TkmapName, "TEXTsames");
    if(refSubDet=="" || refSubDet=="TID")
      plotTID(path+TString("/")+TkmapName, "TEXTsames");
    if(refSubDet=="" || refSubDet=="TEC")
      plotTEC(path+TString("/")+TkmapName, "TEXTsames");

  }
 
}