Skip to content

Commit

Permalink
Merge pull request #25616 from CTPPS/pps_rpalign_db_10_4_X
Browse files Browse the repository at this point in the history
PPS Alignment corrections object for condDB
  • Loading branch information
cmsbuild authored Feb 7, 2019
2 parents 87494bc + d640742 commit 8354321
Show file tree
Hide file tree
Showing 71 changed files with 2,566 additions and 1,207 deletions.
1 change: 1 addition & 0 deletions CondCore/CTPPSPlugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<use name="CondCore/ESSources"/>
<use name="CondFormats/CTPPSReadoutObjects"/>
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/AlignmentRecord"/>
<use name="CondFormats/Serialization"/>
<use name="root"/>
<use name="boost"/>
Expand Down
7 changes: 7 additions & 0 deletions CondCore/CTPPSPlugins/src/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
#include "CondFormats/DataRecord/interface/CTPPSPixelAnalysisMaskRcd.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelGainCalibrations.h"
#include "CondFormats/DataRecord/interface/CTPPSPixelGainCalibrationsRcd.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsData.h"
#include "CondFormats/AlignmentRecord/interface/CTPPSRPAlignmentCorrectionsDataRcd.h"
#include "CondFormats/AlignmentRecord/interface/RPRealAlignmentRecord.h"
#include "CondFormats/AlignmentRecord/interface/RPMisalignedAlignmentRecord.h"
#include "CondFormats/CTPPSReadoutObjects/interface/PPSTimingCalibration.h"
#include "CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h"

REGISTER_PLUGIN(CTPPSPixelDAQMappingRcd,CTPPSPixelDAQMapping);
REGISTER_PLUGIN(CTPPSPixelAnalysisMaskRcd,CTPPSPixelAnalysisMask);
REGISTER_PLUGIN(CTPPSPixelGainCalibrationsRcd,CTPPSPixelGainCalibrations);
REGISTER_PLUGIN(CTPPSRPAlignmentCorrectionsDataRcd,CTPPSRPAlignmentCorrectionsData);
REGISTER_PLUGIN(RPRealAlignmentRecord,CTPPSRPAlignmentCorrectionsData);
REGISTER_PLUGIN(RPMisalignedAlignmentRecord,CTPPSRPAlignmentCorrectionsData);
REGISTER_PLUGIN(PPSTimingCalibrationRcd,PPSTimingCalibration);

