Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes and updates to the geometry comparison tool (v2) #9204

Merged
merged 3 commits into from May 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -8,8 +8,9 @@ def __init__(self, name, config, runGeomComp = "1"):
self.condShorts = {
"TrackerAlignmentErrorExtendedRcd":
{"zeroAPE":{"connectString": ("frontier://FrontierProd"
"/CMS_COND_31X_FROM21X"),
"tagName": "TrackerIdealGeometryErrors210_mc",
"/CMS_CONDITIONS"),
"tagName": "TrackerAlignmentExtendedErr_2009_v2_express_IOVs",

"labelName": ""}}}
section = "alignment:%s"%name
if not config.has_section( section ):
Expand Down
Expand Up @@ -44,7 +44,7 @@
cd .oO[CMSSW_BASE]Oo./src
export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
eval `scramv1 ru -sh`
rfmkdir -p .oO[datadir]Oo. &>! /dev/null
#rfmkdir -p .oO[datadir]Oo. &>! /dev/null

#remove possible result file from previous runs
previous_results=$(cmsLs -l /store/caf/user/$USER/.oO[eosdir]Oo. | awk '{print $5}')
Expand Down
Expand Up @@ -98,6 +98,7 @@ def getRepMap(self, alignment = None):
"CMSSW_RELEASE_BASE": self.cmsswreleasebase,
"alignmentName": alignment.name,
"condLoad": alignment.getConditions(),
"condLoad": alignment.getConditions(),
})
return result

Expand Down

Large diffs are not rendered by default.

Expand Up @@ -9,11 +9,11 @@
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."

process.load("Configuration.Geometry.GeometryDB_cff")
#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
#process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP")

process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")

#process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
process.load("CondCore.DBCommon.CondDBSetup_cfi")

process.MessageLogger = cms.Service("MessageLogger",
Expand All @@ -31,7 +31,6 @@
input = cms.untracked.int32(1)
)
process.dump = cms.EDAnalyzer("TrackerGeometryIntoNtuples",
# outputFile = cms.untracked.string('.oO[workdir]Oo./.oO[alignmentName]Oo.ROOTGeometry.root'),
outputFile = cms.untracked.string('.oO[alignmentName]Oo.ROOTGeometry.root'),
outputTreename = cms.untracked.string('alignTree')
)
Expand All @@ -50,15 +49,11 @@
# global tag
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
process.load("Configuration.Geometry.GeometryDB_cff")

#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")

#process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP")

#process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
# the input .GlobalPosition_Frontier_cff is providing the frontier://FrontierProd/CMS_COND_31X_ALIGNMENT in the release which does not provide the ideal geometry
#process.GlobalPosition.connect = 'frontier://FrontierProd/CMS_COND_31X_FROM21X'
process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")

process.load("CondCore.DBCommon.CondDBSetup_cfi")

Expand All @@ -76,11 +71,8 @@
process.load("DQM.SiStripCommon.TkHistoMap_cfi")

process.DQMStore=cms.Service("DQMStore")
#process.TkDetMap = cms.Service("TkDetMap")
#process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader")

process.load("DQMServices.Core.DQMStore_cfg")
#process.DQMStore=cms.Service("DQMStore")

# configuration of the Tracker Geometry Comparison Tool
# Tracker Geometry Comparison
Expand All @@ -89,13 +81,9 @@

process.TrackerGeometryCompare.inputROOTFile1 = '.oO[comparedGeometry]Oo.'
process.TrackerGeometryCompare.inputROOTFile2 = '.oO[referenceGeometry]Oo.'
# process.TrackerGeometryCompare.outputFile = ".oO[workdir]Oo./.oO[name]Oo..Comparison_common.oO[common]Oo..root"
process.TrackerGeometryCompare.outputFile = ".oO[name]Oo..Comparison_common.oO[common]Oo..root"

process.load("CommonTools.UtilAlgos.TFileService_cfi")
#process.TFileService = cms.Service("TFileService",
# fileName = cms.string('TkSurfDeform.root')
# )
process.TFileService.fileName = cms.string("TkSurfDeform_.oO[name]Oo..Comparison_common.oO[common]Oo..root")

