|
ATLAS Offline Software
|
Go to the documentation of this file.
9 #include "GaudiKernel/ITHistSvc.h"
14 #include "EventInfo/EventInfo.h"
21 return (
e1.lumiBlock<
e2.lumiBlock);
26 return (
e1.runNumber<
e2.runNumber);
33 m_toolSvc(
"ToolSvc",
name)
60 ATH_MSG_FATAL(
"FATAL ERROR: must provide at least one beamspot tool in beamSpotToolList");
61 return StatusCode::FAILURE;
76 return StatusCode::SUCCESS;
87 for(
auto & thisVertex: currentEvent.
vertices){
93 return StatusCode::SUCCESS;
100 return StatusCode::SUCCESS;
109 event.bcid = eventInfo.
bcid();
120 if (
event.lumiBlock != BSeventInfo->
event_ID()->lumi_block())
122 event.lumiBlock = BSeventInfo->
event_ID()->lumi_block();
130 vertex.vxx = vtx->covariancePosition()(0,0);
131 vertex.vxy = vtx->covariancePosition()(0,1);
132 vertex.vyy = vtx->covariancePosition()(1,1);
133 vertex.vzz = vtx->covariancePosition()(2,2);
134 vertex.vertexType = vtx->vertexType();
135 vertex.nTracks = vtx->nTrackParticles();
151 vertex.vxx < 0.)
continue;
152 event.vertices.push_back(
vertex );
170 unsigned int nRuns = 0;
171 unsigned int nLBs = 0;
172 unsigned int nFits = 1;
176 currentID = iter->first;
181 || currentID.
bcid() != lastID.
bcid()
185 << currentID.
pileup() <<
" <-- " << lastID.
pileup() <<
"\n\t"
186 << currentID.
bcid() <<
" <-- " << lastID.
bcid() <<
"\n\t"
194 for(
unsigned int i = 0;
i < iter->second.size();
i++){
203 lastID = iter->first;
212 if ((*
it) ==
"NoVtx") ;
224 ATH_MSG_DEBUG(
"No selection based on vertexType will be done" );
241 if(!vtx) {
return false; }
247 if(vtx->covariancePosition()(0,0) <= 0 || vtx->covariancePosition()(1,1) <= 0 || vtx->covariancePosition()(2,2) <= 0 ) {
return false; }
249 if(vtx->covariancePosition()(0,0) > maxTransverseError2 || vtx->covariancePosition()(1,1) > maxTransverseError2) {
return false;}
254 const std::string inRootID =
"/INDETBEAMSPOTFINDER/";
256 m_root_vrt =
new TTree(svrts.data(),
"Vertices");
257 m_root_vrt->Branch(
"vrt",&
m_root_vtx,
"x/D:y:z:vxx:vxy:vyy:vzz:vType/i:run:lb:bcid:pileup:nTracks:eventNumber/l:eventTime:eventTime_NS:passed/O:valid");
263 std::vector<BeamSpot::VrtHolder> verticesToFit;
266 verticesToFit.clear();
268 for(
const auto & thisVertex: thisEvent.vertices){
269 if( thisVertex.passed ) {
270 verticesToFit.push_back( thisVertex );
278 if(!bs){
return StatusCode::FAILURE; }
279 if(not verticesToFit.empty()) { bsFitStatus = bs->
fit(verticesToFit); }
301 return StatusCode::SUCCESS;
305 const std::string inRootID =
"/INDETBEAMSPOTFINDER/";
306 const std::string sbs =
"BeamSpotNt";
307 m_root_bs =
new TTree(sbs.data(),
"Beamspot Solutions");
326 std::map<std::string,double> paramMap =
tool->getParamMap();
327 std::map<std::string,double> covMap =
tool->getCovMap();
329 std::string slashD =
"/D";
330 std::string keySlashD;
334 std::string
key = iter->first;
338 keySlashD =
key + slashD;
344 const std::string &
key = iter->first;
348 keySlashD =
key + slashD;
380 unsigned int sz =
a.size();
383 for (
unsigned int i = 0;
i <
sz; ++
i)
398 unsigned int nVtxAll = 0;
399 unsigned int nVtxPrim = 0;
401 for(
const auto & thisEvent :
eventList){
402 const auto & theseVertices=thisEvent.vertices;
403 nVtxAll += theseVertices.size();
404 nVtxPrim+= std::count_if(theseVertices.begin(), theseVertices.end(), isPrimaryVertex);
415 const auto & bsToolCovMap= bs->
getCovMap();
417 const std::string &
key = param.first;
418 const auto & bsToolEquivalent =bsToolParamMap.find(
key);
419 param.second = ( bsToolEquivalent == bsToolParamMap.end() ) ? 0 : bsToolEquivalent->second;
429 const std::string &
key = covariance.first;
430 const auto & bsToolEquivalent = bsToolCovMap.find(
key);
431 covariance.second = ( bsToolEquivalent == bsToolCovMap.end() ) ? 0 : bsToolEquivalent->second;
450 const auto smallestLbEvent=std::min_element(
eventList.begin(),
eventList.end(), lesserLumiBlock);
451 return smallestLbEvent->lumiBlock;
455 const auto largestLbEvent=std::max_element(
eventList.begin(),
eventList.end(), lesserLumiBlock);
456 return largestLbEvent->lumiBlock;
460 const auto smallestRunEvent=std::min_element(
eventList.begin(),
eventList.end(), lesserRunNumber);
461 return smallestRunEvent->runNumber;
465 const auto largestRunEvent=std::max_element(
eventList.begin(),
eventList.end(), lesserRunNumber);
466 return largestRunEvent->runNumber;
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
std::vector< xAOD::VxType::VertexType > m_vertexTypes
void convertVtxTypeNames()
IInDetBeamSpotTool * cloneTool(int)
unsigned long long eventNumber
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
std::vector< unsigned int > m_BCIDsToAccept
virtual StatusCode initialize() override
int min_run(std::vector< BeamSpot::Event > &)
int max_lb(std::vector< BeamSpot::Event > &)
bool m_useFilledBCIDsOnly
std::string find(const std::string &s)
return a remapped string
uint64_t eventNumber() const
The current event's event number.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
void setAlgType(int type)
@ V0Vtx
Vertex from V0 decay.
unsigned int m_maxLBsPerFit
bool passEventSelection(const xAOD::EventInfo &)
std::vector< BeamSpot::VrtHolder > vertices
SG::ReadCondHandleKey< BunchCrossingCondData > m_bcDataKey
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
unsigned int m_maxEventsPerFit
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
VxType::VertexType vertexType() const
The type of the vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
uint32_t runNumber() const
The current event's run number.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode finalize() override
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
void setFitStatus(int status)
POOL::TEvent event(POOL::TEvent::kClassAccess)
std::map< std::string, double > covMap
::StatusCode StatusCode
StatusCode definition for legacy code.
@ SecVtx
Secondary vertex.
std::map< std::string, double > paramMap
unsigned int lumiBlock() const
unsigned long timeStamp() const
EventID * event_ID()
the unique identification of the event.
void tolower(std::string &s)
int min_lb(std::vector< BeamSpot::Event > &)
StatusCode setupBeamSpotTree()
std::vector< BeamSpot::Event > m_eventList
unsigned int bcid() const
vertexNtuple_struct m_root_vtx
xAOD::VxType::VertexType vertexType
std::string m_vertexTreeName
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
bool passVertexSelection(const xAOD::Vertex *)
void writeToVertexTree(BeamSpot::Event &, BeamSpot::VrtHolder &)
std::vector< std::vector< BeamSpot::Event > > m_sortedEventList
uint32_t lumiBlock() const
The current event's luminosity block number.
beamSpotNtuple_struct m_beamSpotNtuple
unsigned int m_maxRunsPerFit
unsigned int runNumber() const
BeamSpot::Event readEvent(const xAOD::EventInfo &, const xAOD::VertexContainer &)
void writeToBeamSpotTree(const IInDetBeamSpotTool *bs, std::vector< BeamSpot::Event > &, std::vector< BeamSpot::VrtHolder > &)
std::string m_fitSortingKey
std::map< BeamSpot::ID, std::vector< BeamSpot::Event > > m_eventMap
void setFitWidth(bool fitWidth)
This class provides general information about an event. Event information is provided by the accessor...
StatusCode initialize(bool used=true)
setEventNumber setTimeStamp bcid
Class describing the basic event information.
InDetBeamSpotFinder(const std::string &name, ISvcLocator *pSvcLocator)
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
float chiSquared() const
Returns the of the vertex fit as float.
Class describing a Vertex.
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
ToolHandleArray< IInDetBeamSpotTool > m_beamSpotToolList
void setOnlineStatus(bool isOnline)
unsigned int m_minVertexNum
virtual StatusCode execute() override
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
int max_run(std::vector< BeamSpot::Event > &)
unsigned long long eventTime
StatusCode setupVertexTree()
unsigned long long eventTime_NS
@ ConvVtx
Conversion vertex.
ServiceHandle< IToolSvc > m_toolSvc
xAOD::VxType::VertexType vType
uint32_t bcid() const
The bunch crossing ID of the event.
unsigned int pileup() const
@ NotSpecified
Default value, no explicit type set.
BeamSpotStatusCode m_BeamStatusCode
unsigned long m_secondsPerFit
std::vector< std::string > m_vertexTypeNames
bool isFilled(const bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
double m_maxTransverseError
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.
bool iequals(const std::string &, const std::string &)