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 &, edm::ConsumesCollector &&)
 
const std::map< CaloHitID, float > & getHitsMap ()
 
void const 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
 
const edm::ESGetToken< HcalDDDSimConstants, HcalSimNumberingRecordhcalDDDSimConstantsESToken_
 
const edm::ESGetToken< HcalSimulationConstants, HcalSimNumberingRecordhcalSimulationConstantsESToken_
 
std::unique_ptr< HFShowerLibraryhfshower
 
std::map< CaloHitID, float > hitMap
 
std::string name
 
std::unique_ptr< HcalNumberingFromDDDnumberingFromDDD
 
HcalNumberingScheme numberingScheme
 

Detailed Description

Definition at line 39 of file FastHFShowerLibrary.h.

Constructor & Destructor Documentation

◆ FastHFShowerLibrary()

FastHFShowerLibrary::FastHFShowerLibrary ( edm::ParameterSet const &  p,
edm::ConsumesCollector &&  iC 
)

Definition at line 41 of file FastHFShowerLibrary.cc.

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

43  edm::ParameterSet m_HS = p.getParameter<edm::ParameterSet>("HFShowerLibrary");
44  applyFidCut = m_HS.getParameter<bool>("ApplyFiducialCut");
45 }
const edm::ESGetToken< HcalSimulationConstants, HcalSimNumberingRecord > hcalSimulationConstantsESToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ParameterSet fast
const edm::ESGetToken< HcalDDDSimConstants, HcalSimNumberingRecord > hcalDDDSimConstantsESToken_

◆ ~FastHFShowerLibrary()

FastHFShowerLibrary::~FastHFShowerLibrary ( )
inline

Definition at line 43 of file FastHFShowerLibrary.h.

43 {}

Member Function Documentation

◆ getHitsMap()

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

Definition at line 49 of file FastHFShowerLibrary.h.

References hitMap.

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

49 { return hitMap; };
std::map< CaloHitID, float > hitMap

◆ initHFShowerLibrary()

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

Definition at line 47 of file FastHFShowerLibrary.cc.

References bJpsiMuMuTrigSettings_cff::decays, fast, edm::EventSetup::getData(), hcalConstants, hcalDDDSimConstantsESToken_, HcalSimulationConstants::hcalsimpar(), hcalSimulationConstantsESToken_, hfshower, initializeOnce, name, numberingFromDDD, and AlCaHLTBitMon_QueryRunRegistry::string.

47  {
48  edm::LogInfo("FastCalorimetry") << "initHFShowerLibrary::initialization";
49 
52 
53  std::string name = "HcalHits";
54  numberingFromDDD = std::make_unique<HcalNumberingFromDDD>(hcalConstants);
55  hfshower = std::make_unique<HFShowerLibrary>(name, hcalConstants, hsps->hcalsimpar(), fast);
56 
57  //only one thread can be allowed to setup the G4 physics table.
58  std::call_once(initializeOnce, []() {
59  // Geant4 particles
60  G4DecayPhysics decays;
61  decays.ConstructParticle();
62  G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
63  partTable->SetReadiness();
64  });
65  //G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
66  //hfshower->initRun(partTable, hcalConstants); // init particle code
67 }
const edm::ESGetToken< HcalSimulationConstants, HcalSimNumberingRecord > hcalSimulationConstantsESToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ParameterSet fast
const HcalSimulationParameters * hcalsimpar() const
const edm::ESGetToken< HcalDDDSimConstants, HcalSimNumberingRecord > hcalDDDSimConstantsESToken_
static std::once_flag initializeOnce
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Log< level::Info, false > LogInfo
std::unique_ptr< HFShowerLibrary > hfshower
const HcalDDDSimConstants * hcalConstants

◆ modifyDepth()

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

Definition at line 131 of file FastHFShowerLibrary.cc.

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

Referenced by recoHFShowerLibrary().

131  {
132  if (id.subdet == HcalForward) {
133  int ieta = (id.zside == 0) ? -id.etaR : id.etaR;
134  if (hcalConstants->maxHFDepth(ieta, id.phis) > 2) {
135  if (id.depth <= 2) {
136  if (G4UniformRand() > 0.5)
137  id.depth += 2;
138  }
139  }
140  }
141 }
int maxHFDepth(const int &ieta, const int &iphi) const
const HcalDDDSimConstants * hcalConstants

◆ recoHFShowerLibrary()

void FastHFShowerLibrary::recoHFShowerLibrary ( const FSimTrack myTrack)

Definition at line 76 of file FastHFShowerLibrary.cc.

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().

