CMS 3D CMS Logo

PPSDiamondOrganization.cc
Go to the documentation of this file.
1 // ////////////////////////////////////
2 // Author
3 // Seyed Mohsen Etesami setesami@cern.ch
4 // //////////////////////////////////////////
5 
9 #include "G4VPhysicalVolume.hh"
10 #include "G4VTouchable.hh"
11 #include "G4Step.hh"
12 
13 #include <iostream>
14 
15 //******************************************************************** Constructor and destructor
16 
18  : theArm_(0), theStation_(0), theRoman_pot_(0), thePlane_(0), theDetector_(0) {}
19 
20 uint32_t PPSDiamondOrganization::unitID(const G4Step* aStep) {
21  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
22  G4VPhysicalVolume* physVol = touch->GetVolume(0);
23  int coNum = physVol->GetCopyNo();
24  edm::LogVerbatim("PPSSimDiamond") << " %%%% PhysVol: " << physVol->GetName() << " coNum=" << coNum;
25  theDetector_ = coNum % 100;
26  thePlane_ = coNum / 100;
27 
28  G4VPhysicalVolume* physVolVac = touch->GetVolume(3);
29  if (nullptr == physVolVac) {
30  edm::LogError("PPSSimDiamond") << "Physical volume Primary_Vacuum not found for " << physVol->GetName()
31  << "; cannot determine CTPPSDiamondDetId.";
32  } else {
33  int cpy_no = physVolVac->GetCopyNo();
34  theArm_ = (cpy_no / 100) % 10;
35  theStation_ = (cpy_no / 10) % 10;
36  theRoman_pot_ = cpy_no % 10;
37  }
39 }
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
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...