Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:19

0001 // Usage:
0002 // .L ApeOverview.C++
0003 // ApeOverview a1("test.root");
0004 // a1.getOverview()
0005 // a1.printOverview() resp. a1.printOverview("apeOverview.ps",ApeOverview::event)
0006 
0007 
0008 #include "ApeOverview.h"
0009 
0010 #include <sstream>    //for stringstream
0011 #include <iostream>   //for cout
0012 
0013 #include "TProfile.h"
0014 #include "TPostScript.h"
0015 #include "TLatex.h"
0016 
0017 
0018 ApeOverview::ApeOverview(const TString inputFileName):
0019 inputFile_(TFile::Open(inputFileName)), moduleNo_(1), onlyZoomedHists_(false), firstSelectedSector_("")
0020 {
0021   eventPadCounter_.first = eventPadCounter_.second = trackPadCounter_.first = trackPadCounter_.second = sectorCounter_ = 1;
0022 }
0023 
0024 ApeOverview::~ApeOverview(){}
0025 
0026 
0027 
0028 void
0029 ApeOverview::whichModuleInFile(int moduleNo){
0030   moduleNo_ = moduleNo;
0031 }
0032 
0033 
0034 
0035 void
0036 ApeOverview::onlyZoomedHists(){
0037   onlyZoomedHists_ = true;
0038 }
0039 
0040 
0041 
0042 void
0043 ApeOverview::setSectorsForOverview(const TString& sectors){
0044   //std::vector<>
0045   TObjArray* a_Sector = TString(sectors).Tokenize(",");
0046   for(Int_t iSec= 0; iSec < a_Sector->GetEntriesFast(); ++iSec){
0047     
0048     const TString& sectorNumber = a_Sector->At(iSec)->GetName();
0049     bool validSectorArgument(false);
0050     for(unsigned int i = 0; i<20000 ; ++i){
0051       std::stringstream ssSec;
0052       ssSec << i;
0053       if(ssSec.str().c_str() == sectorNumber){
0054         vSelectedSector_.push_back(i);
0055     std::cout<<"\n\tPrint overview for Sector:\t"<<sectorNumber<<"\n";
0056     validSectorArgument = true;
0057     break;
0058       }
0059     }
0060     if(!validSectorArgument)std::cout<<"\n\tWrong argument in comma separated sector list:\t"<<sectorNumber<<"\n";
0061   }
0062 }
0063 
0064 
0065 
0066 void
0067 ApeOverview::getOverview(){
0068   //pluginDir_ = "ApeEstimatorCosmics1/";
0069   //int nKeys = inputFile_->GetNkeys();
0070   //pluginDir_ = inputFile_->GetListOfKeys()->At(0)->GetName();
0071   //pluginDir_ += "/";
0072   if(moduleNo_<1 || moduleNo_>inputFile_->GetNkeys()){
0073     std::cout<<"Incorrect number given in method whichModuleInFile(...), cannot continue!!!\n";
0074     return;
0075   }
0076   pluginDir_ = inputFile_->GetListOfKeys()->At(moduleNo_-1)->GetName();
0077   pluginDir_ += "/";
0078   
0079   TDirectory* secDir(0);
0080   bool sectorBool(true);
0081   for(unsigned int iSec(1);sectorBool;++iSec){
0082     std::stringstream sectorName, fullDirectoryName;
0083     sectorName << "Sector_" << iSec << "/";
0084     fullDirectoryName << pluginDir_ << sectorName.str();
0085     TString fullName(fullDirectoryName.str().c_str());
0086     inputFile_->cd();
0087     secDir = (TDirectory*)inputFile_->TDirectory::GetDirectory(fullName);
0088     if(secDir){
0089       mSectorPadCounter_[iSec].first = mSectorPadCounter_[iSec].second = 1;
0090       mSectorPair_[iSec].first = mSectorPair_[iSec].second = std::vector<TCanvas*>();
0091     }
0092     else sectorBool = false;
0093   }
0094   
0095   // first print event and track histos (FIXME: now contains also sector hists -> rename)
0096   this->eventAndTrackHistos();
0097 }
0098 
0099 
0100 TString
0101 ApeOverview::setCanvasName()const{
0102   std::stringstream canvas;
0103   int canvasCounter(0);
0104   canvasCounter += eventPair_.first.size() + eventPair_.second.size() + trackPair_.first.size() + trackPair_.second.size();
0105   for(std::map<unsigned int,CanvasPair>::const_iterator iSec = mSectorPair_.begin(); iSec != mSectorPair_.end(); ++iSec){
0106     canvasCounter += (*iSec).second.first.size() + (*iSec).second.second.size();
0107   }
0108   canvas << "canvas" << canvasCounter;
0109   return (canvas.str()).c_str();
0110 }
0111 
0112 
0113 void
0114 ApeOverview::eventAndTrackHistos(){
0115   TString histName;
0116   
0117   histDir_ = "EventVariables/";
0118   histLevel_ = event;
0119   std::cout<<"List of event histograms to print:\n";
0120   
0121   this->drawHistToPad("h_trackSize",true);  //logScale only for 1d-hists? Also for Profiles, but not TH2?
0122   this->drawHistToPad("h_trackSizeGood",true);  //logScale only for 1d-hists? Also for Profiles, but not TH2?
0123   
0124   
0125   histDir_ = "TrackVariables/";
0126   histLevel_ = track;
0127   std::cout<<"List of track histograms to print:\n";
0128   
0129   if(!onlyZoomedHists_){
0130   this->drawHistToPad("h_hitsSize");
0131   this->drawHistToPad("h_hitsValid");
0132   this->drawHistToPad("h_hitsGood");
0133   this->drawHistToPad("h_hits2D");
0134   this->drawHistToPad("h_hitsInvalid");
0135   this->drawHistToPad("h_layersMissed");
0136   this->drawHistToPad("h_hitsPixel");
0137   this->drawHistToPad("h_hitsStrip");
0138   this->setNewCanvas(dim1);
0139   }
0140   
0141   this->drawHistToPad("h_chi2");
0142   this->drawHistToPad("h_ndof");
0143   this->drawHistToPad("h_norChi2");
0144   if(!onlyZoomedHists_){
0145   this->drawHistToPad("h_eta");
0146   this->drawHistToPad("h_theta");
0147   this->drawHistToPad("h_phi");
0148   }
0149   this->setNewCanvas(dim1);
0150   
0151   if(!onlyZoomedHists_){
0152   this->drawHistToPad("h_etaErr");
0153   this->drawHistToPad("h_phiErr");
0154   this->drawHistToPad("h_ptErr");
0155   this->drawHistToPad("h_etaSig");
0156   this->drawHistToPad("h_phiSig");
0157   this->drawHistToPad("h_ptSig");
0158   }
0159   this->setNewCanvas(dim1);
0160   
0161   this->drawHistToPad("h_pt");
0162   this->drawHistToPad("h_p");
0163   this->drawHistToPad("h_prob");
0164   if(!onlyZoomedHists_){
0165   this->drawHistToPad("h_charge",false);
0166   this->drawHistToPad("h_meanAngle");
0167   }
0168   this->setNewCanvas(dim1);
0169   
0170   this->drawHistToPad("h_d0Beamspot");
0171   if(!onlyZoomedHists_){
0172   this->drawHistToPad("h_d0BeamspotErr");
0173   this->drawHistToPad("h_d0BeamspotSig");
0174   }
0175   this->drawHistToPad("h_dz");
0176   if(!onlyZoomedHists_){
0177   this->drawHistToPad("h_dzErr");
0178   this->drawHistToPad("h_dzSig");
0179   }
0180   this->setNewCanvas(dim1);
0181   
0182   this->drawHistToPad("h2_hitsPixelVsEta",false);
0183   this->drawHistToPad("h2_hitsStripVsEta",false);
0184   this->drawHistToPad("h2_ptVsEta",false);
0185   this->drawHistToPad("h2_hitsPixelVsTheta",false);
0186   this->drawHistToPad("h2_hitsStripVsTheta",false);
0187   this->drawHistToPad("h2_ptVsTheta",false);
0188   
0189   if(!onlyZoomedHists_){
0190   this->drawHistToPad("h2_hitsGoodVsHitsValid",false);
0191   this->drawHistToPad("h2_meanAngleVsHits",false);
0192   this->setNewCanvas(dim2);
0193   }
0194   
0195   histLevel_ = sector;
0196   TDirectory* secDir(0);
0197   bool sectorBool(true);
0198   for(unsigned int iSec(1);sectorBool;++iSec){
0199     std::stringstream sectorName, fullDirectoryName;
0200     sectorName << "Sector_" << iSec << "/";
0201     fullDirectoryName << pluginDir_ << sectorName.str();
0202     TString fullName(fullDirectoryName.str().c_str());
0203     inputFile_->cd();
0204     secDir = (TDirectory*)inputFile_->TDirectory::GetDirectory(fullName);
0205     sectorCounter_ = iSec;
0206     if(secDir){
0207       
0208       bool selectedSector(false);
0209       std::stringstream ssFirstSelectedSector;
0210       ssFirstSelectedSector << "Sector_";
0211       if(vSelectedSector_.size() == 0){
0212         selectedSector = true;
0213     ssFirstSelectedSector << "1";
0214       }
0215       else{
0216         ssFirstSelectedSector << *(vSelectedSector_.begin());
0217       }
0218       firstSelectedSector_ = ssFirstSelectedSector.str().c_str();
0219       
0220       for(std::vector<unsigned int>::const_iterator iSelSec = vSelectedSector_.begin(); iSelSec != vSelectedSector_.end(); ++iSelSec){
0221         if(iSec==*iSelSec)selectedSector = true;
0222       }
0223       if(!selectedSector)continue;
0224       
0225       histDir_  = sectorName.str().c_str();
0226       if(histDir_.BeginsWith(firstSelectedSector_))std::cout<<"List of hit histograms to print (showcase for "<<firstSelectedSector_<<", all other sectors identical):\n";
0227       
0228       this->drawHistToPad("sectorTitleSheet");
0229       
0230       
0231       // Cluster Parameters 1D
0232       
0233       this->drawHistToPad("h_WidthX");
0234       this->drawHistToPad("h_WidthProj");
0235       this->drawHistToPad("h_WidthDiff");
0236       if(!onlyZoomedHists_){
0237       this->drawHistToPad("h_MaxStrip",false);
0238       this->drawHistToPad("h_MaxIndex");
0239       this->drawHistToPad("h_BaryStripX",false);
0240       }
0241       this->drawHistToPad("h_ChargeStrip");
0242       this->drawHistToPad("h_ChargePixel");
0243       this->drawHistToPad("h_SOverN");
0244       if(!onlyZoomedHists_){
0245       this->drawHistToPad("h_MaxCharge");
0246       this->drawHistToPad("h_IsOnEdge");
0247       this->drawHistToPad("h_HasBadPixels");
0248       this->drawHistToPad("h_SpansTwoRoc");
0249       this->setNewCanvas(dim1);
0250       this->drawHistToPad("h_ChargeOnEdges");
0251       this->drawHistToPad("h_ChargeAsymmetry");
0252       this->drawHistToPad("h_ChargeLRminus");
0253       this->drawHistToPad("h_ChargeLRplus");
0254       this->drawHistToPad("h_ClusterProbXY");
0255       this->drawHistToPad("h_ClusterProbQ");
0256       this->drawHistToPad("h_ClusterProbXYQ");
0257       }
0258       this->drawHistToPad("h_LogClusterProb");
0259       if(!onlyZoomedHists_){
0260       this->drawHistToPad("h_QBin");
0261       }
0262       this->setNewCanvas(dim1);
0263       
0264       this->drawHistToPad("h_WidthY_y");
0265       if(!onlyZoomedHists_){
0266       this->drawHistToPad("h_BaryStripY_y",false);
0267       }
0268       this->drawHistToPad("h_ChargePixel_y");
0269       if(!onlyZoomedHists_){
0270       this->drawHistToPad("h_IsOnEdge_y");
0271       this->drawHistToPad("h_HasBadPixels_y");
0272       this->drawHistToPad("h_SpansTwoRoc_y");
0273       this->setNewCanvas(dim1);
0274       this->drawHistToPad("h_ClusterProbXY_y");
0275       this->drawHistToPad("h_ClusterProbQ_y");
0276       this->drawHistToPad("h_ClusterProbXYQ_y");
0277       }
0278       this->drawHistToPad("h_LogClusterProb_y");
0279       if(!onlyZoomedHists_){
0280       this->drawHistToPad("h_QBin_y");
0281       }
0282       this->setNewCanvas(dim1);
0283       
0284       
0285       // Hit parameters 1D
0286       
0287       this->drawHistToPad("h_ResX");
0288       this->drawHistToPad("h_NorResX");
0289       this->drawHistToPad("h_ProbX",false);
0290       this->drawHistToPad("h_SigmaXHit");
0291       this->drawHistToPad("h_SigmaXTrk");
0292       this->drawHistToPad("h_SigmaX");
0293       for(unsigned int iUint = 1;;++iUint){
0294         std::stringstream sigmaXHit, sigmaXTrk, sigmaX;
0295         sigmaXHit << "h_sigmaXHit_" << iUint;
0296         sigmaXTrk << "h_sigmaXTrk_" << iUint;
0297         sigmaX    << "h_sigmaX_"    << iUint;
0298     if(this->drawHistToPad(sigmaXHit.str().c_str()) == -1){this->setNewCanvas(dim1); break;}
0299     this->drawHistToPad(sigmaXTrk.str().c_str());
0300     this->drawHistToPad(sigmaX.str().c_str());
0301       }
0302       if(!onlyZoomedHists_){
0303       this->drawHistToPad("h_XHit");
0304       this->drawHistToPad("h_XTrk");
0305       this->setNewCanvas(dim1);
0306       this->drawHistToPad("h_PhiSens");
0307       this->drawHistToPad("h_PhiSensX");
0308       this->drawHistToPad("h_PhiSensY");
0309       }
0310       this->setNewCanvas(dim1);
0311       
0312       this->drawHistToPad("h_ResY");
0313       this->drawHistToPad("h_NorResY");
0314       this->drawHistToPad("h_ProbY",false);
0315       this->drawHistToPad("h_SigmaYHit_y");
0316       this->drawHistToPad("h_SigmaYTrk_y");
0317       this->drawHistToPad("h_SigmaY_y");
0318       for(unsigned int iUint = 1;;++iUint){
0319         std::stringstream sigmaXHit, sigmaXTrk, sigmaX;
0320         sigmaXHit << "h_sigmaYHit_" << iUint;
0321         sigmaXTrk << "h_sigmaYTrk_" << iUint;
0322         sigmaX    << "h_sigmaY_"    << iUint;
0323     if(this->drawHistToPad(sigmaXHit.str().c_str()) == -1){this->setNewCanvas(dim1); break;}
0324     this->drawHistToPad(sigmaXTrk.str().c_str());
0325     this->drawHistToPad(sigmaX.str().c_str());
0326       }
0327       if(!onlyZoomedHists_){
0328       this->drawHistToPad("h_YHit");
0329       this->drawHistToPad("h_YTrk");
0330       this->setNewCanvas(dim1);
0331       this->drawHistToPad("h_PhiSens_y");
0332       this->drawHistToPad("h_PhiSensX_y");
0333       this->drawHistToPad("h_PhiSensY_y");
0334       }
0335       this->setNewCanvas(dim1);
0336       
0337       
0338       // Track, Cluster, and Hit parameters 2D
0339       
0340       // vs. hit, track or residual error
0341       if(!onlyZoomedHists_){
0342       this->drawHistToPad("h2_sigmaXTrkVsHitsValid",false);
0343       this->drawHistToPad("h2_sigmaXTrkVsHitsGood",false);
0344       this->drawHistToPad("h2_sigmaXTrkVsMeanAngle",false);
0345       this->setNewCanvas(dim2);
0346       }
0347       if(!onlyZoomedHists_){
0348       this->drawHistToPad("h2_sigmaXTrkVsHitsInvalid",false);
0349       this->drawHistToPad("h2_sigmaXTrkVsLayersMissed",false);
0350       this->drawHistToPad("h2_sigmaXTrkVsHits2D",false);
0351       this->drawHistToPad("h2_sigmaXTrkVsHitsPixel",false);
0352       this->drawHistToPad("h2_sigmaXTrkVsHitsStrip",false);
0353       }
0354       this->drawHistToPad("h2_sigmaXTrkVsP",false);
0355       this->setNewCanvas(dim2);
0356       if(!onlyZoomedHists_){
0357       this->drawHistToPad("h2_sigmaXTrkVsTheta",false);
0358       this->drawHistToPad("h2_sigmaXTrkVsPhi",false);
0359       this->drawHistToPad("h2_sigmaXTrkVsMaxStrip",false);
0360       this->setNewCanvas(dim2);
0361       }
0362       this->drawHistToPad("h2_sigmaXTrkVsD0Beamspot",false);
0363       this->drawHistToPad("h2_sigmaXTrkVsDz",false);
0364       this->drawHistToPad("h2_sigmaXTrkVsPt",false);
0365       this->drawHistToPad("h2_sigmaXTrkVsInvP",false);
0366       this->drawHistToPad("h2_sigmaXVsNorChi2",false);
0367       this->setNewCanvas(dim2);
0368       
0369       this->drawHistToPad("h2_sigmaXHitVsWidthX",false);
0370       this->drawHistToPad("h2_sigmaXHitVsWidthProj",false);
0371       this->drawHistToPad("h2_sigmaXHitVsWidthDiff",false);
0372       if(!onlyZoomedHists_){
0373       this->drawHistToPad("h2_sigmaXHitVsMaxStrip",false);
0374       this->drawHistToPad("h2_sigmaXHitVsMaxIndex",false);
0375       this->drawHistToPad("h2_sigmaXHitVsBaryStripX",false);
0376       }
0377       this->drawHistToPad("h2_sigmaXHitVsChargeStrip",false);
0378       this->drawHistToPad("h2_sigmaXHitVsSOverN",false);
0379       this->drawHistToPad("h2_sigmaXHitVsChargePixel",false);
0380       if(!onlyZoomedHists_){
0381       this->drawHistToPad("h2_sigmaXHitVsMaxCharge",false);
0382       this->drawHistToPad("h2_sigmaXHitVsChargeOnEdges",false);
0383       this->drawHistToPad("h2_sigmaXHitVsChargeAsymmetry",false);
0384       this->drawHistToPad("h2_sigmaXHitVsChargeLRplus",false);
0385       this->drawHistToPad("h2_sigmaXHitVsChargeLRminus",false);
0386       this->setNewCanvas(dim2);
0387       this->drawHistToPad("h2_sigmaXHitVsIsOnEdge",false);
0388       this->drawHistToPad("h2_sigmaXHitVsHasBadPixels",false);
0389       this->drawHistToPad("h2_sigmaXHitVsSpansTwoRoc",false);
0390       this->setNewCanvas(dim2);
0391       this->drawHistToPad("h2_sigmaXHitVsClusterProbXY",false);
0392       this->drawHistToPad("h2_sigmaXHitVsClusterProbQ",false);
0393       this->drawHistToPad("h2_sigmaXHitVsClusterProbXYQ",false);
0394       }
0395       this->drawHistToPad("h2_sigmaXHitVsLogClusterProb",false);
0396       if(!onlyZoomedHists_){
0397       this->drawHistToPad("h2_sigmaXHitVsQBin",false);
0398       }
0399       this->setNewCanvas(dim2);
0400       
0401       if(!onlyZoomedHists_){
0402       this->drawHistToPad("h2_sigmaXHitVsPhiSens",false);
0403       this->drawHistToPad("h2_sigmaXHitVsPhiSensX",false);
0404       this->drawHistToPad("h2_sigmaXHitVsPhiSensY",false);
0405       this->drawHistToPad("h2_sigmaXTrkVsPhiSens",false);
0406       this->drawHistToPad("h2_sigmaXTrkVsPhiSensX",false);
0407       this->drawHistToPad("h2_sigmaXTrkVsPhiSensY",false);
0408       this->drawHistToPad("h2_sigmaXVsPhiSens",false);
0409       this->drawHistToPad("h2_sigmaXVsPhiSensX",false);
0410       this->drawHistToPad("h2_sigmaXVsPhiSensY",false);
0411       }
0412       
0413       // vs. normalised residual
0414       if(!onlyZoomedHists_){
0415       this->drawHistToPad("h2_norResXVsHitsValid",false);
0416       this->drawHistToPad("h2_norResXVsHitsGood",false);
0417       this->drawHistToPad("h2_norResXVsMeanAngle",false);
0418       this->drawHistToPad("h2_norResXVsHitsInvalid",false);
0419       this->drawHistToPad("h2_norResXVsLayersMissed",false);
0420       this->drawHistToPad("h2_norResXVsHits2D",false);
0421       this->drawHistToPad("h2_norResXVsHitsPixel",false);
0422       this->drawHistToPad("h2_norResXVsHitsStrip",false);
0423       }
0424       this->drawHistToPad("h2_norResXVsP",false);
0425       if(!onlyZoomedHists_){
0426       this->setNewCanvas(dim2);
0427       }
0428       
0429       this->drawHistToPad("h2_norResXVsNorChi2",false);
0430       if(!onlyZoomedHists_){
0431       this->drawHistToPad("h2_norResXVsTheta",false);
0432       this->drawHistToPad("h2_norResXVsPhi",false);
0433       }
0434       this->setNewCanvas(dim2);
0435       this->drawHistToPad("h2_norResXVsD0Beamspot",false);
0436       this->drawHistToPad("h2_norResXVsDz",false);
0437       this->drawHistToPad("h2_norResXVsPt",false);
0438       
0439       this->drawHistToPad("h2_norResXVsWidthX",false);
0440       this->drawHistToPad("h2_norResXVsWidthProj",false);
0441       this->drawHistToPad("h2_norResXVsWidthDiff",false);
0442       if(!onlyZoomedHists_){
0443       this->drawHistToPad("h2_norResXVsMaxStrip",false);
0444       this->drawHistToPad("h2_norResXVsMaxIndex",false);
0445       this->drawHistToPad("h2_norResXVsBaryStripX",false);
0446       }
0447       this->drawHistToPad("h2_norResXVsChargeStrip",false);
0448       this->drawHistToPad("h2_norResXVsSOverN",false);
0449       this->drawHistToPad("h2_norResXVsChargePixel",false);
0450       if(!onlyZoomedHists_){
0451       this->drawHistToPad("h2_norResXVsMaxCharge",false);
0452       this->drawHistToPad("h2_norResXVsChargeOnEdges",false);
0453       this->drawHistToPad("h2_norResXVsChargeAsymmetry",false);
0454       this->drawHistToPad("h2_norResXVsChargeLRplus",false);
0455       this->drawHistToPad("h2_norResXVsChargeLRminus",false);
0456       this->setNewCanvas(dim2);
0457       this->drawHistToPad("h2_norResXVsIsOnEdge",false);
0458       this->drawHistToPad("h2_norResXVsHasBadPixels",false);
0459       this->drawHistToPad("h2_norResXVsSpansTwoRoc",false);
0460       this->setNewCanvas(dim2);
0461       this->drawHistToPad("h2_norResXVsClusterProbXY",false);
0462       this->drawHistToPad("h2_norResXVsClusterProbQ",false);
0463       this->drawHistToPad("h2_norResXVsClusterProbXYQ",false);
0464       }
0465       this->drawHistToPad("h2_norResXVsLogClusterProb",false);
0466       if(!onlyZoomedHists_){
0467       this->drawHistToPad("h2_norResXVsQBin",false);
0468       }
0469       this->setNewCanvas(dim2);
0470       
0471       if(!onlyZoomedHists_){
0472       this->drawHistToPad("h2_norResXVsPhiSens",false);
0473       this->drawHistToPad("h2_norResXVsPhiSensX",false);
0474       this->drawHistToPad("h2_norResXVsPhiSensY",false);
0475       }
0476       
0477       this->drawHistToPad("h2_norResXVsSigmaXHit",false);
0478       this->drawHistToPad("h2_norResXVsSigmaXTrk",false);
0479       this->drawHistToPad("h2_norResXVsSigmaX",false);
0480       this->setNewCanvas(dim2);
0481       
0482       // vs. probability
0483       if(!onlyZoomedHists_){
0484       this->drawHistToPad("h2_probXVsHitsValid",false);
0485       this->drawHistToPad("h2_probXVsHitsGood",false);
0486       this->drawHistToPad("h2_probXVsMeanAngle",false);
0487       this->drawHistToPad("h2_probXVsHitsInvalid",false);
0488       this->drawHistToPad("h2_probXVsLayersMissed",false);
0489       this->drawHistToPad("h2_probXVsHits2D",false);
0490       this->drawHistToPad("h2_probXVsHitsPixel",false);
0491       this->drawHistToPad("h2_probXVsHitsStrip",false);
0492       }
0493       this->drawHistToPad("h2_probXVsP",false);
0494       if(!onlyZoomedHists_){
0495       this->setNewCanvas(dim2);
0496       }
0497       
0498       this->drawHistToPad("h2_probXVsNorChi2",false);
0499       if(!onlyZoomedHists_){
0500       this->drawHistToPad("h2_probXVsTheta",false);
0501       this->drawHistToPad("h2_probXVsPhi",false);
0502       }
0503       this->setNewCanvas(dim2);
0504       this->drawHistToPad("h2_probXVsD0Beamspot",false);
0505       this->drawHistToPad("h2_probXVsDz",false);
0506       this->drawHistToPad("h2_probXVsPt",false);
0507       
0508       this->drawHistToPad("h2_probXVsWidthX",false);
0509       this->drawHistToPad("h2_probXVsWidthProj",false);
0510       this->drawHistToPad("h2_probXVsWidthDiff",false);
0511       if(!onlyZoomedHists_){
0512       this->drawHistToPad("h2_probXVsMaxStrip",false);
0513       this->drawHistToPad("h2_probXVsMaxIndex",false);
0514       this->drawHistToPad("h2_probXVsBaryStripX",false);
0515       }
0516       this->drawHistToPad("h2_probXVsChargeStrip",false);
0517       this->drawHistToPad("h2_probXVsSOverN",false);
0518       this->drawHistToPad("h2_probXVsChargePixel",false);
0519       if(!onlyZoomedHists_){
0520       this->drawHistToPad("h2_probXVsMaxCharge",false);
0521       this->drawHistToPad("h2_probXVsChargeOnEdges",false);
0522       this->drawHistToPad("h2_probXVsChargeAsymmetry",false);
0523       this->drawHistToPad("h2_probXVsChargeLRplus",false);
0524       this->drawHistToPad("h2_probXVsChargeLRminus",false);
0525       this->setNewCanvas(dim2);
0526       this->drawHistToPad("h2_probXVsIsOnEdge",false);
0527       this->drawHistToPad("h2_probXVsHasBadPixels",false);
0528       this->drawHistToPad("h2_probXVsSpansTwoRoc",false);
0529       this->setNewCanvas(dim2);
0530       this->drawHistToPad("h2_probXVsClusterProbXY",false);
0531       this->drawHistToPad("h2_probXVsClusterProbQ",false);
0532       this->drawHistToPad("h2_probXVsClusterProbXYQ",false);
0533       }
0534       this->drawHistToPad("h2_probXVsLogClusterProb",false);
0535       if(!onlyZoomedHists_){
0536       this->drawHistToPad("h2_probXVsQBin",false);
0537       }
0538       this->setNewCanvas(dim2);
0539       
0540       if(!onlyZoomedHists_){
0541       this->drawHistToPad("h2_probXVsPhiSens",false);
0542       this->drawHistToPad("h2_probXVsPhiSensX",false);
0543       this->drawHistToPad("h2_probXVsPhiSensY",false);
0544       }
0545       
0546       this->drawHistToPad("h2_probXVsSigmaXHit",false);
0547       this->drawHistToPad("h2_probXVsSigmaXTrk",false);
0548       this->drawHistToPad("h2_probXVsSigmaX",false);
0549       this->setNewCanvas(dim2);
0550       
0551       // other
0552       this->drawHistToPad("h2_widthVsPhiSensX",false);
0553       this->drawHistToPad("h2_widthVsWidthProj",false);
0554       this->setNewCanvas(dim2);
0555       this->drawHistToPad("h2_widthDiffVsMaxStrip",false);
0556       this->drawHistToPad("h2_widthDiffVsSigmaXHit",false);
0557       if(!onlyZoomedHists_){
0558       this->drawHistToPad("h2_phiSensXVsBarycentreX",false);
0559       }
0560       this->setNewCanvas(dim2);
0561       
0562       
0563       // vs. hit, track or residual error (y coordinate)
0564       if(!onlyZoomedHists_){
0565       this->drawHistToPad("h2_sigmaYTrkVsHitsValid",false);
0566       this->drawHistToPad("h2_sigmaYTrkVsHitsGood",false);
0567       this->drawHistToPad("h2_sigmaYTrkVsMeanAngle",false);
0568       this->setNewCanvas(dim2);
0569       }
0570       if(!onlyZoomedHists_){
0571       this->drawHistToPad("h2_sigmaYTrkVsHitsInvalid",false);
0572       this->drawHistToPad("h2_sigmaYTrkVsLayersMissed",false);
0573       this->drawHistToPad("h2_sigmaYTrkVsHits2D",false);
0574       this->drawHistToPad("h2_sigmaYTrkVsHitsPixel",false);
0575       this->drawHistToPad("h2_sigmaYTrkVsHitsStrip",false);
0576       }
0577       this->drawHistToPad("h2_sigmaYTrkVsP",false);
0578       this->setNewCanvas(dim2);
0579       if(!onlyZoomedHists_){
0580       this->drawHistToPad("h2_sigmaYTrkVsTheta",false);
0581       this->drawHistToPad("h2_sigmaYTrkVsPhi",false);
0582       this->drawHistToPad("h2_sigmaYTrkVsMaxStrip",false);
0583       this->setNewCanvas(dim2);
0584       }
0585       this->drawHistToPad("h2_sigmaYTrkVsD0Beamspot",false);
0586       this->drawHistToPad("h2_sigmaYTrkVsDz",false);
0587       this->drawHistToPad("h2_sigmaYTrkVsPt",false);
0588       this->drawHistToPad("h2_sigmaYTrkVsInvP",false);
0589       this->drawHistToPad("h2_sigmaYVsNorChi2",false);
0590       this->setNewCanvas(dim2);
0591       
0592       this->drawHistToPad("h2_sigmaYHitVsWidthY",false);
0593       this->drawHistToPad("h2_sigmaYHitVsWidthProj",false);
0594       this->drawHistToPad("h2_sigmaYHitVsWidthDiff",false);
0595       if(!onlyZoomedHists_){
0596       this->drawHistToPad("h2_sigmaYHitVsMaxStrip",false);
0597       this->drawHistToPad("h2_sigmaYHitVsMaxIndex",false);
0598       this->drawHistToPad("h2_sigmaYHitVsBaryStripY",false);
0599       }
0600       this->drawHistToPad("h2_sigmaYHitVsChargeStrip",false);
0601       this->drawHistToPad("h2_sigmaYHitVsSOverN",false);
0602       this->drawHistToPad("h2_sigmaYHitVsChargePixel",false);
0603       if(!onlyZoomedHists_){
0604       this->drawHistToPad("h2_sigmaYHitVsMaxCharge",false);
0605       this->drawHistToPad("h2_sigmaYHitVsChargeOnEdges",false);
0606       this->drawHistToPad("h2_sigmaYHitVsChargeAsymmetry",false);
0607       this->drawHistToPad("h2_sigmaYHitVsChargeLRplus",false);
0608       this->drawHistToPad("h2_sigmaYHitVsChargeLRminus",false);
0609       this->setNewCanvas(dim2);
0610       this->drawHistToPad("h2_sigmaYHitVsIsOnEdge",false);
0611       this->drawHistToPad("h2_sigmaYHitVsHasBadPixels",false);
0612       this->drawHistToPad("h2_sigmaYHitVsSpansTwoRoc",false);
0613       this->setNewCanvas(dim2);
0614       this->drawHistToPad("h2_sigmaYHitVsClusterProbXY",false);
0615       this->drawHistToPad("h2_sigmaYHitVsClusterProbQ",false);
0616       this->drawHistToPad("h2_sigmaYHitVsClusterProbXYQ",false);
0617       }
0618       this->drawHistToPad("h2_sigmaYHitVsLogClusterProb",false);
0619       if(!onlyZoomedHists_){
0620       this->drawHistToPad("h2_sigmaYHitVsQBin",false);
0621       }
0622       this->setNewCanvas(dim2);
0623       
0624       if(!onlyZoomedHists_){
0625       this->drawHistToPad("h2_sigmaYHitVsPhiSens",false);
0626       this->drawHistToPad("h2_sigmaYHitVsPhiSensX",false);
0627       this->drawHistToPad("h2_sigmaYHitVsPhiSensY",false);
0628       this->drawHistToPad("h2_sigmaYTrkVsPhiSens",false);
0629       this->drawHistToPad("h2_sigmaYTrkVsPhiSensX",false);
0630       this->drawHistToPad("h2_sigmaYTrkVsPhiSensY",false);
0631       this->drawHistToPad("h2_sigmaYVsPhiSens",false);
0632       this->drawHistToPad("h2_sigmaYVsPhiSensX",false);
0633       this->drawHistToPad("h2_sigmaYVsPhiSensY",false);
0634       }
0635       
0636       // vs. normalised residual (y coordinate)
0637       if(!onlyZoomedHists_){
0638       this->drawHistToPad("h2_norResYVsHitsValid",false);
0639       this->drawHistToPad("h2_norResYVsHitsGood",false);
0640       this->drawHistToPad("h2_norResYVsMeanAngle",false);
0641       this->drawHistToPad("h2_norResYVsHitsInvalid",false);
0642       this->drawHistToPad("h2_norResYVsLayersMissed",false);
0643       this->drawHistToPad("h2_norResYVsHits2D",false);
0644       this->drawHistToPad("h2_norResYVsHitsPixel",false);
0645       this->drawHistToPad("h2_norResYVsHitsStrip",false);
0646       }
0647       this->drawHistToPad("h2_norResYVsP",false);
0648       if(!onlyZoomedHists_){
0649       this->setNewCanvas(dim2);
0650       }
0651       
0652       this->drawHistToPad("h2_norResYVsNorChi2",false);
0653       if(!onlyZoomedHists_){
0654       this->drawHistToPad("h2_norResYVsTheta",false);
0655       this->drawHistToPad("h2_norResYVsPhi",false);
0656       }
0657       this->setNewCanvas(dim2);
0658       this->drawHistToPad("h2_norResYVsD0Beamspot",false);
0659       this->drawHistToPad("h2_norResYVsDz",false);
0660       this->drawHistToPad("h2_norResYVsPt",false);
0661       
0662       this->drawHistToPad("h2_norResYVsWidthY",false);
0663       this->drawHistToPad("h2_norResYVsWidthProj",false);
0664       this->drawHistToPad("h2_norResYVsWidthDiff",false);
0665       if(!onlyZoomedHists_){
0666       this->drawHistToPad("h2_norResYVsMaxStrip",false);
0667       this->drawHistToPad("h2_norResYVsMaxIndex",false);
0668       this->drawHistToPad("h2_norResYVsBaryStripY",false);
0669       }
0670       this->drawHistToPad("h2_norResYVsChargeStrip",false);
0671       this->drawHistToPad("h2_norResYVsSOverN",false);
0672       this->drawHistToPad("h2_norResYVsChargePixel",false);
0673       if(!onlyZoomedHists_){
0674       this->drawHistToPad("h2_norResYVsMaxCharge",false);
0675       this->drawHistToPad("h2_norResYVsChargeOnEdges",false);
0676       this->drawHistToPad("h2_norResYVsChargeAsymmetry",false);
0677       this->drawHistToPad("h2_norResYVsChargeLRplus",false);
0678       this->drawHistToPad("h2_norResYVsChargeLRminus",false);
0679       this->setNewCanvas(dim2);
0680       this->drawHistToPad("h2_norResYVsIsOnEdge",false);
0681       this->drawHistToPad("h2_norResYVsHasBadPixels",false);
0682       this->drawHistToPad("h2_norResYVsSpansTwoRoc",false);
0683       this->setNewCanvas(dim2);
0684       this->drawHistToPad("h2_norResYVsClusterProbXY",false);
0685       this->drawHistToPad("h2_norResYVsClusterProbQ",false);
0686       this->drawHistToPad("h2_norResYVsClusterProbXYQ",false);
0687       }
0688       this->drawHistToPad("h2_norResYVsLogClusterProb",false);
0689       if(!onlyZoomedHists_){
0690       this->drawHistToPad("h2_norResYVsQBin",false);
0691       }
0692       this->setNewCanvas(dim2);
0693       
0694       if(!onlyZoomedHists_){
0695       this->drawHistToPad("h2_norResYVsPhiSens",false);
0696       this->drawHistToPad("h2_norResYVsPhiSensX",false);
0697       this->drawHistToPad("h2_norResYVsPhiSensY",false);
0698       }
0699       
0700       this->drawHistToPad("h2_norResYVsSigmaYHit",false);
0701       this->drawHistToPad("h2_norResYVsSigmaYTrk",false);
0702       this->drawHistToPad("h2_norResYVsSigmaY",false);
0703       this->setNewCanvas(dim2);
0704       
0705       // vs. probability (y coordinate)
0706       if(!onlyZoomedHists_){
0707       this->drawHistToPad("h2_probYVsHitsValid",false);
0708       this->drawHistToPad("h2_probYVsHitsGood",false);
0709       this->drawHistToPad("h2_probYVsMeanAngle",false);
0710       this->drawHistToPad("h2_probYVsHitsInvalid",false);
0711       this->drawHistToPad("h2_probYVsLayersMissed",false);
0712       this->drawHistToPad("h2_probYVsHits2D",false);
0713       this->drawHistToPad("h2_probYVsHitsPixel",false);
0714       this->drawHistToPad("h2_probYVsHitsStrip",false);
0715       }
0716       this->drawHistToPad("h2_probYVsP",false);
0717       if(!onlyZoomedHists_){
0718       this->setNewCanvas(dim2);
0719       }
0720       
0721       this->drawHistToPad("h2_probYVsNorChi2",false);
0722       if(!onlyZoomedHists_){
0723       this->drawHistToPad("h2_probYVsTheta",false);
0724       this->drawHistToPad("h2_probYVsPhi",false);
0725       }
0726       this->setNewCanvas(dim2);
0727       this->drawHistToPad("h2_probYVsD0Beamspot",false);
0728       this->drawHistToPad("h2_probYVsDz",false);
0729       this->drawHistToPad("h2_probYVsPt",false);
0730       
0731       this->drawHistToPad("h2_probYVsWidthY",false);
0732       this->drawHistToPad("h2_probYVsWidthProj",false);
0733       this->drawHistToPad("h2_probYVsWidthDiff",false);
0734       if(!onlyZoomedHists_){
0735       this->drawHistToPad("h2_probYVsMaxStrip",false);
0736       this->drawHistToPad("h2_probYVsMaxIndex",false);
0737       this->drawHistToPad("h2_probYVsBaryStripY",false);
0738       }
0739       this->drawHistToPad("h2_probYVsChargeStrip",false);
0740       this->drawHistToPad("h2_probYVsSOverN",false);
0741       this->drawHistToPad("h2_probYVsChargePixel",false);
0742       if(!onlyZoomedHists_){
0743       this->drawHistToPad("h2_probYVsMaxCharge",false);
0744       this->drawHistToPad("h2_probYVsChargeOnEdges",false);
0745       this->drawHistToPad("h2_probYVsChargeAsymmetry",false);
0746       this->drawHistToPad("h2_probYVsChargeLRplus",false);
0747       this->drawHistToPad("h2_probYVsChargeLRminus",false);
0748       this->setNewCanvas(dim2);
0749       this->drawHistToPad("h2_probYVsIsOnEdge",false);
0750       this->drawHistToPad("h2_probYVsHasBadPixels",false);
0751       this->drawHistToPad("h2_probYVsSpansTwoRoc",false);
0752       this->setNewCanvas(dim2);
0753       this->drawHistToPad("h2_probYVsClusterProbXY",false);
0754       this->drawHistToPad("h2_probYVsClusterProbQ",false);
0755       this->drawHistToPad("h2_probYVsClusterProbXYQ",false);
0756       }
0757       this->drawHistToPad("h2_probYVsLogClusterProb",false);
0758       if(!onlyZoomedHists_){
0759       this->drawHistToPad("h2_probYVsQBin",false);
0760       }
0761       this->setNewCanvas(dim2);
0762       
0763       if(!onlyZoomedHists_){
0764       this->drawHistToPad("h2_probYVsPhiSens",false);
0765       this->drawHistToPad("h2_probYVsPhiSensX",false);
0766       this->drawHistToPad("h2_probYVsPhiSensY",false);
0767       }
0768       
0769       this->drawHistToPad("h2_probYVsSigmaYHit",false);
0770       this->drawHistToPad("h2_probYVsSigmaYTrk",false);
0771       this->drawHistToPad("h2_probYVsSigmaY",false);
0772       this->setNewCanvas(dim2);
0773       
0774       // other (y coordinate)
0775       if(!onlyZoomedHists_){
0776       this->drawHistToPad("h2_phiSensYVsBarycentreY",false);
0777       }
0778       this->setNewCanvas(dim2);
0779       
0780       
0781       // Additional 1D histograms
0782       
0783       this->setNewCanvas(dim1);
0784       for(unsigned int iBin(1); ; ++iBin){
0785         TDirectory* intDir(0);
0786     std::stringstream intervalName, fullDirectoryName2;
0787         intervalName << "Interval_" << iBin << "/";
0788     fullDirectoryName2 << fullDirectoryName.str() << intervalName.str();
0789         TString fullName2(fullDirectoryName2.str().c_str());
0790     inputFile_->cd();
0791         intDir = (TDirectory*)inputFile_->TDirectory::GetDirectory(fullName2);
0792     if(intDir){
0793       histDir_  = (sectorName.str() + intervalName.str()).c_str();
0794       if(!onlyZoomedHists_){
0795       this->drawHistToPad("h_norResX",false);
0796       }
0797     }
0798     else break;
0799       }
0800       
0801       this->setNewCanvas(dim1);
0802       for(unsigned int iBin(1); ; ++iBin){
0803         TDirectory* intDir(0);
0804     std::stringstream intervalName, fullDirectoryName2;
0805         intervalName << "Interval_" << iBin << "/";
0806     fullDirectoryName2 << fullDirectoryName.str() << intervalName.str();
0807         TString fullName2(fullDirectoryName2.str().c_str());
0808     inputFile_->cd();
0809         intDir = (TDirectory*)inputFile_->TDirectory::GetDirectory(fullName2);
0810     if(intDir){
0811       histDir_  = (sectorName.str() + intervalName.str()).c_str();
0812       if(!onlyZoomedHists_){
0813       this->drawHistToPad("h_norResY",false);
0814       }
0815     }
0816     else break;
0817       }
0818       
0819       if(!onlyZoomedHists_){
0820       this->setNewCanvas(dim1);
0821       TDirectory* resDir(0);
0822       std::string resultName("Results/");
0823       histDir_  = (sectorName.str() + resultName).c_str();
0824       std::stringstream fullDirectoryName3;
0825       fullDirectoryName3 << fullDirectoryName.str() << resultName;
0826       resDir = (TDirectory*)inputFile_->TDirectory::GetDirectory(fullDirectoryName3.str().c_str());
0827       if(resDir)
0828       this->drawHistToPad("h_entriesX");
0829       resultName = "";
0830       histDir_  = (sectorName.str() + resultName).c_str();
0831       this->drawHistToPad("h_meanX",false);
0832       this->drawHistToPad("h_fitMeanX1",false);
0833       this->drawHistToPad("h_fitMeanX2",false);
0834       this->drawHistToPad("h_rmsX",false);
0835       this->drawHistToPad("h_residualWidthX1",false);
0836       this->drawHistToPad("h_residualWidthX2",false);
0837       this->drawHistToPad("h_weightX",false);
0838       this->drawHistToPad("h_correctionX1",false);
0839       this->drawHistToPad("h_correctionX2",false);
0840       }
0841       
0842       if(!onlyZoomedHists_){
0843       this->setNewCanvas(dim1);
0844       TDirectory* resDir(0);
0845       std::string resultName("Results/");
0846       histDir_  = (sectorName.str() + resultName).c_str();
0847       std::stringstream fullDirectoryName3;
0848       fullDirectoryName3 << fullDirectoryName.str() << resultName;
0849       resDir = (TDirectory*)inputFile_->TDirectory::GetDirectory(fullDirectoryName3.str().c_str());
0850       if(resDir)
0851       this->drawHistToPad("h_entriesY");
0852       resultName = "";
0853       histDir_  = (sectorName.str() + resultName).c_str();
0854       this->drawHistToPad("h_meanY",false);
0855       this->drawHistToPad("h_fitMeanY1",false);
0856       this->drawHistToPad("h_fitMeanY2",false);
0857       this->drawHistToPad("h_rmsY",false);
0858       this->drawHistToPad("h_residualWidthY1",false);
0859       this->drawHistToPad("h_residualWidthY2",false);
0860       this->drawHistToPad("h_weightY",false);
0861       this->drawHistToPad("h_correctionY1",false);
0862       this->drawHistToPad("h_correctionY2",false);
0863       }
0864     }
0865     else sectorBool = false;
0866   }
0867 }
0868 
0869 
0870 
0871 int
0872 ApeOverview::drawHistToPad(const TString histName, const bool setLogScale){
0873   PadCounterPair* padCounter;
0874   CanvasPair* canvasPair;
0875   
0876   if(histLevel_==event){padCounter=&eventPadCounter_; canvasPair=&eventPair_;}
0877   else if(histLevel_==track){padCounter=&trackPadCounter_; canvasPair=&trackPair_;}
0878   else if(histLevel_==sector){padCounter=&mSectorPadCounter_[sectorCounter_]; canvasPair=&mSectorPair_[sectorCounter_];}
0879   else return -1;
0880   
0881   //if(histName.BeginsWith("h_", TString::kIgnoreCase)) not case sensitive
0882   if(histName.BeginsWith("h_")){
0883     TH1 *hist1(0);
0884     inputFile_->GetObject(pluginDir_ + histDir_ + histName + ";1", hist1);
0885     if(histDir_.BeginsWith(firstSelectedSector_) || histDir_ == "TrackVariables/" || histDir_ == "EventVariables/")std::cout<<"\tDraw 1D Histo\t\t"<<pluginDir_<<histDir_<<histName<<"\n";
0886     //GetEntries delivers double
0887     if(hist1){
0888       if(padCounter->first >= 7){padCounter->first = 1;}
0889       if(padCounter->first == 1){
0890         //new TCanvas
0891         TCanvas* canvas0 = new TCanvas(this->setCanvasName());
0892         canvas0->Divide(3,2);
0893         canvasPair->first.push_back(canvas0);
0894       }
0895       (*(--(canvasPair->first.end())))->cd(padCounter->first);
0896       
0897       if(setLogScale==true && hist1->GetEffectiveEntries()>0.1){
0898       //if(setLogScale==true && hist1->Integral()>0.1)(*(--(canvasPair->first.end())))->cd(padCounter->first)->SetLogy();  // gives same result
0899         (*(--(canvasPair->first.end())))->cd(padCounter->first)->SetLogy();
0900     hist1->SetMinimum(0.5);
0901       }
0902       hist1->Draw();
0903       
0904       ++(padCounter->first);
0905     }
0906     else{if(histDir_.BeginsWith(firstSelectedSector_) || histDir_ == "TrackVariables/" || histDir_ == "EventVariables/")std::cout<<"\t\t\t\t... Histogram does not exist!\n"; return -1;}
0907     return 0;
0908   }
0909   
0910   else if(histName.BeginsWith("h2_")){
0911     TH2 *hist2(0);
0912     inputFile_->GetObject(pluginDir_ + histDir_ + histName + ";1", hist2);
0913     if(histDir_.BeginsWith(firstSelectedSector_) || histDir_ == "TrackVariables/" || histDir_ == "EventVariables/")std::cout<<"\tDraw 2D Histo\t\t"<<pluginDir_<<histDir_<<histName<<"\n";
0914     if(hist2){
0915       if(padCounter->second >= 4){padCounter->second = 1;}
0916       if(padCounter->second == 1){
0917         //new TCanvas
0918         TCanvas* canvas0 = new TCanvas(this->setCanvasName());
0919         canvas0->Divide(3,2);
0920         canvasPair->second.push_back(canvas0);
0921       }
0922       (*(--(canvasPair->second.end())))->cd(padCounter->second);
0923       
0924       if(setLogScale==true && hist2->GetEffectiveEntries()>0.1){
0925         (*(--(canvasPair->second.end())))->cd(padCounter->second)->SetLogy();
0926       }
0927       hist2->Draw("box");
0928       
0929       
0930       // Include profile corresponding to 2D histo automatically here
0931       TString histNameP(histName);
0932       histNameP.ReplaceAll("h2_","p_");
0933       TProfile *histP(0);
0934       inputFile_->GetObject(pluginDir_ + histDir_ + histNameP + ";1", histP);
0935       if(histDir_.BeginsWith(firstSelectedSector_) || histDir_ == "TrackVariables/" || histDir_ == "EventVariables/")std::cout<<"\tDraw Profile Histo\t"<<pluginDir_<<histDir_<<histNameP<<"\n";
0936       if(histP){
0937         (*(--(canvasPair->second.end())))->cd(padCounter->second+3);
0938         if(setLogScale==true && histP->GetEffectiveEntries()>0.1){
0939       (*(--(canvasPair->second.end())))->cd(padCounter->second+3)->SetLogy();
0940     }
0941     
0942     // Loop for separating mean and RMS per bin (separate entries in final plot)
0943     TProfile *rmsPlot(0);
0944     if(histNameP.BeginsWith("p_norResXVs") || histNameP.BeginsWith("p_probXVs") ||
0945        histNameP.BeginsWith("p_norResYVs") || histNameP.BeginsWith("p_probYVs")){
0946       std::stringstream tempName;
0947       tempName << "temp_" << histNameP << "_" << sectorCounter_ << "_" << moduleNo_;
0948       TString tempHist(tempName.str().c_str());
0949       const int nBinX(histP->GetNbinsX());
0950       rmsPlot = new TProfile(tempHist,"temp",nBinX,histP->GetBinLowEdge(1),histP->GetBinLowEdge(nBinX+1));
0951       for(int iBin = 0; iBin < nBinX+1; ++iBin){
0952         rmsPlot->SetBinContent(iBin, 1000000*histP->GetBinError(iBin));   // Scale by factor 1000000, and same for next line --> hack to hide error bars (hard to get rid of in TProfile)
0953         rmsPlot->SetBinEntries(iBin, (histP->GetBinEntries(iBin)<0.1 ? 0 : 1000000));
0954         //rmsPlot->SetBinError(iBin, 0.00001);   // Does not do anything !?
0955       }
0956       //std::cout<<"\t\tBins "<<tempHist<<" "<<nBinX<<" "<<histP->GetBinLowEdge(1)<<" "<<histP->GetBinLowEdge(nBinX+1)<<"\n";
0957     }
0958     
0959         histP->Draw();
0960         if(rmsPlot){
0961       double yMin(histNameP.BeginsWith("p_probXVs") || histNameP.BeginsWith("p_probYVs") ? -0.1 : -3);
0962       double yMax(histNameP.BeginsWith("p_probXVs") || histNameP.BeginsWith("p_probYVs") ? 1.1 : 3);
0963       histP->SetErrorOption("");
0964       histP->GetYaxis()->SetRangeUser(yMin,yMax);
0965       const int nBinX(histP->GetNbinsX());
0966       for(int iBin = 0; iBin < nBinX+1; ++iBin){
0967         if(histP->GetBinContent(iBin)>yMax)histP->SetBinContent(iBin,histP->GetBinEntries(iBin)*yMax);
0968         if(histP->GetBinContent(iBin)<yMin)histP->SetBinContent(iBin,histP->GetBinEntries(iBin)*yMin);
0969         if(rmsPlot->GetBinContent(iBin)>yMax)rmsPlot->SetBinContent(iBin,rmsPlot->GetBinEntries(iBin)*yMax);
0970         if(rmsPlot->GetBinContent(iBin)<yMin)rmsPlot->SetBinContent(iBin,rmsPlot->GetBinEntries(iBin)*yMin);
0971       }
0972       rmsPlot->SetMarkerColor(2);
0973       rmsPlot->SetLineColor(2);
0974       //rmsPlot->SetMarkerStyle(24);
0975       rmsPlot->Draw("same");
0976       //rmsPlot->Draw("hist p same");
0977     }
0978     
0979       }
0980       else{if(histDir_.BeginsWith(firstSelectedSector_) || histDir_ == "TrackVariables/" || histDir_ == "EventVariables/")std::cout<<"\t\t\t\t... Histogram does not exist!\n";return -1;}
0981       
0982       ++(padCounter->second);
0983     }
0984     else{if(histDir_.BeginsWith(firstSelectedSector_) || histDir_ == "TrackVariables/" || histDir_ == "EventVariables/")std::cout<<"\t\t\t\t... Histogram does not exist!\n"; return -1;}
0985     return 0;
0986   }
0987   
0988   else if(histName.BeginsWith("p_")){std::cout<<"\n\tProfile Plot chosen, but set up automatically"<<std::endl; return 1;}
0989   else if(histName == "sectorTitleSheet"){
0990     const TString nameHistName("z_name");
0991     TH1* nameHist(0);
0992     inputFile_->GetObject(pluginDir_ + histDir_ + nameHistName + ";1", nameHist);
0993     TString sectorName(histDir_);
0994     if(nameHist){
0995       sectorName += "  --  ";
0996       sectorName += nameHist->GetTitle();
0997     }
0998     TCanvas* canvas0 = new TCanvas(this->setCanvasName());
0999     canvasPair->first.push_back(canvas0);
1000     (*(--(canvasPair->first.end())))->cd();
1001     TLatex *title1 = new TLatex(0.1583,0.925,sectorName);title1->SetNDC();//title1->SetTextSize(0.075);
1002     title1->Draw();
1003     this->setNewCanvas(dim1);
1004     return 0;
1005   }
1006   else{std::cout<<"\n\tIncorrect Initial Letters for histogram !!!"<<std::endl; return -1;}
1007 }
1008 
1009 
1010 int
1011 ApeOverview::setNewCanvas(const PlotDimension& pDim){
1012   std::pair<unsigned int, unsigned int>* padCounter;
1013   if(histLevel_==event){padCounter=&eventPadCounter_;}
1014   else if(histLevel_==track){padCounter=&trackPadCounter_;}
1015   else if(histLevel_==sector){padCounter=&mSectorPadCounter_[sectorCounter_];}
1016   else return -1;
1017   
1018   if(pDim==dim1){padCounter->first = 7; return 0;}
1019   else if(pDim==dim2){padCounter->second = 4; return 0;}
1020   else return -1;
1021   return 0;
1022 }
1023 
1024 
1025 
1026 void
1027 ApeOverview::printOverview(const TString& outputFileName, const HistLevel& histLevel){
1028   if(eventPair_.first.size()==0 && eventPair_.second.size()==0 &&
1029      trackPair_.first.size()==0 && trackPair_.second.size()==0 &&
1030      mSectorPair_.size()==0)return;
1031   std::cout<<"\tCreate PostScript File:\t"<<outputFileName<<std::endl;
1032   TPostScript* ps = new TPostScript(outputFileName,112);
1033   std::vector<TCanvas*>::const_iterator iCan;
1034   if(histLevel==event){
1035     for(iCan = eventPair_.first.begin(); iCan != eventPair_.first.end(); ++iCan){ps->NewPage();(*iCan)->Draw();}
1036     for(iCan = eventPair_.second.begin(); iCan != eventPair_.second.end(); ++iCan){ps->NewPage();(*iCan)->Draw();}
1037   }
1038   if(histLevel==event || histLevel==track){
1039     for(iCan = trackPair_.first.begin(); iCan != trackPair_.first.end(); ++iCan){ps->NewPage();(*iCan)->Draw();}
1040     for(iCan = trackPair_.second.begin(); iCan != trackPair_.second.end(); ++iCan){ps->NewPage();(*iCan)->Draw();}
1041   }
1042   if(histLevel==event || histLevel==track || histLevel==sector){
1043     std::map<unsigned int, CanvasPair>::const_iterator iSec;
1044     for(iSec = mSectorPair_.begin(); iSec != mSectorPair_.end(); ++iSec){
1045       for(iCan = iSec->second.first.begin(); iCan != iSec->second.first.end(); ++iCan){ps->NewPage();(*iCan)->Draw();}
1046       for(iCan = iSec->second.second.begin(); iCan != iSec->second.second.end(); ++iCan){ps->NewPage();(*iCan)->Draw();}
1047     }
1048   }
1049   ps->Close();
1050   
1051   // Now close the canvases printed to the PostScript ...
1052   for(iCan = eventPair_.first.begin(); iCan != eventPair_.first.end(); ++iCan){(*iCan)->Close();}
1053   for(iCan = eventPair_.second.begin(); iCan != eventPair_.second.end(); ++iCan){(*iCan)->Close();}
1054   for(iCan = trackPair_.first.begin(); iCan != trackPair_.first.end(); ++iCan){(*iCan)->Close();}
1055   for(iCan = trackPair_.second.begin(); iCan != trackPair_.second.end(); ++iCan){(*iCan)->Close();}
1056   for(std::map<unsigned int, CanvasPair>::const_iterator iSec = mSectorPair_.begin(); iSec != mSectorPair_.end(); ++iSec){
1057     for(iCan = iSec->second.first.begin(); iCan != iSec->second.first.end(); ++iCan){(*iCan)->Close();}
1058     for(iCan = iSec->second.second.begin(); iCan != iSec->second.second.end(); ++iCan){(*iCan)->Close();}
1059   }
1060   
1061   // ... and delete the corresponding vectors (which now contain null pointers only) ...
1062   eventPair_.first.clear();
1063   eventPair_.second.clear();
1064   trackPair_.first.clear();
1065   trackPair_.second.clear();
1066   mSectorPair_.clear();
1067   
1068   // ... and reset the counters
1069   eventPadCounter_.first = eventPadCounter_.second = trackPadCounter_.first = trackPadCounter_.second = sectorCounter_ = 1;
1070   mSectorPadCounter_.clear();
1071 }
1072 
1073 
1074 
1075 
1076