8 #ifndef SHWF_SHOWERCHEATER_H 9 #define SHWF_SHOWERCHEATER_H 65 produces< std::vector<recob::Shower> >();
66 produces< std::vector<recob::SpacePoint> >();
67 produces< art::Assns<recob::Shower, recob::Cluster> >();
68 produces< art::Assns<recob::Shower, recob::SpacePoint> >();
69 produces< art::Assns<recob::Shower, recob::Hit> >();
70 produces< art::Assns<recob::Hit, recob::SpacePoint> >();
102 std::vector< art::Ptr<recob::Cluster> > clusters;
106 std::map< int, std::vector<std::pair<size_t, art::Ptr<recob::Cluster> > > > eveClusterMap;
109 for(
size_t c = 0; c < clusters.size(); ++c){
115 int eveID = floor(clusters[c]->ID()/1000.);
117 std::pair<size_t, art::Ptr<recob::Cluster> > indexPtr(c, clusters[c]);
119 eveClusterMap[eveID].push_back(indexPtr);
124 std::unique_ptr< std::vector<recob::Shower> > showercol(
new std::vector<recob::Shower>);
125 std::unique_ptr< std::vector<recob::SpacePoint> > spcol(
new std::vector<recob::SpacePoint>);
131 for(
auto const& clusterMapItr : eveClusterMap){
134 std::vector< std::pair<size_t, art::Ptr<recob::Cluster> > >
const& eveClusters = clusterMapItr.second;
136 size_t startSPIndx = spcol->size();
138 double totalCharge = 0.;
140 std::vector< art::Ptr<recob::Cluster> > ptrvs;
141 std::vector< size_t > idxs;
143 for(
auto const& idxPtr : eveClusters){
144 idxs.push_back(idxPtr.first);
145 ptrvs.push_back(idxPtr.second);
152 std::vector< art::Ptr<recob::Hit> >
const&
hits = fmh.at(idxPtr.first);
154 for(
size_t h = 0; h < hits.size(); ++h){
158 std::vector<double> xyz = bt_serv->
HitToXYZ(hit);
159 double sperr[6] = {0.01, 0.01, 0.1, 0.001, 0.001, 0.001};
166 idxPtr.second->ID()*10000 + h);
167 spcol->push_back(sp);
175 size_t endSPIndx = spcol->size();
179 if( std::abs(pi_serv->
ParticleList()[clusterMapItr.first]->PdgCode()) == 11 ||
180 std::abs(pi_serv->
ParticleList()[clusterMapItr.first]->PdgCode()) == 22 ||
181 std::abs(pi_serv->
ParticleList()[clusterMapItr.first]->PdgCode()) == 111 ){
183 mf::LogInfo(
"ShowerCheater") <<
"prong of " << clusterMapItr.first
184 <<
" is a shower with pdg code " 185 << pi_serv->
ParticleList()[clusterMapItr.first]->PdgCode();
189 const TLorentzVector initmom = pi_serv->
ParticleList()[clusterMapItr.first]->Momentum();
190 TVector3 dcos( initmom.Px()/initmom.Mag(),
191 initmom.Py()/initmom.Mag(),
192 initmom.Pz()/initmom.Mag() );
193 TVector3 dcosErr(1.
e-3, 1.
e-3, 1.
e-3 );
202 s.
set_id(showercol->size());
209 showercol->push_back(s);
214 for(
size_t i = 0; i < idxs.size(); ++i){
215 std::vector< art::Ptr<recob::Hit> >
hits = fmh.at(i);
220 util::CreateAssn(*
this, evt, *showercol, *spcol, *sspassn, startSPIndx, endSPIndx);
222 mf::LogInfo(
"ShowerCheater") <<
"adding shower: \n" 224 <<
"\nto collection.";
229 evt.
put(std::move(showercol));
230 evt.
put(std::move(spcol));
231 evt.
put(std::move(scassn));
232 evt.
put(std::move(shassn));
233 evt.
put(std::move(sspassn));
234 evt.
put(std::move(sphassn));
void set_direction_err(const TVector3 &dir_e)
geo::SigType_t SignalType() const
Signal type for the plane of the hit.
const std::vector< double > HitToXYZ(const recob::Hit &hit)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
void reconfigure(fhicl::ParameterSet const &pset)
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
ShowerCheater(fhicl::ParameterSet const &pset)
void produce(art::Event &evt)
ProductID put(std::unique_ptr< PROD > &&product)
std::string fCheatedClusterLabel
label for module creating recob::Cluster objects
void set_id(const int id)
void set_direction(const TVector3 &dir)
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
Declaration of cluster object.
Detector simulation of raw signals on wires.
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
std::string fG4ModuleLabel
label for module running G4 and making particles, etc
const sim::ParticleList & ParticleList()
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Namespace collecting geometry-related classes utilities.
art framework interface to geometry description
Signal from collection planes.