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 DDCompactView &, 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
 SensitiveCaloDetector (const std::string &iname, const DDCompactView &cpv, 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
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
 ~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
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 ( const std::string &  iname,
const DDCompactView cpv,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)
explicit

Definition at line 21 of file FiberSD.cc.

References g4SimHits_cfi::HFShower, and theShower.

23  :
24  SensitiveCaloDetector(iname, cpv, clg, p),
25  m_trackManager(manager), theHCID(-1), theHC(nullptr) {
26 
27  theShower = new HFShower(iname, cpv, p, 1);
28 
29 }
const SimTrackManager * m_trackManager
Definition: FiberSD.h:59
SensitiveCaloDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
HFShower * theShower
Definition: FiberSD.h:60
FiberG4HitsCollection * theHC
Definition: FiberSD.h:63
G4int theHCID
Definition: FiberSD.h:62
FiberSD::~FiberSD ( )
override

Definition at line 31 of file FiberSD.cc.

References theHC, and theShower.

31  {
32 
33  delete theShower;
34  delete theHC;
35 }
HFShower * theShower
Definition: FiberSD.h:60
FiberG4HitsCollection * theHC
Definition: FiberSD.h:63

Member Function Documentation

void FiberSD::clear ( void  )
override

Definition at line 105 of file FiberSD.cc.

Referenced by EndOfEvent().

105 {}
void FiberSD::clearHits ( )
overridevirtual

Implements SensitiveDetector.

Definition at line 132 of file FiberSD.cc.

132 {}
void FiberSD::DrawAll ( )
override

Definition at line 107 of file FiberSD.cc.

107 {}
void FiberSD::EndOfEvent ( G4HCofThisEvent *  HCE)
override

Definition at line 98 of file FiberSD.cc.

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

98  {
99 
100  LogDebug("FiberSim") << "FiberSD: Sees" << theHC->entries() << " hits";
101  clear();
102  std::cout<<"theHC entries = "<<theHC->entries()<<std::endl;
103 }
#define LogDebug(id)
FiberG4HitsCollection * theHC
Definition: FiberSD.h:63
void clear() override
Definition: FiberSD.cc:105
void FiberSD::fillHits ( edm::PCaloHitContainer ,
const std::string &   
)
overridevirtual

Implements SensitiveCaloDetector.

Definition at line 142 of file FiberSD.cc.

142 {}
void FiberSD::Initialize ( G4HCofThisEvent *  HCE)
override

Definition at line 37 of file FiberSD.cc.

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

37  {
38 
39  LogDebug("FiberSim") << "FiberSD : Initialize called for " << GetName();
40  theHC = new FiberG4HitsCollection(GetName(), collectionName[0]);
41  if (theHCID<0)
42  theHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
43  HCE->AddHitsCollection(theHCID, theHC);
44 
45 }
#define LogDebug(id)
std::string const collectionName[nCollections]
Definition: Collections.h:47
FiberG4HitsCollection * theHC
Definition: FiberSD.h:63
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
Definition: FiberG4Hit.h:58
G4int theHCID
Definition: FiberSD.h:62
void FiberSD::PrintAll ( )
override

Definition at line 109 of file FiberSD.cc.

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

Implements SensitiveDetector.

Definition at line 47 of file FiberSD.cc.

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

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

Implements SensitiveDetector.

Definition at line 134 of file FiberSD.cc.

Referenced by ProcessHits().

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 }
void FiberSD::update ( const BeginOfJob )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 111 of file FiberSD.cc.

References Exception, edm::EventSetup::get(), HFShower::initRun(), and theShower.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

111  {
112 
113  const edm::EventSetup* es = (*job)();
115  es->get<HcalSimNumberingRecord>().get(hdc);
116  if (hdc.isValid()) {
117  HcalDDDSimConstants *hcalConstants = (HcalDDDSimConstants*)(&(*hdc));
118  theShower->initRun(nullptr, hcalConstants);
119  } else {
120  edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimConstant";
121  throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimConstant" << "\n";
122  }
123 
124 }
void initRun(G4ParticleTable *, HcalDDDSimConstants *)
Definition: HFShower.cc:454
HFShower * theShower
Definition: FiberSD.h:60
const T & get() const
Definition: EventSetup.h:58
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.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

126 {}
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.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

128 {}
void FiberSD::update ( const ::EndOfEvent )
overrideprotected

Member Data Documentation

const SimTrackManager* FiberSD::m_trackManager
private

Definition at line 59 of file FiberSD.h.

FiberG4HitsCollection* FiberSD::theHC
private

Definition at line 63 of file FiberSD.h.

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

G4int FiberSD::theHCID
private

Definition at line 62 of file FiberSD.h.

Referenced by Initialize().

HFShower* FiberSD::theShower
private

Definition at line 60 of file FiberSD.h.

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