All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
ana::SBNOsc::CRTSimHitViewer Class Reference

Electron neutrino event selection. More...

Inheritance diagram for ana::SBNOsc::CRTSimHitViewer:
core::SelectionBase core::ProcessorBase

Public Member Functions

 CRTSimHitViewer ()
 
void Initialize (fhicl::ParameterSet *config=NULL)
 
void Finalize ()
 
bool ProcessEvent (const gallery::Event &ev, const std::vector< event::Interaction > &truth, std::vector< event::RecoInteraction > &reco)
 
- Public Member Functions inherited from core::SelectionBase
 SelectionBase ()
 
virtual ~SelectionBase ()
 
- Public Member Functions inherited from core::ProcessorBase
 ProcessorBase ()
 
virtual ~ProcessorBase ()
 
virtual void FillTree ()
 
virtual void FillRecoTree ()
 
virtual void EventCleanup ()
 
template<class T >
TBranch * AddBranch (std::string name, T *obj)
 
template<class T >
TBranch * AddRecoBranch (std::string name, T *obj)
 

Protected Attributes

std::string fCRTHitTag
 
bool fIsICARUS
 
unsigned event_ind
 
TH2D * time_v_pe_all
 
- Protected Attributes inherited from core::ProcessorBase
unsigned long fEventIndex
 An incrementing index. More...
 
Experiment fExperimentID
 Experiment identifier. More...
 
ProviderManagerfProviderManager
 Interface for provider access. More...
 
std::string fOutputFilename
 The output filename. More...
 
std::string fProviderConfig
 A custom provider config fcl file. More...
 
std::vector< geo::BoxBoundedGeofActiveVolumes
 List of active volumes in configured detector. More...
 
bool fWriteTree
 Enable writing of the main tree. More...
 
TFile * fOutputFile
 The output ROOT file. More...
 
TTree * fTree
 The output ROOT tree. More...
 
event::EventfEvent
 The standard output event data structure. More...
 
bool fWriteRecoTree
 Enable writing of the reco tree. More...
 
TTree * fRecoTree
 The output reco ROOT tree. More...
 
event::RecoEventfRecoEvent
 The standard output reco event data structure. More...
 
TTree * fSubRunTree
 Subrun output tree. More...
 
SubRunfSubRun
 Standard output subrun structure. More...
 
TTree * fFileMetaTree
 File metadata output tree. More...
 
FileMetafFileMeta
 standard output file metadata structure More...
 
TParameter< int > * fExperimentParameter
 Saves value of experiment enum. More...
 
std::set< std::pair< int, int > > fSubRunCache
 Cache stored subruns. More...
 
art::InputTag fTruthTag
 art tag for MCTruth information More...
 
art::InputTag fFluxTag
 art tag for MCFlux information More...
 
std::vector< art::InputTag > fWeightTags
 art tag(s) for MCEventWeight information More...
 
art::InputTag fMCTrackTag
 art tag for MCTrack More...
 
art::InputTag fMCShowerTag
 art tag for MCShower More...
 
art::InputTag fMCParticleTag
 art tag for MCParticle More...
 
std::string fGeneratorProcess
 process_name of process used to run genie. Used to extract subrun/POT information More...
 

Additional Inherited Members

- Public Attributes inherited from core::ProcessorBase
std::vector
< event::RecoInteraction > * 
fReco
 Reco interaction list. More...
 
- Protected Member Functions inherited from core::ProcessorBase
virtual void Initialize (char *config=NULL)
 
virtual void Setup (char *config=NULL)
 
virtual void Setup (fhicl::ParameterSet *config=NULL)
 
virtual void Teardown ()
 
void BuildEventTree (gallery::Event &ev)
 
void SetupServices (gallery::Event &ev)
 
void UpdateSubRuns (gallery::Event &ev)
 
void UpdateFileMeta (gallery::Event &ev)
 

Detailed Description

Electron neutrino event selection.

Definition at line 36 of file CRTSimHitViewer.cc.

Constructor & Destructor Documentation

ana::SBNOsc::CRTSimHitViewer::CRTSimHitViewer ( )
inline

Constructor.

Definition at line 39 of file CRTSimHitViewer.cc.

39 {}

Member Function Documentation

void ana::SBNOsc::CRTSimHitViewer::Finalize ( )
inlinevirtual

Finalize and write objects to the output file.

Implements core::ProcessorBase.

Definition at line 55 of file CRTSimHitViewer.cc.

