 |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "EventInfo/EventInfo.h"
20 return (
e1.lumiBlock<
e2.lumiBlock);
25 return (
e1.runNumber<
e2.runNumber);
57 ATH_MSG_FATAL(
"FATAL ERROR: must provide at least one beamspot tool in beamSpotToolList");
58 return StatusCode::FAILURE;
73 return StatusCode::SUCCESS;
84 for(
auto & thisVertex: currentEvent.
vertices){
90 return StatusCode::SUCCESS;
97 return StatusCode::SUCCESS;
106 event.bcid = eventInfo.
bcid();
113 if(!eventInfo.
eventType(xAOD::EventInfo::EventType::IS_SIMULATION))
121 event.lumiBlock = BSeventInfo->
event_ID()->lumi_block();
129 vertex.vxx = vtx->covariancePosition()(0,0);
130 vertex.vxy = vtx->covariancePosition()(0,1);
131 vertex.vyy = vtx->covariancePosition()(1,1);
132 vertex.vzz = vtx->covariancePosition()(2,2);
133 vertex.vertexType = vtx->vertexType();
134 vertex.nTracks = vtx->nTrackParticles();
150 vertex.vxx < 0.)
continue;
151 event.vertices.push_back(
vertex );
169 unsigned int nRuns = 0;
170 unsigned int nLBs = 0;
171 unsigned int nFits = 1;
175 currentID =
iter->first;
180 || currentID.
bcid() != lastID.
bcid()
184 << currentID.
pileup() <<
" <-- " << lastID.
pileup() <<
"\n\t"
185 << currentID.
bcid() <<
" <-- " << lastID.
bcid() <<
"\n\t"
193 for(
unsigned int i = 0;
i <
iter->second.size();
i++){
202 lastID =
iter->first;
211 if ((*
it) ==
"NoVtx") ;
223 ATH_MSG_DEBUG(
"No selection based on vertexType will be done" );
240 if(!vtx) {
return false; }
246 if(vtx->covariancePosition()(0,0) <= 0 || vtx->covariancePosition()(1,1) <= 0 || vtx->covariancePosition()(2,2) <= 0 ) {
return false; }
248 if(vtx->covariancePosition()(0,0) > maxTransverseError2 || vtx->covariancePosition()(1,1) > maxTransverseError2) {
return false;}
253 const std::string inRootID =
"/INDETBEAMSPOTFINDER/";
255 m_root_vrt =
new TTree(svrts.data(),
"Vertices");
256 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");
262 std::vector<BeamSpot::VrtHolder> verticesToFit;
265 verticesToFit.clear();
271 for(
const auto & thisVertex: thisEvent.vertices){
272 if( thisVertex.passed ) {
273 verticesToFit.push_back( thisVertex );
281 if(!bs){
return StatusCode::FAILURE; }
282 if(not verticesToFit.empty()) { bsFitStatus = bs->
fit(verticesToFit); }
304 return StatusCode::SUCCESS;
308 const std::string inRootID =
"/INDETBEAMSPOTFINDER/";
309 const std::string sbs =
"BeamSpotNt";
310 m_root_bs =
new TTree(sbs.data(),
"Beamspot Solutions");
329 std::map<std::string,double> paramMap =
tool->getParamMap();
330 std::map<std::string,double> covMap =
tool->getCovMap();
332 std::string slashD =
"/D";
333 std::string keySlashD;
341 keySlashD =
key + slashD;
347 const std::string &
key =
iter->first;
351 keySlashD =
key + slashD;
383 unsigned int sz =
a.size();
386 for (
unsigned int i = 0;
i <
sz; ++
i)
401 unsigned int nVtxAll = 0;
402 unsigned int nVtxPrim = 0;
404 for(
const auto & thisEvent :
eventList){
405 const auto & theseVertices=thisEvent.vertices;
406 nVtxAll += theseVertices.size();
407 nVtxPrim+= std::count_if(theseVertices.begin(), theseVertices.end(), isPrimaryVertex);
418 const auto & bsToolCovMap= bs->
getCovMap();
420 const std::string &
key = param.first;
421 const auto & bsToolEquivalent =bsToolParamMap.find(
key);
422 param.second = ( bsToolEquivalent == bsToolParamMap.end() ) ? 0 : bsToolEquivalent->second;
432 const std::string &
key = covariance.first;
433 const auto & bsToolEquivalent = bsToolCovMap.find(
key);
434 covariance.second = ( bsToolEquivalent == bsToolCovMap.end() ) ? 0 : bsToolEquivalent->second;
453 const auto smallestLbEvent=std::min_element(
eventList.begin(),
eventList.end(), lesserLumiBlock);
454 return smallestLbEvent->lumiBlock;
458 const auto largestLbEvent=std::max_element(
eventList.begin(),
eventList.end(), lesserLumiBlock);
459 return largestLbEvent->lumiBlock;
463 const auto smallestRunEvent=std::min_element(
eventList.begin(),
eventList.end(), lesserRunNumber);
464 return smallestRunEvent->runNumber;
468 const auto largestRunEvent=std::max_element(
eventList.begin(),
eventList.end(), lesserRunNumber);
469 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
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< ITHistSvc > m_thistSvc
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
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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?
bool eventType(EventType type) const
Check for one particular bitmask value.
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 &)