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

Public Member Functions

 TCShowerElectronLikelihood (fhicl::ParameterSet const &pset)
 
- 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 (SharedResources const &resources)
 
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 &)
 
fhicl::ParameterSetID selectorConfig () 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)
 

Private Member Functions

void beginJob () override
 
void analyze (const art::Event &evt) override
 
void getShowerProfile (detinfo::DetectorClocksData const &clockdata, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> showerhits, TVector3 shwvtx, TVector3 shwdir)
 
void findEnergyBin ()
 
double getLongLikelihood ()
 
double getTranLikelihood ()
 
void resetProfiles ()
 

Private Attributes

std::string fTemplateFile
 
std::string fROOTfile
 
TH3F * longTemplate
 
TH3F * tranTemplate
 
TH3F * tranTemplate_1
 
TH3F * tranTemplate_2
 
TH3F * tranTemplate_3
 
TH3F * tranTemplate_4
 
TH3F * tranTemplate_5
 
TProfile2D * longTemplateProf2D
 
TProfile2D * tranTemplateProf2D
 
TProfile2D * tranTemplateProf2D_1
 
TProfile2D * tranTemplateProf2D_2
 
TProfile2D * tranTemplateProf2D_3
 
TProfile2D * tranTemplateProf2D_4
 
TProfile2D * tranTemplateProf2D_5
 
TH1F * energyDist
 
TH1F * longLikelihoodHist
 
TH1F * tranLikelihoodHist
 
TH1F * longProfHist
 
TH1F * tranProfHist_1
 
TH1F * tranProfHist_2
 
TH1F * tranProfHist_3
 
TH1F * tranProfHist_4
 
TH1F * tranProfHist_5
 
TH1F * longProfile
 
TH1F * tranProfile
 
TH1F * tranProfile_1
 
TH1F * tranProfile_2
 
TH1F * tranProfile_3
 
TH1F * tranProfile_4
 
TH1F * tranProfile_5
 
int energyGuess
 
double energyChi2
 
int maxt
 
const int LBINS = 20
 
const int LMIN = 0
 
const int LMAX = 5
 
const int TBINS = 20
 
const int TMIN = -5
 
const int TMAX = 5
 
const double X0 = 14
 
std::string fHitModuleLabel
 
std::string fShowerModuleLabel
 
std::string fTemplateModuleLabel
 
std::string fGenieGenModuleLabel
 
std::string fDigitModuleLabel
 
calo::CalorimetryAlg fCalorimetryAlg
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- 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 37 of file TCShowerElectronLikelihood_module.cc.

Constructor & Destructor Documentation

shower::TCShowerElectronLikelihood::TCShowerElectronLikelihood ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 122 of file TCShowerElectronLikelihood_module.cc.

