43 #include "TProfile2D.h" 130 fTree = tfs->
make<TTree>(
"tcshowerana",
"tcshowerana");
140 fTree->Branch(
"shwid",
shwid,
"shwid[nshws]/I");
164 std::vector<art::Ptr<recob::Hit> > hitlist;
169 std::vector<art::Ptr<sim::SimChannel> > simchanlist;
174 std::vector<art::Ptr<recob::Shower> > showerlist;
179 std::vector<art::Ptr<simb::MCTruth> > mclist;
186 if (showerListHandle.
isValid()) {
187 nshws = showerlist.size();
190 shwid[i] = showerlist[i]->ID();
191 shwdcosx[i] = showerlist[i]->Direction().X();
192 shwdcosy[i] = showerlist[i]->Direction().Y();
193 shwdcosz[i] = showerlist[i]->Direction().Z();
194 shwstartx[i] = showerlist[i]->ShowerStart().X();
195 shwstarty[i] = showerlist[i]->ShowerStart().Y();
196 shwstartz[i] = showerlist[i]->ShowerStart().Z();
197 for (
size_t j = 0; j<(showerlist[i]->dEdx()).size(); ++j){
198 shwdedx[i][j] = showerlist[i]->dEdx()[j];
214 if (showerlist.size()) {
215 std::vector< art::Ptr<recob::Hit> > showerhits = shwfm.at(0);
218 double tmpEfrac = 0.0;
219 double tmpEcomplet = 0;
220 truthMatcher(hitlist, showerhits, particle, tmpEfrac, tmpEcomplet);
222 std::cout <<
"shower pdg: "<< particle->
PdgCode() <<
" efrac " << tmpEfrac << std::endl;
256 for (
int j = 0; j < 2; ++j){
279 std::map<int,double> trkID_E;
280 for(
size_t j = 0; j < shower_hits.size(); ++j){
283 if( hit->
View() != 1)
continue;
285 for(
size_t k = 0; k < TrackIDs.size(); k++){
286 if (trkID_E.find(std::abs(TrackIDs[k].trackID))==trkID_E.end()) trkID_E[std::abs(TrackIDs[k].trackID)] = 0;
287 trkID_E[std::abs(TrackIDs[k].trackID)] += TrackIDs[k].energy;
290 double max_E = -999.0;
291 double total_E = 0.0;
293 double partial_E=0.0;
295 if( !trkID_E.size() )
return;
297 total_E += ii->second;
298 if((ii->second)>max_E){
299 partial_E = ii->second;
314 Efrac = partial_E/total_E;
318 for(
size_t k = 0; k < all_hits.size(); ++k){
321 for(
size_t l = 0; l < TrackIDs.size(); ++l){
322 if(std::abs(TrackIDs[l].trackID)==
TrackID) {
323 totenergy += TrackIDs[l].energy;
327 Ecomplet = partial_E/totenergy;
const simb::MCParticle * TrackIdToParticle_P(int const &id)
SubRunNumber_t subRun() const
float shwstartx[kMaxShowers]
double shwdedx[kMaxShowers][2]
const simb::MCNeutrino & GetNeutrino() const
TCShowerAnalysis(fhicl::ParameterSet const &pset)
std::vector< TrackID > TrackIDs
Declaration of signal hit object.
const simb::MCParticle & Nu() const
virtual ~TCShowerAnalysis()
int shwbestplane[kMaxShowers]
calo::CalorimetryAlg fCalorimetryAlg
geo::View_t View() const
View for the plane of the hit.
object containing MC flux information
float shwdcosz[kMaxShowers]
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
#define DEFINE_ART_MODULE(klass)
Provides recob::Track data product.
void analyze(const art::Event &evt)
float shwstarty[kMaxShowers]
std::string fHitModuleLabel
std::string fDigitModuleLabel
void truthMatcher(std::vector< art::Ptr< recob::Hit >>all_hits, std::vector< art::Ptr< recob::Hit >> shower_hits, const simb::MCParticle *&MCparticle, double &Efrac, double &Ecomplet)
EDAnalyzer(Table< Config > const &config)
Declaration of cluster object.
Detector simulation of raw signals on wires.
float shwdcosy[kMaxShowers]
std::string fShowerModuleLabel
float shwdcosx[kMaxShowers]
float shwstartz[kMaxShowers]
T * make(ARGS...args) const
Utility object to perform functions of association.
std::string fGenieGenModuleLabel
const std::vector< sim::TrackIDE > HitToEveTrackIDEs(recob::Hit const &hit)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
object containing MC truth information necessary for making RawDigits and doing back tracking ...
void reconfigure(fhicl::ParameterSet const &pset)
EventNumber_t event() const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
art framework interface to geometry description
Event finding and building.