All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
SBNDFlashAna Class Reference
Inheritance diagram for SBNDFlashAna:

Public Member Functions

 SBNDFlashAna (fhicl::ParameterSet const &p)
 
 SBNDFlashAna (SBNDFlashAna const &)=delete
 
 SBNDFlashAna (SBNDFlashAna &&)=delete
 
SBNDFlashAnaoperator= (SBNDFlashAna const &)=delete
 
SBNDFlashAnaoperator= (SBNDFlashAna &&)=delete
 
void analyze (art::Event const &e) override
 

Private Attributes

std::vector< std::string > _flash_label_v
 
std::vector< std::string > _ophit_label_v
 
std::vector< std::string > _mcflash_label_v
 
std::vector< int > _tpc_v
 
opdet::sbndPDMapAlg _pds_map
 
TTree * _flash_tree
 
int _run
 
int _subrun
 
int _event
 
int _tpc
 
double _flash_time
 
double _flash_total_pe
 
std::vector< double > _flash_pe_v
 
double _flash_y
 
double _flash_yerr
 
double _flash_z
 
double _flash_zerr
 
std::vector< double > _flash_ophit_time
 
std::vector< double > _flash_ophit_amp
 
std::vector< double > _flash_ophit_area
 
std::vector< double > _flash_ophit_width
 
std::vector< double > _flash_ophit_pe
 
std::vector< int > _flash_ophit_ch
 
std::vector< std::string > _flash_ophit_chname
 
TTree * _mcflash_tree
 

Detailed Description

Definition at line 31 of file SBNDFlashAna_module.cc.

Constructor & Destructor Documentation

SBNDFlashAna::SBNDFlashAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 77 of file SBNDFlashAna_module.cc.

78  : EDAnalyzer{p}
79 {
80  _flash_label_v = p.get<std::vector<std::string>>("FlashProducer", _flash_label_v);
81  _mcflash_label_v = p.get<std::vector<std::string>>("MCFlashProducer", _mcflash_label_v);
82  _ophit_label_v = p.get<std::vector<std::string>>("OpHitProducer", _ophit_label_v);
83  _tpc_v = p.get<std::vector<int>>("TPC", _tpc_v);
84 
85  art::ServiceHandle<art::TFileService> fs;
86  _flash_tree = fs->make<TTree>("FlashTree","");
87  _flash_tree->Branch("run", &_run, "run/I");
88  _flash_tree->Branch("subrun", &_subrun, "subrun/I");
89  _flash_tree->Branch("event", &_event, "event/I");
90  _flash_tree->Branch("tpc", &_tpc, "tpc/I");
91  _flash_tree->Branch("flash_time", &_flash_time, "flash_time/D");
92  _flash_tree->Branch("flash_total_pe", &_flash_total_pe, "flash_total_pe/D");
93  _flash_tree->Branch("flash_y", &_flash_y, "flash_y/D");
94  _flash_tree->Branch("flash_yerr", &_flash_yerr, "flash_yerr/D");
95  _flash_tree->Branch("flash_z", &_flash_z, "flash_z/D");
96  _flash_tree->Branch("flash_zerr", &_flash_zerr, "flash_zerr/D");
97  _flash_tree->Branch("flash_pe_v", "std::vector<double>", &_flash_pe_v);
98  _flash_tree->Branch("flash_ophit_time", "std::vector<double>", &_flash_ophit_time);
99  _flash_tree->Branch("flash_ophit_amp", "std::vector<double>", &_flash_ophit_amp);
100  _flash_tree->Branch("flash_ophit_area", "std::vector<double>", &_flash_ophit_area);
101  _flash_tree->Branch("flash_ophit_width", "std::vector<double>", &_flash_ophit_width);
102  _flash_tree->Branch("flash_ophit_pe", "std::vector<double>", &_flash_ophit_pe);
103  _flash_tree->Branch("flash_ophit_ch", "std::vector<int>", &_flash_ophit_ch);
104  _flash_tree->Branch("flash_ophit_chname", "std::vector<std::string>", &_flash_ophit_chname);
105 
106  _mcflash_tree = fs->make<TTree>("MCFlashTree","");
107  _mcflash_tree->Branch("run", &_run, "run/I");
108  _mcflash_tree->Branch("subrun", &_subrun, "subrun/I");
109  _mcflash_tree->Branch("event", &_event, "event/I");
110  _mcflash_tree->Branch("tpc", &_tpc, "tpc/I");
111  _mcflash_tree->Branch("flash_time", &_flash_time, "flash_time/D");
112  _mcflash_tree->Branch("flash_total_pe", &_flash_total_pe, "flash_total_pe/D");
113  _mcflash_tree->Branch("flash_y", &_flash_y, "flash_y/D");
114  _mcflash_tree->Branch("flash_yerr", &_flash_yerr, "flash_yerr/D");
115  _mcflash_tree->Branch("flash_z", &_flash_z, "flash_z/D");
116  _mcflash_tree->Branch("flash_zerr", &_flash_zerr, "flash_zerr/D");
117  _mcflash_tree->Branch("flash_pe_v", "std::vector<double>", &_flash_pe_v);
118 }
std::vector< double > _flash_ophit_amp
std::vector< std::string > _ophit_label_v
std::vector< std::string > _mcflash_label_v
std::vector< double > _flash_ophit_pe
pdgs p
Definition: selectors.fcl:22
std::vector< std::string > _flash_label_v
std::vector< int > _tpc_v
std::vector< double > _flash_pe_v
std::vector< double > _flash_ophit_width
std::vector< double > _flash_ophit_area
std::vector< double > _flash_ophit_time
std::vector< std::string > _flash_ophit_chname
std::vector< int > _flash_ophit_ch
SBNDFlashAna::SBNDFlashAna ( SBNDFlashAna const &  )
delete
SBNDFlashAna::SBNDFlashAna ( SBNDFlashAna &&  )
delete

