Skip to content

Commit

Permalink
Merge pull request cms-sw#15 from aknayak/my76xReMiniAOD
Browse files Browse the repository at this point in the history
Updates for 76X reminiAOD
  • Loading branch information
aknayak committed Nov 25, 2015
2 parents 0cd3d70 + 7214f44 commit cd8a31b
Show file tree
Hide file tree
Showing 48 changed files with 2,789 additions and 1,343 deletions.
2 changes: 1 addition & 1 deletion Alignment/CommonAlignment/interface/Alignable.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class Alignable
/// and pointers to surface deformations
virtual int surfaceDeformationIdPairs(std::vector<std::pair<int,SurfaceDeformation*> > &) const = 0;

/// cache the current position, rotation and other parameters (e.g. surface deformations)
/// cache the current position, rotation and other parameters (e.g. surface deformations), also for possible components
virtual void cacheTransformation();

/// restore the previously cached transformation, also for possible components
Expand Down
9 changes: 9 additions & 0 deletions Alignment/CommonAlignment/src/Alignable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,18 @@ AlignmentSurfaceDeformations* Alignable::surfaceDeformations( void ) const

void Alignable::cacheTransformation()
{
// first treat itself
theCachedSurface = theSurface;
theCachedDisplacement = theDisplacement;
theCachedRotation = theRotation;

// now treat components (a clean design would move that to AlignableComposite...)
const Alignables comps(this->components());

for (auto it = comps.begin(); it != comps.end(); ++it) {
(*it)->cacheTransformation();
}

}

