Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-sim94 Rearranging the files in SimG4CMS/Forward #34796

Merged
merged 2 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion SimG4CMS/Forward/plugins/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "SimG4CMS/Forward/interface/ZdcTestAnalysis.h"
#include "SimG4CMS/Forward/interface/DoCastorAnalysis.h"
#include "SimG4CMS/Forward/interface/BscTest.h"
#include "SimG4CMS/Forward/plugins/SimG4FluxProducer.h"
#include "SimG4CMS/Forward/interface/SimG4FluxProducer.h"

#include "SimG4Core/Watcher/interface/SimWatcherFactory.h"
#include "FWCore/PluginManager/interface/ModuleDef.h"
Expand Down
83 changes: 44 additions & 39 deletions SimG4CMS/Forward/src/BscTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

//================================================================

//#define EDM_ML_DEBUG

//UserVerbosity BscTest::std::cout("BscTest","info","BscTest");
enum ntbsc_elements { ntbsc_evt };

Expand All @@ -57,8 +59,8 @@ BscTest::BscTest(const edm::ParameterSet& p) {
fRecreateFile = m_Anal.getParameter<std::string>("FRecreateFile");

if (verbosity > 0) {
std::cout << "============================================================================" << std::endl;
std::cout << "BscTestconstructor :: Initialized as observer" << std::endl;
edm::LogVerbatim("BscTest") << "============================================================================";
edm::LogVerbatim("BscTest") << "BscTestconstructor :: Initialized as observer";
}
// Initialization:

Expand All @@ -68,7 +70,7 @@ BscTest::BscTest(const edm::ParameterSet& p) {
TheHistManager = new BscAnalysisHistManager(fDataLabel);

if (verbosity > 0) {
std::cout << "BscTest constructor :: Initialized BscAnalysisHistManager" << std::endl;
edm::LogVerbatim("BscTest") << "BscTest constructor :: Initialized BscAnalysisHistManager";
}
}

Expand All @@ -77,23 +79,23 @@ BscTest::~BscTest() {
delete theBscNumberingScheme;

TFile bscOutputFile("newntbsc.root", "RECREATE");
std::cout << "Bsc output root file has been created";
edm::LogVerbatim("BscTest") << "Bsc output root file has been created";
bsceventntuple->Write();
std::cout << ", written";
edm::LogVerbatim("BscTest") << ", written";
bscOutputFile.Close();
std::cout << ", closed";
edm::LogVerbatim("BscTest") << ", closed";
delete bsceventntuple;
std::cout << ", and deleted" << std::endl;
edm::LogVerbatim("BscTest") << ", and deleted";

//------->while end

// Write histograms to file
TheHistManager->WriteToFile(fOutputFile, fRecreateFile);
if (verbosity > 0) {
std::cout << std::endl << "BscTest Destructor --------> End of BscTest : " << std::endl;
edm::LogVerbatim("BscTest") << std::endl << "BscTest Destructor --------> End of BscTest : ";
}

std::cout << "BscTest: End of process" << std::endl;
edm::LogVerbatim("BscTest") << "BscTest: End of process";
}

//================================================================
Expand Down Expand Up @@ -143,9 +145,9 @@ void BscAnalysisHistManager::BookHistos() {
void BscAnalysisHistManager::WriteToFile(const TString& fOutputFile, const TString& fRecreateFile) {
//Write to file = fOutputFile

std::cout << "================================================================" << std::endl;
std::cout << " Write this Analysis to File " << fOutputFile << std::endl;
std::cout << "================================================================" << std::endl;
edm::LogVerbatim("BscTest") << "================================================================";
edm::LogVerbatim("BscTest") << " Write this Analysis to File " << fOutputFile;
edm::LogVerbatim("BscTest") << "================================================================";

TFile* file = new TFile(fOutputFile, fRecreateFile);

Expand Down Expand Up @@ -188,9 +190,9 @@ TH1F* BscAnalysisHistManager::GetHisto(Int_t Number) {
return (TH1F*)(fHistArray->At(Number));

} else {
std::cout << "!!!!!!!!!!!!!!!!!!GetHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl;
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!!!GetHisto!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
edm::LogVerbatim("BscTest") << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number;
edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";

return (TH1F*)(fHistArray->At(0));
}
Expand All @@ -204,9 +206,9 @@ TH2F* BscAnalysisHistManager::GetHisto2(Int_t Number) {
return (TH2F*)(fHistArray->At(Number));

} else {
std::cout << "!!!!!!!!!!!!!!!!GetHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number << std::endl;
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!GetHisto2!!!!!!!!!!!!!!!!!!!!!!!!!!!";
edm::LogVerbatim("BscTest") << " WARNING ERROR - HIST ID INCORRECT (TOO HIGH) - " << Number;
edm::LogVerbatim("BscTest") << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";

return (TH2F*)(fHistArray->At(0));
}
Expand Down Expand Up @@ -240,15 +242,15 @@ void BscAnalysisHistManager::StoreWeights() {
//==================================================================== per JOB
void BscTest::update(const BeginOfJob* job) {
//job
std::cout << "BscTest:beggining of job" << std::endl;
edm::LogVerbatim("BscTest") << "BscTest:beggining of job";
;
}

//==================================================================== per RUN
void BscTest::update(const BeginOfRun* run) {
//run

std::cout << std::endl << "BscTest:: Begining of Run" << std::endl;
edm::LogVerbatim("BscTest") << std::endl << "BscTest:: Begining of Run";
}

void BscTest::update(const EndOfRun* run) { ; }
Expand All @@ -257,7 +259,7 @@ void BscTest::update(const EndOfRun* run) { ; }
void BscTest::update(const BeginOfEvent* evt) {
iev = (*evt)()->GetEventID();
if (verbosity > 0) {
std::cout << "BscTest:update Event number = " << iev << std::endl;
edm::LogVerbatim("BscTest") << "BscTest:update Event number = " << iev;
}
whichevent++;
}
Expand All @@ -266,7 +268,7 @@ void BscTest::update(const BeginOfEvent* evt) {
void BscTest::update(const BeginOfTrack* trk) {
itrk = (*trk)()->GetTrackID();
if (verbosity > 1) {
std::cout << "BscTest:update BeginOfTrack number = " << itrk << std::endl;
edm::LogVerbatim("BscTest") << "BscTest:update BeginOfTrack number = " << itrk;
}
if (itrk == 1) {
SumEnerDeposit = 0.;
Expand All @@ -281,7 +283,7 @@ void BscTest::update(const BeginOfTrack* trk) {
void BscTest::update(const EndOfTrack* trk) {
itrk = (*trk)()->GetTrackID();
if (verbosity > 1) {
std::cout << "BscTest:update EndOfTrack number = " << itrk << std::endl;
edm::LogVerbatim("BscTest") << "BscTest:update EndOfTrack number = " << itrk;
}
if (itrk == 1) {
G4double tracklength = (*trk)()->GetTrackLength(); // Accumulated track length
Expand All @@ -308,13 +310,13 @@ void BscTest::update(const G4Step* aStep) {

if (verbosity > 2) {
G4int stepnumber = aStep->GetTrack()->GetCurrentStepNumber();
std::cout << "BscTest:update Step number = " << stepnumber << std::endl;
edm::LogVerbatim("BscTest") << "BscTest:update Step number = " << stepnumber;
}
// track on aStep: !
G4Track* theTrack = aStep->GetTrack();
TrackInformation* trkInfo = dynamic_cast<TrackInformation*>(theTrack->GetUserInformation());
if (trkInfo == nullptr) {
std::cout << "BscTest on aStep: No trk info !!!! abort " << std::endl;
edm::LogVerbatim("BscTest") << "BscTest on aStep: No trk info !!!! abort ";
}
G4int id = theTrack->GetTrackID();
G4String particleType = theTrack->GetDefinition()->GetParticleName(); // !!!
Expand Down Expand Up @@ -518,7 +520,7 @@ void BscTest::update(const EndOfEvent* evt) {

if (verbosity > 1) {
iev = (*evt)()->GetEventID();
std::cout << "BscTest:update EndOfEvent = " << iev << std::endl;
edm::LogVerbatim("BscTest") << "BscTest:update EndOfEvent = " << iev;
}
// Fill-in ntuple
bsceventarray[ntbsc_evt] = (float)whichevent;
Expand All @@ -530,17 +532,17 @@ void BscTest::update(const EndOfEvent* evt) {
// prim.vertex:
G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
if (nvertex != 1)
std::cout << "BscTest: My warning: NumberOfPrimaryVertex != 1 --> = " << nvertex << std::endl;
edm::LogVerbatim("BscTest") << "BscTest: My warning: NumberOfPrimaryVertex != 1 --> = " << nvertex;

for (int i = 0; i < nvertex; i++) {
G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i);
if (avertex == nullptr)
std::cout << "BscTest End Of Event ERR: pointer to vertex = 0" << std::endl;
edm::LogVerbatim("BscTest") << "BscTest End Of Event ERR: pointer to vertex = 0";
G4int npart = avertex->GetNumberOfParticle();
if (npart != 1)
std::cout << "BscTest: My warning: NumberOfPrimaryPart != 1 --> = " << npart << std::endl;
edm::LogVerbatim("BscTest") << "BscTest: My warning: NumberOfPrimaryPart != 1 --> = " << npart;
if (npart == 0)
std::cout << "BscTest End Of Event ERR: no NumberOfParticle" << std::endl;
edm::LogVerbatim("BscTest") << "BscTest End Of Event ERR: no NumberOfParticle";

if (thePrim == nullptr)
thePrim = avertex->GetPrimary(trackID);
Expand Down Expand Up @@ -606,19 +608,22 @@ void BscTest::update(const EndOfEvent* evt) {
std::map<int, float, std::less<int> > themapxy;
std::map<int, float, std::less<int> > themapz;
// access to the G4 hit collections: -----> this work OK:

// edm::LogInfo("BscTest") << "1";
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("BscTest") << "1";
#endif
G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
// edm::LogInfo("BscTest") << "2";
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("BscTest") << "2";
#endif
if (verbosity > 0) {
std::cout << "BscTest: accessed all HC" << std::endl;
edm::LogVerbatim("BscTest") << "BscTest: accessed all HC";
;
}
int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("BSCHits");

BscG4HitCollection* theCAFI = (BscG4HitCollection*)allHC->GetHC(CAFIid);
if (verbosity > 0) {
std::cout << "BscTest: theCAFI->entries = " << theCAFI->entries() << std::endl;
edm::LogVerbatim("BscTest") << "BscTest: theCAFI->entries = " << theCAFI->entries();
}
int varia; // = 0 -all; =1 - MI; =2 - noMI
//varia = 0;
Expand Down Expand Up @@ -655,7 +660,7 @@ void BscTest::update(const EndOfEvent* evt) {
TheHistManager->GetHisto("zHitsnoMI")->Fill(zz);

if (verbosity > 2) {
std::cout << "BscTest:zHits = " << zz << std::endl;
edm::LogVerbatim("BscTest") << "BscTest:zHits = " << zz;
}

themap[unitID] += losenergy;
Expand Down Expand Up @@ -782,11 +787,11 @@ void BscTest::update(const EndOfEvent* evt) {
}
} // MIonly or noMIonly ENDED
if (totallosenergy == 0.0) {
std::cout << "BscTest: number of hits = " << theCAFI->entries() << std::endl;
edm::LogVerbatim("BscTest") << "BscTest: number of hits = " << theCAFI->entries();
for (int j = 0; j < nhits; j++) {
BscG4Hit* aHit = (*theCAFI)[j];
double losenergy = aHit->getEnergyLoss();
std::cout << " j hits = " << j << "losenergy = " << losenergy << std::endl;
edm::LogVerbatim("BscTest") << " j hits = " << j << "losenergy = " << losenergy;
}
}
// FIBRE Hit collected analysis
Expand Down Expand Up @@ -837,6 +842,6 @@ void BscTest::update(const EndOfEvent* evt) {
} // primary end

if (verbosity > 0) {
std::cout << "BscTest: END OF Event " << (*evt)()->GetEventID() << std::endl;
edm::LogVerbatim("BscTest") << "BscTest: END OF Event " << (*evt)()->GetEventID();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "SimG4FluxProducer.h"
#include "SimG4CMS/Forward/interface/SimG4FluxProducer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "G4Track.hh"
Expand Down
5 changes: 2 additions & 3 deletions SimG4CMS/Forward/src/TimingSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,8 @@ void TimingSD::EndOfEvent(G4HCofThisEvent*) {
Local3DPoint locExitPoint = ConvertToLocal3DPoint(aHit->getExitLocalP());

#ifdef EDM_ML_DEBUG
edm::LogInfo("TimingSim") << "TimingSD: Hit for storage \n"
<< *aHit << "\n Entry point: " << locEntryPoint << "\n Exit point: " << locExitPoint
<< "\n";
edm::LogVerbatim("TimingSim") << "TimingSD: Hit for storage \n"
<< *aHit << "\n Entry point: " << locEntryPoint << "\n Exit point: " << locExitPoint;
#endif

slave->processHits(PSimHit(locEntryPoint,
Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Forward/src/TotemRPNumberingScheme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// constructors and destructor
//
TotemRPNumberingScheme::TotemRPNumberingScheme(int i) {
edm::LogInfo("ForwardSim") << " Creating TotemRPNumberingScheme";
edm::LogVerbatim("ForwardSim") << " Creating TotemRPNumberingScheme";
}

TotemRPNumberingScheme::~TotemRPNumberingScheme() {}
2 changes: 1 addition & 1 deletion SimG4CMS/Forward/src/TotemRPOrganization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//
// constructors and destructor
//
TotemRPOrganization ::TotemRPOrganization() { edm::LogInfo("ForwardSim") << "Creating TotemRPOrganization"; }
TotemRPOrganization ::TotemRPOrganization() { edm::LogVerbatim("ForwardSim") << "Creating TotemRPOrganization"; }

TotemRPOrganization ::~TotemRPOrganization() {}

Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Forward/src/TotemT1NumberingScheme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// constructors and destructor
//
TotemT1NumberingScheme::TotemT1NumberingScheme(int i) {
edm::LogInfo("ForwardSim") << " Creating TotemT1NumberingScheme";
edm::LogVerbatim("ForwardSim") << " Creating TotemT1NumberingScheme";
setCurrentDetectorPosition(i);
}

Expand Down
14 changes: 7 additions & 7 deletions SimG4CMS/Forward/src/TotemT1Organization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TotemT1Organization ::TotemT1Organization()
_currentCSC(-1),
_currentLayer(-1),
_currentObjectType(Undefined) {
edm::LogInfo("ForwardSim") << "Creating TotemT1Organization";
edm::LogVerbatim("ForwardSim") << "Creating TotemT1Organization";
}

TotemT1Organization ::~TotemT1Organization() {}
Expand Down Expand Up @@ -188,7 +188,7 @@ int TotemT1Organization ::fromObjectTypeToInt(ObjectType objectType) {
int result(static_cast<int>(objectType));
if (result < 0 || result >= MaxObjectTypes) {
result = 0;
edm::LogInfo("ForwardSim") << "Invalid ObjectType value (" << objectType << "). Now is \"Undefined\"";
edm::LogVerbatim("ForwardSim") << "Invalid ObjectType value (" << objectType << "). Now is \"Undefined\"";
}
return result;
}
Expand Down Expand Up @@ -299,24 +299,24 @@ void TotemT1Organization ::_FromDataToUnitID(void) {
default:
_currentDetectorPosition = 0;
currDP = 0;
edm::LogInfo("ForwardSim") << "Invalid _currentDetectorPosition value (" << _currentDetectorPosition
<< "). Now is \"Undefined\"";
edm::LogVerbatim("ForwardSim") << "Invalid _currentDetectorPosition value (" << _currentDetectorPosition
<< "). Now is \"Undefined\"";
}

if (_currentPlane < -1) {
edm::LogInfo("ForwardSim") << "Invalid _currentPlane value (" << _currentPlane << "). Now is -1";
edm::LogVerbatim("ForwardSim") << "Invalid _currentPlane value (" << _currentPlane << "). Now is -1";
_currentPlane = -1;
}
currPL = _currentPlane + 1;

if (_currentCSC < -1 || _currentCSC > 5) {
edm::LogInfo("ForwardSim") << "Invalid _currentCSC value (" << _currentCSC << "). Now is -1";
edm::LogVerbatim("ForwardSim") << "Invalid _currentCSC value (" << _currentCSC << "). Now is -1";
_currentCSC = -1;
}
currCSC = _currentCSC + 1;

if (_currentLayer < -1) {
edm::LogInfo("ForwardSim") << "Invalid _currentLayer value (" << _currentLayer << "). Now is -1";
edm::LogVerbatim("ForwardSim") << "Invalid _currentLayer value (" << _currentLayer << "). Now is -1";
_currentLayer = -1;
}
currLA = _currentLayer + 1;
Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Forward/src/TotemT2NumberingSchemeGem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// constructors and destructor
//
TotemT2NumberingSchemeGem::TotemT2NumberingSchemeGem(int i) {
edm::LogInfo("ForwardSim") << " Creating TotemT2NumberingSchemeGem";
edm::LogVerbatim("ForwardSim") << " Creating TotemT2NumberingSchemeGem";
}

TotemT2NumberingSchemeGem::~TotemT2NumberingSchemeGem() {}
4 changes: 3 additions & 1 deletion SimG4CMS/Forward/src/TotemT2OrganizationGem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
// constructors and destructor
//

TotemT2OrganizationGem ::TotemT2OrganizationGem() { edm::LogInfo("ForwardSim") << "Creating TotemT2OrganizationGem"; }
TotemT2OrganizationGem ::TotemT2OrganizationGem() {
edm::LogVerbatim("ForwardSim") << "Creating TotemT2OrganizationGem";
}

TotemT2OrganizationGem ::~TotemT2OrganizationGem() {}

Expand Down
4 changes: 2 additions & 2 deletions SimG4CMS/Forward/src/TotemTestGem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ TotemTestGem::TotemTestGem(const edm::ParameterSet& p) {
edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("TotemTestGem");
names = m_Anal.getParameter<std::vector<std::string> >("Names");

edm::LogInfo("ForwardSim") << "TotemTestGem:: Initialised as observer of "
<< "begin of job, begin/end events and of G4step";
edm::LogVerbatim("ForwardSim")
<< "TotemTestGem:: Initialised as observer of begin of job, begin/end events and of G4step";
}

TotemTestGem::~TotemTestGem() {}
Expand Down