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  // Get pointer to HcalDDDConstant and HcalDDDSimulationConstants
34  es.get<HcalSimNumberingRecord>().get(hdsc);
35  if (!hdsc.isValid()) {
36  edm::LogError("FiberSim") << "FiberSD : Cannot find HcalDDDSimulationConstant";
37  throw cms::Exception("Unknown", "FiberSD") << "Cannot find HcalDDDSimulationConstant\n";
38  }
39  const HcalDDDSimulationConstants* hsps = hdsc.product();
41  es.get<HcalSimNumberingRecord>().get(hdc);
42  if (hdc.isValid()) {
43  const HcalDDDSimConstants* hcalConstants = hdc.product();
44  theShower = new HFShower(iname, hcalConstants, hsps->hcalsimpar(), p, 1);
45  } else {
46  edm::LogError("FiberSim") << "FiberSD : Cannot find HcalDDDSimConstant";
47  throw cms::Exception("Unknown", "FiberSD") << "Cannot find HcalDDDSimConstant\n";
48  }
49 }

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

◆ ~FiberSD()

FiberSD::~FiberSD ( )
override

Definition at line 51 of file FiberSD.cc.

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

References theHC, and theShower.

Member Function Documentation

◆ clear()

void FiberSD::clear ( void  )
override

Definition at line 114 of file FiberSD.cc.

114 {}

Referenced by EndOfEvent().

◆ clearHits()

void FiberSD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 128 of file FiberSD.cc.

128 {}

◆ DrawAll()

void FiberSD::DrawAll ( )
override

Definition at line 116 of file FiberSD.cc.

116 {}

◆ EndOfEvent()

void FiberSD::EndOfEvent ( G4HCofThisEvent *  HCE)
override

Definition at line 108 of file FiberSD.cc.

108  {
109  LogDebug("FiberSim") << "FiberSD: Sees" << theHC->entries() << " hits";
110  clear();
111  std::cout << "theHC entries = " << theHC->entries() << std::endl;
112 }

References clear(), gather_cfg::cout, LogDebug, and theHC.

◆ fillHits()

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

Implements SensitiveCaloDetector.

Definition at line 138 of file FiberSD.cc.

138 {}

◆ Initialize()

void FiberSD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 56 of file FiberSD.cc.

56  {
57  LogDebug("FiberSim") << "FiberSD : Initialize called for " << GetName();
58  theHC = new FiberG4HitsCollection(GetName(), collectionName[0]);
59  if (theHCID < 0)
60  theHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
61  HCE->AddHitsCollection(theHCID, theHC);
62 }

References bysipixelclustmulteventfilter_cfi::collectionName, LogDebug, theHC, and theHCID.

◆ PrintAll()

void FiberSD::PrintAll ( )
override

Definition at line 118 of file FiberSD.cc.

118 {}

◆ ProcessHits()

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

Implements SensitiveDetector.

Definition at line 64 of file FiberSD.cc.

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

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

◆ setDetUnitId()

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

Implements SensitiveDetector.

Definition at line 130 of file FiberSD.cc.

130  {
131  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
132  int fibre = (touch->GetReplicaNumber(1)) % 10;
133  int cell = (touch->GetReplicaNumber(2));
134  int tower = (touch->GetReplicaNumber(3));
135  return ((tower * 1000 + cell) * 10 + fibre);
136 }

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 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() [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 120 of file FiberSD.cc.

120 {}

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 122 of file FiberSD.cc.

122 {}

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
HcalDDDSimulationConstants::hcalsimpar
const HcalSimulationParameters * hcalsimpar() const
Definition: HcalDDDSimulationConstants.h:20
mps_fire.i
i
Definition: mps_fire.py:355
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
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
FiberSD::clear
void clear() override
Definition: FiberSD.cc:114
FiberSD::m_trackManager
const SimTrackManager * m_trackManager
Definition: FiberSD.h:57
FiberG4Hit
Definition: FiberG4Hit.h:14
HcalDDDSimConstants
Definition: HcalDDDSimConstants.h:24
Calorimetry_cff.HFShower
HFShower
Definition: Calorimetry_cff.py:264
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:73
FiberSD::theHCID
G4int theHCID
Definition: FiberSD.h:60
edm::ESHandle
Definition: DTSurvey.h:22
bysipixelclustmulteventfilter_cfi.collectionName
collectionName
Definition: bysipixelclustmulteventfilter_cfi.py:5
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::LogError
Definition: MessageLogger.h:183
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
get
#define get
HcalDDDSimulationConstants
Definition: HcalDDDSimulationConstants.h:15
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
FiberSD::theShower
HFShower * theShower
Definition: FiberSD.h:58
Exception
Definition: hltDiff.cc:246
HFShowerPhoton
Definition: HFShowerPhoton.h:13
HFShower::getHits
std::vector< Hit > getHits(const G4Step *aStep, double weight)
Definition: HFShower.cc:42
HcalSimNumberingRecord
Definition: HcalSimNumberingRecord.h:25
FiberG4HitsCollection
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
Definition: FiberG4Hit.h:54
FiberSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *) override
Definition: FiberSD.cc:130