Skip to content

Commit

Permalink
Merge pull request #1578 from aburgm/rechit
Browse files Browse the repository at this point in the history
Rechit
  • Loading branch information
nclopezo committed Dec 3, 2013
2 parents d078354 + c346429 commit 73b00d3
Show file tree
Hide file tree
Showing 139 changed files with 20,754 additions and 1,927 deletions.
1 change: 1 addition & 0 deletions GeneratorInterface/ExternalDecays/plugins/BuildFile.xml
Expand Up @@ -3,6 +3,7 @@
<use name="lhapdf"/>
<use name="SimDataFormats/GeneratorProducts"/>
<use name="tauolapp"/>
<use name="clhep"/>
<use name="GeneratorInterface/ExternalDecays"/>
<library file="*.cc" name="GeneratorInterfaceExternalDecaysPlugins">
<flags EDM_PLUGIN="1"/>
Expand Down
30 changes: 29 additions & 1 deletion GeneratorInterface/ExternalDecays/plugins/TauSpinnerCMS.cc
Expand Up @@ -7,9 +7,27 @@
#include "GeneratorInterface/ExternalDecays/interface/read_particles_from_HepMC.h"
#include "TLorentzVector.h"

#include "CLHEP/Random/RandomEngine.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/RandomNumberGenerator.h"
#include "FWCore/Utilities/interface/Exception.h"

using namespace edm;
using namespace TauSpinner;

CLHEP::HepRandomEngine* decayRandomEngine;
extern "C" {
void ranmar_( float *rvec, int *lenv ){
for(int i = 0; i < *lenv; i++)
*rvec++ = decayRandomEngine->flat();
return;
}

void rmarin_( int*, int*, int* ){
return;
}
}

bool TauSpinnerCMS::isTauSpinnerConfigure=false;

TauSpinnerCMS::TauSpinnerCMS( const ParameterSet& pset ) :
Expand All @@ -31,8 +49,18 @@ TauSpinnerCMS::TauSpinnerCMS( const ParameterSet& pset ) :
produces<double>("TauSpinnerWThplus").setBranchAlias("TauSpinnerWThplus");
produces<double>("TauSpinnerWThminus").setBranchAlias("TauSpinnerWThminus");

if(isReco_) EvtHandleToken_ = consumes<HepMCProduct>(gensrc_);
if(!isReco_) EvtHandleToken_ = consumes<HepMCProduct>(gensrc_);
if(isReco_) gensrcToken_= consumes<reco::GenParticleCollection>(gensrc_);

Service<RandomNumberGenerator> rng;
if(!rng.isAvailable()) {
throw cms::Exception("Configuration")
<< "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
"which appears to be absent. Please add that service to your configuration\n"
"or remove the modules that require it." << std::endl;
}
decayRandomEngine = &rng->getEngine();

}

void TauSpinnerCMS::beginJob()
Expand Down
18 changes: 13 additions & 5 deletions GeneratorInterface/ExternalDecays/test/TauSpinnerRecoTest.py
@@ -1,6 +1,6 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("OWNPARTICLES")
process = cms.Process("TEST")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")#https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions#Global_Tags_for_Monte_Carlo_Prod
process.load("FWCore.MessageService.MessageLogger_cfi")
process.load("GeneratorInterface.ExternalDecays.TauSpinner_cfi")
Expand All @@ -11,11 +11,19 @@
DEBUG = cms.untracked.PSet(limit = cms.untracked.int32(-1))
)

process.GlobalTag.globaltag = 'MC_50_V13::All'
numberOfEvents = 1000

numberOfEvents = 100
process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
TauSpinnerReco = cms.PSet(
initialSeed = cms.untracked.uint32(123456789),
engineName = cms.untracked.string('HepJamesRandom')
)
)
process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")

process.GlobalTag.globaltag = 'MC_70_V1::All'

process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring('file:Hadronizer_Et20ExclTuneZ2_7TeV_alpgen_tauola_cff_py_GEN_SIM_DIGI_L1_DIGI2RAW_RAW2DIGI_RECO.root'))
process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring('file:/afs/cern.ch/user/i/inugent/tmp/5C3DF315-CF96-E111-9323-0025B3E05BF4.root'))

process.debugOutput = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('keep *'),
Expand All @@ -24,6 +32,6 @@
process.out_step = cms.EndPath(process.debugOutput)

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(numberOfEvents) )
process.p1 = cms.Path( process.TauSpinnerReco )
process.p1 = cms.Path(process.TauSpinnerReco )
process.schedule = cms.Schedule(process.p1)
process.schedule.append(process.out_step)
11 changes: 7 additions & 4 deletions GeneratorInterface/ExternalDecays/test/TauSpinnerWTest.py
Expand Up @@ -14,10 +14,13 @@
process.load("GeneratorInterface.ExternalDecays.TauSpinner_cfi")

process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
generator = cms.PSet(
initialSeed = cms.untracked.uint32(123456789),
engineName = cms.untracked.string('HepJamesRandom')
)
generator = cms.PSet(initialSeed = cms.untracked.uint32(123456789),
engineName = cms.untracked.string('HepJamesRandom')
),
TauSpinnerGen = cms.PSet(initialSeed = cms.untracked.uint32(123456789),
engineName = cms.untracked.string('HepJamesRandom')

)
)
process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")

Expand Down
18 changes: 7 additions & 11 deletions GeneratorInterface/ExternalDecays/test/TauSpinnerZTest.py
@@ -1,24 +1,20 @@
import FWCore.ParameterSet.Config as cms

#
# WARNING: This is NOT an example for users -
# it's my private (JY) "development" cfg, for testing
# newly implemented PhotosInterface - which is NOT yet
# released via ExternalDecayDeriver
#