Member Function Documentation

void SBNDFlashAna::analyze ( art::Event const &  e)
override

Definition at line 120 of file SBNDFlashAna_module.cc.

121 {
122  // if (_flash_label_v.size() != 2) {
123  // std::cout << "FlashProducer size has to be 2!" << std::endl;
124  // throw std::exception();
125  // }
126  // if (_mcflash_label_v.size() != 2) {
127  // std::cout << "MCFlashProducer size has to be 2!" << std::endl;
128  // throw std::exception();
129  // }
130 
131 
132  art::Handle<std::vector<recob::OpHit>> ophit_h;
133  e.getByLabel("ophitpmt", ophit_h);
134  if(!ophit_h.isValid()){
135  std::cout << "Invalid producer for recob::OpHit: " << "ophitpmt" << ". Ignoring." << std::endl;
136  }
137  std::vector<art::Ptr<recob::OpHit>> ophit_v;
138  art::fill_ptr_vector(ophit_v, ophit_h);
139  // for (auto oh : ophit_v) {
140  // std::cout << "ophit time " << oh->PeakTime() << std::endl;
141  // }
142 
143 
144 
145  _run = e.id().run();
146  _subrun = e.id().subRun();
147  _event = e.id().event();
148 
149  for (size_t l = 0; l < _flash_label_v.size(); l++) {
150  art::Handle<std::vector<recob::OpFlash>> flash_h;
151  e.getByLabel(_flash_label_v[l], flash_h);
152  if(!flash_h.isValid()){
153  std::cout << "Invalid producer for recob::OpFlash: " << _flash_label_v[l] << ". Ignoring." << std::endl;
154  }
155 
156  art::FindManyP<recob::OpHit> flashToOpHitAssns(flash_h, e, _ophit_label_v[l]);
157 
158  for (size_t i = 0; i < flash_h->size(); i++) {
159  auto const& f = (*flash_h)[i];
160  std::cout << "Flash " << i << ", time " << f.AbsTime() << std::endl;
161  _tpc = _tpc_v[l];
162  _flash_time = f.AbsTime();
163  _flash_total_pe = f.TotalPE();
164  _flash_pe_v = f.PEs();
165  _flash_y = f.YCenter();
166  _flash_yerr = f.YWidth();
167  _flash_z = f.ZCenter();
168  _flash_zerr = f.ZWidth();
169 
170  _flash_ophit_time.clear();
171  _flash_ophit_amp.clear();
172  _flash_ophit_area.clear();
173  _flash_ophit_width.clear();
174  _flash_ophit_pe.clear();
175  _flash_ophit_ch.clear();
176 
177  std::vector<art::Ptr<recob::OpHit>> ophit_v = flashToOpHitAssns.at(i);
178  for (auto ophit : ophit_v) {
179  _flash_ophit_time.push_back(ophit->PeakTimeAbs());
180  _flash_ophit_amp.push_back(ophit->Amplitude());
181  _flash_ophit_area.push_back(ophit->Area());
182  _flash_ophit_width.push_back(ophit->Width());
183  _flash_ophit_pe.push_back(ophit->PE());
184  _flash_ophit_ch.push_back(ophit->OpChannel());
185  _flash_ophit_chname.push_back(_pds_map.pdType(ophit->OpChannel()));
186 
187  }
188 
189  _flash_tree->Fill();
190  }
191  }
192 
193  for (size_t l = 0; l < _mcflash_label_v.size(); l++) {
194  art::Handle<std::vector<recob::OpFlash>> flash_h;
195  e.getByLabel(_mcflash_label_v[l], flash_h);
196  if(!flash_h.isValid()){
197  std::cout << "Invalid producer for MC recob::OpFlash: " << _mcflash_label_v[l] << ". Ignoring." << std::endl;
198  }
199  for (size_t i = 0; i < flash_h->size(); i++) {
200  auto const& f = (*flash_h)[i];
201  _tpc = _tpc_v[l];
202  _flash_time = f.Time();
203  _flash_total_pe = f.TotalPE();
204  _flash_pe_v = f.PEs();
205  _flash_y = f.YCenter();
206  _flash_yerr = f.YWidth();
207  _flash_z = f.ZCenter();
208  _flash_zerr = f.ZWidth();
209  _mcflash_tree->Fill();
210  }
211  }
212 
213 }
std::vector< double > _flash_ophit_amp
std::vector< std::string > _ophit_label_v
std::vector< std::string > _mcflash_label_v
std::vector< double > _flash_ophit_pe
opdet::sbndPDMapAlg _pds_map
std::vector< std::string > _flash_label_v
std::vector< int > _tpc_v
BEGIN_PROLOG opflashCryoW opflashCryoW triggerfilterBNB triggerfilterNuMI triggerfilterOffbeamBNB triggerfilterOffbeamNuMI triggerfilterUnknown roifinder roifinder2d gaushitTPCEE gaushitTPCWE purityana1 ophit
std::vector< double > _flash_pe_v
std::vector< double > _flash_ophit_width
do i e
std::vector< double > _flash_ophit_area
std::vector< double > _flash_ophit_time
std::string pdType(size_t ch) const override
std::vector< std::string > _flash_ophit_chname
BEGIN_PROLOG could also be cout
std::vector< int > _flash_ophit_ch
SBNDFlashAna& SBNDFlashAna::operator= ( SBNDFlashAna const &  )
delete
SBNDFlashAna& SBNDFlashAna::operator= ( SBNDFlashAna &&  )
delete

