18 #include "art_root_io/TFileService.h" 23 #include "canvas/Persistency/Common/FindOne.h" 24 #include "canvas/Persistency/Common/FindOneP.h" 25 #include "canvas/Persistency/Common/FindMany.h" 26 #include "canvas/Persistency/Common/FindManyP.h" 31 #include "MCCheater/BackTracker.h" 45 #include "TDatabasePDG.h" 46 #include "TParticlePDG.h" 50 #include <unordered_map> 142 consumesMany<std::vector<simb::MCTruth> >();
147 consumes<art::Assns<simb::MCTruth, simb::MCParticle> >(
fGeantLabel);
149 consumes<std::vector<rec::Hit> >(
fHitLabel);
154 consumes<art::Assns<rec::Track, rec::Vertex> >(
fVertexLabel);
156 consumes<std::vector<gar::sdp::CaloDeposit> >(
fGeantLabel);
180 fTree = tfs->make<TTree>(
"MPDtestTree",
"MPDtestTree");
234 std::vector< art::Handle<std::vector<simb::MCTruth>> > mcthandlelist;
236 mcthandlelist = e.
getMany<std::vector<simb::MCTruth> >();
241 if (!mcthandlelist.at(i))
243 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
252 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
260 throw cet::exception(
"anatest") <<
" No gar::sdp::CaloDeposit branch." 261 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
270 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
277 if (!TPCClusterHandle) {
279 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
288 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
299 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
308 throw cet::exception(
"anatest") <<
" No :raw::CaloRawDigit branch." 309 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
315 if (!RecoHitHandle) {
317 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
323 if (!RecoClusterHandle) {
325 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
338 for (
size_t imchl = 0; imchl < mcthandlelist.size(); ++imchl) {
339 for (
auto const& mct : (*mcthandlelist.at(imchl)) ) {
340 if (mct.NeutrinoSet()) {
352 bool const dumpMCP =
false;
355 for (
auto const& mcp : *MCPHandle ) {
356 if (mcp.Mother() > 0) {
358 if ( TPCeve->
TrackId() == mcp.TrackId() ) ++nMotherless;
361 std::cout <<
"TrackID: " << mcp.
TrackId() <<
" is PDG: " << mcp.PdgCode() <<
362 " with mother " << mcp.Mother() <<
" produced by process " << mcp.Process()
367 std::cout <<
"Number of children: " << partList->size() <<
std::endl;
368 std::cout <<
"Number of motherless children: " << nMotherless <<
std::endl;
374 std::vector<art::Ptr<rec::Hit>> allhits;
376 for (
size_t iHit=0; iHit<HitHandle->size(); ++iHit) {
378 allhits.push_back(aPtr);
381 if ( mcp.Mother() > 0 )
continue;
382 if (
abs(mcp.PdgCode()) == 13 ) bt->ParticleToHits(&mcp,allhits);
def analyze(root, level, gtrees, gbranches, doprint)
std::string fRawCaloHitLabel
Int_t fSubRun
number of the sub-run being processed
Int_t fEvent
number of the event being processed
Handle< PROD > getHandle(SelectorBase const &) const
std::string fClusterLabel
const simb::MCParticle & Nu() const
virtual void beginJob() override
std::string fECALAssnLabel
int InteractionType() const
#define DEFINE_ART_MODULE(klass)
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
T get(std::string const &key) const
std::string fTPCClusterLabel
anatest(fhicl::ParameterSet const &p)
std::string fCaloHitLabel
SubRunNumber_t subRun() const
Definition of basic calo raw digits.
sim::ParticleList * GetParticleList()
void analyze(art::Event const &e) override
std::vector< Float_t > fQ2
std::vector< Int_t > fInteractionType
std::vector< std::string > fGeneratorLabels
General GArSoft Utilities.
Int_t fRun
number of the run being processed
std::optional< T > get_if_present(std::string const &key) const
EventNumber_t event() const
Event generator information.
cet::coded_exception< error, detail::translate > exception
void FillVectors(art::Event const &e)
QTextStream & endl(QTextStream &s)
std::vector< Int_t > fNeutrinoType