-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Optical function method for PPS proton transport #29857
Changes from all commits
5e14cca
1e681dc
9a66943
ce13f8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
ctpps_2021 = cms.Modifier() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,13 +31,15 @@ | |
#include "SimDataFormats/Forward/interface/LHCTransportLink.h" | ||
#include "SimDataFormats/Forward/interface/LHCTransportLinkContainer.h" | ||
|
||
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" | ||
#include "FWCore/Utilities/interface/RandomNumberGenerator.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/StreamID.h" | ||
#include "SimTransport/PPSProtonTransport/interface/TotemTransport.h" | ||
#include "SimTransport/PPSProtonTransport/interface/HectorTransport.h" | ||
#include "SimTransport/PPSProtonTransport/interface/ProtonTransport.h" | ||
#include "TRandom3.h" | ||
#include "IOMC/RandomEngine/src/TRandomAdaptor.h" | ||
|
||
// | ||
// class declaration | ||
// | ||
|
@@ -47,7 +49,7 @@ class PPSSimTrackProducer : public edm::stream::EDProducer<> { | |
explicit PPSSimTrackProducer(const edm::ParameterSet&); | ||
~PPSSimTrackProducer() override; | ||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
//static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
private: | ||
void beginStream(edm::StreamID) override; | ||
|
@@ -56,7 +58,7 @@ class PPSSimTrackProducer : public edm::stream::EDProducer<> { | |
|
||
// ----------member data --------------------------- | ||
bool m_verbosity; | ||
ProtonTransport* theTransporter = nullptr; | ||
ProtonTransport* theTransporter; | ||
edm::InputTag m_InTag; | ||
edm::EDGetTokenT<edm::HepMCProduct> m_InTagToken; | ||
|
||
|
@@ -78,28 +80,17 @@ class PPSSimTrackProducer : public edm::stream::EDProducer<> { | |
PPSSimTrackProducer::PPSSimTrackProducer(const edm::ParameterSet& iConfig) { | ||
//now do what ever other initialization is needed | ||
// TransportHector | ||
theTransporter = new ProtonTransport(iConfig); | ||
|
||
m_InTag = iConfig.getParameter<edm::InputTag>("HepMCProductLabel"); | ||
m_InTagToken = consumes<edm::HepMCProduct>(m_InTag); | ||
|
||
m_verbosity = iConfig.getParameter<bool>("Verbosity"); | ||
m_transportMethod = iConfig.getParameter<std::string>("TransportMethod"); | ||
//m_transportMethod = iConfig.getParameter<std::string>("TransportMethod"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here |
||
|
||
produces<edm::HepMCProduct>(); | ||
produces<edm::LHCTransportLinkContainer>(); | ||
|
||
theTransporter = nullptr; | ||
|
||
if (m_transportMethod == "Totem") { | ||
theTransporter = new TotemTransport(iConfig, m_verbosity); | ||
} else if (m_transportMethod == "Hector") { | ||
theTransporter = new HectorTransport(iConfig, m_verbosity); | ||
} else { | ||
throw cms::Exception("Configuration") | ||
<< "LHCTransport (ProtonTransport) requires a Method (Hector or Totem) \n" | ||
"which is not present in the configuration file. You should add one of the method\n" | ||
"above in the configuration file or remove the module that requires it."; | ||
} | ||
|
||
edm::Service<edm::RandomNumberGenerator> rng; | ||
if (!rng.isAvailable()) { | ||
throw cms::Exception("Configuration") | ||
|
@@ -143,12 +134,12 @@ void PPSSimTrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe | |
} | ||
|
||
if (HepMCEvt.provenance()->moduleLabel() == "LHCTransport") { | ||
throw cms::Exception("LogicError") << "HectorTrasported HepMCProduce already exists\n"; | ||
throw cms::Exception("LogicError") << "LHCTrasport HepMCProduce already exists\n"; | ||
} | ||
|
||
evt = new HepMC::GenEvent(*HepMCEvt->GetEvent()); | ||
|
||
theTransporter->clear(); | ||
//theTransporter->clear(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here |
||
theTransporter->process(evt, iSetup, engine); | ||
|
||
if (m_verbosity) | ||
|
@@ -165,7 +156,8 @@ void PPSSimTrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe | |
|
||
if (m_verbosity) { | ||
for (unsigned int i = 0; i < (*NewCorrespondenceMap).size(); i++) | ||
LogDebug("HectorEventProcessing") << "Hector correspondence table: " << (*NewCorrespondenceMap)[i]; | ||
LogDebug("ProtonTransportEventProcessing") | ||
<< "ProtonTransport correspondence table: " << (*NewCorrespondenceMap)[i]; | ||
} | ||
|
||
iEvent.put(std::move(NewCorrespondenceMap)); | ||
|
@@ -181,13 +173,14 @@ void PPSSimTrackProducer::beginStream(edm::StreamID) {} | |
void PPSSimTrackProducer::endStream() {} | ||
|
||
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ | ||
/* | ||
void PPSSimTrackProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
//The following says we do not know what parameters are allowed so do no validation | ||
// Please change this to state exactly what you do use, even if it is no parameters | ||
edm::ParameterSetDescription desc; | ||
desc.setUnknown(); | ||
descriptions.addDefault(desc); | ||
} | ||
|
||
*/ | ||
Comment on lines
175
to
+184
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps you can delete all this part |
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(PPSSimTrackProducer); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="SimDataFormats/GeneratorProducts"/> | ||
<use name="SimGeneral/HepPDTRecord"/> | ||
<use name="Utilities/PPS"/> | ||
<use name="SimTransport/TotemRPProtonTransportParametrization"/> | ||
<use name="hector"/> | ||
<use name="hepmc"/> | ||
<use name="clhep"/> | ||
<use name="rootcore"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="CommonTools/Utils"/> | ||
<use name="SimDataFormats/GeneratorProducts"/> | ||
<use name="SimGeneral/HepPDTRecord"/> | ||
<use name="Utilities/PPS"/> | ||
<use name="SimTransport/TotemRPProtonTransportParametrization"/> | ||
<use name="CondFormats/PPSObjects"/> | ||
<use name="CondFormats/RunInfo"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="hector"/> | ||
<use name="hepmc"/> | ||
<use name="clhep"/> | ||
<use name="rootcore"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#ifndef BASEPROTONTRANSPORT | ||
#define BASEPROTONTRANSPORT | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "HepMC/GenEvent.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "Utilities/PPS/interface/PPSUnitConversion.h" | ||
#include "SimDataFormats/Forward/interface/LHCTransportLink.h" | ||
#include <vector> | ||
#include <map> | ||
#include <string> | ||
#include "TLorentzVector.h" | ||
|
||
namespace CLHEP { | ||
class HepRandomEngine; | ||
} | ||
class BaseProtonTransport { | ||
public: | ||
BaseProtonTransport(const edm::ParameterSet& iConfig); | ||
virtual ~BaseProtonTransport() { this->clear(); }; | ||
|
||
std::vector<LHCTransportLink>& getCorrespondenceMap() { return m_CorrespondenceMap; } | ||
virtual void process(const HepMC::GenEvent* ev, const edm::EventSetup& es, CLHEP::HepRandomEngine* engine) = 0; | ||
|
||
void clear(); | ||
|
||
void addPartToHepMC(HepMC::GenEvent*); | ||
|
||
void ApplyBeamCorrection(HepMC::GenParticle* p); | ||
void ApplyBeamCorrection(TLorentzVector& p); | ||
|
||
void setBeamEnergy(double e) { | ||
beamEnergy_ = e; | ||
beamMomentum_ = sqrt(beamEnergy_ * beamEnergy_ - ProtonMassSQ); | ||
} | ||
|
||
double beamEnergy() { return beamEnergy_; }; | ||
double beamMomentum() { return beamMomentum_; }; | ||
|
||
protected: | ||
enum class TransportMode { HECTOR, TOTEM, OPTICALFUNCTIONS }; | ||
TransportMode MODE; | ||
|
||
int NEvent; | ||
CLHEP::HepRandomEngine* engine_; | ||
std::vector<LHCTransportLink> m_CorrespondenceMap; | ||
std::map<unsigned int, TLorentzVector> m_beamPart; | ||
std::map<unsigned int, double> m_xAtTrPoint; | ||
std::map<unsigned int, double> m_yAtTrPoint; | ||
|
||
bool verbosity_; | ||
bool bApplyZShift; | ||
|
||
std::string beam1Filename_; | ||
std::string beam2Filename_; | ||
|
||
double fPPSRegionStart_45; | ||
double fPPSRegionStart_56; | ||
double fCrossingAngle_45; | ||
double fCrossingAngle_56; | ||
|
||
double beamMomentum_; | ||
double beamEnergy_; | ||
double etaCut_; | ||
double momentumCut_; | ||
double fVtxMeanX; | ||
double fVtxMeanY; | ||
double fVtxMeanZ; | ||
|
||
double m_sigmaSTX; | ||
double m_sigmaSTY; | ||
double m_sigmaSX; | ||
double m_sigmaSY; | ||
double m_sig_E; | ||
double fBeamXatIP; | ||
double fBeamYatIP; | ||
}; | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef OPTICALFUNCTION_TRANSPORT | ||
#define OPTICALFUNCTION_TRANSPORT | ||
#include "CondFormats/DataRecord/interface/CTPPSBeamParametersRcd.h" | ||
#include "CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h" | ||
#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" | ||
#include "CondFormats/PPSObjects/interface/CTPPSBeamParameters.h" | ||
#include "CondFormats/PPSObjects/interface/LHCInterpolatedOpticalFunctionsSetCollection.h" | ||
#include "CondFormats/RunInfo/interface/LHCInfo.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" | ||
#include "SimTransport/PPSProtonTransport/interface/BaseProtonTransport.h" | ||
|
||
#include <array> | ||
#include <unordered_map> | ||
|
||
#include <cmath> | ||
|
||
class OpticalFunctionsTransport : public BaseProtonTransport { | ||
public: | ||
OpticalFunctionsTransport(const edm::ParameterSet& ps); | ||
~OpticalFunctionsTransport() override{}; | ||
|
||
void process(const HepMC::GenEvent* ev, const edm::EventSetup& es, CLHEP::HepRandomEngine* engine) override; | ||
|
||
private: | ||
bool transportProton(const HepMC::GenParticle*); | ||
|
||
std::string lhcInfoLabel_; | ||
std::string opticsLabel_; | ||
|
||
edm::ESHandle<LHCInfo> lhcInfo_; | ||
edm::ESHandle<CTPPSBeamParameters> beamParameters_; | ||
edm::ESHandle<LHCInterpolatedOpticalFunctionsSetCollection> opticalFunctions_; | ||
|
||
bool useEmpiricalApertures_; | ||
double empiricalAperture45_xi0_int_, empiricalAperture45_xi0_slp_, empiricalAperture45_a_int_, | ||
empiricalAperture45_a_slp_; | ||
double empiricalAperture56_xi0_int_, empiricalAperture56_xi0_slp_, empiricalAperture56_a_int_, | ||
empiricalAperture56_a_slp_; | ||
|
||
bool produceHitsRelativeToBeam_; | ||
}; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please delete the commented lines of code.