Skip to content

Commit

Permalink
Merge pull request #13133 from friccita/MatBudgValidation_rootmacros
Browse files Browse the repository at this point in the history
fixed macros to be compatible with Root 6
  • Loading branch information
cmsbuild committed Feb 10, 2016
2 parents b4d6124 + e60e4b5 commit edb1732
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Geometry/TrackerCommonData/data/Materials/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
f77=g77
cflags=-O -g -c
link=g77
libs=`cernlib -v pro geant pawlib graflib/X11 packlib mathlib kernlib`
libs=`cernlib geant pawlib graflib/X11 packlib mathlib kernlib`
linkopts=-v
INCS = /usr/include/

Expand Down
4 changes: 2 additions & 2 deletions Validation/Geometry/test/ECALMaterialBudgetCompare.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ void ECALMaterialBudgetCompare()
{

gROOT ->Reset();
char* rfilename = "old_matbdg_ECAL.root";
char* sfilename = "new_matbdg_ECAL.root";
const char* rfilename = "old_matbdg_ECAL.root";
const char* sfilename = "new_matbdg_ECAL.root";

int rcolor = 2;
int scolor = 4;
Expand Down
40 changes: 27 additions & 13 deletions Validation/Geometry/test/MaterialBudget.C
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <iomanip>
#include <fstream>
#include <cmath>
#include <stdlib.h>

// data dirs
TString theDirName = "Images";
Expand Down Expand Up @@ -33,16 +34,25 @@ TProfile* prof_x0_str_ELE;
TProfile* prof_x0_str_OTH;
TProfile* prof_x0_str_AIR;
//
TProfile* prof_l0_det_total;
//
TProfile2D* prof2d_x0_det_total;
//
unsigned int iFirst = 1;
unsigned int iLast = 9;
//

//forward declaration of functions
void createPlots(TString plot);
void create2DPlots(TString plot);
void createRatioPlots(TString plot);
void drawEtaValues();
void makeColorTable();

using namespace std;

// Main
MaterialBudget(TString detector) {
void MaterialBudget(TString detector) {

//
gROOT->SetStyle("Plain");
Expand All @@ -58,7 +68,7 @@ MaterialBudget(TString detector) {
&& theDetector!="InnerTracker"
){
cerr << "MaterialBudget - ERROR detector not found " << theDetector << endl;
break;
exit(0);
}
//

Expand Down Expand Up @@ -156,7 +166,7 @@ void createPlots(TString plot) {
prof_x0_det_ELE = (TProfile*)theDetectorFile->Get(Form("%u", 500 + plotNumber));
prof_x0_det_OTH = (TProfile*)theDetectorFile->Get(Form("%u", 600 + plotNumber));
prof_x0_det_AIR = (TProfile*)theDetectorFile->Get(Form("%u", 700 + plotNumber));

// histos
TH1D* hist_x0_total = (TH1D*)prof_x0_det_total->ProjectionX();
TH1D* hist_x0_SUP = (TH1D*)prof_x0_det_SUP->ProjectionX();
Expand All @@ -165,7 +175,7 @@ void createPlots(TString plot) {
TH1D* hist_x0_COL = (TH1D*)prof_x0_det_COL->ProjectionX();
TH1D* hist_x0_ELE = (TH1D*)prof_x0_det_ELE->ProjectionX();
TH1D* hist_x0_OTH = (TH1D*)prof_x0_det_OTH->ProjectionX();
TH1D* hist_x0_AIR = (TH1D*)prof_x0_det_AIR->ProjectionX();
TH1D* hist_x0_AIR = (TH1D*)prof_x0_det_AIR->ProjectionX();
//
if(theDetector=="TrackerSum" || theDetector=="Pixel" || theDetector=="Strip" || theDetector=="InnerTracker") {
TString subDetector = "TIB";
Expand Down Expand Up @@ -303,6 +313,7 @@ void create2DPlots(TString plot) {
unsigned int plotNumber = 0;
TString abscissaName = "dummy";
TString ordinateName = "dummy";
TString quotaName = "dummy";
Int_t zLog = 0;
Int_t iDrawEta = 0;
Int_t iRebin = 0; //Rebin
Expand Down Expand Up @@ -657,7 +668,7 @@ void createRatioPlots(TString plot) {
void drawEtaValues(){

//Add eta labels
Float_t etas[33] = {-3.4, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4., -1.2, -1., -0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8, 1., 1.2, 1.4, 1.6, 1.8, 2., 2.2, 2.4, 2.6, 2.8, 3.0, 3.4};
Float_t etas[33] = {-3.4, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4, -1.2, -1., -0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8, 1., 1.2, 1.4, 1.6, 1.8, 2., 2.2, 2.4, 2.6, 2.8, 3.0, 3.4};
Float_t etax = 2940.;
Float_t etay = 1240.;
Float_t lineL = 100.;
Expand All @@ -676,16 +687,18 @@ void drawEtaValues(){
TLine *linev = new TLine(0.,-10.,0.,10.);
linev->Draw();

Float_t x1;
Float_t y1;
if ( etas[ieta]>-1.6 && etas[ieta]<1.6 ){
Float_t x1 = etay/tan(th);
Float_t y1 = etay;
x1 = etay/tan(th);
y1 = etay;
} else if ( etas[ieta]<=-1.6 ) {
Float_t x1 = -etax;
Float_t y1 = -etax*tan(th);
x1 = -etax;
y1 = -etax*tan(th);
talign = 11;
} else if ( etas[ieta]>=1.6 ){
Float_t x1 = etax;
Float_t y1 = etax*tan(th);
x1 = etax;
y1 = etax*tan(th);
talign = 31;
}
Float_t x2 = x1+lineL*cos(th);
Expand All @@ -697,10 +710,11 @@ void drawEtaValues(){
line1->Draw();
char text[20];
int rc = sprintf(text, "%3.1f", etas[ieta]);
TLatex *t1;
if ( etas[ieta] == 0 ) {
TLatex *t1 = new TLatex(xt,yt,"#eta = 0");
t1 = new TLatex(xt,yt,"#eta = 0");
} else {
TLatex *t1 = new TLatex(xt,yt,text);
t1 = new TLatex(xt,yt,text);
}
t1->SetTextSize(0.03);
t1->SetTextAlign(talign);
Expand Down
3 changes: 2 additions & 1 deletion Validation/Geometry/test/MaterialBudget_TDR.C
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ float xmax;
float ymin;
float ymax;
//
void createPlots(TString plot);

using namespace std;

// Main
MaterialBudget_TDR() {
void MaterialBudget_TDR() {

//TDR style
setTDRStyle();
Expand Down
35 changes: 23 additions & 12 deletions Validation/Geometry/test/TrackerMaterialBudgetComparison.C
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ unsigned int iFirst = 1;
unsigned int iLast = 9;
//

// function declarations
void createPlots(TString plot);
void create2DPlots(TString plot);
void drawEtaValues();
void makeColorTableRB();

using namespace std;

// Main
TrackerMaterialBudgetComparison(TString detector) {
void TrackerMaterialBudgetComparison(TString detector) {

gROOT->SetStyle("Plain");

Expand All @@ -74,7 +80,7 @@ TrackerMaterialBudgetComparison(TString detector) {
&& theDetector!="InnerTracker"
){
cerr << "MaterialBudget - ERROR detector not found " << theDetector << endl;
break;
exit(0);
}
//

Expand Down Expand Up @@ -423,7 +429,7 @@ void createPlots(TString plot) {
histo_ratio->SetFillColor(0); // white
histo_ratio->SetMarkerStyle(20); // cyrcles
histo_ratio->SetMarkerSize(0.2); //
histo_ratio->SetLineWidth(0.8); //
histo_ratio->SetLineWidth(1); //
//
// Draw
histo_ratio->GetXaxis()->SetTitle(abscissaName);
Expand Down Expand Up @@ -455,11 +461,13 @@ void create2DPlots(TString plot) {
unsigned int plotNumber = 0;
TString abscissaName = "dummy";
TString ordinateName = "dummy";
TString quotaName = "dummy";
Int_t zLog = 0;
Int_t iDrawEta = 0; //draw Eta values
Int_t iRebin = 0; //Rebin
Double_t histoMin = -1.;
Double_t histoMax = -1.;

if(plot.CompareTo("x_vs_eta_vs_phi") == 0) {
plotNumber = 30;
abscissaName = TString("#eta");
Expand Down Expand Up @@ -712,7 +720,7 @@ void create2DPlots(TString plot) {
void drawEtaValues(){

//Add eta labels
Float_t etas[33] = {-3.4, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4., -1.2, -1., -0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8, 1., 1.2, 1.4, 1.6, 1.8, 2., 2.2, 2.4, 2.6, 2.8, 3.0, 3.4};
Float_t etas[33] = {-3.4, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4, -1.2, -1., -0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8, 1., 1.2, 1.4, 1.6, 1.8, 2., 2.2, 2.4, 2.6, 2.8, 3.0, 3.4};
Float_t etax = 2940.;
Float_t etay = 1240.;
Float_t lineL = 100.;
Expand All @@ -728,16 +736,18 @@ void drawEtaValues(){
TLine *linev = new TLine(0.,-10.,0.,10.);
linev->Draw();

Float_t x1;
Float_t y1;
if ( etas[ieta]>-1.6 && etas[ieta]<1.6 ){
Float_t x1 = etay/tan(th);
Float_t y1 = etay;
x1 = etay/tan(th);
y1 = etay;
} else if ( etas[ieta]<=-1.6 ) {
Float_t x1 = -etax;
Float_t y1 = -etax*tan(th);
x1 = -etax;
y1 = -etax*tan(th);
talign = 11;
} else if ( etas[ieta]>=1.6 ){
Float_t x1 = etax;
Float_t y1 = etax*tan(th);
x1 = etax;
y1 = etax*tan(th);
talign = 31;
}
Float_t x2 = x1+lineL*cos(th);
Expand All @@ -749,10 +759,11 @@ void drawEtaValues(){
line1->Draw();
char text[20];
int rc = sprintf(text, "%3.1f", etas[ieta]);
TLatex *t1;
if ( etas[ieta] == 0 ) {
TLatex *t1 = new TLatex(xt,yt,"#eta = 0");
t1 = new TLatex(xt,yt,"#eta = 0");
} else {
TLatex *t1 = new TLatex(xt,yt,text);
t1 = new TLatex(xt,yt,text);
}
t1->SetTextSize(0.03);
t1->SetTextAlign(talign);
Expand Down

0 comments on commit edb1732

Please sign in to comment.