ATLAS Offline Software
Loading...
Searching...
No Matches
InDetBeamSpotFinder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef INDET_INDETBEAMSPOTFINDER_H
6#define INDET_INDETBEAMSPOTFINDER_H
8// Author: Brian Amadio
9// Contact: btamadio@lbl.gov
10// Main Algorithm: Determine the Beamspot position
12
14#include "GaudiKernel/ServiceHandle.h"
15#include "GaudiKernel/ToolHandle.h"
16#include "GaudiKernel/ITHistSvc.h"
17#include "InDetBeamSpotFinder/IInDetBeamSpotTool.h" //for BeamSpot::Event
19#include "xAODEventInfo/EventInfo.h" //typedef, can't fwd declare
20#include "xAODTracking/VertexContainer.h" //typedef, can't fwd declare
21#include "xAODTracking/TrackingPrimitives.h" //for xAOD::VxType
25#include "BeamSpotID.h"
26#include <string>
27#include <vector>
28#include <map>
29
30class IToolSvc;
31class IInDetBeamSpotTool;
32class TTree;
33
34namespace InDet {
36
37 public:
38 //Standard constructor and methods
39 InDetBeamSpotFinder (const std::string& name, ISvcLocator* pSvcLocator);
40 virtual StatusCode initialize() override;
41 virtual StatusCode execute() override;
42 virtual StatusCode finalize() override;
43
44 private:
45 //Reorganize and clean up this section
46 ServiceHandle<IToolSvc> m_toolSvc{this, "ToolSvc", "ToolSvc"};
47 ServiceHandle<ITHistSvc> m_thistSvc{this, "THistSvc", "THistSvc"};
48 ToolHandleArray<IInDetBeamSpotTool> m_beamSpotToolList;
49
51 {this, "BunchCrossingCondDataKey", "BunchCrossingData" ,"SG Key of BunchCrossing CDO"};
52
54 {this, "EvtInfo", "EventInfo", "EventInfo name"};
56 {this, "VertexContainer", "PrimaryVertices", "Vertex container name"};
57
58 //Beamspot sorting options
59 unsigned int m_maxRunsPerFit;
60 unsigned int m_maxEventsPerFit;
61 unsigned int m_maxLBsPerFit;
62 //Event Selection
63 std::vector<unsigned int> m_BCIDsToAccept;
64 //Job Options
67 //Initialize some pointers
68 TTree * m_root_bs=0;
69 TTree * m_root_vrt=0;
70
72 int pileup{}, bcid{}, defectWord{}, fill{}, lbEnd{}, lbStart{};
75 std::map<std::string,double>paramMap{};
76 std::map<std::string,double>covMap{};
77 };
78
80 double x{},y{},z{},vxx{},vxy{},vyy{},vzz{};
82 unsigned int run{}, lb{}, bcid{}, pileup{}, nTracks{};
83 unsigned long long eventNumber{}, eventTime{}, eventTime_NS{};
84 bool passed{}, valid{};
85 };
86
90
91 std::string m_vertexTreeName;
92 std::vector<BeamSpot::Event> m_eventList;
93 std::map< BeamSpot::ID, std::vector<BeamSpot::Event> > m_eventMap;
94 std::vector<std::vector<BeamSpot::Event>> m_sortedEventList;
95 std::vector<std::vector<BeamSpot::VrtHolder>> m_sortedVertices;
96
100 void writeToBeamSpotTree(const IInDetBeamSpotTool *bs, std::vector<BeamSpot::Event> &, std::vector<BeamSpot::VrtHolder> &);
101 void sortEvents();
102 StatusCode setupVertexTree();
103 StatusCode setupBeamSpotTree();
104 StatusCode performFits();
105 bool iequals(const std::string &, const std::string &);
106 int min_lb( std::vector<BeamSpot::Event> & );
107 int max_lb( std::vector<BeamSpot::Event> & );
108 int min_run( std::vector<BeamSpot::Event> & );
109 int max_run( std::vector<BeamSpot::Event> & );
110
111 void convertVtxTypeNames();
112
113 // Parameters for vertex selection criteria
114 int m_minTrackNum{}; //min Tracks in a vertex to be added
115 int m_maxTrackNum{}; //max Tracks in a vertex to be added
116 double m_maxChi2Vertex{}; //maxChi2 of vertex
117 double m_maxTransverseError{}; // max transverse vertex resolution
118 double m_maxAbsCorrelXY{}; //max absolute XY correlation of a vertex to be added
119 double m_minVtxProb{}; // probability cut on chi2/ndf
120 unsigned int m_minVertexNum{}; //min vertex count for solution
121
122 std::vector<std::string> m_vertexTypeNames{}; //names of vertexTypes
123 std::vector<xAOD::VxType::VertexType> m_vertexTypes{};
124
126 bool passVertexSelection(const xAOD::Vertex * );
127 //For forcing a specific run number
128
129 // bool m_groupFitsByBCID; // each bcid is fitted separately
130 bool m_useFilledBCIDsOnly{}; // Only use filled BCIDs not empty ones (data)
131 std::string m_fitSortingKey{};
132
134 //std::map<unsigned int,long> m_nEvents;
135 //std::map<BeamSpot::ID, long> m_nEvents;
136
137 unsigned long m_secondsPerFit{};
138 };
139}//end namespace
140
141#endif
142
Replaces the BunchCrossing AlgTool used in run1/2.
Property holding a SG store/key/clid from which a ReadHandle is made.
#define y
#define z
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Class to hold the definition and accessor methods for the beamspot status-word.
Abstract class for all beamspot determination algorithms.
std::vector< BeamSpot::Event > m_eventList
virtual StatusCode finalize() override
std::map< BeamSpot::ID, std::vector< BeamSpot::Event > > m_eventMap
ServiceHandle< IToolSvc > m_toolSvc
void writeToBeamSpotTree(const IInDetBeamSpotTool *bs, std::vector< BeamSpot::Event > &, std::vector< BeamSpot::VrtHolder > &)
virtual StatusCode initialize() override
bool iequals(const std::string &, const std::string &)
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer
bool passVertexSelection(const xAOD::Vertex *)
std::vector< std::string > m_vertexTypeNames
int min_run(std::vector< BeamSpot::Event > &)
void writeToVertexTree(BeamSpot::Event &, BeamSpot::VrtHolder &)
std::vector< xAOD::VxType::VertexType > m_vertexTypes
ToolHandleArray< IInDetBeamSpotTool > m_beamSpotToolList
SG::ReadCondHandleKey< BunchCrossingCondData > m_bcDataKey
std::vector< std::vector< BeamSpot::Event > > m_sortedEventList
int max_run(std::vector< BeamSpot::Event > &)
BeamSpot::Event readEvent(const xAOD::EventInfo &, const xAOD::VertexContainer &)
virtual StatusCode execute() override
InDetBeamSpotFinder(const std::string &name, ISvcLocator *pSvcLocator)
ServiceHandle< ITHistSvc > m_thistSvc
int min_lb(std::vector< BeamSpot::Event > &)
std::vector< unsigned int > m_BCIDsToAccept
IInDetBeamSpotTool * cloneTool(int)
int max_lb(std::vector< BeamSpot::Event > &)
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
BeamSpotStatusCode m_BeamStatusCode
std::vector< std::vector< BeamSpot::VrtHolder > > m_sortedVertices
bool passEventSelection(const xAOD::EventInfo &)
beamSpotNtuple_struct m_beamSpotNtuple
Property holding a SG store/key/clid from which a ReadHandle is made.
int lb
Definition globals.cxx:23
Primary Vertex Finder.
Definition run.py:1
VertexType
Vertex types.
EventInfo_v1 EventInfo
Definition of the latest event info version.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
void fill(H5::Group &out_file, size_t iterations)