CFEL - ASG Software Suite  2.5.0
CASS
Namespaces | Classes | Typedefs | Functions
cass::pixeldetector Namespace Reference

Namespaces

 commonmode
 
 Direction
 

Classes

class  AboveNoiseFinder
 will find pixels by comparing them to a "noise" map More...
 
class  AdvancedDetector
 An Advanced Pixel Detector. More...
 
class  CoalescingBase
 base class for all coalescing functors More...
 
class  CommonData
 Data used commonly for one AdvancedDetector. More...
 
class  Converter
 Converter for pnCCD, CsPad and commercial CCD Data. More...
 
class  Detector
 Detector containing a ccd camera image. More...
 
class  DetectorHelper
 Helper for Advanced Pixel Detector related Postprocessors. More...
 
struct  DetectorName
 retrieve the DetectorName More...
 
class  Device
 the device containing pixel detector data More...
 
class  FixedMaps
 Creates maps from a fixed number of Frames. More...
 
struct  Frame
 A Frame of an advance Pixel Detector. More...
 
class  FrameProcessorBase
 base class for all frame processors More...
 
class  Frms6Reader
 class for reading frms6 files More...
 
class  GainCalibration
 Creates a gain calibration. More...
 
struct  Hit
 A Hit on a pixel detector. More...
 
class  HLLProcessor
 HLL like frame processing. More...
 
class  HotPixelsFinder
 hotpixels finder More...
 
struct  isNeighbour
 check if pixel is neighbour More...
 
class  MapCreatorBase
 base class for all correction map creators More...
 
class  MovingMaps
 Creates maps from the last number of maps. More...
 
class  NoProcess
 Class with no processing. More...
 
class  OnlineFixedCreator
 Creates the maps fast and simple. More...
 
class  OnlineFixedCreatorCommonMode
 Creates the maps fast and simple with commond mode correction. More...
 
struct  Pixel
 Pixel definition. More...
 
class  PixelFinderBase
 base class for pixel finders More...
 
class  PixelFinderSimple
 simple algorithm to find pixels of interest More...
 
class  PixelFinderSimpleMoreOptions
 same as simple, but with adjustable box size More...
 
class  RAWSSSReader
 class for reading commercial ccd files More...
 
class  SHMStreamer
 deserialize the data stream of shm2tcp program More...
 
class  SimpleCoalesce
 simple coalescing of pixels More...
 
class  WithinRange
 within range More...
 

Typedefs

typedef pair< int, int > index_t
 an index within a matrix More...
 
typedef pair< float, float > indexf_t
 an index within a matrix but with with floating point precision More...
 

Functions

DetectorretrieveDet (CASSEvent &evt, const Device::detectors_t::key_type &key)
 extract the right detector from the CASSEvent More...
 
vector< uint8_t > extractPayload (const Pds::Xtc *xtc)
 copy payload of xtc into a bytearray More...
 
void copyAdditionalPnccdInfo (const Pds::PNCCD::ConfigV1 &, Detector &det, size_t &rowsOfSegment, size_t &columnsOfSegment)
 copy additional info about the pnCCD More...
 
void copyAdditionalPnccdInfo (const Pds::PNCCD::ConfigV2 &cfg, Detector &det, size_t &rowsOfSegment, size_t &columnsOfSegment)
 copy additional info about the pnCCD More...
 
template<typename ConfigType >
void copyPnCCDFrame (const Pds::Xtc *xtc, const ConfigType &cfg, Detector &det)
 copy the pnCCD frame into the detector More...
 
template<typename ConfigType >
void copyCsPadFrame (const Pds::Xtc *xtc, const ConfigType &cfg, Detector &det)
 copy the cspad frame to the detector More...
 
template<typename ConfigType >
void copyEpixFrame (const Pds::Epix::ElementV3 &element, const ConfigType &cfg, Detector &det)
 copy the epix frame to the detector More...
 
void findNeighbours (uint16_t depth, const uint16_t maxDepth, Pixel &pixel, Direction::direction direction, const Frame &frame, CoalescingBase::pixels_t &pixels, CoalescingBase::pixels_t &splitpixelslist)
 find all neighbours of a pixel More...
 
Hit coalesce (const CoalescingBase::pixels_t &splitpixelslist)
 coalesce the pixels More...
 
bool shouldCoalescePixel (const CoalescingBase::pixels_t &splitpixelslist, const float mipThreshold, const Frame &frame)
 check whether list of pixel should be coalesced More...
 
void readHLLOffsetFile (const string &filename, CommonData &data)
 will read the file containing the offset and noise map in the hll format More...
 
void saveHLLOffsetFile (const string &filename, CommonData &data)
 save the maps to a hll type darkcal file More...
 
void readCASSOffsetFile (const string &filename, CommonData &data)
 will read the file containing the offset and noise map in the former CASS format More...
 
