Skip to content

Commit

Permalink
Merge pull request #43186 from francescobrivio/alca-add_SimBeamSpotHL…
Browse files Browse the repository at this point in the history
…LHCObjects

Add new SimBeamSpotHLLHC CondFormat
  • Loading branch information
cmsbuild authored Jul 4, 2024
2 parents b0e21f2 + 17721fb commit 55cba4e
Show file tree
Hide file tree
Showing 28 changed files with 1,304 additions and 152 deletions.
469 changes: 468 additions & 1 deletion CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions CondCore/BeamSpotPlugins/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
<use name="CondCore/CondDB"/>
<use name="boost_python"/>
</library>

<library file="SimBeamSpotHLLHC_PayloadInspector.cc" name="SimBeamSpotHLLHC_PayloadInspector">
<use name="CondCore/Utilities"/>
<use name="CondCore/CondDB"/>
<use name="boost_python"/>
</library>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h"
#include "CondCore/CondDB/interface/Time.h"
#include "CondCore/Utilities/interface/PayloadInspector.h"
#include "CondCore/Utilities/interface/PayloadInspectorModule.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotHLLHCObjects.h"

namespace {

/************************************************
Display of Sim Beam Spot HL-LHC parameters
*************************************************/

typedef simBeamSpotHLLHCPI::DisplayParameters<SimBeamSpotHLLHCObjects> SimBeamSpotHLLHCParameters;

/*********************************************************
Display of Sim Beam Spot HL-LHC parameters Differences
**********************************************************/

typedef simBeamSpotHLLHCPI::DisplayParametersDiff<SimBeamSpotHLLHCObjects, cond::payloadInspector::MULTI_IOV, 1>
SimBeamSpotHLLHCParametersDiffSingleTag;
typedef simBeamSpotHLLHCPI::DisplayParametersDiff<SimBeamSpotHLLHCObjects, cond::payloadInspector::SINGLE_IOV, 2>
SimBeamSpotHLLHCParametersDiffTwoTags;

} // namespace

PAYLOAD_INSPECTOR_MODULE(SimBeamSpotHLLHC) {
PAYLOAD_INSPECTOR_CLASS(SimBeamSpotHLLHCParameters);
PAYLOAD_INSPECTOR_CLASS(SimBeamSpotHLLHCParametersDiffSingleTag);
PAYLOAD_INSPECTOR_CLASS(SimBeamSpotHLLHCParametersDiffTwoTags);
}
13 changes: 8 additions & 5 deletions CondCore/BeamSpotPlugins/src/plugin.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#include "CondCore/ESSources/interface/registration_macros.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotHLLHCObjects.h"
#include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h"
#include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h"
#include "CondFormats/DataRecord/interface/BeamSpotOnlineHLTObjectsRcd.h"
#include "CondFormats/DataRecord/interface/BeamSpotOnlineLegacyObjectsRcd.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h"
#include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h"
#include "CondFormats/DataRecord/interface/SimBeamSpotHLLHCObjectsRcd.h"

