Skip to content

Commit 45de870

Browse files
authored
Merge pull request #1 from markito3/consolidated
Consolidated
2 parents e861870 + 5d2abe0 commit 45de870

File tree

281 files changed

+47709
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+47709
-2
lines changed

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,25 @@ project(hd_interface)
77
set(CMAKE_CXX_STANDARD 11)
88
set(CMAKE_CXX_STANDARD_REQUIRED True)
99

10+
add_subdirectory(xml)
1011
file(GLOB SOURCES src/*/*.cc)
11-
add_library(HD_INTERFACE STATIC ${SOURCES})
12-
include_directories(${CMAKE_SOURCE_DIR}/include $ENV{LIBHDDM_HOME}/include $ENV{ROOTSYS}/include $ENV{JANA_HOME}/include $ENV{HDDM_HOME}/include $ENV{DDAQ_HOME}/include $ENV{DMAGNETICFIELDMAP_HOME}/include $ENV{XERCES_INCLUDE} $ENV{HDDS_HOME}/$ENV{BMS_OSNAME}/src $ENV{CCDB_HOME}/include)
12+
set(DERIVED_SOURCES
13+
${CMAKE_SOURCE_DIR}/src/HDDM/hddm_s++.cpp
14+
${CMAKE_SOURCE_DIR}/src/HDDM/hddm_r++.cpp
15+
${CMAKE_SOURCE_DIR}/src/HDDM/hddm_mc_s++.cpp
16+
${CMAKE_SOURCE_DIR}/src/HDDM/hddm_s.c
17+
${CMAKE_SOURCE_DIR}/src/HDDM/hddm_r.c
18+
${CMAKE_SOURCE_DIR}/src/HDDM/hddm_mc_s.c
19+
)
20+
set_source_files_properties(${DERIVED_SOURCES}
21+
PROPERTIES GENERATED TRUE)
22+
add_library(HD_INTERFACE STATIC ${SOURCES} ${DERIVED_SOURCES})
23+
include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/HDDM $ENV{ROOTSYS}/include $ENV{JANA_HOME}/include $ENV{HDDM_HOME}/include $ENV{XERCES_INCLUDE} $ENV{HDDS_HOME}/$ENV{BMS_OSNAME}/src $ENV{CCDB_HOME}/include /usr/include/tirpc)
1324
target_compile_options(
1425
HD_INTERFACE
1526
PUBLIC -fPIC -pthread -m64
1627
)
28+
add_dependencies(HD_INTERFACE hddm_derived_sources)
1729
install(
1830
TARGETS HD_INTERFACE
1931
DESTINATION lib

include/BCAL/DBCALCluster.h

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#ifndef _DBCALCluster_
2+
#define _DBCALCluster_
3+
4+
/*
5+
* DBCALCluster.h
6+
*
7+
* Created by Matthew Shepherd on 3/12/11.
8+
*
9+
*/
10+
11+
#include "BCAL/DBCALGeometry.h"
12+
#include "BCAL/DBCALPoint.h"
13+
14+
#include <JANA/JObject.h>
15+
#include <JANA/JFactory.h>
16+
17+
#include <vector>
18+
19+
using namespace jana;
20+
using namespace std;
21+
22+
class DBCALCluster : public JObject {
23+
24+
public:
25+
26+
JOBJECT_PUBLIC( DBCALCluster );
27+
28+
DBCALCluster(double z_target_center, const DBCALGeometry *locGeom);
29+
DBCALCluster(const DBCALPoint* point, double z_target_center, double q, const DBCALGeometry *locGeom);
30+
31+
vector< const DBCALPoint* > points() const { return m_points; }
32+
// Returns a vector of the single-ended hits used in the cluster.
33+
// This returns a pair because we need to store the attenuated-corrected energy
34+
// and the DBCALUnifiedHit cannot hold this information.
35+
vector< pair<const DBCALUnifiedHit*,double> > hits() const { return m_single_ended_hits; }
36+
37+
int nCells() const { return m_points.size(); }
38+
39+
// the total energy in the cluster
40+
41+
float E() const { return m_E; }
42+
float E_preshower() const { return m_E_preshower; }
43+
float E_L2() const { return m_E_L2; }
44+
float E_L3() const { return m_E_L3; }
45+
float E_L4() const { return m_E_L4; }
46+
47+
// this is the time at the inner radius of BCAL assuming shower
48+
// particles propagte into module at the speed of light
49+
float t() const { return m_t; }
50+
float sigT() const { return m_sig_t; }
51+
float rmsTime() const { return m_t_rms; }
52+
53+
// assuming a photon leaving the target, this the estimate of t0
54+
// (could be helpful for photon/pion discrimination)
55+
float t0() const;
56+
57+
// location of cluster in spherical coordinates with the origin
58+
// at the center of the target -- WARNING: errors are not rigorously derived!
59+
float rho() const { return m_rho; }
60+
float sigRho() const { return m_sig_rho; }
61+
62+
float theta() const { return m_theta; }
63+
float sigTheta() const { return m_sig_theta; }
64+
65+
float phi() const { return m_phi; }
66+
float sigPhi() const { return m_sig_phi; }
67+
68+
int Q() const { return charge; }
69+
70+
// these functions modify the cluster
71+
void addPoint( const DBCALPoint* point , int q );
72+
void addHit ( const DBCALUnifiedHit* hit, double hit_E_unattenuated );
73+
void mergeClust( const DBCALCluster& clust, double point_reatten_E );
74+
void removePoint( const DBCALPoint* point );
75+
76+
// this prints out info
77+
void toStrings( vector< pair < string, string > > &items ) const;
78+
79+
private:
80+
81+
void makeFromPoints();
82+
void clear();
83+
84+
vector< const DBCALPoint* > m_points;
85+
vector< const DBCALPoint* > m_points_remove;
86+
vector< pair<const DBCALUnifiedHit*,double> > m_single_ended_hits; //Store single-ended hits together with their unattenuated energies
87+
88+
float m_hit_E_unattenuated_sum; //attenuation-corrected sum of energies from single-ended hits
89+
float m_point_reatten_E_sum;
90+
float m_E_points;
91+
float m_E;
92+
float m_E_preshower;
93+
float m_E_L2;
94+
float m_E_L3;
95+
float m_E_L4;
96+
97+
float m_t;
98+
float m_sig_t;
99+
float m_t_rms;
100+
101+
float m_rho;
102+
float m_sig_rho;
103+
float m_theta;
104+
float m_sig_theta;
105+
float m_phi;
106+
float m_sig_phi;
107+
108+
float m_z_target_center;
109+
int new_point_q;
110+
int charge;
111+
const DBCALGeometry *m_BCALGeom;
112+
113+
};
114+
115+
#endif

include/BCAL/DBCALDigiHit.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// $Id$
2+
//
3+
// File: DBCALDigiHit.h
4+
// Created: Tue Aug 6 09:14:41 EDT 2013
5+
// Creator: davidl (on Darwin harriet.jlab.org 11.4.2 i386)
6+
//
7+
8+
#ifndef _DBCALDigiHit_
9+
#define _DBCALDigiHit_
10+
11+
#include <BCAL/DBCALGeometry.h>
12+
13+
#include <JANA/JObject.h>
14+
using namespace jana;
15+
16+
class DBCALDigiHit:public JObject{
17+
18+
/// This class holds a single hit from a BCAL fADC250 module.
19+
/// The values are in the digitized form coming from the module
20+
/// and are therefore uncalibrated.
21+
22+
public:
23+
JOBJECT_PUBLIC(DBCALDigiHit);
24+
25+
int module;
26+
int layer;
27+
int sector;
28+
DBCALGeometry::End end;
29+
uint32_t pulse_integral; ///< identified pulse integral as returned by FPGA algorithm
30+
uint32_t pulse_peak; ///< identified pulse height as returned by FPGA algorithm
31+
uint32_t pulse_time; ///< identified pulse time as returned by FPGA algorithm
32+
uint32_t pedestal; ///< pedestal info used by FPGA (if any)
33+
uint32_t QF; ///< Quality Factor from FPGA algorithms
34+
uint32_t nsamples_integral; ///< number of samples used in integral
35+
uint32_t nsamples_pedestal; ///< number of samples used in pedestal
36+
37+
uint32_t datasource; ///< 0=window raw data, 1=old(pre-Fall16) firmware, 2=Df250PulseData, 3=MC
38+
39+
void toStrings(vector<pair<string,string> > &items)const{
40+
AddString(items, "module", "%d", module);
41+
AddString(items, "layer", "%d", layer);
42+
AddString(items, "sector", "%d", sector);
43+
AddString(items, "end", "%s", end==0 ? "upstream":"downstream" );
44+
AddString(items, "pulse_integral", "%d", pulse_integral);
45+
AddString(items, "pulse_peak", "%d", pulse_peak);
46+
AddString(items, "pulse_time", "%d", pulse_time);
47+
AddString(items, "pedestal", "%d", pedestal);
48+
AddString(items, "QF", "%d", QF);
49+
AddString(items, "nsamples_integral", "%d", nsamples_integral);
50+
AddString(items, "nsamples_pedestal", "%d", nsamples_pedestal);
51+
}
52+
53+
};
54+
55+
#endif // _DBCALDigiHit_
56+

include/BCAL/DBCALGeometry.h

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
// $Id$
2+
//
3+
// File: DBCALGeometry.h
4+
// Created: Thu Nov 17 15:10:51 CST 2005
5+
// Creator: gluexuser (on Linux hydra.phys.uregina.ca 2.4.20-8smp i686)
6+
//
7+
8+
#ifndef _DBCALGeometry_
9+
#define _DBCALGeometry_
10+
11+
#include <JANA/JObject.h>
12+
#include <JANA/JFactory.h>
13+
using namespace jana;
14+
15+
// create a single number channel id which is useful in algorithms
16+
// if M L S are module layer sector the bit map looks like:
17+
// MMMM MMMM LLLL SSSS
18+
19+
#define MODULE_SHIFT 8
20+
#define MODULE_MASK 0xFF00
21+
#define LAYER_SHIFT 4
22+
#define LAYER_MASK 0x00F0
23+
#define SECTOR_SHIFT 0
24+
#define SECTOR_MASK 0X000F
25+
26+
class DBCALGeometry : public JObject {
27+
28+
public:
29+
30+
JOBJECT_PUBLIC( DBCALGeometry );
31+
32+
DBCALGeometry(int runnumber);
33+
34+
enum End { kUpstream, kDownstream };
35+
36+
// Methods to access and initialize the private variables
37+
float GetBCAL_inner_rad() const;
38+
const float* GetBCAL_radii() const;
39+
float GetBCAL_center() const;
40+
float GetBCAL_length() const;
41+
float GetBCAL_phi_shift() const;
42+
43+
float GetBCAL_outer_rad() const { return BCALOUTERRAD; }
44+
float GetBCAL_middle_rad() const { return BCALMIDRAD; }
45+
float GetBCAL_middle_cell() const { return BCALMID; }
46+
float *GetBCAL_cell_radii() { return &(m_radius[0]); }
47+
48+
// as-built geometry
49+
float GetBCAL_Nmodules() const { return NBCALMODS; }
50+
float GetBCAL_Nlayers() const { return NBCALLAYERS; }
51+
float GetBCAL_Nsectors() const { return NBCALSECTORS; }
52+
53+
float GetBCAL_NInnerLayers() const { return NBCALLAYSIN; }
54+
float GetBCAL_NOuterLayers() const { return NBCALLAYSOUT; }
55+
float GetBCAL_NInnerSectors() const { return NBCALSECSIN; }
56+
float GetBCAL_NOuterSectors() const { return NBCALSECSOUT; }
57+
// define these for completeness, but they aren't used outside of this class
58+
// right now, so comment them out
59+
//vector<float> GetBCAL_NSummedInnerLayers() const { return NSUMLAYSIN; }
60+
//vector<float> GetBCAL_NSummedOuterLayers() const { return NSUMLAYSOUT; }
61+
62+
63+
// nominal effective velocity
64+
float GetBCAL_c_effective() const { return C_EFFECTIVE; }
65+
66+
// nominal attenuation length
67+
float GetBCAL_attenutation_length() const { return ATTEN_LENGTH; }
68+
69+
///these functions are about encoding/decoding module/layer/sector info in a cellId
70+
int cellId( int module, int layer, int sector ) const; ///< This object can be used for the SiPM ID or for the fADC ID since they are defined in the same way (4 bits for sector then 4 bits for layer then 8 bits for module.)
71+
int module( int cellId ) const; ///< This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way
72+
int layer( int cellId ) const; ///< This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way
73+
int sector( int cellId ) const; ///< This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way
74+
75+
///these functions are about finding which readout cell contains a specific SiPM cell
76+
int fADC_layer( int SiPM_cellId ) const;
77+
int fADC_sector( int SiPM_cellId ) const;
78+
int fADCId( int module, int SiPM_layer, int SiPM_sector ) const;
79+
int NSiPMs(int fADCId) const;
80+
81+
///these functions are about the physical location and dimensions of a readout cell
82+
float phi( int fADC_cellId ) const;
83+
float phiSize( int fADC_cellId ) const;
84+
float r( int fADC_cellId ) const;
85+
float rSize( int fADC_cellId ) const;
86+
87+
///these are missing functions that fill in some previous gaps.
88+
int fADCcellId_rphi( float r, float phi ) const; ///< Method to get the fADC cell ID from an (R, phi) combination.\n R in cm and phi in radians.
89+
int getglobalchannelnumber(int module, int layer, int sector, int end) const; ///< Return a BCAL channel number, in order of significance (module, layer, sector, end).
90+
int getendchannelnumber(int module, int layer, int sector) const; ///< Return a channel number for either end, in order of significance (module, layer, sector).
91+
int getglobalsector(int module, int sector) const;
92+
int getsector(int globalsector) const;
93+
int getmodule(int globalsector) const;
94+
95+
private:
96+
97+
DBCALGeometry(); // forbid the default constructor
98+
void Initialize(int runnumber); // this is old, but keep it around for now, make sure no one else can call it
99+
100+
// as-built geometry
101+
const int NBCALMODS=48; ///< number of modules
102+
const int NBCALLAYERS=4; ///< number of layers in a module
103+
const int NBCALSECTORS=4; ///< number of sectors in a module
104+
105+
//the distinction between inner layers and outer layers is important, since only the inner layers have TDC readout
106+
const int NBCALLAYSIN=3; ///< number of readout layers in inner BCAL (first 6 SiPM layers)
107+
const int NBCALLAYSOUT=1; ///< number of readout layers in outer BCAL (outer 4 SiPM layers)
108+
109+
// On each module there is a 10x4 (r/phi) array of SiPMs
110+
// 1.2.3.4 summing configuration - This is used in the BCAL as built
111+
vector<int> NSUMLAYSIN = {1,2,3}; ///< number of radial SiPM layers summed for digitization in each inner readout layer
112+
vector<int> NSUMLAYSOUT = {4}; ///< number of radial SiPM layers summed for digitization in each outer readout layer
113+
const int NBCALSECSIN=4; ///<number of sectors in inner region
114+
const int NBCALSECSOUT=4; ///<number of sectors in outer region
115+
// the following are completely deprecated
116+
//const int NSUMSECSIN=1; ///< for the inner layers, the number of SiPM that will be summed in the azimuthal direction
117+
//const int NSUMSECSOUT=1; ///< for the outer layer(s), the number of SiPM that will be summed in the azimuthal direction
118+
//const int NBCALSECSIN=4/NSUMSECSIN; ///<number of sectors in inner region
119+
//const int NBCALSECSOUT=4/NSUMSECSOUT; ///<number of sectors in outer region
120+
121+
float BCALINNERRAD=0.; ///< innner radius of BCAL in cm
122+
float fADC_radius[5] = {}; ///< BCAL layer radii (4 layers total)
123+
float GLOBAL_CENTER=0.; ///< center of BCAL in gloobal coordinate system
124+
float BCALFIBERLENGTH=0.; ///< BCAL Scintilator fiber lenth in cm
125+
float BCAL_PHI_SHIFT=0.; ///< overall phi roation of BCAL in radians
126+
127+
// Enter the index of the SiPM that designates the first
128+
// (counting radially outward) of the outer cells (default 7)
129+
const int BCALMID=7; ///< first outer layer (default 7)
130+
float BCALMIDRAD = m_radius[BCALMID-1]; ///< mid radius of BCAL in cm (boundary between inner and outer layers)
131+
float BCALOUTERRAD=86.17; ///< outer radius of BCAL in cm
132+
133+
float C_EFFECTIVE=16.75; ///< speed of light in fibers
134+
float ATTEN_LENGTH=520.; ///< attenuation length
135+
136+
float m_radius[11] = { 64.3,
137+
66.3,
138+
68.3,
139+
70.3,
140+
72.3,
141+
74.3,
142+
76.3,
143+
78.77,
144+
81.24,
145+
83.70,
146+
86.17};
147+
148+
149+
};
150+
151+
#endif // _DBCALGeometry_

0 commit comments

Comments
 (0)