123  : EDAnalyzer(pset)
124  , fHitModuleLabel(pset.get<std::string>("HitModuleLabel", "trajcluster"))
125  , fShowerModuleLabel(pset.get<std::string>("ShowerModuleLabel", "tcshower"))
126  , fGenieGenModuleLabel(pset.get<std::string>("GenieGenModuleLabel", "generator"))
127  , fCalorimetryAlg(pset.get<fhicl::ParameterSet>("CalorimetryAlg"))
128 {
129  fTemplateFile = pset.get<std::string>("TemplateFile");
130  cet::search_path sp("FW_SEARCH_PATH");
131  if (!sp.find_file(fTemplateFile, fROOTfile))
132  throw cet::exception("TCShowerElectronLikelihood")
133  << "cannot find the root template file: \n"
134  << fTemplateFile << "\n bail ungracefully.\n";
135 
136  std::unique_ptr<TFile> file{TFile::Open(fROOTfile.c_str())};
137 
138  longTemplate = file->Get<TH3F>("tcshowertemplate/fLongitudinal");
139  tranTemplate = file->Get<TH3F>("tcshowertemplate/fTransverse");
140  tranTemplate_1 = file->Get<TH3F>("tcshowertemplate/fTransverse_1");
141  tranTemplate_2 = file->Get<TH3F>("tcshowertemplate/fTransverse_2");
142  tranTemplate_3 = file->Get<TH3F>("tcshowertemplate/fTransverse_3");
143  tranTemplate_4 = file->Get<TH3F>("tcshowertemplate/fTransverse_4");
144  tranTemplate_5 = file->Get<TH3F>("tcshowertemplate/fTransverse_5");
145 
146  longTemplateProf2D = file->Get<TProfile2D>("tcshowertemplate/fShowerProfileRecoLong2D");
147  tranTemplateProf2D = file->Get<TProfile2D>("tcshowertemplate/fShowerProfileRecoTrans2D");
148  tranTemplateProf2D_1 = file->Get<TProfile2D>("tcshowertemplate/fShowerProfileRecoTrans2D_1");
149  tranTemplateProf2D_2 = file->Get<TProfile2D>("tcshowertemplate/fShowerProfileRecoTrans2D_2");
150  tranTemplateProf2D_3 = file->Get<TProfile2D>("tcshowertemplate/fShowerProfileRecoTrans2D_3");
151  tranTemplateProf2D_4 = file->Get<TProfile2D>("tcshowertemplate/fShowerProfileRecoTrans2D_4");
152  tranTemplateProf2D_5 = file->Get<TProfile2D>("tcshowertemplate/fShowerProfileRecoTrans2D_5");
153 
154  longProfile = new TH1F("longProfile", "longitudinal shower profile;t;Q", LBINS, LMIN, LMAX);
155  tranProfile = new TH1F("tranProfile", "transverse shower profile;dist (cm);Q", TBINS, TMIN, TMAX);
156 
157  tranProfile_1 = new TH1F(
158  "tranProfile_1", "transverse shower profile [0 <= t < 1];dist (cm);Q", TBINS, TMIN, TMAX);
159  tranProfile_2 = new TH1F(
160  "tranProfile_2", "transverse shower profile [1 <= t < 2];dist (cm);Q", TBINS, TMIN, TMAX);
161  tranProfile_3 = new TH1F(
162  "tranProfile_3", "transverse shower profile [2 <= t < 3];dist (cm);Q", TBINS, TMIN, TMAX);
163  tranProfile_4 = new TH1F(
164  "tranProfile_4", "transverse shower profile [3 <= t < 4];dist (cm);Q", TBINS, TMIN, TMAX);
165  tranProfile_5 = new TH1F(
166  "tranProfile_5", "transverse shower profile [4 <= t < 5];dist (cm);Q", TBINS, TMIN, TMAX);
167 } // TCShowerElectronLikelihood
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Function Documentation

void shower::TCShowerElectronLikelihood::analyze ( const art::Event evt)
overrideprivate

Definition at line 200 of file TCShowerElectronLikelihood_module.cc.

201 {
202  resetProfiles();
203 
205  std::vector<art::Ptr<recob::Hit>> hitlist;
206  if (evt.getByLabel(fHitModuleLabel, hitListHandle)) art::fill_ptr_vector(hitlist, hitListHandle);
207 
208  art::Handle<std::vector<recob::Shower>> showerListHandle;
209  std::vector<art::Ptr<recob::Shower>> showerlist;
210  if (evt.getByLabel(fShowerModuleLabel, showerListHandle))
211  art::fill_ptr_vector(showerlist, showerListHandle);
212 
213  art::Handle<std::vector<simb::MCTruth>> mctruthListHandle;
214  std::vector<art::Ptr<simb::MCTruth>> mclist;
215  if (evt.getByLabel(fGenieGenModuleLabel, mctruthListHandle))
216  art::fill_ptr_vector(mclist, mctruthListHandle);
217 
218  art::FindManyP<recob::Hit> shwfm(showerListHandle, evt, fShowerModuleLabel);
219 
220  if (showerlist.size()) {
221  auto const clock_data =
223  auto const det_prop =
225  std::vector<art::Ptr<recob::Hit>> showerhits = shwfm.at(0);
227  clock_data, det_prop, showerhits, showerlist[0]->ShowerStart(), showerlist[0]->Direction());
228 
229  maxt = std::ceil((90 - showerlist[0]->ShowerStart().Z()) / X0);
230 
231  findEnergyBin();
232 
235 
236  // check true shower energy
237  if (mclist.size()) {
238  art::Ptr<simb::MCTruth> mctruth = mclist[0];
239  if (mctruth->NeutrinoSet()) {
240  if (std::abs(mctruth->GetNeutrino().Nu().PdgCode()) == 12 &&
241  mctruth->GetNeutrino().CCNC() == 0) {
242  double elep = mctruth->GetNeutrino().Lepton().E();
243  energyDist->Fill(elep - energyGuess);
244  } // cc nue
245  } // neutrinoset
246  } // mclist
247  } // showerlist
248 
255 } // analyze
double E(const int i=0) const
Definition: MCParticle.h:233
int PdgCode() const
Definition: MCParticle.h:212
int CCNC() const
Definition: MCNeutrino.h:148
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
void getShowerProfile(detinfo::DetectorClocksData const &clockdata, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> showerhits, TVector3 shwvtx, TVector3 shwdir)
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
T abs(T value)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
const simb::MCParticle & Lepton() const
Definition: MCNeutrino.h:147
Direction
Definition: AssnsIter.h:13
bool NeutrinoSet() const
Definition: MCTruth.h:78
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
void shower::TCShowerElectronLikelihood::beginJob ( )
overrideprivatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 172 of file TCShowerElectronLikelihood_module.cc.