void saveCASSOffsetFile (const string &filename, CommonData &data)
 will save the file containing the offset and noise map in the former CASS format More...
 
void readHLLGainFile (const string &filename, CommonData &data)
 will read the file containing the gain and cte corretion factors in the HLL format More...
 
void readCASSGainFile (const string &filename, CommonData &data)
 read the CASS generated gain file More...
 
void saveCASSGainFile (const string &filename, const CommonData &data)
 save the gain map to CASS style file More...
 
void readCASSHotPixFile (const string &filename, CommonData &data)
 read the CASS generated hotpixels file More...
 
void saveCASSHotPixFile (const string &filename, const CommonData &data)
 save the hot pixels to CASS style file More...
 
void isSameSize (const Frame &frame, CommonData &data)
 check whether the frame has the same size as the maps. More...
 
void createPixelList (const Detector::frame_t::value_type &offset, const Detector::frame_t::value_type &noise, const MapCreatorBase::storage_t &storage, size_t pixel, bool exclude, Detector::frame_t &pixellist)
 create the list of pixels that are non events More...
 
Detector::frame_t::value_type calcNoise (const Detector::frame_t &values, const Detector::frame_t::value_type &mean)
 calulate the standart deviation of distribution More...
 
Detector::frame_t::value_type calcMean (Detector::frame_t &values, size_t mindisregard, size_t maxdisregard)
 calculate the mean of the distribution More...
 
Detector::frame_t::value_type calcMedian (Detector::frame_t &values, size_t mindisregard, size_t maxdisregard)
 calculate the median of the distribution More...
 
template<class containerType >
Detector::frame_t::value_type getConstant (const containerType &)
 get a constant 1 More...
 
template<class containerType >
Detector::frame_t::value_type getZValue (const containerType &container)
 retrieve the z value of the container More...
 
index_t operator+ (const index_t &lhs, const index_t &rhs)
 operates a plus on two indices More...
 
index_t operator- (const index_t &lhs, const index_t &rhs)
 operates a minus on two indices More...
 
index_t operator* (const index_t &lhs, const index_t &rhs)
 operates times on two indices More...
 
indexf_t operator/ (const indexf_t &lhs, const indexf_t &rhs)
 operates devides on two indices More...
 
bool operator< (const indexf_t &lhs, const indexf_t::first_type rhs)
 operates less of an indices to a scalar More...
 
index_t::first_type dot (const index_t &lhs, const index_t &rhs)
 calculate the scalar product of two indices More...
 
size_t TwoD2OneD (const index_t &matrixIndex, const size_t width)
 convert matrix index to linearised index More...
 
index_t OneD2TwoD (const size_t linearisedIndex, const size_t width)
 convert linearised index to matrixindex More...
 
void addCircle (CommonData &data, CASSSettings &s)
 add a circle to the mask More...
 
void addSquare (CommonData &data, CASSSettings &s)
 add a square element to the mask More...
 
void addEllipse (CommonData &data, CASSSettings &s)
 add a ellipsodial element to the mask More...
 
void addRing (CommonData &data, CASSSettings &s)
 add a ring More...
 
void addTriangle (CommonData &data, CASSSettings &s)
 add a triangluar element to the mask More...
 
void createCASSMask (CommonData &data, CASSSettings &s)
 create the mask More...
 

Typedef Documentation

typedef pair<int,int> cass::pixeldetector::index_t

an index within a matrix

Definition at line 32 of file pixeldetector_mask.cpp.

typedef pair<float,float> cass::pixeldetector::indexf_t

an index within a matrix but with with floating point precision

Definition at line 35 of file pixeldetector_mask.cpp.

Function Documentation

void cass::pixeldetector::addCircle ( CommonData data,
CASSSettings s 
)

add a circle to the mask

goes through the sqare that conatins the cirlce and checks whether the index is covered by the circle. If so the mask at that index will be set to false.

User definable Parameters:

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{CenterX|CenterY}
The center of the circle. Default is 500|500.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{Radius}
The radius of the circle. Default is 2.

Parameters
datathe container containing the mask where the element should be added
sthe settings element to read the mask element parameters from
Author
Nicola Coppola
Lutz Foucar

Definition at line 175 of file pixeldetector_mask.cpp.

References cass::pixeldetector::CommonData::columns, cass::pixeldetector::CommonData::lock, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::rows, cass::toString(), TwoD2OneD(), QSettings::value(), and cass::ACQIRIS::width.

Referenced by createCASSMask().

void cass::pixeldetector::addEllipse ( CommonData data,
CASSSettings s 
)

add a ellipsodial element to the mask

adds an ellipsodial to the mask. Will iterate trhough the sqare that contains the ellipse and checks which pixels should be masked.

