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

debugged MaterialBudgetAction and runP_*_cfg.py #13434

Merged
merged 2 commits into from
Mar 6, 2016
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Validation/Geometry/interface/MaterialBudgetAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@
class BeginOfTrack;
class BeginOfRun;
class BeginOfEvent;
class EndOfEvent;
class G4Step;
class EndOfTrack;
class EndOfRun;
class G4StepPoint;
class G4VTouchable;

class MaterialBudgetAction : public SimWatcher,
public Observer<const BeginOfRun*>,
public Observer<const BeginOfTrack*>,
public Observer<const G4Step*>,
public Observer<const EndOfTrack*>
public Observer<const EndOfTrack*>,
public Observer<const EndOfRun*>
{
public:
MaterialBudgetAction(const edm::ParameterSet&);
Expand All @@ -45,6 +48,7 @@ class MaterialBudgetAction : public SimWatcher,
void update(const BeginOfTrack*);
void update(const G4Step*);
void update(const EndOfTrack*);
void update(const EndOfRun*);

bool CheckTouchableInSelectedVolumes( const G4VTouchable* touch );
bool StopAfterProcess( const G4Step* aStep );
Expand Down
6 changes: 5 additions & 1 deletion Validation/Geometry/python/single_neutrino_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

process = cms.Process("TestProcess")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.load("IOMC.EventVertexGenerators.VtxSmearedFlat_cfi")
process.load("GeneratorInterface.Core.generatorSmeared_cfi")

process.load("Configuration.EventContent.EventContent_cff")

Expand All @@ -11,6 +13,8 @@

process.load("IOMC.RandomEngine.IOMC_cff")
process.RandomNumberGeneratorService.generator.initialSeed = 456789
process.RandomNumberGeneratorService.VtxSmeared.engineName = cms.untracked.string('HepJamesRandom')
process.RandomNumberGeneratorService.VtxSmeared.initialSeed = cms.untracked.uint32(98765432)

process.source = cms.Source("EmptySource",
firstRun = cms.untracked.uint32(1),
Expand All @@ -36,6 +40,6 @@
fileName = cms.untracked.string('single_neutrino_random.root')
)

process.p1 = cms.Path(process.generator)
process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared)
process.outpath = cms.EndPath(process.o1)

17 changes: 12 additions & 5 deletions Validation/Geometry/src/MaterialBudgetAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "SimG4Core/Notification/interface/BeginOfRun.h"
#include "SimG4Core/Notification/interface/EndOfRun.h"
#include "SimG4Core/Notification/interface/BeginOfTrack.h"
#include "SimG4Core/Notification/interface/EndOfTrack.h"
#include "SimG4Core/Notification/interface/EndOfEvent.h"
Expand Down Expand Up @@ -123,11 +124,6 @@ MaterialBudgetAction::MaterialBudgetAction(const edm::ParameterSet& iPSet)
//-------------------------------------------------------------------------
MaterialBudgetAction::~MaterialBudgetAction()
{
if (saveToTxt) delete theTxt;
if (saveToTree) delete theTree;
if (saveToHistos) delete theHistos;
if (theHistoMgr) delete theHistoMgr;
delete theData;
}

//-------------------------------------------------------------------------
Expand Down Expand Up @@ -311,6 +307,17 @@ void MaterialBudgetAction::update(const EndOfTrack* trk)
if (saveToTxt) theTxt->fillEndTrack();
}

//-------------------------------------------------------------------------
void MaterialBudgetAction::update(const EndOfRun* )
{
if (saveToTxt) delete theTxt;
if (saveToTree) delete theTree;
if (saveToHistos) delete theHistos;
if (theHistoMgr) delete theHistoMgr;
delete theData;
return;
}

//-------------------------------------------------------------------------
bool MaterialBudgetAction::CheckTouchableInSelectedVolumes( const G4VTouchable* touch )
{
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_BeamPipe_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_InnerServices_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@friccita @ianna - here and elsewhere in this pull request - could we not just use the full geometry cffs already defined instead of try to reformulate them here? It would be easier to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, it would have been more efficient just to use the full geometry cffs. Since it is important for this pull request to go through so that the functional material budget validation package can become officially available, I propose to make this simple fix (which has essentially a cosmetic effect and doesn't affect the functioning of the code itself) in a separate pull request.

process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_PixBar_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_PixFwdMinus_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_PixFwdPlus_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_TEC_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_TIB_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_TIDB_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_TIDF_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_TOB_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
5 changes: 3 additions & 2 deletions Validation/Geometry/test/runP_TkStrct_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#Geometry
#
process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi")

process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down
10 changes: 6 additions & 4 deletions Validation/Geometry/test/runP_Tracker_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
process = cms.Process("PROD")

process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")

#Geometry
#
process.load("Configuration.Geometry.GeometryExtended_cff")
process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.HcalCommonData.hcalParameters_cfi")
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi")

#Magnetic Field
#
Expand Down Expand Up @@ -41,7 +43,7 @@
)

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
input = cms.untracked.int32(5)
)

process.p1 = cms.Path(process.g4SimHits)
Expand All @@ -60,7 +62,7 @@
TreeFile = cms.string('None'), ## is NOT requested

StopAfterProcess = cms.string('None'),
# string TextFile = "matbdg_Tracker.txt"
# TextFile = cms.string("matbdg_Tracker.txt")
TextFile = cms.string('None')
)
))