CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/SimG4CMS/Muon/src/MuonRpcFrameRotation.cc

Go to the documentation of this file.
00001 #include "SimG4CMS/Muon/interface/MuonRpcFrameRotation.h"
00002 #include "SimG4CMS/Muon/interface/MuonG4Numbering.h"
00003 #include "Geometry/MuonNumbering/interface/MuonDDDConstants.h"
00004 #include "Geometry/MuonNumbering/interface/MuonBaseNumber.h"
00005 
00006 #include "G4StepPoint.hh"
00007 #include "G4TouchableHistory.hh"
00008 
00009 MuonRpcFrameRotation::MuonRpcFrameRotation(const DDCompactView& cpv) : MuonFrameRotation::MuonFrameRotation(cpv) {
00010   g4numbering = new MuonG4Numbering(cpv);
00011   MuonDDDConstants muonConstants(cpv);
00012   int theLevelPart=muonConstants.getValue("level");
00013   theRegion=muonConstants.getValue("mr_region")/theLevelPart;
00014 }
00015 
00016 MuonRpcFrameRotation::~MuonRpcFrameRotation(){
00017   delete g4numbering;
00018 }
00019 
00020 Local3DPoint MuonRpcFrameRotation::transformPoint(const Local3DPoint & point,const G4Step * aStep=0) const {
00021   if (!aStep)
00022     return Local3DPoint(0.,0.,0.);  
00023 
00024   //check if endcap
00025   MuonBaseNumber num = g4numbering->PhysicalVolumeToBaseNumber(aStep);
00026   bool endcap_muon = (num.getSuperNo(theRegion)!=1);
00027   if (endcap_muon){
00028     return Local3DPoint(point.x(),point.z(),-point.y());
00029   } else {
00030     return point; 
00031   }
00032 }