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
virtual void reset ()
 
 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
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, 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 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

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

131 {}
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 141 of file FiberSD.cc.

141 {}
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, egammaForCoreTracking_cff::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:133
std::vector< Hit > getHits(const G4Step *aStep, double weight)
Definition: HFShower.cc:45
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 133 of file FiberSD.cc.

Referenced by ProcessHits().

133  {
134  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
135  int fibre = (touch->GetReplicaNumber(1))%10;
136  int cell = (touch->GetReplicaNumber(2));
137  int tower = (touch->GetReplicaNumber(3));
138  return ((tower*1000+cell)*10+fibre);
139 }
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  theShower->initRun(hdc.product());
118  } else {
119  edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimConstant";
120  throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimConstant" << "\n";
121  }
122 
123 }
HFShower * theShower
Definition: FiberSD.h:60
void initRun(const HcalDDDSimConstants *)
Definition: HFShower.cc:424
T get() const
Definition: EventSetup.h:71
void FiberSD::update ( const BeginOfRun )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 125 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().

125 {}
void FiberSD::update ( const BeginOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 127 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().

127 {}
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().