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 HcalSimulationConstants *, const HcalDDDSimConstants *, 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 SensitiveDetectorCatalog &clg)
 
- 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 SensitiveDetectorCatalog &, 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 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...
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const ::EndOfEvent *) override
 
- 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

FiberG4HitsCollectiontheHC
 
G4int theHCID
 
HFShowertheShower
 

Additional Inherited Members

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

Detailed Description

Definition at line 29 of file FiberSD.h.

Constructor & Destructor Documentation

◆ FiberSD()

FiberSD::FiberSD ( const std::string &  iname,
const HcalSimulationConstants hsps,
const HcalDDDSimConstants hdc,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)
explicit

Definition at line 22 of file FiberSD.cc.

References HcalSimulationConstants::hcalsimpar(), Calorimetry_cff::HFShower, AlCaHLTBitMon_ParallelJobs::p, and theShower.

28  : SensitiveCaloDetector(iname, clg), theShower(nullptr), theHCID(-1), theHC(nullptr) {
29  edm::LogVerbatim("FiberSim") << "FiberSD : Instantiating for " << iname;
30  // Get pointer to HcalDDDConstants and HcalSimulationConstants
31  theShower = new HFShower(iname, hdc, hsps->hcalsimpar(), p, 1);
32 }
Log< level::Info, true > LogVerbatim
const HcalSimulationParameters * hcalsimpar() const
SensitiveCaloDetector(const std::string &iname, const SensitiveDetectorCatalog &clg)
HFShower * theShower
Definition: FiberSD.h:61
FiberG4HitsCollection * theHC
Definition: FiberSD.h:64
G4int theHCID
Definition: FiberSD.h:63

◆ ~FiberSD()

FiberSD::~FiberSD ( )
override

Definition at line 34 of file FiberSD.cc.

References theHC, and theShower.

34  {
35  delete theShower;
36  delete theHC;
37 }
HFShower * theShower
Definition: FiberSD.h:61
FiberG4HitsCollection * theHC
Definition: FiberSD.h:64

Member Function Documentation

◆ clear()

void FiberSD::clear ( void  )
override

Definition at line 104 of file FiberSD.cc.

Referenced by EndOfEvent().

104 {}

◆ clearHits()

void FiberSD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 118 of file FiberSD.cc.

118 {}

◆ DrawAll()

void FiberSD::DrawAll ( )
override

Definition at line 106 of file FiberSD.cc.

106 {}

◆ EndOfEvent()

void FiberSD::EndOfEvent ( G4HCofThisEvent *  HCE)
override

Definition at line 98 of file FiberSD.cc.

References clear(), and theHC.

98  {
99  edm::LogVerbatim("FiberSim") << "FiberSD: finds " << theHC->entries() << " hits";
100  clear();
101  edm::LogVerbatim("FiberSim") << "theHC entries = " << theHC->entries();
102 }
Log< level::Info, true > LogVerbatim
FiberG4HitsCollection * theHC
Definition: FiberSD.h:64
void clear() override
Definition: FiberSD.cc:104

◆ fillHits()

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

Implements SensitiveCaloDetector.

Definition at line 128 of file FiberSD.cc.

128 {}

◆ Initialize()

void FiberSD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 39 of file FiberSD.cc.

References bysipixelclustmulteventfilter_cfi::collectionName, theHC, and theHCID.

39  {
40  edm::LogVerbatim("FiberSim") << "FiberSD : Initialize called for " << GetName() << " in collection "
41  << HCE;
42  theHC = new FiberG4HitsCollection(GetName(), collectionName[0]);
43  if (theHCID < 0)
44  theHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
45  HCE->AddHitsCollection(theHCID, theHC);
46  edm::LogVerbatim("FiberSim") << "FiberSD : Add hit collectrion for " << collectionName[0] << ":"
47  << theHCID << ":" << theHC;
48 }
Log< level::Info, true > LogVerbatim
FiberG4HitsCollection * theHC
Definition: FiberSD.h:64
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
Definition: FiberG4Hit.h:54
G4int theHCID
Definition: FiberSD.h:63

◆ PrintAll()

void FiberSD::PrintAll ( )
override

Definition at line 108 of file FiberSD.cc.

108 {}

◆ ProcessHits()

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

Implements SensitiveDetector.

Definition at line 50 of file FiberSD.cc.

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

