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