REGISTER_PLUGIN(BeamSpotObjectsRcd, BeamSpotObjects);
REGISTER_PLUGIN(SimBeamSpotObjectsRcd, SimBeamSpotObjects);
REGISTER_PLUGIN(BeamSpotOnlineHLTObjectsRcd, BeamSpotOnlineObjects);
REGISTER_PLUGIN_NO_SERIAL(BeamSpotOnlineLegacyObjectsRcd, BeamSpotOnlineObjects);
REGISTER_PLUGIN(SimBeamSpotObjectsRcd, SimBeamSpotObjects);
REGISTER_PLUGIN(SimBeamSpotHLLHCObjectsRcd, SimBeamSpotHLLHCObjects);
26 changes: 24 additions & 2 deletions CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include <iostream>
#include <sstream>
#include "CondCore/Utilities/interface/PayloadInspector.h"
#include "CondCore/BeamSpotPlugins/plugins/SimBeamSpot_PayloadInspector.cc"
#include "CondCore/BeamSpotPlugins/plugins/BeamSpot_PayloadInspector.cc"
#include "CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc"
#include "CondCore/BeamSpotPlugins/plugins/SimBeamSpot_PayloadInspector.cc"
#include "CondCore/BeamSpotPlugins/plugins/SimBeamSpotHLLHC_PayloadInspector.cc"
#include "CondCore/Utilities/interface/PayloadInspector.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/PluginManager/interface/PluginManager.h"
#include "FWCore/PluginManager/interface/standard.h"
Expand Down Expand Up @@ -106,5 +107,26 @@ int main(int argc, char** argv) {
histoSimParametersDiffTwoTags.process(prepConnectionString, PI::mk_input(tag1, start, start, tag2, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimParametersDiffTwoTags.data() << std::endl;

// SimBeamSpotHLLHC
tag = "SimBeamSpotHLLHC_test_tag_1_v0";

edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising SimBeamSpotHLLHC plots " << std::endl;

SimBeamSpotHLLHCParameters histoSimHLLHCParameters;
histoSimHLLHCParameters.process(prepConnectionString, PI::mk_input(tag, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimHLLHCParameters.data() << std::endl;

SimBeamSpotHLLHCParametersDiffSingleTag histoSimHLLHCParametersDiff;
histoSimHLLHCParametersDiff.process(prepConnectionString, PI::mk_input(tag, start, end));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimHLLHCParametersDiff.data() << std::endl;

tag1 = "SimBeamSpotHLLHC_test_tag_1_v0";
tag2 = "SimBeamSpotHLLHC_test_tag_2_v0";

SimBeamSpotHLLHCParametersDiffTwoTags histoSimHLLHCParametersDiffTwoTags;
histoSimHLLHCParametersDiffTwoTags.process(prepConnectionString,
PI::mk_input(tag1, start, start, tag2, start, start));
edm::LogPrint("testBeamSpotPayloadInspector") << histoSimHLLHCParametersDiffTwoTags.data() << std::endl;

Py_Finalize();
}
1 change: 1 addition & 0 deletions CondCore/Utilities/plugins/Module_2XML.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) {
PAYLOAD_2XML_CLASS(RecoIdealGeometry);
PAYLOAD_2XML_CLASS(RunInfo);
PAYLOAD_2XML_CLASS(SimBeamSpotObjects);
PAYLOAD_2XML_CLASS(SimBeamSpotHLLHCObjects);
PAYLOAD_2XML_CLASS(SiPhase2OuterTrackerLorentzAngle);
PAYLOAD_2XML_CLASS(SiPixel2DTemplateDBObject);
PAYLOAD_2XML_CLASS(SiPixelCPEGenericErrorParm);
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBFetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ namespace cond {
FETCH_PAYLOAD_CASE(RecoIdealGeometry)
FETCH_PAYLOAD_CASE(RunInfo)
FETCH_PAYLOAD_CASE(SimBeamSpotObjects)
FETCH_PAYLOAD_CASE(SimBeamSpotHLLHCObjects)
FETCH_PAYLOAD_CASE(SiPhase2OuterTrackerLorentzAngle)
FETCH_PAYLOAD_CASE(SiPixelCalibConfiguration)
FETCH_PAYLOAD_CASE(SiPixelCPEGenericErrorParm)
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 @@ -313,6 +313,7 @@ namespace cond {
IMPORT_PAYLOAD_CASE(RecoIdealGeometry)
IMPORT_PAYLOAD_CASE(RunInfo)
IMPORT_PAYLOAD_CASE(SimBeamSpotObjects)
IMPORT_PAYLOAD_CASE(SimBeamSpotHLLHCObjects)
IMPORT_PAYLOAD_CASE(SiPhase2OuterTrackerLorentzAngle)
IMPORT_PAYLOAD_CASE(SiPixelCalibConfiguration)
IMPORT_PAYLOAD_CASE(SiPixelCPEGenericErrorParm)
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 @@ -9,6 +9,7 @@
#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotHLLHCObjects.h"
#include "CondFormats/CastorObjects/interface/CastorElectronicsMap.h"
#include "CondFormats/CastorObjects/interface/CastorSaturationCorrs.h"
#include "CondFormats/HIObjects/interface/CentralityTable.h"
Expand Down
106 changes: 106 additions & 0 deletions CondFormats/BeamSpotObjects/interface/SimBeamSpotHLLHCObjects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#ifndef CondFormats_BeamSpotObjects_SimBeamSpotHLLHCObjects_h
#define CondFormats_BeamSpotObjects_SimBeamSpotHLLHCObjects_h

/** \class SimBeamSpotHLLHCObjects
*
* Provide the vertex smearing parameters from DB
*
* This Object contains the parameters needed by the HLLHCEvtVtxGenerator generator:
* Parameters used:
* - fMeanX, fMeanY, fMeanZ
* - fEProton, fCrabFrequency, fRF800
* - fCrossingAngle
* - fCrabbingAngleCrossing, fCrabbingAngleSeparation
* - fBetaCrossingPlane, fBetaSeparationPlane
* - fHorizontalEmittance, fVerticalEmittance
* - fBunchLength
* - fTimeOffset
*
*/

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

#include <sstream>

class SimBeamSpotHLLHCObjects {
public:
/// default constructor
SimBeamSpotHLLHCObjects() {
fMeanX = 0.0;
fMeanY = 0.0;
fMeanZ = 0.0;
fEProton = 0.0;
fCrabFrequency = 0.0;
fRF800 = 0.0;
fCrossingAngle = 0.0;
fCrabbingAngleCrossing = 0.0;
fCrabbingAngleSeparation = 0.0;
fBetaCrossingPlane = 0.0;
fBetaSeparationPlane = 0.0;
fHorizontalEmittance = 0.0;
fVerticalEmittance = 0.0;
fBunchLength = 0.0;
fTimeOffset = 0.0;
};

virtual ~SimBeamSpotHLLHCObjects(){};

/// set meanX, meanY, meanZ
void setMeanX(double val) { fMeanX = val; }
void setMeanY(double val) { fMeanY = val; }
void setMeanZ(double val) { fMeanZ = val; }
/// set EProton, fCrabFrequency, RF800
void setEProton(double val) { fEProton = val; }
void setCrabFrequency(double val) { fCrabFrequency = val; }
void setRF800(double val) { fRF800 = val; }
/// set Crossing and Crabbing angles
void setCrossingAngle(double val) { fCrossingAngle = val; }
void setCrabbingAngleCrossing(double val) { fCrabbingAngleCrossing = val; }
void setCrabbingAngleSeparation(double val) { fCrabbingAngleSeparation = val; }
/// set BetaStar and Emittance
void setBetaCrossingPlane(double val) { fBetaCrossingPlane = val; }
void setBetaSeparationPlane(double val) { fBetaSeparationPlane = val; }
void setHorizontalEmittance(double val) { fHorizontalEmittance = val; }
void setVerticalEmittance(double val) { fVerticalEmittance = val; }
/// set BunchLength and TimeOffset
void setBunchLength(double val) { fBunchLength = val; }
void setTimeOffset(double val) { fTimeOffset = val; }

/// get meanX, meanY, meanZ position
double meanX() const { return fMeanX; }
double meanY() const { return fMeanY; }
double meanZ() const { return fMeanZ; }
/// get EProton, fCrabFrequency, RF800
double eProton() const { return fEProton; }
double crabFrequency() const { return fCrabFrequency; }
double rf800() const { return fRF800; }
/// set Crossing and Crabbing angles
double crossingAngle() const { return fCrossingAngle; }
double crabbingAngleCrossing() const { return fCrabbingAngleCrossing; }
double crabbingAngleSeparation() const { return fCrabbingAngleSeparation; }
/// get BetaStar and Emittance
double betaCrossingPlane() const { return fBetaCrossingPlane; }
double betaSeparationPlane() const { return fBetaSeparationPlane; }
double horizontalEmittance() const { return fHorizontalEmittance; }
double verticalEmittance() const { return fVerticalEmittance; }
/// get BunchLength and TimeOffset
double bunchLenght() const { return fBunchLength; }
double timeOffset() const { return fTimeOffset; }

/// print sim beam spot parameters
void print(std::stringstream& ss) const;

private:
double fMeanX, fMeanY, fMeanZ;
double fEProton, fCrabFrequency, fRF800;
double fCrossingAngle, fCrabbingAngleCrossing, fCrabbingAngleSeparation;
double fBetaCrossingPlane, fBetaSeparationPlane;
double fHorizontalEmittance, fVerticalEmittance;
double fBunchLength, fTimeOffset;

COND_SERIALIZABLE;
};

std::ostream& operator<<(std::ostream&, SimBeamSpotHLLHCObjects beam);

#endif
31 changes: 31 additions & 0 deletions CondFormats/BeamSpotObjects/src/SimBeamSpotHLLHCObjects.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotHLLHCObjects.h"

#include <iostream>

void SimBeamSpotHLLHCObjects::print(std::stringstream& ss) const {
ss << "------------------------------------------------------------------------\n"
<< " Sim Beam Spot HL LHC Data\n\n"
<< " MeanX = " << meanX() << " [cm]\n"
<< " MeanY = " << meanY() << " [cm]\n"
<< " MeanZ = " << meanZ() << " [cm]\n"
<< " E Proton = " << eProton() << " [GeV]\n"
<< " Crab Frequency = " << crabFrequency() << " [MHz]\n"
<< " 800 MHz RF ? " << rf800() << "\n"
<< " Crossing Angle = " << crossingAngle() << " [urad]\n"
<< " Crabbing Angle Crossing = " << crabbingAngleCrossing() << " [urad]\n"
<< " Crabbing Angle Separation = " << crabbingAngleSeparation() << " [urad]\n"
<< " Beta Crossing Plane = " << betaCrossingPlane() << " [m]\n"
<< " Beta Separation Plane = " << betaSeparationPlane() << " [m]\n"
<< " Horizontal Emittance = " << horizontalEmittance() << " [mm]\n"
<< " Vertical Emittance = " << verticalEmittance() << " [mm]\n"
<< " Bunch Lenght = " << bunchLenght() << " [m]\n"
<< " TimeOffset = " << timeOffset() << " [ns]\n"
<< "------------------------------------------------------------------------\n\n";
}

std::ostream& operator<<(std::ostream& os, SimBeamSpotHLLHCObjects beam) {
std::stringstream ss;
beam.print(ss);
os << ss.str();
return os;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotHLLHCObjects.h"
#include "FWCore/Utilities/interface/typelookup.h"
TYPELOOKUP_DATA_REG(SimBeamSpotHLLHCObjects);
5 changes: 3 additions & 2 deletions CondFormats/BeamSpotObjects/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<lcgdict>
<class name="BeamSpotObjects"/>
<class name="SimBeamSpotObjects"/>
<class name="BeamSpotObjects"/>
<class name="BeamSpotOnlineObjects"/>
<class name="SimBeamSpotObjects"/>
<class name="SimBeamSpotHLLHCObjects"/>
</lcgdict>
3 changes: 2 additions & 1 deletion CondFormats/BeamSpotObjects/src/headers.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotHLLHCObjects.h"
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

int main() {
testSerialization<BeamSpotObjects>();
testSerialization<SimBeamSpotObjects>();
testSerialization<BeamSpotOnlineObjects>();
testSerialization<SimBeamSpotObjects>();
testSerialization<SimBeamSpotHLLHCObjects>();

return 0;
}
23 changes: 23 additions & 0 deletions CondFormats/DataRecord/interface/SimBeamSpotHLLHCObjectsRcd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef DataRecord_SimBeamSpotHLLHCObjectsRcd_h
#define DataRecord_SimBeamSpotHLLHCObjectsRcd_h
// -*- C++ -*-
//
// Package: DataRecord
// Class : SimBeamSpotHLLHCObjectsRcd
//
/**\class SimBeamSpotHLLHCObjectsRcd SimBeamSpotHLLHCObjectsRcd.h CondFormats/DataRecord/interface/SimBeamSpotHLLHCObjectsRcd.h
Description: Contains the Vertex Smearing parameters used by HLLHCEvtVtxGenerator (Phase 2 BeamSpot simulation)
*/
//
// Author: Francesco Brivio (INFN Milano-Bicocca)
// Created: Thu Nov 2 2023
//

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

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

#endif
15 changes: 15 additions & 0 deletions CondFormats/DataRecord/src/SimBeamSpotHLLHCObjectsRcd.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// -*- C++ -*-
//
// Package: DataRecord
// Class : SimBeamSpotHLLHCObjectsRcd
//
// Implementation:
// <Notes on implementation>
//
// Author: Francesco Brivio (INFN Milano-Bicocca)
// Created: Thu Nov 2 2023

#include "CondFormats/DataRecord/interface/SimBeamSpotHLLHCObjectsRcd.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"

EVENTSETUP_RECORD_REG(SimBeamSpotHLLHCObjectsRcd);
Loading

0 comments on commit 55cba4e

Please sign in to comment.