CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 BeginOfRun * > Observer< const BeginOfEvent * > Observer< const EndOfEvent * > SensitiveDetector

Public Member Functions

virtual void clear ()
 
virtual void DrawAll ()
 
virtual void EndOfEvent (G4HCofThisEvent *HCE)
 
 FiberSD (std::string, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual void Initialize (G4HCofThisEvent *HCE)
 
virtual void PrintAll ()
 
virtual G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist)
 
virtual ~FiberSD ()
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (G4ThreeVector point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
virtual std::vector< std::string > getNames ()
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- 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

virtual void clearHits ()
 
virtual void fillHits (edm::PCaloHitContainer &, std::string)
 
virtual uint32_t setDetUnitId (G4Step *)
 
virtual void update (const BeginOfRun *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const ::EndOfEvent *)
 
- 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
 
std::string theName
 
HFShowertheShower
 

Additional Inherited Members

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

Detailed Description

Definition at line 25 of file FiberSD.h.

Constructor & Destructor Documentation

FiberSD::FiberSD ( std::string  name,
const DDCompactView cpv,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 17 of file FiberSD.cc.

References SensitiveDetector::AssignSD(), ecaldqm::collectionName, LogDebug, SensitiveDetectorCatalog::logicalNames(), SensitiveDetector::Register(), and theShower.

19  :
20  SensitiveCaloDetector(name, cpv, clg, p), theName(name),
21  m_trackManager(manager), theHCID(-1), theHC(0) {
22 
23  collectionName.insert(name);
24  LogDebug("FiberSim") << "***************************************************"
25  << "\n"
26  << "* *"
27  << "\n"
28  << "* Constructing a FiberSD with name " << GetName()
29  << "\n"
30  << "* *"
31  << "\n"
32  << "***************************************************";
33  theShower = new HFShower(name, cpv, p, 1);
34 
35  //
36  // Now attach the right detectors (LogicalVolumes) to me
37  //
38  std::vector<std::string> lvNames = clg.logicalNames(name);
39  this->Register();
40  for (std::vector<std::string>::iterator it=lvNames.begin();
41  it !=lvNames.end(); it++){
42  this->AssignSD(*it);
43  LogDebug("FiberSim") << "FiberSD : Assigns SD to LV " << (*it);
44  }
45 }
#define LogDebug(id)
const SimTrackManager * m_trackManager
Definition: FiberSD.h:56
std::vector< std::string > logicalNames(std::string &readoutName)
std::string theName
Definition: FiberSD.h:55
std::string const collectionName[nCollections]
Definition: Collections.h:39
HFShower * theShower
Definition: FiberSD.h:57
FiberG4HitsCollection * theHC
Definition: FiberSD.h:60
virtual void AssignSD(std::string &vname)
SensitiveCaloDetector(std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
G4int theHCID
Definition: FiberSD.h:59
FiberSD::~FiberSD ( )
virtual

Definition at line 47 of file FiberSD.cc.

References theHC, and theShower.

47  {
48 
49  if (theShower) delete theShower;
50  if (theHC) delete theHC;
51 }
HFShower * theShower
Definition: FiberSD.h:57
FiberG4HitsCollection * theHC
Definition: FiberSD.h:60

Member Function Documentation

void FiberSD::clear ( void  )
virtual

Definition at line 112 of file FiberSD.cc.

Referenced by EndOfEvent().

112 {}
void FiberSD::clearHits ( )
protectedvirtual

Implements SensitiveDetector.

Definition at line 124 of file FiberSD.cc.

124 {}
void FiberSD::DrawAll ( )
virtual

Definition at line 114 of file FiberSD.cc.

114 {}
void FiberSD::EndOfEvent ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 106 of file FiberSD.cc.

References clear(), LogDebug, and theHC.

106  {
107 
108  LogDebug("FiberSim") << "FiberSD: Sees" << theHC->entries() << " hits";
109  clear();
110 }
#define LogDebug(id)
FiberG4HitsCollection * theHC
Definition: FiberSD.h:60
virtual void clear()
Definition: FiberSD.cc:112
void FiberSD::fillHits ( edm::PCaloHitContainer ,
std::string   
)
protectedvirtual

Implements SensitiveCaloDetector.

Definition at line 134 of file FiberSD.cc.

134 {}
void FiberSD::Initialize ( G4HCofThisEvent *  HCE)
virtual

Reimplemented from SensitiveDetector.

Definition at line 53 of file FiberSD.cc.

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

53  {
54 
55  LogDebug("FiberSim") << "FiberSD : Initialize called for " << GetName();
56  theHC = new FiberG4HitsCollection(GetName(), collectionName[0]);
57  if (theHCID<0)
58  theHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
59  HCE->AddHitsCollection(theHCID, theHC);
60 
61 }
#define LogDebug(id)
std::string const collectionName[nCollections]
Definition: Collections.h:39
FiberG4HitsCollection * theHC
Definition: FiberSD.h:60
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
Definition: FiberG4Hit.h:59
G4int theHCID
Definition: FiberSD.h:59
void FiberSD::PrintAll ( )
virtual

Definition at line 116 of file FiberSD.cc.

116 {}
G4bool FiberSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  ROhist 
)
virtual

Implements SensitiveDetector.

Definition at line 63 of file FiberSD.cc.

References HFShower::getHits(), i, LogDebug, position, setDetUnitId(), theHC, and theShower.

63  {
64 
65  std::vector<HFShower::Hit> hits = theShower->getHits(aStep);
66 
67  if (hits.size() > 0) {
68  std::vector<HFShowerPhoton> thePE;
69  for (unsigned int i=0; i<hits.size(); i++) {
70  HFShowerPhoton pe = HFShowerPhoton(hits[i].position.x(),
71  hits[i].position.y(),
72  hits[i].position.z(),
73  hits[i].wavelength, hits[i].time);
74  thePE.push_back(pe);
75  }
76  int trackID = aStep->GetTrack()->GetTrackID();
77  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
78  const G4VTouchable* touch = preStepPoint->GetTouchable();
79  G4LogicalVolume* lv = touch->GetVolume(0)->GetLogicalVolume();
80  int depth = (touch->GetReplicaNumber(0))%10;
81  int detID = setDetUnitId(aStep);
82  math::XYZPoint theHitPos(preStepPoint->GetPosition().x(),
83  preStepPoint->GetPosition().y(),
84  preStepPoint->GetPosition().z());
85 
86  FiberG4Hit *aHit = new FiberG4Hit(lv, detID, depth, trackID);
87  aHit->setNpe(hits.size());
88  aHit->setPos(theHitPos);
89  aHit->setTime(preStepPoint->GetGlobalTime());
90  aHit->setPhoton(thePE);
91 
92  LogDebug("FiberSim") << "FiberSD: Hit created at " << lv->GetName()
93  << " DetID: " << aHit->towerId() << " Depth: "
94  << aHit->depth() << " Track ID: " << aHit->trackId()
95  << " Nb. of Cerenkov Photons: " << aHit->npe()
96  << " Time: " << aHit->time() << " at "
97  << aHit->hitPos();
98  for (unsigned int i=0; i<thePE.size(); i++)
99  LogDebug("FiberSim") << "FiberSD: PE[" << i << "] " << thePE[i];
100 
101  theHC->insert(aHit);
102  }
103  return true;
104 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< Hit > getHits(G4Step *aStep)
Definition: HFShower.cc:70
HFShower * theShower
Definition: FiberSD.h:57
virtual uint32_t setDetUnitId(G4Step *)
Definition: FiberSD.cc:126
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
FiberG4HitsCollection * theHC
Definition: FiberSD.h:60
static int position[264][3]
Definition: ReadPGInfo.cc:509
uint32_t FiberSD::setDetUnitId ( G4Step *  aStep)
protectedvirtual

Implements SensitiveDetector.

Definition at line 126 of file FiberSD.cc.

Referenced by ProcessHits().

126  {
127  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
128  int fibre = (touch->GetReplicaNumber(1))%10;
129  int cell = (touch->GetReplicaNumber(2));
130  int tower = (touch->GetReplicaNumber(3));
131  return ((tower*1000+cell)*10+fibre);
132 }
void FiberSD::update ( const BeginOfRun )
protectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 118 of file FiberSD.cc.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

118 {}
void FiberSD::update ( const BeginOfEvent )
protectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 120 of file FiberSD.cc.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

120 {}
void FiberSD::update ( const ::EndOfEvent )
protectedvirtual

Member Data Documentation

const SimTrackManager* FiberSD::m_trackManager
private

Definition at line 56 of file FiberSD.h.

FiberG4HitsCollection* FiberSD::theHC
private

Definition at line 60 of file FiberSD.h.

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

G4int FiberSD::theHCID
private

Definition at line 59 of file FiberSD.h.

Referenced by Initialize().

std::string FiberSD::theName
private

Definition at line 55 of file FiberSD.h.

HFShower* FiberSD::theShower
private

Definition at line 57 of file FiberSD.h.

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