Skip to content

Commit

Permalink
Merge branch 'apply-pointcloud' of github.com:WireCell/wire-cell-tool…
Browse files Browse the repository at this point in the history
…kit into apply-pointcloud
  • Loading branch information
brettviren committed Jan 6, 2025
2 parents 5f859f1 + 426271c commit 67250d4
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 0 deletions.
123 changes: 123 additions & 0 deletions patrec/docs/QLBundles/Bundle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
## Describe FlashTPCBundle in WCP

For more detailed information, please refer to the [OpFlash documentation](https://github.com/BNLIF/wire-cell-data/blob/master/docs/FlashTPCBundle.md).

## Example prototype jobs or files ...

A WCP rootfile can be found @ [this link](https://www.phy.bnl.gov/xqian/talks/wire-cell-porting/nuselEval_5384_137_6852.root)

Bundle information are saved in
```cpp
TTree *T_match1 = new TTree("T_match","T_match");
T_match1->SetDirectory(file1);
Int_t ncluster;
T_match1->Branch("tpc_cluster_id",&ncluster,"tpc_cluster_id/I"); // TPC parent cluster id (see TC tree for more explainations)
T_match1->Branch("flash_id",&flash_id,"flash_id/I"); // PMT Flash ID, see flash_id for more information
T_match1->Branch("event_type",&event_type,"event_type/I"); // this is to save the event tagger information (saved as bits in WCP)
Double_t flash_time;
T_match1->Branch("flash_time",&flash_time,"flash_time/D"); // Flash time
cluster_length = 0;
T_match1->Branch("cluster_length",&cluster_length,"cluster_length/D"); // cluster length for main cluster
```
TPC Blob information are saved in
```cpp
// load mcell
TTree *TC = (TTree*)file->Get("TC");
std::vector<int> *cluster_id_vec = new std::vector<int>;
std::vector<int> *parent_cluster_id = new std::vector<int>;
std::vector<int> *time_slice_vec = new std::vector<int>;
std::vector<double> *q_vec = new std::vector<double>;
std::vector<double> *uq_vec = new std::vector<double>;
std::vector<double> *vq_vec = new std::vector<double>;
std::vector<double> *wq_vec = new std::vector<double>;
std::vector<double> *udq_vec = new std::vector<double>;
std::vector<double> *vdq_vec = new std::vector<double>;
std::vector<double> *wdq_vec = new std::vector<double>;
std::vector<int> *nwire_u_vec = new std::vector<int>;
std::vector<int> *nwire_v_vec = new std::vector<int>;
std::vector<int> *nwire_w_vec = new std::vector<int>;
std::vector<int> *flag_u_vec = new std::vector<int>;
std::vector<int> *flag_v_vec = new std::vector<int>;
std::vector<int> *flag_w_vec = new std::vector<int>;
std::vector<std::vector<int>> *wire_index_u_vec = new std::vector<std::vector<int>>;
std::vector<std::vector<int>> *wire_index_v_vec = new std::vector<std::vector<int>>;
std::vector<std::vector<int>> *wire_index_w_vec = new std::vector<std::vector<int>>;
std::vector<std::vector<double>> *wire_charge_u_vec = new std::vector<std::vector<double>>;
std::vector<std::vector<double>> *wire_charge_v_vec = new std::vector<std::vector<double>>;
std::vector<std::vector<double>> *wire_charge_w_vec = new std::vector<std::vector<double>>;
std::vector<std::vector<double>> *wire_charge_err_u_vec = new std::vector<std::vector<double>>;
std::vector<std::vector<double>> *wire_charge_err_v_vec = new std::vector<std::vector<double>>;
std::vector<std::vector<double>> *wire_charge_err_w_vec = new std::vector<std::vector<double>>;
TC->SetBranchAddress("cluster_id",&cluster_id_vec); // actual cluster id where this blob belons
TC->SetBranchAddress("parent_cluster_id",&parent_cluster_id); // main cluster id that is used in T_match bundle
TC->SetBranchAddress("time_slice",&time_slice_vec);
TC->SetBranchAddress("q",&q_vec);
TC->SetBranchAddress("uq",&uq_vec);
TC->SetBranchAddress("vq",&vq_vec);
TC->SetBranchAddress("wq",&wq_vec);
TC->SetBranchAddress("udq",&udq_vec);
TC->SetBranchAddress("vdq",&vdq_vec);
TC->SetBranchAddress("wdq",&wdq_vec);
TC->SetBranchAddress("nwire_u",&nwire_u_vec);
TC->SetBranchAddress("nwire_v",&nwire_v_vec);
TC->SetBranchAddress("nwire_w",&nwire_w_vec);
TC->SetBranchAddress("flag_u",&flag_u_vec);
TC->SetBranchAddress("flag_v",&flag_v_vec);
TC->SetBranchAddress("flag_w",&flag_w_vec);
TC->SetBranchAddress("wire_index_u",&wire_index_u_vec);
TC->SetBranchAddress("wire_index_v",&wire_index_v_vec);
TC->SetBranchAddress("wire_index_w",&wire_index_w_vec);
TC->SetBranchAddress("wire_charge_u",&wire_charge_u_vec);
TC->SetBranchAddress("wire_charge_v",&wire_charge_v_vec);
TC->SetBranchAddress("wire_charge_w",&wire_charge_w_vec);
TC->SetBranchAddress("wire_charge_err_u",&wire_charge_err_u_vec);
TC->SetBranchAddress("wire_charge_err_v",&wire_charge_err_v_vec);
TC->SetBranchAddress("wire_charge_err_w",&wire_charge_err_w_vec);
```


Opflash are saved in
```cpp
TTree *T_flash = (TTree*)file->Get("T_flash");
Double_t time;
Int_t type;
Int_t flash_id;
Int_t temp_run_no, temp_subrun_no, temp_event_no;
T_flash->SetBranchAddress("runNo",&temp_run_no);
T_flash->SetBranchAddress("subRunNo",&temp_subrun_no);
T_flash->SetBranchAddress("eventNo",&temp_event_no);
T_flash->SetBranchAddress("time",&time);
T_flash->SetBranchAddress("type",&type); // flash type, full waveform or Cosmic mode, two different types in MicroBooNE
T_flash->SetBranchAddress("flash_id",&flash_id); // this id is useful for matching with TPC object in bundle
Double_t low_time, high_time, total_PE;
Double_t temp_PE[32], temp_PE_err[32];
std::vector<int> *fired_channels = new std::vector<int>;
std::vector<double> *l1_fired_time = new std::vector<double>;
std::vector<double> *l1_fired_pe = new std::vector<double>;
T_flash->SetBranchAddress("low_time",&low_time); // start time of flash
T_flash->SetBranchAddress("high_time",&high_time); // end time of flash
T_flash->SetBranchAddress("total_PE",&total_PE); // total PE
T_flash->SetBranchAddress("PE",temp_PE); // PE for each PMT
T_flash->SetBranchAddress("PE_err",temp_PE_err); // PE_err for each PMT
T_flash->SetBranchAddress("fired_channels",&fired_channels); // which channel are included in flash
T_flash->SetBranchAddress("l1_fired_time",&l1_fired_time); // advanced flash info
T_flash->SetBranchAddress("l1_fired_pe",&l1_fired_pe); // advanced flash info
```
## Describe WCT version
## Example WCT jobs or files ...
## WCP's requirements
N/A
## WCT's questions to confirm functionality
46 changes: 46 additions & 0 deletions patrec/docs/QLBundles/Opflash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Describe OpFlash in WCP

For more detailed information, please refer to the [OpFlash documentation](https://github.com/BNLIF/wire-cell-data/blob/master/docs/OpFlash.md).

## Example prototype jobs or files ...

A WCP rootfile can be found @ [this link](https://www.phy.bnl.gov/xqian/talks/wire-cell-porting/nuselEval_5384_137_6852.root)

Opflash are saved in
```cpp
TTree *T_flash = (TTree*)file->Get("T_flash");
Double_t time;
Int_t type;
Int_t flash_id;
Int_t temp_run_no, temp_subrun_no, temp_event_no;
T_flash->SetBranchAddress("runNo",&temp_run_no);
T_flash->SetBranchAddress("subRunNo",&temp_subrun_no);
T_flash->SetBranchAddress("eventNo",&temp_event_no);
T_flash->SetBranchAddress("time",&time);
T_flash->SetBranchAddress("type",&type); // flash type, full waveform or Cosmic mode, two different types in MicroBooNE
T_flash->SetBranchAddress("flash_id",&flash_id); // this id is useful for matching with TPC object in bundle
Double_t low_time, high_time, total_PE;
Double_t temp_PE[32], temp_PE_err[32];
std::vector<int> *fired_channels = new std::vector<int>;
std::vector<double> *l1_fired_time = new std::vector<double>;
std::vector<double> *l1_fired_pe = new std::vector<double>;
T_flash->SetBranchAddress("low_time",&low_time); // start time of flash
T_flash->SetBranchAddress("high_time",&high_time); // end time of flash
T_flash->SetBranchAddress("total_PE",&total_PE); // total PE
T_flash->SetBranchAddress("PE",temp_PE); // PE for each PMT
T_flash->SetBranchAddress("PE_err",temp_PE_err); // PE_err for each PMT
T_flash->SetBranchAddress("fired_channels",&fired_channels); // which channel are included in flash
T_flash->SetBranchAddress("l1_fired_time",&l1_fired_time); // advanced flash info
T_flash->SetBranchAddress("l1_fired_pe",&l1_fired_pe); // advanced flash info
```
## Describe WCT version
## Example WCT jobs or files ...
## WCP's requirements
N/A
## WCT's questions to confirm functionality
47 changes: 47 additions & 0 deletions patrec/docs/porting_dictionary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Between Clustering and Trajectoryand dQ/dx fitting (Current)

## [Opflash](./QLBundles/Opflash.md) (WCP) vs. <span style="color:red">xxx</span> (WCT)

## [FlashTPCBundle](./QLBundles/Bundle.md) (WCP) vs. <span style="color:red">xxx</span> (WCT)

## [Examine_bundles](https://github.com/BNLIF/wire-cell-2dtoy/blob/master/docs/ExamineBundles.md) is a function that we need to port, [Original ExamineBundles Code](https://github.com/BNLIF/wire-cell-2dtoy/blob/a30305052fc54bbbbbd826b096066d6e8777b54d/src/ExamineBundles.cxx)
- bundle->get_main_cluster() (WCP) vs. <span style="color:red">xxx</span> (WCT)
- bundle->get_other_clusters() (WCP) vs. <span style="color:red">xxx</span> (WCT)
- bundle->get_main_cluster()->get_mcells() (WCP) vs. [loop blob](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/clustering_separate.cxx#L1377) (WCT)
- Create a new temp cluster, PR3DCluster *new_cluster = new PR3DCluster(cluster_id) (WCP) vs. <span style="color:red">xxx</span> (WCT)
- Add every blob to this cluster, new_cluster->AddCell(blob, blob->GetTimeSlice()) (WCP) vs. <span style="color:red">xxx</span> (WCT)
- std::vector<SMGCSelection> sep_mcells = new_cluster->Examine_graph(ct_point_cloud) [code](https://github.com/BNLIF/wire-cell-data/blob/d5748d87c3113efcb44eed237bb48a10d60002d9/src/PR3DCluster.cxx#L2332) (WCP) vs. similar to [Create_graph](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L1444) (WCT)
- [Connect_graph_overclustering_protection](https://github.com/BNLIF/wire-cell-data/blob/d5748d87c3113efcb44eed237bb48a10d60002d9/src/PR3DCluster.cxx#L1853) (WCP) vs. not existing, but example in [connect_graph](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L1444) (WCT)
- For each sep_mcells, we will form a new set of clusters, we need to find the cluster that overlapped the most with the original main cluster, and assign it as the new MAIN CLUSTER for the new bundle (achieved through compare blobs) (WCP) vs. <span style="color:red">xxx</span> (WCT)

## [PRCluster->Create_Graph()](https://github.com/BNLIF/wire-cell/blob/master/uboone_nusel_app/apps/prod-wire-cell-matching-nusel.cxx#L817) (WCP) vs. [Create_graph](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L1444) (WCT)

## [cluster->get_highest_lowest_wcps()](https://github.com/BNLIF/wire-cell/blob/master/uboone_nusel_app/apps/prod-wire-cell-matching-nusel.cxx#L819C103-L819C130) (WCP) vs. [get_ghiehst_lowst_points](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L1241) (WCT)

<span style="color:red">WCT function only returns points, but we need the index to do the shortest path (following two functions), how to get point index from points? </span>

## [cluster->->dijkstra_shortest_paths(wcps.first)](https://github.com/BNLIF/wire-cell/blob/master/uboone_nusel_app/apps/prod-wire-cell-matching-nusel.cxx#L822C25-L823C58) (WCP) vs. [dijkstra_shortest_paths using point index](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L2631) (WCT)

## [cluster->cal_shortest_path(wcps.second)](https://github.com/BNLIF/wire-cell/blob/master/uboone_nusel_app/apps/prod-wire-cell-matching-nusel.cxx#L823) (WCP) vs. [cal_shortest_path using point index](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L2664) (WCT)

## [Improve_PR3DCluster](https://github.com/BNLIF/wire-cell-2dtoy/blob/master/docs/Improve_PR3DCluster.md) is another function that we need to port. [Original Improve_PR3DCluster Code](https://github.com/BNLIF/wire-cell-2dtoy/blob/master/src/ImprovePR3DCluster.cxx)

- From existing clusters --> blobs --> time, fired channels --> get activities to be used to redo tiling (WCP) vs. <span style="color:red">xxx</span> (WCT)
- Access shorest path std::list<WCPointCloud<double>::WCPoint>& wcps = cluster->get_path_wcps() (WCP) vs. [index of points along the path](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L2689) (WCT)
- for a path point, use ct_point_cloud to convert the point into ch vs. time, and then judge if activities are available (WCP) vs. <span style="color:red">xxx</span> (WCT)
- [update the activities according to the path_point's properties](https://github.com/BNLIF/wire-cell-2dtoy/blob/master/src/ImprovePR3DCluster.cxx#L136) (WCP) vs. <span style="color:red">xxx</span> (WCT)
- [redo tiling using the newly created activities](https://github.com/BNLIF/wire-cell-2dtoy/blob/master/src/ImprovePR3DCluster.cxx#L203) (WCP) vs. <span style="color:red">xxx</span> (WCT)
- Compare the newly created blobs vs. the (old) existing blobs using the Overlap_fast function and judge if the blob should be kept or not, then create a new cluster from the remaining blobs (WCP) vs. <span style="color:red">xxx</span>, [overlap_fast](https://github.com/WireCell/wire-cell-toolkit/blob/apply-pointcloud/clus/src/Facade_Cluster.cxx#L513) (WCT)

## [map from old to new cluster](https://github.com/BNLIF/wire-cell/blob/master/uboone_nusel_app/apps/prod-wire-cell-matching-nusel.cxx#L831) (WCP) vs. <span style="color:red">xxx</span> (WCT)


# Include and after Trajectory Fitting (TBD)

## [ProtoSegment](https://github.com/BNLIF/wire-cell-pid/blob/537a3fd17f8a7b3cf5412594267c14c4cc1775cb/docs/protosegment.md) (WCP) vs. <span style="color:red">xxx</span> (WCT)

## [WCShower](https://github.com/BNLIF/wire-cell-pid/blob/537a3fd17f8a7b3cf5412594267c14c4cc1775cb/docs/wcshower.md) (WCP) vs. <span style="color:red">xxx</span> (WCT)

## [ProtoVertex](https://github.com/BNLIF/wire-cell-pid/blob/537a3fd17f8a7b3cf5412594267c14c4cc1775cb/docs/protovertex.md) (WCP) vs. <span style="color:red">xxx</span> (WCT)

## [Steiner Tree](https://github.com/BNLIF/wire-cell-pid/blob/537a3fd17f8a7b3cf5412594267c14c4cc1775cb/docs/PR3DCluster_steiner.md) (WCP) vvs. <span style="color:red">xxx</span> (WCT)

0 comments on commit 67250d4

Please sign in to comment.