Skip to content

Commit

Permalink
Changes from 75X backported
Browse files Browse the repository at this point in the history
  • Loading branch information
cschomak committed Jun 3, 2015
1 parent f240b75 commit 7d95147
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 65 deletions.
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 @@ -97,7 +97,7 @@ def createConfiguration(self, path ):
cfgs[cfgName] = configTemplates.compareTemplate
repMaps[cfgName] = repMap

cfgSchedule.append( cfgName )
cfgSchedule.append( cfgName )
GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule, repMaps = repMaps)

def createScript(self, path):
Expand All @@ -107,6 +107,8 @@ def createScript(self, path):
%self.name), repMap)
for name in self.__compares:
if '"DetUnit"' in self.__compares[name][0].split(","):
repMap["outputFile"] = (".oO[name]Oo..Comparison_common"+name+".root")
repMap["nIndex"] = ("")
repMap["runComparisonScripts"] += \
("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
"/scripts/comparisonScript.C .\n"
Expand All @@ -122,33 +124,45 @@ def createScript(self, path):
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images\n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*PXB*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/Translations\n")
repMap["runComparisonScripts"] += \
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/Rotations\n")
repMap["runComparisonScripts"] += \
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/CrossTalk\n")

### At the moment translations are images with suffix _1 and _2, rotations _3 and _4, and cross talk _5 and _6
### The numeration depends on the order of the MakePlots(x, y) commands in comparisonScript.C
### If comparisonScript.C is changed, check if the following lines need to be changed as well
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*PXF*\" "
("find . -maxdepth 1 -name \"*_1*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TIB*\" "
("find . -maxdepth 1 -name \"*_2*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")

repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TID*\" "
("find . -maxdepth 1 -name \"*_3*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TEC*\" "
("find . -maxdepth 1 -name \"*_4*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")

repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TOB*\" "
("find . -maxdepth 1 -name \"*_5*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*tracker*\" "
("find . -maxdepth 1 -name \"*_6*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")

repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name "
"\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
Expand All @@ -171,7 +185,7 @@ def createScript(self, path):
repMap["runComparisonScripts"] += \
("rfcp .oO[CMSSW_BASE]Oo./src/Alignment"
"/OfflineValidation/scripts/makeArrowPlots.C "
"$CWD/TkAllInOneTool\n"
".\n"
"root -b -q 'makeArrowPlots.C(\""
".oO[name]Oo..Comparison_common"+name
+".root\",\".oO[name]Oo.."
Expand Down Expand Up @@ -199,14 +213,16 @@ def createScript(self, path):
for cfg in self.configFiles:
# FIXME: produce this line only for enabled dbOutput
# postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
postProcess = "rfcp *.db .oO[datadir]Oo.\n"
# postProcess = "rfcp *.db .oO[datadir]Oo.\n"
postProcess = ""
repMap["CommandLine"]+= \
repMap["CommandLineTemplate"]%{"cfgFile":cfg,
"postProcess":postProcess}
repMap["CommandLine"]+= ("# overall postprocessing\n"
".oO[runComparisonScripts]Oo.\n"
)

#~ print configTemplates.scriptTemplate
scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) }
return GenericValidation.createScript(self, scripts, path)

Expand Down
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->SetBranchSF("dalpha", 1000); rot->SetBranchUnits("dalpha", "mrad");
b.push_back("dbeta"); rot->SetBranchSF("dbeta", 1000); rot->SetBranchUnits("dbeta", "mrad");
b.push_back("dgamma"); rot->SetBranchSF("dgamma", 1000); rot->SetBranchUnits("dgamma", "mrad");
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("dalpha"); cross->SetBranchSF("dalpha", 1000); cross->SetBranchUnits("dalpha", "mrad");
dx.push_back("dbeta"); cross->SetBranchSF("dbeta", 1000); cross->SetBranchUnits("dbeta", "mrad");
dx.push_back("dgamma"); cross->SetBranchSF("dgamma", 1000); cross->SetBranchUnits("dgamma", "mrad");
dy.push_back("dr"); cross->SetBranchSF("dr", 10000); cross->SetBranchUnits("dr", "#mum");
dy.push_back("dz"); cross->SetBranchSF("dz", 10000); cross->SetBranchUnits("dz", "#mum");
dy.push_back("rdphi"); cross->SetBranchSF("rdphi",10000); cross->SetBranchUnits("rdphi", "#mum rad");
dy.push_back("dx"); cross->SetBranchSF("dx", 10000); cross->SetBranchUnits("dx", "#mum");
dy.push_back("dy"); cross->SetBranchSF("dy", 10000); cross->SetBranchUnits("dy", "#mum");
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

0 comments on commit 7d95147

Please sign in to comment.