CMS 3D CMS Logo

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

#include <FiberSD.h>

Inheritance diagram for FiberSD:
SensitiveCaloDetector Observer< const BeginOfJob * > Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const EndOfEvent * > SensitiveDetector

Public Member Functions

void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *HCE) override
 
 FiberSD (const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
void fillHits (edm::PCaloHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist) override
 
uint32_t setDetUnitId (const G4Step *) override
 
 ~FiberSD () override
 
- Public Member Functions inherited from SensitiveCaloDetector
virtual void reset ()
 
 SensitiveCaloDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfJob * >
 Observer ()
 
void slotForUpdate (const BeginOfJob * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 

Protected Member Functions

void update (const ::EndOfEvent *) override
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfJob *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfRun *) override
 This routine will be called when the appropriate signal arrives. More...
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 
- Protected Member Functions inherited from Observer< const EndOfEvent * >
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

const SimTrackManagerm_trackManager
 
FiberG4HitsCollectiontheHC
 
G4int theHCID
 
HFShowertheShower
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 

Detailed Description

Definition at line 26 of file FiberSD.h.

Constructor & Destructor Documentation

◆ FiberSD()

FiberSD::FiberSD ( const std::string &  iname,
const edm::EventSetup es,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)
explicit

Definition at line 22 of file FiberSD.cc.

27  : SensitiveCaloDetector(iname, es, clg, p),
28  m_trackManager(manager),
29  theShower(nullptr),
30  theHCID(-1),
31  theHC(nullptr) {
32  edm::LogVerbatim("FiberSim") << "FiberSD : Instantiating for " << iname;
33  // Get pointer to HcalDDDConstants and HcalSimulationConstants
35  es.get<HcalSimNumberingRecord>().get(hdsc);
36  if (!hdsc.isValid()) {
37  edm::LogError("FiberSim") << "FiberSD : Cannot find HcalSimulationConstants";
38  throw cms::Exception("Unknown", "FiberSD") << "Cannot find HcalSimulationConstants\n";
39  }
40  const HcalSimulationConstants* hsps = hdsc.product();
42  es.get<HcalSimNumberingRecord>().get(hdc);
43  if (hdc.isValid()) {
44  const HcalDDDSimConstants* hcalConstants = hdc.product();
45  theShower = new HFShower(iname, hcalConstants, hsps->hcalsimpar(), p, 1);
46  } else {
47  edm::LogError("FiberSim") << "FiberSD : Cannot find HcalDDDSimConstant";
48  throw cms::Exception("Unknown", "FiberSD") << "Cannot find HcalDDDSimConstant\n";
49  }
50 }

References Exception, edm::EventSetup::get(), get, HcalSimulationConstants::hcalsimpar(), Calorimetry_cff::HFShower, edm::ESHandleBase::isValid(), AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), and theShower.

◆ ~FiberSD()

FiberSD::~FiberSD ( )
override

Definition at line 52 of file FiberSD.cc.

52  {
53  delete theShower;
54  delete theHC;
55 }

References theHC, and theShower.

Member Function Documentation

◆ clear()

void FiberSD::clear ( void  )
override

Definition at line 118 of file FiberSD.cc.

118 {}

Referenced by EndOfEvent().

◆ clearHits()

void FiberSD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 132 of file FiberSD.cc.

132 {}

◆ DrawAll()

void FiberSD::DrawAll ( )
override

Definition at line 120 of file FiberSD.cc.

120 {}

◆ EndOfEvent()

void FiberSD::EndOfEvent ( G4HCofThisEvent *  HCE)
override

Definition at line 112 of file FiberSD.cc.

112  {
113  edm::LogVerbatim("FiberSim") << "FiberSD: finds " << theHC->entries() << " hits";
114  clear();
115  edm::LogVerbatim("FiberSim") << "theHC entries = " << theHC->entries();
116 }

References clear(), and theHC.

◆ fillHits()

void FiberSD::fillHits ( edm::PCaloHitContainer ,
const std::string &   
)
overridevirtual

Implements SensitiveCaloDetector.

Definition at line 142 of file FiberSD.cc.

142 {}

◆ Initialize()

void FiberSD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 57 of file FiberSD.cc.

57  {
58  edm::LogVerbatim("FiberSim") << "FiberSD : Initialize called for " << GetName() << " in collection " << HCE;
59  theHC = new FiberG4HitsCollection(GetName(), collectionName[0]);
60  if (theHCID < 0)
61  theHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
62  HCE->AddHitsCollection(theHCID, theHC);
63  edm::LogVerbatim("FiberSim") << "FiberSD : Add hit collectrion for " << collectionName[0] << ":" << theHCID << ":"
64  << theHC;
65 }

References bysipixelclustmulteventfilter_cfi::collectionName, theHC, and theHCID.

◆ PrintAll()

void FiberSD::PrintAll ( )
override

Definition at line 122 of file FiberSD.cc.

122 {}

◆ ProcessHits()

G4bool FiberSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  ROhist 
)
overridevirtual

Implements SensitiveDetector.

Definition at line 67 of file FiberSD.cc.

