Error in Detector Construction.cc while compilation

Dear Experts

I am getting this Error and not able to resolve it Please suggest Solution:
Consolidate compiler generated dependencies of target exampleB3a
[ 11%] Building CXX object CMakeFiles/exampleB3a.dir/src/DetectorConstruction.cc.o
/home/lenovo/Downloads/GEANT4/geant4-v11.1.2/examples/basic/B3/B3a/src/DetectorConstruction.cc: In member function ‘virtual G4VPhysicalVolume* B3::DetectorConstruction::Construct()’:
/home/lenovo/Downloads/GEANT4/geant4-v11.1.2/examples/basic/B3/B3a/src/DetectorConstruction.cc:269:30: error: qualified-id in declaration before ‘(’ token
269 | void PhysicsList::ConstructEM()
| ^
I tried void B3::PhysicsList::ConstructEM() but it did not help Please suggest some solution for this my code is as follows:

//
// ********************************************************************
// * License and Disclaimer                                           *
// *                                                                  *
// * The  Geant4 software  is  copyright of the Copyright Holders  of *
// * the Geant4 Collaboration.  It is provided  under  the terms  and *
// * conditions of the Geant4 Software License,  included in the file *
// * LICENSE and available at  http://cern.ch/geant4/license .  These *
// * include a list of copyright holders.                             *
// *                                                                  *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work  make  any representation or  warranty, express or implied, *
// * regarding  this  software system or assume any liability for its *
// * use.  Please see the license in the file  LICENSE  and URL above *
// * for the full disclaimer and the limitation of liability.         *
// *                                                                  *
// * This  code  implementation is the result of  the  scientific and *
// * technical work of the GEANT4 collaboration.                      *
// * By using,  copying,  modifying or  distributing the software (or *
// * any work based  on the software)  you  agree  to acknowledge its *
// * use  in  resulting  scientific  publications,  and indicate your *
// * acceptance of all terms of the Geant4 Software license.          *
// ********************************************************************
//
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the B1::DetectorConstruction class

#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "G4VUserPhysicsList.hh"
#include "G4RunManager.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Orb.hh"
#include "G4Sphere.hh"
#include "G4Trd.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4PhysicalConstants.hh"
#include "G4ExtrudedSolid.hh"
#include "G4Polyhedra.hh"
#include "G4SystemOfUnits.hh"
#include "G4MagneticField.hh"
#include "G4RotationMatrix.hh"

//#include “G4Electron.hh”
//#include “G4Proton.hh”



namespace B3
{

void PlaceHexagons(double d, double xc, double yc, int nhex, G4LogicalVolume* logHexagon,  G4LogicalVolume* logMother)
{
  bool checkOverlaps = true;
  for (int i=0; i<nhex; ++i) {
    G4ThreeVector pos( yc + d*(i - (nhex-1)*0.5),xc, 0.);
    new G4PVPlacement(0,              // no rotation                                                                    
                      pos,            // position                                                                       
                      logHexagon,     // logical volume                                                                 
                      "Hexagon",      // its name                                                                       
                      logMother,      // its mother  volume                                                             
                      false,          // no boolean operation                                                           
                      0,              // copy number                                                                    
                      checkOverlaps); //overlaps checking                                                               
  }
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

//DetectorConstruction::DetectorConstruction()
//{}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

//DetectorConstruction::~DetectorConstruction()
//{}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......



    G4VPhysicalVolume* DetectorConstruction::Construct()

{  
  // Get nist material manager
  G4NistManager* nist = G4NistManager::Instance();
  G4Material* env_mat = nist->FindOrBuildMaterial("G4_AIR");
  // Envelope parameters
  G4double env_sizeXY = 8.66*mm, env_sizeZ = 12*mm;

  // Option to switch on/off checking of volumes overlaps
  //
  G4bool checkOverlaps = true;

  //
  // World
  //
  G4double world_sizeXY = 1.2*env_sizeXY;
  G4double world_sizeZ  = 1.2*env_sizeZ;
  G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");

  G4Box* solidWorld =
    new G4Box("World",                       //its name
       world_sizeXY, world_sizeXY, world_sizeZ);     //its size

  G4LogicalVolume* logicWorld =
    new G4LogicalVolume(solidWorld,          //its solid
                        world_mat,           //its material
                        "World");            //its name

  G4VPhysicalVolume* physWorld =
    new G4PVPlacement(0,                     //no rotation
                      G4ThreeVector(),       //at (0,0,0)
                      logicWorld,            //its logical volume
                      "World",               //its name
                      0,                     //its mother  volume
                      false,                 //no boolean operation
                      0,                     //copy number
                      checkOverlaps);        //overlaps checking

  //
  // Envelope
  //
  G4Box* solidEnv =
    new G4Box("Envelope",                    //its name
        env_sizeXY, env_sizeXY, env_sizeZ); //its size

  G4LogicalVolume* logicEnv =
    new G4LogicalVolume(solidEnv,            //its solid
                        env_mat,             //its material
                        "Envelope");         //its name

  new G4PVPlacement(0,                       //no rotation
                    G4ThreeVector(),         //at (0,0,0)
                    logicEnv,                //its logical volume
                    "Envelope",              //its name
                    logicWorld,              //its mother  volume
                    false,                   //no boolean operation
                    0,                       //copy number
                    checkOverlaps);          //overlaps checking

  //
  // Shape 1
  //
  G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_Pb");
 

  G4ThreeVector pos1 = G4ThreeVector(0, 1*mm, -5*mm);
    
  //G4RotationMatrix *rm = new G4RotationMatrix; 
  //rm->rotateY(45*deg);   
  // Conical section shape       
  G4Box *solidShape1 = new G4Box("Shape1", 1.*mm,1.*mm,1.*mm); 
  //G4double phi = 45*deg;
  G4RotationMatrix *rotm1 = new G4RotationMatrix();
  rotm1 -> rotateY(45.0 *deg);
  //rotm1.rotateZ(phi); 
  //G4RotationMatrix *solidShape1 = new G4RotationMatrix;
  //solidShape1->rotateY(30*deg);
   



//   G4Box* solidShape1
//= new G4Box("Shape1", Shape1_hx, Shape1_hy, Shape1_hz);                  
    
  G4LogicalVolume* logicShape1 =                         
    new G4LogicalVolume(solidShape1,         //its solid
                        shape1_mat,          //its material
                        "Shape1");           //its name
               
  new G4PVPlacement(rotm1,                       //no rotation
                    pos1,                    //at position
                    logicShape1,             //its logical volume
                    "Shape1",                //its name
                    logicEnv,                //its mother  volume
                    false,                   //no boolean operation
                    0,                       //copy number
                    checkOverlaps);          //overlaps checking
  //
  // Shape 2
  //
  
  G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_Ge");
  G4ThreeVector pos2 = G4ThreeVector(0, -1*mm, 7*mm);


  const G4int nsect = 6; 
  std::vector<G4TwoVector> polygon(nsect);
  G4double ang = twopi / nsect;
  //G4double dR = 2.5 * cm;
  G4double fScint1Thickness = 2.5 * mm;

  G4int nhex = 5;
  G4double d = env_sizeXY/nhex;
  G4double r = d/std::sqrt(3.);
  G4double dR = 0.99*r; 

  for (G4int i = 0; i < nsect; ++i)
  {
        G4double phi = i * ang- 0.5*ang;
        G4double cosphi = std::cos(phi);
        G4double sinphi = std::sin(phi); 
        polygon[i].set(dR * cosphi, dR * sinphi);
  }


  G4TwoVector offsetA(0., 0.), offsetB(0., 0.);
  G4double scaleA = 1., scaleB = 1.;
  G4ExtrudedSolid* solidScint1 = new G4ExtrudedSolid("Extruded", polygon, fScint1Thickness / 2, offsetA, scaleA, offsetB, scaleB);


  G4LogicalVolume* logicShape2 =
    new G4LogicalVolume(solidScint1 ,         //its solid
                        shape2_mat,          //its material
                        "solidScint1");           //its name


 PlaceHexagons(d,   -1.5*r, dR, nhex-1, logicShape2, logicEnv);
//PlaceHexagons(d,   0.*r,dR, nhex-1,   logicShape2, logicEnv);
PlaceHexagons(d,  0*r, dR, nhex,logicShape2,logicEnv);
PlaceHexagons(d,  1.5*r,dR, nhex-1, logicShape2, logicEnv);
PlaceHexagons(d,   3.*r, dR, nhex-2,   logicShape2, logicEnv);
PlaceHexagons(d,   -3.*r, dR, nhex-2,   logicShape2, logicEnv);
  //



  // Set Shape2 as scoring volume
  //
  
//  G4MagneticField* magField =
//new G4UniformMagField(G4ThreeVector(0.,0.,1.*tesla);

//void PhysicsList::ConstructEM() 

//{

  //  emPhysicsList = new G4EmLivermorePolarizedPhysics;
   // emPhysicsList->ConstructProcess();
//}




  fScoringVolume = logicShape2;




  //
  //always return the physical World
  //
  return physWorld;

//}
//}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......


void PhysicsList::ConstructEM()
{

    emPhysicsList = new G4EmLivermorePolarizedPhysics;
    emPhysicsList->ConstructProcess();
} 



//void DetectorConstruction::ConstructSDandField()

 // G4MagneticField* magField =
//new G4UniformMagField(G4ThreeVector(1.*Tesla,0.,0.);

  // G4ThreeVector fieldValue = G4ThreeVector();
  //fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
  //fMagFieldMessenger->SetVerboseLevel(1);
  //G4AutoDelete::Register(fMagFieldMessenger);


}
}




Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

Geant4 Version:
Operating System:
Compiler/Version:
CMake Version:


It doesn’t like that you are defining your function
void PhysicsList::ConstructEM()
Inside of your namespace B3. Actually I wouldn’t define any physics list functions inside of your detector construction file

Thanks for your response. if I comment out the Physics function, the error is gone. However, I need the Physics function to get the shower.

As @loydms commented, I wouldn’t define functions unrelated to DetectorConstruction in its implementation file. Keep the physics related code in PhysicsList.cc, and make sure the member function is declared in class PhysicsList.