From 051b6a2a383e40911dcc2ef609a87625aad18dc7 Mon Sep 17 00:00:00 2001 From: Fang Wenxing <wxfang@lxslc716.ihep.ac.cn> Date: Wed, 9 Sep 2020 17:36:31 +0800 Subject: [PATCH] merge MarlinUtil --- .../CED/.cepcenv/01-09-01/status/install.yml | 20 - Reconstruction/PFA/Pandora/CED/CED/ced.cc | 382 --------- Reconstruction/PFA/Pandora/CED/CED/ced.h | 146 ---- Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc | 539 ------------ Reconstruction/PFA/Pandora/CED/CED/ced_cli.h | 432 ---------- .../PFA/Pandora/CED/CED/ced_config.h | 204 ----- .../PFA/Pandora/GaudiPandora/CMakeLists.txt | 15 +- .../Pandora/GaudiPandora/include/PfoCreator.h | 2 +- .../MarlinUtil/01-08/source/HelixClass.cc | 768 ------------------ .../MarlinUtil/01-08/source/HelixClass.h | 302 ------- .../MarlinUtil/01-08/source/LineClass.cc | 73 -- .../MarlinUtil/01-08/source/LineClass.h | 32 - .../PFA/Pandora/MatrixPandora/CMakeLists.txt | 21 +- .../MatrixPandora/include/PfoCreator.h | 2 +- Utilities/DataHelper/CMakeLists.txt | 6 +- .../DataHelper/DataHelper}/ClusterShapes.h | 2 +- .../DataHelper/src}/ClusterShapes.cc | 2 +- 17 files changed, 15 insertions(+), 2933 deletions(-) delete mode 100644 Reconstruction/PFA/Pandora/CED/.cepcenv/01-09-01/status/install.yml delete mode 100644 Reconstruction/PFA/Pandora/CED/CED/ced.cc delete mode 100644 Reconstruction/PFA/Pandora/CED/CED/ced.h delete mode 100644 Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc delete mode 100644 Reconstruction/PFA/Pandora/CED/CED/ced_cli.h delete mode 100644 Reconstruction/PFA/Pandora/CED/CED/ced_config.h delete mode 100644 Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.cc delete mode 100644 Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.h delete mode 100644 Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.cc delete mode 100644 Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.h rename {Reconstruction/PFA/Pandora/MarlinUtil/01-08/source => Utilities/DataHelper/DataHelper}/ClusterShapes.h (99%) rename {Reconstruction/PFA/Pandora/MarlinUtil/01-08/source => Utilities/DataHelper/src}/ClusterShapes.cc (99%) diff --git a/Reconstruction/PFA/Pandora/CED/.cepcenv/01-09-01/status/install.yml b/Reconstruction/PFA/Pandora/CED/.cepcenv/01-09-01/status/install.yml deleted file mode 100644 index 9f2056ab..00000000 --- a/Reconstruction/PFA/Pandora/CED/.cepcenv/01-09-01/status/install.yml +++ /dev/null @@ -1,20 +0,0 @@ -clean: - end: 2018-09-04 10:38:21.535016 - finished: true - start: 2018-09-04 10:38:21.503623 -compile: - end: 2018-09-04 10:38:21.449716 - finished: true - start: 2018-09-04 10:38:07.382890 -download: - end: 2018-09-04 10:35:56.326883 - finished: true - start: 2018-09-04 10:35:55.941740 -extract: - end: 2018-09-04 10:35:56.510664 - finished: true - start: 2018-09-04 10:35:56.368258 -pre_compile: - end: 2018-09-04 10:37:33.127719 - finished: true - start: 2018-09-04 10:37:33.110630 diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced.cc b/Reconstruction/PFA/Pandora/CED/CED/ced.cc deleted file mode 100644 index 65444465..00000000 --- a/Reconstruction/PFA/Pandora/CED/CED/ced.cc +++ /dev/null @@ -1,382 +0,0 @@ -/* "C" event display. - * Communications related part. - * -*ik - * Alexey Zhelezov, DESY/ITEP, 2005 */ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <unistd.h> -#include <fcntl.h> -#include <time.h> - -#include <ced.h> - -//hauke -//#include <stropts.h> -#include <poll.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -#include <netdb.h> -#include <sys/socket.h> /* for AF_INET */ -#include <iostream> - - -//http://www.rhyolite.com/pipermail/dcc/2004/001986.html -#ifndef POLLRDNORM //fg: should be defined in poll.h -# define POLLRDNORM 0x040 /* Normal data may be read. */ -# define POLLRDBAND 0x080 /* Priority data may be read. */ -# define POLLWRNORM 0x100 /* Writing now will not block. */ -# define POLLWRBAND 0x200 /* Priority data may be written. */ -#endif -//end hauke - -static int ced_fd=-1; // CED connection socket - -static unsigned short ced_port=7927; // port No of CED (assume localhost) -static char ced_host[30]; - -// Return 0 if can be connected, -1 otherwise. -/*static*/ int ced_connect(void){ - static time_t last_attempt=0; - time_t ct; - struct sockaddr_in addr; - - if(ced_fd>=0){ - return 0; // already connected; - } - time(&ct); - if(ct-last_attempt<5){ - return -1; // don't try reconnect all the time - } - addr.sin_family=AF_INET; - addr.sin_port=htons(ced_port); - addr.sin_addr.s_addr=inet_addr(ced_host); - memset(&addr.sin_zero, 0, sizeof(addr.sin_zero)); //not nessesary because sin_zero is not used! - - ced_fd=socket(PF_INET,SOCK_STREAM,0); - if(connect(ced_fd,(struct sockaddr *)&addr,sizeof(addr)) != 0){ - if(!last_attempt){ - perror("WARNING:CED: can't connect to CED"); - } - time(&last_attempt); - close(ced_fd); - ced_fd=-1; - return -1; - } - fprintf(stderr,"INFO:CED: connected to CED\n"); - return 0; -} - - -typedef struct { - unsigned size; // size of one item in bytes - unsigned char *b; // "body" - data are stored here - // (here is some trick :) - unsigned long count; // number of usefull items - unsigned long alloced; // number of allocated items - ced_draw_cb draw; // draw fucation, NOT used in CED client -} ced_element; - -typedef struct { - ced_element *e; - unsigned e_count; -} ced_event; - -//static ced_event eve = {0,0}; - -static ced_event eve = {0,0}; - -// NOT used in CED client -static ced_event ceve = {0,0}; // current event on screen - -// we reserve this size just before ced_element.b data -#define HDR_SIZE 8 - -unsigned ced_register_element(unsigned item_size,ced_draw_cb draw_func){ - ced_element *pe; - if(!(eve.e_count&0xf)){ - eve.e=(ced_element *) realloc(eve.e,(eve.e_count+0x10)*sizeof(ced_element)); - } - - pe=eve.e+eve.e_count; - memset(pe,0,sizeof(*pe)); - pe->size=item_size; - pe->draw=draw_func; - return eve.e_count++; -} - -static void ced_reset(void){ - unsigned i; - - for(i=0;i<eve.e_count;i++){ - eve.e[i].count=0; - // if( eve.e[i].alloced > 0){ - // eve.e[i].alloced=0; //hauke: 15.12.11 - // //free(eve.e[i].b-HDR_SIZE); - // } - } -} - -static void ced_buf_alloc(ced_element *pe,unsigned count){ - if(!pe->b){ - - //std::cout << "malloc requestet: " << count*pe->size+HDR_SIZE << "bytes" << std::endl; - pe->b=(unsigned char *) malloc(count*pe->size+HDR_SIZE); - //printf("malloc: ask for NEW %lu bytes pointer: %p\n ", count*pe->size+HDR_SIZE, pe->b); //hauke - if(pe->b==NULL){ //hauke - printf("ERROR: malloc failed!\n"); - exit(1); - } - }else{ - //free(pe->b-HDR_SIZE); - //pe->b=(unsigned char *) malloc(count*pe->size+HDR_SIZE); - - //std::cout << "realloc requestet: " << count*pe->size+HDR_SIZE << "bytes" << std::endl; - pe->b=(unsigned char *) realloc(pe->b-HDR_SIZE,count*pe->size+HDR_SIZE); - - //printf("malloc: ask for %lu bytes, pointer: %p\n", count*pe->size+HDR_SIZE,pe->b);//hauke - if(pe->b==NULL){ //hauke - printf("ERROR: malloc failed!\n"); - exit(1); - } - } - pe->b+=HDR_SIZE; - pe->alloced=count; -} - -void *ced_add(unsigned id){ - ced_element *pe; - if(id >= eve.e_count){ - fprintf(stderr,"BUG:CED: attempt to access not registered element\n"); - return 0; - } - pe=eve.e+id; - - if(pe->count==pe->alloced){ - ced_buf_alloc(pe,pe->alloced+256); - } - - return (pe->b+(pe->count++)*pe->size); -} - -static void ced_event_copy(ced_event *trg){ - unsigned i; - ced_element *pe; - //std::cout << "trg->e_count: " << trg->e_count << std::endl; - //std::cout << "eve.e_count: " << eve.e_count << std::endl; - - //eve.e_count = 0; - if(trg->e_count<eve.e_count){ - //free(trg->e); - trg->e=(ced_element*) realloc(trg->e,eve.e_count*sizeof(ced_element)); - - //trg->e=(ced_element*) malloc(eve.e_count*sizeof(ced_element)); - } - - - for(i=0;i<eve.e_count;i++){ - pe=trg->e+i; - if(i<trg->e_count){ - //if(pe->alloced > 0){ - // free(pe->b); - // pe->b=NULL; - // pe->alloced=0; - //} - - - //if(pe->alloced > 0){ - // std::cout << "try to free" << std::endl; - // free(pe->b-HDR_SIZE); - // pe->alloced = 0; - // std::cout << "finished" << std::endl; - //} - - if(pe->alloced<eve.e[i].alloced) { - ced_buf_alloc(pe,eve.e[i].alloced); - //std::cout << "test1 " << std::endl; - } - pe->count=eve.e[i].count; - - }else{ - memcpy(pe,eve.e+i,sizeof(ced_element)); - if(pe->b){ - pe->b=0; - // std::cout << "test2 " << std::endl; - ced_buf_alloc(pe,pe->alloced); - } - } - if(pe->count){ - memcpy(pe->b,eve.e[i].b,pe->count*pe->size); - } - } - trg->e_count=eve.e_count; -} - -void ced_do_draw_event(void){ - unsigned int i,j; - ced_element *pe; - unsigned char *pdata; - for(i=0;i<ceve.e_count;i++){ - //printf("ceve.e_count: %i\n", ceve.e_count); - //for(i=ceve.e_count-1; i >=0;i--){ //quick hack, change order so that the detector is drawn at last - //printf("i = %i\n", i); - - pe=ceve.e+i; - if(!pe->draw) - continue; - for(pdata=pe->b,j=0;j<pe->count;j++,pdata+=pe->size) - (*(pe->draw))(pdata); - } -} - -typedef enum { - DRAW_EVENT=10000 -} MSG_TYPE; - -int ced_process_input(void *data){ - struct _phdr{ - unsigned size; - unsigned type; - unsigned char b[4]; - } *hdr = (_phdr*) data; - unsigned count; - ced_element *pe; - - if(!data){ // new client is connected - ced_reset(); - return 0; - } - - if(hdr->type == DRAW_EVENT){ - ced_event_copy(&ceve); - ced_reset(); - return 1; - } - if(hdr->type>=eve.e_count){ - fprintf(stderr,"WARNING:CED: undefined element type (%u), ignored\n", - hdr->type); - return 0; - } - pe=eve.e+hdr->type; - if((hdr->size-HDR_SIZE)%pe->size){ - fprintf(stderr,"BUG:CED: size alignment is wrong for element %u\n", hdr->type); - return 0; - } - count=(hdr->size-HDR_SIZE)/pe->size; - if(!count) - return 0; - if(count>=pe->alloced) - ced_buf_alloc(pe,count+256); - memcpy(pe->b,hdr->b,count*pe->size); - pe->count=count; - return 0; -} - -void ced_send_event(void){ - struct _phdr{ - int size; - unsigned type; - } *hdr,draw_hdr; - unsigned i,problem=0; - int sent_sum; - char *buf; - int sent; - ced_element *pe; - - if(ced_connect()) - return; - for(i=0;i<eve.e_count && !problem;i++){ - //printf("i=%i\n",i); - pe=eve.e+i; - if(!pe->count) - continue; - - //unsigned hauke; - //printf("size of unsigned %i\n", sizeof(hauke)); - hdr=(struct _phdr *)(pe->b-HDR_SIZE); // !!! HERE is the trick :) - hdr->type=i; - //printf("pe->count %i, pe->size %i\n",pe->count, pe->size); - hdr->size=HDR_SIZE+pe->count*pe->size; - sent_sum=0; - //if(hdr->size > 10000000){printf("U P S! This data set is realy big! (%f kB)(%i counts)\n",(hdr->size)/1024.0,pe->count);} - buf=(char *)hdr; - //printf("hdr->size=%i\n",hdr->size); - while(sent_sum<hdr->size){ - //printf("sent_sum = %i, hdr->size=%i\n",sent_sum,hdr->size); - sent=write(ced_fd,buf+sent_sum,hdr->size-sent_sum); - - //printf("byte: %u\n", buf[sent_sum]); - if(sent<0){ - printf("send < 0\n"); - problem=1; - break; - } - sent_sum+=sent; - } - } - if(!problem){ - draw_hdr.size=HDR_SIZE; - draw_hdr.type=DRAW_EVENT; - if(write(ced_fd,&draw_hdr,HDR_SIZE)!=HDR_SIZE) - problem=1; - } - if(problem){ - perror("WARNING:CED: can't send event, till next time..."); - close(ced_fd); - ced_fd=-1; - } -} - - -//hauke -int ced_selected_id_noblock() { - int id=-1 ; - struct pollfd fds[1]; - fds[0].fd=ced_fd; - fds[0].events = POLLRDNORM | POLLIN; - if(poll(fds,1,0) > 0){ - if(recv(ced_fd, &id, sizeof(int) , 0 ) > 0){ - return id; - }else{ - return -1; - } - }else{ - return -1; - } -} - -int ced_selected_id() { - int id=-1 ; - if(recv(ced_fd, &id, sizeof(int) , 0 ) > 0){ - return id; - }else{ - return -1; - } -} -#include <signal.h> -// API -void ced_client_init(const char *hostname,unsigned short port){ - struct hostent *host = gethostbyname(hostname); - snprintf(ced_host, 30, "%u.%u.%u.%u\n",(unsigned char)host->h_addr[0] ,(unsigned char)host->h_addr[1] ,(unsigned char)host->h_addr[2] ,(unsigned char)host->h_addr[3]); - - - //printf("ip: %s\n", ced_host); - //ced_host=host->h_addr; - ced_port=port; - signal(SIGPIPE,SIG_IGN); -} - -void ced_new_event(void){ - ced_reset(); -} - -void ced_draw_event(void){ - ced_send_event(); - ced_reset(); -} diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced.h b/Reconstruction/PFA/Pandora/CED/CED/ced.h deleted file mode 100644 index ccf355c2..00000000 --- a/Reconstruction/PFA/Pandora/CED/CED/ced.h +++ /dev/null @@ -1,146 +0,0 @@ -/* "C" event display. - * Main part. - * - * Alexey Zhelezov, DESY/ITEP, 2005 */ - -/* - * This file is internal. It must not be - * included into enduser application. - */ - -#ifndef __CED_H -#define __CED_H - -#include "ced_cli.h" - -//#ifdef __cplusplus -// extern "C" { -//#endif - - -//char trusted_hosts[50]; -//extern static char testchar; - -typedef void (*ced_draw_cb)(void *data); - - -/* - * Register new element type. Order is important! - * Appropriate code must be defined in both - * client and server parts. - * - * item_size - size of one item in bytes. - * draw_func - function to call to draw one item, - * called from ced_do_draw_event() - * not used on client side. - */ -unsigned ced_register_element(unsigned item_size,ced_draw_cb draw_func); - -/* - * To be called from element functions - * on client side. - * Return allocated space for one item - * with size, specified by ced_register_element() - * - * Example: assume struct Dummy { int i; }; is item. - * - * DummyID=ced_register_element(sizeof(struct Dummy),0); - * ... - * struct Dummy *item=(struct Dummy *)ced_add_element(DummyID); - * item->i=0; - * This will add one Dummy item to the event - */ -void *ced_add(unsigned id); - -/* - * To be called in paint function - * - * It calls user defined functions for - * each item of all elements types. - */ -void ced_do_draw_event(void); - -/* - * Server side function. - * Must be used to process all incoming - * messages from client. - * - * It return positive value when - * new event must be drawn. - * - * Example: - * glut_tcp_server(7285,my_process_input) - * - * my_process_input(x){ - * if(ced_process_input(x)>0) - * <do redraw> - */ -int ced_process_input(void *data); - -//------------ -void addLayerDescriptionToMenu(int,char *);//glced.c -void selectFromMenu(int id);//glced.c -void toggleHelpWindow(void);//glced.c -void updateLayerEntryInPopupMenu(int); //glced.c -int buildMenuPopup(void);//glced.c - - -#define VERSION_CONFIG 3 -struct CEDsettings{ - bool trans; //grid or surface view - bool persp; //perspectivic view or flat projection - bool antia; //anti aliasing - bool light; //light source - bool picking_highlight; //marker at picking position - double detector_trans[NUMBER_DETECTOR_LAYER]; - double detector_cut_angle[NUMBER_DETECTOR_LAYER]; - double detector_cut_z[NUMBER_DETECTOR_LAYER]; - bool detector_picking; -// double cut_angle; //deprecated -// double trans_value; //deprecated -// double z_cutting; //deprecated - bool layer[CED_MAX_LAYER]; - bool phi_projection; - bool z_projection; - double view[3]; - double va; //vertical angle of view - double ha; //horionzional angle of view - bool fixed_view; - int win_h; //height of the window (pixel) - int win_w; //wight of the window (pixel) - double zoom; - double fisheye_alpha; - double world_size; - double fisheye_world_size; - double bgcolor[4]; - bool show_axes; - bool fps; - double screenshot_sections; - int font; //size of text (menu, shortcuts, text in ced window) - bool autoshot; // If true, generate screencapture in every new event - int autoshot_scale; // If true, generate screencapture in every new event -}; - -/* -//important: -// - sum of all layers must be smaler than max_layer! -// - number_popup_layer must be smaler than number_data_layer - -#define CED_MAX_LAYER 100 -#define NUMBER_POPUP_LAYER 20 -#define NUMBER_DATA_LAYER 25 -#define NUMBER_DETECTOR_LAYER 20 - - -#define CED_MAX_LAYER_CHAR 400 -*/ - -//------------- - -//#ifdef __cplusplus -// } -//#endif - - - -#endif /* __CED_H */ diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc b/Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc deleted file mode 100644 index 8c063e12..00000000 --- a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.cc +++ /dev/null @@ -1,539 +0,0 @@ -/* "C" event display. - * Client side elements definitions. - * - * Alexey Zhelezov, DESY/ITEP, 2005 */ -#include <string.h> - -#include <ced_cli.h> -#include <ced.h> -#include <stdio.h> -//#include <iostream> - -#include <math.h> - - -/* - * Hit element - */ - -static unsigned HIT_ID=0; - -void ced_hit(float x,float y,float z,unsigned type,unsigned size,unsigned color){ - ced_hit_ID(x,y,z, type & 0xFF,( type >> CED_LAYER_SHIFT ) & 0xFF, size,color, 0); -} - -//deprecated -void ced_hit_ID_old(float x,float y,float z,unsigned type, unsigned size,unsigned color, unsigned lcioID){ - ced_hit_ID(x,y,z,type & 0xFF,(type >> CED_LAYER_SHIFT) & 0xFF,size,color,lcioID); -} - -void ced_hit_ID(float x,float y,float z,unsigned type,unsigned layer, unsigned size,unsigned color, unsigned lcioID){ - CED_Hit *h=(CED_Hit *)ced_add(HIT_ID); - if(!h) - return; - h->p.x=x; - h->p.y=y; - h->p.z=z; - h->type=type; - // if(layer > 255){ //downward compability - // h->layer=layer >> CED_LAYER_SHIFT; - // }else{ - h->layer=layer; - // } - h->size=size; - h->color=color; - h->lcioID=lcioID; -} - -/* - * Line element - */ - -static unsigned LINE_ID=0; - -void ced_line(float x0,float y0,float z0, - float x1,float y1,float z1, - unsigned type, unsigned width,unsigned color){ - ced_line_ID(x0,y0,z0,x1,y1,z1, type, width, color, 0); -} - -void ced_line_ID(float x0,float y0,float z0, - float x1,float y1,float z1, - unsigned layer, unsigned width,unsigned color, unsigned lcioID){ -// //test for picking -// //static int anz; -// float length=(x1-x0)*(x1-x0) + (y1-y0)*(y1-y0) + (z1-z0)*(z1-z0); -// //printf("CEDLINE length: %f\n x0 %f y0 %f z0 %f, x1 %f, y1 %f z1 %f", length, x0, y0, z0, x1, y1, z1); -// -// if(length > 500.0){ -// //std::cout << "devide line (length=" << length << ")" << std::endl; -// ced_line_ID(x0,y0,z0, -// (x1-x0)/2.0+x0,(y1-y0)/2.0+y0,(z1-z0)/2.0+z0, -// layer, width, color, lcioID); -// ced_line_ID( -// (x1-x0)/2.0+x0,(y1-y0)/2.0+y0,(z1-z0)/2.0+z0, -// -// x1,y1,z1, -// layer, width, color, lcioID); -// //todo -// //printf("seperate line %i\n", anz++); -// return; -// -// } - -/* -//test - if( random()%100000 > 99990){ - double size[]={10,100,50}; - double position[]={x0,y0,z0}; - double rotate[] = {20,50,70}; - int color=1; - int lcio_id=5; - int layer=5; - //ced_geobox(size, position, color ); - ced_geobox_ID(size, position, layer, 0xff00ff, 5); - ced_geobox(size, position, color); - - } - -//end test -*/ - - CED_Line *l=(CED_Line *)ced_add(LINE_ID); - if(!l) - return; - l->p0.x=x0; - l->p0.y=y0; - l->p0.z=z0; - l->p1.x=x1; - l->p1.y=y1; - l->p1.z=z1; - if(layer > 255){ //downward compability - l->type=layer >> CED_LAYER_SHIFT; - }else{ - l->type=layer; - } - - //printf("layer pre: %i after: %i\n" , layer, l->type); - -// l->type=type; - l->width=width; - l->color=color; - l->lcioID=lcioID; -} -/* - * GeoCylinder - */ -static unsigned GEOC_ID=0; - -void ced_geocylinder(float d,unsigned sides,float rotate,float z,float shift, - unsigned color){ - CED_GeoCylinder *c=(CED_GeoCylinder *)ced_add(GEOC_ID); - if(!c) - return; - c->d=d; - c->sides=sides; - c->rotate=rotate; - c->z=z; - c->shift=shift; - c->color=color; -} - -/* - * Rotated Geocylinder - * Extension of the cylinder subject to a 3-DOF rotation - * @author: SD - * @date: 26.08.08 - */ -static unsigned GEOCR_ID=0; - -void ced_geocylinder_r(float d, double z, double * center, double * rotate, unsigned sides, - unsigned int color, int layer){ - int iDim; - CED_GeoCylinderR *c=(CED_GeoCylinderR *)ced_add(GEOCR_ID); - if(!c) return; - for (iDim = 0; iDim < 3; iDim ++ ) { - c->center[iDim] = center[iDim]; - c->rotate[iDim] = rotate[iDim]; - } - c->d=d; - c->sides=sides; - c->color=color; - c->z=z; - if(layer > 255){ //downward compability - c->layer=layer >> CED_LAYER_SHIFT; - }else{ - c->layer=layer; - } - - //c->layer=layer; -} - -void ced_geocylinders(unsigned n,CED_GeoCylinder *all){ - CED_GeoCylinder *c; - unsigned i; - for(i=0;i<n;i++){ - c=(CED_GeoCylinder *)ced_add(GEOC_ID); - if(!c) - return; - memcpy(c,all+i,sizeof(CED_GeoCylinder)); - } -} - -static unsigned GEOT_ID=0; - -void ced_geotubes(unsigned n,CED_GeoTube *all){ - CED_GeoTube *c; - unsigned i; - for(i=0;i<n;i++){ - c=(CED_GeoTube *)ced_add(GEOT_ID); - if(!c) - return; - memcpy(c,all+i,sizeof(CED_GeoTube)); - } -} - - -static unsigned GEOB_ID=0; - -void ced_geobox(double * sizes, double * center, unsigned int color ) { - int iDim; - CED_GeoBox * box = (CED_GeoBox*) ced_add(GEOB_ID); - if ( ! box ) return; - for ( iDim = 0; iDim < 3; iDim ++ ) { - box->sizes[iDim] = sizes[iDim]; - box->center[iDim] = center[iDim]; - } - box->color = color; - -} - -void rotate3d(double *vektor, double *rotate){ - //double cords2[3]; - double r_rad[3]={rotate[0]/360*2*3.14159265358979323846, rotate[1]/360*2*3.14159265358979323846, rotate[2]/360*2*3.14159265358979323846}; - double cords1[3] = {vektor[0], vektor[1], vektor[2]}; - - vektor[0] = ( cos(r_rad[1])*cos(r_rad[2]) )*cords1[0] + - (-cos(r_rad[0])*sin(r_rad[2]) + sin(r_rad[0])*sin(r_rad[1])*cos(r_rad[2]) )*cords1[1] + - ( sin(r_rad[0])*sin(r_rad[2]) + cos(r_rad[0])*sin(r_rad[1])*cos(r_rad[2]) )*cords1[2]; - vektor[1] = ( cos(r_rad[1])*sin(r_rad[2]) ) * cords1[0] + - ( cos(r_rad[0])*cos(r_rad[2]) + sin(r_rad[0])*sin(r_rad[1])*sin(r_rad[2])) * cords1[1] + - ( -sin(r_rad[0])*cos(r_rad[2]) + cos(r_rad[0])*sin(r_rad[1])*sin(r_rad[2]) ) * cords1[2]; - vektor[2] = (-sin(r_rad[1])) * cords1[0] + - ( sin(r_rad[0])*cos(r_rad[1])) * cords1[1] + - ( cos(r_rad[0])*cos(r_rad[1])) * cords1[2]; - -} - -void ced_geobox_r_ID(double *size, double *position, double *rotate, unsigned int layer, unsigned int color, unsigned int lcio_id) { - - int i; - double vektor1[3], vektor2[3]; - //unsigned int type = layer; //<< CED_LAYER_SHIFT; - //unsigned int type = layer; - - double cubematrix[12][6] ={ {-1,-1,-1, +1,-1,-1}, - {-1,-1,-1, -1,+1,-1}, - {-1,-1,-1, -1,-1,+1}, - {+1,-1,-1, +1,+1,-1}, - {+1,-1,-1, +1,-1,+1}, - {+1,+1,-1, +1,+1,+1}, - {+1,+1,-1, -1,+1,-1}, - {+1,+1,+1, -1,+1,+1}, - {+1,+1,+1, +1,-1,+1}, - {-1,+1,+1, -1,-1,+1}, - {-1,+1,+1, -1,+1,-1}, - {-1,-1,+1, +1,-1,+1} }; - - for(i=0;i<12;i++){ - vektor1[0] = cubematrix[i][0]*size[0]/2; - vektor1[1] = cubematrix[i][1]*size[1]/2; - vektor1[2] = cubematrix[i][2]*size[2]/2; - - vektor2[0] = cubematrix[i][3]*size[0]/2; - vektor2[1] = cubematrix[i][4]*size[1]/2; - vektor2[2] = cubematrix[i][5]*size[2]/2; - - rotate3d(vektor1,rotate); - rotate3d(vektor2,rotate); - - - ced_line_ID(position[0]+vektor1[0], position[1]+vektor1[1], position[2]+vektor1[2], - position[0]+vektor2[0], position[1]+vektor2[1], position[2]+vektor2[2], - layer, 1,color, lcio_id); - } -} - -void ced_geobox_ID(double *size, double *position, unsigned int layer, unsigned int color, unsigned int lcio_id) { - double rotate[3]={0.0, 0.0, 0.0}; - ced_geobox_r_ID(size, position, rotate, layer, color, lcio_id); -} - - -void ced_geoboxes(unsigned int nBox, CED_GeoBox * allBoxes ) { - - CED_GeoBox * box; - unsigned int iBox; - for ( iBox = 0; iBox < nBox ; iBox++ ) { - box = (CED_GeoBox *) ced_add(GEOB_ID); - if ( ! box ) return; - memcpy( box, allBoxes + iBox, sizeof(CED_GeoBox) ); - } -} - -static unsigned GEOBR_ID=0; - -void ced_geobox_r(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer) { - int iDim; - CED_GeoBoxR * box = (CED_GeoBoxR*) ced_add(GEOBR_ID); - if ( ! box ) return; - for ( iDim = 0; iDim < 3; iDim ++ ) { - box->sizes[iDim] = sizes[iDim]; - box->center[iDim] = center[iDim]; - box->rotate[iDim] = rotate[iDim]; - } - box->color = color; - - if(layer > 255){ //downward compability - box->layer=layer >> CED_LAYER_SHIFT; - }else{ - box->layer=layer; - } - -// box->layer = layer; -} - -static unsigned GEOBRS_ID=0; - -void ced_geobox_r_solid(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer) { - int iDim; - CED_GeoBoxR * box = (CED_GeoBoxR*) ced_add(GEOBRS_ID); - if ( ! box ) return; - for ( iDim = 0; iDim < 3; iDim ++ ) { - box->sizes[iDim] = sizes[iDim]; - box->center[iDim] = center[iDim]; - box->rotate[iDim] = rotate[iDim]; - } - box->color = color; - - if(layer > 255){ //downward compability - box->layer=layer >> CED_LAYER_SHIFT; - }else{ - box->layer=layer; - } - -// box->layer = layer; -} - -static unsigned LEGEND_ID=0; - -void ced_legend(float ene_min, float ene_max, unsigned int color_steps, unsigned int ** rgb_matrix, unsigned int ticks, char scale) { - CED_Legend * legend = (CED_Legend*) ced_add(LEGEND_ID); - if ( ! legend ) return; - - legend->ene_min = ene_min; - legend->ene_max = ene_max; - legend->color_steps = color_steps; - legend->ticks = ticks; - legend->scale = scale; - - const unsigned int numberOfColours = 3; - unsigned int i,j; - for (i = 0; i < numberOfColours; i ++ ) { - for (j = 0; j < color_steps; j ++ ) { - legend->rgb_matrix[j][i] = rgb_matrix[j][i]; - } - } -} -//hauke -static unsigned TEXT_ID=0; - -void ced_describe_layer(const char *message, int id) { - //printf("ced_describe layer id=%i text: %s\n", id, message); - - if(id >= CED_MAX_LAYER){ - printf("WARNING: ced_describe_layer: Index out of range!\n"); - return; - } - - CED_TEXT *text = (CED_TEXT*) ced_add(TEXT_ID); - if(!text){ - printf("WARNING: ced_describe_layer: cant register CED_TEXT"); - return; - } - - strncpy(text->text,message,CED_MAX_LAYER_CHAR-1); - text->text[CED_MAX_LAYER_CHAR-1] = 0; - text->id=id; - - //text->x=xCordinate; - //text->y=yCordinate; -} - -/* -static unsigned LAYER_TEXT_ID=0; - -void ced_layer_text(char *message, int id) { - LAYER_TEXT *obj = (LAYER_TEXT*) ced_add(LAYER_TEXT_ID); - if (!obj){ - printf("ced_layer_text FAILED\n"); - return; - } - strncpy(obj->str,message,CED_MAX_LAYER_CHAR-1); - obj->id=id; - //printf("ced_layer_text\n"); -} -*/ - -static unsigned PICKING_TEXT_ID=0; - -void ced_picking_text(const char *message, int id) { - CED_PICKING_TEXT *text = (CED_PICKING_TEXT*) ced_add(PICKING_TEXT_ID); - if(!text){ - printf("WARNING: ced_picking_text: cant register CED_PICKING_TEXT"); - return; - } - - strncpy(text->text,message,999); - text->id=id; - //text->text[CED_MAX_LAYER_CHAR-1] = 0; - //text->id=id; - //text->x=xCordinate; - //text->y=yCordinate; -} -//end hauke - -static unsigned CONER_ID=0; - -void ced_cone_r(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor) { - ced_cone_r_ID(base,height,center,rotate,layer, RGBAcolor, 0); -} - -void ced_cone_r_ID(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor, int lcioid) { - CED_ConeR * cone = (CED_ConeR*) ced_add(CONER_ID); - if ( ! cone ) return; - - cone->base = base; - cone->height = height; - - if(layer > 255){ //downward compability - cone->layer=layer >> CED_LAYER_SHIFT; - }else{ - cone->layer=layer; - } - -// cone->layer = layer; - cone->lcioid = lcioid; - - const unsigned int dim = 3; - const unsigned int channel = 4; - unsigned int i, j; - - // ced_line_ID(0,0,0, center[0], center[1], center[2], type, width, RGBAcolor, lcioid); - - //ced_line_ID(center[0], center[1], center[2], rotate[0], rotate[1], rotate[2], layer, 1, RGBAcolor, lcioid); - //printf("CONE: from %f %f %f to %f %f %f\n", center[0], center[1], center[2], rotate[0], rotate[1], rotate[2]); - - for (i = 0; i < dim; i ++ ) { - cone->center[i] = center[i]; - cone->rotate[i] = rotate[i]; - } - for (j = 0; j < channel; j ++ ) { - cone->RGBAcolor[j] = RGBAcolor[j]; - } -} - -static unsigned ELLIPSOID_ID=0; - -void ced_ellipsoid_r(double *size, double *center, double *rotate, unsigned int layer, int color) { - ced_ellipsoid_r_ID(size, center, rotate, layer, color, 0); -} - -void ced_ellipsoid_r_ID(double *size, double *center, double *rotate, unsigned int layer, int color, int lcioID) { - - CED_EllipsoidR * eli = (CED_EllipsoidR*) ced_add(ELLIPSOID_ID); - if ( ! eli ) return; - - const unsigned int dim = 3; - unsigned int i; - for (i = 0; i < dim; i ++ ) { - eli->center[i] = center[i]; - eli->rotate[i] = rotate[i]; - eli->size[i] = size[i]; - } - eli->color = color; - - if(layer > 255){ //downward compability - eli->layer=layer >> CED_LAYER_SHIFT; - }else{ - eli->layer=layer; - } - -// eli->layer = layer; - eli->lcioid = lcioID; -} - -static unsigned CLUELLIPSE_ID=0; - -void ced_cluellipse_r(float radius, float height, float *center, double *rotate, unsigned int layer, int color) { - ced_cluellipse_r_ID(radius, height, center, rotate, layer, color, 0); -} - -void ced_cluellipse_r_ID(float radius, float height, float *center, double *rotate, unsigned int layer, int color, int lcioid) { //hauke - - CED_CluEllipseR * eli = (CED_CluEllipseR*) ced_add(CLUELLIPSE_ID); - if ( ! eli ) return; - - const unsigned int dim = 3; - unsigned int i; - for (i = 0; i < dim; i ++ ) { - eli->center[i] = center[i]; - eli->rotate[i] = rotate[i]; - } - eli->radius = radius; - eli->height = height; - - if(layer > 255){ //downward compability - eli->layer=layer >> CED_LAYER_SHIFT; - }else{ - eli->layer=layer; - } - -// eli->layer = layer; - eli->color = color; - eli->lcioid=lcioid; -} - - -void ced_register_elements(void){ - - //1: - GEOC_ID =ced_register_element(sizeof(CED_GeoCylinder),0); - //2: - GEOCR_ID =ced_register_element(sizeof(CED_GeoCylinderR), 0); - //3: - LINE_ID =ced_register_element(sizeof(CED_Line),0); - //4: - HIT_ID =ced_register_element(sizeof(CED_Hit),0); - //5: - GEOB_ID =ced_register_element(sizeof(CED_GeoBox), 0); - //6: - GEOBR_ID =ced_register_element(sizeof(CED_GeoBoxR), 0); - //7: - GEOBRS_ID =ced_register_element(sizeof(CED_GeoBoxR), 0); - //8: - CONER_ID =ced_register_element(sizeof(CED_ConeR), 0); - //9: - ELLIPSOID_ID =ced_register_element(sizeof(CED_EllipsoidR), 0); - //10: - CLUELLIPSE_ID =ced_register_element(sizeof(CED_CluEllipseR), 0); - //11: - TEXT_ID =ced_register_element(sizeof(CED_TEXT),0); //hauke: the order of this items is important - //12: - LEGEND_ID =ced_register_element(sizeof(CED_Legend), 0); - //13: - GEOT_ID =ced_register_element(sizeof(CED_GeoTube),0); - //14: - PICKING_TEXT_ID =ced_register_element(sizeof(CED_PICKING_TEXT),0); -} - diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.h b/Reconstruction/PFA/Pandora/CED/CED/ced_cli.h deleted file mode 100644 index a92164b0..00000000 --- a/Reconstruction/PFA/Pandora/CED/CED/ced_cli.h +++ /dev/null @@ -1,432 +0,0 @@ -/* "C" event display. - * Enduser accessable API. - * - * Alexey Zhelezov, DESY/ITEP, 2005 - */ - -#ifndef __CED_CLI_H -#define __CED_CLI_H - -#include <ced_config.h> - - -//important: -// - sum of all layers must be smaler than max_layer! -// - number_popup_layer must be smaler than number_data_layer - -//#define CED_MAX_LAYER 100 -//#define NUMBER_POPUP_LAYER 20 -//#define NUMBER_DATA_LAYER 25 -//#define NUMBER_DETECTOR_LAYER 20 -// -// -//#define CED_MAX_LAYER_CHAR 400 - - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This is the first function to call (before any other). - * - * host - host with CED (must be "localhost") - * port - server port number (let say 7285 :) - * - * NOTE: ced_register_elements() must be called - * separately. - */ -void ced_client_init(const char *host,unsigned short port); - -/* - * Cancel current event output. So, all elements - * queued will be discarded. - * - * Good to call at the begining of every event processing. - */ -void ced_new_event(void); - - -/* - * This function really attempt to display event in CED. - * When CED is not available, this function discard - * current event information. - * - * NOTE: between ced_new_event() and ced_draw_event() - * must be some element creation calls. - */ -void ced_draw_event(void); - -/* - * This function really attempt to display event in CED. - * Unlike ced_draw_event() does not reset the event. - * - * NOTE: between ced_new_event() and ced_draw_event() - * must be some element creation calls. - */ -void ced_send_event(void); - -int ced_selected_id(void); - -//hauke -int ced_selected_id_noblock(void); - - -/********************************************* - * - * The following is elements API. - * - *********************************************/ - -void ced_register_elements(void); - -typedef enum { - CED_TYPE_SHIFT=0x0, - CED_LAYER_SHIFT=0x8 -} CED_TYPE_BITS; - -/* -typedef enum { - CED_TYPE_SHIFT=0x0, - CED_LAYER_SHIFT=0x0 -} CED_TYPE_BITS; -*/ - - -typedef struct { - float x; - float y; - float z; -} CED_Point; - -//class CED_Point{ -// public: -// CED_Point(float _x, float _y, float _z){ -// x=_x; -// y=_y; -// z=_z; -// } -// -// CED_Point(void){ -// } -// float x; -// float y; -// float z; -//}; - - -/* - * Hit element - */ - -typedef enum { - CED_HIT_POINT=0, - CED_HIT_CROSS, - CED_HIT_STAR, - CED_HIT_BOX, - CED_HIT_VXD -} CED_HIT_TYPE; - -typedef struct { - CED_Point p; - unsigned type; // point, star, etc - unsigned layer; //layer - unsigned color; // in ARGB form (so, 0xff0000 is RED) - unsigned size; // size of point/size of cross - unsigned lcioID; // unique id of LICO object -} CED_Hit; - -void ced_hit(float x,float y,float z,unsigned type,unsigned size,unsigned color); - -//to give a bit of downward compatibility -void ced_hit_ID_old(float x,float y,float z,unsigned type, unsigned size,unsigned color, unsigned lcioID); - - -void ced_hit_ID(float x,float y,float z,unsigned type,unsigned layer, unsigned size,unsigned color, unsigned lcioID); - -/* - * Line element - */ - -typedef struct { - CED_Point p0; - CED_Point p1; - unsigned type; // not yet defined... - unsigned width; // not yet defined... - unsigned color; // in ARGB form (so, 0xff0000 is RED) - unsigned lcioID; // unique id of LICO object - -} CED_Line; - -void ced_line(float x0,float y0,float z0, - float x1,float y1,float z1, - unsigned type,unsigned width,unsigned color); -void ced_line_ID(float x0,float y0,float z0, - float x1,float y1,float z1, - unsigned type,unsigned width,unsigned color, unsigned lcioID); - -/* - * GeoCylinder - */ -typedef struct { - float d; // radius - unsigned sides; // poligon order - float rotate; // angle degree - float z; // 1/2 length - float shift; // in z - unsigned color; -} CED_GeoCylinder; - -/* - * GeoTube - */ -typedef struct { - float r_o; // outer radius - float r_i; // inner radius - unsigned edges_o; // edges outer - unsigned edges_i; // edges inner - float rotate_o; // angle degree, rotate outer cylinder - float rotate_i; //rotate inner cylinder - float z; // 1/2 length - float shift; // shift in z - unsigned color; // color - unsigned type; //describes the layer where this element lies - bool classic_inner; //draw the outer detector lines in classic view? - bool classic_outer; //draw the inner detector lines in classic view? -} CED_GeoTube; - - -/** Same as CED_GeoTube but here as C++ struct with contstructor. This is allows - * to dynamically allocate the detector structure (in an std::vector using the constructor) - * without knowing the exact number of detector elements a priori (such as the #layers in the FTD). - * This wasn't poassible with the static allocation using the C type struct. - * ( Used in MArlinCED::drawGearDetector ). - */ -struct CEDGeoTube{ - CEDGeoTube(double r_out, - double r_in, - int edges_out, - int edges_in, - double rotate_out, - double rotate_in, - double zlength, - double zshift, - int col, - int layer, - bool classic_i, - bool classic_o ) : - r_o(r_out), - r_i(r_in), - edges_o(edges_out), - edges_i (edges_in), - rotate_o (rotate_out), - rotate_i (rotate_in), - z( zlength), - shift (zshift), - color (col), - type(layer), - classic_inner(classic_i), - classic_outer(classic_o) {} - float r_o; // outer radius - float r_i; // inner radius - unsigned edges_o; // edges outer - unsigned edges_i; // edges inner - float rotate_o; // angle degree, rotate outer cylinder - float rotate_i; //rotate inner cylinder - float z; // 1/2 length - float shift; // shift in z - unsigned color; // color - unsigned type; //describes the layer where this element lies - bool classic_inner; //draw the outer detector lines in classic view? - bool classic_outer; //draw the inner detector lines in classic view? -} ; - -void ced_geotubes(unsigned n,CED_GeoTube *all); - - -void ced_geocylinder(float d,unsigned sides,float rotate,float z,float shift, - unsigned color); - -void ced_geocylinders(unsigned n,CED_GeoCylinder *all); - -/* - * GeoCylinder rotatable - * @author: S.Daraszewicz (UoE) - * @date: 01.09.09 - */ -typedef struct { - float d; // radius - unsigned sides; // poligon order - float center[3]; // cylinder centre z,y,z - float rotate[3]; // rotation angles wrt x,y,z axis - float z; // length - unsigned color; // colour - unsigned layer; // layer the Cylinder to be displayed onto -} CED_GeoCylinderR; - - -void ced_geocylinder_r(float d, double z, double * center, double * rotate, unsigned sides, - unsigned int color, int layer); - - - /** GeoBox structure - */ - typedef struct { - /** The three box sizes in mm */ - double sizes[3]; - /** position of the center of the box*/ - double center[3]; - /** box color */ - unsigned int color; - } CED_GeoBox; - - /** Send/Draw a box at position center (x,y,z in mm) with lengths along the - * axes specified in sizes. - * - * @author A.Bulgheroni, INFN - */ - void ced_geobox(double * sizes, double * center, unsigned int color ); - void ced_geobox_ID(double *size, double *position, unsigned int layer, unsigned int color, unsigned int lcio_id); - void ced_geobox_r_ID(double *size, double *position, double *rotate, unsigned int layer, unsigned int color, unsigned int lcio_id); - void rotate3d(double *vektor, double *rotate); - - - - /* - * @author A.Bulgheroni, INFN - */ - void ced_geoboxes( unsigned int nBox, CED_GeoBox * allBoxes); - - typedef struct { - /** The three box sizes in mm */ - double sizes[3]; - /** position of the center of the box*/ - double center[3]; - /** box color */ - unsigned int color; - /** rotation angle in degrees */ - double rotate[3]; - /** layer for toggling display */ - unsigned int layer; - } CED_GeoBoxR; - -void ced_geobox_r(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer); -void ced_geobox_r_solid(double * sizes, double * center, double * rotate, unsigned int color, unsigned int layer); - -//hauke - typedef struct{ - char text[1000]; - int id; - } CED_PICKING_TEXT; - -void ced_picking_text(const char *, int number); - -//-------- - - typedef struct{ - char text[400]; - int id; - } CED_TEXT; - - -void ced_describe_layer(const char *, int); //, int, int); - - - typedef struct{ - char str[400]; - unsigned int id; - } LAYER_TEXT; - -void ced_layer_text(char *, int); -//end hauke - - -/* - * Energy spectrum colour map legend. - * @author: S.Daraszewicz (UoE) - * @date: 01.09.09 - */ - typedef struct { - /** min energy on the legend */ - float ene_max; - /** max energy on the legend */ - float ene_min; - /** number of ticks on the legend */ - unsigned int ticks; - /** spectrum colour steps */ - unsigned int color_steps; - /** spectrum colour matrix */ - unsigned int rgb_matrix[512][3]; //FIX ME: 512 size not changed with color_steps - /** LOG or LIN */ - char scale; - } CED_Legend; - -void ced_legend(float ene_min, float ene_max, unsigned int color_steps, unsigned int ** rgb_matrix, unsigned int ticks, char scale); - - typedef struct { - /** position of the centre of the base */ - double center[3]; - /** rotation matrix */ - double rotate[3]; - /** layer for toggling display */ - unsigned int layer; - /** base radius */ - float base; - /** height */ - float height; - /** RGBA color */ - float RGBAcolor[4]; - unsigned lcioid; //hauke - } CED_ConeR; - - -void ced_cone_r(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor); -void ced_cone_r_ID(float base, float height, double *center, double *rotate, unsigned int layer, float *RGBAcolor, int lcioid); //hauke - - - typedef struct { - /** position of the centre of the base */ - double center[3]; - /** rotation matrix */ - double rotate[3]; - /** layer for toggling display */ - unsigned int layer; - /** xyz size */ - double size[3]; - /** RGBA color */ - int color; - unsigned lcioid; //hauke - } CED_EllipsoidR; - - -void ced_ellipsoid_r(double *size, double *center, double *rotate, unsigned int layer, int color); -void ced_ellipsoid_r_ID(double *size, double *center, double *rotate, unsigned int layer, int color, int lcioid); //hauke - - - typedef struct { - /** position of the centre of the base */ - double center[3]; - /** rotation matrix */ - double rotate[3]; - /** layer for toggling display */ - unsigned int layer; - /** base radius */ - float radius; - /** half height */ - float height; - /** RGBA color */ - int color; - unsigned lcioid; //hauke - } CED_CluEllipseR; - - -void ced_cluellipse_r(float radius, float height, float *center, double *rotate, unsigned int layer, int color); -void ced_cluellipse_r_ID(float radius, float height, float *center, double *rotate, unsigned int layer, int color, int lcioid); //hauke - - -#ifdef __cplusplus - } -#endif - - -#endif /* __CED_CLI_H */ diff --git a/Reconstruction/PFA/Pandora/CED/CED/ced_config.h b/Reconstruction/PFA/Pandora/CED/CED/ced_config.h deleted file mode 100644 index 66214ead..00000000 --- a/Reconstruction/PFA/Pandora/CED/CED/ced_config.h +++ /dev/null @@ -1,204 +0,0 @@ -/********************************************************** -* ced_config.h, CED config file * -* Hauke Hoelbe, DESY, 2011 * -* Headerfile to adapt CED before the build. * -**********************************************************/ - -#ifndef __CED_CONFIG -#define __CED_CONFIG - -#include "ced_cli.h" - - -/********************************************************** -* Handling * -**********************************************************/ -//enable zoom function by right click and pull -#define ZOOM_RIGHT_CLICK 0 - -//time when 2 clicks should be a double click, in 1/1000000 secounds -#define DOUBLE_CLICK_TIME 300000 - -//data layer keys -#define DATALAYER_SHORTKEY_00 '0' -#define DATALAYER_SHORTKEY_01 '1' -#define DATALAYER_SHORTKEY_02 '2' -#define DATALAYER_SHORTKEY_03 '3' -#define DATALAYER_SHORTKEY_04 '4' -#define DATALAYER_SHORTKEY_05 '5' -#define DATALAYER_SHORTKEY_06 '6' -#define DATALAYER_SHORTKEY_07 '7' -#define DATALAYER_SHORTKEY_08 '8' -#define DATALAYER_SHORTKEY_09 '9' -#define DATALAYER_SHORTKEY_10 ')' -#define DATALAYER_SHORTKEY_11 '!' -#define DATALAYER_SHORTKEY_12 '@' -#define DATALAYER_SHORTKEY_13 '#' -#define DATALAYER_SHORTKEY_14 '$' -#define DATALAYER_SHORTKEY_15 '%' -#define DATALAYER_SHORTKEY_16 '^' -#define DATALAYER_SHORTKEY_17 '&' -#define DATALAYER_SHORTKEY_18 '*' -#define DATALAYER_SHORTKEY_19 '(' -#define DATALAYER_SHORTKEY_20 't' -#define DATALAYER_SHORTKEY_21 'y' -#define DATALAYER_SHORTKEY_22 'u' -#define DATALAYER_SHORTKEY_23 'i' -#define DATALAYER_SHORTKEY_24 'o' - -//detector layer keys -#define DETECTORLAYER_SHORTKEY_00 'j' -#define DETECTORLAYER_SHORTKEY_01 'k' -#define DETECTORLAYER_SHORTKEY_02 'l' -#define DETECTORLAYER_SHORTKEY_03 ';' -#define DETECTORLAYER_SHORTKEY_04 '\'' -#define DETECTORLAYER_SHORTKEY_05 'p' -#define DETECTORLAYER_SHORTKEY_06 '[' -#define DETECTORLAYER_SHORTKEY_07 ']' -#define DETECTORLAYER_SHORTKEY_08 '\\' -#define DETECTORLAYER_SHORTKEY_09 'T' -#define DETECTORLAYER_SHORTKEY_10 'Y' -#define DETECTORLAYER_SHORTKEY_11 'U' -#define DETECTORLAYER_SHORTKEY_12 'I' -#define DETECTORLAYER_SHORTKEY_13 'O' -#define DETECTORLAYER_SHORTKEY_14 'P' -#define DETECTORLAYER_SHORTKEY_15 '{' -#define DETECTORLAYER_SHORTKEY_16 '}' -#define DETECTORLAYER_SHORTKEY_17 '|' -#define DETECTORLAYER_SHORTKEY_18 'a' -#define DETECTORLAYER_SHORTKEY_19 'e' - - -/********************************************************** -* Colors and appearance * -**********************************************************/ -//size of the boarder line in filled (new view) of detector components. -#define CED_GEOTUBE_LINE_WIDTH 0.3 - -//maximal transparency of boarder lines -//#define CED_GEOTUBE_LINE_MAX_TRANS 0.2 -#define CED_GEOTUBE_LINE_MAX_TRANS 1.0 - - -//names and values of color apairs in popup menu -#define CED_BGCOLOR_OPTION1_NAME "Gainsboro" -#define CED_BGCOLOR_OPTION1_COLORCODE 0.862745,0.862745,0.862745,0 - -#define CED_BGCOLOR_OPTION2_NAME "Lightgrey" -#define CED_BGCOLOR_OPTION2_COLORCODE 0.827451,0.827451,0.827451,0 - -#define CED_BGCOLOR_OPTION3_NAME "Darkgray" -#define CED_BGCOLOR_OPTION3_COLORCODE 0.662745,0.662745,0.662745,0 - -#define CED_BGCOLOR_OPTION4_NAME "Gray" -#define CED_BGCOLOR_OPTION4_COLORCODE 0.501961,0.501961,0.501961,0 - -#define CED_BGCOLOR_OPTION5_NAME "Silver" -#define CED_BGCOLOR_OPTION5_COLORCODE 0.7529,0.7529,0.7529,0 - -#define CED_BGCOLOR_OPTION6_NAME "Dimgray" -#define CED_BGCOLOR_OPTION6_COLORCODE 0.4118,0.4118,0.4118,0 - -#define CED_BGCOLOR_OPTION7_NAME "Lightsteelblue" -#define CED_BGCOLOR_OPTION7_COLORCODE 0.6902,0.7686 ,0.8706,0 - -#define CED_BGCOLOR_OPTION8_NAME "Steelblue" -#define CED_BGCOLOR_OPTION8_COLORCODE 0.2745,0.5098,0.70588,0 - -#define CED_BGCOLOR_OPTION9_NAME "Seagreen" -#define CED_BGCOLOR_OPTION9_COLORCODE 0.18039,0.54509,0.34117,0 - -#define CED_BGCOLOR_OPTION10_NAME "Orange" -#define CED_BGCOLOR_OPTION10_COLORCODE 1,0.647,0,0 - -#define CED_BGCOLOR_OPTION11_NAME "Yellow" -#define CED_BGCOLOR_OPTION11_COLORCODE 1,1,0,0 - -#define CED_BGCOLOR_OPTION12_NAME "Violett" -#define CED_BGCOLOR_OPTION12_COLORCODE 0.9333,0.5098,0.9333,0 - -#define CED_BGCOLOR_OPTION13_NAME "Black" -#define CED_BGCOLOR_OPTION13_COLORCODE 0,0,0,0 - -#define CED_BGCOLOR_OPTION14_NAME "Blue" -#define CED_BGCOLOR_OPTION14_COLORCODE 0,0.2,0.4,0 - -#define CED_BGCOLOR_OPTION15_NAME "White" -#define CED_BGCOLOR_OPTION15_COLORCODE 1,1,1,0 - - - - -//Color of xyz axes -#define AXES_COLOR 0.2,0.2,0.8 - -//Width of xyz axes -#define AXES_LINE_SIZE 0.5 - - -//Help frame: Frame fill color, and transp -#define HELP_FRAME_FILL_COLOR 0.5,1,1,0.8 - -//Help frame: Frame boarder color and transp -#define HELP_FRAME_BOARDER_COLOR 0.1,0.8,1.0,0.8 - -//Help frame: Frame boarder line width -#define HELP_FRAME_BOARDER_LINE_SIZE 3. - -//Help frame: Text color, and transp -#define HELP_FRAME_TEXT_COLOR 0.0,0.0,0.0 - - - - -/********************************************************** -* Layers * -**********************************************************/ -//number of total number of layers -#define CED_MAX_LAYER 100 - -//number of layers shown in popup menu -#define NUMBER_POPUP_LAYER 20 - -//number of layers reserved for data -#define NUMBER_DATA_LAYER 25 - -//number of layers reserved for detector components -#define NUMBER_DETECTOR_LAYER 20 - -//layer description text: maximal number of chars for one entry -#define CED_MAX_LAYER_CHAR 400 - -/********************************************************** -* Graphics * -**********************************************************/ - -//Camera field of view, in degree -#define CAMERA_FIELD_OF_VIEW 45 - -//Camera min distance (hint: min and max should be close together) -#define CAMERA_MIN_DISTANCE 100 - -//Camera max distance (hint: min and max should be close together) -#define CAMERA_MAX_DISTANCE 50000.0*mm.sf+50000/mm.sf - -//Where the camera stands -#define CAMERA_POSITION 0,0,2000 - - - -//Fisheye alpha factor -#define FISHEYE_ALPHA 1e-3 -#define FISHEYE_ZOOM 8. - -/********************************************************** -* Debug * -**********************************************************/ - -//show pickable points: -//#define DEBUG_PICKING 1 - - - - -#endif diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt index 46344f83..69a1ec90 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt +++ b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt @@ -1,11 +1,6 @@ gaudi_subdir(GaudiPandora v0r0) find_package(CLHEP REQUIRED) -#find_package(GSL REQUIRED )##don't use this, use CEPC LCIO version one , due to the ClusterShape.cc file which is from LCIO -#message("GSL: ${GSL_LIBRARIES} ") -set (gsl_include "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/include") -set (gsl_lib1 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgsl.so") -set (gsl_lib2 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgslcblas.so") find_package(LCIO REQUIRED ) find_package(GEAR REQUIRED) message("ENV GEAR: $ENV{GEAR}") @@ -25,13 +20,11 @@ link_libraries(${LCContent_LIBRARIES}) list(APPEND CMAKE_MODULE_PATH "$ENV{ROOTSYS}/etc/cmake/") find_package(ROOT 5.26.00 REQUIRED COMPONENTS Eve Geom RGL EG) -#In order to use ClusterShape.cc -include_directories("../CED/CED/") -include_directories("../MarlinUtil/01-08/source/") gaudi_depends_on_subdirs( Service/EventSeeder Service/GearSvc + Utilities/DataHelper ) set(dir_srcs @@ -41,14 +34,12 @@ set(dir_srcs src/CaloHitCreator.cpp src/TrackCreator.cpp src/PfoCreator.cpp - ../CED/CED/*.cc - ../MarlinUtil/01-08/source/*.cc ) set(dir_include include) # Modules gaudi_add_module(GaudiPandora ${dir_srcs} - INCLUDE_DIRS ${gsl_include} ${dir_include} GaudiKernel FWCore CLHEP ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear - LINK_LIBRARIES ${gsl_lib1} ${gsl_lib2} GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so + INCLUDE_DIRS ${dir_include} GaudiKernel FWCore CLHEP ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear + LINK_LIBRARIES GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so DataHelperLib -Wl,--no-as-needed EDM4HEP::edm4hep EDM4HEP::edm4hepDict -Wl,--as-needed diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h index 7619cd9f..5b8942ce 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h @@ -20,7 +20,7 @@ #include "edm4hep/CalorimeterHitCollection.h" #include "edm4hep/CalorimeterHit.h" -#include "ClusterShapes.h" +#include "DataHelper/ClusterShapes.h" #include "Api/PandoraApi.h" class CollectionMaps; diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.cc b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.cc deleted file mode 100644 index 6582e17e..00000000 --- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.cc +++ /dev/null @@ -1,768 +0,0 @@ -#include "HelixClass.h" -#include <math.h> -#include <stdlib.h> -#include <iostream> -#include "ced_cli.h" - -HelixClass::HelixClass() { - _const_2pi = 2.0*M_PI; - _const_pi2 = 0.5*M_PI; - _FCT = 2.99792458E-4; -} - -HelixClass::~HelixClass() {} - -void HelixClass::Initialize_VP(float * pos, float * mom, float q, float B) { - _referencePoint[0] = pos[0]; - _referencePoint[1] = pos[1]; - _referencePoint[2] = pos[2]; - _momentum[0] = mom[0]; - _momentum[1] = mom[1]; - _momentum[2] = mom[2]; - _charge = q; - _bField = B; - _pxy = sqrt(mom[0]*mom[0]+mom[1]*mom[1]); - _radius = _pxy / (_FCT*B); - _omega = q/_radius; - _tanLambda = mom[2]/_pxy; - _phiMomRefPoint = atan2(mom[1],mom[0]); - _xCentre = pos[0] + _radius*cos(_phiMomRefPoint-_const_pi2*q); - _yCentre = pos[1] + _radius*sin(_phiMomRefPoint-_const_pi2*q); - _phiRefPoint = atan2(pos[1]-_yCentre,pos[0]-_xCentre); - _phiAtPCA = atan2(-_yCentre,-_xCentre); - _phi0 = -_const_pi2*q + _phiAtPCA; - while (_phi0<0) _phi0+=_const_2pi; - while (_phi0>=_const_2pi) _phi0-=_const_2pi; - _xAtPCA = _xCentre + _radius*cos(_phiAtPCA); - _yAtPCA = _yCentre + _radius*sin(_phiAtPCA); - // _d0 = -_xAtPCA*sin(_phi0) + _yAtPCA*cos(_phi0); - double pxy = double(_pxy); - double radius = pxy/double(_FCT*B); - double xCentre = double(pos[0]) + radius*double(cos(_phiMomRefPoint-_const_pi2*q)); - double yCentre = double(pos[1]) + radius*double(sin(_phiMomRefPoint-_const_pi2*q)); - - double d0; - - if (q>0) { - d0 = double(q)*radius - double(sqrt(xCentre*xCentre+yCentre*yCentre)); - } - else { - d0 = double(q)*radius + double(sqrt(xCentre*xCentre+yCentre*yCentre)); - } - - _d0 = float(d0); - -// if (fabs(_d0)>0.001 ) { -// std::cout << "New helix : " << std::endl; -// std::cout << " Position : " << pos[0] -// << " " << pos[1] -// << " " << pos[2] << std::endl; -// std::cout << " Radius = " << _radius << std::endl; -// std::cout << " RC = " << sqrt(_xCentre*_xCentre+_yCentre*_yCentre) << std::endl; -// std::cout << " D0 = " << _d0 << std::endl; -// } - - _pxAtPCA = _pxy*cos(_phi0); - _pyAtPCA = _pxy*sin(_phi0); - float deltaPhi = _phiRefPoint - _phiAtPCA; - float xCircles = -pos[2]*q/(_radius*_tanLambda) - deltaPhi; - xCircles = xCircles/_const_2pi; - int nCircles; - int n1,n2; - - if (xCircles >= 0.) { - n1 = int(xCircles); - n2 = n1 + 1; - } - else { - n1 = int(xCircles) - 1; - n2 = n1 + 1; - } - - if (fabs(n1-xCircles) < fabs(n2-xCircles)) { - nCircles = n1; - } - else { - nCircles = n2; - } - _z0 = pos[2] + _radius*_tanLambda*q*(deltaPhi + _const_2pi*nCircles); - -} - -void HelixClass::Initialize_Canonical(float phi0, float d0, float z0, - float omega, float tanLambda, float B) { - _omega = omega; - _d0 = d0; - _phi0 = phi0; - _z0 = z0; - _tanLambda = tanLambda; - _charge = omega/fabs(omega); - _radius = 1./fabs(omega); - _xAtPCA = -_d0*sin(_phi0); - _yAtPCA = _d0*cos(_phi0); - _referencePoint[0] = _xAtPCA; - _referencePoint[1] = _yAtPCA; - _referencePoint[2] = _z0; - _pxy = _FCT*B*_radius; - _momentum[0] = _pxy*cos(_phi0); - _momentum[1] = _pxy*sin(_phi0); - _momentum[2] = _tanLambda * _pxy; - _pxAtPCA = _momentum[0]; - _pyAtPCA = _momentum[1]; - _phiMomRefPoint = atan2(_momentum[1],_momentum[0]); - _xCentre = _referencePoint[0] + - _radius*cos(_phi0-_const_pi2*_charge); - _yCentre = _referencePoint[1] + - _radius*sin(_phi0-_const_pi2*_charge); - _phiAtPCA = atan2(-_yCentre,-_xCentre); - _phiRefPoint = _phiAtPCA ; - _bField = B; -} - - -void HelixClass::Initialize_BZ(float xCentre, float yCentre, float radius, - float bZ, float phi0, float B, float signPz, - float zBegin) { - - _radius = radius; - _pxy = _FCT*B*_radius; - _charge = -(bZ*signPz)/fabs(bZ*signPz); - _momentum[2] = -_charge*_pxy/(bZ*_radius); - _xCentre = xCentre; - _yCentre = yCentre; - _omega = _charge/radius; - _phiAtPCA = atan2(-_yCentre,-_xCentre); - _phi0 = -_const_pi2*_charge + _phiAtPCA; - while (_phi0<0) _phi0+=_const_2pi; - while (_phi0>=_const_2pi) _phi0-=_const_2pi; - _xAtPCA = _xCentre + _radius*cos(_phiAtPCA); - _yAtPCA = _yCentre + _radius*sin(_phiAtPCA); - _d0 = -_xAtPCA*sin(_phi0) + _yAtPCA*cos(_phi0); - _pxAtPCA = _pxy*cos(_phi0); - _pyAtPCA = _pxy*sin(_phi0); - _referencePoint[2] = zBegin; - _referencePoint[0] = xCentre + radius*cos(bZ*zBegin+phi0); - _referencePoint[1] = yCentre + radius*sin(bZ*zBegin+phi0); - _phiRefPoint = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre); - _phiMomRefPoint = -_const_pi2*_charge + _phiRefPoint; - _tanLambda = _momentum[2]/_pxy; - _momentum[0] = _pxy*cos(_phiMomRefPoint); - _momentum[1] = _pxy*sin(_phiMomRefPoint); - - float deltaPhi = _phiRefPoint - _phiAtPCA; - float xCircles = bZ*_referencePoint[2] - deltaPhi; - xCircles = xCircles/_const_2pi; - int nCircles; - int n1,n2; - - if (xCircles >= 0.) { - n1 = int(xCircles); - n2 = n1 + 1; - } - else { - n1 = int(xCircles) - 1; - n2 = n1 + 1; - } - - if (fabs(n1-xCircles) < fabs(n2-xCircles)) { - nCircles = n1; - } - else { - nCircles = n2; - } - _z0 = _referencePoint[2] - (deltaPhi + _const_2pi*nCircles)/bZ; - _bField = B; - -} - -const float * HelixClass::getMomentum() { - return _momentum; -} -const float * HelixClass::getReferencePoint() { - return _referencePoint; -} -float HelixClass::getPhi0() { - if (_phi0<0.0) - _phi0 += 2*M_PI; - return _phi0; -} -float HelixClass::getD0() { - return _d0; -} -float HelixClass::getZ0() { - return _z0; -} -float HelixClass::getOmega() { - return _omega; -} -float HelixClass::getTanLambda() { - return _tanLambda; -} -float HelixClass::getPXY() { - return _pxy; -} -float HelixClass::getXC() { - return _xCentre; -} - -float HelixClass::getYC() { - return _yCentre; -} - -float HelixClass::getRadius() { - return _radius; -} - -float HelixClass::getBz() { - return _bZ; -} - -float HelixClass::getPhiZ() { - return _phiZ; -} - -float HelixClass::getCharge() { - return _charge; -} - -float HelixClass::getPointInXY(float x0, float y0, float ax, float ay, - float * ref , float * point) { - - float time; - - float AA = sqrt(ax*ax+ay*ay); - - - if (AA <= 0) { - time = -1.0e+20; - return time; - } - - - float BB = ax*(x0-_xCentre) + ay*(y0-_yCentre); - BB = BB / AA; - - float CC = (x0-_xCentre)*(x0-_xCentre) - + (y0-_yCentre)*(y0-_yCentre) - _radius*_radius; - - CC = CC / AA; - - float DET = BB*BB - CC; - float tt1 = 0.; - float tt2 = 0.; - float xx1,xx2,yy1,yy2; - - - if (DET < 0 ) { - time = 1.0e+10; - point[0]=0.0; - point[1]=0.0; - point[2]=0.0; - return time; - } - - - tt1 = - BB + sqrt(DET); - tt2 = - BB - sqrt(DET); - - xx1 = x0 + tt1*ax; - yy1 = y0 + tt1*ay; - xx2 = x0 + tt2*ax; - yy2 = y0 + tt2*ay; - - float phi1 = atan2(yy1-_yCentre,xx1-_xCentre); - float phi2 = atan2(yy2-_yCentre,xx2-_xCentre); - float phi0 = atan2(ref[1]-_yCentre,ref[0]-_xCentre); - - float dphi1 = phi1 - phi0; - float dphi2 = phi2 - phi0; - - if (dphi1 < 0 && _charge < 0) { - dphi1 = dphi1 + _const_2pi; - } - else if (dphi1 > 0 && _charge > 0) { - dphi1 = dphi1 - _const_2pi; - } - - if (dphi2 < 0 && _charge < 0) { - dphi2 = dphi2 + _const_2pi; - } - else if (dphi2 > 0 && _charge > 0) { - dphi2 = dphi2 - _const_2pi; - } - - // Times - tt1 = -_charge*dphi1*_radius/_pxy; - tt2 = -_charge*dphi2*_radius/_pxy; - - if (tt1 < 0. ) - std::cout << "WARNING " << tt1 << std::endl; - if (tt2 < 0. ) - std::cout << "WARNING " << tt2 << std::endl; - - - if (tt1 < tt2) { - point[0] = xx1; - point[1] = yy1; - time = tt1; - } - else { - point[0] = xx2; - point[1] = yy2; - time = tt2; - } - - point[2] = ref[2]+time*_momentum[2]; - - - - return time; - -} - - -float HelixClass::getPointOnCircle(float Radius, float * ref, float * point) { - - float distCenterToIP = sqrt(_xCentre*_xCentre + _yCentre*_yCentre); - - point[0] = 0.0; - point[1] = 0.0; - point[2] = 0.0; - - if ((distCenterToIP+_radius)<Radius) { - float xx = -1.0e+20; - return xx; - } - - if ((_radius+Radius)<distCenterToIP) { - float xx = -1.0e+20; - return xx; - } - - float phiCentre = atan2(_yCentre,_xCentre); - float phiStar = Radius*Radius + distCenterToIP*distCenterToIP - - _radius*_radius; - - phiStar = 0.5*phiStar/fmax(1.0e-20,Radius*distCenterToIP); - - if (phiStar > 1.0) - phiStar = 0.9999999; - - if (phiStar < -1.0) - phiStar = -0.9999999; - - phiStar = acos(phiStar); - - float tt1,tt2,time; - - float xx1 = Radius*cos(phiCentre+phiStar); - float yy1 = Radius*sin(phiCentre+phiStar); - - float xx2 = Radius*cos(phiCentre-phiStar); - float yy2 = Radius*sin(phiCentre-phiStar); - - - float phi1 = atan2(yy1-_yCentre,xx1-_xCentre); - float phi2 = atan2(yy2-_yCentre,xx2-_xCentre); - float phi0 = atan2(ref[1]-_yCentre,ref[0]-_xCentre); - - float dphi1 = phi1 - phi0; - float dphi2 = phi2 - phi0; - - if (dphi1 < 0 && _charge < 0) { - dphi1 = dphi1 + _const_2pi; - } - else if (dphi1 > 0 && _charge > 0) { - dphi1 = dphi1 - _const_2pi; - } - - if (dphi2 < 0 && _charge < 0) { - dphi2 = dphi2 + _const_2pi; - } - else if (dphi2 > 0 && _charge > 0) { - dphi2 = dphi2 - _const_2pi; - } - - // Times - tt1 = -_charge*dphi1*_radius/_pxy; - tt2 = -_charge*dphi2*_radius/_pxy; - - if (tt1 < 0. ) - std::cout << "WARNING " << tt1 << std::endl; - if (tt2 < 0. ) - std::cout << "WARNING " << tt2 << std::endl; - - - float time2; - if (tt1 < tt2) { - point[0] = xx1; - point[1] = yy1; - point[3] = xx2; - point[4] = yy2; - time = tt1; - time2 = tt2; - } - else { - point[0] = xx2; - point[1] = yy2; - point[3] = xx1; - point[4] = yy1; - time = tt2; - time2 = tt1; - } - - point[2] = ref[2]+time*_momentum[2]; - point[5] = ref[2]+time2*_momentum[2]; - - - return time; - -} - - -float HelixClass::getPointInZ(float zLine, float * ref, float * point) { - - float time = zLine - ref[2]; - - if (_momentum[2] == 0.) { - time = -1.0e+20; - point[0] = 0.; - point[1] = 0.; - point[2] = 0.; - return time; - } - - time = time/_momentum[2]; - - float phi0 = atan2(ref[1] - _yCentre , ref[0] - _xCentre); - float phi = phi0 - _charge*_pxy*time/_radius; - float xx = _xCentre + _radius*cos(phi); - float yy = _yCentre + _radius*sin(phi); - - point[0] = xx; - point[1] = yy; - point[2] = zLine; - - return time; - - -} - -float HelixClass::getDistanceToPoint(float * xPoint, float * Distance) { - - float zOnHelix; - float phi = atan2(xPoint[1]-_yCentre,xPoint[0]-_xCentre); - float phi0 = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre); - //calculate distance to XYprojected centre of Helix, comparing this with distance to radius around centre gives DistXY - float DistXY = (_xCentre-xPoint[0])*(_xCentre-xPoint[0]) + (_yCentre-xPoint[1])*(_yCentre-xPoint[1]); - DistXY = sqrt(DistXY); - DistXY = fabs(DistXY - _radius); - - int nCircles = 0; - - if (fabs(_tanLambda*_radius)>1.0e-20) { - float xCircles = phi0 - phi -_charge*(xPoint[2]-_referencePoint[2])/(_tanLambda*_radius); - xCircles = xCircles/_const_2pi; - int n1,n2; - - if (xCircles >= 0.) { - n1 = int(xCircles); - n2 = n1 + 1; - } - else { - n1 = int(xCircles) - 1; - n2 = n1 + 1; - } - - if (fabs(n1-xCircles) < fabs(n2-xCircles)) { - nCircles = n1; - } - else { - nCircles = n2; - } - - } - - float DPhi = _const_2pi*((float)nCircles) + phi - phi0; - - zOnHelix = _referencePoint[2] - _charge*_radius*_tanLambda*DPhi; - - float DistZ = fabs(zOnHelix - xPoint[2]); - float Time; - - if (fabs(_momentum[2]) > 1.0e-20) { - Time = (zOnHelix - _referencePoint[2])/_momentum[2]; - } - else { - Time = _charge*_radius*DPhi/_pxy; - } - - Distance[0] = DistXY; - Distance[1] = DistZ; - Distance[2] = sqrt(DistXY*DistXY+DistZ*DistZ); - - return Time; - - -} - -//When we are not interested in the exact distance, we can check if we are -//already far enough away in XY, before we start calculating in Z as the -//distance will only increase -float HelixClass::getDistanceToPoint(const std::vector<float>& xPoint, float distCut) { - //calculate distance to XYprojected centre of Helix, comparing this with distance to radius around centre gives DistXY - float tempx = xPoint[0]-_xCentre; - float tempy = xPoint[1]-_yCentre; - float tempsq = sqrt(tempx*tempx + tempy*tempy); - float tempdf = tempsq - _radius; - float DistXY = fabs( tempdf ); - //If this is bigger than distCut, we dont have to know how much bigger this is - if( DistXY > distCut) { - return DistXY; - } - - int nCircles = 0; - float phi = atan2(tempy,tempx); - float phi0 = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre); - float phidiff = phi0-phi; - float tempz = xPoint[2] - _referencePoint[2];//Yes referencePoint - float tanradius = _tanLambda*_radius; - if (fabs(tanradius)>1.0e-20) { - float xCircles = (phidiff -_charge*tempz/tanradius)/_const_2pi; - int n1,n2; - if (xCircles >= 0.) { - n1 = int(xCircles); - n2 = n1 + 1; - } - else { - n1 = int(xCircles) - 1; - n2 = n1 + 1; - } - if (fabs(n1-xCircles) < fabs(n2-xCircles)) { - nCircles = n1; - } - else { - nCircles = n2; - } - } - float DistZ = - tempz - _charge*tanradius*(_const_2pi*((float)nCircles) - phidiff); - return sqrt(DistXY*DistXY+DistZ*DistZ); -}//getDistanceToPoint(vector,float) - -float HelixClass::getDistanceToPoint(const float* xPoint, float distCut) { - std::vector<float> xPosition(xPoint, xPoint + 3 );//We are expecting three coordinates, must be +3, last element is excluded! - return getDistanceToPoint(xPosition, distCut); -}//getDistanceToPoint(float*,float) - - - -void HelixClass::setHelixEdges(float * xStart, float * xEnd) { - for (int i=0; i<3; ++i) { - _xStart[i] = xStart[i]; - _xEnd[i] = xEnd[i]; - } - -} - -float HelixClass::getDistanceToHelix(HelixClass * helix, float * pos, float * mom) { - - float x01 = getXC(); - float y01 = getYC(); - - float x02 = helix->getXC(); - float y02 = helix->getYC(); - - float rad1 = getRadius(); - float rad2 = helix->getRadius(); - - float distance = sqrt((x01-x02)*(x01-x02)+(y01-y02)*(y01-y02)); - - bool singlePoint = true; - - float phi1 = 0; - float phi2 = 0; - - if (rad1+rad2<distance) { - phi1 = atan2(y02-y01,x02-x01); - phi2 = atan2(y01-y02,x01-x02); - } - else if (distance+rad2<rad1) { - phi1 = atan2(y02-y01,x02-x01); - phi2 = phi1; - } - else if (distance+rad1<rad2) { - phi1 = atan2(y01-y02,x01-x02); - phi2 = phi1; - } - else { - singlePoint = false; - float cosAlpha = 0.5*(distance*distance+rad2*rad2-rad1*rad1)/(distance*rad2); - float alpha = acos(cosAlpha); - float phi0 = atan2(y01-y02,x01-x02); - phi1 = phi0 + alpha; - phi2 = phi0 - alpha; - } - - - float ref1[3]; - float ref2[3]; - for (int i=0;i<3;++i) { - ref1[i]=_referencePoint[i]; - ref2[i]=helix->getReferencePoint()[i]; - } - - float pos1[3]; - float pos2[3]; - float mom1[3]; - float mom2[3]; - - - if (singlePoint ) { - - float xSect1 = x01 + rad1*cos(phi1); - float ySect1 = y01 + rad1*sin(phi1); - float xSect2 = x02 + rad2*cos(phi2); - float ySect2 = y02 + rad2*sin(phi2); - float R1 = sqrt(xSect1*xSect1+ySect1*ySect1); - float R2 = sqrt(xSect2*xSect2+ySect2*ySect2); - - getPointOnCircle(R1,ref1,pos1); - helix->getPointOnCircle(R2,ref2,pos2); - - } - else { - - float xSect1 = x02 + rad2*cos(phi1); - float ySect1 = y02 + rad2*sin(phi1); - float xSect2 = x02 + rad2*cos(phi2); - float ySect2 = y02 + rad2*sin(phi2); - -// std::cout << "(xSect1,ySect1)=(" << xSect1 << "," << ySect1 << ")" << std::endl; -// std::cout << "(xSect2,ySect2)=(" << xSect2 << "," << ySect2 << ")" << std::endl; - - float temp21[3]; - float temp22[3]; - - float phiI2 = atan2(ref2[1]-y02,ref2[0]-x02); - float phiF21 = atan2(ySect1-y02,xSect1-x02); - float phiF22 = atan2(ySect2-y02,xSect2-x02); - float deltaPhi21 = phiF21 - phiI2; - float deltaPhi22 = phiF22 - phiI2; - float charge2 = helix->getCharge(); - float pxy2 = helix->getPXY(); - float pz2 = helix->getMomentum()[2]; - if (deltaPhi21 < 0 && charge2 < 0) { - deltaPhi21 += _const_2pi; - } - else if (deltaPhi21 > 0 && charge2 > 0) { - deltaPhi21 -= _const_2pi; - } - - if (deltaPhi22 < 0 && charge2 < 0) { - deltaPhi22 += _const_2pi; - } - else if (deltaPhi22 > 0 && charge2 > 0) { - deltaPhi22 -= _const_2pi; - } - - float time21 = -charge2*deltaPhi21*rad2/pxy2; - float time22 = -charge2*deltaPhi22*rad2/pxy2; - - float Z21 = ref2[2] + time21*pz2; - float Z22 = ref2[2] + time22*pz2; - - temp21[0] = xSect1; temp21[1] = ySect1; temp21[2] = Z21; - temp22[0] = xSect2; temp22[1] = ySect2; temp22[2] = Z22; - - -// std::cout << "temp21 = " << temp21[0] << " " << temp21[1] << " " << temp21[2] << std::endl; -// std::cout << "temp22 = " << temp22[0] << " " << temp22[1] << " " << temp22[2] << std::endl; - - - float temp11[3]; - float temp12[3]; - - float phiI1 = atan2(ref1[1]-y01,ref1[0]-x01); - float phiF11 = atan2(ySect1-y01,xSect1-x01); - float phiF12 = atan2(ySect2-y01,xSect2-x01); - float deltaPhi11 = phiF11 - phiI1; - float deltaPhi12 = phiF12 - phiI1; - float charge1 = _charge; - float pxy1 = _pxy; - float pz1 = _momentum[2]; - if (deltaPhi11 < 0 && charge1 < 0) { - deltaPhi11 += _const_2pi; - } - else if (deltaPhi11 > 0 && charge1 > 0) { - deltaPhi11 -= _const_2pi; - } - - if (deltaPhi12 < 0 && charge1 < 0) { - deltaPhi12 += _const_2pi; - } - else if (deltaPhi12 > 0 && charge1 > 0) { - deltaPhi12 -= _const_2pi; - } - - float time11 = -charge1*deltaPhi11*rad1/pxy1; - float time12 = -charge1*deltaPhi12*rad1/pxy1; - - float Z11 = ref1[2] + time11*pz1; - float Z12 = ref1[2] + time12*pz1; - - temp11[0] = xSect1; temp11[1] = ySect1; temp11[2] = Z11; - temp12[0] = xSect2; temp12[1] = ySect2; temp12[2] = Z12; - -// std::cout << "temp11 = " << temp11[0] << " " << temp11[1] << " " << temp11[2] << std::endl; -// std::cout << "temp12 = " << temp12[0] << " " << temp12[1] << " " << temp12[2] << std::endl; - - float Dist1 = 0; - float Dist2 = 0; - - for (int j=0;j<3;++j) { - Dist1 += (temp11[j]-temp21[j])*(temp11[j]-temp21[j]); - Dist2 += (temp12[j]-temp22[j])*(temp12[j]-temp22[j]); - } - - if (Dist1<Dist2) { - for (int l=0;l<3;++l) { - pos1[l] = temp11[l]; - pos2[l] = temp21[l]; - } - } - else { - for (int l=0;l<3;++l) { - pos1[l] = temp12[l]; - pos2[l] = temp22[l]; - } - } - - } - - getExtrapolatedMomentum(pos1,mom1); - helix->getExtrapolatedMomentum(pos2,mom2); - - float helixDistance = 0; - - for (int i=0;i<3;++i) { - helixDistance += (pos1[i] - pos2[i])*(pos1[i] - pos2[i]); - pos[i] = 0.5*(pos1[i]+pos2[i]); - mom[i] = mom1[i]+mom2[i]; - } - helixDistance = sqrt(helixDistance); - - return helixDistance; - -} - -void HelixClass::getExtrapolatedMomentum(float * pos, float * momentum) { - - float phi = atan2(pos[1]-_yCentre,pos[0]-_xCentre); - if (phi <0.) phi += _const_2pi; - phi = phi - _phiAtPCA + _phi0; - momentum[0] = _pxy*cos(phi); - momentum[1] = _pxy*sin(phi); - momentum[2] = _momentum[2]; - - -} diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.h b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.h deleted file mode 100644 index 794f8158..00000000 --- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/HelixClass.h +++ /dev/null @@ -1,302 +0,0 @@ -#ifndef HELIXAR_H -#define HELIXAR_H 1 -#include <vector> -/** - * Utility class to manipulate with different parameterisations <br> - * of helix. Helix can be initialized in a three different <br> - * ways using the following public methods : <br> - * 1) Initialize_VP(float * pos, float * mom, float q, float B) : <br> - * initialization of helix is done using <br> - * - position of the reference point : pos[3]; <br> - * - momentum vector at the reference point : mom[3];<br> - * - particle charge : q;<br> - * - magnetic field (in Tesla) : B;<br> - * 2) Initialize_BZ(float xCentre, float yCentre, float radius, <br> - * float bZ, float phi0, float B, float signPz,<br> - * float zBegin):<br> - * initialization of helix is done according to the following<br> - * parameterization<br> - * x = xCentre + radius*cos(bZ*z + phi0)<br> - * y = yCentre + radius*sin(bZ*z + phi0)<br> - * where (x,y,z) - position of point on the helix<br> - * - (xCentre,yCentre) is the centre of circumference in R-Phi plane<br> - * - radius is the radius of circumference<br> - * - bZ is the helix slope parameter<br> - * - phi0 is the initial phase of circumference<br> - * - B is the magnetic field (in Tesla)<br> - * - signPz is the sign of the z component of momentum vector<br> - * - zBegin is the z coordinate of the reference point;<br> - * 3) void Initialize_Canonical(float phi0, float d0, float z0, float omega,<br> - * float tanlambda, float B) :<br> - * canonical (LEP-wise) parameterisation with the following parameters<br> - * - phi0 - Phi angle of momentum vector at the point of<br> - * closest approach to IP in R-Phi plane; - * - d0 - signed distance of closest approach to IP in R-Phi plane;<br> - * - z0 - z coordinate of the point of closest approach in R-Phi plane;<br> - * - omega - signed curvature;<br> - * - tanlambda - tangent of dip angle;<br> - * - B - magnetic field (in Tesla);<br> - * A set of public methods (getters) provide access to <br> - * various parameters associated with helix. Helix Class contains<br> - * also several utility methods, allowing for calculation of helix<br> - * intersection points with planes parallel and perpendicular to <br> - * z (beam) axis and determination of the distance of closest approach<br> - * from arbitrary 3D point to the helix. <br> - * @author A. Raspereza (DESY)<br> - * @version $Id: HelixClass.h,v 1.16 2008-06-05 13:47:18 rasp Exp $<br> - * - */ - -#include "LineClass.h" -class HelixClass; - -class HelixClass { - public: - -/** - * Constructor. Initializations of constants which are used - * to calculate various parameters associated with helix. - */ - HelixClass(); -/** - * Destructor. - */ - ~HelixClass(); -/** - * Initialization of helix using <br> - * - position of the reference point : pos[3]; <br> - * - momentum vector at the reference point : mom[3];<br> - * - particle charge : q;<br> - * - magnetic field (in Tesla) : B<br> - */ - void Initialize_VP(float * pos, float * mom, float q, float B); - -/** - * Initialization of helix according to the following<br> - * parameterization<br> - * x = xCentre + radius*cos(bZ*z + phi0)<br> - * y = yCentre + radius*sin(bZ*z + phi0)<br> - * where (x,y,z) - position of point on the helix<br> - * - (xCentre,yCentre) is the centre of circumference in R-Phi plane<br> - * - radius is the radius of circumference<br> - * - bZ is the helix slope parameter<br> - * - phi0 is the initial phase of circumference<br> - * - B is the magnetic field (in Tesla)<br> - * - signPz is the sign of the z component of momentum vector<br> - * - zBegin is the z coordinate of the reference point<br> - */ - void Initialize_BZ(float xCentre, float yCentre, float radius, - float bZ, float phi0, float B, float signPz, - float zBegin); -/** - * Canonical (LEP-wise) parameterisation with the following parameters<br> - * - phi0 - Phi angle of momentum vector at the point of<br> - * closest approach to IP in R-Phi plane; - * - d0 - signed distance of closest approach in R-Phi plane;<br> - * - z0 - z coordinate of the point of closest approach to IP - * in R-Phi plane;<br> - * - omega - signed curvature;<br> - * - tanlambda - tangent of dip angle;<br> - * - B - magnetic field (in Tesla)<br> - */ - void Initialize_Canonical(float phi0, float d0, float z0, float omega, - float tanlambda, float B); - /** - * Returns momentum of particle at the point of closest approach <br> - * to IP <br> - */ - const float * getMomentum(); - - /** - * Returns reference point of track <br> - */ - const float * getReferencePoint(); - - /** - * Returns Phi angle of the momentum vector <br> - * at the point of closest approach to IP <br> - */ - float getPhi0(); - - /** - * Returns signed distance of closest approach <br> - * to IP in the R-Phi plane <br> - */ - float getD0(); - - /** - * Returns z coordinate of the point of closest - * approach to IP in the R-Phi plane <br> - */ - float getZ0(); - - /** - * Returns signed curvature of the track <br> - */ - float getOmega(); - - /** - * Returns tangent of dip angle of the track <br> - */ - float getTanLambda(); - - /** - * Returns transverse momentum of the track <br> - */ - float getPXY(); - - - /** - * Returns x coordinate of circumference - */ - float getXC(); - - /** - * Returns y coordinate of circumference - */ - float getYC(); - - - /** - * Returns radius of circumference - */ - float getRadius(); - - - /** - * Returns helix intersection point with the plane <br> - * parallel to z axis. Plane is defined by two coordinates <br> - * of the point belonging to the plane (x0,y0) and normal <br> - * vector (ax,ay). ref[3] is the reference point of the helix. <br> - * point[3] - returned vector holding the coordinates of <br> - * intersection point <br> - */ - float getPointInXY(float x0, float y0, float ax, float ay, - float * ref , float * point); - - /** - * Returns helix intersection point with the plane <br> - * perpendicular to z axis. Plane is defined by z coordinate <br> - * of the plane. ref[3] is the reference point of the helix. <br> - * point[3] - returned vector holding the coordinates of <br> - * intersection point <br> - */ - float getPointInZ(float zLine, float * ref, float * point); - - /** - * Return distance of the closest approach of the helix to <br> - * arbitrary 3D point in space. xPoint[3] - coordinates of <br> - * space point. Distance[3] - vector of distances of helix to <br> - * a given point in various projections : <br> - * Distance[0] - distance in R-Phi plane <br> - * Distance[1] - distance along Z axis <br> - * Distance[2] - 3D distance <br> - */ - float getDistanceToPoint(float * xPoint, float * Distance); - - /** - * Return distance of the closest approach of the helix to <br> - * arbitrary 3D point in space. xPoint[3] - coordinates of <br> - * space point. distCut - limit on the distance between helix <br> - * and the point to reduce calculation time <br> - * If R-Phi is found to be greater than distCut, rPhi distance is returned <br> - * If the R-Phi distance is not too big, than the exact 3D distance is returned <br> - * This function can be used, if the exact distance is not always needed <br> - */ - float getDistanceToPoint(const float* xPoint, float distCut); - float getDistanceToPoint(const std::vector<float>& xPoint, float distCut); - - /** - * This method calculates coordinates of both intersection <br> - * of the helix with a cylinder. <br> - * Rotational symmetry with respect to z axis is assumed, <br> - * meaning that cylinder axis corresponds to the z axis <br> - * of reference frame. <br> - * Inputs : <br> - * Radius - radius of cylinder. <br> - * ref[3] - point of closest approach to the origin of the helix. <br> - * Output : <br> - * point[6] - coordinates of intersection point. <br> - * Method returns also generic time, defined as the <br> - * ratio of helix length from reference point to the intersection <br> - * point to the particle momentum <br> - */ - float getPointOnCircle(float Radius, float * ref, float * point); - - /** Returns distance between two helixes <br> - * Output : <br> - * pos[3] - position of the point of closest approach <br> - * mom[3] - momentum of V0 <br> - */ - float getDistanceToHelix(HelixClass * helix, float * pos, float * mom); - - /** - * Set Edges of helix - */ - void setHelixEdges(float * xStart, float * xEnd); - - /** - * Returns starting point of helix - */ - float * getStartingPoint() {return _xStart;} - - /** - * Returns endpoint of helix - */ - float * getEndPoint() {return _xEnd;} - - /** - * Returns BZ for the second parameterization - */ - float getBz(); - - /** - * Returns Phi for the second parameterization - */ - float getPhiZ(); - - /** - * Returns extrapolated momentum - */ - void getExtrapolatedMomentum(float * pos, float * momentum); - - /** - * Returns charge - */ - float getCharge(); - - private: - float _momentum[3]; // momentum @ ref point - float _referencePoint[3]; // coordinates @ ref point - float _phi0; // phi0 in canonical parameterization - float _d0; // d0 in canonical parameterisation - float _z0; // z0 in canonical parameterisation - float _omega; // signed curvuture in canonical parameterisation - float _tanLambda; // TanLambda - float _pxy; // Transverse momentum - float _charge; // Particle Charge - float _bField; // Magnetic field (assumed to point to Z>0) - float _radius; // radius of circle in XY plane - float _xCentre; // X of circle centre - float _yCentre; // Y of circle centre - float _phiRefPoint; // Phi w.r.t. (X0,Y0) of circle @ ref point - float _phiAtPCA; // Phi w.r.t. (X0,Y0) of circle @ PCA - float _xAtPCA; // X @ PCA - float _yAtPCA; // Y @ PCA - float _pxAtPCA; // PX @ PCA - float _pyAtPCA; // PY @ PCA - float _phiMomRefPoint; // Phi of Momentum vector @ ref point - float _const_pi; // PI - float _const_2pi; // 2*PI - float _const_pi2; // PI/2 - float _FCT; // 2.99792458E-4 - float _xStart[3]; // Starting point of track segment - float _xEnd[3]; // Ending point of track segment - - float _bZ; - float _phiZ; - -}; - - -#endif diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.cc b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.cc deleted file mode 100644 index e23db1fa..00000000 --- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.cc +++ /dev/null @@ -1,73 +0,0 @@ -#include "LineClass.h" -#include <math.h> - -/* - * Constructor - */ - -LineClass::LineClass(float x0, - float y0, - float z0, - float ax, - float ay, - float az) { - _x0[0] = x0; - _x0[1] = y0; - _x0[2] = z0; - _ax[0] = ax; - _ax[1] = ay; - _ax[2] = az; -} - -LineClass::LineClass(float *x0, - float *ax) { - - for (int i=0; i<3; ++i) { - _x0[i] = x0[i]; - _ax[i] = ax[i]; - } -} - -float * LineClass::getReferencePoint() { - return _x0; -} - -float * LineClass::getDirectionalVector() { - return _ax; -} - -void LineClass::setReferencePoint(float *x0) { - for (int i=0; i<3; ++i) - _x0[i] = x0[i]; -} - -void LineClass::setDirectionalVector(float *ax) { - for (int i=0; i<3; ++i) - _ax[i] = ax[i]; - -} - -float LineClass::getDistanceToPoint(float * xpoint, float * pos) { - - float dif[3]; - float prod = 0; - float den = 0; - for (int i=0; i<3; ++i) { - dif[i] = xpoint[i] - _x0[i]; - prod += _ax[i]*dif[i]; - den += _ax[i]*_ax[i]; - } - float time = prod/fmax(1e-10,den); - - float dist = 0.0; - for (int i=0; i<3; ++i) { - pos[i] = _x0[i] + _ax[i]*time; - dist += (xpoint[i]-pos[i])*(xpoint[i]-pos[i]); - } - dist = sqrt(dist); - - return dist; - - - -} diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.h b/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.h deleted file mode 100644 index 98970a26..00000000 --- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/LineClass.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef LINECLASS_H -#define LINECLASS_H -class LineClass { - - public: - LineClass(float x0, - float y0, - float z0, - float ax, - float ay, - float az); - - LineClass(float *x0, - float *ax); - - ~LineClass(); - - float * getReferencePoint(); - void setReferencePoint(float *x0); - float * getDirectionalVector(); - void setDirectionalVector(float *ax); - float getDistanceToPoint(float * xpoint, float * pos); - - private: - - float _x0[3]; - float _ax[3]; - - -}; - -#endif diff --git a/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt index 73dc84e3..84535b8e 100644 --- a/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt +++ b/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt @@ -2,25 +2,13 @@ gaudi_subdir(MatrixPandora v0r0) find_package(DD4hep COMPONENTS DDG4 REQUIRED) find_package(CLHEP REQUIRED) -find_package(GSL REQUIRED )##don't use this, use CEPC LCIO version one , due to the ClusterShape.cc file which is from LCIO -message("GSL: ${GSL_LIBRARIES} ") -set (gsl_include "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/include") -set (gsl_lib1 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgsl.so") -set (gsl_lib2 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgslcblas.so") find_package(LCIO REQUIRED ) find_package(GEAR REQUIRED) -#message("ENV GEAR: $ENV{GEAR}") find_package(EDM4HEP REQUIRED ) -#message("EDM4HEP_INCLUDE_DIRS: ${EDM4HEP_INCLUDE_DIR}") -#message("EDM4HEP_LIB: ${EDM4HEP_LIBRARIES}") include_directories(${EDM4HEP_INCLUDE_DIR}) find_package(PandoraSDK REQUIRED ) -#message("PandoraSDK_INCLUDE_DIRS: ${PandoraSDK_INCLUDE_DIRS}") -#message("PandoraSDK_LIB: ${PandoraSDK_LIBRARIES}") find_package(LCContent REQUIRED ) -#message("LCContent_INCLUDE_DIRS: ${LCContent_INCLUDE_DIRS}") -#message("LCContent_LIB: ${LCContent_LIBRARIES}") include_directories(${PandoraSDK_INCLUDE_DIRS}) link_libraries(${PandoraSDK_LIBRARIES}) include_directories(${LCContent_INCLUDE_DIRS}) @@ -30,13 +18,12 @@ link_libraries(${LCContent_LIBRARIES}) list(APPEND CMAKE_MODULE_PATH "$ENV{ROOTSYS}/etc/cmake/") find_package(ROOT 5.26.00 REQUIRED COMPONENTS Eve Geom RGL EG) -include_directories("../CED/CED/") -include_directories("../MarlinUtil/01-08/source/") gaudi_depends_on_subdirs( Service/EventSeeder Service/GearSvc Detector/DetInterface + Utilities/DataHelper ) set(dir_srcs @@ -46,14 +33,12 @@ set(dir_srcs src/CaloHitCreator.cpp src/TrackCreator.cpp src/PfoCreator.cpp - ../CED/CED/*.cc - ../MarlinUtil/01-08/source/*.cc ) set(dir_include include) # Modules gaudi_add_module(MatrixPandora ${dir_srcs} - INCLUDE_DIRS ${gsl_include} ${dir_include} GaudiKernel FWCore CLHEP ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear DD4hep - LINK_LIBRARIES ${gsl_lib1} ${gsl_lib2} GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec + INCLUDE_DIRS ${dir_include} GaudiKernel FWCore CLHEP ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear DD4hep + LINK_LIBRARIES GaudiKernel FWCore CLHEP ROOT ${LCIO_LIBRARIES} $ENV{GEAR}/lib/libgear.so $ENV{GEAR}/lib/libgearxml.so DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec DataHelperLib -Wl,--no-as-needed EDM4HEP::edm4hep EDM4HEP::edm4hepDict -Wl,--as-needed diff --git a/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h b/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h index 83c6e149..b9679a48 100644 --- a/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h +++ b/Reconstruction/PFA/Pandora/MatrixPandora/include/PfoCreator.h @@ -22,7 +22,7 @@ #include "edm4hep/CalorimeterHitCollection.h" #include "edm4hep/CalorimeterHit.h" -#include "ClusterShapes.h" +#include "DataHelper/ClusterShapes.h" #include "Api/PandoraApi.h" class CollectionMaps; diff --git a/Utilities/DataHelper/CMakeLists.txt b/Utilities/DataHelper/CMakeLists.txt index 7bdae2b7..3d1e6122 100644 --- a/Utilities/DataHelper/CMakeLists.txt +++ b/Utilities/DataHelper/CMakeLists.txt @@ -1,6 +1,10 @@ gaudi_subdir(DataHelper v0r0) find_package(EDM4HEP REQUIRED) +set (gsl_include "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/include") +set (gsl_lib1 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgsl.so") +set (gsl_lib2 "/cvmfs/cepc.ihep.ac.cn/software/cepcsoft/x86_64-sl6-gcc49/external/GSL/1.14/install/lib/libgslcblas.so") +INCLUDE_DIRECTORIES(${gsl_include}) gaudi_depends_on_subdirs() @@ -10,5 +14,5 @@ set(DataHelperLib_srcs src/*.cc src/*.cpp) gaudi_add_library(DataHelperLib ${DataHelperLib_srcs} PUBLIC_HEADERS DataHelper - LINK_LIBRARIES EDM4HEP::edm4hep EDM4HEP::edm4hepDict + LINK_LIBRARIES EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${gsl_lib1} ${gsl_lib2} ) diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.h b/Utilities/DataHelper/DataHelper/ClusterShapes.h similarity index 99% rename from Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.h rename to Utilities/DataHelper/DataHelper/ClusterShapes.h index 2b97b685..695dabee 100644 --- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.h +++ b/Utilities/DataHelper/DataHelper/ClusterShapes.h @@ -8,7 +8,7 @@ #include <string> #include <sstream> #include <cstdlib> -#include "HelixClass.h" +#include "DataHelper/HelixClass.h" #include <math.h> diff --git a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.cc b/Utilities/DataHelper/src/ClusterShapes.cc similarity index 99% rename from Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.cc rename to Utilities/DataHelper/src/ClusterShapes.cc index e7e8d4fc..e86bcefa 100644 --- a/Reconstruction/PFA/Pandora/MarlinUtil/01-08/source/ClusterShapes.cc +++ b/Utilities/DataHelper/src/ClusterShapes.cc @@ -1,6 +1,6 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -#include "ClusterShapes.h" +#include "DataHelper/ClusterShapes.h" #include <gsl/gsl_vector.h> #include <gsl/gsl_matrix.h> -- GitLab