Skip to content

Commit

Permalink
Merge CMSSW_10_6_X into CMSSW_10_6_DEVEL_X.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed Mar 14, 2019
2 parents aa116d3 + a5230d7 commit 2eeccc8
Show file tree
Hide file tree
Showing 38 changed files with 652 additions and 529 deletions.
1 change: 1 addition & 0 deletions CondFormats/GEMObjects/interface/GEMDeadStrips.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GEMDeadStrips {
~GEMDeadStrips(){}

std::vector<DeadItem> const & getDeadVec() const {return deadVec_;}
void fillDeadVec(DeadItem m) {deadVec_.push_back(m);}

private:
std::vector<DeadItem> deadVec_;
Expand Down
1 change: 1 addition & 0 deletions CondFormats/GEMObjects/interface/GEMMaskedStrips.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GEMMaskedStrips {
~GEMMaskedStrips(){}

std::vector<MaskItem> const & getMaskVec() const {return maskVec_;}
void fillMaskVec(MaskItem m) {maskVec_.push_back(m);}

private:
std::vector<MaskItem> maskVec_;
Expand Down
5 changes: 5 additions & 0 deletions CondFormats/GEMObjects/test/test_serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ int main()
testSerialization<std::vector<GEMeMap::GEMVFatMap>>();
testSerialization<GEMeMap::GEMStripMap>();
testSerialization<std::vector<GEMeMap::GEMStripMap>>();

testSerialization<GEMDeadStrips>();
testSerialization<GEMDeadStrips::DeadItem>();
testSerialization<GEMMaskedStrips>();
testSerialization<GEMMaskedStrips::MaskItem>();
}
44 changes: 44 additions & 0 deletions IOMC/EventVertexGenerators/interface/PassThroughEvtVtxGenerator.h
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 IOMC/EventVertexGenerators/src/PassThroughEvtVtxGenerator.cc
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 ;
}
2 changes: 2 additions & 0 deletions IOMC/EventVertexGenerators/src/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//#include "IOMC/EventVertexGenerators/interface/VertexGenerator.h"

#include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h"
#include "IOMC/EventVertexGenerators/interface/PassThroughEvtVtxGenerator.h"
#include "IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h"
#include "IOMC/EventVertexGenerators/interface/FlatEvtVtxGenerator.h"
#include "IOMC/EventVertexGenerators/interface/BeamProfileVtxGenerator.h"
Expand All @@ -18,6 +19,7 @@

//using edm::VertexGenerator;
//DEFINE_FWK_MODULE(VertexGenerator) ;
DEFINE_FWK_MODULE(PassThroughEvtVtxGenerator) ;
DEFINE_FWK_MODULE(GaussEvtVtxGenerator) ;
DEFINE_FWK_MODULE(FlatEvtVtxGenerator) ;
DEFINE_FWK_MODULE(BeamProfileVtxGenerator) ;
Expand Down
29 changes: 29 additions & 0 deletions IOMC/ParticleGuns/interface/CloseByParticleGunProducer.h
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
125 changes: 125 additions & 0 deletions IOMC/ParticleGuns/src/CloseByParticleGunProducer.cc
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;
}
}

7 changes: 5 additions & 2 deletions IOMC/ParticleGuns/src/SealModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
#include "IOMC/ParticleGuns/interface/RandomtXiGunProducer.h"
#include "IOMC/ParticleGuns/interface/FlatRandomPtAndDxyGunProducer.h"
#include "IOMC/ParticleGuns/interface/RandomMultiParticlePGunProducer.h"
#include "IOMC/ParticleGuns/interface/CloseByParticleGunProducer.h"


// particle gun prototypes
//


/*
using edm::FlatEGunASCIIWriter;
DEFINE_FWK_MODULE(FlatEGunASCIIWriter);
Expand Down Expand Up @@ -58,3 +59,5 @@ using edm::FlatRandomPtAndDxyGunProducer;
DEFINE_FWK_MODULE(FlatRandomPtAndDxyGunProducer);
using edm::RandomMultiParticlePGunProducer;
DEFINE_FWK_MODULE(RandomMultiParticlePGunProducer);
using edm::CloseByParticleGunProducer;
DEFINE_FWK_MODULE(CloseByParticleGunProducer);
18 changes: 7 additions & 11 deletions RecoLocalMuon/GEMRecHit/BuildFile.xml
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.
30 changes: 30 additions & 0 deletions RecoLocalMuon/GEMRecHit/data/maskedStrips.txt
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
Loading

0 comments on commit 2eeccc8

Please sign in to comment.