173 {
174 
176 
177  energyDist = tfs->make<TH1F>("energyDist", "true energy - guess energy", 41, -20.5, 20.5);
178  longLikelihoodHist = tfs->make<TH1F>("longLikelihoodHist", "longitudinal likelihood", 20, 0, 2);
179  tranLikelihoodHist = tfs->make<TH1F>("tranLikelihoodHist", "transverse likelihood", 20, 0, 3);
180 
181  // just for printing purposes
182  longProfHist =
183  tfs->make<TH1F>("longProfHist", "longitudinal e- profile (reco);t;Q", LBINS, LMIN, LMAX);
184  tranProfHist_1 = tfs->make<TH1F>(
185  "tranProfHist", "transverse e- profile (reco) [0 <= t < 1];dist (cm);Q", TBINS, TMIN, TMAX);
186  tranProfHist_2 = tfs->make<TH1F>(
187  "tranProfHist", "transverse e- profile (reco) [1 <= t < 2];dist (cm);Q", TBINS, TMIN, TMAX);
188  tranProfHist_3 = tfs->make<TH1F>(
189  "tranProfHist", "transverse e- profile (reco) [2 <= t < 3];dist (cm);Q", TBINS, TMIN, TMAX);
190  tranProfHist_4 = tfs->make<TH1F>(
191  "tranProfHist", "transverse e- profile (reco) [3 <= t < 4];dist (cm);Q", TBINS, TMIN, TMAX);
192  tranProfHist_5 = tfs->make<TH1F>(
193  "tranProfHist", "transverse e- profile (reco) [4 <= t < 5];dist (cm);Q", TBINS, TMIN, TMAX);
194 
195 } // beginJob
void shower::TCShowerElectronLikelihood::findEnergyBin ( )
private

Definition at line 353 of file TCShowerElectronLikelihood_module.cc.

