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 ()
 
void const initHFShowerLibrary (const edm::EventSetup &)
 
void modifyDepth (uint32_t &id)
 
void recoHFShowerLibrary (const FSimTrack &myTrack)
 
 ~FastHFShowerLibrary ()
 

Private Attributes

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

Detailed Description

Definition at line 40 of file FastHFShowerLibrary.h.

Constructor & Destructor Documentation

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

Definition at line 42 of file FastHFShowerLibrary.cc.

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

43  : fast(p) {
44  edm::ParameterSet m_HS = p.getParameter<edm::ParameterSet>("HFShowerLibrary");
45  applyFidCut = m_HS.getParameter<bool>("ApplyFiducialCut");
46 }
T getParameter(std::string const &) const
const edm::ParameterSet fast
FastHFShowerLibrary::~FastHFShowerLibrary ( )
inline

Definition at line 46 of file FastHFShowerLibrary.h.

References initHFShowerLibrary(), modifyDepth(), and recoHFShowerLibrary().

46 {;}

Member Function Documentation

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

Definition at line 53 of file FastHFShowerLibrary.h.

References fast, and hitMap.

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

53 { return hitMap; };
std::map< CaloHitID, float > hitMap
void const FastHFShowerLibrary::initHFShowerLibrary ( const edm::EventSetup iSetup)

Definition at line 48 of file FastHFShowerLibrary.cc.

References fast, edm::EventSetup::get(), hcalConstants, hfshower, g4SimHits_cfi::HFShowerLibrary, initializeOnce, name, numberingFromDDD, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FamosManager::setupGeometryAndField(), and ~FastHFShowerLibrary().

48  {
49 
50  edm::LogInfo("FastCalorimetry") << "initHFShowerLibrary::initialization";
51 
53  iSetup.get<IdealGeometryRecord>().get(cpv);
54 
56  iSetup.get<HcalSimNumberingRecord>().get(hdc);
57  hcalConstants = (HcalDDDSimConstants*)(&(*hdc));
58 
59  std::string name = "HcalHits";
61  hfshower.reset(new HFShowerLibrary(name,*cpv,fast));
62 
63  //only one thread can be allowed to setup the G4 physics table.
64  std::call_once(initializeOnce,[]() {
65  // Geant4 particles
66  G4DecayPhysics decays;
67  decays.ConstructParticle();
68  G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
69  partTable->SetReadiness();
70  });
71  G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
72  hfshower->initRun(partTable, hcalConstants); // init particle code
73 }
const edm::ParameterSet fast
static std::once_flag initializeOnce
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
const T & get() const
Definition: EventSetup.h:55
std::unique_ptr< HFShowerLibrary > hfshower
HcalDDDSimConstants * hcalConstants
void FastHFShowerLibrary::modifyDepth ( uint32_t &  id)

Definition at line 131 of file FastHFShowerLibrary.cc.

References HcalDetId::depth(), PVValHelper::eta, hcalConstants, HcalForward, HcalDetId::ieta(), HcalDetId::iphi(), HcalDDDSimConstants::maxHFDepth(), phi, DetId::rawId(), and HcalDetId::subdet().

Referenced by ~FastHFShowerLibrary().

