CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/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(Local3DPoint & point,G4Step * aStep=0) const {
00021   if (aStep) {
00022     //check if endcap
00023     MuonBaseNumber num = g4numbering->PhysicalVolumeToBaseNumber(aStep);
00024     bool endcap_muon = (num.getSuperNo(theRegion)!=1);
00025     if (endcap_muon){
00026       return Local3DPoint(point.x(),point.z(),-point.y());
00027     } else {
00028       return point; 
00029     }
00030   } else {
00031     return Local3DPoint(0.,0.,0.);
00032   }
00033 }