User definable Parameters:

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{CenterX|CenterY}
The central point of the ellipse. Default is 500|500.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{SemiAxisX|SemiAxisY}
The semi axis along x and y of the ellipse. By definition the longer one defines the major axis and the smaller on the minor axis. Default is 5|4.

Parameters
datathe container containing the mask where the element should be added
sthe settings element to read the mask element parameters from
Author
Nicola Coppola
Lutz Foucar
Todo:
check whether this works

Definition at line 278 of file pixeldetector_mask.cpp.

References cass::pixeldetector::CommonData::columns, cass::pixeldetector::CommonData::lock, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::rows, cass::toString(), TwoD2OneD(), QSettings::value(), and cass::ACQIRIS::width.

Referenced by createCASSMask().

void cass::pixeldetector::addRing ( CommonData data,
CASSSettings s 
)

add a ring

define the ring by two ellipses; an inner and outer ellipse. The area covered by the out but not by the inner will be masked. The two ellipsoids can have different centers and axis. Therefore the ring can take any shape.

User definable Parameters:

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{InnerCenterX|InnerCenterY}
The central point of the inner ellipse. Default is 500|500.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{InnerSemiAxisX|InnerSemiAxisY}
The semi axis along x and y of the inner ellipse. By definition the longer one defines the major axis and the smaller on the minor axis. Default is 5|4.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{OuterCenterX|OuterCenterY}
The central point of the outer ellipse. Default is 500|500.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{OuterSemiAxisX|OuterSemiAxisY}
The semi axis along x and y of the outer ellipse. By definition the longer one defines the major axis and the smaller on the minor axis. Default is 20|20.

Author
Lutz Foucar

Definition at line 340 of file pixeldetector_mask.cpp.

References cass::pixeldetector::CommonData::columns, cass::pixeldetector::CommonData::lock, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::rows, cass::toString(), TwoD2OneD(), QSettings::value(), and cass::ACQIRIS::width.

Referenced by createCASSMask().

void cass::pixeldetector::addSquare ( CommonData data,
CASSSettings s 
)

add a square element to the mask

sets all pixels covered by the square to 0.

User definable Parameters:

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{LowerLeftX|LowerLeftY}
The lower left pixel of the square element. The indizes given are . included in the square. Default is 0|0.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{UpperRightX|UpperRightY}
The upper right pixel of the square element. The indizes given are . included in the square. Default is 1023|1023.

Parameters
datathe container containing the mask where the element should be added
sthe settings element to read the mask element parameters from
Author
Nicola Coppola
Lutz Foucar

Definition at line 225 of file pixeldetector_mask.cpp.

References cass::pixeldetector::CommonData::columns, cass::pixeldetector::CommonData::lock, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::rows, cass::toString(), TwoD2OneD(), QSettings::value(), and cass::ACQIRIS::width.

Referenced by createCASSMask().

void cass::pixeldetector::addTriangle ( CommonData data,
CASSSettings s 
)

add a triangluar element to the mask

To see whether a point is within a triangle one can use barycentric coordinates. See http://en.wikipedia.org/wiki/Barycentric_coordinates_(mathematics) for details. A point within barycentric can be defined by converting to these coordinates. The bayrocentric coordinates are represented by three points A, B, C. Each point can be represented by $ \vec{P} = \lambda_1\vec{A} + \lambda_2\vec{B} + \lambda_3\vec{C}$ where $ \lambda_1, \lambda_2, \lambda_3$ can be determined from $ \vec{P} $ using the components of the triangle points and the wanted point $ \vec{P} = (x,y) ; \vec{A} = (x_1,y_1); \vec{B} = (x_2,y_2); \vec{C} = (x_3,y_3)$ with these definition the following equalities are given:

\begin{eqnarray*} \lambda_1&=&\frac{(y_2-y_3)(x-x_3)+(x_3-x_2)(y-y_3)}{(y_2-y_3)(x_1-x_3)+(x_3-x_2)(y_1-y_3)}\\ \lambda_2&=&\frac{(y_3-y_1)(x-x_3)+(x_1-x_3)(y-y_3)}{(y_2-y_3)(x_1-x_3)+(x_3-x_2)(y_1-y_3)}\\ \lambda_3&=&1-\lambda_1-\lambda_2 \end{eqnarray*}

With this we know that $ \vec{P} $ lies within the triangluar when

\[ 0 \leq \lambda_i \leq 1 \]

User definable Parameters:

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{PointA_X|PointA_Y}
The triangles first point. Default is 500|500.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{PointB_X|PointB_Y}
The triangles first point. Default is 500|500.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{PointC_X|PointC_Y}
The triangles first point. Default is 500|500.

Parameters
datathe container containing the mask where the element should be added
sthe settings element to read the mask element parameters from
Author
Lutz Foucar

Definition at line 447 of file pixeldetector_mask.cpp.

