Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
MyGapFilter::GapFilter Class Reference
Inheritance diagram for MyGapFilter::GapFilter:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 GapFilter (fhicl::ParameterSet const &p)
 
virtual ~GapFilter ()
 
void beginJob ()
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void analyze (const art::Event &evt)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Public Attributes

TH2F * fPrimaryMom_vs_TrackLength
 

Private Member Functions

void ResetVars ()
 

Private Attributes

TTree * fTree
 
int run
 
int subrun
 
int event
 
double evttime
 
double efield [3]
 
int t0
 
int nhits
 
int hit_cryostat [kMaxHits]
 
int hit_tpc [kMaxHits]
 
int hit_plane [kMaxHits]
 
int hit_wire [kMaxHits]
 
int hit_channel [kMaxHits]
 
double hit_peakT [kMaxHits]
 
double hit_charge [kMaxHits]
 
double hit_ph [kMaxHits]
 
std::vector< int > gap1
 
std::vector< int > gap2
 
std::vector< int > gap3
 
std::vector< int > gap4
 
std::vector< int > gap5
 
std::vector< int > cross12
 
std::vector< int > cross34
 
std::vector< int > cross14
 
std::vector< int > cross23
 
std::vector< int > cross1and2or4
 
std::vector< int > cross2and1or3
 
std::vector< int > cross1or3and2or4
 
bool TPC1 = false
 
bool TPC7 = false
 
bool TPC5GAP1 = false
 
bool GAP1 = false
 
bool TPC5GAP2 = false
 
bool GAP2 = false
 
bool TPC3GAP3 = false
 
bool GAP3 = false
 
bool TPC3GAP4 = false
 
bool GAP4 = false
 
bool TPC3 = false
 
bool TPC5 = false
 
bool GAP5 = false
 
std::string fHitsModuleLabel
 
std::string fSimulationProducerLabel
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &paths, fhicl::ParameterSet const &config)
 
detail::ProcessAndEventSelectorsprocessAndEventSelectors ()
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 60 of file GapFilter_module.cc.

Constructor & Destructor Documentation

MyGapFilter::GapFilter::GapFilter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 145 of file GapFilter_module.cc.

146  : EDAnalyzer(pset)
147  {
148  // Read in the parameters from the .fcl file.
149  this->reconfigure(pset);
150  }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
void reconfigure(fhicl::ParameterSet const &pset)
MyGapFilter::GapFilter::~GapFilter ( )
virtual

Definition at line 162 of file GapFilter_module.cc.

163  {
164  // Clean up dynamic memory and other resources here.
165  }

Member Function Documentation

void MyGapFilter::GapFilter::analyze ( const art::Event evt)

Definition at line 167 of file GapFilter_module.cc.

