62 std::unique_ptr<std::vector<recob::Track>> &trk_coll,
65 std::unique_ptr<std::vector<recob::Hit>> &hit_coll,
66 std::unique_ptr<std::vector<recob::SpacePoint>> &spt_coll,
67 std::vector<int> &index,
72 std::unique_ptr<std::vector<recob::Shower>> &shw_coll,
75 std::unique_ptr<std::vector<recob::Hit>> &hit_coll,
76 std::unique_ptr<std::vector<recob::SpacePoint>> &spt_coll,
77 std::vector<int> &index,
86 static constexpr
float SqrtPi = 1.7725;
92 fInput(p.get<
std::string>(
"WireCellInput"))
95 produces<std::vector<recob::Hit> >();
96 produces<std::vector<recob::SpacePoint> >();
97 produces<art::Assns<recob::Hit, recob::SpacePoint> >();
98 produces<std::vector<recob::Track> >();
99 produces<std::vector<recob::Shower> >();
100 produces<art::Assns<recob::Track, recob::Hit> >();
101 produces<art::Assns<recob::Track, recob::SpacePoint> >();
102 produces<art::Assns<recob::Shower, recob::Hit> >();
103 produces<art::Assns<recob::Shower, recob::SpacePoint> >();
111 int subrun = evt.
subRun();
114 std::unique_ptr<std::vector<recob::Hit>> hit_coll(
new std::vector<recob::Hit>);
115 std::unique_ptr<std::vector<recob::SpacePoint>> spt_coll(
new std::vector<recob::SpacePoint>);
117 std::unique_ptr<std::vector<recob::Track>> trk_coll(
new std::vector<recob::Track>);
120 std::unique_ptr<std::vector<recob::Shower>> shw_coll(
new std::vector<recob::Shower>);
128 struct dirent *entry;
129 if( (pDIR=opendir(path.c_str())) != NULL ){
131 while((entry = readdir(pDIR)) != NULL){
133 if( strcmp(entry->d_name,
".")==0 || strcmp(entry->d_name,
"..")==00)
continue;
135 std::string filename(entry->d_name);
136 if((
int)filename.find(
".root")==-1)
139 std::string
file = (path + entry->d_name);
140 TFile *
f =
new TFile(file.c_str());
141 TTree *Trun = (TTree*)f->Get(
"Trun");
142 int eventNo, runNo, subRunNo;
143 Trun->SetBranchAddress(
"eventNo",&eventNo);
144 Trun->SetBranchAddress(
"runNo",&runNo);
145 Trun->SetBranchAddress(
"subRunNo",&subRunNo);
146 if (!Trun->GetEntries())
continue;
149 if (runNo!=run||eventNo!=
event||subRunNo!=subrun) {
153 TTree *TC = (TTree*)f->Get(
"TC");
165 Double_t u_charge_err;
166 Double_t v_charge_err;
167 Double_t w_charge_err;
172 TC->SetBranchAddress(
"time_slice", &time_slice);
173 TC->SetBranchAddress(
"charge", &charge);
174 TC->SetBranchAddress(
"xx", &xx);
175 TC->SetBranchAddress(
"yy", &yy);
176 TC->SetBranchAddress(
"zz", &zz);
177 TC->SetBranchAddress(
"u_index", &u_index);
178 TC->SetBranchAddress(
"v_index", &v_index);
179 TC->SetBranchAddress(
"w_index", &w_index);
180 TC->SetBranchAddress(
"u_charge", &u_charge);
181 TC->SetBranchAddress(
"v_charge", &v_charge);
182 TC->SetBranchAddress(
"w_charge", &w_charge);
183 TC->SetBranchAddress(
"u_charge_err", &u_charge_err);
184 TC->SetBranchAddress(
"v_charge_err", &v_charge_err);
185 TC->SetBranchAddress(
"w_charge_err", &w_charge_err);
186 TC->SetBranchAddress(
"cryostat_no", &cryostat_no);
187 TC->SetBranchAddress(
"mcell_id",&mcell_id);
189 TC->GetDirectory()->Print();
193 TObjArray* leafList = TC->GetListOfLeaves();
195 for(
int idx = 0; idx < leafList->GetEntries(); idx++)
197 leafList->At(idx)->Print();
200 TObject* candObj = leafList->FindObject(
"tpc_no");
202 std::cout <<
"candObj: " << candObj << std::endl;
204 TLeaf* candLeaf = (TLeaf*)candObj;
206 candLeaf->SetAddress(&tpc_no);
208 std::vector<int> vcell_id;
210 for (
int i = 0; i<TC->GetEntries(); ++i){
213 tpc_no = candLeaf->GetTypedValue<Int_t>(i) - 1;
215 vcell_id.push_back(mcell_id);
216 double xyz[3] = {
xx,yy,zz};
217 double err[3] = {0,0,0};
225 size_t hitStart = hit_coll->size();
287 size_t hitEnd = hit_coll->size();
288 util::CreateAssn(*
this, evt, *spt_coll, *hit_coll, *shassn, hitStart, hitEnd);
308 std::cout <<
"space point size: " << spt_coll->size() <<
", hit coll size: " << hit_coll->size() << std::endl;
310 evt.
put(std::move(spt_coll));
311 evt.
put(std::move(hit_coll));
312 evt.
put(std::move(shassn));
313 evt.
put(std::move(trk_coll));
314 evt.
put(std::move(trkhassn));
315 evt.
put(std::move(trksassn));
316 evt.
put(std::move(shw_coll));
317 evt.
put(std::move(shwhassn));
318 evt.
put(std::move(shwsassn));
322 std::unique_ptr<std::vector<recob::Track>> &trk_coll,
325 std::unique_ptr<std::vector<recob::Hit>> &hit_coll,
326 std::unique_ptr<std::vector<recob::SpacePoint>> &spt_coll,
327 std::vector<int> &index,
335 Double_t theta[1000];
338 tree->SetBranchAddress(
"npoints", &npoints);
339 tree->SetBranchAddress(
"trackid", &trackid);
340 tree->SetBranchAddress(
"msc_id", msc_id);
341 tree->SetBranchAddress(
"x", x);
342 tree->SetBranchAddress(
"y", y);
343 tree->SetBranchAddress(
"z", z);
344 tree->SetBranchAddress(
"theta", theta);
345 tree->SetBranchAddress(
"phi", phi);
347 Long64_t
nentries = tree->GetEntriesFast();
349 for (Long64_t i=0; i<
nentries; ++i) {
351 std::vector<recob::tracking::Point_t> xyz;
352 std::vector<recob::tracking::Vector_t> dircos;
353 std::vector<size_t>
hits;
354 std::vector<size_t> spts;
355 for (
int i = 0; i<npoints; ++i){
356 xyz.emplace_back(x[i],y[i],z[i]);
357 dircos.emplace_back(sin(theta[i])*cos(phi[i]),sin(theta[i])*sin(phi[i]),cos(theta[i]));
358 for (
size_t j = 0; j<index.size(); ++j){
359 if (index[j]==msc_id[i]){
362 hits.push_back(3*j+1);
363 hits.push_back(3*j+2);
377 std::unique_ptr<std::vector<recob::Shower>> &shw_coll,
380 std::unique_ptr<std::vector<recob::Hit>> &hit_coll,
381 std::unique_ptr<std::vector<recob::SpacePoint>> &spt_coll,
382 std::vector<int> &index,
388 tree->SetBranchAddress(
"npoints", &npoints);
389 tree->SetBranchAddress(
"showerid", &showerid);
390 tree->SetBranchAddress(
"msc_id", msc_id);
392 Long64_t
nentries = tree->GetEntriesFast();
394 for (Long64_t i=0; i<
nentries; ++i) {
399 std::vector<size_t>
hits;
400 std::vector<size_t> spts;
401 for (
int i = 0; i<npoints; ++i){
402 for (
size_t j = 0; j<index.size(); ++j){
403 if (index[j]==msc_id[i]){
406 hits.push_back(3*j+1);
407 hits.push_back(3*j+2);
411 shw_coll->push_back(
recob::Shower(v1, v1, v1, v1, tmp, tmp, tmp, tmp, bestplane, showerid));
SubRunNumber_t subRun() const
void MakeTracks(art::Event &evt, std::unique_ptr< std::vector< recob::Track >> &trk_coll, std::unique_ptr< art::Assns< recob::Track, recob::Hit >> &trkhassn, std::unique_ptr< art::Assns< recob::Track, recob::SpacePoint >> &trksassn, std::unique_ptr< std::vector< recob::Hit >> &hit_coll, std::unique_ptr< std::vector< recob::SpacePoint >> &spt_coll, std::vector< int > &index, TTree *tree)
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 > > SMatrixSym55
Declaration of signal hit object.
MergeWireCell(fhicl::ParameterSet const &p)
TrackTrajectory::Flags_t Flags_t
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
void reconfigure(fhicl::ParameterSet const &p)
ProductID put(std::unique_ptr< PROD > &&product)
#define DEFINE_ART_MODULE(klass)
Provides recob::Track data product.
static constexpr float SqrtPi
A trajectory in space reconstructed from hits.
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.
void produce(art::Event &e) override
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
Utility object to perform functions of association.
EventNumber_t event() const
constexpr double kBogusD
obviously bogus double value
2D representation of charge deposited in the TDC/wire plane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
static constexpr float Sqrt2Pi
void MakeShowers(art::Event &evt, std::unique_ptr< std::vector< recob::Shower >> &shw_coll, std::unique_ptr< art::Assns< recob::Shower, recob::Hit >> &shwhassn, std::unique_ptr< art::Assns< recob::Shower, recob::SpacePoint >> &shwsassn, std::unique_ptr< std::vector< recob::Hit >> &hit_coll, std::unique_ptr< std::vector< recob::SpacePoint >> &spt_coll, std::vector< int > &index, TTree *tree)
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Event finding and building.
MergeWireCell & operator=(MergeWireCell const &)=delete