55  {
56  fOutputFile->cd();
57  time_v_pe_all->Write();
58  }
TFile * fOutputFile
The output ROOT file.
void ana::SBNOsc::CRTSimHitViewer::Initialize ( fhicl::ParameterSet *  config = NULL)
inlinevirtual

Initialization.

Parameters
configA configuration, as a FHiCL ParameterSet object

Implements core::ProcessorBase.

Definition at line 46 of file CRTSimHitViewer.cc.

46  {
47  fCRTHitTag = config ? config->get<std::string>("CRTHitTag", "crtsimhit") : "crtsimhit";
48  fIsICARUS = config ? config->get<bool>("IsICARUS", true) : true;
49  event_ind = 0;
50 
51  time_v_pe_all = new TH2D("in_time_hits_all", "in_time_hits_all", 200, -1000., 1000., 10, 0., 500000.);
52  }
bool ana::SBNOsc::CRTSimHitViewer::ProcessEvent ( const gallery::Event &  ev,
const std::vector< event::Interaction > &  truth,
std::vector< event::RecoInteraction > &  reco 
)
inlinevirtual

Process one event.

Parameters
evA single event, as a gallery::Event
Reconstructedinteractions
Returns
True to keep event

Implements core::ProcessorBase.

Definition at line 67 of file CRTSimHitViewer.cc.