168  {
169  // Implementation of required member function here.
170  ResetVars();
171 
173 
174  run = evt.run();
175  subrun = evt.subRun();
176  event = evt.id().event();
177 
178  //Reset vectors per event
179  gap1.clear();
180  gap2.clear();
181  gap3.clear();
182  gap4.clear();
183  gap5.clear();
184  cross12.clear();
185  cross34.clear();
186  cross14.clear();
187  cross23.clear();
188  cross1and2or4.clear();
189  cross2and1or3.clear();
190  cross1or3and2or4.clear();
191 
192  //Art handles
193 
195  evt.getByLabel(fSimulationProducerLabel, particleHandle);
197  evt.getByLabel(fSimulationProducerLabel, simChannelHandle);
198  std::map< int, const simb::MCParticle* > particleMap;
199 
200  // Get hit list
201  art::Handle< std::vector<recob::Hit> > hitListHandle;
202  std::vector<art::Ptr<recob::Hit> > hitlist;
203  if (evt.getByLabel(fHitsModuleLabel,hitListHandle))
204  art::fill_ptr_vector(hitlist, hitListHandle);
205  nhits = hitlist.size();
206 
207  //loop to determine hits and assign bool metrics for deciding on crossers
208  for (size_t k = 0; k < hitlist.size(); ++k){
209  unsigned int channel = hitlist[k]->Channel();
210  geo::WireID wireid = hitlist[k]->WireID();
211  hit_cryostat[k] = wireid.Cryostat;
212  hit_tpc[k] = wireid.TPC;
213  hit_plane[k] = wireid.Plane;
214  hit_wire[k] = wireid.Wire;
215  hit_channel[k] = channel;
216  hit_peakT[k] = hitlist[k]->PeakTime();
217  hit_charge[k] = hitlist[k]->Integral();
218  hit_ph[k] = hitlist[k]->PeakAmplitude();
219 
220  if (hit_channel[k] == 511 && hit_charge[k] != 0) TPC1 = true;
221  if (hit_channel[k] == 1424 && hit_charge[k] != 0) TPC5GAP1 = true;
222  if (hit_channel[k] == 1535 && hit_charge[k] != 0) TPC5GAP2 = true;
223  if (hit_channel[k] == 912 && hit_charge[k] != 0) TPC3GAP3 = true;
224  if (hit_channel[k] == 1023 && hit_charge[k] != 0) TPC3GAP4 = true;
225  if (hit_channel[k] == 1936 && hit_charge[k] != 0) TPC7 = true;
226  if (hit_channel[k] >= 912 && hit_channel[k] <= 1023 && hit_charge[k] != 0) TPC3 = true;
227  if (hit_channel[k] >= 1424 && hit_channel[k] <= 1535 && hit_charge[k] != 0) TPC5 = true;
228  }
229 
230  //Use bools to decide whether an event crosses a gap
231 
232  if (TPC1 == true && TPC5GAP1 == true) {
233  GAP1 = true;
234  gap1.push_back(event);
235  }
236  else GAP1 = false;
237 
238  if (TPC5GAP2 == true && TPC7 == true) {
239  GAP2 = true;
240  gap2.push_back(event);
241  }
242  else GAP2 = false;
243 
244  if (TPC1 == true && TPC3GAP3 == true) {
245  GAP3 = true;
246  gap3.push_back(event);
247  }
248  else GAP3 = false;
249 
250  if (TPC3GAP4 == true && TPC7 == true) {
251  GAP4 = true;
252  gap4.push_back(event);
253  }
254  else GAP4 = false;
255 
256  if (TPC3 == true && TPC5 == true) {
257  GAP5 = true;
258  gap5.push_back(event);
259  }
260  else GAP5 = false;
261 
262  //Use gap crossers to determine multiple gap crossing events
263  if (GAP1 == true && GAP2 == true) cross12.push_back(event);
264  if (GAP3 == true && GAP4 == true) cross34.push_back(event);
265  if (GAP1 == true && GAP4 == true) cross14.push_back(event);
266  if (GAP2 == true && GAP3 == true) cross23.push_back(event);
267  if (GAP1 == true && (GAP2 == true || GAP4 == true)) cross1and2or4.push_back(event);
268  if (GAP2 == true && (GAP1 == true || GAP3 == true)) cross2and1or3.push_back(event);
269  if ((GAP1 == true || GAP3 == true) && (GAP2 == true || GAP4 == true)) cross1or3and2or4.push_back(event);
270 
271  //Reset bools for next event
272 
273  TPC1 = false;
274  TPC7 = false;
275  TPC5GAP1 = false;
276  GAP1 = false;
277  TPC5GAP2 = false;
278  GAP2 = false;
279  TPC3GAP3 = false;
280  GAP3 = false;
281  TPC3GAP4 = false;
282  GAP4 = false;
283  TPC3 = false;
284  TPC5 = false;
285  GAP5 = false;
286 
287  fTree->Fill();
288  }
std::vector< int > cross34
std::vector< int > cross2and1or3
double hit_peakT[kMaxHits]
double hit_charge[kMaxHits]
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
std::vector< int > cross1and2or4
std::vector< int > cross14
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
std::vector< int > gap5
std::vector< int > gap4
std::vector< int > cross1or3and2or4
double hit_ph[kMaxHits]
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:89
RunNumber_t run() const
Definition: DataViewImpl.cc:82
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
std::vector< int > gap3
std::vector< int > gap1
EventNumber_t event() const
Definition: EventID.h:116
std::string fSimulationProducerLabel
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:291
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
EventID id() const
Definition: Event.cc:37
Event finding and building.
std::vector< int > gap2
std::vector< int > cross23
std::vector< int > cross12
void MyGapFilter::GapFilter::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 290 of file GapFilter_module.cc.

