9#ifndef FADC_APV_MAPPER_H_
10#define FADC_APV_MAPPER_H_
12#include <vxd/dataobjects/VxdID.h>
13#include <svd/dataobjects/SVDShaperDigit.h>
14#include <boost/property_tree/ptree.hpp>
15#include <unordered_map>
16#include <unordered_set>
49 {
m_id.parts.FADC = FADC;
m_id.parts.APV25 = APV25; }
104 {
m_ID.PARTS.layer = layer;
m_ID.PARTS.ladder = ladder;
m_ID.PARTS.dssd = dssd;
m_ID.PARTS.side = side; }
169 unsigned char channel,
short samples[6],
float time = 0.0);
187 bool isAPVinMap(
unsigned short layer,
unsigned short ladder,
unsigned short dssd,
bool side,
unsigned short strip);
227 const ChipInfo&
getChipInfo(
unsigned short layer,
unsigned short ladder,
unsigned short dssd,
bool side,
unsigned short strip);
235 {
return (info.m_channel0 + ((
unsigned short)channel) * (info.m_parallel ? 1 : -1)); }
245 typedef std::unordered_map<unsigned short, unsigned short>
FADCmap;
260 void ReadLayer(
int nLayer, boost::property_tree::ptree
const& xml_layer);
264 void ReadLadder(
int nLayer,
int nLadder, boost::property_tree::ptree
const& xml_ladder);
268 void ReadSensor(
int nLayer,
int nLadder,
int nSensor, boost::property_tree::ptree
const& xml_sensor);
273 void ReadSensorSide(
int nLayer,
int nLadder,
int nSensor,
bool isU, boost::property_tree::ptree
const& xml_side);
281 std::unordered_map< ChipID::baseType, SensorInfo >
m_sensors;
282 std::unordered_map< SensorID::baseType, std::vector<ChipInfo> >
m_chips;
294 int nlayer,
int nladder,
int nsensor,
bool isU,
295 unsigned short stripNumberCh0,
302 unsigned short stripNumberCh0,
Class to hold FADC+APV25 numbers.
chipNumberType getAPV25() const
Get APV25 number.
void setAPV25(chipNumberType APV25)
Set APV25 number.
ChipID & operator=(baseType id)
Assignment from base type.
baseType getID() const
Get chip ID.
chipNumberType getFADC() const
Get FADC number.
unsigned char chipNumberType
Type of chip numbers.
ChipID(baseType id=0)
Constructor taking a compound id.
void setFADC(chipNumberType FADC)
Set FADC number.
bool operator<(const ChipID &other) const
ordering
struct Belle2::SVDOnlineToOfflineMap::ChipID::@250::@251 parts
Alternative struct representation.
ChipID(chipNumberType FADC, chipNumberType APV25)
Constructor taking chip numbers.
void setID(baseType id)
Set chip ID.
unsigned short baseType
Typedefs of the compound id type and chip number types.
ChipID & operator=(ChipID other)
Assignment from same type.
ChipID(const ChipID &other)
Copy ctor.
bool operator==(const ChipID &other) const
equality
union Belle2::SVDOnlineToOfflineMap::ChipID::@250 m_id
Union type representing the ChipID compound.
Class to hold numbers related to sensor.
SensorID & operator=(baseType id)
check if VxdID is the same or not
struct Belle2::SVDOnlineToOfflineMap::SensorID::@252::@253 PARTS
Alternative struct representation.
unsigned short baseType
Typedefs of the compound id type and chip number types.
SensorID(baseType id=0)
Constructor taking a compound id.
union Belle2::SVDOnlineToOfflineMap::SensorID::@252 m_ID
Union type representing the SensorID compound.
unsigned short sensorNumberType
Type of chip numbers.
SensorID(sensorNumberType layer, sensorNumberType ladder, sensorNumberType dssd, bool side)
Constructor taking sensor info.
This class implements the methods to map raw SVD hits to basf2 SVD hits.
unsigned short getFADCboardsNumber()
get the num,ner of FADC boards
void prepareListOfMissingAPVs()
prepares the list of the missing APVs using the channel mapping
std::unordered_map< unsigned short, unsigned short > FADCmap
FADC map typedef.
const SensorInfo & getSensorInfo(unsigned char FADC, unsigned char APV25)
Get SensorInfo for a given FADC/APV combination.
SensorInfo m_currentSensorInfo
current sensor info
int getNumberOfMissingAPVs()
Get number of missing APVs.
void ReadSensor(int nLayer, int nLadder, int nSensor, boost::property_tree::ptree const &xml_sensor)
Read from the ptree xml_sensor the sensor nSensor in ladder nLadder in layer nLayer.
SVDShaperDigit * NewShaperDigit(unsigned char FADC, unsigned char APV25, unsigned char channel, short samples[6], float time=0.0)
Return a pointer to a new SVDShpaerDigit whose VxdID, isU and cellID is set.
std::unordered_multimap< unsigned char, unsigned char > APVforFADCmap
map containing FADC numbers assigned to multiple APVs, from xml file
int m_errorRate
The suppression factor of BadMapping ERRORs messages to be shown.
const ChipInfo & getChipInfo(unsigned short layer, unsigned short ladder, unsigned short dssd, bool side, unsigned short strip)
Get ChipInfo for a given layer/ladder/dssd/side/strip combination.
unsigned int nBadMappingErrors
Counter of the BadMapping errors.
SVDOnlineToOfflineMap()=delete
No default constructor.
std::unordered_map< ChipID::baseType, SensorInfo > m_sensors
m_sensors[ChipID(FADC,APV25)] gives the SensorInfo for the given APV25 on the given FADC (Unpacker)
void ReadLadder(int nLayer, int nLadder, boost::property_tree::ptree const &xml_ladder)
Read from the ptree xml_ladde the ladder nLadder in layer nLayer.
std::unordered_set< unsigned char > FADCnumbers
container for FADC numbers from current mapping file
void addChip(unsigned char chipN, unsigned char FADCn, unsigned short stripNumberCh0, bool isParallel)
add chipN on FADCn to the map
ChipInfo m_currentChipInfo
internal instance of chipinfo used by the getter
void ReadLayer(int nLayer, boost::property_tree::ptree const &xml_layer)
Read from the ptree v in the xml file the layer nLayer.
std::string m_MapUniqueName
Human readable unique name of this map.
std::unordered_map< SensorID::baseType, std::vector< ChipInfo > > m_chips
needed for the packer, map of VxdID to chips
void ReadSensorSide(int nLayer, int nLadder, int nSensor, bool isU, boost::property_tree::ptree const &xml_side)
Read from the ptree xml_side the U-side, if isU, (the V-side otherwise) of the sensor nSensor in ladd...
void addChip(unsigned char chipN, unsigned char FADCn, int nlayer, int nladder, int nsensor, bool isU, unsigned short stripNumberCh0, bool isParallel)
add chipN on FADCn to the map
void prepFADCmaps(FADCmap &, FADCmap &)
function that maps FADC numbers as 0-(nFADCboards-1) from FADCnumbers unordered_set
bool isAPVinMap(unsigned short layer, unsigned short ladder, unsigned short dssd, bool side, unsigned short strip)
is the APV of the strips in the map? for a given layer/ladder/dssd/side/strip combination.
void setErrorRate(int errorRate)
Setter for suppression factor given by the Unpacker.
short getStripNumber(unsigned char channel, const SensorInfo &info) const
Convert APV channel number to a strip number using a ChipInfo object.
std::vector< missingAPV > m_missingAPVs
list of the missing APVs
The SVD ShaperDigit class.
Class to uniquely identify a any structure of the PXD and SVD.
Abstract base class for different kinds of events.
Struct to hold data about an APV25 chip.
unsigned short fadc
fadc number
unsigned short stripLast
last strip number
unsigned char apv
apv number
unsigned short stripFirst
first strip number
unsigned char apvChannel
apv channel
Struct to hold data about a sensor.
bool m_uSide
True if u-side of the sensor.
unsigned short m_channel127
Strip corresponding to channel 127.
bool m_parallel
False if numbering is reversed.
unsigned short m_channel0
Strip corresponding to channel 0.
VxdID m_sensorID
Sensor ID.
struct to hold missing APVs informations
float m_halfStrip
floating strip in the middle of the APV
VxdID m_sensorID
Sensor ID.
bool m_isUSide
True if u-side of the sensor.