Skip to content

Commit c174568

Browse files
author
Brinden Carlson
committed
Merge branch 'release/v09_91_02_01'
2 parents 165d5ab + 7fba1b3 commit c174568

50 files changed

Lines changed: 96801 additions & 212 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: SBND Issue
3+
about: Fillable form for sbndcode issues
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## I'm submitting a ...
11+
12+
- [ ] bug report
13+
- [ ] feature request
14+
15+
## Checklist
16+
- [ ] I've added at least 1 label under `Labels`
17+
- [ ] Assigned a reviewer under `Assignees`
18+
19+
## Expected Behavior
20+
21+
22+
## Current Behavior
23+
24+
25+
## Possible Solution (optional)
26+
27+
28+
## How to reproduce

.github/pull_request_template.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Description
2+
Please provide a detailed description of the changes this pull request introduces.
3+
4+
## Checklist
5+
- [ ] Added at least 1 label from [available labels](https://github.com/SBNSoftware/sbndcode/issues/labels?sort=name-asc).
6+
- [ ] Assigned at least 1 reviewer under `Reviewers`,
7+
- [ ] Assigned all contributers including yourself under `Assignees`
8+
- [ ] Linked any relevant issues under `Developement`
9+
- [ ] Does this PR affect CAF data format? If so, please assign a CAF maintainer as additional reviewer.
10+
- [ ] Does this affect the standard workflow?
11+
12+
### Relevant PR links (optional)
13+
Does this PR require merging another PR in a different repository (such as sbnanobj/sbnobj etc.)?
14+
15+
### Link(s) to docdb describing changes (optional)
16+
Is there a docdb describing the issue this solves or the feature added?

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

18-
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 09.91.02)
18+
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 09.91.02.01)
1919
find_package(cetmodules REQUIRED)
2020
project(sbndcode LANGUAGES CXX)
2121

2222
# for CI:
23-
# project(sbndcode VERSION 09.91.02)
23+
# project(sbndcode VERSION 09.91.02.01)
2424

