CMS 3D CMS Logo

Macros | Functions
TrackingMaterialProducer.cc File Reference
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <exception>
#include <tuple>
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "SimG4Core/Notification/interface/BeginOfJob.h"
#include "SimG4Core/Notification/interface/BeginOfEvent.h"
#include "SimG4Core/Notification/interface/BeginOfTrack.h"
#include "SimG4Core/Notification/interface/EndOfTrack.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4VSolid.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4TouchableHistory.hh"
#include "G4VPhysicalVolume.hh"
#include "G4AffineTransform.hh"
#include <DD4hep/Filter.h>
#include "TrackingMaterialProducer.h"
#include "SimG4Core/Watcher/interface/SimWatcherFactory.h"
#include "FWCore/Framework/interface/MakerMacros.h"

Go to the source code of this file.

Macros

#define DEBUG_G4_VOLUMES
 

Functions

std::tuple< const G4VPhysicalVolume *, int > GetSensitiveVolume (const G4VTouchable *touchable)
 
static const G4AffineTransform & GetTransform (const G4TouchableHistory *touchable, int depth)
 
static const G4LogicalVolume * GetVolume (const std::string &name)
 
static const SimWatcherFactory ::PMaker< SimWatcherMaker< TrackingMaterialProducer > > s_maker__LINE__ ("TrackingMaterialProducer")
 

Macro Definition Documentation

◆ DEBUG_G4_VOLUMES

#define DEBUG_G4_VOLUMES

Definition at line 37 of file TrackingMaterialProducer.cc.

Function Documentation

◆ GetSensitiveVolume()

std::tuple<const G4VPhysicalVolume*, int> GetSensitiveVolume ( const G4VTouchable *  touchable)

Definition at line 70 of file TrackingMaterialProducer.cc.

References hcalRecHitTable_cff::depth, and personalPlayback::level.

Referenced by TrackingMaterialProducer::update().

70  {
71  int depth = touchable->GetHistoryDepth();
72  for (int level = 0; level < depth; ++level) { // 0 is self
73  const G4VPhysicalVolume* volume = touchable->GetVolume(level);
74  if (volume->GetLogicalVolume()->GetSensitiveDetector() != nullptr) {
75  return std::make_tuple(volume, level);
76  }
77  }
78  return std::tuple<const G4VPhysicalVolume*, int>(nullptr, 0);
79 }

◆ GetTransform()

static const G4AffineTransform& GetTransform ( const G4TouchableHistory *  touchable,
int  depth 
)
inlinestatic

Definition at line 60 of file TrackingMaterialProducer.cc.

References hcalRecHitTable_cff::depth.

Referenced by FWGeoTopNode::paintShape(), and TrackingMaterialProducer::update().

60  {
61  return touchable->GetHistory()->GetTransform(touchable->GetHistory()->GetDepth() - depth);
62 }

◆ GetVolume()

static const G4LogicalVolume* GetVolume ( const std::string &  name)
static

Definition at line 43 of file TrackingMaterialProducer.cc.

References Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GflashEMShowerModel::ModelTrigger(), and TrackingMaterialProducer::update().

43  {
44  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
45 
46 #ifdef DEBUG_G4_VOLUMES
47  for (G4LogicalVolumeStore::const_iterator volume = lvs->begin(); volume != lvs->end(); ++volume)
48  LogInfo("TrackingMaterialProducer") << "TrackingMaterialProducer: G4 registered volumes " << (*volume)->GetName()
49  << std::endl;
50 #endif
51 
52  for (G4LogicalVolumeStore::const_iterator volume = lvs->begin(); volume != lvs->end(); ++volume) {
53  if ((const std::string)(dd4hep::dd::noNamespace((*volume)->GetName())) == name)
54  return (*volume);
55  }
56  return nullptr;
57 }
Log< level::Info, false > LogInfo

◆ s_maker__LINE__()

static const SimWatcherFactory ::PMaker< SimWatcherMaker< TrackingMaterialProducer > > s_maker__LINE__ ( "TrackingMaterialProducer"  )
static