References A, cass::pixeldetector::CommonData::columns, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::rows, cass::toString(), TwoD2OneD(), QSettings::value(), cass::ACQIRIS::width, cass::ACQIRIS::x, and cass::ACQIRIS::y.

Referenced by createCASSMask().

Detector::frame_t::value_type cass::pixeldetector::calcMean ( Detector::frame_t values,
size_t  mindisregard,
size_t  maxdisregard 
)

calculate the mean of the distribution

before calulating the mean value of the distribution remove the nbr of elements that have the lowest values and the nbr of elements with the hightest values.

Returns
the mean value
Parameters
valuesthe values to calculate the mean from
mindisregardthe number of minimum values to disregard
maxdisregardthe number of maximum values to disregard
Author
Lutz Foucar

Definition at line 95 of file mapcreators.cpp.

Referenced by cass::pixeldetector::FixedMaps::loadSettings().

Detector::frame_t::value_type cass::pixeldetector::calcMedian ( Detector::frame_t values,
size_t  mindisregard,
size_t  maxdisregard 
)

calculate the median of the distribution

before calulating the median value of the distribution remove the nbr of elements that have the lowest values and the nbr of elements with the hightest values.

Returns
the median value
Parameters
valuesthe values to calculate the median from
mindisregardthe number of minimum values to disregard
maxdisregardthe number of maximum values to disregard
Author
Lutz Foucar

Definition at line 118 of file mapcreators.cpp.

Referenced by cass::pixeldetector::FixedMaps::loadSettings().

Detector::frame_t::value_type cass::pixeldetector::calcNoise ( const Detector::frame_t values,
const Detector::frame_t::value_type &  mean 
)

calulate the standart deviation of distribution

Returns
the standart deviation
Parameters
valuesthe values to calc the standart deviation from the mean value
meanthe mean value to calc the standart deviation from
Author
Lutz Foucar

Definition at line 71 of file mapcreators.cpp.

Referenced by cass::pixeldetector::FixedMaps::operator()().

Hit cass::pixeldetector::coalesce ( const CoalescingBase::pixels_t splitpixelslist)

coalesce the pixels

Coalesce the pixels in the pixel list to an hit on the detector. The value (Z) of the pixels will be added. The position of the hit is defined by the center of mass of the pixel group. Also remember how many pixels contributed to the hit.

Returns
the hit, which is the coalesced pixels
Parameters
splitpixelslistThe list of pixels that belong to one hit on the detector.
Author
Lutz Foucar

Definition at line 173 of file coalesce_simple.cpp.

References hit, cass::pixeldetector::Hit::nbrPixels, cass::pixeldetector::Hit::x, cass::pixeldetector::Hit::y, and cass::pixeldetector::Hit::z.

Referenced by cass::pixeldetector::AdvancedDetector::hits(), and cass::pixeldetector::SimpleCoalesce::operator()().

void cass::pixeldetector::copyAdditionalPnccdInfo ( const Pds::PNCCD::ConfigV1 &  ,
Detector det,
size_t &  rowsOfSegment,
size_t &  columnsOfSegment 
)

copy additional info about the pnCCD

No info is available, just set default values.

Parameters
cfgunused
detreference to the detector that the info will be copied to
rowsOfSegmentthe number of rows in each segment
columnsOfSegmentthe number of columns in each segment
Author
Lutz Foucar

Definition at line 104 of file lcls_converter.cpp.

References cass::pixeldetector::Detector::columns(), and cass::pixeldetector::Detector::rows().

Referenced by copyPnCCDFrame().

void cass::pixeldetector::copyAdditionalPnccdInfo ( const Pds::PNCCD::ConfigV2 &  cfg,
Detector det,
size_t &  rowsOfSegment,
size_t &  columnsOfSegment 
)

copy additional info about the pnCCD

Copy all info that one can get from version 2.

Parameters
cfgreference to the configuration
detreference to the detector that the info will be copied to
rowsOfSegmentthe number of rows in each segment
columnsOfSegmentthe number of columns in each segment
Author
Lutz Foucar

Definition at line 123 of file lcls_converter.cpp.

References cass::Log::add(), cass::pixeldetector::Detector::camaxMagic(), cass::pixeldetector::Detector::columns(), cass::Log::ERROR, cass::pixeldetector::Detector::info(), cass::pixeldetector::Detector::rows(), cass::pixeldetector::Detector::timingFilename(), and cass::toString().

template<typename ConfigType >
void cass::pixeldetector::copyCsPadFrame ( const Pds::Xtc *  xtc,
const ConfigType &  cfg,
Detector det 
)

copy the cspad frame to the detector

Template Parameters
ConfigTypethe type of configuration
Parameters
xtcthe raw data of the detector
cfgthe configuration that tells what is where in the configuration
detthe place where the frame data should be copied to
Author
Lutz Foucar

