Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0cae119
A small cleanup.
gaponenko Sep 18, 2019
19b2570
Config validation for GenEventCountReader
gaponenko Sep 18, 2019
b4551b2
Configuration validation for GenParticlesAnalyzer.
gaponenko Sep 18, 2019
94922f2
Configuration validation for SimParticleDaughterSelector.
gaponenko Sep 19, 2019
bd8a193
Configuration validation for StatusG4Analyzer.
gaponenko Sep 19, 2019
691ec96
Configuration validation for StoppedParticlesDumper; uses conditional…
gaponenko Sep 20, 2019
f84c974
Configuration validation for StoppedParticlesFinder
gaponenko Sep 20, 2019
b6226b8
Configuration validation for TrackSummaryMaker.
gaponenko Sep 20, 2019
bd5728e
Fix the whitespace in GenerateMuonLife module
gaponenko Sep 20, 2019
d735e62
Configuration validation for GenerateMuonLife.
gaponenko Sep 20, 2019
edd42da
Remove tabs and trailing whitespace in ProtonPulseRandPDF.
gaponenko Sep 21, 2019
7a14717
Configuration validation for GenerateProtonTimes.
gaponenko Sep 21, 2019
95300b5
Merge branch 'master' into configuration-validation
gaponenko Sep 21, 2019
d1fc9c4
RPCGun: fix white space and re-indent.
gaponenko Sep 21, 2019
b01c179
Configuration validation for ExtMonFNALGun.
gaponenko Sep 22, 2019
8baafd3
Disallow empty configs for ExtMonFNALGun.
gaponenko Sep 22, 2019
afca72f
Configuration valiation for GenEventCounter.
gaponenko Sep 22, 2019
cc8dc6e
RootTreeSampler bug fix. The memory pointed by the c_str() return v…
gaponenko Sep 22, 2019
ff7cf31
Configuration validation for StoppedParticleG4Gun.
gaponenko Sep 22, 2019
81724da
Configuration validation for InFlightParticleSampler.
gaponenko Sep 22, 2019
9ea8d2f
Configuration validation for CompressPhysicalVolumes.
gaponenko Sep 22, 2019
9b2ed90
Configuration validation for FilterG4Out.
gaponenko Sep 24, 2019
86f866f
FilterG4Out: struct ProductMapEntry became redundant with config vali…
gaponenko Sep 24, 2019
e46dc2c
FilterG4Out: remove the long obsolete noInstanceName option.
gaponenko Sep 24, 2019
f5731b7
FilterG4Out: add a validity check of simParticleIOMap.
gaponenko Sep 24, 2019
76ac3c7
FilterG4Out: remove the numSimParticleCollections parameter. If more…
gaponenko Sep 24, 2019
e8dcba0
FilterG4Out: disable the compressGenParticles option that seems to be…
gaponenko Sep 24, 2019
db5a450
Configuration validation for StepPointMCCollectionUpdater.
gaponenko Sep 24, 2019
5e10b7e
Configuration validation for FilterStatusG4.
gaponenko Sep 24, 2019
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
1 change: 0 additions & 1 deletion Analyses/src/CollectionSizeAnalyzer_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ namespace mu2e {
struct Config {
using Name=fhicl::Name;
using Comment=fhicl::Comment;
//using Atom=fhicl::Atom;
fhicl::Atom<bool> useModuleLabel{Name("useModuleLabel"), Comment("Include input module label into collection name in the plots") };
fhicl::Atom<bool> useInstanceName{Name("useInstanceName"), Comment("Include input instance name into collection name in the plots")};
fhicl::Atom<bool> useProcessName{Name("useProcessName"), Comment("Include input process name into collection name in the plots")};
Expand Down
19 changes: 15 additions & 4 deletions Analyses/src/GenEventCountReader_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,29 @@ namespace mu2e {
unsigned numSubRuns_;
bool makeHistograms_;
public:
explicit GenEventCountReader(const fhicl::ParameterSet& pset);

struct Config {
fhicl::Atom<bool> makeHistograms{
fhicl::Name("makeHistograms"),
fhicl::Comment("Write out number of events and subruns as histograms, in addition to printing them out. "),
true
};
};

using Parameters = art::EDAnalyzer::Table<Config>;
explicit GenEventCountReader(const Parameters& conf);

virtual void analyze(const art::Event&) override {}
virtual void endSubRun(const art::SubRun& sr) override;
virtual void endJob() override;
};

//================================================================
GenEventCountReader::GenEventCountReader(const fhicl::ParameterSet& pset)
: art::EDAnalyzer(pset)
GenEventCountReader::GenEventCountReader(const Parameters& conf)
: art::EDAnalyzer(conf)
, numEvents_(0)
, numSubRuns_(0)
, makeHistograms_(pset.get<bool>("makeHistograms", true))
, makeHistograms_(conf().makeHistograms())
{}

//================================================================
Expand Down
16 changes: 12 additions & 4 deletions Analyses/src/GenParticlesAnalyzer_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ namespace mu2e {
class GenParticlesAnalyzer : public art::EDAnalyzer {
public:

explicit GenParticlesAnalyzer(fhicl::ParameterSet const& pset);
struct Config {
fhicl::Atom<art::InputTag> inputs{
fhicl::Name("inputs"),
fhicl::Comment("The InputTag of a GenParticle collection to analyze. ")
};
};

using Parameters = art::EDAnalyzer::Table<Config>;
explicit GenParticlesAnalyzer(const Parameters& conf);

void beginRun(const art::Run&) override;
void analyze(const art::Event& e) override;
Expand All @@ -31,9 +39,9 @@ namespace mu2e {
GeneratorSummaryHistograms genSummary_;
};

GenParticlesAnalyzer::GenParticlesAnalyzer(const fhicl::ParameterSet& pset) :
art::EDAnalyzer(pset),
inputs_(pset.get<std::string>("inputs")),
GenParticlesAnalyzer::GenParticlesAnalyzer(const Parameters& conf) :
art::EDAnalyzer(conf),
inputs_(conf().inputs()),
genSummary_()
{}

Expand Down
27 changes: 21 additions & 6 deletions Analyses/src/SimParticleDaughterSelector_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,23 @@ namespace mu2e {

class SimParticleDaughterSelector : public art::EDProducer {
public:
explicit SimParticleDaughterSelector(fhicl::ParameterSet const& pset);

struct Config {
using Name=fhicl::Name;
using Comment=fhicl::Comment;
fhicl::Atom<art::InputTag> particleInput{ Name("particleInput"), Comment("The input collection.") };
fhicl::Sequence<std::string> processes{ Name("processes"),
Comment("A list of production process names, like \"DIO\", \"NuclearCapture\".\n"
"SimParticles with the given production codes will be written to the output.\n"
"If the process list is empty, all particles are passed to the output.\n"
"You can use this mode to produce diagnostic histograms that will contain\nthe names of possible processes."
)
};
};

using Parameters = art::EDProducer::Table<Config>;
explicit SimParticleDaughterSelector(const Parameters& conf);

void produce(art::Event& evt) override;
private:
art::InputTag particleInput_;
Expand All @@ -56,15 +72,14 @@ namespace mu2e {
};

//================================================================
SimParticleDaughterSelector::SimParticleDaughterSelector(const fhicl::ParameterSet& pset)
: EDProducer{pset}
, particleInput_(pset.get<std::string>("particleInput"))
SimParticleDaughterSelector::SimParticleDaughterSelector(const Parameters& conf)
: EDProducer{conf}
, particleInput_(conf().particleInput())
, haccepted_(tfs()->make<TH1D>("accepted", "Accepted pdgId and process code pairs", 1, 0., 1.))
, hignored_(tfs()->make<TH1D>("ignored", "Ignored pdgId and process code pairs", 1, 0., 1.))
{
produces<SimParticlePtrCollection>();

const auto& processes = pset.get<std::vector<std::string> >("processes");
const auto& processes = conf().processes();
for(const auto& proc: processes) {
procs_.insert(ProcessCode::findByName(proc).id());
}
Expand Down
18 changes: 14 additions & 4 deletions Analyses/src/StatusG4Analyzer_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,24 @@ namespace mu2e {
TH1D *hCPUTime_ = nullptr;
TH1D *hCPUTimeWide_ = nullptr;
public:
explicit StatusG4Analyzer(const fhicl::ParameterSet& pset);

struct Config {
fhicl::Atom<art::InputTag> input {
fhicl::Name("input"),
fhicl::Comment("The InputTag of the StatusG4 object to analyze.")
};
};

using Parameters = art::EDAnalyzer::Table<Config>;
explicit StatusG4Analyzer(const Parameters& conf);

virtual void analyze(const art::Event& event);
};

//================================================================
StatusG4Analyzer::StatusG4Analyzer(const fhicl::ParameterSet& pset)
: art::EDAnalyzer(pset)
, input_(pset.get<std::string>("input"))
StatusG4Analyzer::StatusG4Analyzer(const Parameters& conf)
: art::EDAnalyzer(conf)
, input_(conf().input())
{
art::ServiceHandle<art::TFileService> tfs;
hStatusValue_ = tfs->make<TH1D>("statusValue", "Non-zero values of the G4 status", 20, 0., 20.);
Expand Down
67 changes: 57 additions & 10 deletions Analyses/src/StoppedParticlesDumper_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ namespace mu2e {

namespace {

typedef std::vector<std::string> VS;
typedef std::vector<StepPointMCCollection> VspMC;

// This should be minimal info, we'll want to load this
Expand Down Expand Up @@ -73,14 +72,61 @@ namespace mu2e {
//================================================================
class StoppedParticlesDumper : public art::EDAnalyzer {
public:
explicit StoppedParticlesDumper(fhicl::ParameterSet const& pset);

struct Config {
using Name=fhicl::Name;
using Comment=fhicl::Comment;

fhicl::Atom<bool> dumpSimParticleLeaves {
Name("dumpSimParticleLeaves"),
Comment("The mode selector. Set it to true to dump info on all the leaves\n"
"of a SimParticleCollection. If it is set to false, the input should\n"
"be of the SimParticlePtrCollection type, and its full content will be included.\n"
),
false
};

fhicl::Atom<art::InputTag> inputCollection {
Name("inputCollection"),
Comment("InputTag of the collection to use.")
};

fhicl::Atom<bool> writeProperTime {
Name("writeProperTime"),
Comment("Compute and write out normalized proper time tau of particles.\n"
"This quantity is defined in such a way that exp(-tau) is the survival\n"
"probability of the particle. It is used in cases when the decay\n"
"process is disabled during the simulation."
),
false
};

fhicl::Sequence<int> decayOffPDGCodes {
Name("decayOffPDGCodes"),
Comment("A list of PDG IDs of particles that had their decay process turned off during\n"
"the simulation. This must be specified if and only if writeProperTime is requested."),
[this](){ return writeProperTime(); }
};

fhicl::Sequence<art::InputTag> hitCollections {
Name("hitCollections"),
Comment("A list of StepPointMCCollection-s via which different stages of simulation\n"
"are connected. Must be specified if and only if writeProperTime is requested."),
[this](){ return writeProperTime(); }
};

};

using Parameters = art::EDAnalyzer::Table<Config>;
explicit StoppedParticlesDumper(const Parameters& conf);

void beginJob() override;
void analyze(const art::Event& evt) override;
private:
bool dumpSimParticleLeaves_;
art::InputTag input_;
bool writeProperTime_;
VS hitColls_;
std::vector<art::InputTag> hitColls_;

std::vector<int> decayOffCodes_;

Expand All @@ -92,16 +138,17 @@ namespace mu2e {
};

//================================================================
StoppedParticlesDumper::StoppedParticlesDumper(const fhicl::ParameterSet& pset) :
art::EDAnalyzer(pset),
dumpSimParticleLeaves_(pset.get<bool>("dumpSimParticleLeaves", false)),
input_(pset.get<std::string>("inputCollection")),
writeProperTime_(pset.get<bool>("writeProperTime")),
hitColls_( writeProperTime_ ? pset.get<VS>("hitCollections") : VS() ),
StoppedParticlesDumper::StoppedParticlesDumper(const Parameters& conf) :
art::EDAnalyzer(conf),
dumpSimParticleLeaves_(conf().dumpSimParticleLeaves()),
input_(conf().inputCollection()),
writeProperTime_(conf().writeProperTime()),
nt_()
{
if(writeProperTime_) {
decayOffCodes_ = pset.get<std::vector<int> >("decayOffPDGCodes");
hitColls_ = conf().hitCollections();
decayOffCodes_ = conf().decayOffPDGCodes();

// must sort to use binary_search in SimParticleGetTau
std::sort(decayOffCodes_.begin(), decayOffCodes_.end());
}
Expand Down
76 changes: 58 additions & 18 deletions Analyses/src/StoppedParticlesFinder_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,50 @@ namespace mu2e {

class StoppedParticlesFinder : public art::EDProducer {
public:
explicit StoppedParticlesFinder(fhicl::ParameterSet const& pset);


struct Config {
using Name=fhicl::Name;
using Comment=fhicl::Comment;

fhicl::Atom<art::InputTag> particleInput{ Name("particleInput"), Comment("The particle input collection.") };

fhicl::Atom<art::InputTag> physVolInfoInput{ Name("physVolInfoInput"), Comment("The PhysicalVolumeInfoMultiCollection input.") };

fhicl::Sequence<int> particleTypes{
Name("particleTypes"),
Comment("A list of PDG IDs of particles to include in the stopped particle search.")
};

fhicl::Atom<std::string> stoppingMaterial{
Name("stoppingMaterial"),
Comment("A non-emtpy string here will select particles that stopped in the given material. Otherwise see vetoedMaterials below."),
""
};

fhicl::Sequence<std::string> vetoedMaterials{ Name("vetoedMaterials"),
Comment("Used only if stoppingMaterial is set to an emtpy string.\n"
"Particles stopping in materials that DO NOT match any on this list will be selected."),
[this](){ return stoppingMaterial().empty(); }
};

fhicl::Atom<unsigned> particleOffsetThreshold{ Name("particleOffsetThreshold"),
Comment("Ignore particles with numbers below the threshold. This should be used\n"
"to limit the selection to stops in just the latest simulation stage."
),
0
};

fhicl::Atom<int> verbosityLevel{ Name("verbosityLevel"),
Comment("Controls the printouts. Levels 0 through 3 are used.\nHigher levels are more verbose."),
0
};

};

using Parameters = art::EDProducer::Table<Config>;
explicit StoppedParticlesFinder(const Parameters& conf);

void beginSubRun(art::SubRun& sr) override;
void produce(art::Event& evt) override;
void endJob() override;
Expand All @@ -45,10 +88,10 @@ namespace mu2e {
std::string stoppingMaterial_;
std::vector<std::string> vetoedMaterials_;

int verbosityLevel_;

unsigned offsetThreshold_; // to select particles from the current simulation stage

int verbosityLevel_;

typedef std::set<PDGCode::type> PDGCodeSet;
PDGCodeSet particleTypes_;

Expand All @@ -65,14 +108,13 @@ namespace mu2e {
};

//================================================================
StoppedParticlesFinder::StoppedParticlesFinder(const fhicl::ParameterSet& pset)
: EDProducer{pset}
, particleInput_(pset.get<std::string>("particleInput"))
, physVolInfoInput_(pset.get<std::string>("physVolInfoInput"))
, stoppingMaterial_(pset.get<std::string>("stoppingMaterial", ""))
, vetoedMaterials_(pset.get<std::vector<std::string> >("vetoedMaterials", std::vector<std::string>()))
, verbosityLevel_(pset.get<int>("verbosityLevel", 0))
, offsetThreshold_(pset.get<unsigned>("particleOffsetThreshold", 0))
StoppedParticlesFinder::StoppedParticlesFinder(const Parameters& conf)
: EDProducer{conf}
, particleInput_(conf().particleInput())
, physVolInfoInput_(conf().physVolInfoInput())
, stoppingMaterial_(conf().stoppingMaterial())
, offsetThreshold_(conf().particleOffsetThreshold())
, verbosityLevel_(conf().verbosityLevel())
, hStopMaterials_(art::ServiceHandle<art::TFileService>()->make<TH1D>("stopmat", "Stopping materials", 1, 0., 1.))
, vols_()
, numTotalParticles_()
Expand All @@ -81,7 +123,11 @@ namespace mu2e {
{
produces<SimParticlePtrCollection>();

auto pt(pset.get<std::vector<int> >("particleTypes"));
if(stoppingMaterial_.empty()) {
vetoedMaterials_ = conf().vetoedMaterials();
}

auto pt(conf().particleTypes());
for(const auto& pid : pt) {
particleTypes_.insert(PDGCode::type(pid));
}
Expand All @@ -103,12 +149,6 @@ namespace mu2e {

mf::LogInfo("Info")<<os.str();
}

//----------------
if( !stoppingMaterial_.empty() && !vetoedMaterials_.empty()) {
throw cet::exception("BADCONFIG")<<"Only one stoppingMaterial or vetoedMaterials may be requested.";
}

}

//================================================================
Expand Down
17 changes: 13 additions & 4 deletions Analyses/src/TrackSummaryMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,25 @@ namespace mu2e {

class TrackSummaryMaker : public art::EDProducer {
public:
explicit TrackSummaryMaker(fhicl::ParameterSet const& pset);

struct Config {
using Name=fhicl::Name;
using Comment=fhicl::Comment;
fhicl::Atom<art::InputTag> trackInput{ Name("trackInput"), Comment("The input collection.") };
};

using Parameters = art::EDProducer::Table<Config>;
explicit TrackSummaryMaker(const Parameters& conf);

void produce(art::Event& evt) override;
private:
art::InputTag trackInput_;
};

//================================================================
TrackSummaryMaker::TrackSummaryMaker(const fhicl::ParameterSet& pset)
: art::EDProducer{pset}
, trackInput_(pset.get<std::string>("trackInput"))
TrackSummaryMaker::TrackSummaryMaker(const Parameters& conf)
: art::EDProducer{conf}
, trackInput_(conf().trackInput())
{
produces<TrackSummaryCollection>();
produces<TrackSummaryRecoMap>();
Expand Down
Loading