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

[92X] Fix pixel barycentre tool #18754

Merged
merged 6 commits into from May 17, 2017
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
12 changes: 4 additions & 8 deletions Alignment/CommonAlignmentProducer/src/AlignmentProducerBase.cc
Expand Up @@ -167,16 +167,17 @@ AlignmentProducerBase::processEvent(const edm::Event& event,

initBeamSpot(event); // must happen every event and before incrementing 'nevent_'

++nevent_; // must happen before the check below;
// otherwise subsequent checks fail for "EmptySource"

if (!alignmentAlgo_->processesEvents()) {
edm::LogWarning("BadConfig")
edm::LogInfo("Alignment")
<< "@SUB=AlignmentProducerBase::processEvent"
<< "Skipping event. The current configuration of the alignment algorithm "
<< "does not need to process any events.";
return false;
}

++nevent_;

// reading in survey records
readInSurveyRcds(setup);

Expand Down Expand Up @@ -904,11 +905,6 @@ AlignmentProducerBase::addSurveyInfo(Alignable* ali)
bool
AlignmentProducerBase::finish()
{
if (isDuringLoop_) {
throw cms::Exception("LogicError")
<< "@SUB=AlignmentProducerBase::finish\n"
<< "Trying to finish before terminating event processing.";
}

for (const auto& monitor: monitors_) monitor->endOfJob();

Expand Down
Expand Up @@ -344,7 +344,7 @@ bool MillePedeAlignmentAlgorithm::processesEvents()
//_____________________________________________________________________________
bool MillePedeAlignmentAlgorithm::storeAlignments()
{
if (isMode(myPedeRunBit)) {
if (isMode(myPedeReadBit)) {
if (runAtPCL_) {

MillePedeFileReader mpReader(theConfig.getParameter<edm::ParameterSet>("MillePedeFileReader"),
Expand Down
4 changes: 3 additions & 1 deletion Alignment/TrackerAlignment/test/BuildFile.xml
Expand Up @@ -24,4 +24,6 @@
<!-- for PTrackerParametersRcd registration -->
<use name="CondFormats/GeometryObjects"/>
<flags EDM_PLUGIN="1"/>
</library>
</library>

<test name="test_PixelBaryCentreTool" command="pixelPositions.sh /tmp/PixelBaryCentreTool"/>
Expand Up @@ -60,8 +60,8 @@

process.AlignmentProducer.ParameterBuilder.Selector = cms.PSet(
alignParams = cms.vstring(
'TrackerTPBModule,111111',
'TrackerTPEModule,111111',
"PixelHalfBarrelDets,111111",
"PXECDets,111111",
# 'TrackerTIBModuleUnit,101111',
# 'TrackerTIDModuleUnit,101111',
'TrackerTOBModuleUnit,101111',
Expand Down
70 changes: 59 additions & 11 deletions Alignment/TrackerAlignment/test/pixelPositions.sh
Expand Up @@ -13,42 +13,66 @@
#PLOTMILLEPEDEDIR=
CONFIG_TEMPLATE="$CMSSW_BASE/src/Alignment/TrackerAlignment/test/alignment_forGeomComp_cfg_TEMPLATE.py"
PLOTMILLEPEDEDIR="$CMSSW_BASE/src/Alignment/MillePedeAlignmentAlgorithm/macros/"
if [[ ! -d ${CONFIG_TEMPLATE} ]]
then
CONFIG_TEMPLATE="${CMSSW_RELEASE_BASE}/src/Alignment/TrackerAlignment/test/alignment_forGeomComp_cfg_TEMPLATE.py"
fi
if [[ ! -d ${PLOTMILLEPEDEDIR} ]]
then
PLOTMILLEPEDEDIR="${CMSSW_RELEASE_BASE}/src/Alignment/MillePedeAlignmentAlgorithm/macros/"
fi

if [[ ${#} -gt 0 ]]
then
EXECUTION_DIR="${1}/"
else
EXECUTION_DIR="$(pwd)/"
fi

echo Using template $CONFIG_TEMPLATE
echo and plotting macros from $PLOTMILLEPEDEDIR
echo "Running in ${EXECUTION_DIR}"
echo

RUN_NUMBERS=(273000)
RUN_NUMBERS=(272011 273000)

# First conditions to check
# (if ALIGNMENT_TAG1 and DB_PATH_TAG1 are empty takes content from GLOBALTAG1)
# also symbolic Global Tags are allowed
GLOBALTAG1="auto:run2_data"
#GLOBALTAG1="80X_dataRun2_Prompt_v8"
# GLOBALTAG1="90X_dataRun2_Express_v4"
ALIGNMENT_TAG1="TrackerAlignment_2009_v1_express"
DB_PATH_TAG1="frontier://FrontierProd/CMS_CONDITIONS"

# Second conditions to check
# also symbolic Global Tags are allowed
GLOBALTAG2="auto:run2_data"
#GLOBALTAG2="80X_dataRun2_Prompt_v8"
# GLOBALTAG2="90X_dataRun2_Express_v4"
ALIGNMENT_TAG2="SiPixelAli_PCL_v0_prompt"
# ALIGNMENT_TAG2="SiPixelAli_PCL_v0_p"
DB_PATH_TAG2="frontier://FrontierPrep/CMS_CONDITIONS"

if [[ ! -d ${EXECUTION_DIR} ]]
then
mkdir ${EXECUTION_DIR}
fi
cd ${EXECUTION_DIR}

for RUN in $RUN_NUMBERS ; do
echo "============================================================"
echo " Run $RUN: $GLOBALTAG1 / $ALIGNMENT_TAG1 (=1) vs $GLOBALTAG2 / $ALIGNMENT_TAG2 (=2)"
echo "============================================================"
CONFIG1=alignment_forGeomComp_${GLOBALTAG1}_${ALIGNMENT_TAG1}_r$RUN.py
TREEFILE1=treeFile_${GLOBALTAG1}_${ALIGNMENT_TAG1}_r${RUN}.root
CONFIG1=alignment_forGeomComp_${GLOBALTAG1}_${ALIGNMENT_TAG1}_r${RUN}_1.py
TREEFILE1=treeFile_${GLOBALTAG1}_${ALIGNMENT_TAG1}_r${RUN}_1.root
TREEFILE1=`echo ${TREEFILE1//"auto:"/"auto_"}`
LOGFILE1=alignment_${GLOBALTAG1}_${ALIGNMENT_TAG1}r${RUN}
LOGFILE1=alignment_${GLOBALTAG1}_${ALIGNMENT_TAG1}r${RUN}_1
LOGFILE1=`echo ${LOGFILE1//"auto:"/"auto_"}`
#echo $TREEFILE1 $LOGFILE1

CONFIG2=alignment_forGeomComp_${GLOBALTAG2}_${ALIGNMENT_TAG2}_r$RUN.py
TREEFILE2=treeFile_${GLOBALTAG2}_${ALIGNMENT_TAG2}_r${RUN}.root
CONFIG2=alignment_forGeomComp_${GLOBALTAG2}_${ALIGNMENT_TAG2}_r${RUN}_2.py
TREEFILE2=treeFile_${GLOBALTAG2}_${ALIGNMENT_TAG2}_r${RUN}_2.root
TREEFILE2=`echo ${TREEFILE2//"auto:"/"auto_"}`
LOGFILE2=alignment_${GLOBALTAG2}_${ALIGNMENT_TAG2}r${RUN}
LOGFILE2=alignment_${GLOBALTAG2}_${ALIGNMENT_TAG2}r${RUN}_2
LOGFILE2=`echo ${LOGFILE2//"auto:"/"auto_"}`
#echo $TREEFILE2 $LOGFILE2

Expand Down Expand Up @@ -80,10 +104,16 @@ EOF

rm ${CONFIG1}_tmp*
cmsRun $CONFIG1
return_code=${?}
if [[ ${return_code} -ne 0 ]]
then
echo "The command 'cmsRun ${CONFIG1}' failed. Please check the log file."
exit ${return_code}
fi
rm remove_me.db

if [ -e $TREEFILE2 ] ; then
echo "Removing old file " $TREEFILE2
echo "Removing old file" $TREEFILE2
rm $TREEFILE2
fi
sed -e "s/RUNNUMBER/${RUN}/g" $CONFIG_TEMPLATE > ${CONFIG2}_tmp
Expand All @@ -110,10 +140,28 @@ EOF

rm ${CONFIG2}_tmp*
cmsRun $CONFIG2
return_code=${?}
if [[ ${return_code} -ne 0 ]]
then
echo "The command 'cmsRun ${CONFIG2}' failed. Please check the log file."
exit ${return_code}
fi
rm remove_me.db

HEREIAM=$(pwd)
cd $PLOTMILLEPEDEDIR
PLOTDIR=${HEREIAM}/PixelBaryCentrePlottingTools
if [[ ! -d ${PLOTDIR} ]]
then
mkdir ${PLOTDIR}
cp -r $PLOTMILLEPEDEDIR/* ${PLOTDIR}
fi
cd ${PLOTDIR}
root -b -q -l allMillePede.C "pixelPositionChange.C+(\"${HEREIAM}/$TREEFILE1\", \"${HEREIAM}/$TREEFILE2\")"
return_code=${?}
if [[ ${return_code} -ne 0 ]]
then
echo "Running 'allMillePede.C' failed."
exit ${return_code}
fi
cd $HEREIAM
done