Commit a1bafede authored by James William Howarth's avatar James William Howarth Committed by Graeme Stewart
Browse files

'Fix for CMT issues' (TrigFTK_RawData-01-00-06)

parent 41c0bccf
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGFTK_RAWDATA_FTK_RAWPIXELCLUSTER_H
#define TRIGFTK_RAWDATA_FTK_RAWPIXELCLUSTER_H
#include <stdint.h>
#include "CLIDSvc/CLASS_DEF.h"
class FTK_RawPixelCluster {
private:
uint32_t m_word_a;
uint32_t m_word_b;
int m_layer;
signed long m_barcode;
public:
FTK_RawPixelCluster();
FTK_RawPixelCluster(int);
FTK_RawPixelCluster( uint32_t, uint32_t, int);
virtual ~FTK_RawPixelCluster();
void setWordA(uint32_t word_a){ m_word_a = word_a;}
void setWordB(uint32_t word_b){ m_word_b = word_b;}
void setLayer(int layer){ m_layer = layer;}
void setColWidth(unsigned int col_width);
void setRowWidth(unsigned int row_width);
void setColCoord(float col_coord);
void setRowCoord(float row_coord);
void setBarcode(signed long barcode){ m_barcode = barcode;}
void setModuleID(unsigned int module_id);
uint32_t getWordA() const { return m_word_a;}
uint32_t getWordB() const { return m_word_b;}
int getLayer() const { return m_layer;}
int getColWidth() const;
int getRowWidth() const;
float getColCoord() const;
float getRowCoord() const;
signed long getBarcode() const {return m_barcode;}
unsigned int getModuleID() const;
};
CLASS_DEF( FTK_RawPixelCluster , 121694371 , 1 )
#endif // TRIGFTK_RAWDATA_FTK_RAWPIXELCLUSTER_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGFTK_RAWDATA_FTK_RAWSCT_CLUSTER_H
#define TRIGFTK_RAWDATA_FTK_RAWSCT_CLUSTER_H
#include <stdint.h>
#include "CLIDSvc/CLASS_DEF.h"
class FTK_RawSCT_Cluster {
private:
uint32_t m_word;
int m_layer;
signed long m_barcode;
public:
FTK_RawSCT_Cluster();
FTK_RawSCT_Cluster(int);
FTK_RawSCT_Cluster(uint32_t, signed long, int);
virtual ~FTK_RawSCT_Cluster();
void setBarcode(signed long barcode){ m_barcode = barcode;}
void setLayer(int layer){ m_layer = layer;}
void setWord(uint32_t word){ m_word = word;}
void setHitCoord(float hit_coord);
void setHitWidth(unsigned int hit_width);
void setModuleID(unsigned int module_id);
uint32_t getWord() const { return m_word;}
int getLayer() const { return m_layer;}
signed long getBarcode() const { return m_barcode;}
float getHitCoord() const;
unsigned int getHitWidth() const;
unsigned int getModuleID() const;
};
CLASS_DEF( FTK_RawSCT_Cluster , 178057777 , 1 )
#endif // TRIGFTK_RAWDATA_FTK_RAWSCT_CLUSTER_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGFTK_RAWDATA_FTK_RAWTRACK_H
#define TRIGFTK_RAWDATA_FTK_RAWTRACK_H
/**************************************************************
NAME: FTK_RawTrack.h
PACKAGE: atlasoff/Trigger/TrigFTK/TrigFTK_RawData
AUTHORS: James Howarth
CREATED: February 2014
PURPOSE: A base class for RAW FTK tracks.
Based on proposed format by Jinlong Zhang.
**************************************************************/
#include <stdint.h>
#include "CLIDSvc/CLASS_DEF.h"
#include "TrigFTK_RawData/FTK_RawSCT_Cluster.h"
#include "TrigFTK_RawData/FTK_RawPixelCluster.h"
//#define NPIXLAYERS 4
//#define NSCTLAYERS 8 //0,2,4,6 = Axial, 1,3,5,7 = Stero
class FTK_RawTrack {
private:
uint32_t m_word_th1;
uint32_t m_word_th2;
uint32_t m_word_th3;
uint32_t m_word_th4;
uint32_t m_word_th5;
std::vector<FTK_RawPixelCluster> m_pix_clusters;
std::vector<FTK_RawSCT_Cluster> m_sct_clusters;
signed long m_barcode;
static const int npixlayers = 4;
static const int nsctlayers = 8;
static const int sixteen_bit_offset = 32767; // 2**15 -1
static const float d0_precision;
static const float z0_precision;
static const float phi_precision;
static const float curv_precision;
static const float cot_precision;
public:
FTK_RawTrack();
FTK_RawTrack(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
FTK_RawTrack(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, const std::vector<FTK_RawPixelCluster>&, const std::vector<FTK_RawSCT_Cluster>&);
~FTK_RawTrack();
float getD0() const;
float getZ0() const;
float getPhi() const;
double getCotTh() const;
double getCurv() const;
uint32_t getRoadID() const {return m_word_th1; }
uint32_t getTH1() const {return m_word_th1; }
uint32_t getTH2() const {return m_word_th2; }
uint32_t getTH3() const {return m_word_th3; }
uint32_t getTH4() const {return m_word_th4; }
uint32_t getTH5() const {return m_word_th5; }
uint32_t getPixelWordA( int ) const;
uint32_t getPixelWordB( int ) const;
uint32_t getPixelBarcode( int ) const;
uint32_t getSCTWord( int ) const;
uint32_t getSCTBarcode( int ) const;
signed long getBarcode() const {return m_barcode; }
int return_bits(int low, int high, uint32_t word) const;
FTK_RawPixelCluster& getPixelCluster( int );
FTK_RawSCT_Cluster& getSCTCluster( int );
const FTK_RawPixelCluster& getPixelCluster( int ) const;
const FTK_RawSCT_Cluster& getSCTCluster( int ) const;
std::vector<FTK_RawPixelCluster>& getPixelClusters() { return m_pix_clusters;}
std::vector<FTK_RawSCT_Cluster>& getSCTClusters() { return m_sct_clusters;}
const std::vector<FTK_RawPixelCluster>& getPixelClusters() const { return m_pix_clusters;}
const std::vector<FTK_RawSCT_Cluster>& getSCTClusters() const { return m_sct_clusters;}
void setRoadID(int v) { m_word_th1 = v; }
void setTH1(uint32_t v) { m_word_th1 = v; }
void setTH2(uint32_t v) { m_word_th2 = v; }
void setTH3(uint32_t v) { m_word_th3 = v; }
void setTH4(uint32_t v) { m_word_th4 = v; }
void setTH5(uint32_t v) { m_word_th5 = v; }
void setD0(float);
void setZ0(float);
void setPhi(float);
void setCotTh(float);
void setCurv(float);
void setPixelCluster( FTK_RawPixelCluster );
void setSCTCluster( FTK_RawSCT_Cluster );
void setPixelClusters( std::vector<FTK_RawPixelCluster> );
void setSCTClusters( std::vector<FTK_RawSCT_Cluster> );
void setBarcode(signed long barcode) { m_barcode = barcode; }
};
CLASS_DEF( FTK_RawTrack , 239377431 , 1 )
#endif // TRIGFTK_RAWDATA_FTK_RAWTRACK_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FTK_RAWTRACKCONTAINER_H
#define FTK_RAWTRACKCONTAINER_H
/**************************************************************
NAME: FTK_RawTrackContainer.h
PACKAGE: atlasoff/Trigger/TrigFTK/TrigFTKRaw
AUTHORS: James Howarth
CREATED: February 2014
PURPOSE: A container for a collection of FTK_RawTrack objects.
Based on code from Trigger/TrigEvent/TrigMuonEFContainer.h
**************************************************************/
#include "DataModel/DataVector.h"
#include "SGTools/BaseInfo.h"
#include "TrigFTK_RawData/FTK_RawTrack.h" // Change this once added to svn
typedef DataVector<FTK_RawTrack> FTK_RawTrackContainer;
CLASS_DEF( FTK_RawTrackContainer , 1294480537 , 1 )
//SG_BASE(FTK_RawTrackContainer, DataVector<FTK_RawTrack>);
#endif // FTK_RAWTRACKCONTAINER
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TrigFTK_RawDataDict_h
#define TrigFTK_RawDataDict_h 1
#include "TrigFTK_RawData/FTK_RawTrack.h"
#include "TrigFTK_RawData/FTK_RawPixelCluster.h"
#include "TrigFTK_RawData/FTK_RawSCT_Cluster.h"
#include "TrigFTK_RawData/FTK_RawTrackContainer.h"
#endif //> not TrigFTKEventPoolDict_h
<lcgdict>
<class name="FTK_RawTrack" id="60581BB5-6510-4837-8572-6316F7676C5F"/>
<class name="FTK_RawPixelCluster" id="5B916D3D-6371-4649-8B97-29C5F1BC572F"/>
<class name="FTK_RawSCT_Cluster" id="90C9ED08-3B76-4AFB-A1E6-E69DD06FB1AA"/>
<class name="FTK_RawTrackContainer" id="193F7fA2-E650-4E0B-9F67-4311D2E72346"/>
</lcgdict>'
package TrigFTK_RawData
author Jay Howarth <jhowarth@cern.ch>
use AtlasPolicy AtlasPolicy-*
use AtlasROOT AtlasROOT-* External
use CLIDSvc CLIDSvc-* Control
use DataModel DataModel-* Control
use SGTools SGTools-* Control
private
use AtlasROOT AtlasROOT-* External
end_private
library TrigFTK_RawData *.cxx
apply_pattern installed_library
private
use AtlasReflex AtlasReflex-* External -no_auto_imports
apply_pattern lcgdict dict=TrigFTK_RawData \
selectionfile=selection.xml \
headerfiles="../TrigFTK_RawData/TrigFTK_RawDataDict.h" \
dataLinks="FTK_RawTrack FTK_RawPixelCluster FTK_RawSCT_Cluster" \
elementLinks="FTK_RawTrackContainer"
\ No newline at end of file
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "TrigFTK_RawData/FTK_RawPixelCluster.h"
#include <iostream>
#define NINT(a) ((a) >= 0.0 ? (int)((a)+0.5) : (int)((a)-0.5))
using namespace std;
FTK_RawPixelCluster::FTK_RawPixelCluster():
m_word_a(0),
m_word_b(0),
m_layer(-1),
m_barcode(0)
{
// nothing to do
}
FTK_RawPixelCluster::FTK_RawPixelCluster(int i):
m_word_a(0),
m_word_b(0),
m_barcode(0)
{
m_layer = i;
}
FTK_RawPixelCluster::FTK_RawPixelCluster(uint32_t word_a, uint32_t word_b, int layer){
m_word_a = word_a;
m_word_b = word_b;
m_layer = layer;
m_barcode = 0;
}
FTK_RawPixelCluster::~FTK_RawPixelCluster()
{
// nothing to do
}
void FTK_RawPixelCluster::setColWidth(unsigned int col_width){
float range_top = 9.;
float range_bot = 0.;
if(col_width > range_bot && col_width < range_top){
uint32_t width = col_width;
width = width << 26;
m_word_b = width | m_word_b;
}
return;
}
void FTK_RawPixelCluster::setColCoord(float col_coord){
if (m_layer == -1){
std::cout << "ERROR: You have not set the layer for this Pixel Cluster, col coord not set" << std::endl;
return;
}
float multiplier = 10.;
float range_top = 144.;
float range_bot = 0.;
int position = 14;
if (m_layer == 0){ // IBL has higher precision
multiplier = 10.;
range_top = 166.;
range_bot = 0.;
}
uint32_t coord = 0;
if(col_coord > range_bot && col_coord < range_top){
coord = NINT( multiplier*col_coord);
coord = coord << position;
m_word_b = (coord | m_word_b);
}
return;
}
void FTK_RawPixelCluster::setRowWidth(unsigned int row_width){
float multiplier = 1.; // Range multiplier
float range_top = 5.;
float range_bot = 0.;
int offset = -1; // If you want to include -ve numbers it should be 2^n-1 where n is the number of bits
int position = 12; // Position along the 32-bit word
uint32_t width = 0;
if(row_width > range_bot && row_width < range_top)
width = NINT( multiplier*row_width + offset);
width = width << position;
m_word_b = (width | m_word_b);
return;
}
void FTK_RawPixelCluster::setRowCoord(float row_coord){
if (m_layer == -1){
std::cout << "ERROR: You have not set the layer for this Pixel Cluster, row coord not set" << std::endl;
return;
}
float multiplier = 10.;
int range_top = 328;
int range_bot = 0;
int offset = 0;
int position = 0;
if (m_layer == 0){ // IBL has higher precision
multiplier = 10.;
range_top = 336;
range_bot = 0.;
offset = 0;
}
uint32_t coord = 0;
if( (row_coord > range_bot) && (row_coord < range_top)){
coord = NINT( multiplier*row_coord + offset);
}
coord = coord << position;
m_word_b = (coord | m_word_b);
return;
}
unsigned int FTK_RawPixelCluster::getModuleID() const{
uint32_t id = (m_word_a << 20) >> 20;
return id;
}
void FTK_RawPixelCluster::setModuleID(unsigned int module_id){
uint32_t id = module_id;
id = (id << 20) >> 20;
m_word_a = (id | m_word_a);
return;
}
float FTK_RawPixelCluster::getColCoord() const{
float multiplier = 10.;
uint32_t col = 0;
col = col | ((m_word_b << 6) >> 20);
float col_coord = ((float)(col)/multiplier);
return col_coord;
}
float FTK_RawPixelCluster::getRowCoord() const {
float multiplier = 10.;
int offset = 0;
int position = 0;
uint16_t row = 0;
row = row | (m_word_b >> position);
row = row << 4;
row = row >> 4; // last bit should always be 0 so we probably don't need this
float row_coord = (((float)(row - offset))/multiplier);
return row_coord;
}
int FTK_RawPixelCluster::getColWidth() const {
uint32_t col = ((m_word_b << 3) >> 29);
return (int)col;
}
int FTK_RawPixelCluster::getRowWidth() const {
float multiplier = 1.; // Range multiplier
float range_top = 5.;
float range_bot = 1.;
int offset = -1; // If you want to include -ve numbers it should be 2^n-1 where n is the number of bits
int position = 12; // Position along the 32-bit word}
uint16_t row = 0;
row = row | (m_word_b >> position);
row = row << 14;
row = row >> 14;
int row_width = (int)((row - offset)/multiplier);
return row_width;
}
#if defined(__MAKECINT__)
#pragma link C++ class FTK_RawPixelCluster;
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "TrigFTK_RawData/FTK_RawSCT_Cluster.h"
#include <iostream>
#define NINT(a) ((a) >= 0.0 ? (int)((a)+0.5) : (int)((a)-0.5))
using namespace std;
FTK_RawSCT_Cluster::FTK_RawSCT_Cluster() :
m_word(0),
m_layer(-1),
m_barcode(0)
{
// nothing to do
}
FTK_RawSCT_Cluster::FTK_RawSCT_Cluster(int i) :
m_word(0),
m_barcode(0)
{
m_layer = i;
}
FTK_RawSCT_Cluster::FTK_RawSCT_Cluster(uint32_t word, signed long barcode, int layer)
{
m_word = word;
m_layer = layer;
m_barcode = barcode;
}
FTK_RawSCT_Cluster::~FTK_RawSCT_Cluster()
{
// nothing to do
}
float FTK_RawSCT_Cluster::getHitCoord() const{
uint32_t hit = (m_word << 9) >> 21;
return (float)hit;
}
unsigned int FTK_RawSCT_Cluster::getHitWidth() const{
unsigned int width = (m_word << 6) >> 29;
width = width - 1;
return width;
}
unsigned int FTK_RawSCT_Cluster::getModuleID() const{
/// module id is bit 0->11 (12-bit) ///
uint32_t module_id = m_word << 20;
module_id = module_id >> 20;
return module_id;
}
void FTK_RawSCT_Cluster::setHitCoord( float hit_coord ){
/// Hit Coord is bits 12->22 (11-bit) ///
float range_top = 768.; // Axial is 768, stereo is 767.
float range_bot = 0.;
uint32_t hit = 0;
if ( hit_coord > range_bot && hit_coord < range_top ){
hit = NINT(hit_coord);
hit = hit << 12;
m_word = (hit | m_word);
}
return;
}
void FTK_RawSCT_Cluster::setHitWidth( unsigned int hit_width ){
float range_top = 9.;
float range_bot = 0.;
int offset = 1;
int position = 23;
uint32_t width = 0;
if(hit_width > range_bot && hit_width < range_top){
width = NINT( hit_width + offset);
width = width << position;
m_word = (width | m_word);
}
return;
}
void FTK_RawSCT_Cluster::setModuleID( unsigned int module_id ){
uint32_t id = module_id;
m_word = (id | m_word);
return;
}
/*void FTK_RawSCT_Cluster::setHitStereo(float hit_stereo){
float multiplier = 1.;
float range_top = 767.;
float range_bot = 0.;
int offset = 0;
int position = 0;
uint32_t hit = 0;
if(hit_stereo > range_bot && hit_stereo < range_top)
hit = NINT( multiplier*hit_stereo + offset);
hit = hit << position;
m_word = (hit | m_word);