2 asics per segment. 8 segments per quadrant.

4 quadrants

all sections above each other

Definition at line 218 of file lcls_converter.cpp.

References cass::pixeldetector::Detector::columns(), cass::pixeldetector::Detector::frame(), and cass::pixeldetector::Detector::rows().

Referenced by cass::pixeldetector::Converter::operator()().

template<typename ConfigType >
void cass::pixeldetector::copyEpixFrame ( const Pds::Epix::ElementV3 &  element,
const ConfigType &  cfg,
Detector det 
)

copy the epix frame to the detector

Template Parameters
ConfigTypethe type of configuration
Parameters
elementthe epix element that contains the raw data
cfgthe configuration that tells what is where in the configuration
detthe place where the frame data should be copied to
Author
Lutz Foucar

Definition at line 266 of file lcls_converter.cpp.

References cass::pixeldetector::Detector::columns(), data, cass::pixeldetector::Detector::frame(), and cass::pixeldetector::Detector::rows().

Referenced by cass::pixeldetector::Converter::operator()().

template<typename ConfigType >
void cass::pixeldetector::copyPnCCDFrame ( const Pds::Xtc *  xtc,
const ConfigType &  cfg,
Detector det 
)

copy the pnCCD frame into the detector

Template Parameters
ConfigTypethe type of configuration
Parameters
xtcthe raw data of the detector
cfgthe configuration that tells what is where in the configuration
detthe place where the frame data should be copied to
Author
Lutz Foucar

Definition at line 155 of file lcls_converter.cpp.

References copyAdditionalPnccdInfo(), cass::pixeldetector::Detector::frame(), and cass::toString().

Referenced by cass::pixeldetector::Converter::operator()().

void cass::pixeldetector::createCASSMask ( CommonData data,
CASSSettings s 
)

create the mask

a mask is created from a list of mask elements loaded form the ini file. The individual elements properties are loaded from the .ini file according to their shape.

User definable Parameters:

PixelDetectors/%name%/CorrectionMaps/Mask/{size}
The number of mask elements that are part of the complete mask. Default is 0.

PixelDetectors/%name%/CorrectionMaps/Mask/%index%/{MaskElementType}
Name of the mask element. Default is "Unknown", which let the code ignore that element. Possible values are:

Author
Nicola Coppola
Lutz Foucar

reset the mask before creating it

Definition at line 512 of file pixeldetector_mask.cpp.

References cass::Log::add(), addCircle(), addEllipse(), addRing(), addSquare(), addTriangle(), QSettings::beginReadArray(), data, cass::Log::DEBUG0, QSettings::endArray(), cass::pixeldetector::CommonData::mask, QSettings::setArrayIndex(), size, and QSettings::value().

Referenced by isSameSize(), and cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::createPixelList ( const Detector::frame_t::value_type &  offset,
const Detector::frame_t::value_type &  noise,
const MapCreatorBase::storage_t storage,
size_t  pixel,
bool  exclude,
Detector::frame_t pixellist 
)

create the list of pixels that are non events

create a list of all pixels from the storage. Exclude all pixels that might contain an event (photon or other).

Parameters
offsetthe offset for the pixel at index pixel
noisethe noise for the pixel at index pixel
storagethe container for all the frames data
pixelindex of the pixel that one wants to create the pixel list for.
excludeflag to show whether to exclude the pixels that potentially a photon hit
[out]pixellistthe list of pixels the are non events
Author
Lutz Foucar

Definition at line 47 of file mapcreators.cpp.

Referenced by cass::pixeldetector::FixedMaps::operator()().

index_t::first_type cass::pixeldetector::dot ( const index_t lhs,
const index_t rhs 
)

calculate the scalar product of two indices

perform operation $ lhs_1*rhs_1 + lhs_2*rhs_2$

Returns
the result of the operation
Parameters
lhsthe left hand side of the operation
rhsthe right hand side of the opeation
Author
Lutz Foucar

Definition at line 126 of file pixeldetector_mask.cpp.

vector<uint8_t> cass::pixeldetector::extractPayload ( const Pds::Xtc *  xtc)

copy payload of xtc into a bytearray

create a byte array of the right size and copy the payload of the xtc to it.

Returns
vector containing the payload of the xtc
Parameters
xtcthe xtc whos payload should be copied.
Author
Lutz Foucar

Definition at line 85 of file lcls_converter.cpp.

Referenced by cass::pixeldetector::Converter::operator()().

void cass::pixeldetector::findNeighbours ( uint16_t  depth,
const uint16_t  maxDepth,
Pixel pixel,
Direction::direction  direction,
const Frame frame,
CoalescingBase::pixels_t pixels,
CoalescingBase::pixels_t splitpixelslist 
)