67  {
68  //std::vector<HFShower::Hit> hits = theShower->getHits(aStep);
69  double zoffset = 1000;
70  std::vector<HFShower::Hit> hits = theShower->getHits(aStep, true, zoffset);
71 
72  if (!hits.empty()) {
73  std::vector<HFShowerPhoton> thePE;
74  for (unsigned int i = 0; i < hits.size(); i++) {
75  //edm::LogVerbatim("FiberSim") << "FiberSD :hit position z " << hits[i].position.z();
77  hits[i].position.x(), hits[i].position.y(), hits[i].position.z(), hits[i].wavelength, hits[i].time);
78  thePE.push_back(pe);
79  }
80  int trackID = aStep->GetTrack()->GetTrackID();
81  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
82  const G4VTouchable* touch = preStepPoint->GetTouchable();
83  G4LogicalVolume* lv = touch->GetVolume(0)->GetLogicalVolume();
84  int depth = (touch->GetReplicaNumber(0)) % 10;
85  int detID = setDetUnitId(aStep);
86  math::XYZPoint theHitPos(
87  preStepPoint->GetPosition().x(), preStepPoint->GetPosition().y(), preStepPoint->GetPosition().z());
88  //edm::LogVerbatim("FiberSim") << "FiberSD :presteppoint position z " << preStepPoint->GetPosition().z();
89 
90  FiberG4Hit* aHit = new FiberG4Hit(lv, detID, depth, trackID);
91  edm::LogVerbatim("FiberSim") << "FiberSD :hit size " << hits.size() << " npe" << aHit->npe();
92  edm::LogVerbatim("FiberSim") << "FiberSD :pre hit position " << aHit->hitPos();
93  aHit->setNpe(hits.size());
94  aHit->setPos(theHitPos);
95  aHit->setTime(preStepPoint->GetGlobalTime());
96  aHit->setPhoton(thePE);
97  edm::LogVerbatim("FiberSim") << "FiberSD :ShowerPhoton position " << thePE[0].x() << " " << thePE[0].y() << " "
98  << thePE[0].z();
99 
100  edm::LogVerbatim("FiberSim") << "FiberSD: Hit created at " << lv->GetName() << " DetID: " << aHit->towerId()
101  << " Depth: " << aHit->depth() << " Track ID: " << aHit->trackId()
102  << " Nb. of Cerenkov Photons: " << aHit->npe() << " Time: " << aHit->time() << " at "
103  << aHit->hitPos();
104  for (unsigned int i = 0; i < thePE.size(); i++)
105  edm::LogVerbatim("FiberSim") << "FiberSD: PE[" << i << "] " << thePE[i];
106 
107  theHC->insert(aHit);
108  }
109  return true;
110 }

References LEDCalibrationChannels::depth, HFShower::getHits(), hfClusterShapes_cfi::hits, mps_fire::i, position, setDetUnitId(), theHC, and theShower.

◆ setDetUnitId()

uint32_t FiberSD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 134 of file FiberSD.cc.

134  {
135  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
136  int fibre = (touch->GetReplicaNumber(1)) % 10;
137  int cell = (touch->GetReplicaNumber(2));
138  int tower = (touch->GetReplicaNumber(3));
139  return ((tower * 1000 + cell) * 10 + fibre);
140 }

References hgcalTowerProducer_cfi::tower.

Referenced by ProcessHits().

◆ update() [1/4]

void FiberSD::update ( const ::EndOfEvent )
overrideprotected

◆ update() [2/4]

void FiberSD::update ( const BeginOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 128 of file FiberSD.cc.

128 {}

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [3/4]

void FiberSD::update ( const BeginOfJob )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 124 of file FiberSD.cc.

124 {}

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [4/4]

void FiberSD::update ( const BeginOfRun )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 126 of file FiberSD.cc.

126 {}

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ m_trackManager

const SimTrackManager* FiberSD::m_trackManager
private

Definition at line 57 of file FiberSD.h.

◆ theHC

FiberG4HitsCollection* FiberSD::theHC
private

Definition at line 61 of file FiberSD.h.

Referenced by EndOfEvent(), Initialize(), ProcessHits(), and ~FiberSD().

◆ theHCID

G4int FiberSD::theHCID
private

Definition at line 60 of file FiberSD.h.

Referenced by Initialize().

◆ theShower

HFShower* FiberSD::theShower
private

Definition at line 58 of file FiberSD.h.

Referenced by FiberSD(), ProcessHits(), and ~FiberSD().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:428
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FiberSD::theHC
FiberG4HitsCollection * theHC
Definition: FiberSD.h:61
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
FiberSD::clear
void clear() override
Definition: FiberSD.cc:118
FiberSD::m_trackManager
const SimTrackManager * m_trackManager
Definition: FiberSD.h:57
FiberG4Hit
Definition: FiberG4Hit.h:14
HcalDDDSimConstants
Definition: HcalDDDSimConstants.h:24
HcalSimulationConstants::hcalsimpar
const HcalSimulationParameters * hcalsimpar() const
Definition: HcalSimulationConstants.h:20
Calorimetry_cff.HFShower
HFShower
Definition: Calorimetry_cff.py:265
SensitiveCaloDetector::SensitiveCaloDetector
SensitiveCaloDetector(const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
Definition: SensitiveCaloDetector.h:12
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
FiberSD::theHCID
G4int theHCID
Definition: FiberSD.h:60
HcalSimulationConstants
Definition: HcalSimulationConstants.h:15
edm::ESHandle
Definition: DTSurvey.h:22
bysipixelclustmulteventfilter_cfi.collectionName
collectionName
Definition: bysipixelclustmulteventfilter_cfi.py:5
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
FiberSD::theShower
HFShower * theShower
Definition: FiberSD.h:58
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:245
HFShowerPhoton
Definition: HFShowerPhoton.h:13
HFShower::getHits
std::vector< Hit > getHits(const G4Step *aStep, double weight)
Definition: HFShower.cc:43
edm::Log
Definition: MessageLogger.h:70
HcalSimNumberingRecord
Definition: HcalSimNumberingRecord.h:25
FiberG4HitsCollection
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
Definition: FiberG4Hit.h:54
FiberSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *) override
Definition: FiberSD.cc:134