CMS 3D CMS Logo

PPSPixelOrganization.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PPS
4 // Class : PPSPixelOrganization
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 
10 // user include files
14 #include "G4VPhysicalVolume.hh"
15 #include "G4VTouchable.hh"
16 
17 //
18 // constructors and destructor
19 //
21  : currentUnitID_(0), currentArm_(0), currentStation_(0), currentRP_(0), currentPlane_(0) {
22  edm::LogVerbatim("PPSSim") << "Creating PPSPixelOrganization";
23 }
24 
25 //
26 // member functions
27 //
28 
29 uint32_t PPSPixelOrganization ::unitID(const G4Step* aStep) {
30  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
31  G4VPhysicalVolume* physVol = touch->GetVolume(0);
32  int coNum = physVol->GetCopyNo();
33  edm::LogVerbatim("PPSPixelSim") << "PPSPixelSim: PhysVol= " << physVol->GetName() << " coNum=" << coNum;
34  currentPlane_ = coNum - 1;
35 
36  G4VPhysicalVolume* physVolVac = touch->GetVolume(3);
37  if (nullptr == physVolVac) {
38  edm::LogError("PPSPixelSim") << "Physical volume RP_box_primary_vacuum not found for " << physVol->GetName()
39  << "; cannot determine CTPPSPixelDetId.";
40  } else {
41  int cpy_no = physVolVac->GetCopyNo();
42  currentArm_ = (cpy_no / 100) % 10;
43  currentStation_ = (cpy_no / 10) % 10;
44  currentRP_ = cpy_no % 10;
45  }
46 
47  edm::LogVerbatim("PPSPixelSim") << " arm=" << currentArm_ << " station=" << currentStation_
48  << " roman_pot=" << currentRP_ << " detector=" << currentPlane_;
50  uint32_t kk = id.rawId();
51  edm::LogVerbatim("PPSPixelSim") << "PPSPixelSim: ID=" << kk;
52  return kk;
53 }
Log< level::Info, true > LogVerbatim
uint32_t unitID(const G4Step *aStep) override
Log< level::Error, false > LogError