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 42 of file FastHFShowerLibrary.cc.

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

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 47 of file FastHFShowerLibrary.cc.

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

References bJpsiMuMuTrigSettings_cff::decays, fast, edm::EventSetup::get(), get, hcalConstants, HcalDDDSimulationConstants::hcalsimpar(), hfshower, Calorimetry_cff::HFShowerLibrary, 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 136 of file FastHFShowerLibrary.cc.

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

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

Referenced by recoHFShowerLibrary().

◆ recoHFShowerLibrary()

void FastHFShowerLibrary::recoHFShowerLibrary ( const FSimTrack myTrack)

Definition at line 81 of file FastHFShowerLibrary.cc.

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

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(), ntuplemaker::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 74 of file FastHFShowerLibrary.cc.

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

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
HcalDDDSimulationConstants::hcalsimpar
const HcalSimulationParameters * hcalsimpar() const
Definition: HcalDDDSimulationConstants.h:20
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:355
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
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HcalNumberingFromDDD
Definition: HcalNumberingFromDDD.h:16
pos
Definition: PixelAliasList.h:18
edm::LogInfo
Definition: MessageLogger.h:254
FastHFShowerLibrary::numberingScheme
HcalNumberingScheme numberingScheme
Definition: FastHFShowerLibrary.h:57
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
FSimTrack::vfcalEntrance
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:149
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:670
edm::ParameterSet
Definition: ParameterSet.h:36
Calorimetry_cff.HFShowerLibrary
HFShowerLibrary
Definition: Calorimetry_cff.py:269
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
HcalDDDSimulationConstants
Definition: HcalDDDSimulationConstants.h:15
HcalForward
Definition: HcalAssistant.h:36
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
FastHFShowerLibrary::modifyDepth
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
Definition: FastHFShowerLibrary.cc:136
RawParticle::e
double e() const
energy of the momentum
Definition: RawParticle.h:305
initializeOnce
static std::once_flag initializeOnce
Definition: FastHFShowerLibrary.cc:40
CaloHitID
Definition: CaloHitID.h:11
FastHFShowerLibrary::numberingFromDDD
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: FastHFShowerLibrary.h:55
FastHFShowerLibrary::hfshower
std::unique_ptr< HFShowerLibrary > hfshower
Definition: FastHFShowerLibrary.h:54
ntuplemaker.time
time
Definition: ntuplemaker.py:310
HcalSimNumberingRecord
Definition: HcalSimNumberingRecord.h:25
FastHFShowerLibrary::applyFidCut
bool applyFidCut
Definition: FastHFShowerLibrary.h:61
weight
Definition: weight.py:1