CMS 3D CMS Logo

PPSStripOrganization.cc
Go to the documentation of this file.
4 
5 #include "G4VPhysicalVolume.hh"
6 #include "G4VTouchable.hh"
7 #include "G4Step.hh"
8 
9 #include <iostream>
10 
11 uint32_t PPSStripOrganization::unitID(const G4Step* aStep) {
12  unsigned int arm = 0;
13  unsigned int station = 0;
14  unsigned int roman_pot = 0;
15 
16  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
17  G4VPhysicalVolume* physVol = touch->GetVolume(0);
18  unsigned int detector = physVol->GetCopyNo();
19  edm::LogVerbatim("PPSStripSim") << "PPSStripSim: PhysVol= " << physVol->GetName() << " coNum=" << detector;
20 
21  G4VPhysicalVolume* physVolVac = touch->GetVolume(2);
22  if (nullptr == physVolVac) {
23  edm::LogError("PPSStripSim") << "Physical volume RP_box_primary_vacuum not found for " << physVol->GetName()
24  << "; cannot determine TotemRPDetId.";
25  } else {
26  int cpy_no = physVolVac->GetCopyNo();
27  arm = (cpy_no / 100) % 10;
28  station = (cpy_no / 10) % 10;
29  roman_pot = cpy_no % 10;
30  }
31  edm::LogVerbatim("PPSStripSim") << " arm=" << arm << " station=" << station << " roman_pot=" << roman_pot
32  << " detector=" << detector;
33  return TotemRPDetId(arm, station, roman_pot, detector).rawId();
34 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
Log< level::Info, true > LogVerbatim
uint32_t unitID(const G4Step *aStep) override
Log< level::Error, false > LogError
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57