11 #include "G4TouchableHistory.hh" 12 #include "G4TransportationManager.hh" 13 #include "CLHEP/Units/GlobalSystemOfUnits.h" 14 #include "CLHEP/Units/GlobalPhysicalConstants.h" 32 for (
const auto&
name : LVNames_) {
33 produces<edm::PassiveHitContainer>(Form(
"%sPassiveHits",
name.c_str()));
35 std::cout <<
"Collection name[" << k <<
"] " <<
name << std::endl;
60 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
61 for (
auto lvcite : *lvs) {
66 std::cout <<
"HGCPassive::Finds " <<
mapLV_.size() <<
" logical volumes\n";
68 for (
const auto& lvs :
mapLV_) {
69 std::cout <<
"Entry[" << k <<
"] " << lvs.first <<
": (" 70 << (lvs.second).
first <<
", " << (lvs.second).second <<
")\n";
80 int iev = (*evt)()->GetEventID();
81 edm::LogInfo(
"ValidHGCal") <<
"HGCPassive: =====> Begin event = " 93 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
96 G4TouchableHistory* touchable = (G4TouchableHistory*)aStep->GetPreStepPoint()->GetTouchable();
97 G4LogicalVolume* plv = (G4LogicalVolume*)touchable->GetVolume()->GetLogicalVolume();
100 unsigned int copy = (
unsigned int)(touchable->GetReplicaNumber(0) +
101 1000*touchable->GetReplicaNumber(1));
102 std::pair<G4LogicalVolume*,unsigned int>
key(plv,copy);
103 auto itr =
store_.find(key);
104 double time = (aStep->GetPostStepPoint()->GetGlobalTime());
105 if (itr ==
store_.end()) {
109 double edeposit = aStep->GetTotalEnergyDeposit();
110 (itr->second).
second += edeposit;
113 << (it->second).second <<
":" << copy <<
" T " 114 << (itr->second).
first <<
" E " << (itr->second).second
129 unsigned int kount(0);
131 for (
const auto& element :
store_) {
132 G4LogicalVolume* lv = (element.first).
first;
133 auto it =
mapLV_.find(lv);
135 if ((it->second).first ==
k) {
137 (element.second).second,(element.second).first);
138 hgcPH.push_back(hit);
140 std::cout <<
"HGCPassive[" << k <<
"] Hit[" << kount <<
"] " << hit
150 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
153 std::map<G4LogicalVolume*,std::pair<unsigned int,std::string>>::iterator
HGCPassive::findLV(G4LogicalVolume * plv) {
154 auto itr =
mapLV_.find(plv);
155 if (itr ==
mapLV_.end()) {
158 if (name.find(
LVNames_[
k]) != std::string::npos) {
159 mapLV_[plv] = std::pair<unsigned int,std::string>(
k,
name);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_SIMWATCHER(type)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void update(const BeginOfRun *run)
This routine will be called when the appropriate signal arrives.
void endOfEvent(edm::PassiveHitContainer &hgcPH, unsigned int k)
std::map< std::pair< G4LogicalVolume *, unsigned int >, std::pair< double, double > > store_
G4VPhysicalVolume * topPV_
U second(std::pair< T, U > const &p)
G4VPhysicalVolume * getTopPV()
HGCPassive(const edm::ParameterSet &p)
std::vector< std::string > LVNames_
std::vector< PassiveHit > PassiveHitContainer
std::map< G4LogicalVolume *, std::pair< unsigned int, std::string > > mapLV_
void produce(edm::Event &, const edm::EventSetup &)
std::map< G4LogicalVolume *, std::pair< unsigned int, std::string > >::iterator findLV(G4LogicalVolume *plv)