-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from markito3/consolidated
Consolidated
- Loading branch information
Showing
281 changed files
with
47,709 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#ifndef _DBCALCluster_ | ||
#define _DBCALCluster_ | ||
|
||
/* | ||
* DBCALCluster.h | ||
* | ||
* Created by Matthew Shepherd on 3/12/11. | ||
* | ||
*/ | ||
|
||
#include "BCAL/DBCALGeometry.h" | ||
#include "BCAL/DBCALPoint.h" | ||
|
||
#include <JANA/JObject.h> | ||
#include <JANA/JFactory.h> | ||
|
||
#include <vector> | ||
|
||
using namespace jana; | ||
using namespace std; | ||
|
||
class DBCALCluster : public JObject { | ||
|
||
public: | ||
|
||
JOBJECT_PUBLIC( DBCALCluster ); | ||
|
||
DBCALCluster(double z_target_center, const DBCALGeometry *locGeom); | ||
DBCALCluster(const DBCALPoint* point, double z_target_center, double q, const DBCALGeometry *locGeom); | ||
|
||
vector< const DBCALPoint* > points() const { return m_points; } | ||
// Returns a vector of the single-ended hits used in the cluster. | ||
// This returns a pair because we need to store the attenuated-corrected energy | ||
// and the DBCALUnifiedHit cannot hold this information. | ||
vector< pair<const DBCALUnifiedHit*,double> > hits() const { return m_single_ended_hits; } | ||
|
||
int nCells() const { return m_points.size(); } | ||
|
||
// the total energy in the cluster | ||
|
||
float E() const { return m_E; } | ||
float E_preshower() const { return m_E_preshower; } | ||
float E_L2() const { return m_E_L2; } | ||
float E_L3() const { return m_E_L3; } | ||
float E_L4() const { return m_E_L4; } | ||
|
||
// this is the time at the inner radius of BCAL assuming shower | ||
// particles propagte into module at the speed of light | ||
float t() const { return m_t; } | ||
float sigT() const { return m_sig_t; } | ||
float rmsTime() const { return m_t_rms; } | ||
|
||
// assuming a photon leaving the target, this the estimate of t0 | ||
// (could be helpful for photon/pion discrimination) | ||
float t0() const; | ||
|
||
// location of cluster in spherical coordinates with the origin | ||
// at the center of the target -- WARNING: errors are not rigorously derived! | ||
float rho() const { return m_rho; } | ||
float sigRho() const { return m_sig_rho; } | ||
|
||
float theta() const { return m_theta; } | ||
float sigTheta() const { return m_sig_theta; } | ||
|
||
float phi() const { return m_phi; } | ||
float sigPhi() const { return m_sig_phi; } | ||
|
||
int Q() const { return charge; } | ||
|
||
// these functions modify the cluster | ||
void addPoint( const DBCALPoint* point , int q ); | ||
void addHit ( const DBCALUnifiedHit* hit, double hit_E_unattenuated ); | ||
void mergeClust( const DBCALCluster& clust, double point_reatten_E ); | ||
void removePoint( const DBCALPoint* point ); | ||
|
||
// this prints out info | ||
void toStrings( vector< pair < string, string > > &items ) const; | ||
|
||
private: | ||
|
||
void makeFromPoints(); | ||
void clear(); | ||
|
||
vector< const DBCALPoint* > m_points; | ||
vector< const DBCALPoint* > m_points_remove; | ||
vector< pair<const DBCALUnifiedHit*,double> > m_single_ended_hits; //Store single-ended hits together with their unattenuated energies | ||
|
||
float m_hit_E_unattenuated_sum; //attenuation-corrected sum of energies from single-ended hits | ||
float m_point_reatten_E_sum; | ||
float m_E_points; | ||
float m_E; | ||
float m_E_preshower; | ||
float m_E_L2; | ||
float m_E_L3; | ||
float m_E_L4; | ||
|
||
float m_t; | ||
float m_sig_t; | ||
float m_t_rms; | ||
|
||
float m_rho; | ||
float m_sig_rho; | ||
float m_theta; | ||
float m_sig_theta; | ||
float m_phi; | ||
float m_sig_phi; | ||
|
||
float m_z_target_center; | ||
int new_point_q; | ||
int charge; | ||
const DBCALGeometry *m_BCALGeom; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// $Id$ | ||
// | ||
// File: DBCALDigiHit.h | ||
// Created: Tue Aug 6 09:14:41 EDT 2013 | ||
// Creator: davidl (on Darwin harriet.jlab.org 11.4.2 i386) | ||
// | ||
|
||
#ifndef _DBCALDigiHit_ | ||
#define _DBCALDigiHit_ | ||
|
||
#include <BCAL/DBCALGeometry.h> | ||
|
||
#include <JANA/JObject.h> | ||
using namespace jana; | ||
|
||
class DBCALDigiHit:public JObject{ | ||
|
||
/// This class holds a single hit from a BCAL fADC250 module. | ||
/// The values are in the digitized form coming from the module | ||
/// and are therefore uncalibrated. | ||
|
||
public: | ||
JOBJECT_PUBLIC(DBCALDigiHit); | ||
|
||
int module; | ||
int layer; | ||
int sector; | ||
DBCALGeometry::End end; | ||
uint32_t pulse_integral; ///< identified pulse integral as returned by FPGA algorithm | ||
uint32_t pulse_peak; ///< identified pulse height as returned by FPGA algorithm | ||
uint32_t pulse_time; ///< identified pulse time as returned by FPGA algorithm | ||
uint32_t pedestal; ///< pedestal info used by FPGA (if any) | ||
uint32_t QF; ///< Quality Factor from FPGA algorithms | ||
uint32_t nsamples_integral; ///< number of samples used in integral | ||
uint32_t nsamples_pedestal; ///< number of samples used in pedestal | ||
|
||
uint32_t datasource; ///< 0=window raw data, 1=old(pre-Fall16) firmware, 2=Df250PulseData, 3=MC | ||
|
||
void toStrings(vector<pair<string,string> > &items)const{ | ||
AddString(items, "module", "%d", module); | ||
AddString(items, "layer", "%d", layer); | ||
AddString(items, "sector", "%d", sector); | ||
AddString(items, "end", "%s", end==0 ? "upstream":"downstream" ); | ||
AddString(items, "pulse_integral", "%d", pulse_integral); | ||
AddString(items, "pulse_peak", "%d", pulse_peak); | ||
AddString(items, "pulse_time", "%d", pulse_time); | ||
AddString(items, "pedestal", "%d", pedestal); | ||
AddString(items, "QF", "%d", QF); | ||
AddString(items, "nsamples_integral", "%d", nsamples_integral); | ||
AddString(items, "nsamples_pedestal", "%d", nsamples_pedestal); | ||
} | ||
|
||
}; | ||
|
||
#endif // _DBCALDigiHit_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
// $Id$ | ||
// | ||
// File: DBCALGeometry.h | ||
// Created: Thu Nov 17 15:10:51 CST 2005 | ||
// Creator: gluexuser (on Linux hydra.phys.uregina.ca 2.4.20-8smp i686) | ||
// | ||
|
||
#ifndef _DBCALGeometry_ | ||
#define _DBCALGeometry_ | ||
|
||
#include <JANA/JObject.h> | ||
#include <JANA/JFactory.h> | ||
using namespace jana; | ||
|
||
// create a single number channel id which is useful in algorithms | ||
// if M L S are module layer sector the bit map looks like: | ||
// MMMM MMMM LLLL SSSS | ||
|
||
#define MODULE_SHIFT 8 | ||
#define MODULE_MASK 0xFF00 | ||
#define LAYER_SHIFT 4 | ||
#define LAYER_MASK 0x00F0 | ||
#define SECTOR_SHIFT 0 | ||
#define SECTOR_MASK 0X000F | ||
|
||
class DBCALGeometry : public JObject { | ||
|
||
public: | ||
|
||
JOBJECT_PUBLIC( DBCALGeometry ); | ||
|
||
DBCALGeometry(int runnumber); | ||
|
||
enum End { kUpstream, kDownstream }; | ||
|
||
// Methods to access and initialize the private variables | ||
float GetBCAL_inner_rad() const; | ||
const float* GetBCAL_radii() const; | ||
float GetBCAL_center() const; | ||
float GetBCAL_length() const; | ||
float GetBCAL_phi_shift() const; | ||
|
||
float GetBCAL_outer_rad() const { return BCALOUTERRAD; } | ||
float GetBCAL_middle_rad() const { return BCALMIDRAD; } | ||
float GetBCAL_middle_cell() const { return BCALMID; } | ||
float *GetBCAL_cell_radii() { return &(m_radius[0]); } | ||
|
||
// as-built geometry | ||
float GetBCAL_Nmodules() const { return NBCALMODS; } | ||
float GetBCAL_Nlayers() const { return NBCALLAYERS; } | ||
float GetBCAL_Nsectors() const { return NBCALSECTORS; } | ||
|
||
float GetBCAL_NInnerLayers() const { return NBCALLAYSIN; } | ||
float GetBCAL_NOuterLayers() const { return NBCALLAYSOUT; } | ||
float GetBCAL_NInnerSectors() const { return NBCALSECSIN; } | ||
float GetBCAL_NOuterSectors() const { return NBCALSECSOUT; } | ||
// define these for completeness, but they aren't used outside of this class | ||
// right now, so comment them out | ||
//vector<float> GetBCAL_NSummedInnerLayers() const { return NSUMLAYSIN; } | ||
//vector<float> GetBCAL_NSummedOuterLayers() const { return NSUMLAYSOUT; } | ||
|
||
|
||
// nominal effective velocity | ||
float GetBCAL_c_effective() const { return C_EFFECTIVE; } | ||
|
||
// nominal attenuation length | ||
float GetBCAL_attenutation_length() const { return ATTEN_LENGTH; } | ||
|
||
///these functions are about encoding/decoding module/layer/sector info in a cellId | ||
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.) | ||
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 | ||
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 | ||
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 | ||
|
||
///these functions are about finding which readout cell contains a specific SiPM cell | ||
int fADC_layer( int SiPM_cellId ) const; | ||
int fADC_sector( int SiPM_cellId ) const; | ||
int fADCId( int module, int SiPM_layer, int SiPM_sector ) const; | ||
int NSiPMs(int fADCId) const; | ||
|
||
///these functions are about the physical location and dimensions of a readout cell | ||
float phi( int fADC_cellId ) const; | ||
float phiSize( int fADC_cellId ) const; | ||
float r( int fADC_cellId ) const; | ||
float rSize( int fADC_cellId ) const; | ||
|
||
///these are missing functions that fill in some previous gaps. | ||
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. | ||
int getglobalchannelnumber(int module, int layer, int sector, int end) const; ///< Return a BCAL channel number, in order of significance (module, layer, sector, end). | ||
int getendchannelnumber(int module, int layer, int sector) const; ///< Return a channel number for either end, in order of significance (module, layer, sector). | ||
int getglobalsector(int module, int sector) const; | ||
int getsector(int globalsector) const; | ||
int getmodule(int globalsector) const; | ||
|
||
private: | ||
|
||
DBCALGeometry(); // forbid the default constructor | ||
void Initialize(int runnumber); // this is old, but keep it around for now, make sure no one else can call it | ||
|
||
// as-built geometry | ||
const int NBCALMODS=48; ///< number of modules | ||
const int NBCALLAYERS=4; ///< number of layers in a module | ||
const int NBCALSECTORS=4; ///< number of sectors in a module | ||
|
||
//the distinction between inner layers and outer layers is important, since only the inner layers have TDC readout | ||
const int NBCALLAYSIN=3; ///< number of readout layers in inner BCAL (first 6 SiPM layers) | ||
const int NBCALLAYSOUT=1; ///< number of readout layers in outer BCAL (outer 4 SiPM layers) | ||
|
||
// On each module there is a 10x4 (r/phi) array of SiPMs | ||
// 1.2.3.4 summing configuration - This is used in the BCAL as built | ||
vector<int> NSUMLAYSIN = {1,2,3}; ///< number of radial SiPM layers summed for digitization in each inner readout layer | ||
vector<int> NSUMLAYSOUT = {4}; ///< number of radial SiPM layers summed for digitization in each outer readout layer | ||
const int NBCALSECSIN=4; ///<number of sectors in inner region | ||
const int NBCALSECSOUT=4; ///<number of sectors in outer region | ||
// the following are completely deprecated | ||
//const int NSUMSECSIN=1; ///< for the inner layers, the number of SiPM that will be summed in the azimuthal direction | ||
//const int NSUMSECSOUT=1; ///< for the outer layer(s), the number of SiPM that will be summed in the azimuthal direction | ||
//const int NBCALSECSIN=4/NSUMSECSIN; ///<number of sectors in inner region | ||
//const int NBCALSECSOUT=4/NSUMSECSOUT; ///<number of sectors in outer region | ||
|
||
float BCALINNERRAD=0.; ///< innner radius of BCAL in cm | ||
float fADC_radius[5] = {}; ///< BCAL layer radii (4 layers total) | ||
float GLOBAL_CENTER=0.; ///< center of BCAL in gloobal coordinate system | ||
float BCALFIBERLENGTH=0.; ///< BCAL Scintilator fiber lenth in cm | ||
float BCAL_PHI_SHIFT=0.; ///< overall phi roation of BCAL in radians | ||
|
||
// Enter the index of the SiPM that designates the first | ||
// (counting radially outward) of the outer cells (default 7) | ||
const int BCALMID=7; ///< first outer layer (default 7) | ||
float BCALMIDRAD = m_radius[BCALMID-1]; ///< mid radius of BCAL in cm (boundary between inner and outer layers) | ||
float BCALOUTERRAD=86.17; ///< outer radius of BCAL in cm | ||
|
||
float C_EFFECTIVE=16.75; ///< speed of light in fibers | ||
float ATTEN_LENGTH=520.; ///< attenuation length | ||
|
||
float m_radius[11] = { 64.3, | ||
66.3, | ||
68.3, | ||
70.3, | ||
72.3, | ||
74.3, | ||
76.3, | ||
78.77, | ||
81.24, | ||
83.70, | ||
86.17}; | ||
|
||
|
||
}; | ||
|
||
#endif // _DBCALGeometry_ |
Oops, something went wrong.