291  {
292  // Implementation of optional member function here.
294 
295  fTree = tfs->make<TTree>("hitdumper","analysis tree");
296  fTree->Branch("run",&run,"run/I");
297  fTree->Branch("subrun",&subrun,"subrun/I");
298  fTree->Branch("event",&event,"event/I");
299  fTree->Branch("evttime",&evttime,"evttime/D");
300  fTree->Branch("efield",efield,"efield[3]/D");
301  fTree->Branch("t0",&t0,"t0/I");
302 
303  fTree->Branch("nhits",&nhits,"nhits/I");
304  fTree->Branch("hit_cryostat",hit_cryostat,"hit_cryostat[nhits]/I");
305  fTree->Branch("hit_tpc",hit_tpc,"hit_tpc[nhits]/I");
306  fTree->Branch("hit_plane",hit_plane,"hit_plane[nhits]/I");
307  fTree->Branch("hit_wire",hit_wire,"hit_wire[nhits]/I");
308  fTree->Branch("hit_channel",hit_channel,"hit_channel[nhits]/I");
309  fTree->Branch("hit_peakT",hit_peakT,"hit_peakT[nhits]/D");
310  fTree->Branch("hit_charge",hit_charge,"hit_charge[nhits]/D");
311  fTree->Branch("hit_ph",hit_ph,"hit_ph[nhits]/D");
312 
313  fTree->Branch("gap1", &gap1);
314  fTree->Branch("gap2", &gap2);
315  fTree->Branch("gap3", &gap3);
316  fTree->Branch("gap4", &gap4);
317  fTree->Branch("gap5", &gap5);
318 
319  fTree->Branch("cross12", &cross12);
320  fTree->Branch("cross34", &cross34);
321 
322  fTree->Branch("cross14", &cross14);
323  fTree->Branch("cross23", &cross23);
324 
325  fTree->Branch("cross1and2or4", &cross1and2or4);
326  fTree->Branch("cross2and1or3", &cross2and1or3);
327  fTree->Branch("cross1or3and2or4", &cross1or3and2or4);
328  }
code to link reconstructed objects back to the MC truth information
std::vector< int > cross34
std::vector< int > cross2and1or3
double hit_peakT[kMaxHits]
double hit_charge[kMaxHits]
std::vector< int > cross1and2or4
std::vector< int > cross14
std::vector< int > gap5
std::vector< int > gap4
std::vector< int > cross1or3and2or4
double hit_ph[kMaxHits]
std::vector< int > gap3
std::vector< int > gap1
Event finding and building.
std::vector< int > gap2
std::vector< int > cross23
std::vector< int > cross12
void MyGapFilter::GapFilter::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 152 of file GapFilter_module.cc.

153  {
154  // Read parameters from the .fcl file. The names in the arguments
155  // to p.get<TYPE> must match names in the .fcl file.
156 
157  fHitsModuleLabel = p.get< std::string >("HitsModuleLabel");
158  fSimulationProducerLabel = p.get< std::string >("SimulationProducerLabel");
159  return;
160  }
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223
std::string fSimulationProducerLabel
void MyGapFilter::GapFilter::ResetVars ( void  )
private

Definition at line 330 of file GapFilter_module.cc.