76  {
77 #ifdef DebugLog
78  edm::LogInfo("FastCalorimetry") << "FastHFShowerLibrary: recoHFShowerLibrary ";
79 #endif
80 
81  if (!myTrack.onVFcal()) {
82 #ifdef DebugLog
83  edm::LogInfo("FastCalorimetry") << "FastHFShowerLibrary: we should not be here ";
84 #endif
85  }
86 
87  hitMap.clear();
88  double eGen = 1000. * myTrack.vfcalEntrance().e(); // energy in [MeV]
89  double delZv = (myTrack.vfcalEntrance().vertex().Z() > 0.0) ? 50.0 : -50.0;
90  G4ThreeVector vertex(10. * myTrack.vfcalEntrance().vertex().X(),
91  10. * myTrack.vfcalEntrance().vertex().Y(),
92  10. * myTrack.vfcalEntrance().vertex().Z() + delZv); // in [mm]
93 
94  G4ThreeVector direction(
95  myTrack.vfcalEntrance().Vect().X(), myTrack.vfcalEntrance().Vect().Y(), myTrack.vfcalEntrance().Vect().Z());
96 
97  bool ok;
98  double weight = 1.0; // rad. damage
99  int parCode = myTrack.type();
100  double tSlice = 0.1 * vertex.mag() / 29.98;
101 
102  std::vector<HFShowerLibrary::Hit> hits =
103  hfshower->fillHits(vertex, direction, parCode, eGen, ok, weight, tSlice, false);
104 
105  for (unsigned int i = 0; i < hits.size(); ++i) {
106  G4ThreeVector pos = hits[i].position;
107  int depth = hits[i].depth;
108  double time = hits[i].time;
109  if (!applyFidCut || (HFFibreFiducial::PMTNumber(pos) > 0)) {
110  // if (!applyFidCut || (applyFidCut && HFFibreFiducial::PMTNumber(pos)>0)) {
111  int det = 5;
112  int lay = 1;
113  uint32_t id = 0;
115  numberingFromDDD->unitID(det, math::XYZVectorD(pos.x(), pos.y(), pos.z()), depth, lay);
116  modifyDepth(tmp);
118 
119  CaloHitID current_id(id, time, myTrack.id());
120  std::map<CaloHitID, float>::iterator cellitr;
121  cellitr = hitMap.find(current_id);
122  if (cellitr == hitMap.end()) {
123  hitMap.insert(std::pair<CaloHitID, float>(current_id, 1.0));
124  } else {
125  cellitr->second += 1.0;
126  }
127  } // end of isItinFidVolume check
128  } // end loop over hits
129 }
std::map< CaloHitID, float > hitMap
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:149
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id)
Definition: weight.py:1
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
HcalNumberingScheme numberingScheme
int onVFcal() const
Definition: FSimTrack.h:121
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Log< level::Info, false > LogInfo
int PMTNumber(const G4ThreeVector &pe_effect)
XYZVector Vect() const
the momentum threevector
Definition: RawParticle.h:323
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
std::unique_ptr< HFShowerLibrary > hfshower
tmp
align.sh
Definition: createJobs.py:716
double e() const
energy of the momentum
Definition: RawParticle.h:305
int id() const
the index in FBaseSimEvent and other vectors
Definition: FSimTrack.h:96
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:320

◆ SetRandom()

void FastHFShowerLibrary::SetRandom ( const RandomEngineAndDistribution rnd)

Definition at line 69 of file FastHFShowerLibrary.cc.

References LogDebug, and RandomEngineAndDistribution::theEngine().

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

69  {
70  // define Geant4 engine per thread
71  G4Random::setTheEngine(&(rnd->theEngine()));
72  LogDebug("FastHFShowerLibrary::recoHFShowerLibrary")
73  << "Begin of event " << G4UniformRand() << " " << rnd->theEngine().name() << " " << rnd->theEngine();
74 }
CLHEP::HepRandomEngine & theEngine() const
#define LogDebug(id)

Member Data Documentation

◆ applyFidCut

bool FastHFShowerLibrary::applyFidCut
private

Definition at line 62 of file FastHFShowerLibrary.h.

Referenced by FastHFShowerLibrary(), and recoHFShowerLibrary().

◆ fast

const edm::ParameterSet FastHFShowerLibrary::fast
private

Definition at line 54 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary().

◆ hcalConstants

const HcalDDDSimConstants* FastHFShowerLibrary::hcalConstants
private

Definition at line 57 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and modifyDepth().

◆ hcalDDDSimConstantsESToken_

const edm::ESGetToken<HcalDDDSimConstants, HcalSimNumberingRecord> FastHFShowerLibrary::hcalDDDSimConstantsESToken_
private

Definition at line 65 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary().

◆ hcalSimulationConstantsESToken_

const edm::ESGetToken<HcalSimulationConstants, HcalSimNumberingRecord> FastHFShowerLibrary::hcalSimulationConstantsESToken_
private

Definition at line 66 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary().

◆ hfshower

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

Definition at line 55 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and recoHFShowerLibrary().

◆ hitMap

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

Definition at line 60 of file FastHFShowerLibrary.h.

Referenced by getHitsMap(), and recoHFShowerLibrary().

◆ name

std::string FastHFShowerLibrary::name
private

Definition at line 63 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 56 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and recoHFShowerLibrary().

◆ numberingScheme

HcalNumberingScheme FastHFShowerLibrary::numberingScheme
private

Definition at line 58 of file FastHFShowerLibrary.h.

Referenced by recoHFShowerLibrary().