354 {
355 
356  if (longProfile->GetNbinsX() != longTemplate->GetNbinsX())
357  throw cet::exception("TCShowerElectronLikelihood")
358  << "Bin mismatch in longitudinal profile template \n";
359 
360  if (tranProfile->GetNbinsX() != tranTemplate->GetNbinsX())
361  throw cet::exception("TCShowerElectronLikelihood")
362  << "Bin mismatch in transverse profile template \n";
363 
364  double chi2min = 999999;
365  double bestbin = -1;
366 
367  int ebins = longTemplate->GetNbinsY();
368  int lbins = longTemplate->GetNbinsX();
369  int tbins = tranTemplate->GetNbinsX();
370 
371  for (int i = 0; i < ebins; ++i) {
372  double thischi2 = 0;
373 
374  TProfile* ltemp = longTemplateProf2D->ProfileX("_x", i + 1, i + 1);
375  TProfile* ttemp_1 = tranTemplateProf2D_1->ProfileX("_x_1", i + 1, i + 1);
376  TProfile* ttemp_2 = tranTemplateProf2D_2->ProfileX("_x_2", i + 1, i + 1);
377  TProfile* ttemp_3 = tranTemplateProf2D_3->ProfileX("_x_3", i + 1, i + 1);
378  TProfile* ttemp_4 = tranTemplateProf2D_4->ProfileX("_x_4", i + 1, i + 1);
379  TProfile* ttemp_5 = tranTemplateProf2D_5->ProfileX("_x_5", i + 1, i + 1);
380 
381  int nlbins = 0;
382  int ntbins = 0;
383 
384  for (int j = 0; j < lbins; ++j) {
385  double obs = longProfile->GetBinContent(j + 1);
386  double exp = ltemp->GetBinContent(j + 1);
387  if (obs != 0) {
388  thischi2 += cet::square(obs - exp) / exp;
389  ++nlbins;
390  }
391  } // loop through longitudinal bins
392 
393  for (int j = 0; j < tbins; ++j) {
394  double obs = tranProfile_1->GetBinContent(j + 1);
395  double exp = ttemp_1->GetBinContent(j + 1);
396  if (obs != 0) {
397  thischi2 += cet::square(obs - exp) / exp;
398  ++ntbins;
399  }
400 
401  obs = tranProfile_2->GetBinContent(j + 1);
402  exp = ttemp_2->GetBinContent(j + 1);
403  if (obs != 0) {
404  thischi2 += cet::square(obs - exp) / exp;
405  ++ntbins;
406  }
407 
408  obs = tranProfile_3->GetBinContent(j + 1);
409  exp = ttemp_3->GetBinContent(j + 1);
410  if (obs != 0) {
411  thischi2 += cet::square(obs - exp) / exp;
412  ++ntbins;
413  }
414 
415  obs = tranProfile_4->GetBinContent(j + 1);
416  exp = ttemp_4->GetBinContent(j + 1);
417  if (obs != 0) {
418  thischi2 += cet::square(obs - exp) / exp;
419  ++ntbins;
420  }
421 
422  obs = tranProfile_5->GetBinContent(j + 1);
423  exp = ttemp_5->GetBinContent(j + 1);
424  if (obs != 0) {
425  thischi2 += cet::square(obs - exp) / exp;
426  ++ntbins;
427  }
428  } // loop through longitudinal bins
429 
430  thischi2 /= (nlbins + ntbins);
431 
432  if (thischi2 < chi2min) {
433  chi2min = thischi2;
434  bestbin = i;
435  }
436 
437  } // loop through energy bins
438 
439  energyChi2 = chi2min;
440  energyGuess = bestbin + 1;
441 } // findEnergyBin
constexpr T square(T x)
Definition: pow.h:21
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double shower::TCShowerElectronLikelihood::getLongLikelihood ( )
private

Definition at line 446 of file TCShowerElectronLikelihood_module.cc.

447 {
448  if (energyGuess < 0) return -9999.;
449  int energyBin = energyGuess;
450 
451  double longLikelihood = 0.;
452  int nbins = 0;
453 
454  for (int i = 0; i < LBINS; ++i) {
455  double qval = longProfile->GetBinContent(i + 1);
456  int qbin = longTemplate->GetZaxis()->FindBin(qval);
457  int binentries = longTemplate->GetBinContent(i + 1, energyBin, qbin);
458  int totentries = longTemplate->Integral(i + 1, i + 1, energyBin, energyBin, 0, 100);
459  if (qval > 0) {
460  ++nbins;
461  double prob = (double)binentries / totentries * 100;
462  if (binentries > 0) longLikelihood += log(prob);
463  }
464  } // loop through
465 
466  longLikelihood /= nbins;
467 
468  std::cout << longLikelihood << std::endl;
469  return longLikelihood;
470 } // getLongLikelihood
QTextStream & endl(QTextStream &s)
void shower::TCShowerElectronLikelihood::getShowerProfile ( detinfo::DetectorClocksData const &  clockdata,
detinfo::DetectorPropertiesData const &  detProp,
std::vector< art::Ptr< recob::Hit >>  showerhits,
TVector3  shwvtx,
TVector3  shwdir 
)
private

Definition at line 279 of file TCShowerElectronLikelihood_module.cc.

