Skip to content

Commit 1311cb0

Browse files
committed
Added StrawGasStepFilter
1 parent e391635 commit 1311cb0

3 files changed

Lines changed: 101 additions & 0 deletions

File tree

Filters/fcl/SGSFilter.fcl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include "Offline/fcl/standardServices.fcl"
2+
process_name : SGSFilter
3+
4+
source : {
5+
module_type: RootInput
6+
}
7+
services : @local::Services.Core
8+
9+
physics : {
10+
filters : {
11+
SGSFilter : {
12+
StrawGasStepTag: "compressDetStepMCs"
13+
MinSteps: 10
14+
module_type: "StrawGasStepFilter"
15+
}
16+
}
17+
FilterPath: [
18+
SGSFilter
19+
]
20+
e1 : [FilterOutput]
21+
end_paths : [e1]
22+
}
23+
physics.trigger_paths : [ FilterPath ]
24+
25+
outputs: {
26+
FilterOutput: {
27+
SelectEvents: [
28+
"FilterPath"
29+
]
30+
module_type: "RootOutput"
31+
outputCommands: [
32+
"keep *_*_*_*"
33+
]
34+
}
35+
}
36+
37+
services.ProditionsService.trackerStatus.Settings.useDb: true
38+
services.ProditionsService.trackerStatus.Settings.verbose: 2
39+
#services.DbService.textFile : ["TrackerStatus.txt" ]
40+
services.DbService.verbose: 2

Filters/src/SConscript

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ helper.make_plugins( [
3232
'mu2e_GeneralUtilities',
3333
'mu2e_DbService',
3434
'mu2e_DbTables',
35+
'mu2e_TrackerConditions',
36+
'mu2e_ConditionsService',
3537
babarlibs,
3638
'art_Framework_Core',
3739
'art_Framework_Principal',
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// requires a minimum number of steps in online straws
2+
3+
#include "art/Framework/Core/EDFilter.h"
4+
#include "art/Framework/Principal/Event.h"
5+
#include "art/Framework/Principal/Handle.h"
6+
#include "fhiclcpp/ParameterSet.h"
7+
#include "Offline/MCDataProducts/inc/StrawGasStep.hh"
8+
#include "Offline/ProditionsService/inc/ProditionsHandle.hh"
9+
#include "Offline/TrackerConditions/inc/TrackerStatus.hh"
10+
11+
#include <string>
12+
13+
using namespace std;
14+
15+
namespace mu2e{
16+
17+
class StrawGasStepFilter : public art::EDFilter {
18+
public:
19+
using Name=fhicl::Name;
20+
using Comment=fhicl::Comment;
21+
22+
struct Config {
23+
fhicl::Atom<art::InputTag> stepstag { Name("StrawGasStepTag"), Comment("StrawGasStep tag")};
24+
fhicl::Atom<unsigned> minsteps { Name("MinSteps"), Comment("Minimum number of SGS")};
25+
};
26+
using Parameters = art::EDFilter::Table<Config>;
27+
explicit StrawGasStepFilter(const Parameters& config);
28+
virtual bool filter(art::Event& e);
29+
30+
private:
31+
art::InputTag _stepsTag;
32+
size_t _minSteps;
33+
34+
ProditionsHandle<TrackerStatus> _trackerStatus_h;
35+
36+
37+
};
38+
39+
StrawGasStepFilter::StrawGasStepFilter(const Parameters& config) :
40+
art::EDFilter{config},
41+
_stepsTag(config().stepstag()),
42+
_minSteps(config().minsteps())
43+
{
44+
}
45+
46+
bool StrawGasStepFilter::filter(art::Event& event) {
47+
auto const& trackerStatus = _trackerStatus_h.getPtr(event.id());
48+
49+
size_t count = 0;
50+
auto steps = event.getValidHandle<StrawGasStepCollection>(_stepsTag);
51+
for (size_t i=0;i<steps->size();i++){
52+
if (!trackerStatus->noSignal(steps->at(i).strawId()))
53+
count += 1;
54+
}
55+
return count >= _minSteps;
56+
}
57+
}
58+
59+
DEFINE_ART_MODULE(mu2e::StrawGasStepFilter)

0 commit comments

Comments
 (0)