process.TrackerGeometryCompare.levels = [ .oO[levels]Oo. ]
Expand All @@ -113,7 +101,7 @@
dbOutputTemplate= """
//_________________________ db Output ____________________________
# setup for writing out to DB
include "CondCore/DBCommon/data/CondDBSetup.cfi"
include "CondCore/DBCommon/CondDBSetup.cfi"
# include "CondCore/DBCommon/data/CondDBCommon.cfi"

service = PoolDBOutputService {
Expand Down
69 changes: 56 additions & 13 deletions Alignment/OfflineValidation/scripts/comparisonScript.C
Expand Up @@ -33,25 +33,68 @@ void comparisonScript (TString inFile,//="mp1510_vs_mp1509.Comparison_commonTrac
// from r and dphi

// now the object to produce the comparison plots is created
GeometryComparisonPlotter * cp = new GeometryComparisonPlotter (inFile, outDir);

// Plot Translations
GeometryComparisonPlotter * trans = new GeometryComparisonPlotter (inFile, outDir);
// x and y contain the couples to plot
// -> every combination possible will be performed
// /!\ always give units (otherwise, unexpected bug from root...)
vector<TString> x,y;
x.push_back("r"); cp->SetBranchUnits("r", "cm");
x.push_back("phi"); cp->SetBranchUnits("phi", "rad");
x.push_back("z"); cp->SetBranchUnits("z", "cm"); //cp->SetBranchMax("z", 100); cp->SetBranchMin("z", -100);
y.push_back("dr"); cp->SetBranchSF("dr", 10000); cp->SetBranchUnits("dr", "#mum");
y.push_back("dz"); cp->SetBranchSF("dz", 10000); cp->SetBranchUnits("dz", "#mum");
y.push_back("rdphi"); cp->SetBranchSF("rdphi",10000); cp->SetBranchUnits("rdphi", "#mum rad");
y.push_back("dx"); cp->SetBranchSF("dx", 10000); cp->SetBranchUnits("dx", "#mum"); //cp->SetBranchMax("dx", 10); cp->SetBranchMin("dx", -10);
y.push_back("dy"); cp->SetBranchSF("dy", 10000); cp->SetBranchUnits("dy", "#mum"); //cp->SetBranchMax("dy", 10); cp->SetBranchMin("dy", -10);
cp->MakePlots(x, y); // default output is pdf, but png gives a nicer result, so we use it as well
x.push_back("r"); trans->SetBranchUnits("r", "cm");
x.push_back("phi"); trans->SetBranchUnits("phi", "rad");
x.push_back("z"); trans->SetBranchUnits("z", "cm"); //trans->SetBranchMax("z", 100); trans->SetBranchMin("z", -100);
y.push_back("dr"); trans->SetBranchSF("dr", 10000); trans->SetBranchUnits("dr", "#mum");
y.push_back("dz"); trans->SetBranchSF("dz", 10000); trans->SetBranchUnits("dz", "#mum");
y.push_back("rdphi"); trans->SetBranchSF("rdphi",10000); trans->SetBranchUnits("rdphi", "#mum rad");
y.push_back("dx"); trans->SetBranchSF("dx", 10000); trans->SetBranchUnits("dx", "#mum"); //trans->SetBranchMax("dx", 10); trans->SetBranchMin("dx", -10);
y.push_back("dy"); trans->SetBranchSF("dy", 10000); trans->SetBranchUnits("dy", "#mum"); //trans->SetBranchMax("dy", 10); trans->SetBranchMin("dy", -10);
trans->MakePlots(x, y); // default output is pdf, but png gives a nicer result, so we use it as well
// remark: what takes the more time is the creation of the output files,
// not the looping on the tree (because the code is perfect, of course :p)
cp->SetGrid(1,1);
cp->SetPrintOption("png");
cp->MakePlots(x, y);
trans->SetGrid(1,1);
trans->SetPrintOption("png");
trans->MakePlots(x, y);


// Plot Rotations
GeometryComparisonPlotter * rot = new GeometryComparisonPlotter (inFile, outDir);
// x and y contain the couples to plot
// -> every combination possible will be performed
// /!\ always give units (otherwise, unexpected bug from root...)
vector<TString> a,b;
a.push_back("alpha"); rot->SetBranchUnits("alpha", "rad");
a.push_back("beta"); rot->SetBranchUnits("beta", "rad");
a.push_back("gamma"); rot->SetBranchUnits("gamma", "rad");
b.push_back("dalpha"); rot->SetBranchUnits("dalpha", "rad");
b.push_back("dbeta"); rot->SetBranchUnits("dbeta", "rad");
b.push_back("dgamma"); rot->SetBranchUnits("dgamma", "rad");
rot->MakePlots(a, b); // default output is pdf, but png gives a nicer result, so we use it as well
// remark: what takes the more time is the creation of the output files,
// not the looping on the tree (because the code is perfect, of course :p)
rot->SetGrid(1,1);
rot->SetPrintOption("png");
rot->MakePlots(a, b);

// Plot cross talk
GeometryComparisonPlotter * cross = new GeometryComparisonPlotter (inFile, outDir);
// x and y contain the couples to plot
// -> every combination possible will be performed
// /!\ always give units (otherwise, unexpected bug from root...)
vector<TString> dx,dy;
dx.push_back("dr"); cross->SetBranchSF("dr", 10000); cross->SetBranchUnits("dr", "#mum");
dx.push_back("dz"); cross->SetBranchSF("dz", 10000); cross->SetBranchUnits("dz", "#mum");
dx.push_back("rdphi"); cross->SetBranchSF("rdphi",10000); cross->SetBranchUnits("rdphi", "#mum rad");
dx.push_back("dx"); cross->SetBranchSF("dx", 10000); cross->SetBranchUnits("dx", "#mum");
dx.push_back("dy"); cross->SetBranchSF("dy", 10000); cross->SetBranchUnits("dy", "#mum");
dy.push_back("dalpha"); cross->SetBranchUnits("dalpha", "rad");
dy.push_back("dbeta"); cross->SetBranchUnits("dbeta", "rad");
dy.push_back("dgamma"); cross->SetBranchUnits("dgamma", "rad");
cross->MakePlots(dx,dy); // default output is pdf, but png gives a nicer result, so we use it as well
// remark: what takes the more time is the creation of the output files,
// not the looping on the tree (because the code is perfect, of course :p)
cross->SetGrid(1,1);
cross->SetPrintOption("png");
cross->MakePlots(dx, dy);

// now the same object can be reused with other specifications/cuts
//void SetPrint (const bool); // activates the printing of the individual and global pdf
Expand Down
17 changes: 6 additions & 11 deletions Alignment/OfflineValidation/scripts/makeArrowPlots.C
Expand Up @@ -12,7 +12,7 @@ float y_,x_,z_,phi_,r_,dphi_,dr_,dx_,dz_,dy_;
int level_,sublevel_;
char outputDir_[192];

void Plot10Mu(char* text,float X, float Y, float size)
void Plot10Mu(const char* text,float X, float Y, float size)
{
TPaveText* atext = new TPaveText(X,Y,X+size,Y+size);
atext->AddText(text);
Expand Down Expand Up @@ -48,13 +48,8 @@ void DrawRPhiLegend(double xLim, double yLim, double barrelRPhiRescale)
normArrow(xTest+dYTest,yTest-4*dYTest-disty,500./10000*barrelRPhiRescale);
}

void Write()
{
output->Write();
}


int makeRPhiArrowPlot( TTree* data, char* name, double xLim, double yLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){
int makeRPhiArrowPlot( TTree* data, const char* name, double xLim, double yLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){


TCanvas* OBPCanvas = new TCanvas(name,name,1050,875);
Expand All @@ -80,7 +75,7 @@ int makeRPhiArrowPlot( TTree* data, char* name, double xLim, double yLim, double
DrawRPhiLegend( xLim, yLim, barrelRPhiRescale );

char sliceLeg[192];
sprintf( sliceLeg, "%s: %d < z <= %d", name, zMin, zMax );
sprintf( sliceLeg, "%s: %f < z <= %f", name, zMin, zMax );
//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
TPaveText* atext = new TPaveText(0.2*xLim,0.85*yLim,0.66*xLim,0.99*yLim);
atext->AddText(sliceLeg);
Expand All @@ -99,7 +94,7 @@ int makeRPhiArrowPlot( TTree* data, char* name, double xLim, double yLim, double
return passcut;
}

int makeZPhiArrowPlot( TTree* data, char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){
int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){


TCanvas* OBPCanvas = new TCanvas(name,name,1050,875);
Expand All @@ -125,7 +120,7 @@ int makeZPhiArrowPlot( TTree* data, char* name, double zLim, double phiLim, doub
DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale );

char sliceLeg[192];
sprintf( sliceLeg, "%s: %d < r <= %d", name, rMin, rMax );
sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax );
//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim);
atext->AddText(sliceLeg);
Expand Down Expand Up @@ -198,7 +193,7 @@ int makeRZArrowPlot( TTree* data, char* name, double zLim, double zLimMax, doubl
}
*/

void makeArrowPlots(char* filename, char* outputDir)
void makeArrowPlots(const char* filename, const char* outputDir)
{

fin = new TFile(filename);
Expand Down