284 {
286 
287  auto collectionPlane = geo::PlaneID(0, 0, 1);
288 
289  double shwVtxTime = detProp.ConvertXToTicks(shwvtx[0], collectionPlane);
290  double shwVtxWire = geom->WireCoordinate(shwvtx[1], shwvtx[2], collectionPlane);
291 
292  double shwTwoTime = detProp.ConvertXToTicks(shwvtx[0] + shwdir[0], collectionPlane);
293  double shwTwoWire =
294  geom->WireCoordinate(shwvtx[1] + shwdir[1], shwvtx[2] + shwdir[2], collectionPlane);
295 
296  for (size_t i = 0; i < showerhits.size(); ++i) {
297  if (showerhits[i]->WireID().Plane != collectionPlane.Plane) continue;
298 
299  double wirePitch = geom->WirePitch(showerhits[i]->WireID());
300  double tickToDist = detProp.DriftVelocity(detProp.Efield(), detProp.Temperature());
301  tickToDist *= 1.e-3 * sampling_rate(clockdata); // 1e-3 is conversion of 1/us to 1/ns
302 
303  double xvtx = shwVtxTime * tickToDist;
304  double yvtx = shwVtxWire * wirePitch;
305 
306  double xtwo = shwTwoTime * tickToDist;
307  double ytwo = shwTwoWire * wirePitch;
308 
309  double xtwoorth = (ytwo - yvtx) + xvtx;
310  double ytwoorth = -(xtwo - xvtx) + yvtx;
311 
312  double xhit = showerhits[i]->PeakTime() * tickToDist;
313  double yhit = showerhits[i]->WireID().Wire * wirePitch;
314 
315  double ldist = std::abs((ytwoorth - yvtx) * xhit - (xtwoorth - xvtx) * yhit + xtwoorth * yvtx -
316  ytwoorth * xvtx) /
317  std::hypot(ytwoorth - yvtx, xtwoorth - xvtx);
318  double tdist = ((ytwo - yvtx) * xhit - (xtwo - xvtx) * yhit + xtwo * yvtx - ytwo * xvtx) /
319  std::hypot(ytwo - yvtx, xtwo - xvtx);
320 
321  double to3D = 1. / std::hypot(xvtx - xtwo,
322  yvtx - ytwo); // distance between two points in 3D space is one
323  ldist *= to3D;
324  tdist *= to3D;
325  double t = ldist / X0;
326 
327  double Q = showerhits[i]->Integral() *
328  fCalorimetryAlg.LifetimeCorrection(clockdata, detProp, showerhits[i]->PeakTime());
329 
330  longProfile->Fill(t, Q);
331  tranProfile->Fill(tdist, Q);
332 
333  if (t < 1)
334  tranProfile_1->Fill(tdist, Q);
335  else if (t < 2)
336  tranProfile_2->Fill(tdist, Q);
337  else if (t < 3)
338  tranProfile_3->Fill(tdist, Q);
339  else if (t < 4)
340  tranProfile_4->Fill(tdist, Q);
341  else if (t < 5)
342  tranProfile_5->Fill(tdist, Q);
343 
344  } // loop through showerhits
345 
346  return;
347 
348 } // getShowerProfile
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
Definition: hypot.h:60
T abs(T value)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
detail::Node< FrameID, bool > PlaneID
Definition: CRTID.h:125
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
double shower::TCShowerElectronLikelihood::getTranLikelihood ( )
private

Definition at line 475 of file TCShowerElectronLikelihood_module.cc.

