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 (const 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:45
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 121 of file FiberSD.cc.

Referenced by EndOfEvent().

121 {}
void FiberSD::clearHits ( )
protectedvirtual

Implements SensitiveDetector.

Definition at line 133 of file FiberSD.cc.

133 {}
void FiberSD::DrawAll ( )
virtual

Definition at line 123 of file FiberSD.cc.

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

Reimplemented from SensitiveDetector.

Definition at line 114 of file FiberSD.cc.

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

114  {
115 
116  LogDebug("FiberSim") << "FiberSD: Sees" << theHC->entries() << " hits";
117  clear();
118  std::cout<<"theHC entries = "<<theHC->entries()<<std::endl;
119 }
#define LogDebug(id)
FiberG4HitsCollection * theHC
Definition: FiberSD.h:60
tuple cout
Definition: gather_cfg.py:121
virtual void clear()
Definition: FiberSD.cc:121
void FiberSD::fillHits ( edm::PCaloHitContainer ,
std::string   
)
protectedvirtual

Implements SensitiveCaloDetector.

Definition at line 143 of file FiberSD.cc.

143 {}
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:45
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 125 of file FiberSD.cc.

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

Implements SensitiveDetector.

Definition at line 63 of file FiberSD.cc.

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

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

Implements SensitiveDetector.

Definition at line 135 of file FiberSD.cc.

Referenced by ProcessHits().

135  {
136  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
137  int fibre = (touch->GetReplicaNumber(1))%10;
138  int cell = (touch->GetReplicaNumber(2));
139  int tower = (touch->GetReplicaNumber(3));
140  return ((tower*1000+cell)*10+fibre);
141 }
void FiberSD::update ( const BeginOfRun )
protectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

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

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

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

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

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