Skip to content

Commit

Permalink
Merge pull request #24 from cms-sw/CMSSW_7_4_X
Browse files Browse the repository at this point in the history
Synchronize CMSSW_7_4_X
  • Loading branch information
venturia committed Dec 11, 2014
2 parents 9bfb7a4 + 4561f56 commit c0bc58d
Show file tree
Hide file tree
Showing 2,343 changed files with 218,508 additions and 196,140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class Trajectory;
#include "Alignment/LaserAlignment/interface/TsosVectorCollection.h"
#include "DataFormats/Alignment/interface/TkFittedLasBeamCollectionFwd.h"
#include "DataFormats/Alignment/interface/AliClusterValueMapFwd.h"
#include "FWCore/Framework/interface/Event.h"

namespace edm { class EventID; class RunID; class EventSetup; class ParameterSet; }
namespace edm { class EventSetup; class ParameterSet; }
namespace reco { class Track; class BeamSpot; }

class AlignmentAlgorithmBase
Expand All @@ -42,25 +43,41 @@ class AlignmentAlgorithmBase
typedef std::pair<RunNumber,RunNumber> RunRange;

/// define event information passed to algorithms
struct EventInfo {
EventInfo(const edm::EventID &eventId,
const ConstTrajTrackPairCollection &trajTrackPairs,
const reco::BeamSpot &beamSpot,
const AliClusterValueMap *clusterValueMap)
: eventId_(eventId), trajTrackPairs_(trajTrackPairs), beamSpot_(beamSpot), clusterValueMap_(clusterValueMap) {}

const edm::EventID &eventId_;
class EventInfo {
public:
EventInfo(const edm::EventID &theEventId,
const ConstTrajTrackPairCollection &theTrajTrackPairs,
const reco::BeamSpot &theBeamSpot,
const AliClusterValueMap *theClusterValueMap)
: eventId_(theEventId), trajTrackPairs_(theTrajTrackPairs), beamSpot_(theBeamSpot), clusterValueMap_(theClusterValueMap) {}

const edm::EventID eventId() const { return eventId_; }
const ConstTrajTrackPairCollection& trajTrackPairs() const { return trajTrackPairs_; }
const reco::BeamSpot& beamSpot() const { return beamSpot_; }
const AliClusterValueMap* clusterValueMap() const { return clusterValueMap_; }///might be null!


private:
const edm::EventID eventId_;
const ConstTrajTrackPairCollection &trajTrackPairs_;
const reco::BeamSpot &beamSpot_;
const AliClusterValueMap *clusterValueMap_;///might be null!
};

/// define run information passed to algorithms (in endRun)
struct EndRunInfo {
EndRunInfo(const edm::RunID &runId, const TkFittedLasBeamCollection *tkLasBeams,
const TsosVectorCollection *tkLasBeamTsoses)
: runId_(runId), tkLasBeams_(tkLasBeams), tkLasBeamTsoses_(tkLasBeamTsoses) {}
const edm::RunID &runId_;
class EndRunInfo {
public:
EndRunInfo(const edm::RunID &theRunId, const TkFittedLasBeamCollection *theTkLasBeams,
const TsosVectorCollection *theTkLasBeamTsoses)
: runId_(theRunId), tkLasBeams_(theTkLasBeams), tkLasBeamTsoses_(theTkLasBeamTsoses) {}

const edm::RunID runId() const { return runId_; }
const TkFittedLasBeamCollection* tkLasBeams() const { return tkLasBeams_; } /// might be null!
const TsosVectorCollection* tkLasBeamTsoses() const { return tkLasBeamTsoses_; } /// might be null!


private:
const edm::RunID runId_;
const TkFittedLasBeamCollection *tkLasBeams_; /// might be null!
const TsosVectorCollection *tkLasBeamTsoses_; /// might be null!
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,15 @@ class AlignmentParameterStore
AlignmentCorrelationsStore* theCorrelationsStore;

private:
enum TypeOfConstraints { NONE, HIERARCHY_CONSTRAINTS, APPROX_AVERAGING_CONSTRAINTS };

// data members

/// alignables
align::Alignables theAlignables;

/// type of constraints
TypeOfConstraints theTypeOfConstraints;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ SiPixelLorentzAngleCalibration::derivatives(std::vector<ValuesIndexPair> &outDer
if (hit.det()) { // otherwise 'constraint hit' or whatever

const int index = moduleGroupSelector_->getParameterIndexFromDetId(hit.det()->geographicalId(),
eventInfo.eventId_.run());
eventInfo.eventId().run());
if (index >= 0) { // otherwise not treated
edm::ESHandle<MagneticField> magneticField;
setup.get<IdealMagneticFieldRecord>().get(magneticField);
Expand Down Expand Up @@ -360,7 +360,7 @@ bool SiPixelLorentzAngleCalibration::checkLorentzAngleInput(const edm::EventSetu
// 'floating point comparison' problems (FIXME?)
throw cms::Exception("BadInput")
<< "SiPixelLorentzAngleCalibration::checkLorentzAngleInput:\n"
<< "Content of SiPixelLorentzAngle changed at run " << eventInfo.eventId_.run()
<< "Content of SiPixelLorentzAngle changed at run " << eventInfo.eventId().run()
<< ", but algorithm expects constant input!\n";
return false; // not reached...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ SiStripBackplaneCalibration::derivatives(std::vector<ValuesIndexPair> &outDerivI
if (hit.det()) { // otherwise 'constraint hit' or whatever

const int index = moduleGroupSelector_->getParameterIndexFromDetId(hit.det()->geographicalId(),
eventInfo.eventId_.run());
eventInfo.eventId().run());
if (index >= 0) { // otherwise not treated
edm::ESHandle<MagneticField> magneticField;
setup.get<IdealMagneticFieldRecord>().get(magneticField);
Expand Down Expand Up @@ -432,7 +432,7 @@ bool SiStripBackplaneCalibration::checkBackPlaneCorrectionInput(const edm::Event
// 'floating point comparison' problems (FIXME?)
throw cms::Exception("BadInput")
<< "SiStripBackplaneCalibration::checkBackPlaneCorrectionInput:\n"
<< "Content of SiStripBackPlaneCorrection changed at run " << eventInfo.eventId_.run()
<< "Content of SiStripBackPlaneCorrection changed at run " << eventInfo.eventId().run()
<< ", but algorithm expects constant input!\n";
return false; // not reached...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ SiStripLorentzAngleCalibration::derivatives(std::vector<ValuesIndexPair> &outDer
if (hit.det()) { // otherwise 'constraint hit' or whatever

const int index = moduleGroupSelector_->getParameterIndexFromDetId(hit.det()->geographicalId(),
eventInfo.eventId_.run());
eventInfo.eventId().run());
if (index >= 0) { // otherwise not treated
edm::ESHandle<MagneticField> magneticField;
setup.get<IdealMagneticFieldRecord>().get(magneticField);
Expand Down Expand Up @@ -398,7 +398,7 @@ bool SiStripLorentzAngleCalibration::checkLorentzAngleInput(const edm::EventSetu
// 'floating point comparison' problems (FIXME?)
throw cms::Exception("BadInput")
<< "SiStripLorentzAngleCalibration::checkLorentzAngleInput:\n"
<< "Content of SiStripLorentzAngle changed at run " << eventInfo.eventId_.run()
<< "Content of SiStripLorentzAngle changed at run " << eventInfo.eventId().run()
<< ", but algorithm expects constant input!\n";
return false; // not reached...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
Weight = cms.double(0.5),
MaxUpdates = cms.int32(5000)
),
UseExtendedCorrelations = cms.untracked.bool(False)
UseExtendedCorrelations = cms.untracked.bool(False),
TypeOfConstraints = cms.string('approximate_averaging'),
)
)

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ AlignmentParameterStore::AlignmentParameterStore( const align::Alignables &alis,

edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore"
<< "Created with " << theAlignables.size() << " alignables.";

// set hierarchy vs averaging constraints
theTypeOfConstraints = NONE;
const std::string cfgStrTypeOfConstraints(config.getParameter<std::string>("TypeOfConstraints"));
if( cfgStrTypeOfConstraints == "hierarchy" ) {
theTypeOfConstraints = HIERARCHY_CONSTRAINTS;
edm::LogWarning("Alignment") << "@SUB=AlignmentParameterStore"
<< "\n\n\n******* WARNING ******************************************\n"
<< "Using hierarchy constraints that have a not-understood bug.\n"
<< "It is strongly recommended to use averaging constraints for\n"
<< "the time being!\n\n\n";

} else if( cfgStrTypeOfConstraints == "approximate_averaging" ) {
theTypeOfConstraints = APPROX_AVERAGING_CONSTRAINTS;
edm::LogWarning("Alignment") << "@SUB=AlignmentParameterStore"
<< "Using approximate implementation of averaging constraints";
} else {
edm::LogError("BadArgument") << "@SUB=AlignmentParameterStore"
<< "Unknown type of hierarchy constraints '" << cfgStrTypeOfConstraints << "'";
}
}

//__________________________________________________________________________________________________
Expand Down Expand Up @@ -682,7 +702,15 @@ ::hierarchyConstraints(const Alignable *ali, const align::Alignables &aliComps,
}
for (unsigned int iParComp = 0; iParComp < aliCompSel.size(); ++iParComp) {
if (aliCompSel[iParComp]) {
const double factor = p2pDerivs(iParMast, iParComp);
double factor = 0.;
if( theTypeOfConstraints == HIERARCHY_CONSTRAINTS ) {
// hierachy constraints
factor = p2pDerivs(iParMast, iParComp);
} else if( theTypeOfConstraints == APPROX_AVERAGING_CONSTRAINTS ) {
// CHK poor mans averaging constraints
factor = p2pDerivs(iParMast, iParComp);
if (iParMast < 3 && (iParComp % 9) >= 3) factor = 0.;
}
if (fabs(factor) > epsilon) {
paramIdsVecOut[iParMastUsed].push_back(ParameterId(*iComp, iParComp));
factorsVecOut[iParMastUsed].push_back(factor);
Expand Down
10 changes: 5 additions & 5 deletions Alignment/HIPAlignmentAlgorithm/src/HIPAlignmentAlgorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ void HIPAlignmentAlgorithm::run(const edm::EventSetup& setup, const EventInfo &e
theFile->cd();

// loop over tracks
const ConstTrajTrackPairCollection &tracks = eventInfo.trajTrackPairs_;
const ConstTrajTrackPairCollection &tracks = eventInfo.trajTrackPairs();
for (ConstTrajTrackPairCollection::const_iterator it=tracks.begin();
it!=tracks.end();
++it) {
Expand Down Expand Up @@ -778,7 +778,7 @@ void HIPAlignmentAlgorithm::run(const edm::EventSetup& setup, const EventInfo &e

//////////Hit prescaling part
bool skiphit = false;
if (eventInfo.clusterValueMap_) {
if (eventInfo.clusterValueMap()) {
// check from the PrescalingMap if the hit was taken.
// If not skip to the next TM
// bool hitTaken=false;
Expand All @@ -796,7 +796,7 @@ void HIPAlignmentAlgorithm::run(const edm::EventSetup& setup, const EventInfo &e
if (stripHit1D) {
SiStripRecHit1D::ClusterRef stripclust(stripHit1D->cluster());
// myflag=PrescMap[stripclust];
myflag = (*eventInfo.clusterValueMap_)[stripclust];
myflag = (*eventInfo.clusterValueMap())[stripclust];
} else {
edm::LogError("HIPAlignmentAlgorithm")
<< "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Strip RecHit failed! "
Expand All @@ -810,7 +810,7 @@ void HIPAlignmentAlgorithm::run(const edm::EventSetup& setup, const EventInfo &e
if (stripHit2D) {
SiStripRecHit2D::ClusterRef stripclust(stripHit2D->cluster());
// myflag=PrescMap[stripclust];
myflag = (*eventInfo.clusterValueMap_)[stripclust];
myflag = (*eventInfo.clusterValueMap())[stripclust];
} else {
edm::LogError("HIPAlignmentAlgorithm")
<< "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Strip RecHit failed! "
Expand All @@ -824,7 +824,7 @@ void HIPAlignmentAlgorithm::run(const edm::EventSetup& setup, const EventInfo &e
if (pixelhit) {
SiPixelClusterRefNew pixelclust(pixelhit->cluster());
// myflag=PrescMap[pixelclust];
myflag = (*eventInfo.clusterValueMap_)[pixelclust];
myflag = (*eventInfo.clusterValueMap())[pixelclust];
}
else {
edm::LogError("HIPAlignmentAlgorithm")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ void KalmanAlignmentAlgorithm::run( const edm::EventSetup & setup, const EventIn
try
{
// Run the refitter algorithm
const ConstTrajTrackPairCollection &tracks = eventInfo.trajTrackPairs_;
const reco::BeamSpot &beamSpot = eventInfo.beamSpot_;
const ConstTrajTrackPairCollection &tracks = eventInfo.trajTrackPairs();
const reco::BeamSpot &beamSpot = eventInfo.beamSpot();
TrackletCollection refittedTracklets = theRefitter->refitTracks( setup, theAlignmentSetups, tracks, &beamSpot );

// Associate tracklets to alignment setups
Expand All @@ -186,7 +186,7 @@ void KalmanAlignmentAlgorithm::run( const edm::EventSetup & setup, const EventIn

// Construct reference trajectories
ReferenceTrajectoryCollection trajectories =
itMap->first->trajectoryFactory()->trajectories( setup, tracklets, external, eventInfo.beamSpot_ );
itMap->first->trajectoryFactory()->trajectories( setup, tracklets, external, eventInfo.beamSpot() );

ReferenceTrajectoryCollection::iterator itTrajectories;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase
const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr,
unsigned int iHit, AlignmentParameters *&params);

/// Add global data (labels, derivatives) to GBL trajectory
/// Returns -1 if any problem (for params cf. globalDerivativesHierarchy)
int addGlobalData(const edm::EventSetup &setup, const EventInfo &eventInfo,
const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr,
unsigned int iHit, GblPoint &gblPoint);

/// Increase hit counting of MillePedeVariables behind each parVec[i]
/// (and also for parameters higher in hierarchy),
/// assuming 'parVec' and 'validHitVecY' to be parallel.
Expand Down Expand Up @@ -130,13 +136,22 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase
std::vector<int> &globalLabels,
AlignmentParameters *&lowestParams) const;

/// recursively adding derivatives (double) and labels, false if problems
bool globalDerivativesHierarchy(const EventInfo &eventInfo,
const TrajectoryStateOnSurface &tsos,
Alignable *ali, const AlignableDetOrUnitPtr &alidet,
std::vector<double> &globalDerivativesX,
std::vector<double> &globalDerivativesY,
std::vector<int> &globalLabels,
AlignmentParameters *&lowestParams) const;

/// adding derivatives from integrated calibrations
void globalDerivativesCalibration(const TransientTrackingRecHit::ConstRecHitPointer &recHit,
const TrajectoryStateOnSurface &tsos,
const edm::EventSetup &setup, const EventInfo &eventInfo,
std::vector<float> &globalDerivativesX,
std::vector<float> &globalDerivativesY,
std::vector<int> &globalLabels) const;
const TrajectoryStateOnSurface &tsos,
const edm::EventSetup &setup, const EventInfo &eventInfo,
std::vector<float> &globalDerivativesX,
std::vector<float> &globalDerivativesY,
std::vector<int> &globalLabels) const;

/// calls callMille1D or callMille2D
int callMille(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr,
Expand Down Expand Up @@ -219,6 +234,9 @@ class MillePedeAlignmentAlgorithm : public AlignmentAlgorithmBase
std::vector<float> theFloatBufferY;
std::vector<int> theIntBuffer;
bool theDoSurveyPixelBarrel;
// CHK for GBL
MilleBinary *theBinary;
bool theGblDoubleBinary;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
Presigmas = cms.VPSet(),
minHieraConstrCoeff = cms.double(1.e-7), # min abs value of coeff. in hierarchy constr.
minHieraParPerConstr = cms.uint32(2), # ignore hierarchy constraints with less params
constrPrecision = cms.uint32(0), # use default precision for writing constraints to text file

# specify additional steering files
additionalSteerFiles = cms.vstring(), # obsolete - can be given as entries in 'options'
Expand All @@ -84,6 +85,7 @@
# TwoBodyDecayReferenceTrajectoryFactory, # for this overwrite MaterialEffects for BL
minNumHits = cms.uint32(7), ## minimum number of hits (with alignable parameters)
max2Dcorrelation = cms.double(0.05), ## if correlation >5% 2D measurements in TID/TEC get diagonalized
doubleBinary = cms.bool(False), ## create binary files with doubles instead of floats (GBL only)

# Parameters for PXB survey steering
surveyPixelBarrel = cms.PSet(
Expand Down
Loading

0 comments on commit c0bc58d

Please sign in to comment.