CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
FastHFShowerLibrary Class Reference

#include <FastHFShowerLibrary.h>

Public Member Functions

 FastHFShowerLibrary (edm::ParameterSet const &p)
 
const std::map< CaloHitID, float > & getHitsMap ()
 
const void initHFShowerLibrary (const edm::EventSetup &)
 
void modifyDepth (HcalNumberingFromDDD::HcalID &id)
 
void recoHFShowerLibrary (const FSimTrack &myTrack)
 
void SetRandom (const RandomEngineAndDistribution *)
 
 ~FastHFShowerLibrary ()
 

Private Attributes

bool applyFidCut
 
const edm::ParameterSet fast
 
const HcalDDDSimConstantshcalConstants
 
std::unique_ptr< HFShowerLibraryhfshower
 
std::map< CaloHitID, float > hitMap
 
std::string name
 
std::unique_ptr< HcalNumberingFromDDDnumberingFromDDD
 
HcalNumberingScheme numberingScheme
 

Detailed Description

Definition at line 38 of file FastHFShowerLibrary.h.

Constructor & Destructor Documentation

◆ FastHFShowerLibrary()

FastHFShowerLibrary::FastHFShowerLibrary ( edm::ParameterSet const &  p)

Definition at line 44 of file FastHFShowerLibrary.cc.

44  : fast(p) {
45  edm::ParameterSet m_HS = p.getParameter<edm::ParameterSet>("HFShowerLibrary");
46  applyFidCut = m_HS.getParameter<bool>("ApplyFiducialCut");
47 }

References applyFidCut, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_ParallelJobs::p.

◆ ~FastHFShowerLibrary()

FastHFShowerLibrary::~FastHFShowerLibrary ( )
inline

Definition at line 42 of file FastHFShowerLibrary.h.

42 { ; }

Member Function Documentation

◆ getHitsMap()

const std::map<CaloHitID, float>& FastHFShowerLibrary::getHitsMap ( )
inline

Definition at line 48 of file FastHFShowerLibrary.h.

48 { return hitMap; };

References hitMap.

Referenced by CalorimetryManager::HDShowerSimulation(), and CalorimetryManager::reconstructTrack().

◆ initHFShowerLibrary()

const void FastHFShowerLibrary::initHFShowerLibrary ( const edm::EventSetup iSetup)

Definition at line 49 of file FastHFShowerLibrary.cc.

49  {
50  edm::LogInfo("FastCalorimetry") << "initHFShowerLibrary::initialization";
51 
53  iSetup.get<HcalSimNumberingRecord>().get(hdc);
54  hcalConstants = hdc.product();
55 
57  iSetup.get<HcalSimNumberingRecord>().get(hdsc);
58  const HcalSimulationConstants* hsps = hdsc.product();
59 
60  std::string name = "HcalHits";
61  numberingFromDDD = std::make_unique<HcalNumberingFromDDD>(hcalConstants);
62  hfshower = std::make_unique<HFShowerLibrary>(name, hcalConstants, hsps->hcalsimpar(), fast);
63 
64  //only one thread can be allowed to setup the G4 physics table.
65  std::call_once(initializeOnce, []() {
66  // Geant4 particles
67  G4DecayPhysics decays;
68  decays.ConstructParticle();
69  G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
70  partTable->SetReadiness();
71  });
72  //G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
73  //hfshower->initRun(partTable, hcalConstants); // init particle code
74 }

