Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:11

0001 // -*- C++ -*-
0002 //
0003 // Package:     PPS
0004 // Class  :     PPSPixelOrganization
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 
0010 // user include files
0011 #include "SimG4CMS/PPS/interface/PPSPixelOrganization.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h"
0014 #include "G4VPhysicalVolume.hh"
0015 #include "G4VTouchable.hh"
0016 
0017 //
0018 // constructors and destructor
0019 //
0020 PPSPixelOrganization ::PPSPixelOrganization()
0021     : currentUnitID_(0), currentArm_(0), currentStation_(0), currentRP_(0), currentPlane_(0) {
0022   edm::LogVerbatim("PPSSim") << "Creating PPSPixelOrganization";
0023 }
0024 
0025 //
0026 // member functions
0027 //
0028 
0029 uint32_t PPSPixelOrganization ::unitID(const G4Step* aStep) {
0030   const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
0031   G4VPhysicalVolume* physVol = touch->GetVolume(1);
0032   int coNum = physVol->GetCopyNo();
0033   edm::LogVerbatim("PPSPixelSim") << "PPSPixelSim: PhysVol= " << physVol->GetName() << " coNum=" << coNum;
0034   currentPlane_ = coNum - 1;
0035 
0036   G4VPhysicalVolume* physVolVac = touch->GetVolume(3);
0037   if (nullptr == physVolVac) {
0038     edm::LogError("PPSPixelSim") << "Physical volume RP_box_primary_vacuum not found for " << physVol->GetName()
0039                                  << "; cannot determine CTPPSPixelDetId.";
0040   } else {
0041     int cpy_no = physVolVac->GetCopyNo();
0042     currentArm_ = (cpy_no / 100) % 10;
0043     currentStation_ = (cpy_no / 10) % 10;
0044     currentRP_ = cpy_no % 10;
0045   }
0046 
0047   edm::LogVerbatim("PPSPixelSim") << "    arm=" << currentArm_ << " station=" << currentStation_
0048                                   << " roman_pot=" << currentRP_ << " detector=" << currentPlane_;
0049   CTPPSPixelDetId id(currentArm_, currentStation_, currentRP_, currentPlane_);
0050   uint32_t kk = id.rawId();
0051   edm::LogVerbatim("PPSPixelSim") << "PPSPixelSim: ID=" << kk;
0052   return kk;
0053 }