476 {
477  if (energyGuess < 0) return -9999.;
478  int energyBin = energyGuess;
479 
480  double tranLikelihood_1 = 0;
481  double tranLikelihood_2 = 0;
482  double tranLikelihood_3 = 0;
483  double tranLikelihood_4 = 0;
484  double tranLikelihood_5 = 0;
485 
486  double qval;
487  int qbin, binentries, totentries;
488 
489  int nbins = 0;
490 
491  for (int i = 0; i < TBINS; ++i) {
492  qval = tranProfile_1->GetBinContent(i + 1);
493  qbin = tranTemplate_1->GetZaxis()->FindBin(qval);
494  binentries = tranTemplate_1->GetBinContent(i + 1, energyBin, qbin);
495  totentries = tranTemplate_1->Integral(i + 1, i + 1, energyBin, energyBin, 0, 100);
496  if (qval > 0) {
497  ++nbins;
498  double prob = (double)binentries / totentries * 100;
499  if (binentries > 0) tranLikelihood_1 += log(prob);
500  }
501 
502  qval = tranProfile_2->GetBinContent(i + 1);
503  qbin = tranTemplate_2->GetZaxis()->FindBin(qval);
504  binentries = tranTemplate_2->GetBinContent(i + 1, energyBin, qbin);
505  totentries = tranTemplate_2->Integral(i + 1, i + 1, energyBin, energyBin, 0, 100);
506  if (qval > 0) {
507  ++nbins;
508  double prob = (double)binentries / totentries * 100;
509  if (binentries > 0) tranLikelihood_2 += log(prob);
510  }
511 
512  qval = tranProfile_3->GetBinContent(i + 1);
513  qbin = tranTemplate_3->GetZaxis()->FindBin(qval);
514  binentries = tranTemplate_3->GetBinContent(i + 1, energyBin, qbin);
515  totentries = tranTemplate_3->Integral(i + 1, i + 1, energyBin, energyBin, 0, 100);
516  if (qval > 0) {
517  ++nbins;
518  double prob = (double)binentries / totentries * 100;
519  if (binentries > 0) tranLikelihood_3 += log(prob);
520  }
521 
522  qval = tranProfile_4->GetBinContent(i + 1);
523  qbin = tranTemplate_4->GetZaxis()->FindBin(qval);
524  binentries = tranTemplate_4->GetBinContent(i + 1, energyBin, qbin);
525  totentries = tranTemplate_4->Integral(i + 1, i + 1, energyBin, energyBin, 0, 100);
526  if (qval > 0) {
527  ++nbins;
528  double prob = (double)binentries / totentries * 100;
529  if (binentries > 0) tranLikelihood_4 += log(prob);
530  }
531 
532  qval = tranProfile_5->GetBinContent(i + 1);
533  qbin = tranTemplate_5->GetZaxis()->FindBin(qval);
534  binentries = tranTemplate_5->GetBinContent(i + 1, energyBin, qbin);
535  totentries = tranTemplate_5->Integral(i + 1, i + 1, energyBin, energyBin, 0, 100);
536  if (qval > 0) {
537  ++nbins;
538  double prob = (double)binentries / totentries * 100;
539  if (binentries > 0) tranLikelihood_5 += log(prob);
540  }
541 
542  } // loop through
543 
544  double const tranLikelihood =
545  (tranLikelihood_1 + tranLikelihood_2 + tranLikelihood_3 + tranLikelihood_4 + tranLikelihood_5) /
546  nbins;
547  std::cout << tranLikelihood << std::endl;
548  return tranLikelihood;
549 } // getTranLikelihood
QTextStream & endl(QTextStream &s)
void shower::TCShowerElectronLikelihood::resetProfiles ( )
private

Definition at line 260 of file TCShowerElectronLikelihood_module.cc.

Member Data Documentation

double shower::TCShowerElectronLikelihood::energyChi2
private

Definition at line 95 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::energyDist
private

Definition at line 75 of file TCShowerElectronLikelihood_module.cc.

int shower::TCShowerElectronLikelihood::energyGuess
private

Definition at line 94 of file TCShowerElectronLikelihood_module.cc.

calo::CalorimetryAlg shower::TCShowerElectronLikelihood::fCalorimetryAlg
private

Definition at line 114 of file TCShowerElectronLikelihood_module.cc.

std::string shower::TCShowerElectronLikelihood::fDigitModuleLabel
private

Definition at line 112 of file TCShowerElectronLikelihood_module.cc.

std::string shower::TCShowerElectronLikelihood::fGenieGenModuleLabel
private

Definition at line 111 of file TCShowerElectronLikelihood_module.cc.

std::string shower::TCShowerElectronLikelihood::fHitModuleLabel
private

Definition at line 108 of file TCShowerElectronLikelihood_module.cc.

std::string shower::TCShowerElectronLikelihood::fROOTfile
private

Definition at line 57 of file TCShowerElectronLikelihood_module.cc.

std::string shower::TCShowerElectronLikelihood::fShowerModuleLabel
private

Definition at line 109 of file TCShowerElectronLikelihood_module.cc.

std::string shower::TCShowerElectronLikelihood::fTemplateFile
private

Definition at line 56 of file TCShowerElectronLikelihood_module.cc.

std::string shower::TCShowerElectronLikelihood::fTemplateModuleLabel
private

Definition at line 110 of file TCShowerElectronLikelihood_module.cc.