330  {
331 
332  run = -99999;
333  subrun = -99999;
334  event = -99999;
335  evttime = -99999;
336  for (int i = 0; i<3; ++i){
337  efield[i] = -99999;
338  }
339  t0 = -99999;
340  nhits = -99999;
341  for (int i = 0; i<kMaxHits; ++i){
342  hit_cryostat[i] = -99999;
343  hit_tpc[i] = -99999;
344  hit_plane[i] = -99999;
345  hit_wire[i] = -99999;
346  hit_channel[i] = -99999;
347  hit_peakT[i] = -99999;
348  hit_charge[i] = -99999;
349  hit_ph[i] = -99999;
350  }
351  }
code to link reconstructed objects back to the MC truth information
double hit_peakT[kMaxHits]
double hit_charge[kMaxHits]
double hit_ph[kMaxHits]
const int kMaxHits

Member Data Documentation

std::vector<int> MyGapFilter::GapFilter::cross12
private

Definition at line 106 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::cross14
private

Definition at line 110 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::cross1and2or4
private

Definition at line 114 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::cross1or3and2or4
private

Definition at line 116 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::cross23
private

Definition at line 111 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::cross2and1or3
private

Definition at line 115 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::cross34
private

Definition at line 107 of file GapFilter_module.cc.

double MyGapFilter::GapFilter::efield[3]
private

Definition at line 84 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::event
private

Definition at line 82 of file GapFilter_module.cc.

double MyGapFilter::GapFilter::evttime
private

Definition at line 83 of file GapFilter_module.cc.

std::string MyGapFilter::GapFilter::fHitsModuleLabel
private

Definition at line 139 of file GapFilter_module.cc.

TH2F* MyGapFilter::GapFilter::fPrimaryMom_vs_TrackLength

Definition at line 71 of file GapFilter_module.cc.

std::string MyGapFilter::GapFilter::fSimulationProducerLabel
private

Definition at line 140 of file GapFilter_module.cc.

TTree* MyGapFilter::GapFilter::fTree
private

Definition at line 77 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::gap1
private

Definition at line 99 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::GAP1 = false
private

Definition at line 123 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::gap2
private

Definition at line 100 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::GAP2 = false
private

Definition at line 126 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::gap3
private

Definition at line 101 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::GAP3 = false
private

Definition at line 129 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::gap4
private

Definition at line 102 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::GAP4 = false
private

Definition at line 132 of file GapFilter_module.cc.

std::vector<int> MyGapFilter::GapFilter::gap5
private

Definition at line 103 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::GAP5 = false
private

Definition at line 136 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::hit_channel[kMaxHits]
private

Definition at line 93 of file GapFilter_module.cc.

double MyGapFilter::GapFilter::hit_charge[kMaxHits]
private

Definition at line 95 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::hit_cryostat[kMaxHits]
private

Definition at line 89 of file GapFilter_module.cc.

double MyGapFilter::GapFilter::hit_peakT[kMaxHits]
private

Definition at line 94 of file GapFilter_module.cc.

double MyGapFilter::GapFilter::hit_ph[kMaxHits]
private

Definition at line 96 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::hit_plane[kMaxHits]
private

Definition at line 91 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::hit_tpc[kMaxHits]
private

Definition at line 90 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::hit_wire[kMaxHits]
private

Definition at line 92 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::nhits
private

Definition at line 88 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::run
private

Definition at line 80 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::subrun
private

Definition at line 81 of file GapFilter_module.cc.

int MyGapFilter::GapFilter::t0
private

Definition at line 85 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC1 = false
private

Definition at line 119 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC3 = false
private

Definition at line 134 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC3GAP3 = false
private

Definition at line 128 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC3GAP4 = false
private

Definition at line 131 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC5 = false
private

Definition at line 135 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC5GAP1 = false
private

Definition at line 122 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC5GAP2 = false
private

Definition at line 125 of file GapFilter_module.cc.

bool MyGapFilter::GapFilter::TPC7 = false
private

Definition at line 120 of file GapFilter_module.cc.


The documentation for this class was generated from the following file: