Use nullptr (C++) instead of NULL (C)
This commit is contained in:
@@ -88,7 +88,7 @@ public:
|
||||
static F04GlobalField* getObject();
|
||||
|
||||
//
|
||||
static G4bool Exists() {if (object==NULL) {return false;} else {return true;}; }
|
||||
static G4bool Exists() {if (object==nullptr) {return false;} else {return true;}; }
|
||||
|
||||
/// GetFieldValue() returns the field value at a given point[].
|
||||
/// field is really field[6]: Bx,By,Bz,Ex,Ey,Ez.
|
||||
|
||||
@@ -150,7 +150,7 @@ void F04ElementField::construct()
|
||||
|
||||
G4VisAttributes *F04ElementField::getVisAttribute(G4String color)
|
||||
{
|
||||
G4VisAttributes *p = NULL;
|
||||
G4VisAttributes *p = nullptr;
|
||||
if (color.size() > 0 && (isdigit(color.c_str()[0]) || color.c_str()[0] == '.')) {
|
||||
G4double red = 0.0, green = 0.0, blue = 0.0;
|
||||
if (sscanf(color.c_str(), "%lf,%lf,%lf", &red, &green, &blue) == 3) {
|
||||
|
||||
@@ -120,7 +120,7 @@ void musrDetectorMessenger::SetNewValue(G4UIcommand *command, G4String newValue)
|
||||
G4cout << "*** Random Seed set by the system time ***" << G4endl;
|
||||
G4cout << "******************************************" << G4endl;
|
||||
long seeds[2];
|
||||
time_t systime = time(NULL);
|
||||
time_t systime = time(nullptr);
|
||||
seeds[0] = (long)systime;
|
||||
seeds[1] = (long)(systime * G4UniformRand());
|
||||
G4cout << "seed1: " << seeds[0] << "; seed2: " << seeds[1] << G4endl;
|
||||
|
||||
@@ -34,7 +34,7 @@ musrErrorMessage::musrErrorMessage():nErrors(1)
|
||||
|
||||
musrErrorMessage::~musrErrorMessage() {}
|
||||
|
||||
musrErrorMessage* musrErrorMessage::pointerToErrors=NULL;
|
||||
musrErrorMessage* musrErrorMessage::pointerToErrors=nullptr;
|
||||
musrErrorMessage* musrErrorMessage::GetInstance() {
|
||||
return pointerToErrors;
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ musrMuonium* musrMuonium::Definition()
|
||||
1, 0, 0,
|
||||
0, 0, 0,
|
||||
"lepton", -1, 0, -1313,
|
||||
false, 2197.03*CLHEP::ns, NULL,
|
||||
false, 2197.03*CLHEP::ns, nullptr,
|
||||
false, "mu"
|
||||
);
|
||||
// Bohr magnetron of Muonium - T. Shiroka
|
||||
|
||||
@@ -45,7 +45,7 @@ musrParameters::musrParameters(G4String steeringFileName)
|
||||
// (and therefore the parameters can not be read in in the musrDetectorConstruction.cc class).
|
||||
|
||||
FILE *fSteeringFile=fopen(steeringFileName.c_str(),"r");
|
||||
if (fSteeringFile==NULL) {
|
||||
if (fSteeringFile==nullptr) {
|
||||
G4cout<<"musrParameters::musrParameters: steeringFileName=\""<<steeringFileName
|
||||
<<"\" not opened for some reason."<<G4endl;
|
||||
G4cout << "S T O P F O R C E D" << G4endl;
|
||||
@@ -139,7 +139,7 @@ musrParameters::musrParameters(G4String steeringFileName)
|
||||
|
||||
musrParameters::~musrParameters() {}
|
||||
|
||||
musrParameters* musrParameters::pointerToParameters=NULL;
|
||||
musrParameters* musrParameters::pointerToParameters=nullptr;
|
||||
musrParameters* musrParameters::GetInstance() {
|
||||
return pointerToParameters;
|
||||
}
|
||||
|
||||
@@ -280,6 +280,7 @@ void musrPhysicsList::ConstructProcess()
|
||||
//cks 14.12.2011 #include "G4UrbanMscModel92.hh"
|
||||
//#include "G4UrbanMscModel93.hh"
|
||||
#include "G4UrbanMscModel.hh"
|
||||
#include <string>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -288,7 +289,7 @@ void musrPhysicsList::ConstructEM()
|
||||
// cks 2008.08.22. - Adding the possibility to define the processes from the steering file:
|
||||
char charSteeringFileName[1000]; strcpy(charSteeringFileName,(musrParameters::mySteeringFileName).c_str());
|
||||
FILE *fSteeringFile=fopen(charSteeringFileName,"r");
|
||||
if (fSteeringFile==NULL) {
|
||||
if (fSteeringFile==nullptr) {
|
||||
sprintf(eMessage,"musrPhysicsList::ConstructEM(): Failed to open macro file \"%s\" .",charSteeringFileName);
|
||||
musrErrorMessage::GetInstance()->musrError(FATAL,eMessage,false);
|
||||
}
|
||||
@@ -312,7 +313,7 @@ void musrPhysicsList::ConstructEM()
|
||||
G4String stringParticleName = charParticleName;
|
||||
G4ParticleDefinition* particleDefinition = G4ParticleTable::GetParticleTable() -> FindParticle(stringParticleName);
|
||||
// G4cout<<"particleDefinition of "<<stringParticleName<<" = "<<particleDefinition<<G4endl;
|
||||
if (particleDefinition==NULL) {
|
||||
if (particleDefinition==nullptr) {
|
||||
if ((stringParticleName=="opticalphoton")&& (!(musrParameters::boolG4OpticalPhotons))) {
|
||||
musrErrorMessage::GetInstance()->musrError(INFO,
|
||||
"musrPhysicsList: Ignoring optical photon process definition because G4OpticalPhotons in *.mac file is set to false",false);
|
||||
@@ -447,7 +448,7 @@ void musrPhysicsList::ConstructEM()
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*s %s %d",charModelName,&modelPriority);
|
||||
G4String stringModelName = charModelName;
|
||||
G4cout<<" Adding model "<<charModelName<<" with priority "<<modelPriority<<" to process "<<charProcessName<<"."<<G4endl;
|
||||
// if (myProc==NULL) {
|
||||
// if (myProc==nullptr) {
|
||||
// sprintf(eMessage,"musrPhysicsList: Trying to add model \"%s\" , but the process \"%s\" not found in G4ProcessTable.",
|
||||
// charModelName,charProcessName);
|
||||
// musrErrorMessage::GetInstance()->musrError(FATAL,eMessage,false);
|
||||
@@ -640,7 +641,7 @@ void musrPhysicsList::ReportProblemWithProcessDefinition(char myString[501]) {
|
||||
|
||||
G4Region* musrPhysicsList::FindG4Region(G4String regionName, char* lineOfSteeringFile) {
|
||||
G4Region* myRegion = G4RegionStore::GetInstance()->GetRegion(regionName,false);
|
||||
if( myRegion != NULL ) { // G4Region found
|
||||
if( myRegion != nullptr ) { // G4Region found
|
||||
return myRegion;
|
||||
}
|
||||
else { // G4Region not found
|
||||
|
||||
@@ -48,7 +48,7 @@ G4bool musrPrimaryGeneratorAction::setRandomNrSeedFromFile_RNDM=0;
|
||||
G4int musrPrimaryGeneratorAction::nRndmEventToSaveSeeds=-2;
|
||||
G4int musrPrimaryGeneratorAction::lastEventID_in_pointerToSeedVector=0;
|
||||
|
||||
std::vector<int> * musrPrimaryGeneratorAction::pointerToSeedVector=NULL;
|
||||
std::vector<int> * musrPrimaryGeneratorAction::pointerToSeedVector=nullptr;
|
||||
std::vector<int> * musrPrimaryGeneratorAction::GetPointerToSeedVector() {
|
||||
return pointerToSeedVector;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ void musrPrimaryGeneratorAction::SetMuonDecayTimeLimits(G4ThreeVector decayTimeL
|
||||
void musrPrimaryGeneratorAction::SetTurtleInput(G4String turtleFileName) {
|
||||
takeMuonsFromTurtleFile = true;
|
||||
fTurtleFile = fopen(turtleFileName.c_str(),"r");
|
||||
if (fTurtleFile==NULL) {
|
||||
if (fTurtleFile==nullptr) {
|
||||
G4cout << "E R R O R : Failed to open TURTLE input file \"" << turtleFileName
|
||||
<<"\"."<< G4endl;
|
||||
G4cout << "S T O P F O R C E D" << G4endl;
|
||||
@@ -462,7 +462,7 @@ void musrPrimaryGeneratorAction::SetTurtleInput(G4String turtleFileName) {
|
||||
|
||||
//===============================================================================
|
||||
void musrPrimaryGeneratorAction::SetTurtleInputFileToEventNo(G4int lineNumberOfTurtleFile) {
|
||||
if (fTurtleFile==NULL) {
|
||||
if (fTurtleFile==nullptr) {
|
||||
G4cout << "musrPrimaryGeneratorAction::SetTurtleInputFileToEventNo:"
|
||||
<<" TURTLE input file not found - line number can not be set."<<G4endl;
|
||||
}
|
||||
@@ -547,7 +547,7 @@ void musrPrimaryGeneratorAction::SetKEnergy(G4double val) {
|
||||
void musrPrimaryGeneratorAction::SetPrimaryParticule(G4String particleName) {
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particule= particleTable->FindParticle(particleName);
|
||||
if (particule!=NULL) {
|
||||
if (particule!=nullptr) {
|
||||
G4cout<<" musrPrimaryGeneratorAction::SetPrimaryParticleMuMinus(): USING "
|
||||
<<particleName<<" AS PRIMARY PARTICLE!"<<G4endl;
|
||||
particleGun->SetParticleDefinition(particule);
|
||||
|
||||
@@ -99,7 +99,7 @@ void musrRunAction::EndOfRunAction(const G4Run* aRun) {
|
||||
|
||||
if (F04GlobalField::Exists()) {
|
||||
F04GlobalField* myGlobalField = F04GlobalField::getObject(); //Was causing seg. fault when called here
|
||||
if (myGlobalField!=NULL) {delete myGlobalField;}
|
||||
if (myGlobalField!=nullptr) {delete myGlobalField;}
|
||||
}
|
||||
|
||||
musrErrorMessage::GetInstance()->PrintErrorSummary();
|
||||
|
||||
+4
-4
@@ -139,7 +139,7 @@ musrScintSD::musrScintSD(G4String name)
|
||||
|
||||
musrScintSD::~musrScintSD(){ }
|
||||
|
||||
musrScintSD* musrScintSD::pointer=NULL;
|
||||
musrScintSD* musrScintSD::pointer=nullptr;
|
||||
musrScintSD* musrScintSD::GetInstance() {return pointer;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -260,7 +260,7 @@ void musrScintSD::ProcessOpticalPhoton(G4Step* aStep) {
|
||||
// }
|
||||
|
||||
G4OpBoundaryProcessStatus boundaryStatus=Undefined;
|
||||
static G4OpBoundaryProcess* boundaryProc=NULL;
|
||||
static G4OpBoundaryProcess* boundaryProc=nullptr;
|
||||
//find the boundary process only once
|
||||
if(!boundaryProc){
|
||||
G4ProcessManager* pm = aStep->GetTrack()->GetDefinition()->GetProcessManager();
|
||||
@@ -644,7 +644,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
||||
G4double OPSA_CFD_ampl = -1000;
|
||||
G4int iHistNr = -1;
|
||||
G4int iHistNrSUM = -1;
|
||||
// TF1* poiss = NULL;
|
||||
// TF1* poiss = nullptr;
|
||||
for (optHitDetectorMapType::const_iterator it2 = optHitDetectorMap->begin(); it2 != optHitDetectorMap->end(); it2++ ) {
|
||||
//delete G4cout<<"KAMIL: Nr of optHitDetectorMap->size()="<<optHitDetectorMap->size()<<G4endl;
|
||||
OPSA_nPhot++;
|
||||
@@ -1103,7 +1103,7 @@ void musrScintSD::ReadInPulseShapeArray(const char* filename) {
|
||||
std::ifstream file( filename );
|
||||
// FILE* file = fopen(filename,"r");
|
||||
if (!(file.is_open())) {
|
||||
// if (file==NULL) {
|
||||
// if (file==nullptr) {
|
||||
G4cout << "musrScintSD::ReadInPulseShapeArray: requested pulse shape data file \""<< filename << "\" not opened (found) !!!"<<G4endl;
|
||||
musrErrorMessage::GetInstance()->musrError(FATAL,"musrScintSD: pulse shape data file not found !",false);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ musrSteppingAction::musrSteppingAction() {
|
||||
boolMuonEventReweighting = false;
|
||||
boolCalculateFieldIntegral = false;
|
||||
myRootOutput = musrRootOutput::GetRootInstance();
|
||||
if (myRootOutput == NULL) {
|
||||
if (myRootOutput == nullptr) {
|
||||
musrErrorMessage::GetInstance()->musrError(FATAL,
|
||||
"musrSteppingAction::musrSteppingAction(): pointer to the musrRootOutput class not found! ==> EXECUTION STOPPED",true);
|
||||
}
|
||||
@@ -184,8 +184,8 @@ void musrSteppingAction::UserSteppingAction(const G4Step* aStep) {
|
||||
// Save info about the old tracks, if the user wishes to have Vvv info in the output Root Tree.
|
||||
if (boolIsVvvInfoRequested) {
|
||||
G4VPhysicalVolume* nextVolume = aTrack->GetNextVolume();
|
||||
if (nextVolume!=NULL) {
|
||||
if ((nextVolume->GetLogicalVolume()->GetSensitiveDetector()!=NULL)||(actualLogicalVolume->GetSensitiveDetector()!=NULL)) {
|
||||
if (nextVolume!=nullptr) {
|
||||
if ((nextVolume->GetLogicalVolume()->GetSensitiveDetector()!=nullptr)||(actualLogicalVolume->GetSensitiveDetector()!=nullptr)) {
|
||||
G4int trackID = aTrack->GetTrackID();
|
||||
std::map<G4int,G4int>::iterator itr;
|
||||
itr = myOldTracksMap.find(trackID);
|
||||
@@ -199,7 +199,7 @@ void musrSteppingAction::UserSteppingAction(const G4Step* aStep) {
|
||||
vertexKine_oldTrack[indexOfOldTrack] = aTrack->GetVertexKineticEnergy();
|
||||
vertexPosition_oldTrack[indexOfOldTrack] = aTrack->GetVertexPosition();
|
||||
vertexLogVol_oldTrack[indexOfOldTrack] = aTrack->GetLogicalVolumeAtVertex()->GetName();
|
||||
if ((aTrack->GetCreatorProcess())!=NULL) { vertexProcess_oldTrack[indexOfOldTrack] = aTrack->GetCreatorProcess()->GetProcessName();}
|
||||
if ((aTrack->GetCreatorProcess())!=nullptr) { vertexProcess_oldTrack[indexOfOldTrack] = aTrack->GetCreatorProcess()->GetProcessName();}
|
||||
else { vertexProcess_oldTrack[indexOfOldTrack] = "initialParticle";}
|
||||
}
|
||||
else {
|
||||
@@ -326,7 +326,7 @@ void musrSteppingAction::UserSteppingAction(const G4Step* aStep) {
|
||||
|
||||
// Pick up process "DecayWithSpin":
|
||||
const G4VProcess* process = postStepPoint->GetProcessDefinedStep();
|
||||
if (process!=NULL) {
|
||||
if (process!=nullptr) {
|
||||
G4String processName = process->GetProcessName();
|
||||
if (processName=="DecayWithSpin") {
|
||||
// std::cout<<"musrSteppingAction: DecayWithSpin"<<std::endl;
|
||||
@@ -365,7 +365,7 @@ void musrSteppingAction::UserSteppingAction(const G4Step* aStep) {
|
||||
else {
|
||||
G4FieldManager *fMgr=G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
// G4cout<<"Debug 1"<<G4endl;
|
||||
if (fMgr!=NULL) {
|
||||
if (fMgr!=nullptr) {
|
||||
// G4cout<<"Debug 2"<<G4endl;
|
||||
if(!fMgr->DoesFieldChangeEnergy()) { //then we have a magnetic field
|
||||
// G4cout<<"Debug 3"<<G4endl;
|
||||
|
||||
@@ -78,7 +78,7 @@ void musrSteppingVerbose::StepInfo()
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr){
|
||||
G4cout << " "
|
||||
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
|
||||
Reference in New Issue
Block a user