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_(-1), theStation_(-1), theRoman_pot_(-1), thePlane_(-1), theDetector_(-1) {}
19 
20 uint32_t PPSDiamondOrganization::unitID(const G4Step* aStep) {
21  G4VPhysicalVolume* physVol;
22  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
23 
24  for (int ii = 0; ii < touch->GetHistoryDepth(); ii++) {
25  physVol = touch->GetVolume(ii);
26 
27  if (physVol->GetName() == "CTPPS_Diamond_Segment" || physVol->GetName() == "CTPPS_UFSD_Segment") {
28  theDetector_ = physVol->GetCopyNo() % 100;
29  thePlane_ = physVol->GetCopyNo() / 100;
30  LogDebug("PPSSimDiamond") << "\n---------------------CTPPS_Diamond_Segment-------------------------------------"
31  "------------------------------";
32  LogDebug("PPSSimDiamond") << "\t\t\t\t\tDetector name " << physVol->GetName()
33  << " copynumber= " << physVol->GetCopyNo();
34  LogDebug("PPSSimDiamond") << "\t\t\t\t\tdetector= " << theDetector_ << " plane= " << thePlane_ << " ii = " << ii;
35  }
36 
37  else if (physVol->GetName() == "Primary_Vacuum") {
38  int cpy_no = physVol->GetCopyNo();
39  theArm_ = (cpy_no / 100) % 10;
40  theStation_ = (cpy_no / 10) % 10;
41  theRoman_pot_ = cpy_no % 10;
42  }
43  LogDebug("PPSSimDiamond") << "Diamond"
44  << "physVol =" << physVol->GetName() << ", level=" << ii
45  << ", physVol->GetCopyNo()=" << physVol->GetCopyNo() << std::endl;
46  }
48 }
#define LogDebug(id)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
uint32_t unitID(const G4Step *aStep) override
ii
Definition: cuy.py:590
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...