find all neighbours of a pixel

This function is meant to be called recursively only to a depth of 5. First it will add the pixel that is passed to this function to the split pixel list and is marked as used. Then it will try to find another pixel in the pixellist of the frame, that is a neighbour of that pixel. It will search whether there is a pixel above, underneath, left or right from the pixel and call this function for this pixel recursively and increases the depth by one. As parameter it will also tell the callee where the orignal pixel was, so that when checking for neightbours we can omit the directions we came from.

This idea was inspired by Tom White.

Parameters
depthThe recursive depth of calling this function
maxDepthThe maximum allowed recursive depth of calling this function
pixelThe pixel whos neighbours we are searching for
directionThe direction that we came from
frameReference to the frame containing the frame data an info about the coulumns and rows of the frame.
pixelsthe list of pixels that should be coalesced
splitpixelslistReference to the list of pixels that have neighbours The event (hit) that all these pixels belong to has been split among the pixels in this list.
Author
Lutz Foucar

check for neighbour to the west

check for neighbour to the east

check for neighbour to the north

check for neighbour to the south

Definition at line 95 of file coalesce_simple.cpp.

References cass::pixeldetector::Frame::columns, cass::pixeldetector::Direction::east, cass::pixeldetector::Direction::north, cass::pixeldetector::Frame::rows, cass::pixeldetector::Direction::south, cass::pixeldetector::Pixel::used, cass::pixeldetector::Direction::west, cass::pixeldetector::Pixel::x, and cass::pixeldetector::Pixel::y.

Referenced by cass::pixeldetector::SimpleCoalesce::operator()().

template<class containerType >
Detector::frame_t::value_type cass::pixeldetector::getConstant ( const containerType &  )

get a constant 1

Template Parameters
thetype of container for which the constant should be returned
Returns
1
Parameters
containerunused
Author
Lutz Foucar

Definition at line 37 of file pixel_detectors.cpp.

template<class containerType >
Detector::frame_t::value_type cass::pixeldetector::getZValue ( const containerType &  container)

retrieve the z value of the container

Template Parameters
thetype of container for which the z value should be returned
Returns
the z value of the container
Parameters
containerthe container that contains the z value
Author
Lutz Foucar

Definition at line 51 of file pixel_detectors.cpp.

void cass::pixeldetector::isSameSize ( const Frame frame,
CommonData data 
)

check whether the frame has the same size as the maps.

if not resize the maps to the right size and initialize them with values, that will let the hitfinder find no pixels and the correction make does not alter the frame.

this function relys on that the maps are locked. Usually they are since this is called by the operators of the map creators. These are locked because the function calling the operators will lock the maps before.

Parameters
framethe Frame to check
datathe container for all maps.
Author
Lutz Foucar

Definition at line 436 of file common_data.cpp.

References cass::Log::add(), QSettings::beginGroup(), cass::pixeldetector::Frame::columns, cass::pixeldetector::CommonData::columns, cass::pixeldetector::CommonData::correctionMap, createCASSMask(), cass::pixeldetector::CommonData::createCorMap(), cass::pixeldetector::CommonData::detectorname, QString::fromStdString(), cass::pixeldetector::CommonData::gain_cteMap, cass::pixeldetector::CommonData::hotpixels, cass::pixeldetector::CommonData::lock, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::noiseMap, cass::pixeldetector::CommonData::offsetMap, cass::pixeldetector::Frame::rows, cass::pixeldetector::CommonData::rows, cass::toString(), and cass::Log::WARNING.

index_t cass::pixeldetector::OneD2TwoD ( const size_t  linearisedIndex,
const size_t  width 
)

convert linearised index to matrixindex

Returns
index in the matrix
Parameters
linearisedIndexthe linearized index in the matrix
widththe width of the matrix
Author
Lutz Foucar

Definition at line 153 of file pixeldetector_mask.cpp.

index_t cass::pixeldetector::operator* ( const index_t lhs,
const index_t rhs 
)

operates times on two indices

performs $(lhs_1*rhs_1)(lhs_2*rhs_2)$.

Returns
the result of the operation
Parameters
lhsthe left hand side of the operation
rhsthe right hand side of the opeation
Author
Lutz Foucar

Definition at line 79 of file pixeldetector_mask.cpp.

index_t cass::pixeldetector::operator+ ( const index_t lhs,
const index_t rhs 
)

operates a plus on two indices

performs $(lhs_1+rhs_1)(lhs_2+rhs_2)$.

Returns
the result of the operation
Parameters
lhsthe left hand side of the operation
rhsthe right hand side of the opeation
Author
Lutz Foucar

Definition at line 47 of file pixeldetector_mask.cpp.

index_t cass::pixeldetector::operator- ( const index_t lhs,
const index_t rhs 
)

operates a minus on two indices

