Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:45:09

0001 // Plot distributions of module-level parameters
0002 //
0003 // Execute as (in an interactive ROOT session):
0004 //
0005 //  > .L createPedeParamPlots.C
0006 //  > compile()
0007 //  > createPedeParamPlots("<path-to-treeFile_merge.root","<label>")
0008 //
0009 //
0010 //
0011 // NB: Currently, the treeFile-writing assumes the 5th  column in millepede.res
0012 //     to be the parameter uncertainties (as it is the case when running pede in
0013 //     inversion mode) and puts those values in the tree. If pede is not run in
0014 //     inversion mode, the 5th column might be sth else and thus the plotted errors
0015 //     do not make sense. --> Ignore all plots other than <name>_0_<det>.pdf in that
0016 //     case!
0017 
0018 #include "TString.h"
0019 #include "TROOT.h"
0020 
0021 #include "GFUtils/GFHistManager.h"
0022 #include "PlotMillePede.h"
0023 
0024 
0025 void compile() {
0026   gROOT->ProcessLine(".L allMillePede.C");
0027   gROOT->ProcessLine("allMillePede()");
0028   gROOT->ProcessLine(".L setGStyle.C");
0029   gROOT->ProcessLine("setGStyle()");
0030 }
0031 
0032 void createPedeParamPlots(const TString& treeFile1, const TString& title1, const TString& treeFile2="", const TString& title2="") {
0033 
0034   const int subDetIds[6]       = { 1,      2,      3,     4,     5,     6     };
0035   const TString subDetNames[6] = { "BPIX", "FPIX", "TIB", "TID", "TOB", "TEC" };
0036   const TString coords[6]      = { "x",    "xz",   "z",   "z",   "z",   "z"   }; // printed in legend
0037 
0038   const bool has2 = treeFile2.Length()>0;
0039 
0040   TString outNamePrefix1(title1);
0041   outNamePrefix1.ReplaceAll(" ","_");
0042   TString outNamePrefix2(title2);
0043   outNamePrefix2.ReplaceAll(" ","_");
0044   
0045    PlotMillePede* p1 = new PlotMillePede(treeFile1);
0046    if( !has2 ) p1->SetTitle(title1);
0047    p1->SetBowsParameters(true);
0048    p1->SetHieraLevel(0);        // lowest level
0049 
0050    PlotMillePede* p2 = NULL;
0051    if( has2 ) {
0052      p2 = new PlotMillePede(treeFile2);
0053      p2->SetTitle(title2);
0054      p2->SetBowsParameters(true);
0055      p2->SetHieraLevel(0);      // lowest level
0056    }
0057 
0058    for(int i = 0; i < 6; ++i) {
0059      p1->SetSubDetId(subDetIds[i]);
0060      p1->SetOutName(outNamePrefix1+"_PedeParam_"+subDetNames[i]+"_");
0061      p1->DrawPedeParam();
0062 
0063      if( has2 ) {
0064        p2->SetSubDetId(subDetIds[i]);
0065        p2->SetOutName(outNamePrefix2+"_PedeParam_"+subDetNames[i]+"_");
0066        p2->DrawPedeParam();
0067      }
0068 
0069      if( has2 ) {
0070        p1->SetOutName(outNamePrefix1+"-"+outNamePrefix2+"_PedeParam_"+subDetNames[i]+"_");
0071        p1->GetHistManager()->Overlay(p1->GetHistManager(),0,0,title1);
0072        p1->GetHistManager()->Overlay(p2->GetHistManager(),0,0,p2->GetTitle());
0073        p1->GetHistManager()->Draw();
0074        p1->GetHistManager()->SameWithStats(true);
0075        p1->GetHistManager()->Draw();
0076      }
0077    }
0078 
0079    // do the first plots again to have the correct title
0080    if( has2 ) {
0081      p1->SetTitle(title1);
0082      for(int i = 0; i < 6; ++i) {
0083        p1->SetSubDetId(subDetIds[i]);
0084        p1->SetOutName(outNamePrefix1+"_PedeParam_"+subDetNames[i]+"_");
0085        p1->DrawPedeParam();
0086      }
0087    }
0088 }