67  {
68 
69  if (fIsICARUS) {
70  auto const &crt_hits_handle = ev.getValidHandle<std::vector<sbn::crt::CRTHit>>(fCRTHitTag);;
71  const std::vector<sbn::crt::CRTHit> &crt_hits = *crt_hits_handle;
72  const std::vector<sim::AuxDetSimChannel> &crt_sim_channels = *ev.getValidHandle<std::vector<sim::AuxDetSimChannel>>("largeant");
73  art::FindManyP<icarus::crt::CRTData, void> hits_to_data(crt_hits_handle, ev, fCRTHitTag);
74  std::cout << "Event: " << event_ind << std::endl;
75 
76  for (const sim::AuxDetSimChannel &sim_channel: crt_sim_channels) {
77  int channel = sim_channel.AuxDetID();
78  std::cout << "Channel: " << channel << std::endl;
79  for (const sim::AuxDetIDE &ide: sim_channel.AuxDetIDEs()) {
80  std::cout << "IDE\n";
81  std::cout << "entry T: " << ide.entryT << " exit T: " << ide.exitT << std::endl;
82  std::cout << "entry X: " << ide.entryX << " entry Y: " << ide.entryY << " entry Z: " << ide.entryZ << std::endl;
83  std::cout << "exit X: " << ide.exitX << " exit Y: " << ide.exitY << " exit Z: " << ide.exitZ << std::endl;
84  std::cout << "Track ID: " << ide.trackID << std::endl;
85  }
86  }
87 
88  std::string histo_name = "in_time_hits" + std::to_string(event_ind);
89  fOutputFile->cd();
90  TH2D *time_v_pe = new TH2D(histo_name.c_str(), "in_time_hits", 200, -1000., 1000., 10, 0., 500000.);
91  for (unsigned i = 0; i < crt_hits.size(); i++) {
92  const sbn::crt::CRTHit &crt_hit = crt_hits[i];
93  std::cout << "Hit index: " << i << std::endl;
94  std::cout << "TS0 NS: " << (int)crt_hit.ts0_ns << std::endl;
95  std::cout << "TS1 NS: " << crt_hit.ts1_ns << std::endl;
96  std::cout << "X: " << crt_hit.x_pos << " Y: " << crt_hit.y_pos << " Z: " << crt_hit.z_pos << std::endl;
97  std::cout << "Xerr: " << crt_hit.x_err << " Yerr: " << crt_hit.y_err << " Z: " << crt_hit.z_err << std::endl;
98  std::cout << "Plane: " << crt_hit.plane << std::endl;
99  std::cout << "PE's Hit: " << crt_hit.peshit << std::endl;
100  std::cout << "Tagger: " << crt_hit.tagger << std::endl;
101  time_v_pe->Fill(((int)crt_hit.ts0_ns) / 1000. + 1.1e3, crt_hit.peshit);
102  time_v_pe_all->Fill(((int)crt_hit.ts0_ns) / 1000. + 1.1e3, crt_hit.peshit);
103  const std::vector<art::Ptr<icarus::crt::CRTData>> &crt_datas = hits_to_data.at(i);
104  std::cout << "Track IDs: ";
105  for (auto const &crt_data: crt_datas) {
106  std::vector<icarus::crt::CRTChannelData> crt_channel_datas = crt_data->ChanData();
107  for (auto const &crt_chan: crt_channel_datas) {
108  for (int id: crt_chan.TrackID()) {
109  std::cout << id << " ";
110  }
111  }
112  }
113  std::cout << std::endl;
114  }
115  time_v_pe->Write();
116  delete time_v_pe;
117  }
118  else {
119  auto const &crt_hits_handle = ev.getValidHandle<std::vector<sbn::crt::CRTHit>>(fCRTHitTag);;
120  const std::vector<sbn::crt::CRTHit> &crt_hits = *crt_hits_handle;
121  const std::vector<sim::AuxDetSimChannel> &crt_sim_channels = *ev.getValidHandle<std::vector<sim::AuxDetSimChannel>>("largeant");
122  std::cout << "Event: " << event_ind << std::endl;
123 
124  for (const sim::AuxDetSimChannel &sim_channel: crt_sim_channels) {
125  int channel = sim_channel.AuxDetID();
126  std::cout << "Channel: " << channel << std::endl;
127  for (const sim::AuxDetIDE &ide: sim_channel.AuxDetIDEs()) {
128  std::cout << "IDE\n";
129  std::cout << "entry T: " << ide.entryT << " exit T: " << ide.exitT << std::endl;
130  std::cout << "entry X: " << ide.entryX << " entry Y: " << ide.entryY << " entry Z: " << ide.entryZ << std::endl;
131  std::cout << "exit X: " << ide.exitX << " exit Y: " << ide.exitY << " exit Z: " << ide.exitZ << std::endl;
132  }
133  }
134 
135  for (unsigned i = 0; i < crt_hits.size(); i++) {
136  const sbn::crt::CRTHit &crt_hit = crt_hits[i];
137  std::cout << "Hit index: " << i << std::endl;
138  std::cout << "TS0 NS: " << crt_hit.ts0_ns << std::endl;
139  std::cout << "TS1 NS: " << crt_hit.ts1_ns << std::endl;
140  std::cout << "X: " << crt_hit.x_pos << " Y: " << crt_hit.y_pos << " Z: " << crt_hit.z_pos << std::endl;
141  std::cout << "Xerr: " << crt_hit.x_err << " Yerr: " << crt_hit.y_err << " Z: " << crt_hit.z_err << std::endl;
142  std::cout << "Plane: " << crt_hit.plane << std::endl;
143  std::cout << "PE's Hit: " << crt_hit.peshit << std::endl;
144  }
145 
146  }
147  event_ind += 1;
148 
149  return false;
150  }
float z_err
position uncertainty in z-direction (cm).
Definition: CRTHit.hh:43
float x_err
position uncertainty in x-direction (cm).
Definition: CRTHit.hh:39
double ts1_ns
Timestamp T1 ([signal time w.r.t. Trigger time]), in UTC absolute time scale in nanoseconds from the ...
Definition: CRTHit.hh:34
int plane
Name of the CRT wall (in the form of numbers).
Definition: CRTHit.hh:36
float peshit
Total photo-electron (PE) in a crt hit.
Definition: CRTHit.hh:27
float y_err
position uncertainty in y-direction (cm).
Definition: CRTHit.hh:41
TFile * fOutputFile
The output ROOT file.
Collection of particles crossing one auxiliary detector cell.
float z_pos
position in z-direction (cm).
Definition: CRTHit.hh:42
double ts0_ns
Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch...
Definition: CRTHit.hh:32
float y_pos
position in y-direction (cm).
Definition: CRTHit.hh:40
float x_pos
position in x-direction (cm).
Definition: CRTHit.hh:38
std::string to_string(WindowPattern const &pattern)
MC truth information to make RawDigits and do back tracking.
std::string tagger
Name of the CRT wall (in the form of strings).
Definition: CRTHit.hh:45
BEGIN_PROLOG could also be cout

Member Data Documentation

unsigned ana::SBNOsc::CRTSimHitViewer::event_ind
protected

Definition at line 155 of file CRTSimHitViewer.cc.

std::string ana::SBNOsc::CRTSimHitViewer::fCRTHitTag
protected

Definition at line 153 of file CRTSimHitViewer.cc.

bool ana::SBNOsc::CRTSimHitViewer::fIsICARUS
protected

Definition at line 154 of file CRTSimHitViewer.cc.

TH2D* ana::SBNOsc::CRTSimHitViewer::time_v_pe_all
protected

Definition at line 156 of file CRTSimHitViewer.cc.


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