performs $(lhs_1-rhs_1)(lhs_2-rhs_2)$.

Returns
the result of the operation
Parameters
lhsthe left hand side of the operation
rhsthe right hand side of the opeation
Author
Lutz Foucar

Definition at line 63 of file pixeldetector_mask.cpp.

indexf_t cass::pixeldetector::operator/ ( const indexf_t lhs,
const indexf_t rhs 
)

operates devides on two indices

performs $(lhs_1/rhs_1)(lhs_2/rhs_2)$.

Returns
the result of the operation
Parameters
lhsthe left hand side of the operation
rhsthe right hand side of the opeation
Author
Lutz Foucar

Definition at line 95 of file pixeldetector_mask.cpp.

bool cass::pixeldetector::operator< ( const indexf_t lhs,
const indexf_t::first_type  rhs 
)

operates less of an indices to a scalar

performs $(lhs_1+lhs_2)<rhs$.

Returns
the result of the operation
Parameters
lhsthe left hand side of the operation
rhsthe right hand side of the opeation
Author
Lutz Foucar

Definition at line 111 of file pixeldetector_mask.cpp.

void cass::pixeldetector::readCASSGainFile ( const string &  filename,
CommonData data 
)

read the CASS generated gain file

Parameters
filenamethe filename of file containing the gain maps.
datathe data storage where the info should be written to.
Author
Lutz Foucar

Definition at line 337 of file common_data.cpp.

References cass::Log::add(), cass::pixeldetector::CommonData::gain_cteMap, cass::pixeldetector::CommonData::lock, size, and cass::Log::WARNING.

Referenced by cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::readCASSHotPixFile ( const string &  filename,
CommonData data 
)

read the CASS generated hotpixels file

Parameters
filenamethe filename of file containing the hot pixel mask.
datathe data storage where the info should be written to.
Author
Lutz Foucar

Definition at line 382 of file common_data.cpp.

References cass::Log::add(), cass::pixeldetector::CommonData::hotpixels, cass::pixeldetector::CommonData::lock, size, and cass::Log::WARNING.

Referenced by cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::readCASSOffsetFile ( const string &  filename,
CommonData data 
)

will read the file containing the offset and noise map in the former CASS format

open the file then determine its size from which one can extract the size of the frame. Then read data into temporary containers for double and then copy the data to the final float containers

Parameters
filenamethe filename of file containing the offset and noise maps.
datathe data storage where the info should be written to.
Author
Lutz Foucar

Definition at line 170 of file common_data.cpp.

References cass::Log::add(), cass::pixeldetector::CommonData::lock, cass::pixeldetector::CommonData::noiseMap, cass::pixeldetector::CommonData::offsetMap, size, and cass::Log::WARNING.

Referenced by cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::readHLLGainFile ( const string &  filename,
CommonData data 
)

will read the file containing the gain and cte corretion factors in the HLL format

read in HLL gain/CTE correction format from a given file. If no filename is given just return from the function without doing anything.

the first four lines look like the following

HE File containing gain and CTE values
VERSION 3
HE       #Column   Gain    CTE0
GC          0          1   0.999977
[...]

the third line and following lines have different spacing, depending on how xonline is writing these files.

column is related to the way the ccd is read out. The ccd consists of four segments

BC AD

that are placed ABCD for the HLL file format with the following numbers

1023 <- 512 1535 <- 1024

0 -> 512 1536 -> 2048

The segments are read out bottom up for AD and top down for BC (actually shifted to the corresponding edge).

The memory representation is continuously

... 1024 -> 2047 0 -> 1023

Parameters
filenamethe filename of file containing the offset and noise maps.
datathe data storage where the info should be written to.
Author
Mirko Scholz
Lutz Foucar

Definition at line 266 of file common_data.cpp.

References cass::Log::add(), cass::pixeldetector::CommonData::gain_cteMap, cass::hllDataTypes::HLL2CASS(), cass::pixeldetector::CommonData::lock, and cass::Log::WARNING.

Referenced by cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::readHLLOffsetFile ( const string &  filename,
CommonData data 
)

will read the file containing the offset and noise map in the hll format

The Hll darkcal file format starts with a 1024 bit long header. Then an array of staDataType objects containing more info than just the offset (mean) and the noise (sigma) of the pixels.

After that data a list of chars containing the bad pixel map is recorded. The length of the arrays is according to the size of the frame.

The header first contains a string to identify that it is a proper darkcal file "HE pixel statistics map". Then it is followed by the following the height, the width and the overall length of the frame. See HllFileHeader for details.

since the arrays for the offset and noise map are in the HLL layout, we need to copy the individual information from the staDataType structure to temporary arrays, which we then can convert to the layout that CASS is using.

Parameters
filenamethe filename of file containing the offset and noise maps.
datathe data storage where the info should be written to.
Author
Lutz Foucar