Member Data Documentation

int SBNDFlashAna::_event
private

Definition at line 56 of file SBNDFlashAna_module.cc.

std::vector<std::string> SBNDFlashAna::_flash_label_v
private

Definition at line 48 of file SBNDFlashAna_module.cc.

std::vector<double> SBNDFlashAna::_flash_ophit_amp
private

Definition at line 66 of file SBNDFlashAna_module.cc.

std::vector<double> SBNDFlashAna::_flash_ophit_area
private

Definition at line 67 of file SBNDFlashAna_module.cc.

std::vector<int> SBNDFlashAna::_flash_ophit_ch
private

Definition at line 70 of file SBNDFlashAna_module.cc.

std::vector<std::string> SBNDFlashAna::_flash_ophit_chname
private

Definition at line 71 of file SBNDFlashAna_module.cc.

std::vector<double> SBNDFlashAna::_flash_ophit_pe
private

Definition at line 69 of file SBNDFlashAna_module.cc.

std::vector<double> SBNDFlashAna::_flash_ophit_time
private

Definition at line 65 of file SBNDFlashAna_module.cc.

std::vector<double> SBNDFlashAna::_flash_ophit_width
private

Definition at line 68 of file SBNDFlashAna_module.cc.

std::vector<double> SBNDFlashAna::_flash_pe_v
private

Definition at line 60 of file SBNDFlashAna_module.cc.

double SBNDFlashAna::_flash_time
private

Definition at line 58 of file SBNDFlashAna_module.cc.

double SBNDFlashAna::_flash_total_pe
private

Definition at line 59 of file SBNDFlashAna_module.cc.

TTree* SBNDFlashAna::_flash_tree
private

Definition at line 55 of file SBNDFlashAna_module.cc.

double SBNDFlashAna::_flash_y
private

Definition at line 61 of file SBNDFlashAna_module.cc.

double SBNDFlashAna::_flash_yerr
private

Definition at line 62 of file SBNDFlashAna_module.cc.

double SBNDFlashAna::_flash_z
private

Definition at line 63 of file SBNDFlashAna_module.cc.

double SBNDFlashAna::_flash_zerr
private

Definition at line 64 of file SBNDFlashAna_module.cc.

std::vector<std::string> SBNDFlashAna::_mcflash_label_v
private

Definition at line 50 of file SBNDFlashAna_module.cc.

TTree* SBNDFlashAna::_mcflash_tree
private

Definition at line 73 of file SBNDFlashAna_module.cc.

std::vector<std::string> SBNDFlashAna::_ophit_label_v
private

Definition at line 49 of file SBNDFlashAna_module.cc.

opdet::sbndPDMapAlg SBNDFlashAna::_pds_map
private

Definition at line 53 of file SBNDFlashAna_module.cc.

int SBNDFlashAna::_run
private

Definition at line 56 of file SBNDFlashAna_module.cc.

int SBNDFlashAna::_subrun
private

Definition at line 56 of file SBNDFlashAna_module.cc.

int SBNDFlashAna::_tpc
private

Definition at line 57 of file SBNDFlashAna_module.cc.

std::vector<int> SBNDFlashAna::_tpc_v
private

Definition at line 51 of file SBNDFlashAna_module.cc.


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