diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/STTrack.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/STTrack.h new file mode 100755 index 0000000000000000000000000000000000000000..c76e54c8a416921d801edf8663a3cff75dd93ac0 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/STTrack.h @@ -0,0 +1,311 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef STTRACK_H +#define STTRACK_H + +#include <vector> +#include <set> +#include <map> +#include <list> + +class TrigSiSpacePoint; + + + +/****************************************************************/ +/****************************************************************/ +/** class STRoad **/ +/****************************************************************/ +/****************************************************************/ + +class STRoad { + + public: + + STRoad() : lay1(100), lay2(100) {} + + // STRoad() {} + + ~STRoad() {} + + + public: + + int lay1, lay2; + + std::set<int> lay3; + +}; + + + +/****************************************************************/ +/****************************************************************/ +/** class STSeed **/ +/****************************************************************/ +/****************************************************************/ + +class STSeed { + + public: + + STSeed() : deleted(false) { + for(unsigned int i=0; i<19; i++) {layer[i]=false; phiext[i]=1000;} + } + ~STSeed() {} + + public: + + // Track parameters + float eta, phi, d02, z; + bool deleted; + + // Space points + const TrigSiSpacePoint *sp1, *sp2; + + // Seed cut quantities + float dr; // m_seedingPreCutRZ + float z0; // m_vertexingCutRZ + float z12; + float dphi; // m_seedingPreCutPhi + float phi0; // m_seedingPreCutRPhi + + // Cached selection information + float costheta; + float deltax12; + float deltay12; + float deltaz12; + float deltar12; + + // Extrapolation information + bool layer[19]; + float xext[19]; + float yext[19]; + float zext[19]; + float rext[19]; + float dzext[19]; + float drext[19]; + float phiext[19]; + float dphiext[19]; +}; + + + +/****************************************************************/ +/****************************************************************/ +/** class STTriplet **/ +/****************************************************************/ +/****************************************************************/ + +class STTriplet { + + public: + + STTriplet() : deleted(false) {} + ~STTriplet() {} + + public: + + // Track parameters + float eta, phi, d0, pt, z0; + float chi2; + bool deleted; + + // Space points + const TrigSiSpacePoint *sp1, *sp2, *sp3; + + // Seed cut quantities + float dr; // m_seedingPreCutRZ + float dphi; // m_seedingPreCutPhi + float phi0; // m_seedingPreCutRPhi + float drz; + float drp; +}; + + + +/****************************************************************/ +/****************************************************************/ +/** class STTrack **/ +/****************************************************************/ +/****************************************************************/ + +class STTrack { + + public: + + STTrack() : deleted(false), merged(false), removed(false) { + for(unsigned int i=0; i<19; i++) { + sp[i]=sp2[i]=0; + tr[i]=tr2[i]=0; + spDistance[i]=10000; spShared[i]=0; + spRej[i]=spRej2[i]=0; + chi2=0; + } + } + ~STTrack() {} + + public: + + // Track parameters + float eta, phi; + float chi2; + bool deleted, merged, removed; + + // Space points + const TrigSiSpacePoint* sp[19]; + const TrigSiSpacePoint* sp2[19]; + const STTriplet* tr[19]; + const STTriplet* tr2[19]; + int spRej[19]; + int spRej2[19]; + + int spShared[19]; + int sumSp; + int sumSpAll; + + // Distances + float spDistance[19]; + float sumSpDistance; + + public: + + void evaluateSum() { + sumSp=0; sumSpAll=0; sumSpDistance=0.0; + for(unsigned int i=0; i<19; i++) { + if(sp[i]!=0) { + sumSp++; + sumSpAll++; + sumSpDistance += spDistance[i]; + } + if(sp2[i]!=0) { + sumSpAll++; + } + } + } + + + float evaluateSharedFraction() { + int total=0, shared=0; + for(unsigned int i=0; i<19; i++) { + if(sp[i]!=0) { + total++; + shared += spShared[i]; + } + } + return ((float)shared/total); + } + + + void resetDistance() { + for(unsigned int i=0; i<19; i++) {spDistance[i]=0;} + } + + + friend bool operator<(const STTrack &t1, const STTrack &t2) { + + // Count space points + int sp1=0, sp2=0; + int lay1=0, lay2=0; + for(unsigned int i=0; i<19; i++) { + if(t1.sp[i]!=0) {sp1++; lay1++;} + if(t2.sp[i]!=0) {sp2++; lay2++;} + if(t1.sp2[i]!=0) sp1++; + if(t2.sp2[i]!=0) sp2++; + } + if(t1.deleted) lay1=0; + if(t2.deleted) lay2=0; + + // Evaluate bool relations + bool isLayBetter = (lay1 > lay2); + bool isLayEqual = (lay1 == lay2); + bool isSpBetter = (sp1 > sp2); + bool isSpEqual = (sp1 == sp2); + bool isChi2Better = (t1.chi2 < t2.chi2); + + // Check if first track is better + return (isLayBetter || (isLayEqual&&isSpBetter)|| (isLayEqual&&isSpEqual&&isChi2Better)); + } + +}; + + + +/****************************************************************/ +/****************************************************************/ +/** class STPattern **/ +/****************************************************************/ +/****************************************************************/ + +class STPattern { + + public: + + STPattern() {} + ~STPattern() {} + + public: + + STRoad* road; + STSeed* seed; + std::list<STTriplet*> triplets; + STTrack* track; + + + friend bool operator<(const STPattern &t1, const STPattern &t2) { + return ((*(t1.track))<(*(t2.track))); + } + +}; + + +struct STPatternCompare : public std::binary_function<STPattern*, STPattern*, bool> { + bool operator()(const STPattern *t1, const STPattern *t2) const { + return ((*(t1->track))<(*(t2->track))); + }; +}; + + + +/****************************************************************/ +/****************************************************************/ +/** class STTrk **/ +/****************************************************************/ +/****************************************************************/ + +class STTrk { + + public: + + STTrk() : triplet_num(0), deleted(false) {} + ~STTrk() {} + + public: + + // General parameters + float z0; + + // Seed parameters + const TrigSiSpacePoint *seed_sp1, *seed_sp2; + float seed_z0, seed_eta, seed_phi; + + // Triplet parameters + unsigned int triplet_num; + std::vector<const TrigSiSpacePoint*> triplet_sp3; + std::vector<float> triplet_eta; + std::vector<float> triplet_phi; + std::vector<float> triplet_chi2; + std::vector<float> triplet_pt; + std::vector<float> triplet_d0; + + // Track parameters + STTrack *track; + + // Processing parameters + bool deleted; + +}; + +#endif // TrigSiTrack_STTrack_H diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto.h new file mode 100644 index 0000000000000000000000000000000000000000..40b3a7232b4d22c45335438c6cc55f7a552f42a3 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto.h @@ -0,0 +1,84 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGHISTO_H +#define TRIGINDETEVENT_TRIGHISTO_H + +#include <vector> + +//--------------------------------------------------------------- + +namespace TrigHistoCutType { + enum CutTypeEnum { + BELOW_X, + ABOVE_X, + BELOW_X_BELOW_Y, + ABOVE_X_BELOW_Y, + BELOW_X_ABOVE_Y, + ABOVE_X_ABOVE_Y}; +} + +//--------------------------------------------------------------- + +/** @class TrigHisto + * + * @author W. H. Bell <W.Bell@cern.ch> + * + * @brief The base class for TrigHisto1D and TrigHisto2D. This class + * should never be stored or used directly. + * + */ +class TrigHisto { + public: + TrigHisto(void); + virtual ~TrigHisto(void); + + /** Zero all histogram bins */ + void clear(void); + + /** Return the number of bins along the y-axis, not + * including the under and overflow. */ + unsigned int nbins_x(void) { + return m_nbins_x; + } + + /** Return the minimum along the x-axis. */ + float min_x(void) { + return m_min_x; + } + + /** Return the maximum along the x-axis. */ + float max_x(void) { + return m_max_x; + } + + /** Return the bin contents of the histogram, including + * the under and overflow bins. */ + std::vector<float> contents(void) { + return m_contents; + } + + protected: + /** + * @return which bin this value corresponds to. + * (Supply bin limits such that it might be used for 1D or 2D derived class.) + */ + unsigned int findBin(unsigned int nbins, + float h_min, float h_max, float binSize, + float value); + + std::vector<float> m_contents; //<! A vector to contain the contents of the histogram. + std::vector<float>::iterator m_itr; + std::vector<float>::iterator m_itr_end; + + // Histogram limits + unsigned int m_nbins_x; + unsigned int m_underflowBin_x; + unsigned int m_overflowBin_x; + float m_min_x; + float m_max_x; + float m_binSize_x; +}; + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1D.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1D.h new file mode 100644 index 0000000000000000000000000000000000000000..7e15d762c75a0daf1d62aaffe5ebc14612b9ad25 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1D.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGHISTO1D_H +#define TRIGINDETEVENT_TRIGHISTO1D_H + +#include "CLIDSvc/CLASS_DEF.h" + +#include "TrigHisto.h" + +/** @class TrigHisto1D + * + * @author W. H. Bell <W.Bell@cern.ch> + * + * @brief A very basic one dimensional histogram to provide storage of + * HLT distributions, allowing constraints but preventing excessive + * memory usage for busy events. The histogram data is compressed + * during persistification according to the type of template + * instantiated. + * + */ +class TrigHisto1D: public TrigHisto { + public: + + /** Default constructor used by T/P converters. */ + TrigHisto1D(void); + + /** Standard constructor used by FEX algorithms. */ + TrigHisto1D(unsigned int nbins_x, float min_x, float max_x); + + /** Constructor used by TrigHisto2D */ + TrigHisto1D(unsigned int nbins_x, float min_x, float max_x, std::vector<float> contents); + + /** Destructor */ + virtual ~TrigHisto1D(void); + + /** Copy Constructor */ + TrigHisto1D(const TrigHisto1D& trigHisto); + + /** Assignment operator */ + TrigHisto1D& operator=(const TrigHisto1D& trigHisto); + + /** Fill a 1D histogram. */ + void fill(float value_x, float weight); + + /** Sum the number of entries within the cut range */ + double sumEntries(float value_x, int cutType); + +}; + +// obtained using clid -m "TrigHisto1D" etc +CLASS_DEF( TrigHisto1D , 11655925 , 1 ) + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1DContainer.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1DContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..a570a505171137f20a66c19d7a4425054b3144f1 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto1DContainer.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGHISTO1DCONTAINER_H +#define TRIGINDETEVENT_TRIGHISTO1DCONTAINER_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigHisto1D.h" +#include "SGTools/BaseInfo.h" + +/** @class TrigHistoContainer + * @author W. H. Bell <W.Bell@cern.ch> + * + * @brief Container of TrigHisto1D classes. + * + */ + +class TrigHisto1DContainer : public DataVector<TrigHisto1D> { }; + +// obtained using clid -m TrigHisto1DContainer +CLASS_DEF( TrigHisto1DContainer , 1218315511 , 1 ) + +SG_BASE(TrigHisto1DContainer, DataVector<TrigHisto1D>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2D.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2D.h new file mode 100644 index 0000000000000000000000000000000000000000..8a12295579881551ffb3a76753516da94347cfb4 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2D.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGHISTO2D_H +#define TRIGINDETEVENT_TRIGHISTO2D_H + +#include "CLIDSvc/CLASS_DEF.h" + +#include "TrigHisto.h" +#include "TrigHisto1D.h" + +/** @class TrigHisto2D + * + * @author W. H. Bell <W.Bell@cern.ch> + * + * @brief A very basic two dimensional histogram to provide storage of + * HLT distributions, allowing constraints but preventing excessive + * memory usage for busy events. The histogram data is compressed + * during persistification according to the type of template + * instantiated. + * + */ +class TrigHisto2D: public TrigHisto { + public: + + /** Default constructor used by T/P converters. */ + TrigHisto2D(void); + + /** Standard constructor used by FEX algorithms. */ + TrigHisto2D(unsigned int nbins_x, float min_x, float max_x, + unsigned int nbins_y, float min_y, float max_y); + + /** Destructor */ + virtual ~TrigHisto2D(void); + + /** Copy Constructor */ + TrigHisto2D(const TrigHisto2D& trigHisto); + + /** Assignment operator */ + TrigHisto2D& operator=(const TrigHisto2D& trigHisto); + + /** Fill a 2D histogram */ + void fill(float value_x, float value_y, float weight); + + /** Sum the number of entries within the cut range */ + double sumEntries(float value_x, float value_y, int cutType); + + /** Collapse the y-axis and return a profile from the x-axis */ + TrigHisto1D profileX(void); + + /** Collapse the x-axis and return a profile from the y-axis */ + TrigHisto1D profileY(void); + + /** Return the number of bins along the y-axis, not + * including the under and overflow. */ + unsigned int nbins_y(void) { + return m_nbins_y; + } + + /** Return the minimum along the y-axis. */ + float min_y(void) { + return m_min_y; + } + + /** Return the maximum along the y-axis. */ + float max_y(void) { + return m_max_y; + } + + + protected: + // The other dimension of histogram limits + unsigned int m_nbins_y; + unsigned int m_underflowBin_y; + unsigned int m_overflowBin_y; + float m_min_y; + float m_max_y; + float m_binSize_y; +}; + + +// obtained using clid -m "TrigHisto2D" +CLASS_DEF( TrigHisto2D , 10655800 , 1 ) + + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2DContainer.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2DContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..64b56a0d0ae6693b731d54aba62ee2e9d8a36a04 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigHisto2DContainer.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGHISTO2DCONTAINER_H +#define TRIGINDETEVENT_TRIGHISTO2DCONTAINER_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigHisto2D.h" +#include "SGTools/BaseInfo.h" + +/** @class TrigHistoContainer + * @author W. H. Bell <W.Bell@cern.ch> + * + * @brief Container of TrigHisto2D classes. + * + */ + +class TrigHisto2DContainer : public DataVector<TrigHisto2D> { }; + +// obtained using clid -m TrigHisto2DContainer +CLASS_DEF( TrigHisto2DContainer , 1261809248 , 1 ) + +SG_BASE(TrigHisto2DContainer, DataVector<TrigHisto2D>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetEventDict.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetEventDict.h new file mode 100755 index 0000000000000000000000000000000000000000..ffdfb197a6fba442e25aab076503125e770e527f --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetEventDict.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIG_INDET_DICT_H +#define TRIG_INDET_DICT_H + +#include "TrigInDetEvent/TrigInDetTrackFitPar.h" +#include "TrigInDetEvent/TrigInDetTrack.h" +#include "TrigInDetEvent/TrigTauTracksInfo.h" +#include "TrigInDetEvent/TrigTauTracksInfoCollection.h" +#include "TrigInDetEvent/TrigInDetTrackCollection.h" +#include "TrigInDetEvent/TrigVertex.h" +#include "TrigInDetEvent/TrigVertexCollection.h" +#include "TrigInDetEvent/TrigHisto.h" +#include "TrigInDetEvent/TrigHisto1D.h" +#include "TrigInDetEvent/TrigHisto1DContainer.h" +#include "TrigInDetEvent/TrigHisto2D.h" +#include "TrigInDetEvent/TrigHisto2DContainer.h" +#include "TrigInDetEvent/TrigSpacePointCounts.h" +#include "TrigInDetEvent/TrigSpacePointCountsCollection.h" +#include "TrigInDetEvent/TrigTrtHitCounts.h" +#include "TrigInDetEvent/TrigTrtHitCountsCollection.h" +#include "TrigInDetEvent/TrigTrackCounts.h" +#include "TrigInDetEvent/TrigTrackCountsCollection.h" +#include "TrigInDetEvent/TrigVertexCounts.h" +#include "TrigInDetEvent/TrigVertexCountsCollection.h" + +//namespace HLT::TrigInDetEventDict { +void dummyTriggerForTVCollTypedef(TrigVertexCollection a, + DataVector<TrigInDetTrackCollection> b, + DataVector<TrigInDetTrackFitPar> c, + DataVector<TrigVertexCollection> d, + DataVector<TrigSpacePointCounts> e, + DataVector<TrigSpacePointCountsCollection> f, + DataVector<TrigTrackCounts> g, + DataVector<TrigTrackCountsCollection> h, + DataVector<TrigTauTracksInfo> i, + DataVector<TrigTauTracksInfoCollection> j, + DataVector<TrigTrtHitCounts> k, + DataVector<TrigTrtHitCountsCollection> l, + DataVector<TrigHisto1D> m, + DataVector<TrigHisto1DContainer> n, + DataVector<TrigHisto2D> o, + DataVector<TrigHisto2DContainer> p, + DataVector<TrigVertexCounts> q, + DataVector<TrigVertexCountsCollection> r) { + TrigVertexCollection aa = a; + DataVector<TrigInDetTrackCollection> bb = b; + DataVector<TrigInDetTrackFitPar> cc = c; + DataVector<TrigVertexCollection> dd = d; + DataVector<TrigSpacePointCounts> ee = e; + DataVector<TrigSpacePointCountsCollection> ff = f; + DataVector<TrigTrackCounts> gg = g; + DataVector<TrigTrackCountsCollection> hh = h; + DataVector<TrigTauTracksInfo> ii = i; + DataVector<TrigTauTracksInfoCollection> jj = j; + DataVector<TrigTrtHitCounts> kk = k; + DataVector<TrigTrtHitCountsCollection> ll = l; + DataVector<TrigHisto1D> mm = m; + DataVector<TrigHisto1DContainer> nn = n; + DataVector<TrigHisto2D> oo = o; + DataVector<TrigHisto2DContainer> pp = p; + DataVector<TrigVertexCounts> qq = q; + DataVector<TrigVertexCountsCollection> rr = r; +} + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrack.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrack.h new file mode 100755 index 0000000000000000000000000000000000000000..87d7172deb56d79e6c3eb7a7125e7bfd24a2de83 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrack.h @@ -0,0 +1,223 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETTRACK_H +#define TRIGINDETTRACK_H +#include "CLIDSvc/CLASS_DEF.h" +#include "TrigInDetEvent/TrigSiSpacePoint.h" +#include "TrigInDetEvent/TrigInDetTrackFitPar.h" +#include "InDetPrepRawData/TRT_DriftCircle.h" +#include "Identifier/Identifier.h" +#include <map> +#include <ostream> +#include "GaudiKernel/MsgStream.h" + + +/** @class TrigInDetTrack + represents a LVL2 ID track + + param() : Track parameters (class TrigInDetTrackFitPar) at start of track + + endParam() : Optional Track parameters (class TrigInDetTrackFitPar) at end of track + + chi2() : \f$ \chi^2\f$ of the track fit divided by the number of degrees of freedom + + siSpacePoints() : vector of Si spacepoints (class TrigSiSpacePoint) + + trtDriftCircles() : vector of TRT hits associated with the track + + algorithmId() : author - an algorithm that's created the track, SiTrack = 1, IdScan = 2, TrtXK = 4 + +*/ + +class TrigInDetTrack { + + public: + enum AlgoId{NULLID=0, SITRACKID=1, IDSCANID=2, TRTLUTID=3, TRTXKID=4, STRATEGY_A_ID=5, STRATEGY_B_ID=6, STRATEGY_C_ID=7, + STRATEGY_F_ID=8, STRATEGY_G_ID=9, + STRATEGY_AB_ID=10, STRATEGY_BC_ID=11, STRATEGY_AC_ID=12, STRATEGY_FR_ID=13}; + + /** Constructors: POOL needs default constructor */ + TrigInDetTrack() : + // m_trkID(-1), + m_algId(NULLID), m_param(NULL), m_endParam(NULL), + m_chi2(-1.0), m_siSpacePoints(NULL), m_trtDriftCircles(NULL) + { + m_NStrawHits=-1; + m_NStraw=-1; + m_NStrawTime=-1; + m_NTRHits=-1; + m_NPixelSpacePoints=0; + m_NSCT_SpacePoints=0; + m_HitPattern=0; + }; + + /** Constructor with no space points or drift circles */ + TrigInDetTrack (const TrigInDetTrackFitPar* param, + const TrigInDetTrackFitPar* endParam=0, + const double chi2=0) : + // m_trkID(-1), + m_algId(NULLID),m_param(param), m_endParam(endParam), m_chi2(chi2), + m_siSpacePoints(NULL), m_trtDriftCircles(NULL) + { + m_NStrawHits=-1; + m_NStraw=-1; + m_NStrawTime=-1; + m_NTRHits=-1; + m_NPixelSpacePoints=0; + m_NSCT_SpacePoints=0; + m_HitPattern=0; + }; + + /** Constructor with a list of points */ + TrigInDetTrack (std::vector<const TrigSiSpacePoint*>* siSpacePoints, + const TrigInDetTrackFitPar* param = 0, + const TrigInDetTrackFitPar* endParam=0, + const double chi2=0) : + // m_trkID(-1), + m_algId(NULLID),m_param(param), m_endParam(endParam), m_chi2(chi2), + m_siSpacePoints(siSpacePoints), m_trtDriftCircles(NULL) + { + m_NStrawHits=-1; + m_NStraw=-1; + m_NStrawTime=-1; + m_NTRHits=-1; + m_NPixelSpacePoints=0; + m_NSCT_SpacePoints=0; + m_HitPattern=0; + m_fillSiHitInfo(); + } + + // Constructor with a list of DriftCircles + TrigInDetTrack (std::vector<const InDet::TRT_DriftCircle*>* driftCircles, + const TrigInDetTrackFitPar* param = 0, + const TrigInDetTrackFitPar* endParam=0, + const double chi2=0) : + // m_trkID(-1), + m_algId(NULLID),m_param(param), m_endParam(endParam), m_chi2(chi2), + m_siSpacePoints(NULL), m_trtDriftCircles(driftCircles) + { + m_NStrawHits=-1; + m_NStraw=-1; + m_NStrawTime=-1; + m_NTRHits=-1; + m_NPixelSpacePoints=0; + m_NSCT_SpacePoints=0; + m_HitPattern=0; + } + + /** Destructor */ + ~TrigInDetTrack() { + if(m_param) delete m_param; + if(m_endParam) delete m_endParam; + if(m_siSpacePoints) delete m_siSpacePoints; + if(m_trtDriftCircles) delete m_trtDriftCircles; + } + + // Methods to set data members + //void trackId(const int id) { m_trkID = id;} + void algorithmId(const AlgoId id) { m_algId = id;} + void param (const TrigInDetTrackFitPar* param) { m_param = param; } + void endParam (const TrigInDetTrackFitPar* param) { m_endParam = param; } + void chi2 ( const double chi2) { m_chi2 = chi2; } + void StrawHits (const int NSHits ) { m_NStrawHits = NSHits;} + void Straw (const int NS ) { m_NStraw = NS ;} + void StrawTime (const int NSTime ) { m_NStrawTime = NSTime;} + void TRHits (const int NTR ) { m_NTRHits = NTR ;} + void NPixelSpacePoints(const int n){ m_NPixelSpacePoints = n;} + void NSCT_SpacePoints(const int n) { m_NSCT_SpacePoints = n;} + + void siSpacePoints ( std::vector<const TrigSiSpacePoint*>* spacePoints ) { + m_siSpacePoints = spacePoints; + m_fillSiHitInfo(); + } + void trtDriftCircles(std::vector<const InDet::TRT_DriftCircle*>* driftCircles) { + m_trtDriftCircles = driftCircles; + } + /** Hit pattern setter method */ + void HitPattern(const long hp) { m_HitPattern = hp;} + + // Methods to retrieve data members + //int trackId() const { return m_trkID; } + /** Track author SiTrack = 1, IdScan = 2, TrtXK = 4 */ + AlgoId algorithmId() const { return m_algId; } + /** Track parameters (class TrigInDetTrackFitPar) at start of track */ + const TrigInDetTrackFitPar* param() const { return m_param; } + /** Track parameters (class TrigInDetTrackFitPar) at end of track */ + const TrigInDetTrackFitPar* endParam() const { return m_endParam; } + /** Chi2 of the track fit normalized on number of DOF */ + double chi2() const { return m_chi2; } + /** Pixel and SCT spacepoints associated with track */ + std::vector <const TrigSiSpacePoint*>* siSpacePoints() const { return m_siSpacePoints; } + + /** Number of Pixel spacepoints associated with track */ + inline int NPixelSpacePoints() const { return m_NPixelSpacePoints;} + /** Number of SCT spacepoints associated with track */ + inline int NSCT_SpacePoints() const { return m_NSCT_SpacePoints;} + /** Hit pattern of silicon spacepoints */ + inline long HitPattern() const { return m_HitPattern;} + + //Sivokl: add TRT info + /** Number of TRT hits associated with track */ + inline int NStrawHits() const { return m_NStrawHits; } + /** Number of TRT straws intersected by track */ + inline int NStraw() const { return m_NStraw; } + /** Number of TRT straws with valid drift time intersected by track */ + inline int NStrawTime() const { return m_NStrawTime; } + /** Number of high-threshold TRT hits associated with track */ + inline int NTRHits() const { return m_NTRHits; } + /** TRT drift circles associated with track */ + std::vector<const InDet::TRT_DriftCircle*>* trtDriftCircles() const { + return m_trtDriftCircles; + } + /** RDOs associated with track */ + const std::vector<Identifier>& rdoList() const { + return m_rdoList; + } + + void eraseRdoList() { + m_rdoList.clear(); + } + + void fillRdoList(); + + private: + //int m_trkID; + AlgoId m_algId; + const TrigInDetTrackFitPar* m_param; + const TrigInDetTrackFitPar* m_endParam; + double m_chi2; + int m_NStrawHits; + int m_NStraw; + int m_NStrawTime; + int m_NTRHits; + int m_NPixelSpacePoints; + int m_NSCT_SpacePoints; + long m_HitPattern; + std::vector<const TrigSiSpacePoint*>* m_siSpacePoints; + std::vector<const InDet::TRT_DriftCircle*>* m_trtDriftCircles; + void m_fillSiHitInfo(); + + std::vector<Identifier> m_rdoList; +}; + +std::string str( const TrigInDetTrack& t ); //<! printing helper +MsgStream& operator<< ( MsgStream& m, const TrigInDetTrack& t ); //<! printing helper (wraps above) +bool operator== ( const TrigInDetTrack& a, const TrigInDetTrack& b ); +inline bool operator!= ( const TrigInDetTrack& a, const TrigInDetTrack& b ) { return !(a==b); } + +/** @brief comparison with feedback + * Function compares two objects and returns "semi verbose" output + * in the form of map where there are varaibel names and differences + * between two obejcts + * @param variableChange - map to record the differences + * In case of collections (or objects when the size may be different) that information can also be returned in variableChange + */ +void diff( const TrigInDetTrack& a, const TrigInDetTrack& b, std::map<std::string, double>& variableChange ); + + +CLASS_DEF( TrigInDetTrack , 256636597 , 1 ) + + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackCollection.h new file mode 100755 index 0000000000000000000000000000000000000000..97eca3263c44710393b2204e54702bdd0edce0c8 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackCollection.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIG_IN_DET_TRACK_COLLECTION_H +#define TRIG_IN_DET_TRACK_COLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigInDetTrack.h" +#include "SGTools/BaseInfo.h" + +class TrigInDetTrackCollection : public DataVector<TrigInDetTrack> { + +public: + // Constructors: POOL needs default constructor + TrigInDetTrackCollection() : m_RoI_ID(-1) {}; + + void RoI_ID ( const int roi) { m_RoI_ID = roi; } + + int RoI_ID() const { return m_RoI_ID;} + +private: + int m_RoI_ID; +}; + +CLASS_DEF( TrigInDetTrackCollection , 1299522495 , 1 ) + +CLASS_DEF( DataVector<TrigInDetTrackCollection> , 1306764742 , 1 ) + +SG_BASE(TrigInDetTrackCollection, DataVector<TrigInDetTrack>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackFitPar.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackFitPar.h new file mode 100755 index 0000000000000000000000000000000000000000..5d60c440ddb0e8831194f3b940f3a2fa7a02ee03 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackFitPar.h @@ -0,0 +1,236 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETTRACKFITPAR_H +#define TRIGINDETTRACKFITPAR_H +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include <vector> + +/** @class TrigInDetTrackFitPar + encapsulates LVL2 track parameters and covariance matrix + The vector of track parameters consists of + + \f$ a_0 \f$ , \f$ \phi_0 \f$, \f$ z_0 \f$, \f$ \eta \f$, \f$ p_T \f$ + + The first three parameters are defined as follows + + if m_surfaceType is PERIGEE - the default + + \f$ a_0 \f$ : transverse impact parameter, a.k.a., \f$ d_0 \f$, the distance of the closest approach + of a helix to the z-axis. + + \f$ \phi_0 \f$ : momentum angle phi at the point of the closest approach + + \f$ z_0 \f$ : longitudinal impact parameter, the z value at the point of the closest approach. + + The convention for the sign of \f$ a_0 \f$ is the following. Let \f$ \Phi \f$ be the azimuthal angle to the + perigee point. The sign of \f$ a_0 \f$ is then defined as positive if \f$ \Phi = \phi_0 + \frac{\pi}{2} \f$. + Note that this convention is independent from particle charge sign. + + if m_surfaceType is BARREL, radius is given by m_surfaceCoordinate + + \f$ a_0 \f$ : Phi - azimuthal angle of the track position on the surface + + \f$ \phi_0 \f$ : momentum angle phi in the global reference frame + + \f$ z_0 \f$ : z-position (along the barrel axis) + + if m_surfaceType is ENDCAP, surface is a disk orthogonal to the global z-axis + z-coordinate of the disk is given by m_surfaceCoordinate + + \f$ a_0 \f$ : Phi - azimuthal angle of the track position on the surface + + \f$ \phi_0 \f$ : momentum angle phi in the global reference frame + + \f$ z_0 \f$ : Rho - radial coordinate of the track position on the disk + + Covariance matrix is stored in a std::vector<double>: + + cov : vector of 15 numbers corresponding to the upper half + of the covariance matrix, packed as follows: + cov(a0,a0) -> cov(a0,phi0) -> cov(a0,z0) -> cov(a0,eta) -> cov(a0,pT) -> + cov(phi0,phi0) -> cov(phi0,z0) -> cov(phi0,eta) -> cov(phi0,pT) -> + cov(z0,z0) -> cov(z0,eta) -> cov(z0,pT) -> + cov(eta,eta) -> cov(eta,pT) -> + cov(pT,pT) + + + m_ea0, m_ephi0, m_ez0, m_eeta, m_epT - square roots out of corresponding diagonal elements + of the covariance matrix + + Note that pT is actually pT \f$ \times \f$ sign of particle charge + +*/ + +class TrigInDetTrackFitPar { + + public: + + enum TrigSurfaceType{PERIGEE=0, BARREL=1, ENDCAP=2, UNDEFINED=3}; + + /** Constructor for POOL only */ + TrigInDetTrackFitPar () : //!< Default constructor: needed by POOL + m_a0(0.0), m_phi0(0.0), m_z0(0.0),m_eta(0.0), m_pT(0.0), + m_ea0(0.0), m_ephi0(0.0), m_ez0(0.0), m_eeta(0.0), m_epT(0.0), + m_cov(NULL), m_surfaceType(PERIGEE), m_surfaceCoordinate(0.0) + {}; + + /** Constructor for parameters on PERIGEE surface */ + TrigInDetTrackFitPar (const double a0, + const double phi0, + const double z0, + const double eta, + const double pT, + const double ea0, + const double ephi0, + const double ez0, + const double eeta, + const double epT, + const std::vector<double>* cov=0) : + m_a0(a0), m_phi0(phi0), m_z0(z0), + m_eta(eta), m_pT(pT), m_ea0(ea0), m_ephi0(ephi0), m_ez0(ez0), + m_eeta(eeta), m_epT(epT), m_cov(cov),m_surfaceType(PERIGEE), + m_surfaceCoordinate(0.0) + {}; + + + /** Constructor for parameters on non-PERIGEE surface */ + TrigInDetTrackFitPar (const double a0, + const double phi0, + const double z0, + const double eta, + const double pT, + const double ea0, + const double ephi0, + const double ez0, + const double eeta, + const double epT, + const TrigSurfaceType t, + const double c, + const std::vector<double>* cov=0) : + m_a0(a0), m_phi0(phi0), m_z0(z0), + m_eta(eta), m_pT(pT), m_ea0(ea0), m_ephi0(ephi0), m_ez0(ez0), + m_eeta(eeta), m_epT(epT), m_cov(cov), m_surfaceType(t), m_surfaceCoordinate(c) + {}; + + /** Constructor for PERIGEE parameters without errors or covariance */ + TrigInDetTrackFitPar (const double a0, + const double phi0, + const double z0, + const double eta, + const double pT, + const std::vector<double>* cov=0) : + m_a0(a0), m_phi0(phi0), m_z0(z0), + m_eta(eta), m_pT(pT), + m_ea0(0.0), m_ephi0(0.0), m_ez0(0.0), m_eeta(0.0), + m_epT(0.0), m_cov(cov), m_surfaceType(PERIGEE), + m_surfaceCoordinate(0.0){ + if(cov!=NULL) { + if((*cov)[0]>=0.0) m_ea0 = sqrt((*cov)[0]); + if((*cov)[5]>=0.0) m_ephi0 = sqrt((*cov)[5]); + if((*cov)[9]>=0.0) m_ez0 = sqrt((*cov)[9]); + if((*cov)[12]>=0.0) m_eeta = sqrt((*cov)[12]); + if((*cov)[14]>=0.0) m_epT = sqrt((*cov)[14]); + } + } + + /** Constructor for non-PERIGEE parameters without errors or covariance */ + TrigInDetTrackFitPar (const double a0, + const double phi0, + const double z0, + const double eta, + const double pT, + const TrigSurfaceType t, + const double c, + const std::vector<double>* cov=0) : + m_a0(a0), m_phi0(phi0), m_z0(z0), + m_eta(eta), m_pT(pT), + m_ea0(0.0), m_ephi0(0.0), m_ez0(0.0), m_eeta(0.0), m_epT(0.0), m_cov(cov), m_surfaceType(t), + m_surfaceCoordinate(c) + { + if(cov!=NULL) { + if((*cov)[0]>=0.0) m_ea0 = sqrt((*cov)[0]); + if((*cov)[5]>=0.0) m_ephi0 = sqrt((*cov)[5]); + if((*cov)[9]>=0.0) m_ez0 = sqrt((*cov)[9]); + if((*cov)[12]>=0.0) m_eeta = sqrt((*cov)[12]); + if((*cov)[14]>=0.0) m_epT = sqrt((*cov)[14]); + } + } + + /** Destructor */ + ~TrigInDetTrackFitPar() {if(m_cov) delete m_cov;} + + // Methods to set data members + /** Setter: transverse impact parameter */ + void a0 ( const double a0 ) { m_a0 = a0; } + /** Setter: longitudinal impact parameter */ + void z0 ( const double z0 ) { m_z0 = z0; } + /** Setter: azimuthal angle of the momentum */ + void phi0( const double phi0 ) { m_phi0 = phi0; } + /** Setter: pseudorapidity */ + void eta ( const double eta ) { m_eta = eta; } + /** Setter: transverse momentum */ + void pT ( const double pT ) { m_pT = pT; } + /** Setter: covariance matrix of track parameters */ + void cov ( const std::vector<double>* cov ) { m_cov = cov; } + /** Setter: surface type PERIGEE=0, BARREL=1, ENDCAP=2 */ + void surfaceType(TrigSurfaceType s) { m_surfaceType=s; } + /** Setter: surface reference coordinate for non-perigee surfaces */ + void surfaceCoordinate(double c) { m_surfaceCoordinate=c; } + + // Methods to retrieve data members + /** transverse impact parameter */ + double a0() const { return m_a0; } + /** longitudinal impact parameter */ + double z0() const { return m_z0; } + /** azimuthal angle of the momentum */ + double phi0() const { return m_phi0; } + /** pseudorapidity */ + double eta() const { return m_eta; } + /** transverse momentum */ + double pT() const { return m_pT; } + /** variance of transverse impact parameter */ + double ea0() const { return m_ea0; } + /** variance of longitudinal impact parameter */ + double ez0() const { return m_ez0; } + /** variance of azimuthal angle of the momentum */ + double ephi0() const { return m_ephi0; } + /** variance of pseudorapidity */ + double eeta() const { return m_eeta; } + /** variance of transverse momentum */ + double epT() const { return m_epT; } + /** covariance (packed) of track parameters */ + const std::vector<double>* cov() const { return m_cov; } + /** surface type */ + TrigSurfaceType surfaceType() const { return m_surfaceType; } + /** surface reference coordinate (radius or z-position) for non-perigee parameters */ + double surfaceCoordinate() const { return m_surfaceCoordinate; } + + private: + double m_a0;//!< see detailed description below + double m_phi0;//!< see detailed description below + double m_z0;//!< see detailed description below + double m_eta;//!< pseudorapidity + double m_pT;//!< transverse momentum + double m_ea0;//!<\f$ \sqrt{cov(a_0,a_0)}\f$ + double m_ephi0;//!<\f$ \sqrt{cov(\phi_0,\phi_0)}\f$ + double m_ez0;//!<\f$ \sqrt{cov(z_0,z_0)}\f$ + double m_eeta;//!<\f$ \sqrt{cov(\eta,\eta)}\f$ + double m_epT;//!<\f$ \sqrt{cov(p_T,p_T)}\f$ + const std::vector<double>* m_cov;//!< covariance matrix packed as described below + TrigSurfaceType m_surfaceType;//!< type of track parameters - perigee, barrel, or endcap + double m_surfaceCoordinate;//!<barrel radius or z of endcap disk +}; + +CLASS_DEF( TrigInDetTrackFitPar , 159201573 , 1 ) +CLASS_DEF( DataVector<TrigInDetTrackFitPar> , 99002908 , 1 ) + +#endif + + + + + + diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackHelper.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackHelper.h new file mode 100755 index 0000000000000000000000000000000000000000..7d707ed6476fa7395cc47e72d89d39b6cb672afd --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigInDetTrackHelper.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETTRACKHELPER_H +#define TRIGINDETTRACKHELPER_H +#include "TrigInDetEvent/TrigInDetTrackFitPar.h" +// +// Class for operations based on Track Fit Parameters: +// + +class TrigInDetTrackHelper { + + public: + TrigInDetTrackHelper(const TrigInDetTrackFitPar* par): m_param(par) {} + ~TrigInDetTrackHelper(){}; + + // give phiC and etaC of point of intercept of track with cylinder of centre (0,0) + // radius rC and half-length zC + +void extrapolate(double rC, double zC, double &phiC, double &etaC) const; + + private: + + const TrigInDetTrackFitPar* m_param; +}; +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigL2Vertex.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigL2Vertex.h new file mode 100755 index 0000000000000000000000000000000000000000..4980b5f2bbf8f1a4785232a57debbead83786b35 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigL2Vertex.h @@ -0,0 +1,208 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef __TRIG_L2_VERTEX__ +#define __TRIG_L2_VERTEX__ + +#include <list> +#include <vector> +#include "TrigInDetEvent/TrigInDetTrack.h" +#include "TrkTrack/Track.h" +#include "GaudiKernel/MsgStream.h" + +#define MAX_SIZE_VERT_COVM 30 + +/** This is the implementation of classes used by TrigL2VertexFitter: + + - TrigL2Vertex - an extended version of TrigVertex class which incapsulates vertex fit parameters + vector and associated covariance matrix. + + - TrigVertexFittingNode: base class for + + - TrigVertexFitInputTrack which incapsulates input track parameters and is responsible + for updating vertex fit parameters + - TrigVertexFitConstraint which incapsulates mass constraint information + + The algorithm used in m_updateVertex method of the TrigVertexFitInputTrack class is described in + ATL-COM-DAQ-2007-036 note available at http://cdsweb.cern.ch/record/1062118 + + NB: a user should not modify TrigL2Vertex directly but rather use methods provided by TrigVertexingTool + + Vertex fitting loop in the TrigL2VertexFitter basically consists of alternate calls of m_getChi2Distance +and m_updateVertex methods of TrigVertexFittingNodes (i.e. tracks and constraints) + +*/ + +class TrigVertexFittingNode +{ + public: + TrigVertexFittingNode(){}; + virtual ~TrigVertexFittingNode(){}; + virtual double m_getChi2Distance(class TrigL2Vertex*) = 0;//!< abstract method + virtual void m_updateVertex(class TrigL2Vertex*) = 0;//!< abstract method + virtual MsgStream& m_report( MsgStream& ) const = 0; + protected: + double m_resid[2]; + double m_V[2][2]; + double m_D[2][MAX_SIZE_VERT_COVM]; +}; + +inline MsgStream& operator << ( MsgStream& msg, const TrigVertexFittingNode& node) +{ + return node.m_report(msg); +} + +inline MsgStream& operator << ( MsgStream& msg, const TrigVertexFittingNode* node) +{ + return node->m_report(msg); +} + +class TrigVertexFitInputTrack : public TrigVertexFittingNode +{ + public: + TrigVertexFitInputTrack(const TrigInDetTrack*, double);//!< constructor for L2 tracks + TrigVertexFitInputTrack(const Trk::Track*, double);//!< constructor for EF (offline) tracks + ~TrigVertexFitInputTrack(); + const TrigInDetTrack* m_getTrigTrack();//!< getter for L2 tracks + const Trk::Track* m_getTrkTrack();//!< getter for EF (offline) tracks + void m_initializeVertex(class TrigL2Vertex*);//!< resets and fills its part of the covariance and parameter vector + bool m_linearize(class TrigL2Vertex*);//!< re-calculates linearization of the measurement model in the vicinity of parameters provided by input TrigL2Vertex + virtual double m_getChi2Distance(class TrigL2Vertex*);//!< implementation of abstract method from the base class + virtual void m_updateVertex(class TrigL2Vertex*);//!< implementation of abstract method from the base class + virtual MsgStream& m_report( MsgStream& ) const; + void m_setIndex(int);//!< to be used by TrigVertexingTool + int m_getIndex() const;//!< to be used by TrigVertexingTool + int m_getTrackType();//!< 0: L2 track, 1: EF(offline) track + bool m_isActive();//!< if true this track will be used in the vertex fit otherwise it will be masked + void m_activate();//!< sets m_isActive to true + void m_mask();//!< sets m_isActive to false + void m_setMass(double);//!< sets a mass of this particle + double m_getMass() const {return m_mass;}//!< gets a mass of this particle + const double* Perigee() const;//!< track parameters at the perigee + double PerigeeCovariance(int,int) const;//!< covariance of track parameters at the perigee + private: + const TrigInDetTrack* m_pTrigTrack; + const Trk::Track* m_pTrkTrack; + int m_nTrackType; + int m_index; + double m_mass; + double m_Vqq[3][3]; + double m_Vuq[2][3]; + double m_Vuu[2][2]; + double m_u[2]; + double m_q[3]; + double m_Perigee[5]; + double m_PerigeeCovariance[5][5]; + double m_A[2][3]; + double m_B[2][3]; + double m_h[2]; + + bool m_active; +}; + +class TrigVertexFitConstraint : public TrigVertexFittingNode +{ + public: + TrigVertexFitConstraint(double,const TrigVertexFitInputTrack*, const TrigVertexFitInputTrack*);//!< two-track mass constraint + TrigVertexFitConstraint(double,const TrigVertexFitInputTrack*, const TrigVertexFitInputTrack*, + const TrigVertexFitInputTrack*);//!< three-track mass constraint + ~TrigVertexFitConstraint(); + virtual double m_getChi2Distance(class TrigL2Vertex*);//!< implementation of abstract method from the base class + virtual void m_updateVertex(class TrigL2Vertex*);//!< implementation of abstract method from the base class + virtual MsgStream& m_report( MsgStream& ) const; + double m_getValue();//!< returns a mass of the constraint + private: + double m_calculateInvariantMass(TrigL2Vertex* pV); + std::list<const TrigVertexFitInputTrack*> m_trackList; + double m_value; +}; + +/* +class TrigVertexCovarianceRow +{ + public: + TrigVertexCovarianceRow(int); + ~TrigVertexCovarianceRow(); + double& operator[] (int); + private: + int m_size; + double* m_data; +}; + +class TrigVertexCovariance +{ + public: + TrigVertexCovariance(int); + ~TrigVertexCovariance(); + TrigVertexCovarianceRow& operator[] (int); + private: + int m_size; + std::vector<TrigVertexCovarianceRow*>* m_data; +}; +*/ + +class TrigL2Vertex +{ + public: + TrigL2Vertex(); + ~TrigL2Vertex(); + bool m_prepareForFit();//!< resets all internal structures + initialization of the covariance + void m_reset();//!< resets all internal structures + double chi2();//!< returns accumulated \f$\chi^2\f$ of the fit + int ndof();//!< returns accumulated number-of-degree-of-freedom of the fit + double mass();//!< returns calculated mass of the vertex + double massVariance();//!< returns variance of the calculated mass of the vertex + + void m_addChi2(double);//!< increments accumulated \f$\chi^2\f$ of the fit + void m_addNdof(int);//!< increments accumulated number-of-degree-of-freedom of the fit + void m_setMass(double);//!< sets calculated mass of the vertex + void m_setMassVariance(double);//!< sets variance of the calculated mass of the vertex + int m_getNumberOfTracks(); + double* m_getParametersVector();//!< returns vector of vertex fit parameters: vertex position + refitted track momenta at-perigee (sic !) + //TrigVertexCovariance* m_getCovariance(); + //void m_setCovariance(TrigVertexCovariance*); + + bool m_isVertexFitted();//!< vertex status + bool m_isMassEstimated();//!< vertex status + bool m_isReadyForFit();//!< vertex status + + const TrigVertexFitInputTrack* m_contains(const TrigInDetTrack*);//!< checks whether L2 track is in the vertex + const TrigVertexFitInputTrack* m_contains(const Trk::Track*);//!< checks whether ofline track is in the vertex + + std::list<TrigVertexFitConstraint*>* m_getConstraints();//!< lists of all constraints imposed on the vertex + std::list<TrigVertexFitInputTrack*>* m_getTracks();//!< lists of tracks in the vertex + void m_setStatus(int);//!< sets vertex status flag + int m_getStatus();//!< returns vertex status flag + void m_setMotherTrack(TrigInDetTrackFitPar*);//!< sets mother particle parameters after kinematical fitting + const TrigInDetTrackFitPar* m_getMotherTrack();//!< returns mother particle parameters if m_isMassEstimated() is true + MsgStream& m_report( MsgStream& ) const; + double m_Gk[MAX_SIZE_VERT_COVM][MAX_SIZE_VERT_COVM]; + + private: + int m_nTracks,m_nDOF; + int m_nTrackType; + //TrigVertexCovariance* m_Gk; + + std::list<TrigVertexFitInputTrack*>* m_pvTracks; + std::list<TrigVertexFitConstraint*>* m_pvConstraints; + double m_mass,m_chiSquared; + double m_massVar; + int m_nStatus; + //double* m_Rk; + double m_Rk[MAX_SIZE_VERT_COVM]; + TrigInDetTrackFitPar* m_P; + bool m_ready; +}; + +inline MsgStream& operator << ( MsgStream& msg, const TrigL2Vertex& vrt) +{ + return vrt.m_report(msg); +} + +inline MsgStream& operator << ( MsgStream& msg, const TrigL2Vertex* vrt) +{ + return vrt->m_report(msg); +} + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePoint.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePoint.h new file mode 100755 index 0000000000000000000000000000000000000000..1b534263db25422dd387c02376c2fc35d16acd2f --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePoint.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGSISPACEPOINT_H +#define TRIGSISPACEPOINT_H +#include<utility> +#include "Identifier/Identifier.h" +#include <utility> +#include "InDetPrepRawData/SiCluster.h" +#include "TrigInDetEvent/TrigSiSpacePointBase.h" + +class TrigSiSpacePoint : public TrigSiSpacePointBase { + +public: + + // Constructor from single cluster using cylindrical co-ordinates, no. errors + TrigSiSpacePoint ( const InDet::SiCluster* cluster1, + const Identifier& elementId, long layer, + double r, double phi, double z, + double dr=0.0, double dphi=0.0, double dz=0.0 ) : + TrigSiSpacePointBase(layer, r, phi, z, dr, dphi, dz), + m_clusters(cluster1, 0), + m_elementId(elementId) {}; + + // Constructor from two clusters using cylindrical co-ordinates, no. errors + TrigSiSpacePoint ( const InDet::SiCluster* cluster1, + const InDet::SiCluster* cluster2, + const Identifier& elementId, long layer, + double r, double phi, double z, + double dr=0.0, double dphi=0.0, double dz=0.0) : + TrigSiSpacePointBase(layer, r, phi, z, dr, dphi, dz), + m_clusters(cluster1, cluster2), + m_elementId(elementId) {}; + + // Destructor + virtual ~TrigSiSpacePoint() {}; + + // Methods to return values of data members + const Identifier& identify() const {return m_elementId;} + + // Methods to retrieve data members + std::pair < const InDet::SiCluster*, const InDet::SiCluster* > clusters() const { + return m_clusters; + } + +private: + + std::pair<const InDet::SiCluster*, const InDet::SiCluster*> m_clusters; + const Identifier m_elementId; +}; + +#endif + + + + diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointBase.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointBase.h new file mode 100644 index 0000000000000000000000000000000000000000..af7dfa0fd82d99fd3fdac6acf036ef2b18c1757c --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointBase.h @@ -0,0 +1,146 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef __TRIGSISPACEPOINTBASE_H__ +#define __TRIGSISPACEPOINTBASE_H__ + +#include <math.h> +#include <cstddef> +#include "TrkSpacePoint/SpacePoint.h" + +#define MAX_SILICON_LAYER_NUM 19 + +// layer numbering scheme: +// 3 Barrel Pixels 0,1,2 +// 4 Barrel SCT 3,4,5,6 i.e. offsetBarrelSCT = 3 +// 3 Endcap Pixels 7,8,9 i.e. offsetEndcapPixels = 7 +// 9 Endcap SCT 10,11,12,13,14,15,16,17,18 i.e. offsetEndcapSCT = 10 + +#define OffsetEndcapPixels 7 +#define OffsetBarrelSCT 3 +#define OffsetEndcapSCT 10 + +class TrigSiSpacePointBase { + +public: + + // using cylindrical co-ordinates, no. errors + TrigSiSpacePointBase(long layer, + double r, double phi, double z, + double dr=0.0, double dphi=0.0, double dz=0.0, const Trk::SpacePoint* offlineSpacePoint = NULL) : + m_layer(layer), + m_r(r), m_phi(phi), m_z(z), + m_dr(dr), m_dphi(dphi), m_dz(dz), m_locT(0.), m_locL(0.), + m_original_r(r), m_original_phi(phi), m_offlineSpacePoint(offlineSpacePoint) + { + m_x = m_original_x = r * cos(phi); + m_y = m_original_y = r * sin(phi); + m_elementIndex[0]=-1;m_elementIndex[1]=-1; + m_eta = eta(0.0); + m_rotatedPhi = m_phi; + m_barCode=-1; + } + + // Destructor + virtual ~TrigSiSpacePointBase() {}; + + // Methods to set data members + void r( const double r ) {m_r = r; } + void phi(const double phi) {m_phi = phi;} + void z( const double z ) {m_z = z; } + void x( const double x ) {m_x = x; } + void y( const double y ) {m_y = y; } + void dr( const double dr ) {m_dr = dr; } + void dphi(const double dphi) {m_dphi = dphi;} + void dz( const double dz ) {m_dz = dz; } + void locT(const double locT) {m_locT = locT;} + void locL( const double locL ) {m_locL = locL; } + void elementIndex(int i, unsigned int idx) { + if((i==0) || (i==1)) + m_elementIndex[i]=idx; + } + + void setEta(double eta) { + m_eta=eta; + } + + void usedBy(int idx) {m_usedBy=idx;} + void index(int idx) {m_index=idx;} + void rotatedPhi(double phi) {m_rotatedPhi = phi;} + + void barCode(int code) {m_barCode = code;} + + // Methods to return values of data members + unsigned int elementIndex(int i) const { + if((i==0) || (i==1)) + return m_elementIndex[i]; + else return -1; + } + + double r() const {return m_r;} + double phi() const {return m_phi;} + double z() const {return m_z;} + double dr() const {return m_dr;} + double dphi() const {return m_dphi;} + double dz() const {return m_dz;} + double locT() const {return m_locT;} + double locL() const {return m_locL;} + double x() const {return m_x;} + double y() const {return m_y;} + long layer() const {return m_layer;} + double eta() const {return m_eta;} + + double original_r() const {return m_original_r;} + double original_phi() const {return m_original_phi;} + double original_x() const {return m_original_x;} + double original_y() const {return m_original_y;} + + // Methods to calculate associated values + + double eta(double z0) const { + double zr = (m_z-z0)/m_r; + return log(zr+sqrt(1.+zr*zr)); + } + + double rotatedPhi() const {return m_rotatedPhi;} + int usedBy() const {return m_usedBy;} + int index() const {return m_index;} + int barCode() const {return m_barCode;} + const Trk::SpacePoint* offlineSpacePoint() const {return m_offlineSpacePoint;} + +protected: + + unsigned int m_elementIndex[2]; + long m_layer; + + double m_r; + double m_x; + double m_y; + + double m_phi; + double m_z; + double m_dr; + double m_dphi; + double m_dz; + double m_locT; + double m_locL; + + double m_original_r; + double m_original_phi; + double m_original_x; + double m_original_y; + + double m_rotatedPhi;// to be used for RoIs with [+/- pi] boundary + double m_eta; //cache for eta result; + int m_usedBy; //index of a track sp is assigned to + int m_index; //sp index in a collection + int m_barCode; //MC truth association + + const Trk::SpacePoint* m_offlineSpacePoint; +}; +#endif + + + + diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointCollection.h new file mode 100755 index 0000000000000000000000000000000000000000..385f5a2707805d811ed5c6987599acd4ef7d36cd --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSiSpacePointCollection.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGSISPACEPOINTCOLLECTION_H +#define TRIGSISPACEPOINTCOLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "TrkPrepRawData/PrepRawDataCollection.h" +#include "TrkPrepRawData/PrepRawDataContainer.h" +#include "TrigInDetEvent/TrigSiSpacePoint.h" +//#include "InDetIdentifier/InDetDetElemHash.h" + +typedef Trk::PrepRawDataCollection< TrigSiSpacePoint > TrigSiSpacePointCollection; + +CLASS_DEF( TrigSiSpacePointCollection , 1333891984 , 1 ) + +typedef Trk::PrepRawDataContainer< TrigSiSpacePointCollection> TrigSiSpacePointContainer; + +CLASS_DEF( TrigSiSpacePointContainer , 1291201278 , 1 ) + + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCounts.h new file mode 100644 index 0000000000000000000000000000000000000000..ed587ed859c3d0fe5a87fcab9ef090666673501c --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCounts.h @@ -0,0 +1,92 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_SPACEPOINTCOUNTER_H +#define TRIGINDETEVENT_SPACEPOINTCOUNTER_H + +#include "TrigInDetEvent/TrigHisto2D.h" +#include "Identifier/Identifier.h" + +#include "CLIDSvc/CLASS_DEF.h" + +/** @class TrigSpacePointCounts + * @author Regina Kwee <regina.kwee@cern.ch> + * + * A class to store Pixel cluster and SCT space point information for + * the level 2 minbias trigger. + * + */ +class TrigSpacePointCounts { + public: + + /** Default constructor used by T/P converters. */ + TrigSpacePointCounts(); + + /** Standard constructor used by FEX algorithms. */ + TrigSpacePointCounts(TrigHisto2D pixelClusEndcapC, + TrigHisto2D pixelClusBarrel, + TrigHisto2D pixelClusEndcapA, + std::vector<Identifier> droppedPixelModules, + unsigned int sctSpEndcapC, + unsigned int sctSpBarrel, + unsigned int sctSpEndcapA, + std::vector<Identifier> droppedSctModules); + + /** Copy Constructor */ + TrigSpacePointCounts(const TrigSpacePointCounts& trigSpacePointCounts); + + /** Destructor */ + ~TrigSpacePointCounts(void); + + TrigHisto2D pixelClusEndcapC(void) const; + + TrigHisto2D pixelClusBarrel(void) const; + + TrigHisto2D pixelClusEndcapA(void) const; + + std::vector<Identifier> droppedPixelModules(void) const; + + unsigned int sctSpEndcapC(void) const; + + unsigned int sctSpBarrel(void) const; + + unsigned int sctSpEndcapA(void) const; + + std::vector<Identifier> droppedSctModules(void) const; + + private: + + /** A histogram of pixel cluster time over threshold against pixel + cluster size for endcap C. */ + TrigHisto2D m_pixelClusEndcapC; + + /** A histogram of pixel cluster time over threshold against pixel + cluster size for the barrel. */ + TrigHisto2D m_pixelClusBarrel; + + /** A histogram of pixel cluster time over threshold against pixel + cluster size for endcap A. */ + TrigHisto2D m_pixelClusEndcapA; + + /** A vector of module identifiers dropped from the pixel cluster sum. */ + std::vector<Identifier> m_droppedPixelModules; + + /** The space point multiplicity for space points in the SCT endcap C */ + unsigned int m_sctSpEndcapC; + + /** The space point multiplicity for space points in the SCT barrel */ + unsigned int m_sctSpBarrel; + + /** The space point multiplicity for space points in the SCT endcap A */ + unsigned int m_sctSpEndcapA; + + /** A vector of modules identifiers dropped from the SCT space point sum. */ + std::vector<Identifier> m_droppedSctModules; +}; + +// obtained using clid -m TrigSpacePointCounts +CLASS_DEF( TrigSpacePointCounts , 180429846 , 1 ) + + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCountsCollection.h new file mode 100644 index 0000000000000000000000000000000000000000..8d1598563fd6cd422625043ccb00e08195135a84 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigSpacePointCountsCollection.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGSPACEPOINTCOUNTSCOLLECTION_H +#define TRIGINDETEVENT_TRIGSPACEPOINTCOUNTSCOLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigSpacePointCounts.h" +#include "SGTools/BaseInfo.h" + +/** @class TrigSctSpCountsCollection + * @author Regina Kwee <Regina.Kwee@cern.ch> + * + * @brief Container class needed for EDM. Should normally only + * contain 1 TrigSpacePointCounts object. + * + */ +class TrigSpacePointCountsCollection : public DataVector<TrigSpacePointCounts> { }; + +// obtained using clid -m TrigSctSpCountsCollection +CLASS_DEF( TrigSpacePointCountsCollection , 1123027134 , 1 ) + +SG_BASE(TrigSpacePointCountsCollection, DataVector<TrigSpacePointCounts>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfo.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..cbce08f4f1dff33958015aab98612f79a6552bf9 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfo.h @@ -0,0 +1,123 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGTAUTRACKSINFO_H +#define TRIGTAUTRACKSINFO_H + +/** @class TrigTauTracksInfo + + Contains basic information about trackc collection associated with Tau RoI. + To be used by FEX TrigT2IDTau at L2. + + + created by Olya Igonkina - Jan 16, 2008 + + +*/ +#include "CLIDSvc/CLASS_DEF.h" +#include "FourMom/P4PtEtaPhiM.h" +#include "FourMom/P4PxPyPzE.h" +#include "Navigation/Navigable.h" +#include "EventKernel/INavigable4Momentum.h" +#include "TrigInDetEvent/TrigInDetTrackCollection.h" + + + +class TrigTauTracksInfo : public P4PtEtaPhiM, public NavigableTerminalNode , + virtual public INavigable4Momentum { +public: + /** Constructor */ + TrigTauTracksInfo(); + /** Copy Constructor */ + TrigTauTracksInfo(const TrigTauTracksInfo & te); + + /** Descrtuctor */ + ~TrigTauTracksInfo(); + + /** getters */ + int roiId() const {return m_roiID;}; + + int nCoreTracks() const {return m_nCoreTracks;}; + int nSlowTracks() const{return m_nSlowTracks;}; + int nIsoTracks() const{return m_nIsoTracks;}; + + float charge() const{return m_charge;}; + float leadingTrackPt() const { return m_leadingTrackPt; }; + float sumPtRatio() const{return m_scalarPtSumIso/m_scalarPtSumCore;}; + float scalarPtSumCore() const{return m_scalarPtSumCore;}; + float scalarPtSumIso() const{return m_scalarPtSumIso;}; + float ptBalance() const{return m_ptBalance;}; + + const P4PtEtaPhiM & threeFastestTracks() const {return m_3fastest; } ; + const TrigInDetTrackCollection* trackCollection() const {return m_tracks;}; + + + /** setters */ + void setRoiId(int id) {m_roiID = id;}; + void setNCoreTracks( int nCoreTrk) {m_nCoreTracks = nCoreTrk; } ; + void setNSlowTracks(int nSlowTrk) {m_nSlowTracks = nSlowTrk; } ; + void setNIsoTracks( int nIsoTrk ) {m_nIsoTracks = nIsoTrk; }; + + void setCharge( float charge) {m_charge = charge; }; + void setLeadingTrackPt (float pt ) {m_leadingTrackPt = pt;} + void setScalarPtSumCore(float sumPtCore) {m_scalarPtSumCore = sumPtCore; }; + void setScalarPtSumIso(float sumPtIso) {m_scalarPtSumIso = sumPtIso; }; + void setPtBalance(float ptBal) {m_ptBalance = ptBal;} ; + + void set3fastestPtEtaPhiM(float pt, float eta, float phi, float m); + void set3fastestPxPyPzE(float px, float py, float pz, float e); + void setTrackCollection(const TrigInDetTrackCollection* trackColl) {m_tracks = trackColl;}; + + +private: + /** RoI id */ + int m_roiID; + /** number of tracks in the core region */ + int m_nCoreTracks; + /** number of slow tracks in the core region */ + int m_nSlowTracks; + /** number of tracks in the isolation region */ + int m_nIsoTracks; + + /** charge of tracks in the core region. */ + float m_charge; // use float in case we ever will shift to weighted pt charge + /** leading track Pt */ + float m_leadingTrackPt; + /** scalar sum of pts in core area */ + float m_scalarPtSumCore; + /** scalar sum of pts in isolation area */ + float m_scalarPtSumIso; + /** variable determining a difference between slow and leading tracks */ + float m_ptBalance; + + P4PtEtaPhiM m_3fastest; + + const TrigInDetTrackCollection* m_tracks; + + +}; + +/// Helper function for printing the object +std::string str( const TrigTauTracksInfo& tau ); + +/// Helper operator for printing the object +MsgStream& operator<< ( MsgStream& m, const TrigTauTracksInfo& tau ); + +/// Operator comparing two TrigTauTracksInfo objects for equality +bool operator== ( const TrigTauTracksInfo& left, const TrigTauTracksInfo& right ); +/// Operator comparing two TrigTauTracksInfo objects for inequality +inline bool operator!= ( const TrigTauTracksInfo& left, const TrigTauTracksInfo& right ) { + return !( left == right ); +} + +/// Comparison with feedback +void diff( const TrigTauTracksInfo& left, const TrigTauTracksInfo& right, + std::map< std::string, double >& varChange ); + + + +CLASS_DEF( TrigTauTracksInfo , 239760293 , 1 ) + +#include "TrigInDetEvent/TrigTauTracksInfoCollection.h" +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfoCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfoCollection.h new file mode 100644 index 0000000000000000000000000000000000000000..d7dd4db8398a9592cce285da6eb32dd2d2aef14c --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTauTracksInfoCollection.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGTAUTRACKSINFOCOLLECTION_H +#define TRIGTAUTRACKSINFOCOLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigTauTracksInfo.h" +#include "SGTools/BaseInfo.h" + +class TrigTauTracksInfoCollection : public DataVector<TrigTauTracksInfo> { }; + +CLASS_DEF( TrigTauTracksInfoCollection , 1090546955 , 1 ) + +SG_BASE(TrigTauTracksInfoCollection, DataVector<TrigTauTracksInfo>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCounts.h new file mode 100644 index 0000000000000000000000000000000000000000..befc51f1995fc6f307d7da7b3d002500420c05a7 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCounts.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGTRACKCOUNTS_H +#define TRIGINDETEVENT_TRIGTRACKCOUNTS_H + +#include "TrigInDetEvent/TrigHisto2D.h" + +#include "CLIDSvc/CLASS_DEF.h" + +/** @class TrigTrackCounts + * @author Regina Kwee <regina.kwee@cern.ch> + * + * A class to store reconstructed track distributions: z0 vs pt and + * eta vs phi. + */ +class TrigTrackCounts { +public: + + /** Default constructor used by T/P converters. */ + TrigTrackCounts(); + + /** Standard constructor used by FEX algorithms. */ + TrigTrackCounts(TrigHisto2D z0_pt, + TrigHisto2D eta_phi); + + /** Copy Constructor */ + TrigTrackCounts(const TrigTrackCounts& trigTrackCounts); + + /** Destructor */ + ~TrigTrackCounts(); + + TrigHisto2D z0_pt(void) const; + + TrigHisto2D eta_phi(void) const; + +private: + + /** A histogram of the reconstructed track z0 vs pt */ + TrigHisto2D m_z0_pt; + + /** A histogram of the reconstructed track eta vs phi */ + TrigHisto2D m_eta_phi; +}; + +// obtained using clid -m TrigTrackCounts +CLASS_DEF( TrigTrackCounts , 24895180 , 1 ) + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCountsCollection.h new file mode 100644 index 0000000000000000000000000000000000000000..ea34f5eb2cd4fb2884ed9bfa56c06a9c33106ac3 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrackCountsCollection.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGTRACKCOUNTSCOLLECTION_H +#define TRIGINDETEVENT_TRIGTRACKCOUNTSCOLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigTrackCounts.h" +#include "SGTools/BaseInfo.h" + +class TrigTrackCountsCollection : public DataVector<TrigTrackCounts> { }; + +CLASS_DEF( TrigTrackCountsCollection , 1117551094 , 1 ) + +SG_BASE(TrigTrackCountsCollection, DataVector<TrigTrackCounts>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCounts.h new file mode 100644 index 0000000000000000000000000000000000000000..878c82141984502477c7857137a4a1cecaa1770c --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCounts.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRTHITCOUNTER_H +#define TRIGINDETEVENT_TRTHITCOUNTER_H + +#include "TrigInDetEvent/TrigHisto1D.h" + +#include "CLIDSvc/CLASS_DEF.h" + +/** @class TrigTrtHitCounts + * @author Regina Kwee <regina.kweeATcern.ch> + * + * @brief A class to store the distributions of time of threshold from + * the TRT raw data. + * + */ +class TrigTrtHitCounts { + public: + + /** Default constructor used by T/P converters. */ + TrigTrtHitCounts(void); + + /** Standard constructor used by FEX algorithms. */ + TrigTrtHitCounts(TrigHisto1D endcapC, + TrigHisto1D barrel, + TrigHisto1D endcapA); + + /** Copy Constructor */ + TrigTrtHitCounts(const TrigTrtHitCounts& trigTrtHitCounts); + + /** Destructor */ + ~TrigTrtHitCounts(void); + + /** Return a histogram of time over threshold for endcap C pixel clusters */ + TrigHisto1D endcapC(void) const; + + /** Return a histogram of time over threshold for barrel pixel clusters */ + TrigHisto1D barrel(void) const; + + /** Return a histogram of time over threshold for endcap A pixel clusters */ + TrigHisto1D endcapA(void) const; + +private: + TrigHisto1D m_endcapC; + TrigHisto1D m_barrel; + TrigHisto1D m_endcapA; +}; + +// obtained using clid -m TrigTrtHitCounts +CLASS_DEF( TrigTrtHitCounts , 168287091 , 1 ) + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCountsCollection.h new file mode 100644 index 0000000000000000000000000000000000000000..b3813d4ad1c7af3492a1b3c39a8d04065fff8e70 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigTrtHitCountsCollection.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGTRTHITCOUNTSCOLLECTION_H +#define TRIGINDETEVENT_TRIGTRTHITCOUNTSCOLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigTrtHitCounts.h" +#include "SGTools/BaseInfo.h" + +/** @class TrigTrtHitCountsCollection + * @author Samir Ferrag <S.Ferrag@physics.gla.ac.uk> + * + * @brief Container class needed for EDM. Should normally only + * contain 1 TrigTrtHitCounts object. + * + */ + +class TrigTrtHitCountsCollection : public DataVector<TrigTrtHitCounts> { }; + +// obtained using clid -m TrigTrtHitCountsCollection +CLASS_DEF( TrigTrtHitCountsCollection , 1246744021 , 1 ) + +SG_BASE(TrigTrtHitCountsCollection, DataVector<TrigTrtHitCounts>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertex.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertex.h new file mode 100755 index 0000000000000000000000000000000000000000..b1cdcc9cfda66a0bc6f52e708cd46d198fd357e6 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertex.h @@ -0,0 +1,200 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGVERTEX_H +#define TRIGINDETEVENT_TRIGVERTEX_H + +#include <list> + +#include "CLHEP/Geometry/Point3D.h" +#include "TrigInDetEvent/TrigInDetTrack.h" +#include <math.h> +#include <map> +#include <ostream> +#include "GaudiKernel/MsgStream.h" + +/** @class TrigVertex + encapsulates LVL2 vertex parameters (in the global reference frame), + covariance matrix, and some auxilliary information about the vertex. + + Note that covariance is represented by a std::vector<double> in a packed form: + + cov(x,x) cov(x,y) cov(x,z) cov(y,y) cov(y,z) cov(z,z) +*/ + +typedef std::list< const TrigInDetTrack* > TrackInVertexList; + +class TrigVertex{ + + public: + enum AlgoId{NULLID=0, SITRACKID=1, IDSCANID=2, HISTOPRMVTXSITRACKID=3, VKALSECVTXID=4, BPHYSSECID=5, + BSFULLSITRACKID=6, BSFULLIDSCANID=7, BSSPLITSITRACKID=8, BSSPLITIDSCANID=9, HISTOPRMVTXIDSCANID=10, + HISTOPRMVTXEFID=11, HISTOPRMVTXSITRACKIDTAU=12, HISTOPRMVTXEFIDTAU=13, BJETSECVTXID=14, + BSFULL_STRATEGY_B_ID=15, BSFULL_STRATEGY_A_ID=16, BSSPLIT_STRATEGY_B_ID=17, BSSPLIT_STRATEGY_A_ID=18, + HISTOPRMVTXFTKID=19, HISTOPRMVTXFTKIDTAU=20, BSFULL_STRATEGY_F_ID=21, BSSPLIT_STRATEGY_F_ID = 22, + HISTOPRMVTXFTKID_REFIT = 23}; + + // Constructors + TrigVertex() : m_x(0.0), m_y(0.0), m_z(0.), m_position(0,0,0), + m_chiSquared(0.0), m_nDOF(0), + m_tracks(NULL), m_algId(NULLID), + m_ownTracks(false) + { + for(int i=0;i<6;i++) m_cov[i]=0.0; + m_mass=0.0;m_massVar=0.0;m_P=NULL;m_energyFraction=0.0; + m_nTwoTracksSecVtx=0; + m_decayLength = m_decayLengthSignificance = 0; + } + + TrigVertex( double zPosition ) : m_x(0.0), m_y(0.0), m_z(zPosition),m_position(0,0,zPosition), + m_chiSquared(0.0), m_nDOF(0), + m_tracks(NULL), m_algId(NULLID), + m_ownTracks(false) + { + for(int i=0;i<6;i++) m_cov[i]=0.0; + m_mass=0.0;m_massVar=0.0;m_P=NULL;m_energyFraction=0.0; + m_nTwoTracksSecVtx=0; + m_decayLength = m_decayLengthSignificance = 0; + } + + TrigVertex( double zPosition, AlgoId id ) : m_x(0.0), m_y(0.0), m_z(zPosition), m_position(0,0,zPosition), + m_chiSquared(0.0), m_nDOF(0), + m_tracks(NULL), m_algId(id), + m_ownTracks(false) + { + for(int i=0;i<6;i++) m_cov[i]=0.0; + m_mass=0.0;m_massVar=0.0;m_P=NULL;m_energyFraction=0.0; + m_nTwoTracksSecVtx=0; + m_decayLength = m_decayLengthSignificance = 0; + } + + TrigVertex( double zPosition, double cv, AlgoId id ) : m_x(0.0), m_y(0.0), m_z(zPosition), m_position(0,0,zPosition), + m_chiSquared(0.0), m_nDOF(0), + m_tracks(NULL), m_algId(id), + m_ownTracks(false) + { + for(int i=0;i<5;i++) m_cov[i]=0.0; m_cov[5]=cv; + m_mass=0.0;m_massVar=0.0;m_P=NULL;m_energyFraction=0.0; + m_nTwoTracksSecVtx=0; + m_decayLength = m_decayLengthSignificance = 0; + } + + TrigVertex(double x, double y, double z, double cv[6], double chi2, int ndf, TrackInVertexList* tracks) : + m_x(x), m_y(y), m_z(z), m_position(x,y,z), m_chiSquared(chi2), + m_nDOF(ndf), m_tracks(tracks), m_algId(NULLID), + m_ownTracks(false) + { + for(int i=0;i<6;i++) m_cov[i]=cv[i]; + m_mass=0.0;m_massVar=0.0;m_P=NULL;m_energyFraction=0.0; + m_nTwoTracksSecVtx=0; + m_decayLength = m_decayLengthSignificance = 0; + } + + TrigVertex(double x, double y, double z, double cv[6], double chi2, int ndf, TrackInVertexList* tracks, + double mass, double energyFraction, int n2trkvtx, + double decayLength, double decayLengthSignificance, + AlgoId algo_id) : + m_x(x), m_y(y), m_z(z), m_mass(mass), + m_energyFraction(energyFraction), + m_nTwoTracksSecVtx(n2trkvtx), + m_decayLength(decayLength), + m_decayLengthSignificance(decayLengthSignificance), + m_position(x,y,z), m_chiSquared(chi2), + m_nDOF(ndf), m_tracks(tracks), m_algId(algo_id), + m_ownTracks(false) + { + for(int i=0;i<6;i++) m_cov[i]=cv[i]; + m_P=NULL; + } + + // Destructor + ~TrigVertex() + { + if (m_ownTracks) { + for (TrackInVertexList::iterator i = m_tracks->begin(); + i != m_tracks->end(); + ++i) + delete *i; + } + if(m_tracks!=NULL) delete m_tracks; + if(m_P!=NULL) delete m_P; + } + + // Methods to retrieve data members + + void algorithmId(const AlgoId id) { m_algId = id;}//!< sets author ID - algorithm that's created this vertex + AlgoId algorithmId() const { return m_algId;}//!< returns author ID - algorithm that's created this vertex + + const HepGeom::Point3D<double>& position() const { return m_position; } //!< position in HepGeom::Point3D<double> form + double chi2() const { return m_chiSquared; } //!< \f$ \chi^2\f$ of the vertex fit + int ndof() const { return m_nDOF; } //!< Number of degree-of-freedom of the vertex fit + const double* cov() const { return &m_cov[0];} //!< covariance of the vertex position, packed as follows + + TrackInVertexList* tracks() const { return m_tracks; }//!< std::list of track pointers associated with the vertex + double x() const { return m_x; } //!< x-position + double y() const { return m_y; } //!< y-position + double z() const { return m_z; } //!< z-position + + double mass() const { return m_mass; }//!< vertex mass estimated after the vertex fit + double massVariance() const { return m_massVar; }//!< variance of the vertex mass estimate + const TrigInDetTrackFitPar* getMotherTrack() { return m_P;} //!< parameters of a mother particle reconstructed after the vertex fit + + double energyFraction() const { return m_energyFraction; } //!< energy ratio E(secondary vertex)/E(jet) + int nTwoTracksSecVtx() const { return m_nTwoTracksSecVtx; }//!< number of 2-track vertices + double decayLength() const { return m_decayLength; } //!< decay length to the primary vertex used to find this secondary vertex + double decayLengthSignificance() const { return m_decayLengthSignificance;} //!< decay length divided by its error + + // Methods to set data members + + void setMass (double m) { m_mass = m; } + void setMassVariance (double m) { m_massVar = m; } + void setMotherTrack(const TrigInDetTrackFitPar* P) { m_P=P;} + + void setEnergyFraction (double e) { m_energyFraction = e; } + void setNTwoTrackSecVtx (int n) { m_nTwoTracksSecVtx = n; } + + void setDecayLength (double v) {m_decayLength = v;} + void setDecayLengthSignificance (double v) {m_decayLengthSignificance = v;} + + private: + + + double m_x,m_y,m_z,m_mass,m_massVar; + double m_cov[6]; + + double m_energyFraction;//!< energy ratio E(secondary vertex)/E(jet) + + int m_nTwoTracksSecVtx;//!< number of 2-track vertices + + double m_decayLength; + double m_decayLengthSignificance; + + HepGeom::Point3D<double> m_position; + double m_chiSquared; + int m_nDOF; + TrackInVertexList* m_tracks; + AlgoId m_algId; + const TrigInDetTrackFitPar* m_P; + bool m_ownTracks; + +}; + +std::string str( const TrigVertex& v ); //<! printing helper +MsgStream& operator<< ( MsgStream& m, const TrigVertex& v ); //<! printing helper (wraps above) +bool operator== ( const TrigVertex& a, const TrigVertex& b ); +inline bool operator!= ( const TrigVertex& a, const TrigVertex& b ) { return !(a==b); } + +/** @brief comparison with feedback + * Function compares two objects and returns "semi verbose" output + * in the form of map where there are varaibel names and differences + * between two obejcts + * @param variableChange - map to record the differences + * In case of collections (or objects when the size may be different) that information can also be returned in variableChange + */ +void diff( const TrigVertex& a, const TrigVertex& b, std::map<std::string, double>& variableChange ); + + +CLASS_DEF( TrigVertex , 224516498 , 1 ) + +#endif // TRIGINDETEVENT_TRIGVERTEX_H diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCollection.h new file mode 100755 index 0000000000000000000000000000000000000000..ad2b523e9156eab3d2068ab629d24963ac4dce26 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCollection.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGVERTEXCOLLECTION_H +#define TRIGINDETEVENT_TRIGVERTEXCOLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigVertex.h" +#include "SGTools/BaseInfo.h" + +class TrigVertexCollection: public DataVector< TrigVertex > {}; +//typedef DataVector<TrigVertex> TrigVertexCollection; + +// obtained using ./clid -m TrigVertexCollection + +CLASS_DEF( TrigVertexCollection , 1299073032 , 1 ) +CLASS_DEF( DataVector<TrigVertexCollection> , 1089493875 , 1 ) + +SG_BASE(TrigVertexCollection, DataVector<TrigVertex>); + +#endif // TRIGINDETEVENT_TRIGVERTEXCOLLECTION_H diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCounts.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCounts.h new file mode 100644 index 0000000000000000000000000000000000000000..a793161362dae20ee46cdff1ec3711939aefa89c --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCounts.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGVERTEXCOUNTS_H +#define TRIGINDETEVENT_TRIGVERTEXCOUNTS_H + +#include "CLIDSvc/CLASS_DEF.h" + +/** @class TrigVertexCounts + * @author W. H. Bell <W.Bell@cern.ch> + * + * A class to store the number of tracks and the pT^2 sum per reconstructed + * primary vertex. + */ +class TrigVertexCounts { +public: + + /** Default constructor used by T/P converters. */ + TrigVertexCounts(); + + /** Standard constructor used by FEX algorithms. */ + TrigVertexCounts(std::vector<unsigned int> vtxNtrks, + std::vector<float> vtxTrkPtSqSum); + + /** Copy Constructor */ + TrigVertexCounts(const TrigVertexCounts& trigVertexCounts); + + /** Destructor */ + ~TrigVertexCounts(); + + std::vector<unsigned int> vtxNtrks(void) const { return m_vtxNtrks; } + std::vector<float> vtxTrkPtSqSum(void) const { return m_vtxTrkPtSqSum; } + +private: + + std::vector<unsigned int> m_vtxNtrks; + std::vector<float> m_vtxTrkPtSqSum; +}; + +// obtained using clid -m TrigVertexCounts +CLASS_DEF( TrigVertexCounts , 64641956 , 1 ) + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCountsCollection.h b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCountsCollection.h new file mode 100644 index 0000000000000000000000000000000000000000..46f75516139f3c2452b0ad809c07797ce77249a2 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/TrigVertexCountsCollection.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETEVENT_TRIGVERTEXCOUNTSCOLLECTION_H +#define TRIGINDETEVENT_TRIGVERTEXCOUNTSCOLLECTION_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigInDetEvent/TrigVertexCounts.h" +#include "SGTools/BaseInfo.h" + +class TrigVertexCountsCollection : public DataVector<TrigVertexCounts> { }; + +CLASS_DEF( TrigVertexCountsCollection , 1092392202 , 1 ) + +SG_BASE(TrigVertexCountsCollection, DataVector<TrigVertexCounts>); + +#endif diff --git a/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/selection.xml b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/selection.xml new file mode 100755 index 0000000000000000000000000000000000000000..66af3d9017efcbd5f8ffac0712b21cb910c9c08a --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/TrigInDetEvent/selection.xml @@ -0,0 +1,85 @@ +<lcgdict> + <class name="TrigInDetTrackCollection" id="5F6029E6-764B-4126-891D-73BFC3CC391C" /> + <class name="DataVector<TrigInDetTrack>" /> + <class name="std::vector<TrigInDetTrack*>" /> + <class name="std::list<const TrigInDetTrack*>" /> + <class name="std::list<const TrigInDetTrack*>::iterator" /> + <class name="TrigInDetTrack" id="BF6B3636-BC2F-4309-903E-2117DC3407D8" > + <field name="m_siSpacePoints" transient="true" /> + <field name="m_trtDriftCircles" transient="true" /> + <field name="m_rdoList" transient="false" /> + </class> + + <class name="DataVector<TrigInDetTrackCollection>" id="D5A94D82-EB3C-4224-BD52-BD86F4DF578E" /> + <class name="std::vector<TrigInDetTrackCollection*>" /> + + + + <class name="TrigInDetTrackFitPar" id="D47C2A8F-4FCD-4E70-93B2-7A1E4EE9B264" > + <field name="m_cov" transient="false" /> + </class> + + <class name="DataVector<TrigInDetTrackFitPar>" id="28D972D0-B985-4017-A7B8-4FCF5E281936" /> + <class name="std::vector<TrigInDetTrackFitPar*>" /> + + <class name="TrigVertexCollection" id="0974DF97-5B51-4416-8FBE-42BAE0C54010" /> + <class name="DataVector<TrigVertex>" id="E2C600D6-CD4B-4B7B-9C09-93CE9FF435A1" /> + <class name="std::vector<TrigVertex*>" /> + <class name="TrigVertex" id="77CCC075-25BD-45B2-BEB9-F3EEFF5CF2AC" > + <field name="m_cov" transient="false" /> + <field name="m_tracks" transient="false" /> + <field name="m_position" transient="true" /> + <field name="m_P" transient="true" /> + </class> + + <class name="DataVector<TrigVertexCollection>" id="A7C5BCF0-051E-41BC-84A3-DBD29CA0911D" /> + <class name="std::vector<TrigVertexCollection*>" /> + + <function name="dummyTriggerForTVCollTypedef" /> + + <class name="TrigHisto"> + <field name="m_itr" transient="true" /> + <field name="m_itr_end" transient="true" /> + </class> + <class name="TrigHisto1D" id="1DC53456-7E55-4C1F-B9AA-820EAE5C2316" /> + <class name="TrigHisto2D" id="3C3241B3-2FDB-4C0B-B2E0-2A38C5FE6990"> + <field name="m_underflowBin_y" transient="true" /> + <field name="m_overflowBin_y" transient="true" /> + <field name="m_binSize_y" transient="true" /> + </class> + <class name="TrigHisto1DContainer" id="B5752F0C-EF7A-4330-8413-1CCF0FC58AC8" /> + <class name="DataVector<TrigHisto1D>" id="0D92B990-3850-4807-8B00-66990581C65C" /> + <class name="std::vector<TrigHisto1D*>" /> + <class name="TrigHisto2DContainer" id="E43A29FA-3BC9-4B08-9A94-735E1EC53951" /> + <class name="DataVector<TrigHisto2D>" id="6E82EA7A-95CD-4811-9A7B-CF96EB909338" /> + <class name="std::vector<TrigHisto2D*>" /> + + <class name="TrigSpacePointCountsCollection" id="633C9739-C3D1-4F5D-9678-887445DA42B6" /> + <class name="TrigSpacePointCounts" id="1BCAD9FD-DAFE-4E50-9A37-C75E822E6D02" /> + <class name="DataVector<TrigSpacePointCounts>" id="EB182127-C36B-419B-9057-A7CA43290D11" /> + <class name="std::vector<TrigSpacePointCounts*>" /> + + <class name="TrigTrtHitCountsCollection" id="7631C2C2-612F-4245-8C8B-D40F59222E1E" /> + <class name="TrigTrtHitCounts" id="6F04169E-E47C-4556-9456-256A659EC68B" /> + <class name="DataVector<TrigTrtHitCounts>" id="2BA9359C-C1A5-4298-A903-3273FB0400D0" /> + <class name="std::vector<TrigTrtHitCounts*>" /> + + <class name="TrigTrackCountsCollection" id="7A4412AD-C11D-4EFD-AE15-D343D2CB28BC" /> + <class name="DataVector<TrigTrackCounts>" id="BEB86BA3-2AE3-46D6-B496-43781B136492" /> + <class name="std::vector<TrigTrackCounts*>" /> + <class name="TrigTrackCounts" id="6277C97C-0EAA-4922-892E-E88C1FA01BA0" /> + + <class name="TrigVertexCountsCollection" id="0C1EE526-FB6C-44B6-8FA5-B9722ED6CB99" /> + <class name="DataVector<TrigVertexCounts>" id="ECC6DB82-CBE2-442A-A6A4-E5ECA7E183CC" /> + <class name="std::vector<TrigVertexCounts*>" /> + <class name="TrigVertexCounts" id="6EB3B5D2-3376-4231-8B0A-0984139F1D23" /> + + <class name="TrigTauTracksInfoCollection" id="27E95E77-0D99-417D-83C7-7F1B8E6DE511" /> + <class name="TrigTauTracksInfo" id="630E4944-7EDE-4938-B189-020DBC0436AE" > + <field name="m_tracks" transient="true" /> + </class> + <class name="DataVector<TrigTauTracksInfo>" id="562459CC-233C-4135-BAF8-515B194FDD10" /> + <class name="std::vector<TrigTauTracksInfo*>" /> + + +</lcgdict> diff --git a/Trigger/TrigEvent/TrigInDetEvent/cmt/requirements b/Trigger/TrigEvent/TrigInDetEvent/cmt/requirements new file mode 100755 index 0000000000000000000000000000000000000000..683dea3c2f11f182e4174fc0e3a926ae343908f8 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/cmt/requirements @@ -0,0 +1,105 @@ +package TrigInDetEvent + +public + +use AtlasCLHEP AtlasCLHEP-* External +use AtlasPolicy AtlasPolicy-* +use CLIDSvc CLIDSvc* Control +use DataModel DataModel-* Control +use EventKernel EventKernel-* Event +use FourMom FourMom* Event +use GaudiInterface GaudiInterface-* External +use Identifier Identifier-* DetectorDescription +use InDetPrepRawData InDetPrepRawData-* InnerDetector/InDetRecEvent +use Navigation Navigation-* Control +use SGTools SGTools-* Control +use TrkPrepRawData TrkPrepRawData-* Tracking/TrkEvent +use TrkTrack TrkTrack-* Tracking/TrkEvent +use TrkSpacePoint TrkSpacePoint-* Tracking/TrkEvent + +private + +use Particle Particle-* Reconstruction +use ParticleTruth ParticleTruth-* Reconstruction + +use TrigNavigation TrigNavigation-* Trigger/TrigEvent + +use TrkSegment TrkSegment-* Tracking/TrkEvent +use TrkTruthData TrkTruthData-* Tracking/TrkEvent +use VxSecVertex VxSecVertex-* Tracking/TrkEvent +use VxVertex VxVertex-* Tracking/TrkEvent + + +use TrkParameters TrkParameters-* Tracking/TrkEvent + +use xAODTracking xAODTracking-* Event/xAOD +use xAODTrigMinBias xAODTrigMinBias-* Event/xAOD + + +public + +library TrigInDetEvent *.cxx +apply_pattern installed_library + +#apply_pattern declare_non_standard_include name=doc + +private +# need AtlasSeal +use AtlasReflex AtlasReflex* External -no_auto_imports +use TrigSerializeUtils TrigSerializeUtils-* Trigger/TrigDataAccess + + +# Pattern to build the dict lib. User should create a single header +# file: <package>Dict.h which includes all other .h files. See MissingETDict +# A selection file must be created by hand. This file lists the +# classes to be added to the dictionary, and which fields are +# transient. It should be put in ../<package> dir and is conventionally called +# selection.xml. +#macro_append reflex_dict_options --debug + +apply_pattern lcgdict dict=TrigInDetEvent selectionfile=selection.xml \ + headerfiles="../TrigInDetEvent/TrigInDetEventDict.h" \ + elementLinks="TrigInDetTrackCollection" \ + dataLinks="TrigTrackCounts TrigVertexCounts TrigTauTracksInfo TrigSpacePointCounts TrigTrtHitCounts TrigVertexCollection" + +apply_pattern sercnv typesWithNamespace="Rec::TrackParticleContainer Trk::SegmentCollection " \ + files="-s=${TrigInDetEvent_root}/TrigInDetEvent TrigInDetTrack.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigInDetTrackCollection.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigInDetTrackFitPar.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigVertex.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigVertexCollection.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigTrackCounts.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigTrackCountsCollection.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigVertexCounts.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigVertexCountsCollection.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigTauTracksInfo.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigTauTracksInfoCollection.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigHisto1D.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigHisto2D.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigSpacePointCounts.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigSpacePointCountsCollection.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigTrtHitCounts.h \ + -s=${TrigInDetEvent_root}/TrigInDetEvent TrigTrtHitCountsCollection.h \ + -s=${TrkTrack_root}/TrkTrack TrackCollection.h TrackExtensionMap.h \ + -s=${VxVertex_root}/VxVertex VxContainer.h \ + -s=${TrkSegment_root}/TrkSegment SegmentCollection.h \ + -s=${Particle_root}/Particle TrackParticleContainer.h " + +apply_pattern sercnv \ +libtag="xAOD" \ +typesWithNamespace="xAOD::TrackParticle xAOD::TrackParticleContainer xAOD::TrackParticleAuxContainer \ + xAOD::Vertex xAOD::VertexContainer xAOD::VertexAuxContainer \ + xAOD::TrigSpacePointCounts xAOD::TrigSpacePointCountsContainer xAOD::TrigSpacePointCountsAuxContainer \ + xAOD::TrigHisto2D xAOD::TrigHisto2DContainer xAOD::TrigHisto2DAuxContainer \ + xAOD::TrigVertexCounts xAOD::TrigVertexCountsContainer xAOD::TrigVertexCountsAuxContainer \ + xAOD::TrigTrackCounts xAOD::TrigTrackCountsContainer xAOD::TrigTrackCountsAuxContainer" \ + files="-s=${xAODTracking_root}/xAODTracking VertexContainer.h VertexAuxContainer.h \ + TrackParticleContainer.h TrackParticleAuxContainer.h \ + -s=${xAODTrigMinBias_root}/xAODTrigMinBias TrigSpacePointCountsContainer.h TrigSpacePointCountsAuxContainer.h \ + TrigHisto2DContainer.h TrigHisto2DAuxContainer.h \ + TrigVertexCountsContainer.h TrigVertexCountsAuxContainer.h \ + TrigTrackCountsContainer.h TrigTrackCountsAuxContainer.h" + + +end_private + diff --git a/Trigger/TrigEvent/TrigInDetEvent/doc/mainpage.h b/Trigger/TrigEvent/TrigInDetEvent/doc/mainpage.h new file mode 100755 index 0000000000000000000000000000000000000000..3f90ae06ff1b9741b151bedc2fe80da0e1870e4c --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/doc/mainpage.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** +@mainpage TrigInDetEvent Package + +This package contains classes used in the LVL2 ID algorithms + +@author D.Emeliyanov AT rlDOTacDOTuk + +@section TrigInDetEventIntro Introduction + +The following classes are defined + + - TrigInDetTrackFitPar : represents a set of LVL2 track parameters with associated covariance + - TrigInDetTrack : a LVL2 track containing TrigInDetTrackFitPar(s) and input data - Pixel and SCT + spacepoints and TRT drift circles + - TrigSiSpacePoint : a LVL2 spacepoint in Pixel or SCT + - TrigVertex : a LVL2 vertex class containing vertex coordinates, covariance matrix, and + some auxilliary information about vertex + - TrigHisto : A base class for TrigHisto1D and TrigHisto2D, contains common code. Not + stored directly. TP converters do not persistify this class. + - TrigHisto1D : A class to store a 1D histogram for a given event and provide cut + functionality. This class is used by TrigTrtHitCounts. + - TrigHisto2D : A class to store a 1D histogram for a given event and provide cut and profile + functionality. This class is used by TrigSpacePointCounts and + TrigTrackCounts. + - TrigSpacePointCounts : Contains 3 histograms (TrigHisto2D of Pixel cluster time over threshold vs size, + for endcap C, barrel and endcap A. It also contains the total number of + SCT space points for endcap C, barrel and endcap A. + - TrigTrtHitCounts : Contains 3 histograms (TrigHisto1D) of TRT time over threshold for + endcap C, barrel and endcap A. + - TrigTrackCounts : Contains 2 histograms (TrigHisto2D) of track z0 vs pt and eta vs phi + respectively + +This package also contains selection.xml - a file for lcgdict generation + +@section TrigInDetEventReq Requirements + +@include requirements + +*/ diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto.cxx new file mode 100644 index 0000000000000000000000000000000000000000..78116814dd39b82205df6bd6436ccd4b5ce47ae2 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto.cxx @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigHisto.h" + +//--------------------------------------------------------------- + +TrigHisto::TrigHisto(void): m_nbins_x(0), + m_underflowBin_x(0), + m_overflowBin_x(0), + m_min_x(0.), + m_max_x(0.), + m_binSize_x(0.) { +} + +//--------------------------------------------------------------- + +TrigHisto::~TrigHisto(void) { +} + +//--------------------------------------------------------------- + +void TrigHisto::clear(void) { + m_itr = m_contents.begin(); + m_itr_end = m_contents.end(); + for(; m_itr != m_itr_end; ++m_itr) (*m_itr) = 0.; +} + +//--------------------------------------------------------------- + +// Require histogram sizes such that it might be called by TrigHisto2D too. +unsigned int TrigHisto::findBin(unsigned int nbins, + float h_min, + float h_max, + float binSize, + float value) { + unsigned int ibin = 0; + + if(value < h_min) { // Underflow + ibin = 0; + } + else if( !(value < h_max)) { // Overflow (catches NaN) + ibin = nbins+1; + } + else { + while(value > (ibin*binSize+h_min) && ibin <= nbins) { // None under/overflow from 1 to nbins + ibin++; + } + } + + return ibin; +} + +//--------------------------------------------------------------- diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto1D.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto1D.cxx new file mode 100644 index 0000000000000000000000000000000000000000..763add30357ab907ef6e39943852ac29a94c9461 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto1D.cxx @@ -0,0 +1,133 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigHisto1D.h" + +using namespace TrigHistoCutType; + +//--------------------------------------------------------------- + +TrigHisto1D::TrigHisto1D(): TrigHisto() { +} + +//--------------------------------------------------------------- + +TrigHisto1D::TrigHisto1D(unsigned int nbins_x, + float min_x, + float max_x): TrigHisto() { + + m_nbins_x = nbins_x; + m_min_x = min_x; + m_max_x = max_x; + + m_contents.clear(); + m_contents.resize(m_nbins_x+2, 0); // Two additional bins for under and overflow. + + if(m_nbins_x != 0) { + m_binSize_x = (m_max_x - m_min_x)/((float)m_nbins_x); // Calculate bin size. + } + else { + m_binSize_x = 0.; + } + + m_underflowBin_x = 0; // Cache this to make the code more readable. + m_overflowBin_x = m_nbins_x+1; // Cache this to make the code more readable and faster. +} + +//--------------------------------------------------------------- + +TrigHisto1D::TrigHisto1D(unsigned int nbins_x, + float min_x, + float max_x, + std::vector<float> contents) { + m_nbins_x = nbins_x; + m_min_x = min_x; + m_max_x = max_x; + + m_contents = contents; + m_contents.resize(m_nbins_x+2, 0); // Resize if it not the correct size. + + m_binSize_x = (m_max_x - m_min_x)/((float)m_nbins_x); // Calculate bin size. + + m_underflowBin_x = 0; // Cache this to make the code more readable. + m_overflowBin_x = m_nbins_x+1; // Cache this to make the code more readable and faster. +} + +//--------------------------------------------------------------- + +TrigHisto1D::~TrigHisto1D() { +} + +//--------------------------------------------------------------- + +TrigHisto1D::TrigHisto1D(const TrigHisto1D& trigHisto): TrigHisto() { + m_nbins_x = trigHisto.m_nbins_x; + m_min_x = trigHisto.m_min_x; + m_max_x = trigHisto.m_max_x; + m_contents = trigHisto.m_contents; + m_binSize_x = trigHisto.m_binSize_x; + m_underflowBin_x = trigHisto.m_underflowBin_x; + m_overflowBin_x = trigHisto.m_overflowBin_x; +} + +//--------------------------------------------------------------- + +TrigHisto1D& TrigHisto1D::operator=(const TrigHisto1D& trigHisto) { + m_nbins_x = trigHisto.m_nbins_x; + m_min_x = trigHisto.m_min_x; + m_max_x = trigHisto.m_max_x; + m_contents = trigHisto.m_contents; + m_binSize_x = trigHisto.m_binSize_x; + m_underflowBin_x = trigHisto.m_underflowBin_x; + m_overflowBin_x = trigHisto.m_overflowBin_x; + + return *this; +} + +//--------------------------------------------------------------- + +void TrigHisto1D::fill(float value_x, float weight) { + unsigned int ibin; + + ibin = findBin(m_nbins_x, m_min_x, m_max_x, m_binSize_x, value_x); + + m_contents[ibin] += weight; // Append the weight to this bin. +} + +//--------------------------------------------------------------- + +double TrigHisto1D::sumEntries(float value_x, int cutType) { + unsigned int ibin_x, ibin_x_selected; + double entries; + + // Find which bin contains the value_x. + ibin_x_selected = findBin(m_nbins_x, m_min_x, m_max_x, m_binSize_x, value_x); + + entries = 0.; + + if( m_nbins_x==0 ){ + return 0; + } + else{ + + if (cutType == BELOW_X) { + for(ibin_x = m_underflowBin_x; ibin_x <= ibin_x_selected; ibin_x++) { + entries += m_contents[ibin_x]; + } + } + else if(cutType == ABOVE_X) { + for(ibin_x = ibin_x_selected; ibin_x <= m_overflowBin_x; ibin_x++) { + entries += m_contents[ibin_x]; + } + } + else { + return 0; //<! Should report error message. + } + } + + return entries; +} + +//--------------------------------------------------------------- + diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto2D.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto2D.cxx new file mode 100644 index 0000000000000000000000000000000000000000..23af5de8ea2358a5f7754b084a46cb1b3602098f --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigHisto2D.cxx @@ -0,0 +1,225 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigHisto2D.h" + +using namespace TrigHistoCutType; + +//--------------------------------------------------------------- + +TrigHisto2D::TrigHisto2D(): TrigHisto(), + m_nbins_y(0), + m_underflowBin_y(0), + m_overflowBin_y(0), + m_min_y(0.), + m_max_y(0.), + m_binSize_y(0.) { +} + +//--------------------------------------------------------------- + +TrigHisto2D::TrigHisto2D(unsigned int nbins_x, + float min_x, float max_x, + unsigned int nbins_y, + float min_y, float max_y): TrigHisto(), + m_nbins_y(nbins_y), + m_min_y(min_y), + m_max_y(max_y) { + m_nbins_x = nbins_x; + m_min_x = min_x; + m_max_x = max_x; + + unsigned int nbins; + + nbins = (nbins_x+2)*(nbins_y+2); // Two additional bins for under and overflow per 1d profile. + + m_contents.clear(); + m_contents.resize(nbins, 0.); // Two additional bins for under and overflow per 1d profile. + + if(m_nbins_x != 0) { + m_binSize_x = (m_max_x - m_min_x)/((float)m_nbins_x); // Calculate bin size. + } + else { + m_binSize_x = 0.; + } + if(m_nbins_y != 0) { + m_binSize_y = (m_max_y - m_min_y)/((float)m_nbins_y); // Calculate bin size. + } + else { + m_binSize_y = 0.; + } + + m_underflowBin_x = 0; // Cache this to make the code more readable. + m_overflowBin_x = m_nbins_x+1; // Cache this to make the code more readable and faster. + m_underflowBin_y = 0; // Cache this to make the code more readable. + m_overflowBin_y = m_nbins_y+1; // Cache this to make the code more readable and faster. +} + +//--------------------------------------------------------------- + +TrigHisto2D::~TrigHisto2D() { +} + +//--------------------------------------------------------------- + +TrigHisto2D::TrigHisto2D(const TrigHisto2D& trigHisto): TrigHisto() { + m_nbins_x = trigHisto.m_nbins_x; + m_min_x = trigHisto.m_min_x; + m_max_x = trigHisto.m_max_x; + + m_nbins_y = trigHisto.m_nbins_y; + m_min_y = trigHisto.m_min_y; + m_max_y = trigHisto.m_max_y; + + m_contents = trigHisto.m_contents; + + m_binSize_x = trigHisto.m_binSize_x; + m_binSize_y = trigHisto.m_binSize_y; + + m_underflowBin_x = trigHisto.m_underflowBin_x; + m_overflowBin_x = trigHisto.m_overflowBin_x; + m_underflowBin_y = trigHisto.m_underflowBin_y; + m_overflowBin_y = trigHisto.m_overflowBin_y; +} + +//--------------------------------------------------------------- + +TrigHisto2D& TrigHisto2D::operator=(const TrigHisto2D& trigHisto) { + m_nbins_x = trigHisto.m_nbins_x; + m_min_x = trigHisto.m_min_x; + m_max_x = trigHisto.m_max_x; + + m_nbins_y = trigHisto.m_nbins_y; + m_min_y = trigHisto.m_min_y; + m_max_y = trigHisto.m_max_y; + + m_contents = trigHisto.m_contents; + + m_binSize_x = trigHisto.m_binSize_x; + m_binSize_y = trigHisto.m_binSize_y; + + m_underflowBin_x = trigHisto.m_underflowBin_x; + m_overflowBin_x = trigHisto.m_overflowBin_x; + m_underflowBin_y = trigHisto.m_underflowBin_y; + m_overflowBin_y = trigHisto.m_overflowBin_y; + + return *this; +} + +//--------------------------------------------------------------- + +void TrigHisto2D::fill(float value_x, float value_y, float weight) { + unsigned int ibin_x, ibin_y, ibin; + + ibin_x = findBin(m_nbins_x, m_min_x, m_max_x, m_binSize_x, value_x); + ibin_y = findBin(m_nbins_y, m_min_y, m_max_y, m_binSize_y, value_y); + + ibin = ibin_y*(m_nbins_x+2) + ibin_x; // Find position in 1d data array + + m_contents[ibin] += weight; // Append the weight to this bin +} + +//--------------------------------------------------------------- + +double TrigHisto2D::sumEntries(float value_x, float value_y, int cutType) { + unsigned int ibin, ibin_x, ibin_y, ibin_x_selected, ibin_y_selected; + double entries; + + + + // Find the x bin index that the cut corresponds to. + ibin_x_selected = findBin(m_nbins_x, m_min_x, m_max_x, m_binSize_x, value_x); + + // Find the y bin index that the cut corresponds to. + ibin_y_selected = findBin(m_nbins_y, m_min_y, m_max_y, m_binSize_y, value_y); + + entries = 0.; + + + if( m_nbins_x==0 || m_nbins_y==0 ){ + return 0; + } + else{ + + if(cutType == BELOW_X_BELOW_Y) { + for(ibin_x = m_underflowBin_x; ibin_x <= ibin_x_selected; ibin_x++) { + for(ibin_y = m_underflowBin_y; ibin_y <= ibin_y_selected; ibin_y++) { + ibin = ibin_y*(m_nbins_x+2) + ibin_x; // Find position in 1d data array + entries += m_contents[ibin]; + } + } + } + else if(cutType == ABOVE_X_BELOW_Y) { + for(ibin_x = ibin_x_selected; ibin_x <= m_overflowBin_x; ibin_x++) { + for(ibin_y = m_underflowBin_y; ibin_y <= ibin_y_selected; ibin_y++) { + ibin = ibin_y*(m_nbins_x+2) + ibin_x; // Find position in 1d data array + entries += m_contents[ibin]; + } + } + } + else if(cutType == BELOW_X_ABOVE_Y) { + for(ibin_x = m_underflowBin_x; ibin_x <= ibin_x_selected; ibin_x++) { + for(ibin_y = ibin_y_selected; ibin_y <= m_overflowBin_y; ibin_y++) { + ibin = ibin_y*(m_nbins_x+2) + ibin_x; // Find position in 1d data array + entries += m_contents[ibin]; + } + } + } + else if(cutType == ABOVE_X_ABOVE_Y) { + for(ibin_x = ibin_x_selected; ibin_x <= m_overflowBin_x; ibin_x++) { + for(ibin_y = ibin_y_selected; ibin_y <= m_overflowBin_y; ibin_y++) { + ibin = ibin_y*(m_nbins_x+2) + ibin_x; // Find position in 1d data array + entries += m_contents[ibin]; + } + } + } + else { + return 0; + } + }// else of m_nbins!=0 + + return entries; +} + +//--------------------------------------------------------------- + +TrigHisto1D TrigHisto2D::profileX(void) { + unsigned int ibin, ibin_x, ibin_y; + + // Define size carefully to avoid memory problems in for loop. + std::vector<float> contents((m_overflowBin_x-m_underflowBin_x+1),0.); + + // Sum all y bins for each x bin. + for(ibin_x = m_underflowBin_x; ibin_x <= m_overflowBin_x; ibin_x++) { + for(ibin_y = m_underflowBin_y; ibin_y <= m_overflowBin_y; ibin_y++) { + ibin = ibin_y*(m_nbins_x+2) + ibin_x; // Find position in 1d data array + contents[ibin_x] += m_contents[ibin]; + } + } + + // Return a 1D histogram containing the profile contents. + return TrigHisto1D(m_nbins_x, m_min_x, m_max_x, contents); +} + +//--------------------------------------------------------------- + +TrigHisto1D TrigHisto2D::profileY(void) { + unsigned int ibin, ibin_x, ibin_y; + + // Define size carefully to avoid memory problems in for loop. + std::vector<float> contents((m_overflowBin_y-m_underflowBin_y+1),0.); + + // Sum all x bins for each y bin. + for(ibin_y = m_underflowBin_y; ibin_y <= m_overflowBin_y; ibin_y++) { + for(ibin_x = m_underflowBin_x; ibin_x <= m_overflowBin_x; ibin_x++) { + ibin = ibin_y*(m_nbins_x+2) + ibin_x; // Find position in 1d data array + contents[ibin_y] += m_contents[ibin]; + } + } + + // Return a 1D histogram containing the profile contents. + return TrigHisto1D(m_nbins_y, m_min_y, m_max_y, contents); +} + +//--------------------------------------------------------------- diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetEventStorageDefinitions.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetEventStorageDefinitions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d2aed115b662155eb43b9ec370444f6a7f0e8064 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetEventStorageDefinitions.cxx @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigInDetTrackCollection.h" +#include "TrigInDetEvent/TrigTauTracksInfoCollection.h" +#include "TrigInDetEvent/TrigVertexCollection.h" +#include "TrigInDetEvent/TrigSpacePointCountsCollection.h" +#include "TrigInDetEvent/TrigTrtHitCountsCollection.h" +#include "TrigInDetEvent/TrigTrackCountsCollection.h" +#include "TrigInDetEvent/TrigVertexCountsCollection.h" +#include "TrigInDetEvent/TrigInDetTrackFitPar.h" +#include "TrkTrack/TrackCollection.h" +#include "Particle/TrackParticleContainer.h" +#include "VxVertex/VxContainer.h" +#include "TrkTruthData/TrkTruthARA.h" +#include "TrkSegment/SegmentCollection.h" +#include "TrkTrack/TrackExtensionMap.h" +#include "ParticleTruth/TrackParticleTruthCollection.h" +#include "ParticleTruth/TrackParticleTruthCollectionContainer.h" +#include "VxSecVertex/VxSecVertexInfo.h" + +typedef DataVector<struct TrackExtensionMap> TrackExtensionMapContainer; +CLASS_DEF( TrackExtensionMapContainer , 1280217485 , 1 ) + +#include "TrigNavigation/TypeRegistration.h" +REGISTER_PACKAGE_WITH_NAVI(TrigInDetEvent) diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetTrack.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetTrack.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b95752293779dc4fce08894c6c3ecb13ef433676 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetTrack.cxx @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigInDetTrack.h" + +void TrigInDetTrack::m_fillSiHitInfo() +{ + eraseRdoList(); + if(m_siSpacePoints==NULL) return; + m_NPixelSpacePoints=0;m_NSCT_SpacePoints=0;m_HitPattern=0; + for(std::vector<const TrigSiSpacePoint*>::iterator it = m_siSpacePoints->begin(); + it!= m_siSpacePoints->end();++it) + { + + std::pair < const InDet::SiCluster*, const InDet::SiCluster* > cls = (*it)->clusters(); + if(cls.second==NULL) {//i.e pixel + m_NPixelSpacePoints++; + } + else { + m_NSCT_SpacePoints++; + } + + long layer = (*it)->layer(); + long mask = 1 << layer; + m_HitPattern |= mask; + } +} + +void TrigInDetTrack::fillRdoList() { + if(m_siSpacePoints==NULL) return; + m_rdoList.clear(); + for(std::vector<const TrigSiSpacePoint*>::iterator it = m_siSpacePoints->begin(); + it!= m_siSpacePoints->end();++it) + { + std::pair < const InDet::SiCluster*, const InDet::SiCluster* > cls = (*it)->clusters(); + if(cls.first!=NULL) { + std::copy(cls.first->rdoList().begin(),cls.first->rdoList().end(),std::back_inserter(m_rdoList)); + } + if(cls.second!=NULL) { + std::copy(cls.second->rdoList().begin(),cls.second->rdoList().end(),std::back_inserter(m_rdoList)); + } + } +} + +std::string str( const TrigInDetTrack& t ) //<! printing helper +{ + std::stringstream ss; + const TrigInDetTrackFitPar* p = t.param(); + + ss << "AlgorithmID: "<<t.algorithmId() + << "d0: "<<p->a0() + <<" z0: "<<p->z0() + <<" phi0: "<<p->phi0() + <<" eta: "<<p->eta() + <<" pT: "<<p->pT() + <<" chi2: "<<t.chi2() + <<" NpixSPs: "<<t.NPixelSpacePoints() + <<" NsctSPs: "<<t.NSCT_SpacePoints() + <<" NstrawHits: "<<t.NStrawHits() + <<" HitPattern: "<<t.HitPattern(); + return ss.str(); +} + +MsgStream& operator<< ( MsgStream& m, const TrigInDetTrack& t ) //<! printing helper (wraps above) +{ + m << str(t); + return m; +} + +bool operator== ( const TrigInDetTrack& a, const TrigInDetTrack& b ) +{ + const double epsilon = 1e-8; + + const TrigInDetTrackFitPar* pA = a.param(); + const TrigInDetTrackFitPar* pB = b.param(); + + if(a.algorithmId() != b.algorithmId()) return false; + if(a.HitPattern() != b.HitPattern()) return false; + if(a.NStrawHits() != b.NStrawHits()) return false; + if(fabs(a.chi2()-b.chi2())>epsilon) return false; + if(fabs(pA->a0()-pB->a0())>epsilon) return false; + if(fabs(pA->z0()-pB->z0())>epsilon) return false; + if(fabs(pA->phi0()-pB->phi0())>epsilon) return false; + if(fabs(pA->eta()-pB->eta())>epsilon) return false; + if(fabs(pA->pT()-pB->pT())>epsilon) return false; + return true; +} + +void diff( const TrigInDetTrack& a, const TrigInDetTrack& b, std::map<std::string, double>& variableChange ) +{ + const TrigInDetTrackFitPar* pA = a.param(); + const TrigInDetTrackFitPar* pB = b.param(); + + variableChange["d0"] = pA->a0() - pB->a0(); + variableChange["z0"] = pA->z0() - pB->z0(); + variableChange["phi0"] = pA->phi0() - pB->phi0(); + variableChange["eta"] = pA->eta() - pB->eta(); + variableChange["pT"] = pA->pT() - pB->pT(); + variableChange["chi2"] = a.chi2() - b.chi2(); +} + diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetTrackHelper.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetTrackHelper.cxx new file mode 100755 index 0000000000000000000000000000000000000000..8b2e26ee44d75e2682751e1b04b7c2d6c1d908ed --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigInDetTrackHelper.cxx @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <cmath> +#include "TrigInDetEvent/TrigInDetTrackHelper.h" + + +/* ---------------------------------------------------------------------- */ +void TrigInDetTrackHelper::extrapolate(double rC, double zC, double &phiC, double &etaC) const { +/*----------------------------------------------------------------------* + + * pt (I) : pt * + * pz (I) : pz * + * q (I) : charge * + * phi0 (I) : phi of dirn vec at closest approach to (0,0) * + * d0 (I) : dist. (mm) of close appr. to (0,0) in xy plane * + * z0 (I) : z at r=d0 (mm) * + * rC (I) : radius of Cylinder (mm) * + * zC (I) : half-length in z of Cylinder (mm) * + * phiC (O) : phi of track at (rC, zC) * + * etaC (O) : eta of track at (rC, zC) * + * * + * Note : looping tracks are not treated correctly, phiC is set twopi * + * * + * Author : John Baines Date : 12/11/97 * + * from an original concept by Simon George * + * * + *----------------------------------------------------------------------*/ +#define BFIELD 2.0 + double Rcurv,r, z, xD, xN, dphi; + + double pt = m_param->pT(); + double eta = m_param->eta(); + double q = 1.; + if (pt < 0) q = -1.; + double theta = 2.*atan(exp(-fabs(eta))); + double pz = fabs(pt) / tan(theta); + if (eta < 0) pz = -pz; + double d0 = m_param->a0(); + double z0 = m_param->z0(); + double phi0 = m_param->phi0(); + + phiC = 0; + etaC = 0; + if (rC > 0 && fabs(zC) > 0 && pt != 0 && fabs(z0) < zC) { + + /* r, z of intersection with cylinder */ + + z = z0 + pz * (rC - fabs(d0)) / fabs(pt); + if (fabs(z) > fabs(zC)) { + /* track passes through the end of the cylinder */ + if (z > 0) z = fabs(zC); else z = -fabs(zC); + r = fabs(d0) + (z - z0) * fabs(pt) / pz; + r = fabs(r); /* NOT SURE IF -ve r is handled correctly */ + } else r = rC; /* hits barrel of cylinder */ + + theta = atan2(r, fabs(z)) / 2.; + if (z > 0) etaC = -log(tan(theta)); + else etaC = log(tan(theta)); + + /* Now calculate phiC */ + + if (q == 0) { /* Neutral Track */ + if (fabs(d0) <= r) phiC = phi0 - asin(fabs(d0)/r); + } else { /* Charged track */ + Rcurv = fabs(pt)/(0.3*BFIELD); + xD = 2. * r*(Rcurv + d0); + if (xD != 0) { + xN = d0 * d0 + r * r + 2. * Rcurv * d0; + if (fabs(xN)/fabs(xD) > 1) { + /* trajectory does not reach r, track loops + ***temporary set dphi to 0 for this case */ + phiC = 2. * M_PI; + } else { + dphi = q*acos(xN/xD); + /* two solutions from the 2 intersections of the 2 circles, + but phi0 defines a direction a direction, so the first solution + should be the one we want....*/ + phiC = phi0 - q*M_PI_2 + dphi; + } + } else phiC = 0; /* means track is orbiting the origin */ + + } + /* fold back into -pi to pi */ + while (phiC > M_PI) phiC = phiC - 2. * M_PI; + while (phiC < -M_PI) phiC = phiC + 2. * M_PI; + } +} diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigL2Vertex.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigL2Vertex.cxx new file mode 100755 index 0000000000000000000000000000000000000000..290f5bd4cd96dd94c155f6c9cac90e587289bee8 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigL2Vertex.cxx @@ -0,0 +1,736 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <cstring> +#include "TrigInDetEvent/TrigL2Vertex.h" +#include "TrkParameters/TrackParameters.h" + +TrigVertexFitInputTrack::TrigVertexFitInputTrack(const TrigInDetTrack* pT, double mass=0.0) : m_mass(mass) +{ + m_nTrackType=1;m_active=true; + m_pTrigTrack=pT;m_pTrkTrack=NULL; + double Ck[5][5]; + int i,j; + + const TrigInDetTrackFitPar* p=pT->param(); + + double a=-2.0*exp(-p->eta())/(1.0+exp(-2.0*p->eta())); + m_u[0]=p->a0(); + m_u[1]=p->z0(); + m_q[0]=p->phi0(); + m_q[1]=2.0*atan(exp(-p->eta())); + m_q[2]=p->pT()/1000.0; + + + Ck[0][0]=(*p->cov())[0];Ck[0][1]=Ck[1][0]=(*p->cov())[2]; + Ck[0][2]=Ck[2][0]=(*p->cov())[1];Ck[0][3]=Ck[3][0]=(*p->cov())[3]; + Ck[0][4]=Ck[4][0]=(*p->cov())[4];Ck[1][1]=(*p->cov())[9]; + Ck[1][2]=Ck[2][1]=(*p->cov())[6];Ck[1][3]=Ck[3][1]=(*p->cov())[10]; + Ck[1][4]=Ck[4][1]=(*p->cov())[11];Ck[2][2]=(*p->cov())[5]; + Ck[2][3]=Ck[3][2]=(*p->cov())[7];Ck[2][4]=Ck[4][2]=(*p->cov())[8]; + Ck[3][3]=(*p->cov())[12];Ck[3][4]=Ck[4][3]=(*p->cov())[13]; + Ck[4][4]=(*p->cov())[14]; + for(i=0;i<5;i++) + { + Ck[3][i]=a*Ck[3][i];Ck[i][3]=Ck[3][i]; + } + Ck[3][3]*=a; + for(i=0;i<5;i++) + { + Ck[4][i]=Ck[4][i]/1000.0;Ck[i][4]=Ck[4][i]; + } + Ck[4][4]/=1000.0; + + + for(i=0;i<2;i++) for(j=0;j<2;j++) m_Vuu[i][j]=Ck[i][j]; + for(i=0;i<2;i++) for(j=0;j<3;j++) m_Vuq[i][j]=Ck[i][j+2]; + for(i=0;i<3;i++) for(j=0;j<3;j++) m_Vqq[i][j]=Ck[i+2][j+2]; + + /* + m_Vuu[0][0]=(*p->cov())[0]; + m_Vuu[0][1]=m_Vuu[1][0]=(*p->cov())[2]; + m_Vuu[1][1]=(*p->cov())[9]; + + m_Vuq[0][0]=(*p->cov())[1];m_Vuq[0][1]=(*p->cov())[3]*a; + m_Vuq[0][2]=(*p->cov())[4]*1e-3;m_Vuq[1][0]=(*p->cov())[6];m_Vuq[1][1]=(*p->cov())[10]*a; + m_Vuq[1][2]=(*p->cov())[11]*1e-3; + + m_Vqq[0][0]=(*p->cov())[5];m_Vqq[0][1]=m_Vqq[1][0]=(*p->cov())[7]*a; + m_Vqq[0][2]=m_Vqq[2][0]=(*p->cov())[8]*1e-3; + m_Vqq[1][1]=(*p->cov())[12]*a*a;m_Vqq[1][2]=m_Vqq[2][1]=(*p->cov())[13]*a*1e-3; + m_Vqq[2][2]=(*p->cov())[14]*1e-6; + */ + m_Perigee[0]=m_u[0];m_Perigee[1]=m_u[1];m_Perigee[2]=m_q[0];m_Perigee[3]=m_q[1];m_Perigee[4]=m_q[2]; +} + +TrigVertexFitInputTrack::TrigVertexFitInputTrack(const Trk::Track* pT,double mass=0.0) : m_mass(mass) +{ + double Ck[5][5]; + + m_nTrackType=2;m_active=true; + m_pTrkTrack=pT;m_pTrigTrack=NULL; + + const Trk::Perigee* pP= pT->perigeeParameters(); + + m_u[0]=pP->parameters()[Trk::d0]; + m_u[1]=pP->parameters()[Trk::z0]; + m_q[0]=pP->parameters()[Trk::phi0]; + m_q[1]=pP->parameters()[Trk::theta]; + + double ptC=1000.0*pP->parameters()[Trk::qOverP]; + + m_q[2]=sin(pP->parameters()[Trk::theta])/ptC; + + if( pP->covariance() ){ + // has covariance matrix + const AmgSymMatrix(5)* TC = pP->covariance(); + + Ck[0][0]=(*TC)(Trk::d0,Trk::d0); + Ck[0][1]=Ck[1][0]=(*TC)(Trk::d0,Trk::z0); + Ck[0][2]=Ck[2][0]=(*TC)(Trk::d0,Trk::phi0); + Ck[0][3]=Ck[3][0]=(*TC)(Trk::d0,Trk::theta); + Ck[0][4]=Ck[4][0]=(*TC)(Trk::d0,Trk::qOverP); + Ck[1][1]=(*TC)(Trk::z0,Trk::z0); + Ck[1][2]=Ck[2][1]=(*TC)(Trk::z0,Trk::phi0); + Ck[1][3]=Ck[3][1]=(*TC)(Trk::z0,Trk::theta); + Ck[1][4]=Ck[4][1]=(*TC)(Trk::z0,Trk::qOverP); + Ck[2][2]=(*TC)(Trk::phi0,Trk::phi0); + Ck[2][3]=Ck[3][2]=(*TC)(Trk::phi0,Trk::theta); + Ck[2][4]=Ck[4][2]=(*TC)(Trk::phi0,Trk::qOverP); + Ck[3][3]=(*TC)(Trk::theta,Trk::theta); + Ck[3][4]=Ck[4][3]=(*TC)(Trk::theta,Trk::qOverP); + Ck[4][4]=(*TC)(Trk::qOverP,Trk::qOverP); + + double a,b; + + a=cos(pP->parameters()[Trk::theta])/ptC; + b=-sin(pP->parameters()[Trk::theta])/(pP->parameters()[Trk::qOverP]*ptC); + + Ck[3][3]=Ck[3][3]+2.0*a*Ck[3][4]+a*a*Ck[4][4]; + Ck[3][4]=Ck[4][3]=b*Ck[3][4]+a*b*Ck[4][4]; + Ck[4][4]=b*b*Ck[4][4]; + Ck[0][3]=Ck[3][0]=Ck[0][3]+a*Ck[0][4];Ck[0][4]*=b;Ck[4][0]=Ck[0][4]; + Ck[1][3]=Ck[3][1]=Ck[1][3]+a*Ck[1][4];Ck[1][4]*=b;Ck[4][1]=Ck[1][4]; + Ck[2][3]=Ck[3][2]=Ck[2][3]+a*Ck[2][4];Ck[2][4]*=b;Ck[4][2]=Ck[2][4]; + for(int i=0;i<2;i++) for(int j=0;j<2;j++) m_Vuu[i][j]=Ck[i][j]; + for(int i=0;i<3;i++) for(int j=0;j<3;j++) m_Vqq[i][j]=Ck[i+2][j+2]; + for(int i=0;i<2;i++) for(int j=0;j<3;j++) m_Vuq[i][j]=Ck[i][j+2]; + + m_Perigee[0]=m_u[0];m_Perigee[1]=m_u[1];m_Perigee[2]=m_q[0];m_Perigee[3]=m_q[1];m_Perigee[4]=m_q[2]; + } + else{ + m_active=false; + // no covariance + } + +} + +TrigVertexFitInputTrack::~TrigVertexFitInputTrack() +{ + +} + +void TrigVertexFitInputTrack::m_setMass(double m) +{ + m_mass=m; +} + +void TrigVertexFitInputTrack::m_mask() +{ + m_active=false; +} + +void TrigVertexFitInputTrack::m_activate() +{ + m_active=true; +} + +bool TrigVertexFitInputTrack::m_isActive() +{ + return m_active; +} + +int TrigVertexFitInputTrack::m_getTrackType() +{ + return m_nTrackType; +} + + +const TrigInDetTrack* TrigVertexFitInputTrack::m_getTrigTrack() +{ + return m_pTrigTrack; +} + +const Trk::Track* TrigVertexFitInputTrack::m_getTrkTrack() +{ + return m_pTrkTrack; +} + +void TrigVertexFitInputTrack::m_setIndex(int i) +{ + m_index=i; +} + +int TrigVertexFitInputTrack::m_getIndex() const +{ + return m_index; +} + +const double* TrigVertexFitInputTrack::Perigee() const +{ + return &m_Perigee[0]; +} + +double TrigVertexFitInputTrack::PerigeeCovariance(int i, int j) const +{ + return m_PerigeeCovariance[i][j]; +} + +void TrigVertexFitInputTrack::m_initializeVertex(class TrigL2Vertex* pV) +{ + int i,j; + i=3+m_index*3; + for(j=0;j<3;j++) + pV->m_getParametersVector()[i+j]=m_q[j]; +} + +double TrigVertexFitInputTrack::m_getChi2Distance(class TrigL2Vertex* pV) +{ + const double C=0.02997; + const double B=20.84; + + double Sk[2][2],detr,chi2; + double AC[2][3],BV[2][3]; + int i,j,k,shift; + double psi,sinPsi,cosPsi,alpha=C*B/1000.0,xv,yv,zv, + cosPhi0,sinPhi0,ctt,sint,phi0,theta0,P0; + + shift=m_index*3; + + k=3+shift; + for(i=0;i<3;i++) + for(j=0;j<3;j++) + pV->m_Gk[i+k][j+k]=m_Vqq[i][j]; + + m_initializeVertex(pV); + xv=pV->m_getParametersVector()[0]; + yv=pV->m_getParametersVector()[1]; + zv=pV->m_getParametersVector()[2]; + phi0=pV->m_getParametersVector()[3+shift]; + theta0=pV->m_getParametersVector()[4+shift]; + P0=pV->m_getParametersVector()[5+shift]; + + cosPhi0=cos(phi0);sinPhi0=sin(phi0); + sinPsi=-alpha*(xv*cosPhi0+yv*sinPhi0)/P0; + if(fabs(sinPsi)>1.0) return -999.9; + cosPsi=sqrt(1.0-sinPsi*sinPsi); + psi=asin(sinPsi); + sint=sin(theta0); + ctt=cos(theta0)/sint; + + m_A[0][0]=-sin(phi0+psi)/cosPsi; + m_A[0][1]= cos(phi0+psi)/cosPsi; + m_A[0][2]=0.0; + + m_A[1][0]=-ctt*cosPhi0/cosPsi; + m_A[1][1]=-ctt*sinPhi0/cosPsi; + m_A[1][2]=1.0; + + m_B[0][0]=-xv*m_A[0][1]+yv*m_A[0][0]; + m_B[0][1]=0.0; + m_B[0][2]=(1.0-1.0/cosPsi)/alpha; + + m_B[1][0]=-xv*m_A[1][1]+yv*m_A[1][0]; + m_B[1][1]=-P0*psi/(alpha*sint*sint); + m_B[1][2]=ctt*(psi-sinPsi/cosPsi)/alpha; + + m_h[0]=yv*cosPhi0-xv*sinPhi0+P0*(1-cosPsi)/alpha; + m_h[1]=zv+P0*ctt*psi/alpha; + + m_resid[0]=m_u[0]-m_h[0]; + m_resid[1]=m_u[1]-m_h[1]; + + for(i=0;i<2;i++) for(j=0;j<2;j++) Sk[i][j]=m_Vuu[i][j]; + for(i=0;i<2;i++) for(j=0;j<3;j++) + { + AC[i][j]=0.0; + for(k=0;k<3;k++) AC[i][j]+=m_A[i][k]*pV->m_Gk[k][j]; + } + for(i=0;i<2;i++) for(j=0;j<2;j++) + { + for(k=0;k<3;k++) Sk[i][j]+=AC[i][k]*m_A[j][k]; + } + for(i=0;i<2;i++) + for(j=0;j<3;j++) + { + BV[i][j]=0.0; + for(k=0;k<3;k++) BV[i][j]+=m_B[i][k]*m_Vqq[k][j]; + } + for(i=0;i<2;i++) + for(j=0;j<2;j++) + { + for(k=0;k<3;k++) Sk[i][j]+=BV[i][k]*m_B[j][k]; + } + Sk[0][0]-=2.0*(m_Vuq[0][0]*m_B[0][0]+m_Vuq[0][1]*m_B[0][1]+m_Vuq[0][2]*m_B[0][2]); + Sk[1][1]-=2.0*(m_Vuq[1][0]*m_B[1][0]+m_Vuq[1][1]*m_B[1][1]+m_Vuq[1][2]*m_B[1][2]); + Sk[0][1]-=m_Vuq[1][0]*m_B[0][0]+m_Vuq[1][1]*m_B[0][1]+m_Vuq[1][2]*m_B[0][2]+ + m_Vuq[0][0]*m_B[1][0]+m_Vuq[0][1]*m_B[1][1]+m_Vuq[0][2]*m_B[1][2]; + Sk[1][0]=Sk[0][1]; + + detr=1.0/(Sk[0][0]*Sk[1][1]-Sk[0][1]*Sk[1][0]); + m_V[0][0]=Sk[1][1]*detr; + m_V[1][1]=Sk[0][0]*detr; + m_V[0][1]=m_V[1][0]=-Sk[0][1]*detr; + + chi2=m_V[0][0]*m_resid[0]*m_resid[0]+m_V[1][1]*m_resid[1]*m_resid[1]+ + 2.0*m_V[0][1]*m_resid[1]*m_resid[0]; + + for(i=0;i<2;i++) + { + for(j=0;j<3;j++) m_D[i][j]=AC[i][j]; + for(j=3;j<3+shift;j++) + { + m_D[i][j]=0.0; + for(k=0;k<3;k++) + m_D[i][j]+=m_A[i][k]*pV->m_Gk[k][j]; + } + for(j=0;j<3;j++) m_D[i][j+3+shift]=BV[i][j]-m_Vuq[i][j]; + } + + return chi2; +} + + +void TrigVertexFitInputTrack::m_updateVertex(class TrigL2Vertex* pV) +{ + int i,j,k,nSize=6+3*m_index; + + double K[2][MAX_SIZE_VERT_COVM]; + + for(i=0;i<2;i++) + { + for(j=0;j<nSize;j++) + { + K[i][j]=0.0; + for(k=0;k<2;k++) K[i][j]+=m_D[k][j]*m_V[k][i]; + } + } + for(i=0;i<nSize;i++) + { + pV->m_getParametersVector()[i]+=K[0][i]*m_resid[0]+K[1][i]*m_resid[1]; + for(j=i;j<nSize;j++) + { + pV->m_Gk[i][j]-=K[0][i]*m_D[0][j]+K[1][i]*m_D[1][j]; + pV->m_Gk[j][i]=pV->m_Gk[i][j]; + } + } +} + +MsgStream& TrigVertexFitInputTrack::m_report( MsgStream& out ) const +{ + int i; + + out<<"Track "<<m_index<<" : mass="<<m_mass<<endreq; + for(i=0;i<2;i++) + { + out<<" u"<<i<<" = "<<m_u[i]<<" "<<m_Vuu[i][0]<<" "<<m_Vuu[i][1]<<endreq; + } + for(i=0;i<3;i++) + { + out<<" q"<<i<<" = "<<m_q[i]<<" "<<m_Vqq[i][0]<<" "<<m_Vqq[i][1]<<" "<<m_Vqq[i][2]<<endreq; + } + return out; +} + +TrigVertexFitConstraint::TrigVertexFitConstraint(double m, + const TrigVertexFitInputTrack* pT1, + const TrigVertexFitInputTrack* pT2) : m_value(m) +{ + m_trackList.clear(); + m_trackList.push_back(pT1); + m_trackList.push_back(pT2); +} + +TrigVertexFitConstraint::TrigVertexFitConstraint(double m, + const TrigVertexFitInputTrack* pT1, + const TrigVertexFitInputTrack* pT2, + const TrigVertexFitInputTrack* pT3) : m_value(m) +{ + m_trackList.clear(); + m_trackList.push_back(pT1);m_trackList.push_back(pT2);m_trackList.push_back(pT3); +} + + +TrigVertexFitConstraint::~TrigVertexFitConstraint() +{ + m_trackList.clear(); +} + +double TrigVertexFitConstraint::m_calculateInvariantMass(TrigL2Vertex* pV) +{ + const double C=0.029997; + const double B=20.84; + + double invMass=0.0,alpha=C*B/1000.0; + double P[3];double E=0.0; + int i; + + double* Rk = pV->m_getParametersVector(); + + int offset=0; + for(i=0;i<3;i++) P[i]=0.0; + + for(std::list<const TrigVertexFitInputTrack*>::iterator it=m_trackList.begin();it!=m_trackList.end();++it) + { + offset=3+3*(*it)->m_getIndex(); + double mass=(*it)->m_getMass()/1000.0; + double pT=fabs(Rk[offset+2]); + double p=pT/sin(Rk[offset+1]); + + double psi=-asin(alpha*(Rk[0]*cos(Rk[offset])+Rk[1]*sin(Rk[offset]))/Rk[offset+2]); + double phiV=Rk[offset]+psi; + P[0]+=pT*cos(phiV); + P[1]+=pT*sin(phiV); + P[2]+=pT*cos(Rk[offset+1])/sin(Rk[offset+1]); + E+=sqrt(mass*mass+p*p); + } + invMass=sqrt(E*E-P[0]*P[0]-P[1]*P[1]-P[2]*P[2]); + + return invMass; +} + + +double TrigVertexFitConstraint::m_getChi2Distance(TrigL2Vertex* pV) +{ + const double C=0.029997; + const double B=20.84; + + double invMass=0.0,alpha=C*B/1000.0; + double P[3]; + double E=0.0; + int i,j; + bool linFailed=false; + double* Rk = pV->m_getParametersVector(); + + int offset=0; + for(i=0;i<3;i++) P[i]=0.0; + + int nSize=3+3*pV->m_getTracks()->size(); + + for(std::list<const TrigVertexFitInputTrack*>::iterator it=m_trackList.begin();it!=m_trackList.end();++it) + { + offset=3+3*(*it)->m_getIndex(); + double mass=(*it)->m_getMass()/1000.0; + double pT=fabs(Rk[offset+2]); + double p=pT/sin(Rk[offset+1]); + + double psi=-asin(alpha*(Rk[0]*cos(Rk[offset])+Rk[1]*sin(Rk[offset]))/Rk[offset+2]); + double phiV=Rk[offset]+psi; + P[0]+=pT*cos(phiV); + P[1]+=pT*sin(phiV); + P[2]+=pT*cos(Rk[offset+1])/sin(Rk[offset+1]); + E+=sqrt(mass*mass+p*p); + } + invMass=sqrt(E*E-P[0]*P[0]-P[1]*P[1]-P[2]*P[2]); + + m_resid[0]=m_value/1000.0-invMass; + m_D[0][0]=0.0;m_D[0][1]=0.0;m_D[0][2]=0.0; + + for(std::list<const TrigVertexFitInputTrack*>::iterator it=m_trackList.begin();it!=m_trackList.end();++it) + { + offset=3+3*(*it)->m_getIndex(); + + double mass=(*it)->m_getMass()/1000.0; + double Ck=(Rk[offset+2]<0.0)?-1.0:1.0; + double sinT=sin(Rk[offset+1]); + double cosT=cos(Rk[offset+1]); + double pT=fabs(Rk[offset+2]); + double p=pT/sinT; + double e=sqrt(p*p+mass*mass); + double sinF=sin(Rk[offset]); + double cosF=cos(Rk[offset]); + + double sinPsi=-alpha*(Rk[0]*cosF+Rk[1]*sinF)/Rk[offset+2]; + if(fabs(sinPsi)>1.0) + { + linFailed=true; + break; + } + double psi=asin(sinPsi); + double cosPsi=sqrt(1.0-sinPsi*sinPsi); + double phiV=Rk[offset]+psi; + + double aCos=alpha*Ck/cosPsi; + double dP=P[1]*cos(phiV)-P[0]*sin(phiV); + double eE=E*Rk[offset+2]/(e*sinT); + + m_D[0][0]+=dP*cosF*aCos; + m_D[0][1]+=dP*sinF*aCos; + m_D[0][offset]=-dP*Ck*(Rk[offset+2]-Ck*aCos*(Rk[1]*cosF-Rk[0]*sinF)); + m_D[0][offset+1]=(Rk[offset+2]/(sinT*sinT))*(P[2]*Ck-eE*cosT); + m_D[0][offset+2]=eE/sinT-Ck*(P[0]*cos(phiV)+P[1]*sin(phiV)+P[2]*cosT/sinT)+dP*Ck*sinPsi/cosPsi; + } + for(i=0;i<nSize;i++) m_D[0][i]/=invMass; + if(linFailed) return -999.9; + /* + for(i=0;i<nSize;i++) printf("%E ",m_D[0][i]); + printf("\n"); + printf("----- numerical Jacobian -----\n"); + + double oldPar, newPar, Delta, newMass, der; + for(i=0;i<nSize;i++) + { + oldPar=Rk[i]; + Delta=0.00001*oldPar; + newPar=oldPar+Delta; + Rk[i]=newPar; + newMass=m_calculateInvariantMass(pV); + der=(newMass-invMass)/Delta; + m_D[1][i]=der; + Rk[i]=oldPar; + } + for(i=0;i<nSize;i++) printf("%E ",m_D[1][i]); + printf("\n"); + printf("------------------------------\n"); + */ + + double covM=1e-12; + + for(i=0;i<nSize;i++) + { + for(j=i;j<nSize;j++) + { + double dCov=pV->m_Gk[i][j]*m_D[0][i]*m_D[0][j]; + if(i!=j) dCov*=2.0; + covM+=dCov; + } + } + m_V[0][0]=1.0/covM; + return ((m_resid[0]*m_resid[0])*m_V[0][0]); +} + +void TrigVertexFitConstraint::m_updateVertex(TrigL2Vertex* pV) +{ + double K[MAX_SIZE_VERT_COVM]; + int i,j,nSize=3+3*pV->m_getTracks()->size(); + double gain; + + for(i=0;i<nSize;i++) + { + gain=0.0; + for(j=0;j<nSize;j++) gain+=pV->m_Gk[i][j]*m_D[0][j]; + m_D[1][i]=gain; + K[i]=gain*m_V[0][0]; + } + for(i=0;i<nSize;i++) + { + pV->m_getParametersVector()[i]+=K[i]*m_resid[0]; + for(j=i;j<nSize;j++) + { + pV->m_Gk[i][j]-=K[i]*m_D[1][j]; + pV->m_Gk[j][i]=pV->m_Gk[i][j]; + } + } +} + +MsgStream& TrigVertexFitConstraint::m_report( MsgStream& out) const +{ + out<<"Mass constraint with "<<m_trackList.size()<<" : mass="<<m_value<<endreq; + return out; +} + +double TrigVertexFitConstraint::m_getValue() +{ + return m_value; +} + +TrigL2Vertex::TrigL2Vertex() +{ + m_pvConstraints=new std::list<TrigVertexFitConstraint*>; + m_pvTracks=new std::list<TrigVertexFitInputTrack*>; + m_pvConstraints->clear();m_pvTracks->clear(); + m_nStatus=0; + m_nTracks=0; + m_P=NULL; + m_mass=0.0; + m_massVar=0.0; + m_chiSquared=0.0; + m_nDOF=0; + m_ready=false; +} + +TrigL2Vertex::~TrigL2Vertex() +{ + for(std::list<TrigVertexFitInputTrack*>::iterator tIt=m_pvTracks->begin(); + tIt!=m_pvTracks->end();++tIt) + { + delete (*tIt); + } + for(std::list<TrigVertexFitConstraint*>::iterator tIt=m_pvConstraints->begin(); + tIt!=m_pvConstraints->end();++tIt) + { + delete (*tIt); + } + m_pvConstraints->clear();m_pvTracks->clear(); + delete m_pvTracks;delete m_pvConstraints; + if(m_P!=NULL) delete m_P; +} + +int TrigL2Vertex::m_getNumberOfTracks() +{ + m_nTracks=m_pvTracks->size(); + return m_nTracks; +} + +bool TrigL2Vertex::m_prepareForFit() +{ + m_nTracks=m_pvTracks->size(); + m_nDOF=-3; + m_chiSquared=0.0; + m_ready=true; + return true; +} + +void TrigL2Vertex::m_reset() +{ + memset(&m_Gk[0][0],0,sizeof(m_Gk)); + m_nDOF=-3; + m_chiSquared=0.0; +} + +bool TrigL2Vertex::m_isVertexFitted() +{ + return (m_nStatus>0); +} + +bool TrigL2Vertex::m_isMassEstimated() +{ + return (m_nStatus>1); +} + +const TrigInDetTrackFitPar* TrigL2Vertex::m_getMotherTrack() +{ + return m_P; +} + +void TrigL2Vertex::m_setMotherTrack(TrigInDetTrackFitPar* P) +{ + m_P=P; +} + +double TrigL2Vertex::chi2() +{ + return m_chiSquared; +} + +int TrigL2Vertex::ndof() +{ + return m_nDOF; +} + +void TrigL2Vertex::m_addChi2(double chi2) +{ + m_chiSquared+=chi2; +} + +void TrigL2Vertex::m_addNdof(int n) +{ + m_nDOF+=n; +} + +double TrigL2Vertex::mass() +{ + if(m_isMassEstimated()) return m_mass; + else return 0.0; +} + +double TrigL2Vertex::massVariance() +{ + if(m_isMassEstimated()) return m_massVar; + else return 0.0; +} + +double* TrigL2Vertex::m_getParametersVector() +{ + return &m_Rk[0]; +} + +std::list<TrigVertexFitInputTrack*>* TrigL2Vertex::m_getTracks() +{ + return m_pvTracks; +} + +std::list<TrigVertexFitConstraint*>* TrigL2Vertex::m_getConstraints() +{ + return m_pvConstraints; +} + +void TrigL2Vertex::m_setStatus(int s) +{ + m_nStatus=s; +} + +void TrigL2Vertex::m_setMass(double m) +{ + m_mass=m; +} + +void TrigL2Vertex::m_setMassVariance(double v) +{ + m_massVar=v; +} + +int TrigL2Vertex::m_getStatus() +{ + return m_nStatus; +} + +bool TrigL2Vertex::m_isReadyForFit() +{ + return m_ready; +} + +MsgStream& TrigL2Vertex::m_report( MsgStream& msg) const +{ + int i,j,nSize=3+3*m_pvTracks->size(); + + for(i=0;i<nSize;i++) + { + msg<<m_Rk[i]<<" "; + for(j=0;j<nSize;j++) msg<<m_Gk[i][j]<<" "; + msg<<endreq; + } + return msg; +} + +const TrigVertexFitInputTrack* TrigL2Vertex::m_contains(const TrigInDetTrack* pT) +{ + TrigVertexFitInputTrack* pI=NULL; + for(std::list<TrigVertexFitInputTrack*>::iterator it=m_pvTracks->begin(); + it!=m_pvTracks->end();++it) + { + if((*it)->m_getTrackType()!=1) continue; + if(pT==(*it)->m_getTrigTrack()) + { + pI=(*it);break; + } + } + return pI; +} + + +const TrigVertexFitInputTrack* TrigL2Vertex::m_contains(const Trk::Track* pT) +{ + TrigVertexFitInputTrack* pI=NULL; + for(std::list<TrigVertexFitInputTrack*>::iterator it=m_pvTracks->begin(); + it!=m_pvTracks->end();++it) + { + if((*it)->m_getTrackType()!=2) continue; + if(pT==(*it)->m_getTrkTrack()) + { + pI=(*it);break; + } + } + return pI; +} diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigSpacePointCounts.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigSpacePointCounts.cxx new file mode 100644 index 0000000000000000000000000000000000000000..03bc79026e3cbae1247c974305c247416595c53b --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigSpacePointCounts.cxx @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigSpacePointCounts.h" + +//--------------------------------------------------------------- + +TrigSpacePointCounts::TrigSpacePointCounts(): m_pixelClusEndcapC(), + m_pixelClusBarrel(), + m_pixelClusEndcapA(), + m_droppedPixelModules(), + m_sctSpEndcapC(0), + m_sctSpBarrel(0), + m_sctSpEndcapA(0), + m_droppedSctModules() { +} + +//--------------------------------------------------------------- + +TrigSpacePointCounts::TrigSpacePointCounts(TrigHisto2D pixelClusEndcapC, + TrigHisto2D pixelClusBarrel, + TrigHisto2D pixelClusEndcapA, + std::vector<Identifier> droppedPixelModules, + unsigned int sctSpEndcapC, + unsigned int sctSpBarrel, + unsigned int sctSpEndcapA, + std::vector<Identifier> droppedSctModules): m_pixelClusEndcapC(pixelClusEndcapC), + m_pixelClusBarrel(pixelClusBarrel), + m_pixelClusEndcapA(pixelClusEndcapA), + m_droppedPixelModules(droppedPixelModules), + m_sctSpEndcapC(sctSpEndcapC), + m_sctSpBarrel(sctSpBarrel), + m_sctSpEndcapA(sctSpEndcapA), + m_droppedSctModules(droppedSctModules) { +} + +//--------------------------------------------------------------- + +TrigSpacePointCounts::TrigSpacePointCounts(const TrigSpacePointCounts& trigSpacePointCounts) { + m_pixelClusEndcapC = trigSpacePointCounts.m_pixelClusEndcapC; + m_pixelClusBarrel = trigSpacePointCounts.m_pixelClusBarrel; + m_pixelClusEndcapA = trigSpacePointCounts.m_pixelClusEndcapA; + m_sctSpEndcapC = trigSpacePointCounts.m_sctSpEndcapC; + m_sctSpBarrel = trigSpacePointCounts.m_sctSpBarrel; + m_sctSpEndcapA = trigSpacePointCounts.m_sctSpEndcapA; +} + +//--------------------------------------------------------------- + +TrigSpacePointCounts::~TrigSpacePointCounts(void) { +} + +//--------------------------------------------------------------- + +TrigHisto2D TrigSpacePointCounts::pixelClusEndcapC(void) const { + return m_pixelClusEndcapC; +} + +TrigHisto2D TrigSpacePointCounts::pixelClusBarrel(void) const { + return m_pixelClusBarrel; +} + +TrigHisto2D TrigSpacePointCounts::pixelClusEndcapA(void) const { + return m_pixelClusEndcapA; +} + +std::vector<Identifier> TrigSpacePointCounts::droppedPixelModules(void) const { + return m_droppedPixelModules; +} + +unsigned int TrigSpacePointCounts::sctSpEndcapC(void) const { + return m_sctSpEndcapC; +} + +unsigned int TrigSpacePointCounts::sctSpBarrel(void) const { + return m_sctSpBarrel; +} + +unsigned int TrigSpacePointCounts::sctSpEndcapA(void) const { + return m_sctSpEndcapA; +} + +std::vector<Identifier> TrigSpacePointCounts::droppedSctModules(void) const { + return m_droppedSctModules; +} + +//--------------------------------------------------------------- diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigTauTracksInfo.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigTauTracksInfo.cxx new file mode 100644 index 0000000000000000000000000000000000000000..61b7b90a640a5d328a4402af851c572db51b50a7 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigTauTracksInfo.cxx @@ -0,0 +1,182 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +/** @class TrigTauTracksInfo + + Contains basic information about trackc collection associated with Tau RoI. + To be used by FEX TrigT2IDTau at L2. + + + created by Olya Igonkina - Jan 16, 2008 + + +*/ + +#include "TrigInDetEvent/TrigTauTracksInfo.h" + +TrigTauTracksInfo::TrigTauTracksInfo() : + P4PtEtaPhiM(0,0,0,0), + NavigableTerminalNode(), + m_roiID(0), + m_nCoreTracks(0), + m_nSlowTracks(0), + m_nIsoTracks(0), + m_charge(0), + m_leadingTrackPt(0), + m_scalarPtSumCore(0), + m_scalarPtSumIso(0), + m_ptBalance(0), + m_tracks(0) +{ + m_3fastest.setPt(0); + m_3fastest.setEta(0); + m_3fastest.setPhi(0); + m_3fastest.setM(0); + +} + +TrigTauTracksInfo::TrigTauTracksInfo(const TrigTauTracksInfo & te) : + I4Momentum(te), + P4PtEtaPhiMBase(te), + INavigable(te), + IAthenaBarCode(te), + INavigable4Momentum(te), + P4PtEtaPhiM(te), + NavigableTerminalNode(te) +{ + m_roiID = te.m_roiID; + m_nCoreTracks = te.m_nCoreTracks ; + m_nSlowTracks = te.m_nSlowTracks ; + m_nIsoTracks = te.m_nIsoTracks ; + m_charge = te.m_charge ; + m_leadingTrackPt = te.m_leadingTrackPt ; + m_scalarPtSumCore = te.m_scalarPtSumCore ; + m_scalarPtSumIso = te.m_scalarPtSumIso ; + m_ptBalance = te.m_ptBalance ; + + + m_3fastest.setPt( te.threeFastestTracks().pt()); + m_3fastest.setEta( te.threeFastestTracks().eta()); + m_3fastest.setPhi( te.threeFastestTracks().phi()); + m_3fastest.setM( te.threeFastestTracks().m()); +} +TrigTauTracksInfo::~TrigTauTracksInfo(){} + + +void TrigTauTracksInfo::set3fastestPtEtaPhiM(float pt, float eta, float phi, float m) +{ + m_3fastest.setPt( pt); + m_3fastest.setEta( eta); + m_3fastest.setPhi( phi); + m_3fastest.setM( m); +} +void TrigTauTracksInfo::set3fastestPxPyPzE(float px, float py, float pz, float e) +{ + m_3fastest.set4Mom(P4PxPyPzE(px,py,pz, e)); +} + + +std::string str( const TrigTauTracksInfo& tau ) { + + std::stringstream stream; + stream << "RoI ID: " << tau.roiId() + << "; pt: " << tau.pt() + << "; eta: " << tau.eta() + << "; phi: " << tau.phi() + << "; nCoreTracks: " << tau.nCoreTracks() + << "; nSlowTracks: " << tau.nSlowTracks() + << "; nIsoTracks: " << tau.nIsoTracks() + << "; charge: " << tau.charge() + << "; leadingTrackPt: " << tau.leadingTrackPt() + << "; scalarPtSumCore: " << tau.scalarPtSumCore() + << "; scalarPtSumIso: " << tau.scalarPtSumIso() + << "; ptBalance: " << tau.ptBalance() + << "; threeFastestTracksPt: " << tau.threeFastestTracks().pt() + << "; threeFastestTracksEta: " << tau.threeFastestTracks().eta() + << "; threeFastestTracksPhi: " << tau.threeFastestTracks().phi(); + + + return stream.str(); +} + +MsgStream& operator<< ( MsgStream& m, const TrigTauTracksInfo& tau ) { + + return ( m << str( tau ) ); + +} + +bool operator== ( const TrigTauTracksInfo& left, const TrigTauTracksInfo& right ) { + + static const double DELTA = 0.001; + if( ( left.roiId() != right.roiId() ) || + ( left.nCoreTracks() != right.nCoreTracks() ) || + ( left.nSlowTracks() != right.nSlowTracks() ) || + ( left.nIsoTracks() != right.nIsoTracks() ) || + + ( std::abs( left.pt() - right.pt() ) > DELTA ) || + ( std::abs( left.eta() - right.eta() ) > DELTA ) || + ( std::abs( left.phi() - right.phi() ) > DELTA ) || + + ( std::abs( left.charge() - right.charge() ) > DELTA ) || + ( std::abs( left.leadingTrackPt() - right.leadingTrackPt() ) > DELTA ) || + ( std::abs( left.scalarPtSumCore() - right.scalarPtSumCore() ) > DELTA ) || + ( std::abs( left.scalarPtSumIso() - right.scalarPtSumIso() ) > DELTA ) || + ( std::abs( left.ptBalance() - right.ptBalance() ) > DELTA ) + ) { + + return false; + + } else { + + return true; + + } + +} + +void diff( const TrigTauTracksInfo& left, const TrigTauTracksInfo& right, + std::map< std::string, double >& varChange ) { + + static const double DELTA = 0.001; + if( left.roiId() != right.roiId() ) { + varChange[ "roiId" ] = static_cast< double >( left.roiId() - right.roiId() ); + } + if( left.nCoreTracks() != right.nCoreTracks() ) { + varChange[ "nCoreTracks" ] = static_cast< double >( left.nCoreTracks() - right.nCoreTracks() ); + } + if( left.nSlowTracks() != right.nSlowTracks() ) { + varChange[ "nSlowTracks" ] = static_cast< double >( left.nSlowTracks() - right.nSlowTracks() ); + } + if( left.nIsoTracks() != right.nIsoTracks() ) { + varChange[ "nIsoTracks" ] = static_cast< double >( left.nIsoTracks() - right.nIsoTracks() ); + } + if( std::abs( left.pt() - right.pt() ) > DELTA ) { + varChange[ "pt" ] = left.pt() - right.pt(); + } + if( std::abs( left.eta() - right.eta() ) > DELTA ) { + varChange[ "eta" ] = left.eta() - right.eta(); + } + if( std::abs( left.phi() - right.phi() ) > DELTA ) { + varChange[ "phi" ] = left.phi() - right.phi(); + } + + if( std::abs( left.charge() - right.charge() ) > DELTA ) { + varChange[ "charge" ] = left.charge() - right.charge(); + } + if( std::abs( left.leadingTrackPt() - right.leadingTrackPt() ) > DELTA ) { + varChange[ "leadingTrackPt" ] = left.leadingTrackPt() - right.leadingTrackPt(); + } + if( left.scalarPtSumCore() != right.scalarPtSumCore() ) { + varChange[ "scalarPtSumCore" ] = left.scalarPtSumCore() - right.scalarPtSumCore(); + } + if( left.scalarPtSumIso() != right.scalarPtSumIso() ) { + varChange[ "scalarPtSumIso" ] = left.scalarPtSumIso() - right.scalarPtSumIso(); + } + if( left.ptBalance() != right.ptBalance() ) { + varChange[ "ptBalance" ] = left.ptBalance() - right.ptBalance(); + } + + return; +} diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigTrackCounts.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigTrackCounts.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9e1f316c97f3f7c84ee8459b93abd226280a8217 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigTrackCounts.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigTrackCounts.h" + +//--------------------------------------------------------------- + +TrigTrackCounts::TrigTrackCounts(): m_z0_pt(), + m_eta_phi() { +} + +//--------------------------------------------------------------- + +TrigTrackCounts::TrigTrackCounts(TrigHisto2D z0_pt, + TrigHisto2D eta_phi): m_z0_pt(z0_pt), + m_eta_phi(eta_phi) { +} + +//--------------------------------------------------------------- + +TrigTrackCounts::TrigTrackCounts(const TrigTrackCounts& trigTrackCounts) { + m_z0_pt = trigTrackCounts.m_z0_pt; + m_eta_phi = trigTrackCounts.m_eta_phi; +} + +//--------------------------------------------------------------- + +TrigTrackCounts::~TrigTrackCounts() { +} + +//--------------------------------------------------------------- + +TrigHisto2D TrigTrackCounts::z0_pt(void) const { + return m_z0_pt; +} + +TrigHisto2D TrigTrackCounts::eta_phi(void) const { + return m_eta_phi; +} + +//--------------------------------------------------------------- diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigTrtHitCounts.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigTrtHitCounts.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d2760b18df61ecc4fd4f3e24350ae8c808075a7c --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigTrtHitCounts.cxx @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigTrtHitCounts.h" + +//--------------------------------------------------------------- + +TrigTrtHitCounts::TrigTrtHitCounts(): m_endcapC(), + m_barrel(), + m_endcapA() { +} + +//--------------------------------------------------------------- + +TrigTrtHitCounts::TrigTrtHitCounts(TrigHisto1D endcapC, + TrigHisto1D barrel, + TrigHisto1D endcapA): m_endcapC(endcapC), + m_barrel(barrel), + m_endcapA(endcapA) { +} + +//--------------------------------------------------------------- + +TrigTrtHitCounts::~TrigTrtHitCounts() { +} + +//--------------------------------------------------------------- + +TrigTrtHitCounts::TrigTrtHitCounts(const TrigTrtHitCounts& trigTrtHitCounts) { + m_endcapC = trigTrtHitCounts.m_endcapC; + m_barrel = trigTrtHitCounts.m_barrel; + m_endcapA = trigTrtHitCounts.m_endcapA; +} + +//--------------------------------------------------------------- + +TrigHisto1D TrigTrtHitCounts::endcapC(void) const { + return m_endcapC; +} + +TrigHisto1D TrigTrtHitCounts::barrel(void) const { + return m_barrel; +} + +TrigHisto1D TrigTrtHitCounts::endcapA(void) const { + return m_endcapA; +} diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigVertex.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigVertex.cxx new file mode 100644 index 0000000000000000000000000000000000000000..de1a12a8b3225ac5ffd20aa994305580901299b2 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigVertex.cxx @@ -0,0 +1,83 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigVertex.h" + +std::string str( const TrigVertex& v ) //<! printing helper +{ + std::stringstream ss; + const HepGeom::Point3D<double>& pos = v.position(); + int nTracks=0; + + if(v.tracks()!=NULL) nTracks=v.tracks()->size(); + + ss << "AlgorithmID: "<<v.algorithmId() + << "x: "<<pos.x() + <<" y: "<<pos.y() + <<" z: "<<pos.z() + <<" chi2: "<<v.chi2() + <<" ndof: "<<v.ndof() + <<" ntracks: "<<nTracks + <<" mass: "<<v.mass() + <<" energyFraction: "<<v.energyFraction() + <<" nTwoTracksSecVtx: "<<v.nTwoTracksSecVtx(); + return ss.str(); + +} + +MsgStream& operator<< ( MsgStream& m, const TrigVertex& v ) //<! printing helper (wraps above) +{ + m << str(v); + return m; +} + +bool operator== ( const TrigVertex& a, const TrigVertex& b ) +{ + const double epsilon=1e-8; + int nTracksA=0; + int nTracksB=0; + + if(a.tracks()!=NULL) nTracksA=a.tracks()->size(); + if(b.tracks()!=NULL) nTracksB=b.tracks()->size(); + const HepGeom::Point3D<double>& posA = a.position(); + const HepGeom::Point3D<double>& posB = b.position(); + + if(a.algorithmId() != b.algorithmId()) return false; + if(nTracksA != nTracksB) return false; + if(a.ndof() != b.ndof()) return false; + if(fabs(posA.x()-posB.x())>epsilon) return false; + if(fabs(posA.y()-posB.y())>epsilon) return false; + if(fabs(posA.z()-posB.z())>epsilon) return false; + if(fabs(a.chi2()-b.chi2())>epsilon) return false; + if(fabs(a.mass()-b.mass())>epsilon) return false; + return true; +} + +/** @brief comparison with feedback + * Function compares two objects and returns "semi verbose" output + * in the form of map where there are variable names and differences + * between two objects + * @param variableChange - map to record the differences + * In case of collections (or objects when the size may be different) that information can also be returned in variableChange + */ +void diff( const TrigVertex& a, const TrigVertex& b, std::map<std::string, double>& variableChange ) +{ + int nTracksA=0; + int nTracksB=0; + + if(a.tracks()!=NULL) nTracksA=a.tracks()->size(); + if(b.tracks()!=NULL) nTracksB=b.tracks()->size(); + const HepGeom::Point3D<double>& posA = a.position(); + const HepGeom::Point3D<double>& posB = b.position(); + + variableChange["x"] = posA.x() - posB.x(); + variableChange["y"] = posA.y() - posB.y(); + variableChange["z"] = posA.z() - posB.z(); + variableChange["ntracks"] = (double)(nTracksA - nTracksB); + variableChange["chi2"] = a.chi2() - b.chi2(); + variableChange["ndof"] = (double)(a.ndof() - b.ndof()); + variableChange["mass"] = a.mass() - b.mass(); + variableChange["energyFraction"] = a.energyFraction() - b.energyFraction(); + variableChange["nTwoTracksSecVtx"] = (double)(a.nTwoTracksSecVtx() - b.nTwoTracksSecVtx()); +} diff --git a/Trigger/TrigEvent/TrigInDetEvent/src/TrigVertexCounts.cxx b/Trigger/TrigEvent/TrigInDetEvent/src/TrigVertexCounts.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cb1ccef7dd5858e663b6f0a1b3e33dc0f994e297 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/src/TrigVertexCounts.cxx @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetEvent/TrigVertexCounts.h" + +//--------------------------------------------------------------- + +TrigVertexCounts::TrigVertexCounts(): m_vtxNtrks(), + m_vtxTrkPtSqSum() {} + +//--------------------------------------------------------------- + +TrigVertexCounts::TrigVertexCounts(std::vector<unsigned int> vtxNtrks, + std::vector<float> vtxTrkPtSqSum): m_vtxNtrks(vtxNtrks), + m_vtxTrkPtSqSum(vtxTrkPtSqSum) { +} + +//--------------------------------------------------------------- + +TrigVertexCounts::TrigVertexCounts(const TrigVertexCounts& trigTrackCounts) { + m_vtxNtrks = trigTrackCounts.m_vtxNtrks; + m_vtxTrkPtSqSum = trigTrackCounts.m_vtxTrkPtSqSum; +} + +//--------------------------------------------------------------- + +TrigVertexCounts::~TrigVertexCounts() { +} + +//--------------------------------------------------------------- diff --git a/Trigger/TrigEvent/TrigInDetEvent/test/TrigHisto_test.cxx b/Trigger/TrigEvent/TrigInDetEvent/test/TrigHisto_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..179dc9bad98025a7538301ac4204a6c3120f6b36 --- /dev/null +++ b/Trigger/TrigEvent/TrigInDetEvent/test/TrigHisto_test.cxx @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Following the example of +// Trigger/TrigEvent/TrigSteeringEvent/test/Operators_test.cxx + +// Need to modify requirements file to compile this code once the HEAD +// of TrigInDetEvent compiles against a nightly. Waiting for Tomasz et al.. + +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" +#include <iostream> + +#include "TrigInDetEvent/TrigHisto.h" + +int main() { + MsgStream log(Athena::getMessageSvc(), "TrigHisto_test"); + + TrigHisto1D<unsigned char> trigHisto1D(5,-2.5,2.5); + + trigHisto1D.fill(-3.0, 2); + trigHisto1D.fill(-2.5, 4); + trigHisto1D.fill(1., 1); + + TrigHisto2D<unsigned int> trigHisto2D(20,-10.,10.,10,-5.,5.); + for(int i=0;i<22;i++) { + for(int j=0;j<12;j++) { + trigHisto2D.fill(i-11,j-6); + } + } + + return 0; +} +