131  {
132 
133  HcalDetId hid(id);
134  if (hid.subdet() == HcalForward) {
135  int eta = hid.ieta();
136  int phi = hid.iphi();
137  if (hcalConstants->maxHFDepth(eta,phi) > 2) {
138  if (hid.depth() <= 2) {
139  int dep = (G4UniformRand() > 0.5) ? (2+hid.depth()) : hid.depth();
140  id = HcalDetId(HcalForward,eta,phi,dep).rawId();
141  }
142  }
143  }
144 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int maxHFDepth(const int &ieta, const int &iphi) const
HcalDDDSimConstants * hcalConstants
void FastHFShowerLibrary::recoHFShowerLibrary ( const FSimTrack myTrack)

Definition at line 75 of file FastHFShowerLibrary.cc.

References applyFidCut, particleFlowClusterECALTimeSelected_cfi::depth, HcalNumberingScheme::getUnitID(), hfshower, hitMap, hfClusterShapes_cfi::hits, mps_fire::i, FSimTrack::id(), numberingFromDDD, numberingScheme, convertSQLiteXML::ok, FSimTrack::onVFcal(), HFFibreFiducial::PMTNumber(), ntuplemaker::time, tmp, CoreSimTrack::type(), RawParticle::vertex(), FSimTrack::vfcalEntrance(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

Referenced by CalorimetryManager::HDShowerSimulation(), CalorimetryManager::reconstruct(), and ~FastHFShowerLibrary().

75  {
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(myTrack.vfcalEntrance().Vect().X(),
95  myTrack.vfcalEntrance().Vect().Y(),
96  myTrack.vfcalEntrance().Vect().Z());
97 
98  bool ok;
99  double weight = 1.0; // rad. damage
100  int parCode = myTrack.type();
101  double tSlice = 0.1*vertex.mag()/29.98;
102 
103  std::vector<HFShowerLibrary::Hit> hits =
104  hfshower->fillHits(vertex,direction,parCode,eGen,ok,weight,tSlice,false);
105 
106  for (unsigned int i=0; i<hits.size(); ++i) {
107  G4ThreeVector pos = hits[i].position;
108  int depth = hits[i].depth;
109  double time = hits[i].time;
110  if (!applyFidCut || (HFFibreFiducial::PMTNumber(pos)>0) ) {
111 // if (!applyFidCut || (applyFidCut && HFFibreFiducial::PMTNumber(pos)>0)) {
112  int det = 5;
113  int lay = 1;
114  uint32_t id = 0;
115  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det, pos, depth, lay);
116  id = numberingScheme.getUnitID(tmp);
117 
118  CaloHitID current_id(id,time,myTrack.id());
119  std::map<CaloHitID,float>::iterator cellitr;
120  cellitr = hitMap.find(current_id);
121  if(cellitr==hitMap.end()) {
122  hitMap.insert(std::pair<CaloHitID,float>(current_id,1.0));
123  } else {
124  cellitr->second += 1.0;
125  }
126  } // end of isItinFidVolume check
127  } // end loop over hits
128 
129 }
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:139
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id)
Definition: weight.py:1
static int PMTNumber(const G4ThreeVector &pe_effect)
HcalNumberingScheme numberingScheme
double Y() const
y of vertex
Definition: RawParticle.h:275
double Z() const
z of vertex
Definition: RawParticle.h:276
int onVFcal() const
Definition: FSimTrack.h:111
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:285
double X() const
x of vertex
Definition: RawParticle.h:274
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:25
std::unique_ptr< HFShowerLibrary > hfshower
int id() const
the index in FBaseSimEvent and other vectors
Definition: FSimTrack.h:86
std::map< CaloHitID, float > hitMap

Member Data Documentation

bool FastHFShowerLibrary::applyFidCut
private

Definition at line 65 of file FastHFShowerLibrary.h.

Referenced by FastHFShowerLibrary(), and recoHFShowerLibrary().

const edm::ParameterSet FastHFShowerLibrary::fast
private

Definition at line 53 of file FastHFShowerLibrary.h.

Referenced by getHitsMap(), and initHFShowerLibrary().

HcalDDDSimConstants* FastHFShowerLibrary::hcalConstants
private

Definition at line 60 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and modifyDepth().

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

Definition at line 58 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and recoHFShowerLibrary().

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

Definition at line 63 of file FastHFShowerLibrary.h.

Referenced by getHitsMap(), and recoHFShowerLibrary().

std::string FastHFShowerLibrary::name
private

Definition at line 66 of file FastHFShowerLibrary.h.

Referenced by ElectronMVAID.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__(), core.autovars.NTupleObjectType::addSubObjects(), core.autovars.NTupleObjectType::addVariables(), core.autovars.NTupleObjectType::allVars(), 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(), Vispa.Views.PropertyView.Property::valueChanged(), counter.Counter::write(), and average.Average::write().

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

Definition at line 59 of file FastHFShowerLibrary.h.

Referenced by initHFShowerLibrary(), and recoHFShowerLibrary().

HcalNumberingScheme FastHFShowerLibrary::numberingScheme
private

Definition at line 61 of file FastHFShowerLibrary.h.

Referenced by recoHFShowerLibrary().