void Alignable::restoreCachedTransformation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TrackerSystematicMisalignments::TrackerSystematicMisalignments(const edm::Parame
{
// use existing geometry
m_fromDBGeom = cfg.getUntrackedParameter< bool > ("fromDBGeom");

// constants
m_radialEpsilon = cfg.getUntrackedParameter< double > ("radialEpsilon");
m_telescopeEpsilon = cfg.getUntrackedParameter< double > ("telescopeEpsilon");
Expand All @@ -54,34 +54,34 @@ TrackerSystematicMisalignments::TrackerSystematicMisalignments(const edm::Parame

m_ellipticalDelta = cfg.getUntrackedParameter< double > ("ellipticalDelta");
m_skewDelta = cfg.getUntrackedParameter< double > ("skewDelta");
m_sagittaDelta = cfg.getUntrackedParameter< double > ("sagittaDelta");
m_sagittaDelta = cfg.getUntrackedParameter< double > ("sagittaDelta");

if (m_radialEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying radial ...";
edm::LogWarning("MisalignedTracker") << "Applying radial ...";
}
if (m_telescopeEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying telescope ...";
edm::LogWarning("MisalignedTracker") << "Applying telescope ...";
}
if (m_layerRotEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying layer rotation ...";
edm::LogWarning("MisalignedTracker") << "Applying layer rotation ...";
}
if (m_bowingEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying bowing ...";
edm::LogWarning("MisalignedTracker") << "Applying bowing ...";
}
if (m_zExpEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying z-expansion ...";
edm::LogWarning("MisalignedTracker") << "Applying z-expansion ...";
}
if (m_twistEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying twist ...";
edm::LogWarning("MisalignedTracker") << "Applying twist ...";
}
if (m_ellipticalEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying elliptical ...";
edm::LogWarning("MisalignedTracker") << "Applying elliptical ...";
}
if (m_skewEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying skew ...";
edm::LogWarning("MisalignedTracker") << "Applying skew ...";
}
if (m_sagittaEpsilon > -990.0){
edm::LogWarning("MisalignedTracker") << "Applying sagitta ...";
edm::LogWarning("MisalignedTracker") << "Applying sagitta ...";
}

// get flag for suppression of blind movements
Expand All @@ -90,7 +90,7 @@ TrackerSystematicMisalignments::TrackerSystematicMisalignments(const edm::Parame
{
edm::LogWarning("MisalignedTracker") << "Blind movements suppressed (TIB/TOB in z, TID/TEC in r)";
}

// compatibility with old (weird) z convention
oldMinusZconvention = cfg.getUntrackedParameter< bool > ("oldMinusZconvention");
if (oldMinusZconvention)
Expand All @@ -106,62 +106,62 @@ TrackerSystematicMisalignments::TrackerSystematicMisalignments(const edm::Parame

void TrackerSystematicMisalignments::beginJob()
{

}


void TrackerSystematicMisalignments::analyze(const edm::Event& event, const edm::EventSetup& setup){

//Retrieve tracker topology from geometry
edm::ESHandle<TrackerTopology> tTopoHandle;
setup.get<TrackerTopologyRcd>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();

edm::ESHandle<GeometricDet> geom;
setup.get<IdealGeometryRecord>().get(geom);
setup.get<IdealGeometryRecord>().get(geom);
edm::ESHandle<PTrackerParameters> ptp;
setup.get<PTrackerParametersRcd>().get( ptp );
TrackerGeometry* tracker = TrackerGeomBuilderFromGeometricDet().build(&*geom, *ptp );

//take geometry from DB or randomly generate geometry
if (m_fromDBGeom){
//build the tracker
edm::ESHandle<Alignments> alignments;
edm::ESHandle<AlignmentErrorsExtended> alignmentErrors;

setup.get<TrackerAlignmentRcd>().get(alignments);
setup.get<TrackerAlignmentErrorExtendedRcd>().get(alignmentErrors);

//apply the latest alignments
GeometryAligner aligner;
aligner.applyAlignments<TrackerGeometry>( &(*tracker), &(*alignments), &(*alignmentErrors), AlignTransform() );

}

theAlignableTracker = new AlignableTracker(&(*tracker), tTopo);

applySystematicMisalignment( &(*theAlignableTracker) );

// -------------- writing out to alignment record --------------
Alignments* myAlignments = theAlignableTracker->alignments() ;
AlignmentErrorsExtended* myAlignmentErrorsExtended = theAlignableTracker->alignmentErrors() ;

// Store alignment[Error]s to DB
edm::Service<cond::service::PoolDBOutputService> poolDbService;
std::string theAlignRecordName = "TrackerAlignmentRcd";
std::string theErrorRecordName = "TrackerAlignmentErrorExtendedRcd";

// Call service
if( !poolDbService.isAvailable() ) // Die if not available
throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";

poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), theAlignRecordName);
poolDbService->writeOne<AlignmentErrorsExtended>(&(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), theErrorRecordName);
}

void TrackerSystematicMisalignments::applySystematicMisalignment(Alignable* ali)
{

const align::Alignables& comp = ali->components();
unsigned int nComp = comp.size();
//move then do for lower level object
Expand All @@ -180,32 +180,32 @@ void TrackerSystematicMisalignments::applySystematicMisalignment(Alignable* ali)
switch(subdetid)
{
// TIB/TON blind to z
case SiStripDetId::TIB:
case SiStripDetId::TOB:
blindToZ = true;
case SiStripDetId::TIB:
case SiStripDetId::TOB:
blindToZ = true;
break;
// TID/TEC blind to R
case SiStripDetId::TID:
case SiStripDetId::TEC:
blindToR = true;
case SiStripDetId::TID:
case SiStripDetId::TEC:
blindToR = true;
break;
default:
default:
break;
}
}

const int level = ali->alignableObjectId();
if ((level == 1)||(level == 2)){
const int level = ali->alignableObjectId();
if ((level == 1)||(level == 2)){
const align::PositionType gP = ali->globalPosition();
const align::GlobalVector gVec = findSystematicMis( gP, blindToZ, blindToR);
ali->move( gVec );
}
}
}

align::GlobalVector TrackerSystematicMisalignments::findSystematicMis( const align::PositionType& globalPos, const bool blindToZ, const bool blindToR ){
//align::GlobalVector TrackerSystematicMisalignments::findSystematicMis( align::PositionType globalPos ){
// calculates shift for the current alignable
// all corrections are calculated w.r.t. the original geometry
// all corrections are calculated w.r.t. the original geometry
double deltaX = 0.0;
double deltaY = 0.0;
double deltaZ = 0.0;
Expand All @@ -223,7 +223,7 @@ align::GlobalVector TrackerSystematicMisalignments::findSystematicMis( const ali
deltaZ += m_telescopeEpsilon*oldR;
}
if (m_layerRotEpsilon > -990.0){
// The following number was chosen such that the Layer Rotation systematic
// The following number was chosen such that the Layer Rotation systematic
// misalignment would not cause an overall rotation of the tracker.
const double Roffset = 57.0;
const double xP = oldR*cos(oldPhi+m_layerRotEpsilon*(oldR-Roffset));
Expand Down Expand Up @@ -261,7 +261,7 @@ align::GlobalVector TrackerSystematicMisalignments::findSystematicMis( const ali

// Compatibility with old version <= 1.5
if (oldMinusZconvention) deltaZ = -deltaZ;

align::GlobalVector gV( deltaX, deltaY, deltaZ );
return gV;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#epsilons
radialEpsilon = cms.untracked.double(-999.0), # default 5e-4 ~ 600 um
telescopeEpsilon = cms.untracked.double(-999.0), # default 5e-4 ~ 600 um
layerRotEpsilon = cms.untracked.double(-999.0), # 9.43e-6 mm^-1
bowingEpsilon = cms.untracked.double(-999.0), #6.77e-9 mm^-2
layerRotEpsilon = cms.untracked.double(-999.0), # 9.43e-6 cm^-1
bowingEpsilon = cms.untracked.double(-999.0), #6.77e-9 cm^-2
zExpEpsilon = cms.untracked.double(-999.0), # 2.02e-4
twistEpsilon = cms.untracked.double(-999.0),# 2.04e-6 mm^-1
twistEpsilon = cms.untracked.double(-999.0),# 2.04e-6 cm^-1
ellipticalEpsilon = cms.untracked.double(-999.0), # 5e-4
skewEpsilon = cms.untracked.double(-999.0), # 5.5e-2 mm
skewEpsilon = cms.untracked.double(-999.0), # 5.5e-2 cm
sagittaEpsilon = cms.untracked.double(-999.0), #5.0e-4

#misalignment phases
Expand Down
18 changes: 18 additions & 0 deletions Alignment/TrackerAlignment/test/testProduceAllMisalignments.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/bash

#to use:
#set the input geometry and IOV in testProduceSystematicMisalignment_cfg.py
#set the output file name to outputfile.db or folder/outputfile.db
# (outputfile.db is replaced by (misalignment name).db)

#set the magnitude for each one in the comment after the -999
#set the phases for the phi dependent misalignments

#then cmsenv and run this
#don't bother submitting to a queue, the whole thing takes less than 2 minutes

for a in $(grep Epsilon testProduceSystematicMisalignment_cfg.py | grep 999 | sed "s/Epsilon.*//"); do
sed -r -e "s/(${a}Epsilon.*)-999. *#/\1/" -e "s|outputfile.db|${a}.db|" testProduceSystematicMisalignment_cfg.py > ${a}_cfg.py
cmsRun ${a}_cfg.py
rm ${a}_cfg.py
done
Loading

0 comments on commit cd8a31b

Please sign in to comment.