50  {
51  //std::vector<HFShower::Hit> hits = theShower->getHits(aStep);
52  double zoffset = 1000;
53  std::vector<HFShower::Hit> hits = theShower->getHits(aStep, true, zoffset);
54 
55  if (!hits.empty()) {
56  std::vector<HFShowerPhoton> thePE;
57  for (unsigned int i = 0; i < hits.size(); i++) {
58  //edm::LogVerbatim("FiberSim") << "FiberSD :hit position z " << hits[i].position.z();
60  hits[i].position.x(), hits[i].position.y(), hits[i].position.z(), hits[i].wavelength, hits[i].time);
61  thePE.push_back(pe);
62  }
63  int trackID = aStep->GetTrack()->GetTrackID();
64  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
65  const G4VTouchable* touch = preStepPoint->GetTouchable();
66  G4LogicalVolume* lv = touch->GetVolume(0)->GetLogicalVolume();
67  int depth = (touch->GetReplicaNumber(0)) % 10;
68  int detID = setDetUnitId(aStep);
69  math::XYZPoint theHitPos(
70  preStepPoint->GetPosition().x(), preStepPoint->GetPosition().y(), preStepPoint->GetPosition().z());
71  //edm::LogVerbatim("FiberSim") << "FiberSD :presteppoint position z " << preStepPoint->GetPosition().z();
72 
73  FiberG4Hit* aHit = new FiberG4Hit(lv, detID, depth, trackID);
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("FiberSim") << "FiberSD :hit size " << hits.size() << " npe" << aHit->npe();
76  edm::LogVerbatim("FiberSim") << "FiberSD :pre hit position " << aHit->hitPos();
77 #endif
78  aHit->setNpe(hits.size());
79  aHit->setPos(theHitPos);
80  aHit->setTime(preStepPoint->GetGlobalTime());
81  aHit->setPhoton(thePE);
82 #ifdef EDM_ML_DEBUG
83  edm::LogVerbatim("FiberSim") << "FiberSD :ShowerPhoton position " << thePE[0].x() << " "
84  << thePE[0].y() << " " << thePE[0].z();
85 
86  edm::LogVerbatim("FiberSim") << "FiberSD: Hit created at " << lv->GetName()
87  << " DetID: " << aHit->towerId() << " Depth: " << aHit->depth()
88  << " Track ID: " << aHit->trackId() << " Nb. of Cerenkov Photons: " << aHit->npe()
89  << " Time: " << aHit->time() << " at " << aHit->hitPos();
90  for (unsigned int i = 0; i < thePE.size(); i++)
91  edm::LogVerbatim("FiberSim") << "FiberSD: PE[" << i << "] " << thePE[i];
92 #endif
93  theHC->insert(aHit);
94  }
95  return true;
96 }
Log< level::Info, true > LogVerbatim
uint32_t setDetUnitId(const G4Step *) override
Definition: FiberSD.cc:120
std::vector< Hit > getHits(const G4Step *aStep, double weight)
Definition: HFShower.cc:45
HFShower * theShower
Definition: FiberSD.h:61
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
FiberG4HitsCollection * theHC
Definition: FiberSD.h:64
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ setDetUnitId()

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

Implements SensitiveDetector.

Definition at line 120 of file FiberSD.cc.

References l1tHGCalTowerProducer_cfi::tower.

Referenced by ProcessHits().

120  {
121  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
122  int fibre = (touch->GetReplicaNumber(1)) % 10;
123  int cell = (touch->GetReplicaNumber(2));
124  int tower = (touch->GetReplicaNumber(3));
125  return ((tower * 1000 + cell) * 10 + fibre);
126 }

◆ update() [1/4]

void FiberSD::update ( const BeginOfJob )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob *>.

Definition at line 110 of file FiberSD.cc.

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

110 {}

◆ update() [2/4]

void FiberSD::update ( const BeginOfRun )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun *>.

Definition at line 112 of file FiberSD.cc.

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

112 {}

◆ update() [3/4]

void FiberSD::update ( const BeginOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent *>.

Definition at line 114 of file FiberSD.cc.

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

114 {}

◆ update() [4/4]

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

Member Data Documentation

◆ theHC

FiberG4HitsCollection* FiberSD::theHC
private

Definition at line 64 of file FiberSD.h.

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

◆ theHCID

G4int FiberSD::theHCID
private

Definition at line 63 of file FiberSD.h.

Referenced by Initialize().

◆ theShower

HFShower* FiberSD::theShower
private

Definition at line 61 of file FiberSD.h.

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