Definition at line 63 of file common_data.cpp.

References cass::Log::add(), cass::hllDataTypes::HLL2CASS(), cass::pixeldetector::CommonData::lock, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::noiseMap, cass::pixeldetector::CommonData::offsetMap, cass::toString(), and cass::Log::WARNING.

Referenced by cass::pixeldetector::CommonData::loadSettings().

Detector& cass::pixeldetector::retrieveDet ( CASSEvent evt,
const Device::detectors_t::key_type &  key 
)

extract the right detector from the CASSEvent

check whether the device that contains the detector is present in the CASSevent if not throw a runtime error

Returns
reference to the requested detector
Parameters
evtthe cassvent containing the detector
keykey of the detector within the map of the device holding the devices
Author
Lutz Foucar

Definition at line 64 of file lcls_converter.cpp.

References cass::pixeldetector::Device::dets(), cass::CASSEvent::devices(), and cass::CASSEvent::PixelDetectors.

Referenced by cass::pixeldetector::Converter::operator()().

void cass::pixeldetector::saveCASSGainFile ( const string &  filename,
const CommonData data 
)

save the gain map to CASS style file

Parameters
filenamethe filename of file were the gains will be written to
datathe data storage where the info should be taken from.
Author
Lutz Foucar

Definition at line 362 of file common_data.cpp.

References cass::pixeldetector::CommonData::gain_cteMap.

Referenced by cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::saveCASSHotPixFile ( const string &  filename,
const CommonData data 
)

save the hot pixels to CASS style file

Parameters
filenamethe filename of file were the hot pixel mask will be written to
datathe data storage where the info should be taken from.
Author
Lutz Foucar

Definition at line 408 of file common_data.cpp.

References cass::pixeldetector::CommonData::hotpixels.

Referenced by cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::saveCASSOffsetFile ( const string &  filename,
CommonData data 
)

will save the file containing the offset and noise map in the former CASS format

write the offset and noise map into a file. The values will just be written in a binary stream of doubles.

The maps are still locked by the createMaps lock when writing.

Parameters
filenamethe filename of file containing the offset and noise maps.
datathe data storage where the info should be written to.
Author
Lutz Foucar

Definition at line 205 of file common_data.cpp.

References cass::pixeldetector::CommonData::noiseMap, and cass::pixeldetector::CommonData::offsetMap.

Referenced by cass::pixeldetector::CommonData::loadSettings().

void cass::pixeldetector::saveHLLOffsetFile ( const string &  filename,
CommonData data 
)

save the maps to a hll type darkcal file

see readHLLOffsetFile for details about the fileformat. There is no need to lock the maps since they are still locked by the lock started in createMaps

Parameters
filenamethe name of the file to write the data to
datathe container including the maps to write to file
Author
Lutz Foucar

Definition at line 120 of file common_data.cpp.

References cass::hllDataTypes::CASS2HLL(), cass::pixeldetector::CommonData::columns, cass::hllDataTypes::DarkcalFileHeader::length, cass::pixeldetector::CommonData::mask, cass::pixeldetector::CommonData::noiseMap, cass::pixeldetector::CommonData::offsetMap, cass::hllDataTypes::DarkcalFileHeader::rows, and cass::pixeldetector::CommonData::rows.

Referenced by cass::pixeldetector::CommonData::loadSettings().

bool cass::pixeldetector::shouldCoalescePixel ( const CoalescingBase::pixels_t splitpixelslist,
const float  mipThreshold,
const Frame frame 
)

check whether list of pixel should be coalesced

Checks whether the pixels in the list are a massiv ionizing particle (MIP) candidate. This means whether the value (z) of that pixel is above a user set threshold. If this is true then the list should not be coalesced. Then check whether one of the neighbouring pixels in the raw frame is 0. This means that it has been marked as bad by either the darkframe calibration or by the user.

Returns
true when the pixels in the list should be coalesced
Parameters
splitpixelslistThe list of pixels that belong to one hit on the detector.
mipThresholdThe threshold above which a pixel is identified as MIP signature
frameThe frame of this detector
Author
Lutz Foucar

Definition at line 215 of file coalesce_simple.cpp.

References cass::pixeldetector::Frame::columns, cass::pixeldetector::Frame::data, data, and cass::pixeldetector::Frame::rows.

Referenced by cass::pixeldetector::SimpleCoalesce::operator()().

size_t cass::pixeldetector::TwoD2OneD ( const index_t matrixIndex,
const size_t  width 
)

convert matrix index to linearised index

Returns
index in the linearised array
Parameters
matrixIndexin the matrix
widththe width of the matrix
Author
Lutz Foucar

Definition at line 140 of file pixeldetector_mask.cpp.

Referenced by addCircle(), addEllipse(), addRing(), addSquare(), and addTriangle().