process = cms.Process("TEST")
process.load("FWCore.Framework.test.cmsExceptionsFatal_cff")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
#process.load("SimGeneral.HepPDTESSource.pdt_cfi")
process.load("GeneratorInterface.ExternalDecays.TauSpinner_cfi")

process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
generator = cms.PSet(
initialSeed = cms.untracked.uint32(123456789),
engineName = cms.untracked.string('HepJamesRandom')
)
generator = cms.PSet(initialSeed = cms.untracked.uint32(123456789),
engineName = cms.untracked.string('HepJamesRandom')
),
TauSpinnerGen = cms.PSet(initialSeed = cms.untracked.uint32(123456789),
engineName = cms.untracked.string('HepJamesRandom')
)
)

process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")

process.Timing=cms.Service("Timing",
Expand Down
30 changes: 30 additions & 0 deletions TauAnalysis/MCEmbeddingTools/interface/DetNaming.h
@@ -0,0 +1,30 @@
#ifndef TauAnalysis_MCEmbeddingTools_DetNaming_h
#define TauAnalysis_MCEmbeddingTools_DetNaming_h

#include <vector>
#include <string>
#include <map>
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"

#include <boost/foreach.hpp>

class DetNaming
{
public:
DetNaming();
~DetNaming() {}

std::string getKey(const DetId&);
std::vector<std::string> getAllKeys();

private:
typedef std::map<int, std::string > TMyMainMap;
typedef std::map<int, std::map<int, std::string> > TMySubMap;
TMyMainMap detMap_;
TMySubMap subDetMap_;
};


#endif
59 changes: 59 additions & 0 deletions TauAnalysis/MCEmbeddingTools/interface/GenMuonRadiationAlgorithm.h
@@ -0,0 +1,59 @@
#ifndef TauAnalysis_MCEmbeddingTools_GenMuonRadiationAlgorithm_h
#define TauAnalysis_MCEmbeddingTools_GenMuonRadiationAlgorithm_h

/** \class GenMuonRadiationAlgorithm
*
* Auxiliary class to correct for muon --> muon + photon final state radiation (FSR) in selected Z --> mu+ mu- events.
* The FSR is estimated on event-by-event basis via a Monte Carlo technique:
* for each reconstructed muon, PHOTOS is used to obtain a random amount of radiated photon energy.
* The radiated photon energy is then added to the energy of the reconstructed muon
* and the energy of generator level tau leptons is set to the sum.
*
* NOTE: FSR increases with the energy of the muon.
* So, in principle the energy of muon + photon (energy of muon before FSR),
* not the energy of the reconstructed muon (energy of muon after FSR) would need to be used as input to PHOTOS.
* As the amount of radiated photon energy is typically small (< 1 GeV on average),
* taking the energy of the reconstructed muon is a good approximation.
*
* \author Christian Veelken, LLR
*
* \version $Revision: 1.6 $
*
* $Id: GenMuonRadiationAlgorithm.h,v 1.6 2013/01/27 13:53:44 veelken Exp $
*
*/

#include "DataFormats/Candidate/interface/Candidate.h"
#include "GeneratorInterface/Pythia6Interface/interface/Pythia6Service.h"
#include "GeneratorInterface/ExternalDecays/interface/PhotosInterface.h"

#include<string>

class myPythia6ServiceWithCallback;

class GenMuonRadiationAlgorithm
{
public:
explicit GenMuonRadiationAlgorithm(const edm::ParameterSet&);
~GenMuonRadiationAlgorithm();

reco::Candidate::LorentzVector compFSR(const reco::Candidate::LorentzVector&, int, const reco::Candidate::LorentzVector&, int&);

private:
double beamEnergy_;

enum { kPYTHIA, kPHOTOS };
int mode_;

gen::PhotosInterface* photos_;
static bool photos_isInitialized_;

myPythia6ServiceWithCallback* pythia_;
static bool pythia_isInitialized_;

int verbosity_;
};

#endif


46 changes: 46 additions & 0 deletions TauAnalysis/MCEmbeddingTools/interface/L1ExtraMixerPluginBase.h
@@ -0,0 +1,46 @@
#ifndef TauAnalysis_MCEmbeddingTools_L1ExtraMixerPluginBase_h
#define TauAnalysis_MCEmbeddingTools_L1ExtraMixerPluginBase_h

/** \class L1ExtraMEtMixerPluginBase
*
* Abstract base-class for L1ExtraMixerPlugins
*
* \author Christian Veelken, LLR
*
* \version $Revision: 1.2 $
*
* $Id: L1ExtraMixerPluginBase.h,v 1.2 2012/10/14 12:22:48 veelken Exp $
*
*/

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "FWCore/Utilities/interface/Exception.h"

#include <string>

class L1ExtraMixerPluginBase : public edm::EDProducer
{
public:
explicit L1ExtraMixerPluginBase(const edm::ParameterSet&);
~L1ExtraMixerPluginBase() {}

virtual void registerProducts(edm::EDProducer&) = 0;

virtual void produce(edm::Event&, const edm::EventSetup&) = 0;

protected:
edm::InputTag src1_;
edm::InputTag src2_;

std::string instanceLabel_;
};

#include "FWCore/PluginManager/interface/PluginFactory.h"

typedef edmplugin::PluginFactory<L1ExtraMixerPluginBase* (const edm::ParameterSet&)> L1ExtraMixerPluginFactory;

#endif
54 changes: 0 additions & 54 deletions TauAnalysis/MCEmbeddingTools/interface/MCParticleReplacer.h

This file was deleted.

0 comments on commit 73b00d3

Please sign in to comment.