From cc54bf5cf01a8b7fcdf41d69fccb25da6b7c80f9 Mon Sep 17 00:00:00 2001 From: wmtan Date: Mon, 13 Apr 2015 21:13:17 +0200 Subject: [PATCH 1/4] Macros need to compile in ROOT6 --- .../MCEmbeddingTools/macros/makeEmbeddingKineReweightLUTs2.C | 4 ++-- .../MCEmbeddingTools/macros/makeEmbeddingValidationPlots.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingKineReweightLUTs2.C b/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingKineReweightLUTs2.C index 7790c47931e63..10e7351833670 100644 --- a/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingKineReweightLUTs2.C +++ b/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingKineReweightLUTs2.C @@ -75,9 +75,9 @@ struct weightEntryType } TString name_; const TH1* lut_; - TAxis* xAxis_; + const TAxis* xAxis_; Int_t numBinsX_; - TAxis* yAxis_; + const TAxis* yAxis_; Int_t numBinsY_; int variableX_; int variableY_; diff --git a/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingValidationPlots.C b/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingValidationPlots.C index 6f02d79a91684..3ee3ed87dcbc0 100644 --- a/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingValidationPlots.C +++ b/TauAnalysis/MCEmbeddingTools/macros/makeEmbeddingValidationPlots.C @@ -230,7 +230,7 @@ TGraphAsymmErrors* getEfficiency(const TH1* histogram_numerator, const TH1* hist return 0; } - TAxis* xAxis = histogram_numerator->GetXaxis(); + const TAxis* xAxis = histogram_numerator->GetXaxis(); Int_t nBins = xAxis->GetNbins(); TArrayF x(nBins); From 67b243fc76c32a9ebc3c5ff0b8aef173426786f8 Mon Sep 17 00:00:00 2001 From: wmtan Date: Mon, 13 Apr 2015 22:14:51 +0200 Subject: [PATCH 2/4] Macros need to compile in ROOT6 --- .../macros/PlotAlignmentValidation.C | 12 ++++++------ .../macros/PlotAlignmentValidation.h | 3 ++- Alignment/OfflineValidation/macros/trackSplitPlot.C | 3 ++- .../SiStripChannelGain/test/7TeVData/PlotMacro.C | 2 +- Calibration/IsolatedParticles/test/CalibTree.C | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C index b3c451fca8b30..03e46293b5087 100644 --- a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C +++ b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C @@ -60,13 +60,13 @@ PlotAlignmentValidation::PlotAlignmentValidation(const char *inputFile,std::stri //------------------------------------------------------------------------------ PlotAlignmentValidation::~PlotAlignmentValidation() { - delete sourcelist; for(std::vector::iterator it = sourceList.begin(); it != sourceList.end(); ++it){ delete (*it); } + delete sourcelist; } //------------------------------------------------------------------------------ @@ -214,7 +214,7 @@ void PlotAlignmentValidation::plotOutlierModules(const char *outputFileName, std gStyle->SetOptStat(111111); gStyle->SetStatY(0.9); - //TList treelist=getTreeList(); + //TList* treelist=getTreeList(); TCanvas *c1 = new TCanvas("canv", "canv", 800, 500); //setCanvasStyle( *c1 ); @@ -312,13 +312,13 @@ void PlotAlignmentValidation::plotOutlierModules(const char *outputFileName, std } //------------------------------------------------------------------------------ -TList PlotAlignmentValidation::getTreeList() +TList* PlotAlignmentValidation::getTreeList() { - TList treeList = new TList(); + TList *treeList = new TList(); TFile *first_source = (TFile*)sourcelist->First(); std::cout<GetName()<Get( treeBaseDir.c_str() ); - treeList.Add( (TTree*)(*d).Get("TkOffVal") ); + treeList->Add( (TTree*)(*d).Get("TkOffVal") ); if( moreThanOneSource ==true ){ TFile *nextsource = (TFile*)sourcelist->After( first_source ); @@ -326,7 +326,7 @@ TList PlotAlignmentValidation::getTreeList() std::cout<GetName()<Get("TrackerOfflineValidation"); - treeList.Add((TTree*)(*d).Get("TkOffVal")); + treeList->Add((TTree*)(*d).Get("TkOffVal")); nextsource = (TFile*)sourcelist->After( nextsource ); } diff --git a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.h b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.h index aa7042a451716..a8e55807c5dd7 100644 --- a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.h +++ b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.h @@ -72,6 +72,7 @@ TkOfflineVariables::TkOfflineVariables(std::string fileName, std::string baseDir class PlotAlignmentValidation { public: //PlotAlignmentValidation(TString *tmp); + PlotAlignmentValidation() {} PlotAlignmentValidation(const char *inputFile,std::string fileName="", int lineColor=1, int lineStyle=1); ~PlotAlignmentValidation(); void loadFileList(const char *inputFile, std::string fileName="", int lineColor=2, int lineStyle=1); @@ -89,7 +90,7 @@ class PlotAlignmentValidation { THStack* addHists(const char *selection, const TString &residType = "xPrime", TLegend **myLegend = 0, bool printModuleIds = false);//add hists fulfilling 'selection' on TTree; residType: xPrime,yPrime,xPrimeNorm,yPrimeNorm,x,y,xNorm; if (printModuleIds): cout DetIds private : - TList getTreeList(); + TList* getTreeList(); std::string treeBaseDir; bool useFit_; diff --git a/Alignment/OfflineValidation/macros/trackSplitPlot.C b/Alignment/OfflineValidation/macros/trackSplitPlot.C index 397894ebcdd7d..9b6dfa9028f33 100644 --- a/Alignment/OfflineValidation/macros/trackSplitPlot.C +++ b/Alignment/OfflineValidation/macros/trackSplitPlot.C @@ -9,6 +9,7 @@ Table Of Contents 6. TDR Style ***********************************/ +#include #include "trackSplitPlot.h" //=================== @@ -119,7 +120,7 @@ TCanvas *trackSplitPlot(Int_t nFiles,TString *files,TString *names,TString xvar, if (type == Profile || type == ScatterPlot || type == Histogram || type == Resolution) axislimits(nFiles,files,yvar,'y',relative,pull,ymin,ymax); - TString meansrmss[n]; + std::vector meansrmss(n); Bool_t used[n]; //a file is not "used" if it's MC data and the x variable is run number, or if the filename is blank for (Int_t i = 0; i < n; i++) diff --git a/CalibTracker/SiStripChannelGain/test/7TeVData/PlotMacro.C b/CalibTracker/SiStripChannelGain/test/7TeVData/PlotMacro.C index 6ab185df5ab1f..e2572da89f81b 100644 --- a/CalibTracker/SiStripChannelGain/test/7TeVData/PlotMacro.C +++ b/CalibTracker/SiStripChannelGain/test/7TeVData/PlotMacro.C @@ -17,7 +17,7 @@ #include -#include +#include "tdrstyle.C" void PlotMacro_Core(string input, string moduleName, string output); TF1* getLandau(TH1* InputHisto, double* FitResults, double LowRange=50, double HighRange=5400); diff --git a/Calibration/IsolatedParticles/test/CalibTree.C b/Calibration/IsolatedParticles/test/CalibTree.C index c3bd6cb7d327c..126024a013f2a 100644 --- a/Calibration/IsolatedParticles/test/CalibTree.C +++ b/Calibration/IsolatedParticles/test/CalibTree.C @@ -90,9 +90,9 @@ public : virtual void Show(Long64_t entry = -1); bool goodTrack(); void BookHisto(std::string fname); + TFile *fout; private: - TFile *fout; TProfile *hprof_ndets; }; From f93745b7e22f23d215e80889a5983261185573fc Mon Sep 17 00:00:00 2001 From: wmtan Date: Tue, 14 Apr 2015 00:40:24 +0200 Subject: [PATCH 3/4] Macros need to compile in ROOT6 --- RecoParticleFlow/PFClusterTools/test/src/init.C | 2 +- .../PFClusterTools/test/src/testConversion.C | 16 ++++++++-------- .../PFClusterTools/test/src/testWrappers.C | 2 +- RecoTracker/TrackProducer/test/analyze_tracks.C | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/RecoParticleFlow/PFClusterTools/test/src/init.C b/RecoParticleFlow/PFClusterTools/test/src/init.C index 3c212405e615d..27ef035da3bd4 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/init.C +++ b/RecoParticleFlow/PFClusterTools/test/src/init.C @@ -1,8 +1,8 @@ +{ /* * A Root macro to initialise testing of the functionality of the PFClusterTools package * */ -{ gSystem->Load("libRecoParticleFlowPFClusterTools.so"); std::cout << "Loaded libraries." << std::endl; using namespace std; diff --git a/RecoParticleFlow/PFClusterTools/test/src/testConversion.C b/RecoParticleFlow/PFClusterTools/test/src/testConversion.C index c9f0964453527..b699ca14617b2 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/testConversion.C +++ b/RecoParticleFlow/PFClusterTools/test/src/testConversion.C @@ -7,22 +7,22 @@ using namespace pftools; TFile* testConversion = new TFile("TestConversion.root", "recreate"); - testConversion.mkdir("extraction"); - testConversion.cd("extraction"); + testConversion->mkdir("extraction"); + testConversion->cd("extraction"); TTree* tree = new TTree("Extraction", ""); Calibratable* c = new Calibratable(); tree->Branch("Calibratable", "pftools::Calibratable", &c, 32000, 2); std::cout << "Initialised objects etc.\n"; - TRandom2 rand; + TRandom2 rand2; for (unsigned u(0); u < 1000; ++u) { double eta, phi, energy, ecalFrac, gaussSamp; - eta = rand.Uniform(0, 1.5); - phi = rand.Uniform(0, 3.14); - energy = rand.Uniform(2, 20); - ecalFrac = rand.Uniform(0, 1.0); - gaussSamp = rand.Gaus(1, 0.3); + eta = rand2.Uniform(0, 1.5); + phi = rand2.Uniform(0, 3.14); + energy = rand2.Uniform(2, 20); + ecalFrac = rand2.Uniform(0, 1.0); + gaussSamp = rand2.Gaus(1, 0.3); //gaussSamp = 1.0; c->reset(); diff --git a/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C b/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C index 2852dbc8814fa..1b885de387567 100644 --- a/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C +++ b/RecoParticleFlow/PFClusterTools/test/src/testWrappers.C @@ -1,8 +1,8 @@ +{ /* * A Root macro to initialise testing of the functionality of the PFClusterTools package * */ -{ gSystem->Load("libRecoParticleFlowPFClusterTools.so"); TFile f("TestWrappers.root", "recreate"); diff --git a/RecoTracker/TrackProducer/test/analyze_tracks.C b/RecoTracker/TrackProducer/test/analyze_tracks.C index b6dc287f7ee71..27173b27b79b9 100644 --- a/RecoTracker/TrackProducer/test/analyze_tracks.C +++ b/RecoTracker/TrackProducer/test/analyze_tracks.C @@ -7,11 +7,11 @@ TTree * tree = (TTree *) gROOT->FindObject("Events"); TFile outFile("graphsParTest2.root","recreate"); float intervals[] = {0,0.5,1.0,1.5,2.0,2.5}; int bins = 5; -char * ptinterval = "4.99 tot; vector ptrmsRS; From bf43e90162b5eb4d50f15d7f2054bd7d61b291ca Mon Sep 17 00:00:00 2001 From: Michail Date: Tue, 14 Apr 2015 12:14:44 +0200 Subject: [PATCH 4/4] Added protection for negative HCAL energy in presence of HO --- RecoParticleFlow/PFProducer/src/PFAlgo.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoParticleFlow/PFProducer/src/PFAlgo.cc b/RecoParticleFlow/PFProducer/src/PFAlgo.cc index 282badf75be0f..956328227acc2 100644 --- a/RecoParticleFlow/PFProducer/src/PFAlgo.cc +++ b/RecoParticleFlow/PFProducer/src/PFAlgo.cc @@ -2253,7 +2253,7 @@ void PFAlgo::processBlock( const reco::PFBlockRef& blockref, PFClusterRef hoclusterref = elements[iHO].clusterRef(); (*pfCandidates_)[tmpi].addElementInBlock( blockref, iHO); muonHO = std::min(muonHO_[0]+muonHO_[1],hoclusterref->energy()); - (*pfCandidates_)[tmpi].setHcalEnergy(totalHcal-totalHO,muonHcal); + (*pfCandidates_)[tmpi].setHcalEnergy(max(totalHcal-totalHO,0.0),muonHcal); (*pfCandidates_)[tmpi].setHoEnergy(hoclusterref->energy(),muonHO); } // Remove it from the block @@ -2742,7 +2742,7 @@ void PFAlgo::processBlock( const reco::PFBlockRef& blockref, (*pfCandidates_)[tmpi].setHcalEnergy( rawhcalEnergy[iPivot],hcalEnergy[iPivot] ); (*pfCandidates_)[tmpi].setHoEnergy(0., 0.); } else { - (*pfCandidates_)[tmpi].setHcalEnergy( rawhcalEnergy[iPivot]-totalHO,hcalEnergy[iPivot]*(1.-totalHO/rawhcalEnergy[iPivot])); + (*pfCandidates_)[tmpi].setHcalEnergy( max(rawhcalEnergy[iPivot]-totalHO,0.0),hcalEnergy[iPivot]*(1.-totalHO/rawhcalEnergy[iPivot])); (*pfCandidates_)[tmpi].setHoEnergy(totalHO, totalHO * hcalEnergy[iPivot]/rawhcalEnergy[iPivot]); } (*pfCandidates_)[tmpi].setPs1Energy( 0. ); @@ -2814,7 +2814,7 @@ void PFAlgo::processBlock( const reco::PFBlockRef& blockref, chargedHadron.setHcalEnergy( fraction * totalHcal, fraction * totalHcalEnergyCalibrated ); chargedHadron.setHoEnergy( 0., 0. ); } else { - chargedHadron.setHcalEnergy( fraction * (totalHcal-totalHO), fraction * totalHcalEnergyCalibrated * (1.-totalHO/totalHcal) ); + chargedHadron.setHcalEnergy( fraction * max(totalHcal-totalHO,0.0), fraction * totalHcalEnergyCalibrated * (1.-totalHO/totalHcal) ); chargedHadron.setHoEnergy( fraction * totalHO, fraction * totalHO * totalHcalEnergyCalibrated / totalHcal ); } //JB: fixing up (previously omitted) setting of ECAL energy gouzevit @@ -3098,7 +3098,7 @@ void PFAlgo::processBlock( const reco::PFBlockRef& blockref, (*pfCandidates_)[tmpi].setHcalEnergy( totalHcal, calibHcal ); (*pfCandidates_)[tmpi].setHoEnergy(0.,0.); } else { - (*pfCandidates_)[tmpi].setHcalEnergy( totalHcal-totalHO, calibHcal*(1.-totalHO/totalHcal)); + (*pfCandidates_)[tmpi].setHcalEnergy( max(totalHcal-totalHO,0.0), calibHcal*(1.-totalHO/totalHcal)); (*pfCandidates_)[tmpi].setHoEnergy(totalHO,totalHO*calibHcal/totalHcal); } (*pfCandidates_)[tmpi].setPs1Energy( 0. );