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

Allow selection of subdetector for track splitting #10356

Merged
merged 3 commits into from Jul 31, 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
6 changes: 3 additions & 3 deletions Alignment/OfflineValidation/macros/trackSplitPlot.h
Expand Up @@ -51,9 +51,9 @@ Int_t runNumberBins = 30;
Int_t binsProfileResolution = 30; //for everything but runNumber and nHits
//(nHits gets a bin for each integer between the minimum and the maximum)

TString xvariables[xsize] = {"pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", "runNumber","nHits",""};
TString yvariables[ysize] = {"pt", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", ""};
Bool_t relativearray[ysize] = {true, false, false, false, false, false, false, false, false};
TString xvariables[xsize] = {"", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", "runNumber", "nHits"};
TString yvariables[ysize] = {"pt", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", ""};
Bool_t relativearray[ysize] = {true, false, false, false, false, false, false, false, false};

TList *stufftodelete = new TList();

Expand Down
Expand Up @@ -10,14 +10,18 @@ def __init__(self, valName, alignment, config,
configBaseName = "TkAlTrackSplitting", scriptBaseName = "TkAlTrackSplitting", crabCfgBaseName = "TkAlTrackSplitting",
resultBaseName = "TrackSplitting", outputBaseName = "TrackSplitting"):
mandatories = ["trackcollection"]
defaults = {"subdetector": "BPIX"}
self.configBaseName = configBaseName
self.scriptBaseName = scriptBaseName
self.crabCfgBaseName = crabCfgBaseName
self.resultBaseName = resultBaseName
self.outputBaseName = outputBaseName
self.needParentFiles = False
GenericValidationData.__init__(self, valName, alignment, config,
"split", addMandatories = mandatories)
"split", addMandatories = mandatories, addDefaults = defaults)
validsubdets = self.validsubdets()
if self.general["subdetector"] not in validsubdets:
raise AllInOneError("'%s' is not a valid subdetector!\n" % self.general["subdetector"] + "The options are: " + ", ".join(validsubdets))

def createConfiguration(self, path ):
cfgName = "%s.%s.%s_cfg.py"%(self.configBaseName, self.name,
Expand All @@ -38,8 +42,9 @@ def getRepMap( self, alignment = None ):
repMap = GenericValidationData.getRepMap(self)
repMap.update({
"nEvents": self.general["maxevents"],
"TrackCollection": self.general["trackcollection"]
})
"TrackCollection": self.general["trackcollection"],
"subdetector": self.general["subdetector"],
})
# repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
# if self.jobmode.split( ',' )[0] == "crab":
# repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
Expand Down Expand Up @@ -70,3 +75,31 @@ def appendToMerge( self, validationsSoFar = "" ):
mergedoutputfile = os.path.join("root://eoscms//eos/cms", repMap["finalResultFile"].lstrip("/"))
validationsSoFar += "hadd -f %s %s\n" % (mergedoutputfile, parameters)
return validationsSoFar

def validsubdets(self):
filename = os.path.join(self.cmssw, "src/Alignment/CommonAlignmentProducer/python/AlignmentTrackSelector_cfi.py")
if not os.path.isfile(filename):
filename = os.path.join(self.cmsswreleasebase, "src/Alignment/CommonAlignmentProducer/python/AlignmentTrackSelector_cfi.py")
with open(filename) as f:
trackselector = f.read()

minhitspersubdet = trackselector.split("minHitsPerSubDet")[1].split("(",1)[1]

parenthesesdepth = 0
i = 0
for character in minhitspersubdet:
if character == "(":
parenthesesdepth += 1
if character == ")":
parenthesesdepth -= 1
if parenthesesdepth < 0:
break
i += 1
minhitspersubdet = minhitspersubdet[0:i]

results = minhitspersubdet.split(",")
empty = []
for i in range(len(results)):
results[i] = results[i].split("=")[0].strip().replace("in", "", 1)

return [a for a in results if a]
Expand Up @@ -98,7 +98,6 @@
process.AlignmentTrackSelector.etaMax = 9999.
process.AlignmentTrackSelector.nHitMin = 10
process.AlignmentTrackSelector.nHitMin2D = 2
process.AlignmentTrackSelector.minHitsPerSubDet.inBPIX=4 ##skip tracks not passing the pixel
process.AlignmentTrackSelector.chi2nMax = 9999.
process.AlignmentTrackSelector.applyMultiplicityFilter = True
process.AlignmentTrackSelector.maxMultiplicity = 1
Expand All @@ -109,7 +108,7 @@
process.AlignmentTrackSelector.minHitIsolation = 0.8
process.AlignmentTrackSelector.applyChargeCheck = False
process.AlignmentTrackSelector.minHitChargeStrip = 50.
process.AlignmentTrackSelector.minHitsPerSubDet.inBPIX = 2
process.AlignmentTrackSelector.minHitsPerSubDet.in.oO[subdetector]Oo. = 2
#process.AlignmentTrackSelector.trackQualities = ["highPurity"]
#process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
process.KFFittingSmootherWithOutliersRejectionAndRK.EstimateCut=30.0
Expand Down Expand Up @@ -168,32 +167,10 @@

trackSplitPlotExecution="""
#make track splitting plots
if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]] # check for interactive mode
then
rfmkdir -p .oO[workdir]Oo./TrackSplittingPlots
else
mkdir -p TrackSplittingPlots
fi

rfcp .oO[trackSplitPlotScriptPath]Oo. .
root -x -b -q TkAlTrackSplitPlot.C++
rfmkdir -p .oO[datadir]Oo./TrackSplittingPlots

if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]] # check for interactive mode
then
image_files=$(find .oO[workdir]Oo./TrackSplittingPlots/* -maxdepth 0)
echo ${image_files}
ls .oO[workdir]Oo./TrackSplittingPlots
else
image_files=$(find TrackSplittingPlots/* -maxdepth 0)
echo ${image_files}
ls TrackSplittingPlots
fi

for image in ${image_files}
do
cp -r ${image} .oO[datadir]Oo./TrackSplittingPlots
done

"""

######################################################################
Expand Down Expand Up @@ -254,8 +231,8 @@
/*
The variables are defined in Alignment/OfflineValidation/macros/trackSplitPlot.h
as follows:
TString xvariables[xsize] = {"pt", "eta", "phi", "dz", "dxy", "theta",
"qoverpt", "runNumber","nHits",""};
TString xvariables[xsize] = {"", "pt", "eta", "phi", "dz", "dxy", "theta",
"qoverpt", "runNumber", "nHits"};

TString yvariables[ysize] = {"pt", "pt", "eta", "phi", "dz", "dxy", "theta",
"qoverpt", ""};
Expand Down Expand Up @@ -290,12 +267,13 @@
void TkAlTrackSplitPlot()
{
//fillmatrix(); //(C)
makePlots(".oO[trackSplitPlotInstantiation]Oo.",
makePlots(
".oO[trackSplitPlotInstantiation]Oo.",
//misalignment,values,phases, //(A)
"TrackSplittingPlots"
".oO[datadir]Oo./TrackSplittingPlots"
//,"xvar","yvar" //(B)
//,plotmatrix //(C)
);
);
}
"""