adding name strings for canvases and histograms, adding z0 resolution
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jun 2013 11:33:20 +0000 (11:33 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jun 2013 11:33:20 +0000 (11:33 +0000)
STAT/TStatToolkit.cxx
TPC/Upgrade/macros/toyMCRecPlots.C

index 688e8da..9ca9e96 100644 (file)
@@ -1585,25 +1585,6 @@ void TStatToolkit::DrawHistogram(TTree * tree, const char* drawCommand, const ch
    TString cutStr(cuts);
    Int_t dim = 1;
 
-   // TODO: more than 1D implementation!
-   // TString strVal(drawCommand);
-   // if ( strVal.Contains(":") ){
-     
-   //   // count ":", but do not take into account "::"
-   //   Int_t count = 0;
-   //   Int_t len   = strVal.Length();
-   //   const char *data  = strVal.Data();
-   //   for (Int_t n = 0; n < len; n++){     
-   //     if (data[n] == ':'){
-   //   if(n<len-1){
-   //     if(data[n+1] == ':') n++;
-   //     else count++;
-   //   }
-   //     }
-   //   }     
-   // }
-   // cout<<dim<<endl;
-
    if(!tree) {
      cerr<<" Tree pointer is NULL!"<<endl;
      return;
index 08df08a..721ed44 100644 (file)
@@ -5,7 +5,7 @@ root.exe -l $ALICE_ROOT/TPC/Upgrade/macros/{loadlibs.C,ConfigOCDB.C}
 
 */
 
-void toyMCRecPlots(TString inFileName = "toyMC.debug.root"){
+void toyMCRecPlots(TString inFileName = "toyMC.debug.root",Bool_t doPlots = kFALSE){
   //
   // do all the plots for Toy MC Reconstruction for the TDR 
   //
@@ -15,6 +15,7 @@ void toyMCRecPlots(TString inFileName = "toyMC.debug.root"){
   // parameters
   const Int_t nT0          = 2;
   const Int_t nT02D        = 2;
+  const Int_t nZ0          = 2;
   const Int_t nTrackParams = 9;
 
   Int_t col = kBlack;
@@ -22,13 +23,23 @@ void toyMCRecPlots(TString inFileName = "toyMC.debug.root"){
   TString sT0[nT0] = {"fTime0-t0","fTime0-t0+z0*TMath::Sign(1,tOrig.Eta())/vdrift"};
   TString sT02D[nT02D] = {"fTime0-t0+z0*TMath::Sign(1,tOrig.Eta())/vdrift:tOrig.fP[3]","fTime0-t0+z0*TMath::Sign(1,tOrig.Eta())/vdrift:tOrig.fP[4]"};
   TString sTrackParams[nTrackParams] = {"track.fP[0]-tOrig.fP[0]","track.fP[1]-tOrig.fP[1]","track.fP[2]-tOrig.fP[2]","track.fP[3]-tOrig.fP[3]","track.fP[4]-tOrig.fP[4]","track.fAlpha-tOrig.fAlpha","track.fX/tOrig.fX","track.fY/tOrig.fY","track.fZ/tOrig.fZ"};
+  TString sZ0[nZ0] = {"(fTime0-t0)*vdrift","(fTime0-t0+z0*TMath::Sign(1,tOrig.Eta())/vdrift)*vdrift"};
+
 
   TString tT0[nT0] = {"T_{0} resolution","intrinsic T_{0} resolution"};
   TString tT02D[nT0] = {"intrinsic T_{0} resolution vs. tan#lambda","intrinsic T_{0} resolution vs. 1/p_{T}"};
   TString tTrackParams[nTrackParams] = {"local y","z","sin inclination angle","tan#lambda","1/p_{T}","#alpha","X","Y","Z"};
+  TString tZ0[nZ0] = {"Z_{0} resolution","intrinsic Z_{0} resolution"};
+
 
   TString sSel = "fTime0>-1"; // seeding successful
 
+  // retrieve configuration string
+  TPRegexp reg(".*([0-9]_[0-9]_[0-9]_[0-9]{3}_[0-9]{2}).debug.root");
+  TObjArray *arrMatch=0x0;
+  arrMatch=reg.MatchS(inFileName);
+  TString sConfig = arrMatch->At(1)->GetName();
+   
   // get file
   TFile *fIn  = TFile::Open(inFileName.Data(),"READ");
   if(!fIn){
@@ -42,14 +53,18 @@ void toyMCRecPlots(TString inFileName = "toyMC.debug.root"){
     Printf("No TTree found");
     return;
   }
+
  // output canvases
-  TCanvas *cT0 = new TCanvas("cT0","cT0",1200,500);
+  TCanvas *cT0 = new TCanvas(Form("cT0_%s",sConfig.Data()),Form("cT0_%s",sConfig.Data()),1200,500);
   cT0->Divide(2,1);
 
-  TCanvas *cT02D = new TCanvas("cT02D","cT02D",1200,500);
+  TCanvas *cT02D = new TCanvas(Form("cT02D_%s",sConfig.Data()),Form("cT02D_%s",sConfig.Data()),1200,500);
   cT02D->Divide(2,1);
 
-  TCanvas *cTrackParams = new TCanvas("cTrackParams","cTrackParams",1200,900);
+  TCanvas *cZ0 = new TCanvas(Form("cZ0_%s",sConfig.Data()),Form("cZ0_%s",sConfig.Data()),1200,500);
+  cZ0->Divide(2,1);
+
+  TCanvas *cTrackParams = new TCanvas(Form("cTrackParams_%s",sConfig.Data()),Form("cTrackParams_%s",sConfig.Data()),1200,900);
   cTrackParams->Divide(3,3);
 
  
@@ -62,7 +77,7 @@ void toyMCRecPlots(TString inFileName = "toyMC.debug.root"){
   for(Int_t iT0 = 0; iT0 < nT0; iT0 ++){
 
     cT0->cd(iT0+1);
-    TStatToolkit::DrawHistogram(Tracks,sT0[iT0].Data(),sSel.Data(),Form("hT0%d",iT0),Form("%s",tT0[iT0].Data()),3);
+    TStatToolkit::DrawHistogram(Tracks,sT0[iT0].Data(),sSel.Data(),Form("hT0_%s_%d",sConfig.Data(),iT0),Form("%s",tT0[iT0].Data()),3);
 
     //hT0[iT0]->Fit("gaus","","");
     //l[iT0]= new TLegend(0.55,0.7,0.8,0.8,Form(""));
@@ -78,27 +93,35 @@ void toyMCRecPlots(TString inFileName = "toyMC.debug.root"){
 
 
     cT02D->cd(iT02D+1);
-    TStatToolkit::DrawHistogram(Tracks,sT02D[iT02D].Data(),sSel.Data(),Form("hT02D%d",iT0),Form("%s",tT02D[iT02D].Data()),3);
+    TStatToolkit::DrawHistogram(Tracks,sT02D[iT02D].Data(),sSel.Data(),Form("hT02D_%s_%d",sConfig.Data(),iT02D),Form("%s",tT02D[iT02D].Data()),3);
 
   }
 
+  // draw Z0 resolution
+  for(Int_t iZ0 = 0; iZ0 < nZ0; iZ0 ++){
+
+    cZ0->cd(iZ0+1);
+    TStatToolkit::DrawHistogram(Tracks,sZ0[iZ0].Data(),sSel.Data(),Form("hZ0_%s_%d",sConfig.Data(),iZ0),Form("%s",tZ0[iZ0].Data()),3);
+
+  }
 
   // draw track parameters
   for(Int_t iTrackParams = 0; iTrackParams < nTrackParams; iTrackParams ++){
 
     cTrackParams->cd(iTrackParams+1);
-    TStatToolkit::DrawHistogram(Tracks,sTrackParams[iTrackParams].Data(),sSel.Data(),Form("hTrackParams%d",iTrackParams),Form("%s",tTrackParams[iTrackParams].Data()),3);
+    TStatToolkit::DrawHistogram(Tracks,sTrackParams[iTrackParams].Data(),sSel.Data(),Form("hTrackParams_%s_%d",sConfig.Data(),iTrackParams),Form("%s",tTrackParams[iTrackParams].Data()),3);
 
   }
 
 
   // plots
-  TString outFileName = inFileName;
-  outFileName.ReplaceAll(".root","");
-  cT0->SaveAs(Form("%s_T0.eps",outFileName.Data()));
-  cT02D->SaveAs(Form("%s_T02D.eps",outFileName.Data()));
-  cTrackParams->SaveAs(Form("%s_TrackParams.eps",outFileName.Data()));
-
+  if(doPlots){
+    TString outFileName = inFileName;
+    outFileName.ReplaceAll(".root","");
+    cT0->SaveAs(Form("%s_T0.eps",outFileName.Data()));
+    cT02D->SaveAs(Form("%s_T02D.eps",outFileName.Data()));
+    cTrackParams->SaveAs(Form("%s_TrackParams.eps",outFileName.Data()));
+  }
 }
 
 void myLegendSetUp(TLegend *currentLegend = NULL,Float_t currentTextSize=0.07){