Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "SimG4CMS/Forward/interface/TotemRPOrganization.h"
00018 #include "SimG4CMS/Forward/interface/TotemNumberMerger.h"
00019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00020
00021 #include "G4VPhysicalVolume.hh"
00022 #include "G4VTouchable.hh"
00023
00024
00025
00026
00027 TotemRPOrganization :: TotemRPOrganization() :
00028 _needUpdateUnitID(false), _needUpdateData(false), _currentUnitID(-1),
00029 _currentPlane(-1), _currentCSC(-1), _currentLayer(-1) {
00030
00031 edm::LogInfo("ForwardSim") << "Creating TotemRPOrganization";
00032 }
00033
00034 TotemRPOrganization :: ~TotemRPOrganization() {
00035 }
00036
00037
00038
00039
00040
00041 uint32_t TotemRPOrganization :: GetUnitID(const G4Step* aStep) const {
00042 return const_cast<TotemRPOrganization *>(this)->GetUnitID(aStep);
00043 }
00044
00045 uint32_t TotemRPOrganization :: GetUnitID(const G4Step* aStep) {
00046
00047 G4VPhysicalVolume* physVol;
00048 int32_t UNITA=0;
00049 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
00050 int ii =0;
00051 for( ii = 0; ii < touch->GetHistoryDepth(); ii++ ){
00052 physVol = touch->GetVolume(ii);
00053
00054 #ifdef SCRIVI
00055 LogDebug("ForwardSim") << "physVol=" << physVol->GetName() << ", level="
00056 << ii << ", physVol->GetCopyNo()="
00057 << physVol->GetCopyNo();
00058 #endif
00059 if (physVol->GetName() == "myRP") _currentDetectorPosition = 3;
00060
00061 }
00062 physVol= touch->GetVolume(0);
00063
00064 if(physVol->GetName() == "myRP") UNITA=(touch->GetVolume(5)->GetCopyNo())*1111;
00065
00066 #ifdef SCRIVI
00067 LogDebug("ForwardSim") << "\nUNITA-RP " << UNITA << "\n\n";
00068 #endif
00069 return UNITA;
00070 }