|
| 1 | +///////////////////////////////////////////////////////////////////// |
| 2 | +// |
| 3 | +// BlipRecoAlg |
| 4 | +// |
| 5 | +// To include in your module, add the header file at the top: |
| 6 | +// #include "sbndcode/BlipReco/Alg/BlipRecoAlg.h |
| 7 | +// |
| 8 | +// then declare a private alg object in your class definition: |
| 9 | +// BlipRecoAlg fBlipAlg; |
| 10 | +// |
| 11 | +// W. Foreman, May 2022 |
| 12 | +// wforeman @ iit.edu |
| 13 | +// |
| 14 | +///////////////////////////////////////////////////////////////////// |
| 15 | +#ifndef BLIPRECOALG_H |
| 16 | +#define BLIPRECOALG_H |
| 17 | + |
| 18 | +// framework includes |
| 19 | +#include "art_root_io/TFileService.h" |
| 20 | +#include "art/Framework/Principal/Handle.h" |
| 21 | +#include "art/Framework/Services/Registry/ServiceHandle.h" |
| 22 | +#include "canvas/Persistency/Common/Ptr.h" |
| 23 | +#include "canvas/Persistency/Common/PtrVector.h" |
| 24 | +#include "canvas/Persistency/Common/FindMany.h" |
| 25 | +#include "canvas/Persistency/Common/FindManyP.h" |
| 26 | + |
| 27 | +// LArSoft includes |
| 28 | +#include "lardata/DetectorInfoServices/DetectorClocksService.h" |
| 29 | +#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" |
| 30 | +#include "nusimdata/SimulationBase/MCParticle.h" |
| 31 | +#include "nusimdata/SimulationBase/MCTruth.h" |
| 32 | +#include "lardataobj/Simulation/SimEnergyDeposit.h" |
| 33 | +#include "lardataobj/RecoBase/Hit.h" |
| 34 | +#include "lardataobj/RecoBase/Track.h" |
| 35 | +#include "larsim/MCCheater/BackTrackerService.h" |
| 36 | +#include "lardataobj/AnalysisBase/BackTrackerMatchingData.h" |
| 37 | +#include "larsim/MCCheater/ParticleInventoryService.h" |
| 38 | +#include "larcore/Geometry/Geometry.h" |
| 39 | +#include "larcorealg/Geometry/GeometryCore.h" |
| 40 | +#include "larreco/Calorimetry/CalorimetryAlg.h" |
| 41 | +#include "art/Framework/Principal/Event.h" |
| 42 | + |
| 43 | + |
| 44 | +// Microboone includes |
| 45 | +//#include "ubevt/Database/TPCEnergyCalib/TPCEnergyCalibService.h" |
| 46 | +//#include "ubevt/Database/TPCEnergyCalib/TPCEnergyCalibProvider.h" |
| 47 | +//#include "ubevt/Database/UbooneElectronLifetimeProvider.h" |
| 48 | +//#include "ubevt/Database/UbooneElectronLifetimeService.h" |
| 49 | +#include "larevt/SpaceCharge/SpaceCharge.h" |
| 50 | +#include "larevt/SpaceChargeServices/SpaceChargeService.h" |
| 51 | +#include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" |
| 52 | +#include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" |
| 53 | + |
| 54 | +// Blip-specific utils |
| 55 | +#include "sbndcode/BlipRecoSBND/Utils/BlipUtils.h" |
| 56 | + |
| 57 | +// ROOT stuff |
| 58 | +#include "TH1D.h" |
| 59 | +#include "TH2D.h" |
| 60 | +#include "TFile.h" |
| 61 | +#include "TTree.h" |
| 62 | +#include "TSpline.h" |
| 63 | +#include "TGraph.h" |
| 64 | + |
| 65 | +// c++ |
| 66 | +#include <vector> |
| 67 | +#include <iostream> |
| 68 | +#include <memory> |
| 69 | +#include <math.h> |
| 70 | +#include <limits> |
| 71 | + |
| 72 | +typedef std::map<int, std::map<int, std::map< int,float >>> CTPMap_t; |
| 73 | +typedef std::map<int, std::map<int,float >> CTMap_t; |
| 74 | + |
| 75 | + |
| 76 | +namespace blip { |
| 77 | + |
| 78 | + //-------------------------------------------- |
| 79 | + class BlipRecoAlg{ |
| 80 | + public: |
| 81 | + |
| 82 | + //Constructor/destructor |
| 83 | + BlipRecoAlg( fhicl::ParameterSet const& pset ); |
| 84 | + //BlipRecoAlg(); |
| 85 | + ~BlipRecoAlg(); |
| 86 | + |
| 87 | + void reconfigure(fhicl::ParameterSet const& pset ); |
| 88 | + void RunBlipReco(const art::Event& evt); |
| 89 | + void PrintConfig(); |
| 90 | + |
| 91 | + // TO-DO: make these private and create getters instead |
| 92 | + std::vector<blip::HitInfo> hitinfo; |
| 93 | + std::vector<blip::HitClust> hitclust; |
| 94 | + std::vector<blip::Blip> blips; |
| 95 | + std::vector<blip::TrueBlip> trueblips; |
| 96 | + std::vector<blip::ParticleInfo> pinfo; |
| 97 | + |
| 98 | + float ModBoxRecomb(float,float); |
| 99 | + float dQdx_to_dEdx(float,float); |
| 100 | + float Q_to_E(float,float); |
| 101 | + |
| 102 | + |
| 103 | + std::vector<bool> fBadChanMask; |
| 104 | + std::vector<bool> fBadChanMaskPerEvt; |
| 105 | + int EvtBadChanCount; |
| 106 | + |
| 107 | + TH1D* h_recoWireEff_denom; |
| 108 | + TH1D* h_recoWireEff_num; |
| 109 | + |
| 110 | + TH1D* h_recoWireEffQ_denom; |
| 111 | + TH1D* h_recoWireEffQ_num; |
| 112 | + |
| 113 | + float kWion; |
| 114 | + float kNominalRecombFactor; |
| 115 | + float kLArDensity; |
| 116 | + float kNominalEfield; |
| 117 | + float kDriftVelocity; |
| 118 | + float kTickPeriod; |
| 119 | + int kNumChannels; |
| 120 | + |
| 121 | + private: |
| 122 | + |
| 123 | + calo::CalorimetryAlg* fCaloAlg; |
| 124 | + geo::GeometryCore const& fGeom; |
| 125 | + |
| 126 | + CTPMap_t kXTicksOffsets; |
| 127 | + |
| 128 | + // --- FCL configs --- |
| 129 | + std::string fHitProducer; |
| 130 | + std::string fTrkProducer; |
| 131 | + std::string fGeantProducer; |
| 132 | + std::string fSimDepProducer; |
| 133 | + std::string fSimChanProducer; |
| 134 | + float fSimGainFactor; |
| 135 | + bool fDebugMode; |
| 136 | + float fTrueBlipMergeDist; |
| 137 | + bool fDoHitFiltering; |
| 138 | + float fMaxHitTrkLength; |
| 139 | + float fMaxHitAmp; |
| 140 | + std::vector<float> fMinHitAmp; |
| 141 | + std::vector<float> fMinHitRMS; |
| 142 | + std::vector<float> fMaxHitRMS; |
| 143 | + std::vector<float> fMinHitGOF; |
| 144 | + std::vector<float> fMaxHitGOF; |
| 145 | + std::vector<float> fMinHitRatio; |
| 146 | + std::vector<float> fMaxHitRatio; |
| 147 | + int fMaxHitMult; |
| 148 | + float fHitClustWidthFact; |
| 149 | + int fHitClustWireRange; |
| 150 | + float fMatchQDiffLimit; |
| 151 | + float fMatchMaxQRatio; |
| 152 | + std::vector<float> fTimeOffset; |
| 153 | + bool fApplyXTicksOffset; |
| 154 | + float fMatchMinOverlap; |
| 155 | + float fMatchSigmaFact; |
| 156 | + float fMatchMaxTicks; |
| 157 | + int fMaxWiresInCluster; |
| 158 | + float fMinClusterCharge; |
| 159 | + float fMaxClusterCharge; |
| 160 | + float fMaxClusterSpan; |
| 161 | + int fMinMatchedPlanes; |
| 162 | + bool fPickyBlips; |
| 163 | + bool fApplyTrkCylinderCut; |
| 164 | + float fCylinderRadius; |
| 165 | + |
| 166 | + bool fVetoBadChannels; |
| 167 | + std::string fBadChanProducer; |
| 168 | + std::string fBadChanFile; |
| 169 | + int fMinDeadWireGap; |
| 170 | + |
| 171 | + bool keepAllClusts; |
| 172 | + bool fKeepAllClusts[kNplanes]; |
| 173 | + |
| 174 | + // --- Calorimetry configs --- |
| 175 | + int fCaloPlane; |
| 176 | + float fCalodEdx; |
| 177 | + float fESTAR_p0; |
| 178 | + float fESTAR_p1; |
| 179 | + bool fLifetimeCorr; |
| 180 | + bool fSCECorr; |
| 181 | + bool fYZUniformityCorr; |
| 182 | + float fModBoxA; |
| 183 | + float fModBoxB; |
| 184 | + |
| 185 | + // --- Splines for calo |
| 186 | + TSpline3* spline_PSTAR; |
| 187 | + TSpline3* CreateSplinePSTAR(); |
| 188 | + float Q_to_E_ESTAR(float Q); |
| 189 | + float Q_to_E_PSTAR(float Q); |
| 190 | + |
| 191 | + // --- Histograms --- |
| 192 | + //TH1D* h_chanstatus; |
| 193 | + //TH1D* h_hit_chanstatus; |
| 194 | + TH1D* h_hit_times; |
| 195 | + TH1D* h_chan_nhits; |
| 196 | + TH1D* h_chan_nclusts; |
| 197 | + TH1D* h_clust_nwires; |
| 198 | + TH1D* h_clust_timespan; |
| 199 | + |
| 200 | + TH1D* h_clust_overlap[kNTPCs][kNplanes]; |
| 201 | + TH1D* h_clust_dt[kNTPCs][kNplanes]; |
| 202 | + TH1D* h_clust_dtfrac[kNTPCs][kNplanes]; |
| 203 | + TH2D* h_clust_q[kNTPCs][kNplanes]; |
| 204 | + TH2D* h_clust_q_cut[kNTPCs][kNplanes]; |
| 205 | + TH1D* h_clust_score[kNTPCs][kNplanes]; |
| 206 | + //TH1D* h_clust_picky_overlap[kNplanes]; |
| 207 | + //TH1D* h_clust_picky_dt[kNplanes]; |
| 208 | + //TH1D* h_clust_picky_dtfrac[kNplanes]; |
| 209 | + //TH2D* h_clust_picky_q[kNplanes]; |
| 210 | + |
| 211 | + TH1D* h_clust_truematch_overlap[kNTPCs][kNplanes]; |
| 212 | + TH1D* h_clust_truematch_dt[kNTPCs][kNplanes]; |
| 213 | + TH1D* h_clust_truematch_dtfrac[kNTPCs][kNplanes]; |
| 214 | + TH1D* h_clust_truematch_score[kNTPCs][kNplanes]; |
| 215 | + TH2D* h_clust_truematch_q[kNTPCs][kNplanes]; |
| 216 | + |
| 217 | + TH1D* h_nmatches[kNTPCs][kNplanes]; |
| 218 | + |
| 219 | + }; |
| 220 | + |
| 221 | +} |
| 222 | + |
| 223 | +#endif |
0 commit comments