const int shower::TCShowerElectronLikelihood::LBINS = 20
private

Definition at line 98 of file TCShowerElectronLikelihood_module.cc.

const int shower::TCShowerElectronLikelihood::LMAX = 5
private

Definition at line 100 of file TCShowerElectronLikelihood_module.cc.

const int shower::TCShowerElectronLikelihood::LMIN = 0
private

Definition at line 99 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::longLikelihoodHist
private

Definition at line 76 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::longProfHist
private

Definition at line 79 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::longProfile
private

Definition at line 86 of file TCShowerElectronLikelihood_module.cc.

TH3F* shower::TCShowerElectronLikelihood::longTemplate
private

Definition at line 59 of file TCShowerElectronLikelihood_module.cc.

TProfile2D* shower::TCShowerElectronLikelihood::longTemplateProf2D
private

Definition at line 66 of file TCShowerElectronLikelihood_module.cc.

int shower::TCShowerElectronLikelihood::maxt
private

Definition at line 96 of file TCShowerElectronLikelihood_module.cc.

const int shower::TCShowerElectronLikelihood::TBINS = 20
private

Definition at line 102 of file TCShowerElectronLikelihood_module.cc.

const int shower::TCShowerElectronLikelihood::TMAX = 5
private

Definition at line 104 of file TCShowerElectronLikelihood_module.cc.

const int shower::TCShowerElectronLikelihood::TMIN = -5
private

Definition at line 103 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranLikelihoodHist
private

Definition at line 77 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfHist_1
private

Definition at line 80 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfHist_2
private

Definition at line 81 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfHist_3
private

Definition at line 82 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfHist_4
private

Definition at line 83 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfHist_5
private

Definition at line 84 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfile
private

Definition at line 87 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfile_1
private

Definition at line 88 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfile_2
private

Definition at line 89 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfile_3
private

Definition at line 90 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfile_4
private

Definition at line 91 of file TCShowerElectronLikelihood_module.cc.

TH1F* shower::TCShowerElectronLikelihood::tranProfile_5
private

Definition at line 92 of file TCShowerElectronLikelihood_module.cc.

TH3F* shower::TCShowerElectronLikelihood::tranTemplate
private

Definition at line 60 of file TCShowerElectronLikelihood_module.cc.

TH3F* shower::TCShowerElectronLikelihood::tranTemplate_1
private

Definition at line 61 of file TCShowerElectronLikelihood_module.cc.

TH3F* shower::TCShowerElectronLikelihood::tranTemplate_2
private

Definition at line 62 of file TCShowerElectronLikelihood_module.cc.

TH3F* shower::TCShowerElectronLikelihood::tranTemplate_3
private

Definition at line 63 of file TCShowerElectronLikelihood_module.cc.

TH3F* shower::TCShowerElectronLikelihood::tranTemplate_4
private

Definition at line 64 of file TCShowerElectronLikelihood_module.cc.

TH3F* shower::TCShowerElectronLikelihood::tranTemplate_5
private

Definition at line 65 of file TCShowerElectronLikelihood_module.cc.

TProfile2D* shower::TCShowerElectronLikelihood::tranTemplateProf2D
private

Definition at line 67 of file TCShowerElectronLikelihood_module.cc.

TProfile2D* shower::TCShowerElectronLikelihood::tranTemplateProf2D_1
private

Definition at line 68 of file TCShowerElectronLikelihood_module.cc.

TProfile2D* shower::TCShowerElectronLikelihood::tranTemplateProf2D_2
private

Definition at line 69 of file TCShowerElectronLikelihood_module.cc.

TProfile2D* shower::TCShowerElectronLikelihood::tranTemplateProf2D_3
private

Definition at line 70 of file TCShowerElectronLikelihood_module.cc.

TProfile2D* shower::TCShowerElectronLikelihood::tranTemplateProf2D_4
private

Definition at line 71 of file TCShowerElectronLikelihood_module.cc.

TProfile2D* shower::TCShowerElectronLikelihood::tranTemplateProf2D_5
private

Definition at line 72 of file TCShowerElectronLikelihood_module.cc.

const double shower::TCShowerElectronLikelihood::X0 = 14
private

Definition at line 106 of file TCShowerElectronLikelihood_module.cc.


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