6 #ifndef FlashMatchAna_H 7 #define FlashMatchAna_H 1 11 #include "TEfficiency.h" 43 #include "art_root_io/TFileService.h" 44 #include "art_root_io/TFileDirectory.h" 47 #include "canvas/Persistency/Common/FindManyP.h" 168 #endif // FlashMatchAna_H 193 fPE = pset.
get<
float>(
"PE", 18.);
282 if (!fOpDetWaveformLabel.empty()) {
283 fCountTree = tfs->make<TTree>(
"CountWaveforms",
"CountWaveforms");
341 for (
auto wf: *wfHandle) {
344 if ( peak > (1.5*
fPE)) {
347 if ( peak > (2.5*
fPE) )
363 std::vector<art::Ptr<recob::OpFlash> > flashlist;
370 mf::LogWarning(
"FlashMatchAna") <<
"Cannot load any flashes. Failing";
374 std::vector<art::Ptr<recob::OpHit> > hitlist;
382 for (
auto hit: hitlist)
394 std::set<int> signal_trackids;
404 if (mctruth->NParticles() == 0) {
405 mf::LogError(
"FlashMatchAna") <<
"No MCTruth Particles";
409 art::FindManyP<simb::MCParticle> SignalGeantAssns(MClistHandle,evt,
fGeantLabel);
410 for (
size_t i = 0; i < SignalGeantAssns.size(); i++) {
411 auto parts = SignalGeantAssns.at(i);
412 for (
auto part = parts.begin(); part != parts.end(); part++) {
413 signal_trackids.emplace((*part)->TrackId());
427 unsigned int const nParticles = mctruth->NParticles();
428 for (
unsigned int i = 0; i < nParticles; ++i) {
439 double loc[] = {part.Vx(), part.Vy(), part.Vz()};
441 if (! geom->
HasTPC(tpc) ) {
442 mf::LogInfo(
"FlashMatchAna") <<
"No valid TPC for " << tpc;
449 double deltaTicks = detProp.ConvertXToTicks(part.Vx(), planeid);
450 double deltaT = clockData.TPCTick2Time(deltaTicks);
470 double maxT = clockData.TPCTick2Time(detProp.NumberTimeSamples());
482 bool AnyReconstructed =
false;
483 bool LargestFound =
false;
484 bool LargestRight =
false;
485 bool SelectedFound =
false;
486 bool SelectedRight =
false;
492 for(
unsigned int i = 0; i < flashlist.size(); ++i)
512 double ticks = clockData.Time2Tick(timeDiff);
513 fRecoX = detProp.ConvertTicksToX(ticks, planeid);
518 if (timeDiff < -10 || timeDiff > maxT)
540 for(
unsigned int iOD = 0; iOD < geom->
NOpDets(); ++iOD){
543 for(
unsigned int iC=0; iC < geom->
NOpChannels(); ++iC)
550 for(
unsigned int iOD = 0; iOD < geom->
NOpDets(); ++iOD){
572 if (
fPurity > 0) AnyReconstructed =
true;
585 if (
fPurity > 0) LargestRight =
true;
599 SelectedFound =
true;
600 if (
fPurity > 0) SelectedRight =
true;
double E(const int i=0) const
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< Int_t > fFlashFrameVector
std::string fOpHitModuleLabel
std::vector< Int_t > fTrueAllPDG
TTree * fLargestFlashTree
std::vector< Float_t > fTrueEallpart
double Py(const int i=0) const
std::vector< Float_t > fPurityVector
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps(art::Ptr< recob::OpFlash > &flash_P)
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< Float_t > fDistanceVector
TEfficiency * fLargestEfficiencyVsXandE
The data type to uniquely identify a Plane.
double Px(const int i=0) const
std::vector< Int_t > fFlashIDVector
double PE(unsigned int i) const
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
EDAnalyzer(fhicl::ParameterSet const &pset)
std::vector< Float_t > fTruePzallpart
const double OpHitCollectionPurity(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps)
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
TTree * fSelectedFlashTree
tick ticks
Alias for common language habits.
art framework interface to geometry description
TEfficiency * fLargestEfficiencyVsE
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
std::string fOpDetWaveformLabel
std::vector< Float_t > fTimeDiffVector
TEfficiency * fSelectedEfficiencyVsX
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
void analyze(const art::Event &)
#define DEFINE_ART_MODULE(klass)
FlashMatchAna(const fhicl::ParameterSet &)
TEfficiency * fLargestEfficiencyVsX
std::vector< Int_t > fOnBeamTimeVector
T get(std::string const &key) const
std::vector< Float_t > fZCenterVector
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
struct recob::OpFlashPtrSortByPE_t OpFlashPtrSortByPE
The data type to uniquely identify a TPC.
TEfficiency * fRecoEfficiencyVsE
TEfficiency * fSelectedEfficiencyVsXandE
void err(const char *fmt,...)
unsigned int NOpDets() const
Number of OpDets in the whole detector.
Detector simulation of raw signals on wires.
std::vector< Float_t > fZWidthVector
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
TEfficiency * fRecoEfficiencyVsXandE
std::vector< Float_t > fRecoXVector
std::vector< Float_t > fYWidthVector
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
double Pz(const int i=0) const
TEfficiency * fSelectedEfficiencyVsE
EventNumber_t event() const
std::vector< Float_t > fTimeVector
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
std::vector< Float_t > fTruePxallpart
std::vector< Float_t > fTruePyallpart
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
std::vector< Bool_t > fInBeamFrameVector
std::vector< Float_t > fYCenterVector
std::string fOpFlashModuleLabel
std::vector< Float_t > fPEsPerOpDetVector
std::vector< Float_t > fTotalPEVector
TEfficiency * fRecoEfficiencyVsX
std::vector< Float_t > fTimeWidthVector
std::vector< Int_t > fNHitOpDetVector