9 #include "TGeoMatrix.h" 45 #include "art_root_io/TFileDirectory.h" 46 #include "art_root_io/TFileService.h" 49 #include "canvas/Persistency/Common/FindMany.h" 50 #include "canvas/Persistency/Common/FindManyP.h" 51 #include "canvas/Persistency/Common/FindOneP.h" 84 void FillMyMaps ( std::map< int, simb::MCParticle> &MyMap,
85 art::FindManyP<simb::MCParticle> Assn,
87 std::map<int, int>* indexMap=
nullptr);
89 bool InMyMap (
int TrID, std::map< int, simb::MCParticle> ParMap );
90 void FillTruth(
const art::FindManyP<simb::MCParticle> Assn,
91 const art::Handle<std::vector<simb::MCTruth>>& Hand,
94 art::Handle< std::vector<raw::RawDigit> >rawDigitsVecHandle,
95 std::set<int> badChannels,
197 std::cout <<
"Reconfigured " << this->
processName() <<
" with " 198 <<
" SaveNeighbourADCs: " << std::boolalpha
199 <<
" SaveTruth: " << std::boolalpha << fSaveTruth
200 <<
" SaveIDEs: " << std::boolalpha <<
std::endl;
258 fAnaTree = tfs->make<TTree>(
"OpHitDumpTree",
"OpHitDumper analysis tree");
318 auto const*
geo = lar::providerFrom<geo::Geometry>();
325 art::FindManyP<simb::MCParticle> SignAssn(SignTrue,evt,
fGEANTLabel);
335 art::FindManyP<simb::MCParticle> Ar39Assn(Ar39True,evt,
fGEANTLabel);
343 art::FindManyP<simb::MCParticle> NeutAssn(NeutTrue,evt,
fGEANTLabel);
351 art::FindManyP<simb::MCParticle> KrypAssn(KrypTrue,evt,
fGEANTLabel);
359 art::FindManyP<simb::MCParticle> RdonAssn(RdonTrue,evt,
fGEANTLabel);
367 art::FindManyP<simb::MCParticle> Ar42Assn(Ar42True,evt,
fGEANTLabel);
373 std::vector<simb::MCParticle> allTruthParts;
375 allTruthParts.push_back(it.second);
377 allTruthParts.push_back(it.second);
379 allTruthParts.push_back(it.second);
381 allTruthParts.push_back(it.second);
383 allTruthParts.push_back(it.second);
385 allTruthParts.push_back(it.second);
387 std::map<PType, std::map< int, simb::MCParticle >&> PTypeToMap{
396 std::map<PType,std::set<int>> PTypeToTrackID;
398 for(
auto const& it : PTypeToMap){
400 auto const&
m=it.second;
401 for(
auto const& it2 :
m){
403 PTypeToTrackID[
p].insert(it2.first);
411 std::vector<art::Ptr<recob::OpHit> > ophitlist;
412 std::map<PType, std::vector<art::Ptr<recob::OpHit> > > map_of_ophit;
418 std::cout <<
"There are " << ophitlist.size() <<
" optical hits in the event." <<
std::endl;
420 for(
size_t i = 0; i < ophitlist.size(); ++i)
428 std::sort(vec_tracksdp.begin(), vec_tracksdp.end(),
431 for (
size_t iSDP=0; iSDP<vec_tracksdp.size(); ++iSDP) {
438 if (vec_tracksdp.size()>0){
454 map_of_ophit[
gen].push_back(ophitlist.at(i));
456 double xyz_optdet[3]={0,0,0};
457 double xyz_world [3]={0,0,0};
459 geo->OpDetGeoFromOpChannel(ophitlist[i]->
OpChannel()).LocalToWorld(xyz_optdet,xyz_world);
474 std::cerr <<
" - Othe : " << map_of_ophit[
kUnknown].size() <<
" opt hits" <<
std::endl;
483 mf::LogWarning(
"DualPhaseOpHitDumperModule") <<
"Requested to save optical hits, but cannot load any ophits";
495 const art::Handle<std::vector<simb::MCTruth>>& Hand,
498 for(
size_t i1=0; i1<Hand->size(); ++i1) {
499 for (
size_t i2=0; i2 < Assn.at(i1).size(); ++i2 ) {
520 art::FindManyP<simb::MCParticle> Assn,
522 std::map<int, int>* indexMap) {
523 for (
size_t L1=0; L1 < Hand->size(); ++L1 ) {
526 for (
size_t L2=0; L2 < Assn.at(L1).size(); ++L2 ) {
528 MyMap[ThisPar.
TrackId()] = ThisPar;
529 if(indexMap) indexMap->insert({ThisPar.
TrackId(), L1});
541 ThisPType=it->second;
551 ParIt = ParMap.find( TrID );
552 if ( ParIt != ParMap.end() ) {
double E(const int i=0) const
std::string const & processName() const
std::vector< double > True_Bck_VertX
Index OpChannel(Index detNum, Index channel)
std::map< int, simb::MCParticle > RdonParts
std::vector< int > True_Bck_ID
std::vector< double > True_Bck_VertY
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
std::map< PType, std::string > PTypeString
std::vector< double > PDS_OpHit_Width
EventNumber_t event() const
std::map< int, const simb::MCParticle * > truthmap
std::vector< int > PDS_OpHit_OpChannel
std::vector< int > True_Bck_Mode
std::vector< double > PDS_OpHit_Z
std::vector< int > PDS_OpHit_True_GenType
std::vector< double > PDS_OpHit_PeakTime
Handle< PROD > getHandle(SelectorBase const &) const
void FillTruth(const art::FindManyP< simb::MCParticle > Assn, const art::Handle< std::vector< simb::MCTruth >> &Hand, const PType type)
std::vector< unsigned short > PDS_OpHit_Frame
std::vector< double > PDS_OpHit_True_Energy
DualPhaseOpHitDumper(fhicl::ParameterSet const &p)
double Width(Resonance_t res)
resonance width (GeV)
std::vector< double > True_Bck_VertZ
std::map< int, simb::MCParticle > Ar42Parts
std::vector< double > PDS_OpHit_Amplitude
std::vector< double > PDS_OpHit_Area
EDAnalyzer(fhicl::ParameterSet const &pset)
std::map< int, simb::MCParticle > NeutParts
art framework interface to geometry description
art::ServiceHandle< cheat::PhotonBackTrackerService > pbt_serv
void analyze(art::Event const &evt) override
std::vector< int > PDS_OpHit_True_IndexAll
art::ServiceHandle< cheat::BackTrackerService > bt_serv
simb::MCParticle TrackIdToParticle(int const id) const
std::vector< int > PDS_OpHit_True_Index
std::vector< double > True_Bck_Energy
#define DEFINE_ART_MODULE(klass)
std::map< int, simb::MCParticle > SignParts
std::vector< int > PDS_OpHit_True_TrackIDAll
std::vector< double > PDS_OpHit_FastToTotal
T get(std::string const &key) const
float energyFrac
fraction of OpHit energy from the particle with this trackID
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P)
void SaveNeighbourADC(int channel, art::Handle< std::vector< raw::RawDigit > >rawDigitsVecHandle, std::set< int > badChannels, recob::Hit const &hits)
double T(const int i=0) const
art::ServiceHandle< geo::Geometry > geo
std::vector< double > PDS_OpHit_True_EnergyAll
SubRunNumber_t subRun() const
bool InMyMap(int TrID, std::map< int, simb::MCParticle > ParMap)
void reconfigure(fhicl::ParameterSet const &p)
Encapsulate the geometry of a wire.
Ionization photons from a Geant4 track.
double Vx(const int i=0) const
Declaration of signal hit object.
std::vector< int > PDS_OpHit_True_TrackID
std::vector< double > True_Bck_Time
std::string fOpHitModuleLabel
std::vector< double > PDS_OpHit_PeakTimeAbs
Stores extra MC truth information that is recorded when generating events using a time-dependent supe...
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void FillMyMaps(std::map< int, simb::MCParticle > &MyMap, art::FindManyP< simb::MCParticle > Assn, art::Handle< std::vector< simb::MCTruth > > Hand, std::map< int, int > *indexMap=nullptr)
double Vz(const int i=0) const
PType WhichParType(int TrID)
Definitions of geometry vector data types.
Declaration of basic channel signal object.
std::vector< double > PDS_OpHit_PE
std::vector< double > PDS_OpHit_X
2D representation of charge deposited in the TDC/wire plane
Tools and modules for checking out the basics of the Monte Carlo.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
DualPhaseOpHitDumper & operator=(DualPhaseOpHitDumper const &)=delete
std::map< int, int > trkIDToMarleyIndex
LArSoft geometry interface.
std::map< int, simb::MCParticle > KrypParts
std::map< int, simb::MCParticle > Ar39Parts
std::vector< int > True_Bck_PDG
double Vy(const int i=0) const
std::vector< int > PDS_OpHit_True_GenTypeAll
QTextStream & endl(QTextStream &s)
std::map< int, PType > trkIDToPType
std::vector< double > PDS_OpHit_Y