MarlinTPC
1.2.0
|
The VoxelTPC is a helper class containing a std::map of all TPCVoxels which contain charge. More...
#include <VoxelTPC.h>
Classes | |
struct | VoxelIndex |
This structure is for the sorting of the voxels. More... | |
Public Member Functions | |
VoxelTPC (gear::TPCParameters const *tpcParameters, double lengthOfTimeBin, double inductionFactor=0) | |
Constructor of VoxelTPC. | |
~VoxelTPC () | |
Destructor of VoxelTPC. | |
LCCollectionVec * | getVoxelCollection (double outputLength=-1) |
Returns an LCCollectionVec of the stored TPCVoxels. More... | |
LCCollectionVec * | fetchVoxelCollection (double outputLength=-1) |
Does the same as getVoxelCollection() but erases the voxels from the map. | |
std::list< std::pair < VoxelIndex, int > > * | getVoxelList (double outputLength=-1, bool erase=false) |
This function works like getVoxelCollection, but the output format is different. More... | |
std::list< std::pair < VoxelIndex, int > > * | fetchVoxelList (double outputLength=-1) |
Convenience function: calls getVoxelMap with erase = true. | |
void | putChargeInVoxels (SimTrackerHit *hit, double sigmaTrans, double sigmaLong=0) |
Distributes the charge onto the pads assuming a 2D Gaussian distribution with the width sigmaTrans. More... | |
void | putChargeInVoxel (TPCVoxel const &voxel) |
Puts the charge into the voxel. More... | |
void | putChargeInVoxel (int padIndex, double zLength, int charge, int moduleID=0) |
Convenience function for putChargeInVoxel( TPCVoxel const &voxel). More... | |
TPCVoxel | getVoxel (int padIndex, int timeIndex, int moduleID=0) |
Get the voxel with a given index. More... | |
std::vector< TPCVoxel > | getVoxelsOnPad (int padIndex, int moduleID=0) |
Returns a vector with all voxels with a specific pad (and module) index. | |
std::vector< TPCVoxel > | getVoxelsWithZBin (int zBin) |
Returns a vector of all non-empty voxels with a specific time index. | |
void | addCollection (LCCollection *voxelCol) |
Adds the given collection of TPCVoxels to the map. | |
void | removeVoxel (TPCVoxel const &voxel) |
Removes a voxel from the set. More... | |
void | removeVoxel (int padIndex, int zBin, int moduleID=0) |
Removes a voxel with given pad index and zBin from the map. | |
void | removeVoxels (std::vector< TPCVoxel > const &voxelVec) |
Removes voxels in vector from the set. More... | |
void | removeVoxelsOnPad (int padIndex, int moduleID=0) |
Removes all voxels with given pad index. | |
void | removeVoxelsWithZBin (int zBin) |
Removes all voxels with given time index. | |
int | getZBin (double zLength) |
Takes a length in z and returns the number of the corresponding zBin. | |
size_t | getSize () |
For debugging: get the size of the map. | |
Protected Attributes | |
std::map< VoxelIndex, int > | _voxelMap |
Map to store the information contained in the voxels. More... | |
gear::TPCParameters const * | _tpcParameters |
Pointer on the gear pad layout. | |
HitDistributor * | _distributeHitPtr |
Pointer on HitSmearer for the distribution of the hits. | |
double | _lengthOfZBin |
Instantiation parameters. | |
The VoxelTPC is a helper class containing a std::map of all TPCVoxels which contain charge.
It uses the GEAR pad geometry and the length of a time bin to calculate the pad index and time index of the voxels. One time bin does not necessarily have to be one sample of the ADC. It can also be a nanosecond (useful to have good time resolution for a realistic electronics shaping) or one bunch crossing (to store one bunch train on a per event basis).
TPCVoxel marlintpc::VoxelTPC::getVoxel | ( | int | padIndex, |
int | timeIndex, | ||
int | moduleID = 0 |
||
) |
Get the voxel with a given index.
In case the voxel is not in the map it returns an empty voxel.
LCCollectionVec * marlintpc::VoxelTPC::getVoxelCollection | ( | double | outputLength = -1 | ) |
Returns an LCCollectionVec of the stored TPCVoxels.
This vector is newly taken from the heap so it can be given to an event, which takes over the ownership. Be careful to delete it and all the voxels it contains if you don't add it to the event! Returns a pointer on the collection which contains all voxels with a zBin below or equal to the given outputLength. Default outputLength is -1. If outputLength is negative all voxels in the map are returned.
Referenced by marlintpc::IonBackDriftProcessor::processEvent(), and marlintpc::IonsInVoxelsProcessor::processEvent().
std::list< std::pair< VoxelTPC::VoxelIndex, int > > * marlintpc::VoxelTPC::getVoxelList | ( | double | outputLength = -1 , |
bool | erase = false |
||
) |
This function works like getVoxelCollection, but the output format is different.
This is to keep the memory footprint low by bypassing the LCIO interface of a processor.
void marlintpc::VoxelTPC::putChargeInVoxel | ( | TPCVoxel const & | voxel | ) |
Puts the charge into the voxel.
If the voxel does not have charge yet it is added to the map, otherwise the charge is added to the existing entry for the voxel. Smearing is done in the x,y-plane according to transversal diffusion and if wanted also in z according to longitudinal diffusion
References marlintpc::TPCVoxel::getCharge(), marlintpc::TPCVoxel::getModuleID(), marlintpc::TPCVoxel::getPadIndex(), and marlintpc::TPCVoxel::getTimeIndex().
Referenced by marlintpc::IonBackDriftProcessor::processEvent(), and marlintpc::IonsInVoxelsProcessor::processEvent().
void marlintpc::VoxelTPC::putChargeInVoxel | ( | int | padIndex, |
double | zLength, | ||
int | charge, | ||
int | moduleID = 0 |
||
) |
Convenience function for putChargeInVoxel( TPCVoxel const &voxel).
It determines the zBin corresponding to the given z length and then puts charge in voxel with given padIndex and zBin
void marlintpc::VoxelTPC::putChargeInVoxels | ( | SimTrackerHit * | hit, |
double | sigmaTrans, | ||
double | sigmaLong = 0 |
||
) |
Distributes the charge onto the pads assuming a 2D Gaussian distribution with the width sigmaTrans.
The charge is deposited in the according voxels with the zBin in arbitrry units, which can be chosen by the user e.g. drift time or a length scale. The zBin can be smeared with a Gaussian with width sigmaLong. By default sigmaLong is 0 and the charge is not distributed in z. This is useful in case of single electrons which have been amplified in a GEM. Here charge is distributed in xy, but the distribution in z is negligible.
Referenced by marlintpc::MokkaToVoxelProcessor::processEvent(), and marlintpc::ChargeDistributionProcessor::processEvent().
void marlintpc::VoxelTPC::removeVoxel | ( | TPCVoxel const & | voxel | ) |
Removes a voxel from the set.
It removes the corresponding voxel in the map, not the object which is passed to this function.
References marlintpc::TPCVoxel::getModuleID(), marlintpc::TPCVoxel::getPadIndex(), and marlintpc::TPCVoxel::getTimeIndex().
void marlintpc::VoxelTPC::removeVoxels | ( | std::vector< TPCVoxel > const & | voxelVec | ) |
Removes voxels in vector from the set.
It removes the corresponding voxels in the map, not the objects in the vector.
|
protected |
Map to store the information contained in the voxels.
padIndex and zBin are used in a struct as key. The map sorted first by the zBin then by the padIndex. the charge contained in the voxel is the map data.