References bJpsiMuMuTrigSettings_cff::decays, fast, edm::EventSetup::get(), get, hcalConstants, HcalSimulationConstants::hcalsimpar(), hfshower, initializeOnce, name, numberingFromDDD, edm::ESHandle< T >::product(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FamosManager::setupGeometryAndField().

◆ modifyDepth()

void FastHFShowerLibrary::modifyDepth ( HcalNumberingFromDDD::HcalID id)

Definition at line 138 of file FastHFShowerLibrary.cc.

138  {
139  if (id.subdet == HcalForward) {
140  int ieta = (id.zside == 0) ? -id.etaR : id.etaR;
141  if (hcalConstants->maxHFDepth(ieta, id.phis) > 2) {
142  if (id.depth <= 2) {
143  if (G4UniformRand() > 0.5)
144  id.depth += 2;
145  }
146  }
147  }
148 }

References LEDCalibrationChannels::depth, hcalConstants, HcalForward, LEDCalibrationChannels::ieta, and HcalDDDSimConstants::maxHFDepth().

Referenced by recoHFShowerLibrary().

◆ recoHFShowerLibrary()

void FastHFShowerLibrary::recoHFShowerLibrary ( const FSimTrack myTrack)

Definition at line 83 of file FastHFShowerLibrary.cc.

83  {
84 #ifdef DebugLog
85  edm::LogInfo("FastCalorimetry") << "FastHFShowerLibrary: recoHFShowerLibrary ";
86 #endif
87 
88  if (!myTrack.onVFcal()) {
89 #ifdef DebugLog
90  edm::LogInfo("FastCalorimetry") << "FastHFShowerLibrary: we should not be here ";
91 #endif
92  }
93 
94  hitMap.clear();
95  double eGen = 1000. * myTrack.vfcalEntrance().e(); // energy in [MeV]
96  double delZv = (myTrack.vfcalEntrance().vertex().Z() > 0.0) ? 50.0 : -50.0;
97  G4ThreeVector vertex(10. * myTrack.vfcalEntrance().vertex().X(),
98  10. * myTrack.vfcalEntrance().vertex().Y(),
99  10. * myTrack.vfcalEntrance().vertex().Z() + delZv); // in [mm]
100 
101  G4ThreeVector direction(
102  myTrack.vfcalEntrance().Vect().X(), myTrack.vfcalEntrance().Vect().Y(), myTrack.vfcalEntrance().Vect().Z());
103 
104  bool ok;
105  double weight = 1.0; // rad. damage
106  int parCode = myTrack.type();
107  double tSlice = 0.1 * vertex.mag() / 29.98;
108 
109  std::vector<HFShowerLibrary::Hit> hits =
110  hfshower->fillHits(vertex, direction, parCode, eGen, ok, weight, tSlice, false);
111 
112  for (unsigned int i = 0; i < hits.size(); ++i) {
113  G4ThreeVector pos = hits[i].position;
114  int depth = hits[i].depth;
115  double time = hits[i].time;
116  if (!applyFidCut || (HFFibreFiducial::PMTNumber(pos) > 0)) {
117  // if (!applyFidCut || (applyFidCut && HFFibreFiducial::PMTNumber(pos)>0)) {
118  int det = 5;
119  int lay = 1;
120  uint32_t id = 0;
122  numberingFromDDD->unitID(det, math::XYZVectorD(pos.x(), pos.y(), pos.z()), depth, lay);
123  modifyDepth(tmp);
125 
126  CaloHitID current_id(id, time, myTrack.id());
127  std::map<CaloHitID, float>::iterator cellitr;
128  cellitr = hitMap.find(current_id);
129  if (cellitr == hitMap.end()) {
130  hitMap.insert(std::pair<CaloHitID, float>(current_id, 1.0));
131  } else {
132  cellitr->second += 1.0;
133  }
134  } // end of isItinFidVolume check
135  } // end loop over hits
136 }

References applyFidCut, LEDCalibrationChannels::depth, RawParticle::e(), HcalNumberingScheme::getUnitID(), hfshower, hitMap, hfClusterShapes_cfi::hits, mps_fire::i, FSimTrack::id(), modifyDepth(), numberingFromDDD, numberingScheme, convertSQLiteXML::ok, FSimTrack::onVFcal(), HFFibreFiducial::PMTNumber(), protons_cff::time, createJobs::tmp, CoreSimTrack::type(), RawParticle::Vect(), bphysicsOniaDQM_cfi::vertex, RawParticle::vertex(), and FSimTrack::vfcalEntrance().

Referenced by CalorimetryManager::HDShowerSimulation(), and CalorimetryManager::reconstructTrack().

◆ SetRandom()

void FastHFShowerLibrary::SetRandom ( const RandomEngineAndDistribution rnd)

Definition at line 76 of file FastHFShowerLibrary.cc.

76  {
77  // define Geant4 engine per thread
78  G4Random::setTheEngine(&(rnd->theEngine()));
79  LogDebug("FastHFShowerLibrary::recoHFShowerLibrary")
80  << "Begin of event " << G4UniformRand() << " " << rnd->theEngine().name() << " " << rnd->theEngine();
81 }

References LogDebug, and RandomEngineAndDistribution::theEngine().

Referenced by CalorimetryManager::HDShowerSimulation(), and CalorimetryManager::initialize().

Member Data Documentation

◆ applyFidCut

bool FastHFShowerLibrary::applyFidCut
private

Definition at line 61 of file FastHFShowerLibrary.h.

Referenced by FastHFShowerLibrary(), and recoHFShowerLibrary().

◆ fast

const edm::ParameterSet FastHFShowerLibrary::fast
private

Definition at line 53 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary().

◆ hcalConstants

const HcalDDDSimConstants* FastHFShowerLibrary::hcalConstants
private

Definition at line 56 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and modifyDepth().

◆ hfshower

std::unique_ptr<HFShowerLibrary> FastHFShowerLibrary::hfshower
private

Definition at line 54 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and recoHFShowerLibrary().

◆ hitMap

std::map<CaloHitID, float> FastHFShowerLibrary::hitMap
private

Definition at line 59 of file FastHFShowerLibrary.h.

Referenced by getHitsMap(), and recoHFShowerLibrary().

◆ name

std::string FastHFShowerLibrary::name
private

Definition at line 62 of file FastHFShowerLibrary.h.

Referenced by ElectronMVAID.ElectronMVAID::__call__(), FWLite.ElectronMVAID::__call__(), dirstructure.Directory::__create_pie_image(), DisplayManager.DisplayManager::__del__(), dqm_interfaces.DirID::__eq__(), dirstructure.Directory::__get_full_path(), dirstructure.Comparison::__get_img_name(), dataset.Dataset::__getDataType(), dataset.Dataset::__getFileInfoList(), dirstructure.Comparison::__make_image(), core.autovars.NTupleVariable::__repr__(), core.autovars.NTupleObjectType::__repr__(), core.autovars.NTupleObject::__repr__(), core.autovars.NTupleCollection::__repr__(), dirstructure.Directory::__repr__(), dqm_interfaces.DirID::__repr__(), dirstructure.Comparison::__repr__(), config.Service::__setattr__(), config.CFG::__str__(), counter.Counter::__str__(), average.Average::__str__(), FWLite.WorkingPoints::_reformat_cut_definitions(), core.autovars.NTupleObjectType::addSubObjects(), core.autovars.NTupleObjectType::addVariables(), core.autovars.NTupleObjectType::allVars(), dataset.CMSDataset::buildListOfFiles(), dataset.LocalDataset::buildListOfFiles(), dataset.CMSDataset::buildListOfFilesDBS(), dirstructure.Directory::calcStats(), validation.Sample::digest(), python.rootplot.utilities.Hist::divide(), python.rootplot.utilities.Hist::divide_wilson(), DisplayManager.DisplayManager::Draw(), TreeCrawler.Package::dump(), core.autovars.NTupleVariable::fillBranch(), core.autovars.NTupleObject::fillBranches(), core.autovars.NTupleCollection::fillBranchesScalar(), core.autovars.NTupleCollection::fillBranchesVector(), core.autovars.NTupleCollection::get_cpp_declaration(), core.autovars.NTupleCollection::get_cpp_wrapper_class(), core.autovars.NTupleCollection::get_py_wrapper_class(), utils.StatisticalTest::get_status(), production_tasks.Task::getname(), dataset.CMSDataset::getPrimaryDatasetEntries(), dataset.PrivateDataset::getPrimaryDatasetEntries(), initHFShowerLibrary(), VIDSelectorBase.VIDSelectorBase::initialize(), core.autovars.NTupleVariable::makeBranch(), core.autovars.NTupleObject::makeBranches(), core.autovars.NTupleCollection::makeBranchesScalar(), core.autovars.NTupleCollection::makeBranchesVector(), dirstructure.Directory::print_report(), dataset.BaseDataset::printInfo(), dataset.Dataset::printInfo(), production_tasks.MonitorJobs::run(), python.rootplot.utilities.Hist::TGraph(), python.rootplot.utilities.Hist::TH1F(), counter.Counter::write(), and average.Average::write().

◆ numberingFromDDD

std::unique_ptr<HcalNumberingFromDDD> FastHFShowerLibrary::numberingFromDDD
private

Definition at line 55 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and recoHFShowerLibrary().

◆ numberingScheme

HcalNumberingScheme FastHFShowerLibrary::numberingScheme
private

Definition at line 57 of file FastHFShowerLibrary.h.

Referenced by recoHFShowerLibrary().

FastHFShowerLibrary::hcalConstants
const HcalDDDSimConstants * hcalConstants
Definition: FastHFShowerLibrary.h:56
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FastHFShowerLibrary::fast
const edm::ParameterSet fast
Definition: FastHFShowerLibrary.h:53
HcalNumberingScheme::getUnitID
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id)
Definition: HcalNumberingScheme.cc:19
bJpsiMuMuTrigSettings_cff.decays
decays
Definition: bJpsiMuMuTrigSettings_cff.py:15
mps_fire.i
i
Definition: mps_fire.py:428
HcalNumberingFromDDD::HcalID
Definition: HcalNumberingFromDDD.h:21
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
RawParticle::vertex
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:320
pos
Definition: PixelAliasList.h:18
protons_cff.time
time
Definition: protons_cff.py:35
FastHFShowerLibrary::numberingScheme
HcalNumberingScheme numberingScheme
Definition: FastHFShowerLibrary.h:57
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
HFFibreFiducial::PMTNumber
int PMTNumber(const G4ThreeVector &pe_effect)
Definition: HFFibreFiducial.cc:9
FastHFShowerLibrary::name
std::string name
Definition: FastHFShowerLibrary.h:62
HcalSimulationConstants::hcalsimpar
const HcalSimulationParameters * hcalsimpar() const
Definition: HcalSimulationConstants.h:20
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
FSimTrack::vfcalEntrance
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:149
HcalSimulationConstants
Definition: HcalSimulationConstants.h:15
edm::ESHandle
Definition: DTSurvey.h:22
FSimTrack::onVFcal
int onVFcal() const
Definition: FSimTrack.h:121
HcalDDDSimConstants::maxHFDepth
int maxHFDepth(const int &ieta, const int &iphi) const
Definition: HcalDDDSimConstants.cc:655
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
RawParticle::Vect
XYZVector Vect() const
the momentum threevector
Definition: RawParticle.h:323
FastHFShowerLibrary::hitMap
std::map< CaloHitID, float > hitMap
Definition: FastHFShowerLibrary.h:59
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
FSimTrack::id
int id() const
the index in FBaseSimEvent and other vectors
Definition: FSimTrack.h:96
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CoreSimTrack::type
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
get
#define get
RandomEngineAndDistribution::theEngine
CLHEP::HepRandomEngine & theEngine() const
Definition: RandomEngineAndDistribution.h:25
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalForward
Definition: HcalAssistant.h:36
FastHFShowerLibrary::modifyDepth
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
Definition: FastHFShowerLibrary.cc:138
RawParticle::e
double e() const
energy of the momentum
Definition: RawParticle.h:305
initializeOnce
static std::once_flag initializeOnce
Definition: FastHFShowerLibrary.cc:42
CaloHitID
Definition: CaloHitID.h:11
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
FastHFShowerLibrary::numberingFromDDD
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: FastHFShowerLibrary.h:55
FastHFShowerLibrary::hfshower
std::unique_ptr< HFShowerLibrary > hfshower
Definition: FastHFShowerLibrary.h:54
HcalSimNumberingRecord
Definition: HcalSimNumberingRecord.h:25
FastHFShowerLibrary::applyFidCut
bool applyFidCut
Definition: FastHFShowerLibrary.h:61
weight
Definition: weight.py:1