CMS 3D CMS Logo

Bcm1fSD.cc
Go to the documentation of this file.
2 
5 
9 
12 
14 
19 
20 #include "G4Track.hh"
21 #include "G4SDManager.hh"
22 #include "G4VProcess.hh"
23 #include "G4EventManager.hh"
24 #include "G4Event.hh"
25 #include "G4VProcess.hh"
26 
27 #include <string>
28 #include <vector>
29 #include <iostream>
30 
31 #include "CLHEP/Units/GlobalSystemOfUnits.h"
32 
34  const edm::EventSetup& es,
35  const SensitiveDetectorCatalog& clg,
36  edm::ParameterSet const& p,
37  const SimTrackManager* manager)
38  : TimingSD(name, es, clg, p, manager) {
39  edm::ParameterSet m_TrackerSD = p.getParameter<edm::ParameterSet>("Bcm1fSD");
40  energyCut = m_TrackerSD.getParameter<double>("EnergyThresholdForPersistencyInGeV") * GeV; //default must be 0.5 (?)
42  m_TrackerSD.getParameter<double>("EnergyThresholdForHistoryInGeV") * GeV; //default must be 0.05 (?)
43 
45 }
46 
48 
49 uint32_t Bcm1fSD::setDetUnitId(const G4Step* aStep) {
50  uint32_t detId = 0;
51 
52  //Find number of levels
53  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
54  int level = (touch) ? ((touch->GetHistoryDepth()) + 1) : 0;
55 
56  //Get name and copy numbers
57  if (level > 1) {
58  G4String sensorName = touch->GetVolume(0)->GetName();
59  G4String diamondName = touch->GetVolume(1)->GetName();
60  G4String detectorName = touch->GetVolume(2)->GetName();
61  G4String volumeName = touch->GetVolume(3)->GetName();
62 
63  if (sensorName != "BCM1FSensor") {
64  edm::LogWarning("ForwardSim") << "Bcm1fSD::setDetUnitId -w- Sensor name not BCM1FSensor ";
65  }
66  if (detectorName != "BCM1F") {
67  edm::LogWarning("ForwardSim") << " Bcm1fSD::setDetUnitId -w- Detector name not BCM1F ";
68  }
69  int sensorNo = touch->GetReplicaNumber(0);
70  int diamondNo = touch->GetReplicaNumber(1);
71  int volumeNo = touch->GetReplicaNumber(3);
72 
73  // Detector ID definition
74  // detId = XYYZ
75  // X = volume, 1: +Z, 2: -Z
76  // YY = diamond, 01-12, 12: phi = 90 deg, numbering clockwise when looking from the IP
77  // Z = sensor, 1 or 2, clockwise when looking from the IP
78 
79  detId = 1000 * volumeNo + 10 * diamondNo + sensorNo;
80  }
81  return detId;
82 }
83 
84 bool Bcm1fSD::checkHit(const G4Step*, BscG4Hit* hit) {
85  // 50 micron are allowed between the exit
86  // point of the current hit and the entry point of the new hit
87  static const float tolerance2 = (float)(0.0025 * CLHEP::mm * CLHEP::mm);
88  return ((hit->getExitLocalP() - getLocalEntryPoint()).mag2() < tolerance2);
89 }
personalPlayback.level
level
Definition: personalPlayback.py:22
SimTrackManager
Definition: SimTrackManager.h:35
ESTransientHandle.h
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
ESHandle.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TimingSD
Definition: TimingSD.h:29
TimingSD::getLocalEntryPoint
const G4ThreeVector & getLocalEntryPoint() const
Definition: TimingSD.h:66
TrackingSlaveSD.h
Bcm1fSD.h
Bcm1fSD::energyHistoryCut
float energyHistoryCut
Definition: Bcm1fSD.h:27
G4ProcessTypeEnumerator.h
Bcm1fSD::Bcm1fSD
Bcm1fSD(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: Bcm1fSD.cc:33
Bcm1fSD::energyCut
float energyCut
Definition: Bcm1fSD.h:26
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
edm::ParameterSet
Definition: ParameterSet.h:36
hgcalTopologyTester_cfi.detectorName
detectorName
Definition: hgcalTopologyTester_cfi.py:6
Bcm1fSD::~Bcm1fSD
~Bcm1fSD() override
Definition: Bcm1fSD.cc:47
GeV
const double GeV
Definition: MathUtil.h:16
mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition: Basic3DVectorLD.h:124
UpdatablePSimHit.h
edm::EventSetup
Definition: EventSetup.h:57
TrackInformation.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
G4TrackToParticleID.h
LocalPoint.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
TimingSD::setCuts
void setCuts(double eCut, double historyCut)
Definition: TimingSD.cc:96
BscG4Hit
Definition: BscG4Hit.h:17
Bcm1fSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *) override
Definition: Bcm1fSD.cc:49
LocalVector.h
hit
Definition: SiStripHitEffFromCalibTree.cc:88
Bcm1fSD::checkHit
bool checkHit(const G4Step *, BscG4Hit *) override
Definition: Bcm1fSD.cc:84