Commit 14dd4bc6 authored by Breno Rilho Lemos's avatar Breno Rilho Lemos 💬
Browse files

Merge branch 'lucas' into 'Breno'

Lucas-Breno

See merge request !1
parents 1d1376cf 5e592ea3
#+TITLE: Alice LabBook
#+AUTHOR: LMS
#+STARTUP: overview indent
#+TAGS: noexport(n) deprecated(d) Marcelo(m) Lucas(l)
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+SEQ_TODO: TODO(t!) STARTED(s!) WAITING(w!) | DONE(d!) CANCELLED(c!) DEFERRED(f!)
This document is in English.
* Introduction
Most of the code in this Laboratory Notebook is written in R.
#+begin_src R :results output :session :exports both
suppressMessages(library(tidyverse))
sessionInfo()
#+end_src
#+RESULTS:
#+begin_example
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux bullseye/sid
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.7.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.3 purrr_0.3.2
[5] readr_1.3.1 tidyr_0.8.3 tibble_2.1.3 ggplot2_3.2.1
[9] tidyverse_1.2.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 cellranger_1.1.0 pillar_1.4.2 compiler_3.6.1
[5] tools_3.6.1 zeallot_0.1.0 jsonlite_1.6 lubridate_1.7.4
[9] gtable_0.3.0 nlme_3.1-141 lattice_0.20-38 pkgconfig_2.0.2
[13] rlang_0.4.0 cli_1.1.0 rstudioapi_0.10 haven_2.1.1
[17] withr_2.1.2 xml2_1.2.2 httr_1.4.1 generics_0.0.2
[21] vctrs_0.2.0 hms_0.5.1 grid_3.6.1 tidyselect_0.2.5
[25] glue_1.3.1 R6_2.4.0 readxl_1.3.1 modelr_0.1.5
[29] magrittr_1.5 backports_1.1.4 scales_1.0.0 rvest_0.3.4
[33] assertthat_0.2.1 colorspace_1.4-1 stringi_1.4.3 lazyeval_0.2.2
[37] munsell_0.5.0 broom_0.5.2 crayon_1.3.4
#+end_example
* 2019-10-11 Plot data created by sol-analitica
** Data :ATTACH:
:PROPERTIES:
:Attachments: positions.zip
:ID: f33a9852-afa9-4cda-b9e8-34b1f2dfe368
:END:
** Unzip and Read
#+begin_src R :results output :session :exports both
FILE <- "data/f3/3a9852-afa9-4cda-b9e8-34b1f2dfe368/positions.zip"
unzip(FILE)
read_delim("positions.txt", delim=" ", col_names=FALSE) %>%
rename(Track = X1,
Time = X2,
X = X3,
Y = X4,
Z = X5) %>%
print -> df.exp0
#+end_src
#+RESULTS:
#+begin_example
Parsed with column specification:
cols(
X1 = col_double(),
X2 = col_double(),
X3 = col_double(),
X4 = col_double(),
X5 = col_double()
)
# A tibble: 109,900 x 5
Track Time X Y Z
<dbl> <dbl> <dbl> <dbl> <dbl>
 1 0 0 -0.0000773 0.00170 0.195
 2 0 0.0001 0.0000994 0.00165 0.195
 3 0 0.0002 0.000276 0.00160 0.195
 4 0 0.000300 0.000453 0.00155 0.195
 5 0 0.0004 0.000630 0.00150 0.195
 6 0 0.0005 0.000806 0.00146 0.195
 7 0 0.000600 0.000983 0.00141 0.195
 8 0 0.0007 0.00116 0.00136 0.195
 9 0 0.0008 0.00134 0.00131 0.195
10 0 0.0009 0.00151 0.00126 0.195
# … with 109,890 more rows
#+end_example
** Plot
See here
https://stackoverflow.com/questions/6862742/draw-a-circle-with-ggplot2
on how to draw a circle.
#+begin_src R :results output graphics :file img/positions.png :exports both :width 600 :height 600 :session
circleFun <- function(center = c(0,0),diameter = 1, npoints = 100){
r = diameter / 2
tt <- seq(0,2*pi,length.out = npoints)
xx <- center[1] + r * cos(tt)
yy <- center[2] + r * sin(tt)
return(data.frame(x = xx, y = yy))
}
df.tpc.outer <- circleFun(c(0,0), 4.95, npoints = 100)
df.tpc.inner <- circleFun(c(0,0), 1.80, npoints = 100)
df.exp0 %>%
ggplot(aes(x=X, y=Y)) +
# Draw the tracks
geom_point(aes(color=as.factor(Track)), size=.1) +
# Draw approximate TPC
geom_path(data=df.tpc.outer, aes(x=x, y=y)) +
geom_path(data=df.tpc.inner, aes(x=x, y=y)) +
# Cosmetics
theme_bw(base_size=16) +
theme(legend.position="none",
axis.title=element_blank(),
axis.text=element_blank(),
axis.ticks=element_blank())
#+end_src
#+RESULTS:
[[file:img/positions.png]]
*
......@@ -16,9 +16,12 @@
//
// REMEMBER: Vx is for velocity; vx is for vertex.
//
//
#define ESD_SUMARIO "esd-summary.dat"
#define ESD_DETALHE "esd-detail.dat"
void main() {
int main(int argc, char **argv) {
int i, j, numberOfTracks;
double vx, vy, vz, w, Rx, Ry, Rz, B, radius, prevRadius, t, dt, skip[8];
......@@ -26,8 +29,18 @@ void main() {
FILE *detail, *summary;
summary = fopen("esd-summary.dat","r"); // filename must be "esd-summary.dat"
detail = fopen("esd-detail.dat","r"); // filename must be "esd-detail.dat"
// filename must be "esd-summary.dat"
summary = fopen(ESD_SUMARIO,"r");
if (summary == NULL){
fprintf(stderr, "O arquivo %s não pode ser aberto.\n", ESD_SUMARIO);
exit(1);
}
// filename must be "esd-detail.dat"
detail = fopen(ESD_DETALHE,"r");
if (detail == NULL){
fprintf(stderr, "O arquivo %s não pode ser aberto.\n", ESD_DETALHE);
exit(1);
}
i=0;
j=0;
......@@ -43,7 +56,7 @@ void main() {
if(numberOfTracks < 15 || numberOfTracks > 30) { // if loop has ended and number of tracks is NOT between 15 and 30, finish business
printf("There are no events so that 15 < number of tracks < 30 \n\n");
return;
return 1;
}
......@@ -150,6 +163,7 @@ void main() {
fclose(positions);
return 0;
} // Program works for one specific event.
// Remember to organize AliAnalysisTaskMyTask.cxx 11834
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment