-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge CMSSW_10_6_X into CMSSW_10_6_DEVEL_X.
- Loading branch information
Showing
38 changed files
with
652 additions
and
529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
IOMC/EventVertexGenerators/interface/PassThroughEvtVtxGenerator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef IOMC_EventVertexGenerators_PassThroughEvtVtxGenerator_H | ||
#define IOMC_EventVertexGenerators_PassThroughEvtVtxGenerator_H | ||
/* | ||
*/ | ||
|
||
#include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h" | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include "FWCore/Utilities/interface/EDGetToken.h" | ||
|
||
#include "TMatrixD.h" | ||
|
||
namespace HepMC { | ||
class FourVector ; | ||
} | ||
|
||
namespace CLHEP { | ||
class HepRandomEngine; | ||
} | ||
|
||
namespace edm { | ||
class HepMCProduct; | ||
} | ||
|
||
class PassThroughEvtVtxGenerator : public BaseEvtVtxGenerator | ||
{ | ||
public: | ||
|
||
// ctor & dtor | ||
explicit PassThroughEvtVtxGenerator( const edm::ParameterSet& ); | ||
~PassThroughEvtVtxGenerator() override; | ||
|
||
void produce( edm::Event&, const edm::EventSetup&) override; | ||
|
||
HepMC::FourVector newVertex(CLHEP::HepRandomEngine*) const override; | ||
|
||
TMatrixD const* GetInvLorentzBoost() const override { return nullptr;}; | ||
|
||
private : | ||
|
||
edm::EDGetTokenT<edm::HepMCProduct> sourceToken; | ||
|
||
}; | ||
|
||
#endif |
67 changes: 67 additions & 0 deletions
67
IOMC/EventVertexGenerators/src/PassThroughEvtVtxGenerator.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
/* | ||
*/ | ||
|
||
#include "IOMC/EventVertexGenerators/interface/PassThroughEvtVtxGenerator.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" | ||
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" | ||
|
||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/Utilities/interface/RandomNumberGenerator.h" | ||
|
||
#include "FWCore/Utilities/interface/Exception.h" | ||
|
||
#include "DataFormats/Provenance/interface/Provenance.h" | ||
#include "FWCore/Utilities/interface/EDMException.h" | ||
|
||
//#include "HepMC/GenEvent.h" | ||
// #include "CLHEP/Vector/ThreeVector.h" | ||
// #include "HepMC/SimpleVector.h" | ||
|
||
using namespace edm; | ||
using namespace CLHEP; | ||
//using namespace HepMC; | ||
|
||
|
||
PassThroughEvtVtxGenerator::PassThroughEvtVtxGenerator( const ParameterSet& pset ) | ||
: BaseEvtVtxGenerator(pset) | ||
{ | ||
Service<RandomNumberGenerator> rng; | ||
if ( ! rng.isAvailable()) { | ||
throw cms::Exception("Configuration") | ||
<< "The PassThroughEvtVtxGenerator requires the RandomNumberGeneratorService\n" | ||
"which is not present in the configuration file. \n" | ||
"You must add the service\n" | ||
"in the configuration file or remove the modules that require it."; | ||
} | ||
sourceToken=consumes<edm::HepMCProduct>(pset.getParameter<edm::InputTag>("src")); | ||
} | ||
|
||
PassThroughEvtVtxGenerator::~PassThroughEvtVtxGenerator() | ||
{ | ||
} | ||
|
||
HepMC::FourVector PassThroughEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine*) const { | ||
return HepMC::FourVector(0.,0.,0.); | ||
} | ||
|
||
void PassThroughEvtVtxGenerator::produce( Event& evt, const EventSetup& ) | ||
{ | ||
edm::Service<edm::RandomNumberGenerator> rng; | ||
|
||
Handle<HepMCProduct> HepUnsmearedMCEvt ; | ||
|
||
evt.getByToken( sourceToken, HepUnsmearedMCEvt ) ; | ||
|
||
// Copy the HepMC::GenEvent | ||
HepMC::GenEvent* genevt = new HepMC::GenEvent(*HepUnsmearedMCEvt->GetEvent()); | ||
std::unique_ptr<edm::HepMCProduct> HepMCEvt(new edm::HepMCProduct(genevt)); | ||
|
||
evt.put(std::move(HepMCEvt)) ; | ||
|
||
return ; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef IOMC_ParticleGun_CloseByParticleGunProducer_H | ||
#define IOMC_ParticleGun_CloseByParticleGunProducer_H | ||
|
||
#include "IOMC/ParticleGuns/interface/BaseFlatGunProducer.h" | ||
|
||
namespace edm | ||
{ | ||
|
||
class CloseByParticleGunProducer : public BaseFlatGunProducer | ||
{ | ||
|
||
public: | ||
CloseByParticleGunProducer(const ParameterSet &); | ||
~CloseByParticleGunProducer() override; | ||
|
||
private: | ||
|
||
void produce(Event & e, const EventSetup& es) override; | ||
|
||
protected : | ||
|
||
// data members | ||
double fEn,fR,fZ,fDelta; | ||
bool fPointing = false; | ||
std::vector<int> fPartIDs; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#include <ostream> | ||
|
||
#include "IOMC/ParticleGuns/interface/CloseByParticleGunProducer.h" | ||
|
||
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" | ||
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" | ||
|
||
#include "DataFormats/Math/interface/Vector3D.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/Utilities/interface/RandomNumberGenerator.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
#include "CLHEP/Random/RandFlat.h" | ||
#include "CLHEP/Units/GlobalSystemOfUnits.h" | ||
#include "CLHEP/Units/GlobalPhysicalConstants.h" | ||
#include "CLHEP/Random/RandFlat.h" | ||
|
||
using namespace edm; | ||
using namespace std; | ||
|
||
CloseByParticleGunProducer::CloseByParticleGunProducer(const ParameterSet& pset) : | ||
BaseFlatGunProducer(pset) | ||
{ | ||
|
||
ParameterSet defpset ; | ||
ParameterSet pgun_params = | ||
pset.getParameter<ParameterSet>("PGunParameters") ; | ||
|
||
fEn = pgun_params.getParameter<double>("En"); | ||
fR = pgun_params.getParameter<double>("R"); | ||
fZ = pgun_params.getParameter<double>("Z"); | ||
fDelta = pgun_params.getParameter<double>("Delta"); | ||
fPartIDs = pgun_params.getParameter< vector<int> >("PartID"); | ||
fPointing = pgun_params.getParameter<bool>("Pointing"); | ||
|
||
produces<HepMCProduct>("unsmeared"); | ||
produces<GenEventInfoProduct>(); | ||
} | ||
|
||
CloseByParticleGunProducer::~CloseByParticleGunProducer() | ||
{ | ||
// no need to cleanup GenEvent memory - done in HepMCProduct | ||
} | ||
|
||
void CloseByParticleGunProducer::produce(Event &e, const EventSetup& es) | ||
{ | ||
edm::Service<edm::RandomNumberGenerator> rng; | ||
CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID()); | ||
|
||
if ( fVerbosity > 0 ) | ||
{ | ||
LogDebug("CloseByParticleGunProducer") << " CloseByParticleGunProducer : Begin New Event Generation" << endl ; | ||
} | ||
fEvt = new HepMC::GenEvent() ; | ||
|
||
// loop over particles | ||
// | ||
int barcode = 1 ; | ||
double phi = CLHEP::RandFlat::shoot(engine, -3.14159265358979323846, 3.14159265358979323846); | ||
for (unsigned int ip=0; ip<fPartIDs.size(); ++ip, phi += fDelta/fR) | ||
{ | ||
|
||
int PartID = fPartIDs[ip] ; | ||
const HepPDT::ParticleData *PData = fPDGTable->particle(HepPDT::ParticleID(abs(PartID))) ; | ||
double mass = PData->mass().value() ; | ||
double mom = sqrt(fEn*fEn-mass*mass); | ||
double px = 0.; | ||
double py = 0.; | ||
double pz = mom; | ||
double energy = fEn; | ||
|
||
// Compute Vertex Position | ||
double x=fR*cos(phi); | ||
double y=fR*sin(phi); | ||
constexpr double c= 2.99792458e+1; // cm/ns | ||
double timeOffset = sqrt(x*x + y*y + fZ*fZ)/c*ns*c_light; | ||
HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(x*cm,y*cm,fZ*cm,timeOffset)); | ||
|
||
HepMC::FourVector p(px,py,pz,energy) ; | ||
// If we are requested to be pointing to (0,0,0), correct the momentum direction | ||
if (fPointing) { | ||
math::XYZVector direction(x,y,fZ); | ||
math::XYZVector momentum = direction.unit() * mom; | ||
p.setX(momentum.x()); | ||
p.setY(momentum.y()); | ||
p.setZ(momentum.z()); | ||
} | ||
HepMC::GenParticle* Part = new HepMC::GenParticle(p,PartID,1); | ||
Part->suggest_barcode( barcode ); | ||
barcode++; | ||
|
||
Vtx->add_particle_out(Part); | ||
|
||
if (fVerbosity > 0) { | ||
Vtx->print(); | ||
Part->print(); | ||
} | ||
fEvt->add_vertex(Vtx); | ||
} | ||
|
||
|
||
fEvt->set_event_number(e.id().event()); | ||
fEvt->set_signal_process_id(20); | ||
|
||
if ( fVerbosity > 0 ) | ||
{ | ||
fEvt->print(); | ||
} | ||
|
||
unique_ptr<HepMCProduct> BProduct(new HepMCProduct()); | ||
BProduct->addHepMCData( fEvt ); | ||
e.put(std::move(BProduct), "unsmeared"); | ||
|
||
unique_ptr<GenEventInfoProduct> genEventInfo(new GenEventInfoProduct(fEvt)); | ||
e.put(std::move(genEventInfo)); | ||
|
||
if ( fVerbosity > 0 ) | ||
{ | ||
LogDebug("CloseByParticleGunProducer") << " CloseByParticleGunProducer : Event Generation Done " << endl; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
<use name="root"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/PluginManager"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="Geometry/Records"/> | ||
<use name="Geometry/GEMGeometry"/> | ||
<use name="DataFormats/TrackingRecHit"/> | ||
<use name="DataFormats/DTRecHit"/> | ||
<use name="DataFormats/CSCRecHit"/> | ||
<use name="DataFormats/RPCRecHit"/> | ||
<use name="DataFormats/RPCDigi"/> | ||
<use name="DataFormats/GEMRecHit"/> | ||
<use name="DataFormats/GEMDigi"/> | ||
<use name="DataFormats/Common"/> | ||
<use name="CondFormats/RPCObjects"/> | ||
<use name="CondFormats/GEMObjects"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="Geometry/RPCGeometry"/> | ||
<use name="Geometry/GEMGeometry"/> | ||
<use name="Geometry/DTGeometry"/> | ||
<use name="Geometry/CSCGeometry"/> | ||
<use name="TrackingTools/TrackRefitter"/> | ||
<flags EDM_PLUGIN="1"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
671505408 1 | ||
671505408 3 | ||
671505408 5 | ||
671505408 7 | ||
671505408 9 | ||
671505408 11 | ||
671505408 13 | ||
671505408 15 | ||
671505408 17 | ||
671505408 19 | ||
671505408 21 | ||
671505408 23 | ||
671505408 25 | ||
671505408 27 | ||
671505408 29 | ||
671505408 31 | ||
671505408 33 | ||
671505408 35 | ||
671505408 37 | ||
671505408 39 | ||
671505408 41 | ||
671505408 43 | ||
671505408 45 | ||
671505408 47 | ||
671505408 49 | ||
671505408 51 | ||
671505408 53 | ||
671505408 55 | ||
|
||
# example masking file gemId Re -1 Ri 1 St 1 La 1 Ch 29 Ro 6 rawId 671505408 |
Oops, something went wrong.