2525
message(STATUS "\n")
2626
message(STATUS "================================= ${PROJECT_NAME} =================================")

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Contributing
2+
For most recent contributing guidelines, see [docDB 37211 slides 7-10](https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=37211).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
add_subdirectory(OpReco)
22
add_subdirectory(CRT)
3+
add_subdirectory(DQM)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cet_build_plugin(FilterChoppy art::module
2+
lardataobj::RecoBase
3+
ROOT::Core
4+
ROOT::Tree
5+
art::Framework_Core
6+
art::Framework_Principal
7+
art::Utilities
8+
art_root_io::tfile_support
9+
art_root_io::TFileService_service
10+
canvas::canvas
11+
fhiclcpp::fhiclcpp
12+
cetlib::cetlib
13+
cetlib_except::cetlib_except
14+
messagefacility::MF_MessageLogger
15+
lardataobj::RawData
16+
larcore::Geometry_Geometry_service
17+
fhiclcpp::fhiclcpp
18+
cetlib::cetlib
19+
CLHEP::Random
20+
ROOT::Geom
21+
ROOT::XMLIO
22+
ROOT::Gdml
23+
ROOT::FFTW
24+
)
25+
26+
install_headers()
27+
install_source()
28+
install_fhicl()
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
#include <iostream>
2+
#include <stdlib.h>
3+
#include <string>
4+
#include <vector>
5+
#include <numeric>
6+
#include <getopt.h>
7+
#include <chrono>
8+
#include <float.h>
9+
10+
11+
//some ROOT includes
12+
#include "TInterpreter.h"
13+
#include "TROOT.h"
14+
#include "TH1F.h"
15+
#include "TH2D.h"
16+
#include "TCanvas.h"
17+
#include "TTree.h"
18+
#include "TFile.h"
19+
#include "TStyle.h"
20+
#include "TSystem.h"
21+
#include "TGraph.h"
22+
#include "TFFTReal.h"
23+
#include "TTimeStamp.h"
24+
#include "TLatex.h"
25+
#include "TLine.h"
26+
27+
28+
// art includes
29+
#include "canvas/Utilities/InputTag.h"
30+
#include "canvas/Persistency/Common/FindOneP.h"
31+
#include "canvas/Persistency/Common/FindManyP.h"
32+
#include "canvas/Persistency/Common/Ptr.h"
33+
#include "art/Framework/Core/EDFilter.h"
34+
#include "art/Framework/Core/ModuleMacros.h"
35+
#include "art/Framework/Principal/Event.h"
36+
#include "art/Framework/Principal/Handle.h"
37+
#include "art/Framework/Principal/Run.h"
38+
#include "art/Framework/Principal/SubRun.h"
39+
#include "fhiclcpp/ParameterSet.h"
40+
#include "messagefacility/MessageLogger/MessageLogger.h"
41+
#include "lardataobj/RecoBase/Hit.h"
42+
#include "fhiclcpp/ParameterSet.h"
43+
#include "lardataobj/RawData/RawDigit.h"
44+
#include "lardataobj/RawData/RDTimeStamp.h"
45+
#include "lardataobj/RawData/raw.h"
46+
#include "larcore/Geometry/Geometry.h"
47+
#include "canvas/Persistency/Provenance/Timestamp.h"
48+
49+
#include "art_root_io/TFileService.h"
50+
51+
#include "sbndcode/ChannelMaps/TPC/TPCChannelMapService.h"
52+
53+
54+
namespace filt{
55+
56+
class FilterChoppy : public art::EDFilter {
57+
public:
58+
59+
explicit FilterChoppy(fhicl::ParameterSet const & pset);
60+
virtual bool filter(art::Event& evt) override;
61+
void reconfigure(fhicl::ParameterSet const& pset);
62+
virtual void beginJob() override;
63+
64+
std::vector<art::Ptr<raw::RDTimeStamp>> raw_timestamps_handle;
65+
66+
private:
67+
68+
int run;
69+
int subrun;
70+
int event;
71+
long delta_tmaxmin;
72+
std::vector<long> ts_vec;
73+
std::vector<long> ts_hist_vec;
74+
int npeak;
75+
76+
};
77+
78+
79+
FilterChoppy::FilterChoppy(fhicl::ParameterSet const & pset)
80+
: EDFilter(pset)
81+
{
82+
this->reconfigure(pset);
83+
}
84+
85+
void FilterChoppy::reconfigure(fhicl::ParameterSet const& pset){
86+
}
87+
88+
89+
bool FilterChoppy::filter(art::Event & evt){
90+
91+
raw_timestamps_handle.clear();
92+
run = evt.id().run();
93+
subrun = evt.id().subRun();
94+
event = evt.id().event();
95+
96+
ts_vec.clear();
97+
ts_hist_vec.clear();
98+
npeak = 0;
99+
delta_tmaxmin = 0;
100+
101+
// get the timestamps
102+
art::Handle<std::vector<raw::RDTimeStamp>> timestamp_handle;
103+
evt.getByLabel("daq", timestamp_handle);
104+
105+
// exit if the data isn't present
106+
if (!timestamp_handle.isValid()) {
107+
std::cerr << "Error: missing timestamps with producer (" << "daq" << ")" << std::endl;
108+
return false;
109+
}
110+
art::fill_ptr_vector(raw_timestamps_handle, timestamp_handle);
111+
112+
// collect TS
113+
unsigned timeindex = 0;
114+
for (auto const& timestamps: raw_timestamps_handle) {
115+
long this_ts = timestamps->GetTimeStamp();
116+
ts_vec.push_back(this_ts);
117+
timeindex++;
118+
}
119+
// find min, max TS values
120+
long ts_min = ts_vec[0];
121+
long ts_max = ts_vec[0];
122+
for (long ts : ts_vec) {
123+
if (ts < ts_min) {
124+
ts_min = ts;
125+
}
126+
if (ts > ts_max) {
127+
ts_max = ts;
128+
}
129+
}
130+
delta_tmaxmin = std::abs(ts_max - ts_min);
131+
132+
// if (delta_tmaxmin > 100000){
133+
// std::cout << "Event " << event << " has a delta_tmaxmin of " << delta_tmaxmin << std::endl;
134+
// }
135+
return delta_tmaxmin < 100000;
136+
137+
138+
// // Identify choppy events by looking at the # of peaks in the TS distribution
139+
// make binned hist
140+
// float nbin = 100.;
141+
// float bin_width = (ts_max - ts_min)/nbin;
142+
// for (int i = 0; i < 100; ++i) {
143+
// float bin_low = ts_min + i*bin_width;
144+
// float bin_high = ts_min + (i+1)*bin_width;
145+
// int bin_count = 0;
146+
// for (long ts : ts_vec) {
147+
// if ((bin_low < ts) & (ts <= bin_high)) {
148+
// bin_count += 1;
149+
// }
150+
// }
151+
// ts_hist_vec.push_back(bin_count);
152+
// }
153+
// // find peak bins
154+
// for (int bc : ts_hist_vec) {
155+
// //TODO: make threshold fcl parameter
156+
// if (bc > 1000) {
157+
// npeak += 1;
158+
// }
159+
// }
160+
161+
// // If the energy deposit within the beam time is greater than some limit then trigger the event
162+
// if (npeak > 1){
163+
// std::cout << "Event " << event << " has " << npeak << " peaks" << std::endl;
164+
// }
165+
// return npeak < 2;
166+
167+
}
168+
169+
void FilterChoppy::beginJob() {
170+
}
171+
172+
DEFINE_ART_MODULE(FilterChoppy)
173+
174+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include "services_sbnd.fcl"
2+
#include "TPCChannelMapService.fcl"
3+
4+
process_name: FilterChoppy
5+
6+
services:
7+
{
8+
TFileService: { fileName: "reco_hist.root"}
9+
MemoryTracker: {}
10+
TimeTracker: {}
11+
RandomNumberGenerator: {}
12+
message: @local::sbnd_message_services_prod_debug
13+
FileCatalogMetadata: @local::art_file_catalog_mc
14+
TPCChannelMapService: @local::SBNDTPCChannelMapServiceDefaults
15+
AuxDetExptGeoHelperInterface: { service_provider: "sbndcode/CRT/CRTGeometryHelper" }
16+
ExptGeoHelperInterface: @local::sbnd_geometry_helper
17+
Geometry: @local::sbnd_geo
18+
GeometryConfigurationWriter: {}
19+
@table::sbnd_basic_services
20+
@table::sbnd_random_services
21+
}
22+
23+
source:
24+
{
25+
module_type: RootInput
26+
maxEvents: -1
27+
}
28+
29+
outputs:
30+
{
31+
out1:
32+
{
33+
module_type: RootOutput
34+
fileName: "%ifb_choppyfiltered.root"
35+
dataTier: "filtered"
36+
fastCloning: true
37+
SelectEvents: [ filter ]
38+
}
39+
}
40+
41+
physics:
42+
{
43+
filters:
44+
{
45+
filterchoppy: {
46+
module_type: FilterChoppy
47+
}
48+
}
49+
50+
filter: [ filterchoppy ]
51+
stream1: [ out1 ]
52+
trigger_paths: [ filter ]
53+
end_paths: [ stream1 ]
54+
}
55+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include "services_sbnd.fcl"
2+
#include "TPCChannelMapService.fcl"
3+
4+
process_name: FilterChoppy
5+
6+
services:
7+
{
8+
TFileService: { fileName: "reco_hist.root"}
9+
MemoryTracker: {}
10+
TimeTracker: {}
11+
RandomNumberGenerator: {}
12+
message: @local::sbnd_message_services_prod_debug
13+
FileCatalogMetadata: @local::art_file_catalog_mc
14+
TPCChannelMapService: @local::SBNDTPCChannelMapServiceDefaults
15+
AuxDetExptGeoHelperInterface: { service_provider: "sbndcode/CRT/CRTGeometryHelper" }
16+
ExptGeoHelperInterface: @local::sbnd_geometry_helper
17+
Geometry: @local::sbnd_geo
18+
GeometryConfigurationWriter: {}
19+
@table::sbnd_basic_services
20+
@table::sbnd_random_services
21+
}
22+
23+
source:
24+
{
25+
module_type: RootInput
26+
maxEvents: -1
27+
}
28+
29+
outputs:
30+
{
31+
out1:
32+
{
33+
module_type: RootOutput
34+
fileName: "%ifb_nonchoppy.root"
35+
dataTier: "filtered"
36+
fastCloning: true
37+
SelectEvents: [ dropchoppy ]
38+
}
39+
out2:
40+
{
41+
module_type: RootOutput
42+
fileName: "%ifb_choppy.root"
43+
dataTier: "filtered"
44+
fastCloning: true
45+
SelectEvents: [ savechoppy ]
46+
}
47+
}
48+
49+
physics:
50+
{
51+
filters:
52+
{
53+
filterchoppy: {
54+
module_type: FilterChoppy
55+
}
56+
}
57+
58+
dropchoppy: [ "filterchoppy"]
59+
savechoppy: [ "!filterchoppy"]
60+
stream1: [ out1 ]
61+
stream2: [ out2 ]
62+
trigger_paths: [ dropchoppy, savechoppy ]
63+
end_paths: [ stream1, stream2 ]
64+
}
65+

0 commit comments

Comments
 (0)