Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:39

0001 /*
0002 TkHistoMapDisplay macro to display TkHistoMap.
0003 A canvas is created for each subdetector, containing the histograms of all the layers of the subdetector.
0004 To each histogram can be overlapped the histgram that contains the detids, to easily discover problems.
0005 
0006 usage
0007 
0008 .L TkHistoMapDisplay.C
0009 
0010 a) To create only display of the interesting histomap:
0011 
0012 TkHistoMapDisplay("filaname","dirpat","mapName") like TkHistoMapDisplay("test.root","DQMData/Zmap","Zmap")
0013 
0014 b) To overlap also the detids (very time expensive)
0015 
0016 TkHistoMapDisplay("filaname","dirpat","mapName","filename of the reference file") like TkHistoMapDisplay("test.root","DQMData/Zmap","Zmap","test.root")
0017 
0018 c) To overlap also the detids of a single subdetector
0019 
0020 TkHistoMapDisplay("filaname","dirpat","mapName","filename of the reference file","subdetname") like TkHistoMapDisplay("test.root","DQMData/Zmap","Zmap","test.root","TIB")
0021 */
0022 
0023 #include "TCanvas.h"
0024 #include "TFile.h"
0025 #include "TProfile2D.h"
0026 #include "TString.h"
0027 #include <iostream>
0028 
0029 TFile *_file,*_reffile, *_afile;
0030 TCanvas *CTIB, *CTOB, *CTEC, *CTID;
0031 TProfile2D* h;
0032 
0033 void plotTIB(TString fullPath, TString Option){
0034   std::cout<< fullPath+TString("_TIB") << std::endl;
0035   CTIB->cd(1);
0036   h=(TProfile2D*) _afile->Get(fullPath+TString("_TIB_L1"));
0037   h->Draw(Option);
0038   CTIB->cd(2);
0039   h= (TProfile2D*) _afile->Get(fullPath+TString("_TIB_L2"));
0040   h->Draw(Option);
0041   CTIB->cd(3);
0042   h= (TProfile2D*) _afile->Get(fullPath+TString("_TIB_L3"));
0043   h->Draw(Option);
0044   CTIB->cd(4);
0045   h= (TProfile2D*) _afile->Get(fullPath+TString("_TIB_L4"));
0046   h->Draw(Option);
0047 }
0048 
0049 void plotTOB(TString fullPath, TString Option){
0050   std::cout<< fullPath+TString("_TOB") << std::endl;
0051   CTOB->cd(1);
0052   h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L1"));
0053   h->Draw(Option);
0054   CTOB->cd(2);
0055   h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L2"));
0056   h->Draw(Option);
0057   CTOB->cd(3);
0058   h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L3"));
0059   h->Draw(Option);
0060   CTOB->cd(4);
0061   h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L4"));
0062   h->Draw(Option);
0063   CTOB->cd(5);
0064   h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L5"));
0065   h->Draw(Option);
0066   CTOB->cd(6);
0067   h= (TProfile2D*) _afile->Get(fullPath+TString("_TOB_L6"));
0068   h->Draw(Option);
0069 }
0070 
0071 void plotTID(TString fullPath, TString Option){
0072   std::cout<< fullPath+TString("_TID") << std::endl;
0073   CTID->cd(1);
0074   h= (TProfile2D*) _afile->Get(fullPath+TString("_TID_D1"));
0075   h->Draw(Option);
0076   CTID->cd(2);
0077   h= (TProfile2D*) _afile->Get(fullPath+TString("_TID_D2"));
0078   h->Draw(Option);
0079   CTID->cd(3);
0080   h= (TProfile2D*) _afile->Get(fullPath+TString("_TID_D3"));
0081   h->Draw(Option);
0082 }
0083 
0084 void plotTEC(TString fullPath, TString Option){
0085   std::cout<< fullPath+TString("_TEC") << std::endl;
0086   CTEC->cd(1);
0087   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W1"));
0088   h->Draw(Option);
0089   CTEC->cd(2);
0090   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W2"));
0091   h->Draw(Option);
0092   CTEC->cd(3);
0093   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W3"));
0094   h->Draw(Option);
0095   CTEC->cd(4);
0096   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W4"));
0097   h->Draw(Option);
0098   CTEC->cd(5);
0099   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W5"));
0100   h->Draw(Option);
0101   CTEC->cd(6);
0102   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W6"));
0103   h->Draw(Option);
0104   CTEC->cd(7);
0105   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W7"));
0106   h->Draw(Option);
0107   CTEC->cd(8);
0108   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W8"));
0109   h->Draw(Option);
0110   CTEC->cd(9);
0111   h= (TProfile2D*) _afile->Get(fullPath+TString("_TEC_W9"));
0112   h->Draw(Option);
0113 }
0114 
0115 void TkHistoMapDisplay(TString File="", TString path="", TString TkmapName="", TString referenceFile="", TString refSubDet="", TString opt=""){
0116 
0117   std::cout << "File " << File.Data() << " reference " << referenceFile.Data()<< std::endl;
0118 
0119 
0120   _file=new TFile(File);
0121   
0122   CTIB=new TCanvas("TIB","TIB");
0123   CTOB=new TCanvas("TOB","TOB");
0124   CTID=new TCanvas("TID","TID");
0125   CTEC=new TCanvas("TEC","TEC");
0126   CTIB->Divide(2,2);
0127   CTOB->Divide(2,3);
0128   CTID->Divide(1,3);
0129   CTEC->Divide(3,3);
0130   
0131   _afile=_file;
0132   gStyle->SetOptStat(0);
0133   gStyle->SetPalette(1,0);
0134   if(opt=="")
0135     opt="COLZ";
0136   plotTIB(path+TString("/")+TkmapName, opt);
0137   plotTOB(path+TString("/")+TkmapName, opt);
0138   plotTID(path+TString("/")+TkmapName, opt);
0139   plotTEC(path+TString("/")+TkmapName, opt);
0140   
0141   
0142   if(referenceFile!=TString("")){
0143     
0144     path="DQMData/detId";
0145     TkmapName="detId";
0146     
0147     _reffile=new TFile(referenceFile);
0148 
0149     std::cout<< _reffile << std::endl;
0150     _afile=_reffile;
0151     std::cout<< _reffile << std::endl;
0152     gStyle->SetOptStat(0);
0153 
0154     if(refSubDet=="" || refSubDet=="TIB")
0155       plotTIB(path+TString("/")+TkmapName, "TEXTsames");
0156     if(refSubDet=="" || refSubDet=="TOB")
0157       plotTOB(path+TString("/")+TkmapName, "TEXTsames");
0158     if(refSubDet=="" || refSubDet=="TID")
0159       plotTID(path+TString("/")+TkmapName, "TEXTsames");
0160     if(refSubDet=="" || refSubDet=="TEC")
0161       plotTEC(path+TString("/")+TkmapName, "TEXTsames");
0162 
0163   }
0164  
0165 }