CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
PltSD Class Reference

#include <PltSD.h>

Inheritance diagram for PltSD:
TimingSD SensitiveTkDetector Observer< const BeginOfEvent * > SensitiveDetector

Public Member Functions

 PltSD (const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
uint32_t setDetUnitId (const G4Step *) override
 
 ~PltSD () override
 
- Public Member Functions inherited from TimingSD
void clearHits () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PSimHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
 TimingSD (const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
 
 ~TimingSD () override
 
- Public Member Functions inherited from SensitiveTkDetector
 SensitiveTkDetector (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 BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 

Protected Member Functions

bool checkHit (const G4Step *, BscG4Hit *) override
 
- Protected Member Functions inherited from TimingSD
const G4ThreeVector & getGlobalEntryPoint () const
 
const G4ThreeVector & getLocalEntryPoint () const
 
void setCuts (double eCut, double historyCut)
 
void setTimeFactor (double)
 
void setToLocal (const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
 
void update (const BeginOfEvent *) 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 > &)
 

Private Attributes

double energyCut
 
double energyHistoryCut
 

Additional Inherited Members

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

Detailed Description

Definition at line 11 of file PltSD.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file PltSD.cc.

References energyCut, energyHistoryCut, edm::ParameterSet::getParameter(), GeV, and TimingSD::setCuts().

21  : TimingSD(name, cpv, clg, p, manager) {
22 
23  edm::ParameterSet m_TrackerSD = p.getParameter<edm::ParameterSet>("PltSD");
24  energyCut = m_TrackerSD.getParameter<double>("EnergyThresholdForPersistencyInGeV")*CLHEP::GeV; //default must be 0.5
25  energyHistoryCut = m_TrackerSD.getParameter<double>("EnergyThresholdForHistoryInGeV")*CLHEP::GeV;//default must be 0.05
26 
27  setCuts(energyCut, energyHistoryCut);
28 }
T getParameter(std::string const &) const
const double GeV
Definition: MathUtil.h:16
void setCuts(double eCut, double historyCut)
Definition: TimingSD.cc:88
double energyHistoryCut
Definition: PltSD.h:29
TimingSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
Definition: TimingSD.cc:40
double energyCut
Definition: PltSD.h:28
PltSD::~PltSD ( )
override

Definition at line 30 of file PltSD.cc.

30  {
31 }

Member Function Documentation

bool PltSD::checkHit ( const G4Step *  ,
BscG4Hit hit 
)
overrideprotectedvirtual

Reimplemented from TimingSD.

Definition at line 126 of file PltSD.cc.

References objects.autophobj::float, BscG4Hit::getExitLocalP(), TimingSD::getLocalEntryPoint(), and mag2().

126  {
127 
128  // 50 micron are allowed between the exit
129  // point of the current hit and the entry point of the new hit
130  static const float tolerance2 = (float)(0.0025 * CLHEP::mm * CLHEP::mm);
131  return ((hit->getExitLocalP()-getLocalEntryPoint()).mag2()<tolerance2);
132 }
const G4ThreeVector & getLocalEntryPoint() const
Definition: TimingSD.h:69
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
const G4ThreeVector & getExitLocalP() const
Definition: BscG4Hit.h:38
uint32_t PltSD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements SensitiveDetector.

Definition at line 33 of file PltSD.cc.

References gather_cfg::cout, hcalDigis_cfi::level, LogDebug, and groupFilesInBlocks::temp.

33  {
34 
35  unsigned int detId = 0;
36 
37  LogDebug("PltSD")<< " DetID = "<<detId;
38 
39  //Find number of levels
40  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
41  int level = 0;
42  if (touch) level = ((touch->GetHistoryDepth())+1);
43 
44  //Get name and copy numbers
45  if ( level > 1 ) {
46  //some debugging with the names
47  G4String sensorName = touch->GetVolume(2)->GetName();
48  G4String telName = touch->GetVolume(3)->GetName();
49  G4String volumeName = touch->GetVolume(4)->GetName();
50  if ( sensorName != "PLTSensorPlane" )
51  std::cout << " PltSD::setDetUnitId -w- Sensor name not PLTSensorPlane " << std::endl;
52  if ( telName != "Telescope" )
53  std::cout << " PltSD::setDetUnitId -w- Telescope name not Telescope " << std::endl;
54  if ( volumeName != "PLT" )
55  std::cout << " PltSD::setDetUnitId -w- Volume name not PLT " << std::endl;
56 
57  //Get the information about which telescope, plane, row/column was hit
58  int columnNum = touch->GetReplicaNumber(0);
59  int rowNum = touch->GetReplicaNumber(1);
60  int sensorNum = touch->GetReplicaNumber(2);
61  int telNum = touch->GetReplicaNumber(3);
62  //temp stores the PLTBCM volume the hit occured in (i.e. was the hit on the + or -z side?)
63  int temp = touch->GetReplicaNumber(5);
64  //convert to the PLT hit id standard
65  int pltNum;
66  if (temp == 2) pltNum = 0;
67  else pltNum = 1;
68 
69  //correct the telescope numbers on the -z side to have the same naming convention in phi as the +z side
70  if (pltNum == 0){
71  if (telNum == 0){
72  telNum = 7;
73  }
74  else if (telNum == 1){
75  telNum = 6;
76  }
77  else if (telNum == 2){
78  telNum = 5;
79  }
80  else if (telNum == 3){
81  telNum = 4;
82  }
83  else if (telNum == 4){
84  telNum = 3;
85  }
86  else if (telNum == 5){
87  telNum = 2;
88  }
89  else if (telNum == 6){
90  telNum = 1;
91  }
92  else if (telNum == 7){
93  telNum = 0;
94  }
95  }
96  //the PLT is divided into sets of telescopes on the + and -x sides
97  int halfCarriageNum = -1;
98 
99  //If the telescope is on the -x side of the carriage, halfCarriageNum=0. If on the +x side, it is = 1.
100  if(telNum == 0 || telNum == 1 || telNum == 2 || telNum == 3)
101  halfCarriageNum = 0;
102  else
103  halfCarriageNum = 1;
104  //correct the telescope numbers of the +x half-carriage to range from 0 to 3
105  if(halfCarriageNum == 1){
106  if(telNum == 4){
107  telNum = 0;
108  }
109  else if (telNum == 5){
110  telNum = 1;
111  }
112  else if (telNum == 6){
113  telNum = 2;
114  }
115  else if (telNum == 7){
116  telNum = 3;
117  }
118  }
119  //Define unique detId for each pixel. See https://twiki.cern.ch/twiki/bin/viewauth/CMS/PLTSimulationGuide for more information
120  detId = 10000000*pltNum+1000000*halfCarriageNum+100000*telNum+10000*sensorNum+100*rowNum+columnNum;
121  //std::cout << "Hit Recorded at " << "plt:" << pltNum << " hc:" << halfCarriageNum << " tel:" << telNum << " plane:" << sensorNum << std::endl;
122  }
123  return detId;
124 }
#define LogDebug(id)

Member Data Documentation

double PltSD::energyCut
private

Definition at line 28 of file PltSD.h.

Referenced by PltSD().

double PltSD::energyHistoryCut
private

Definition at line 29 of file PltSD.h.

Referenced by PltSD().