1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBFetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace cond {
FETCH_PAYLOAD_CASE( CTPPSPixelDAQMapping )
FETCH_PAYLOAD_CASE( CTPPSPixelAnalysisMask )
FETCH_PAYLOAD_CASE( CTPPSPixelGainCalibrations )
FETCH_PAYLOAD_CASE( CTPPSRPAlignmentCorrectionsData )
FETCH_PAYLOAD_CASE( CastorChannelQuality )
FETCH_PAYLOAD_CASE( CastorElectronicsMap )
FETCH_PAYLOAD_CASE( CastorGainWidths )
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBImport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace cond {
IMPORT_PAYLOAD_CASE( CTPPSPixelDAQMapping )
IMPORT_PAYLOAD_CASE( CTPPSPixelAnalysisMask )
IMPORT_PAYLOAD_CASE( CTPPSPixelGainCalibrations )
IMPORT_PAYLOAD_CASE( CTPPSRPAlignmentCorrectionsData )
IMPORT_PAYLOAD_CASE( CastorChannelQuality )
IMPORT_PAYLOAD_CASE( CastorElectronicsMap )
IMPORT_PAYLOAD_CASE( CastorGainWidths )
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelDAQMapping.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelAnalysisMask.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelGainCalibrations.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsData.h"
#include "CondFormats/CTPPSReadoutObjects/interface/PPSTimingCalibration.h"
#include "CondFormats/DTObjects/interface/DTCCBConfig.h"
#include "CondFormats/DTObjects/interface/DTDeadFlag.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef CTPPSRPAlignmentCorrectionsDataRcd_CTPPSRPAlignmentCorrectionsDataRcd_h
#define CTPPSRPAlignmentCorrectionsDataRcd_CTPPSRPAlignmentCorrectionsDataRcd_h
// -*- C++ -*-
//
// Package: CondFormats/DataAlignmentRecord
// Class : CTPPSRPAlignmentCorrectionsDataRcd
//
/**\class CTPPSRPAlignmentCorrectionsDataRcd CTPPSRPAlignmentCorrectionsDataRcd.h CondFormats/AlignmentRecord/interface/CTPPSRPAlignmentCorrectionsDataRcd.h
Description: [one line class summary]
Usage:
<usage>
*/
//
// Author: Helena Brandao Malbouisson
// Created: Thu, 05 Apr 2018 17:34:31 GMT
//

#include "FWCore/Framework/interface/EventSetupRecordImplementation.h"

class CTPPSRPAlignmentCorrectionsDataRcd : public edm::eventsetup::EventSetupRecordImplementation<CTPPSRPAlignmentCorrectionsDataRcd> {};

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// -*- C++ -*-
//
// Package: CondFormats/AlignmentRecord
// Class : CTPPSRPAlignmentCorrectionsDataRcd
//
// Implementation:
// [Notes on implementation]
//
// Author: Helena Brandao Malbouisson
// Created: Thu, 05 Apr 2018 17:34:31 GMT

#include "CondFormats/AlignmentRecord/interface/CTPPSRPAlignmentCorrectionsDataRcd.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"

EVENTSETUP_RECORD_REG(CTPPSRPAlignmentCorrectionsDataRcd);
1 change: 1 addition & 0 deletions CondFormats/CTPPSReadoutObjects/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/Concurrency"/>
<use name="DataFormats/CTPPSDetId"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/****************************************************************************
*
* This is a part of TOTEM offline software.
* This is a part of CMS-TOTEM PPS offline software.
* Authors:
* Jan Kašpar ([email protected])
* Jan Kašpar ([email protected])
* Helena Malbouisson
* Clemencia Mora Herrera
*
****************************************************************************/

#ifndef DataFormats_CTPPSAlignment_RPAlignmentCorrectionData
#define DataFormats_CTPPSAlignment_RPAlignmentCorrectionData
#ifndef CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionData
#define CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionData

#include "CondFormats/Serialization/interface/Serializable.h"

#include "DataFormats/Math/interface/Vector3D.h"
#include <Math/Rotation3D.h>
Expand Down Expand Up @@ -52,7 +56,7 @@
| 0 sin r_x cos r_x | |-sin r_y 0 cos r_y | | 0 0 1 |
\endverbatim
**/
class RPAlignmentCorrectionData
class CTPPSRPAlignmentCorrectionData
{
protected:
/// shift in mm; in global XYZ frame, which is not affected by (alignment) rotations!
Expand All @@ -67,11 +71,11 @@ class RPAlignmentCorrectionData

public:
/// full constructor, shifts in mm, rotations in rad
RPAlignmentCorrectionData(double _sh_x, double _sh_x_u, double _sh_y, double _sh_y_u, double _sh_z, double _sh_z_u,
CTPPSRPAlignmentCorrectionData(double _sh_x, double _sh_x_u, double _sh_y, double _sh_y_u, double _sh_z, double _sh_z_u,
double _rot_x, double _rot_x_u, double _rot_y, double _rot_y_u, double _rot_z, double _rot_z_u);

/// no uncertainty constructor, shifts in mm, rotation in rad
RPAlignmentCorrectionData(double _sh_x = 0., double _sh_y = 0., double _sh_z = 0.,
CTPPSRPAlignmentCorrectionData(double _sh_x = 0., double _sh_y = 0., double _sh_z = 0.,
double _rot_x = 0., double _rot_y = 0., double rot_z = 0.);


Expand Down Expand Up @@ -133,9 +137,11 @@ class RPAlignmentCorrectionData
/// \param sumErrors if it is true, old and new alignment uncertainties are summed (in quadrature)
/// if it is false, the uncertainties of the parameter (i.e. not the object) will be used
/// With the add... switches one can control which corrections are added.
void add(const RPAlignmentCorrectionData&, bool sumErrors=true, bool addSh=true, bool addRot=true);
void add(const CTPPSRPAlignmentCorrectionData&, bool sumErrors=true, bool addSh=true, bool addRot=true);

COND_SERIALIZABLE;
};

std::ostream& operator<<(std::ostream& s, const RPAlignmentCorrectionData &corr);
std::ostream& operator<<(std::ostream& s, const CTPPSRPAlignmentCorrectionData &corr);

#endif
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/****************************************************************************
*
* This is a part of TOTEM offline software.
* This is a part of CMS-TOTEM PPS offline software.
* Authors:
* Jan Kašpar ([email protected])
* Jan Kašpar ([email protected])
* Helena Malbouisson
* Clemencia Mora Herrera
*
****************************************************************************/

#ifndef DataFormats_CTPPSAlignment_RPAlignmentCorrectionsData
#define DataFormats_CTPPSAlignment_RPAlignmentCorrectionsData
#ifndef CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionsData
#define CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionsData

#include "DataFormats/CTPPSAlignment/interface/RPAlignmentCorrectionData.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionData.h"

#include <map>

Expand All @@ -20,11 +22,11 @@
* alignment corrections from the corresponding RP, see getFullSensorCorrection
* method.
**/
class RPAlignmentCorrectionsData
class CTPPSRPAlignmentCorrectionsData
{
public:
/// map: element id -> its alignment correction
typedef std::map<unsigned int, RPAlignmentCorrectionData> mapType;
typedef std::map<unsigned int, CTPPSRPAlignmentCorrectionData> mapType;

private:
/// alignment correction maps
Expand All @@ -33,7 +35,7 @@ class RPAlignmentCorrectionsData
friend class StraightTrackAlignment;

public:
RPAlignmentCorrectionsData() {}
CTPPSRPAlignmentCorrectionsData() {}

/// returns the map of RP alignment corrections
const mapType& getRPMap() const { return rps_; }
Expand All @@ -42,40 +44,42 @@ class RPAlignmentCorrectionsData
const mapType& getSensorMap() const { return sensors_; }

/// returns the correction value from the RP map
RPAlignmentCorrectionData& getRPCorrection( unsigned int id );
RPAlignmentCorrectionData getRPCorrection( unsigned int id ) const;
CTPPSRPAlignmentCorrectionData& getRPCorrection( unsigned int id );
CTPPSRPAlignmentCorrectionData getRPCorrection( unsigned int id ) const;

/// returns the correction value from the sensor map
RPAlignmentCorrectionData& getSensorCorrection( unsigned int id );
RPAlignmentCorrectionData getSensorCorrection( unsigned int id ) const;
CTPPSRPAlignmentCorrectionData& getSensorCorrection( unsigned int id );
CTPPSRPAlignmentCorrectionData getSensorCorrection( unsigned int id ) const;

/// returns the correction for the given sensor, combining the data from RP and sensor map
/// regarding transverse shifts, uses the x and y representation, sh_r will not be corrected!
/// by default, RP errors shall not be summed up (strong correlation).
RPAlignmentCorrectionData getFullSensorCorrection( unsigned int id, bool useRPErrors = false ) const;
CTPPSRPAlignmentCorrectionData getFullSensorCorrection( unsigned int id, bool useRPErrors = false ) const;

/// sets the alignment correction for the given RP
void setRPCorrection( unsigned int id, const RPAlignmentCorrectionData& ac );
void setRPCorrection( unsigned int id, const CTPPSRPAlignmentCorrectionData& ac );

/// sets the alignment correction for the given sensor
void setSensorCorrection( unsigned int id, const RPAlignmentCorrectionData& ac );
void setSensorCorrection( unsigned int id, const CTPPSRPAlignmentCorrectionData& ac );

/// adds (merges) a RP correction on top of the current value
/// \param sumErrors if it is true, old and new alignment uncertainties are summed (in quadrature)
/// if it is false, the uncertainties of the parameter (i.e. not the object) will be used
/// With the add... switches one can control which corrections are added.
void addRPCorrection( unsigned int, const RPAlignmentCorrectionData&, bool sumErrors=true, bool addSh=true, bool addRot=true );
void addRPCorrection( unsigned int, const CTPPSRPAlignmentCorrectionData&, bool sumErrors=true, bool addSh=true, bool addRot=true );

/// adds (merges) a RP correction on top of the current value
void addSensorCorrection( unsigned int, const RPAlignmentCorrectionData&, bool sumErrors=true, bool addSh=true, bool addRot=true );
void addSensorCorrection( unsigned int, const CTPPSRPAlignmentCorrectionData&, bool sumErrors=true, bool addSh=true, bool addRot=true );

/// adds (merges) corrections on top of the current values
void addCorrections( const RPAlignmentCorrectionsData &, bool sumErrors=true, bool addSh=true, bool addRot=true );
void addCorrections( const CTPPSRPAlignmentCorrectionsData &, bool sumErrors=true, bool addSh=true, bool addRot=true );

/// clears all alignments
void clear();

COND_SERIALIZABLE;
};

std::ostream& operator<<(std::ostream& s, const RPAlignmentCorrectionsData &corr);
std::ostream& operator<<(std::ostream& s, const CTPPSRPAlignmentCorrectionsData &corr);

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/****************************************************************************
*
* This is a part of TOTEM offline software.
* Authors:
* Jan Kašpar ([email protected])
*
****************************************************************************/

#ifndef CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionsDataSequence
#define CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionsDataSequence

#include <vector>

#include "FWCore/Framework/interface/ValidityInterval.h"

#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsData.h"

/**
*\brief Time sequence of alignment corrections.
* I/O methods have been factored out to:
* CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsMethods.h
*/
class CTPPSRPAlignmentCorrectionsDataSequence : public std::vector< std::pair<edm::ValidityInterval, CTPPSRPAlignmentCorrectionsData> >
{
public:
CTPPSRPAlignmentCorrectionsDataSequence() {}

void insert(const edm::ValidityInterval &iov, const CTPPSRPAlignmentCorrectionsData &data)
{
emplace_back(iov, data);
}
};

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/****************************************************************************
*
* This is a part of TOTEM offline software.
* Authors:
* Jan Kaspar
* Helena Malbouisson
* Clemencia Mora Herrera
*
****************************************************************************/

#ifndef CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionsMethods
#define CondFormats_CTPPSReadoutObjects_CTPPSRPAlignmentCorrectionsMethods

#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionData.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsData.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsDataSequence.h"

#include <xercesc/dom/DOM.hpp>

//----------------------------------------------------------------------------------------------------

class CTPPSRPAlignmentCorrectionsMethods
{
public:
CTPPSRPAlignmentCorrectionsMethods() {}

/// loads sequence of alignment corrections from XML file
static CTPPSRPAlignmentCorrectionsDataSequence loadFromXML( const std::string& fileName );

/// writes sequence of alignment corrections into a single XML file
static void writeToXML( const CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::string& fileName,
bool precise = false, bool wrErrors = true,
bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true );

/// writes alignment corrections into a single XML file, assigning infinite interval of validity
static void writeToXML( const CTPPSRPAlignmentCorrectionsData &ad, const std::string& fileName,
bool precise = false, bool wrErrors = true,
bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true )
{
const edm::ValidityInterval iov(edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
CTPPSRPAlignmentCorrectionsDataSequence s;
s.insert(iov, ad);
writeToXML(s, fileName, precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z);
}

static edm::IOVSyncValue stringToIOVValue(const std::string &);

static std::string iovValueToString(const edm::IOVSyncValue &);

protected:
/// load corrections data corresponding to one IOV
static CTPPSRPAlignmentCorrectionsData getCorrectionsData( xercesc::DOMNode* );

/// writes data of a correction in XML format
static void writeXML( const CTPPSRPAlignmentCorrectionData& data, FILE* f, bool precise, bool wrErrors,
bool wrSh_xy, bool wrSh_z, bool wrRot_xy, bool wrRot_z );

/// writes a block of corrections into a file
static void writeXMLBlock( const CTPPSRPAlignmentCorrectionsData&, FILE*, bool precise = false, bool wrErrors = true,
bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true );
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "CondFormats/AlignmentRecord/interface/RPRealAlignmentRecord.h"
#include "CondFormats/AlignmentRecord/interface/RPMisalignedAlignmentRecord.h"

#include "DataFormats/CTPPSAlignment/interface/RPAlignmentCorrectionsData.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsData.h"

//----------------------------------------------------------------------------------------------------

Expand All @@ -37,7 +37,7 @@ class CTPPSAlignmentInfo : public edm::one::EDAnalyzer<>

void analyze( const edm::Event&, const edm::EventSetup& ) override;

void printInfo(const RPAlignmentCorrectionsData &alignments, const edm::Event& event) const;
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event& event) const;
};

//----------------------------------------------------------------------------------------------------
Expand All @@ -57,7 +57,7 @@ CTPPSAlignmentInfo::CTPPSAlignmentInfo( const edm::ParameterSet& iConfig ) :

void CTPPSAlignmentInfo::analyze( const edm::Event& iEvent, const edm::EventSetup& iSetup )
{
edm::ESHandle<RPAlignmentCorrectionsData> alignments;
edm::ESHandle<CTPPSRPAlignmentCorrectionsData> alignments;

if ( alignmentType_ == "real" )
{
Expand All @@ -84,7 +84,7 @@ void CTPPSAlignmentInfo::analyze( const edm::Event& iEvent, const edm::EventSetu

//----------------------------------------------------------------------------------------------------

void CTPPSAlignmentInfo::printInfo(const RPAlignmentCorrectionsData &alignments, const edm::Event& event) const
void CTPPSAlignmentInfo::printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event& event) const
{
time_t unixTime = event.time().unixTime();
char timeStr[50];
Expand Down
Loading

0 comments on commit 8354321

Please sign in to comment.