CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/SimG4CMS/Forward/src/TotemRPOrganization.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Forward
00004 // Class  :     TotemRPOrganization
00005 //
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  
00010 //         Created:  Tue May 16 10:14:34 CEST 2006
00011 // $Id: TotemRPOrganization.cc,v 1.1 2006/05/17 16:18:58 sunanda Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
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 // constructors and destructor
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 // member functions
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);//aStep->GetPreStepPoint()->GetPhysicalVolume();
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 }