ATLAS Offline Software
InDetBeamSpotFinder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "InDetBeamSpotFinder.h"
7 #include "InDetBeamSpotVertex.h"
8 #include "InDetBeamSpotRooFit.h"
9 #include "VxVertex/VxCandidate.h"
12 
13 #include "EventInfo/EventInfo.h"
14 #include "EventInfo/EventID.h"
15 #include <algorithm>
16 
17 namespace{
18  //comparison of events for lumiBlock
19  auto lesserLumiBlock = [](const BeamSpot::Event & e1, const BeamSpot::Event & e2)->bool{
20  return (e1.lumiBlock<e2.lumiBlock);
21  };
22 
23  //comparison of events for run number
24  auto lesserRunNumber = [](const BeamSpot::Event & e1, const BeamSpot::Event & e2)->bool{
25  return (e1.runNumber<e2.runNumber);
26  };
27 
28 }
29 
30 InDet::InDetBeamSpotFinder::InDetBeamSpotFinder(const std::string& name, ISvcLocator* pSvcLocator):
31  AthAlgorithm(name, pSvcLocator)
32 {
33  declareProperty( "BeamSpotToolList" , m_beamSpotToolList );
34  declareProperty( "RunRange" , m_maxRunsPerFit = 0 );
35  declareProperty( "LumiRange" , m_maxLBsPerFit = 0 );
36  declareProperty( "EventRange" , m_maxEventsPerFit = 0);
37  declareProperty( "UseBCID" , m_BCIDsToAccept );
38  declareProperty( "UseFilledBCIDsOnly", m_useFilledBCIDsOnly = true );
39  declareProperty( "MinTracksPerVtx", m_minTrackNum = 5);
40  declareProperty( "MaxTracksPerVtx", m_maxTrackNum = 1000000);
41  declareProperty( "MinVtxNum" , m_minVertexNum = 100);
42  declareProperty( "MaxVtxChi2" , m_maxChi2Vertex = 10);
43  declareProperty( "MaxTransverseErr", m_maxTransverseError=1000000);
44  declareProperty( "MaxAbsCorrelXY", m_maxAbsCorrelXY=0.8);
45  declareProperty( "VertexTypes" , m_vertexTypeNames);
46  declareProperty( "MinVtxProb" , m_minVtxProb=0.001);
47  declareProperty( "GroupFitsBy" , m_fitSortingKey = "none");
48  declareProperty( "VertexNtuple" , m_writeVertexNtuple = true);
49  declareProperty( "WriteAllVertices" , m_writeAllVertices=false);
50  declareProperty( "VertexTreeName" , m_vertexTreeName = "Vertices");
51  declareProperty( "SecondsPerFit", m_secondsPerFit = 1);
52 }
53 
55  ATH_MSG_DEBUG( "in initialize()");
56  if ( m_beamSpotToolList.empty() ){
57  ATH_MSG_FATAL("FATAL ERROR: must provide at least one beamspot tool in beamSpotToolList");
58  return StatusCode::FAILURE;
59  }
60 
61  ATH_CHECK( m_thistSvc.retrieve() );
62  ATH_CHECK( m_toolSvc.retrieve() );
63 
65 
67  ATH_CHECK( m_vertexContainer.initialize() );
68 
69  for ( unsigned int i = 0; i < m_beamSpotToolList.size(); i++){ ATH_CHECK( m_beamSpotToolList[i].retrieve() );}
73  return StatusCode::SUCCESS;
74 }
75 
79  if ( !passEventSelection( *eventInfo ) ) return StatusCode::SUCCESS;
80  BeamSpot::Event currentEvent = readEvent(*eventInfo, *vertexContainer);
81 
82  m_eventList.push_back( currentEvent );
83  if( m_writeVertexNtuple ){
84  for( auto & thisVertex: currentEvent.vertices){
85  if( thisVertex.passed || m_writeAllVertices ){
86  writeToVertexTree( currentEvent, thisVertex );
87  }
88  }
89  }
90  return StatusCode::SUCCESS;
91 }
92 
94  ATH_MSG_DEBUG( "in finalize()" );
95  sortEvents();
97  return StatusCode::SUCCESS;
98 }
99 
103  event.pileup = ceil(eventInfo.actualInteractionsPerCrossing());
104  event.runNumber = eventInfo.runNumber();
105  event.lumiBlock = eventInfo.lumiBlock();
106  event.bcid = eventInfo.bcid();
107  event.eventTime = eventInfo.timeStamp();
108  event.eventTime_NS = eventInfo.timeStampNSOffset();
109  event.eventNumber = eventInfo.eventNumber();
110  const EventInfo* BSeventInfo;
111  //This is required for pseudo lumiblocks
112 
113  if(!eventInfo.eventType(xAOD::EventInfo::EventType::IS_SIMULATION))
114  {
115  if( evtStore()->retrieve(BSeventInfo) != StatusCode::SUCCESS){
116  ATH_MSG_ERROR("Cannot get event info.");
117  return event;
118  }
119 
120  // Remove the redundent logic, event.lumiBlock != BSeventInfo->event_ID()->lumi_block()
121  event.lumiBlock = BSeventInfo->event_ID()->lumi_block();
122  };
123 
124  for(const xAOD::Vertex* vtx:vertexContainer) {
125  if (vtx->vertexType() == xAOD::VxType::NoVtx) continue;
126  vertex.x = vtx->x();
127  vertex.y = vtx->y();
128  vertex.z = vtx->z();
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();
135  vertex.passed = passVertexSelection( vtx );
136  vertex.valid = vertex.passed;
137  //Remove vertices with wrong x-y correlation
138  if(vertex.vxy*vertex.vxy/vertex.vxx/vertex.vyy > 1.0 ||
139  vertex.vzz < 0. ||
140  vertex.vyy < 0. ||
141  vertex.vxx < 0.) {
142  ATH_MSG_DEBUG("Bad vertex: " << event.eventNumber << " " << vtx->vertexType() << " "
143  << vertex.x << " " << vertex.y << " " << vertex.z << " "
144  << vertex.vxx << " " << vertex.vyy << " " << vertex.vzz << " "
145  << vertex.nTracks << " " << vertex.vxy*vertex.vxy/vertex.vxx/vertex.vyy);
146  }
148  vertex.vzz < 0. ||
149  vertex.vyy < 0. ||
150  vertex.vxx < 0.) continue;
151  event.vertices.push_back( vertex );
152  }
153  return event;
154 }
155 
157  for( const auto & thisEvent: m_eventList){
159  id.runNumber( (m_maxRunsPerFit > 0) ? thisEvent.runNumber : 0 );
160  id.lumiBlock( (m_maxLBsPerFit > 0) ? thisEvent.lumiBlock : 0 );
161  id.pileup ( iequals(m_fitSortingKey,"pileup") ? thisEvent.pileup : 0 );
162  id.bcid ( iequals(m_fitSortingKey,"bcid" ) ? thisEvent.bcid : 0 );
163  id.timeStamp( iequals(m_fitSortingKey,"time" ) ? thisEvent.eventTime/m_secondsPerFit : 0 );
164  m_eventMap[id].push_back( thisEvent );
165  }
166  auto iter = m_eventMap.begin();
167  BeamSpot::ID lastID = iter->first;
168  BeamSpot::ID currentID = iter->first;
169  unsigned int nRuns = 0;
170  unsigned int nLBs = 0;
171  unsigned int nFits = 1;
172  m_sortedEventList.resize( nFits );
173 
174  for( iter = m_eventMap.begin(); iter != m_eventMap.end(); ++iter){
175  currentID = iter->first;
176  if( iter == m_eventMap.begin() || currentID.runNumber() != lastID.runNumber() ){ nRuns++; }
177  if( iter == m_eventMap.begin() || currentID.lumiBlock() != lastID.lumiBlock() ){ nLBs++; }
178  if( currentID.timeStamp() != lastID.timeStamp() ||
179  currentID.pileup() != lastID.pileup()
180  || currentID.bcid() != lastID.bcid()
181  || ( m_maxRunsPerFit > 0 && nRuns > m_maxRunsPerFit )
182  || ( m_maxLBsPerFit > 0 && nLBs > m_maxLBsPerFit )){
183  ATH_MSG_INFO( "New Fit " << currentID.timeStamp() << "<--"<< lastID.timeStamp() << "\n\t"
184  << currentID.pileup() << " <-- " << lastID.pileup() << "\n\t"
185  << currentID.bcid() << " <-- " << lastID.bcid() << "\n\t"
186  << nRuns << " " << m_maxRunsPerFit << "\n\t"
187  << nLBs << " " << m_maxLBsPerFit );
188 
189  nFits++;
190  m_sortedEventList.resize(nFits);
191  nRuns = 1; nLBs = 1;
192  }
193  for( unsigned int i = 0; i < iter->second.size(); i++){
194  if( m_sortedEventList.at(nFits-1).size() == m_maxEventsPerFit && m_maxEventsPerFit > 0 ){
195  nFits++;
196  m_sortedEventList.resize(nFits);
197  nRuns = 1; nLBs = 1;
198  }
199 
200  m_sortedEventList.at(nFits-1).push_back( iter->second.at(i) );
201  }
202  lastID = iter->first;
203  }
204 }
205 
206 //Convert the vector of strings to vector of vertex types.
208  if ( not m_vertexTypeNames.empty() ) {
209  for ( std::vector<std::string>::const_iterator it = m_vertexTypeNames.begin();
210  it != m_vertexTypeNames.end(); ++it) {
211  if ((*it) == "NoVtx") ;
212  else if ((*it) == "PriVtx") m_vertexTypes.push_back(xAOD::VxType::PriVtx);
213  else if ((*it) == "SecVtx") m_vertexTypes.push_back(xAOD::VxType::SecVtx);
214  else if ((*it) == "PileUp") m_vertexTypes.push_back(xAOD::VxType::PileUp);
215  else if ((*it) == "ConvVtx") m_vertexTypes.push_back(xAOD::VxType::ConvVtx);
216  else if ((*it) == "V0Vtx") m_vertexTypes.push_back(xAOD::VxType::V0Vtx);
217  else if ((*it) == "KinkVtx") m_vertexTypes.push_back(xAOD::VxType::KinkVtx);
218  else if ((*it) =="NotSpecified")m_vertexTypes.push_back(xAOD::VxType::NotSpecified) ;
219  }
220  ATH_MSG_INFO("Allowing " << m_vertexTypes.size() << " Vertex types" );
221  }
222  else {
223  ATH_MSG_DEBUG( "No selection based on vertexType will be done" );
224  }
225 }
226 
228  const int bcid = eventInfo.bcid();
229  if ( m_useFilledBCIDsOnly) {
231  if ( !bcData->isFilled(bcid) ) return false;
232  }
233  if( m_BCIDsToAccept.begin() != m_BCIDsToAccept.end() )
234  return ( std::find(m_BCIDsToAccept.begin(), m_BCIDsToAccept.end(), bcid) != m_BCIDsToAccept.end());
235  else
236  return true;
237 }
238 
240  if(!vtx) { return false; }
241  if(m_vertexTypes.end() == std::find( m_vertexTypes.begin(), m_vertexTypes.end(), vtx->vertexType() ) ) { return false; }
242  if(vtx->chiSquared()/vtx->numberDoF() > m_maxChi2Vertex) { return false; }
243  if(static_cast<int>(vtx->nTrackParticles()) < m_minTrackNum ){ return false; }
244  if(static_cast<int>(vtx->nTrackParticles()) > m_maxTrackNum ){ return false; }
245  if(TMath::Prob(vtx->chiSquared(), vtx->numberDoF()) < m_minVtxProb ) { return false; }
246  if(vtx->covariancePosition()(0,0) <= 0 || vtx->covariancePosition()(1,1) <= 0 || vtx->covariancePosition()(2,2) <= 0 ) { return false; }
247  double maxTransverseError2 = m_maxTransverseError * m_maxTransverseError;
248  if(vtx->covariancePosition()(0,0) > maxTransverseError2 || vtx->covariancePosition()(1,1) > maxTransverseError2) {return false;}
249  return true;
250 }
251 
253  const std::string inRootID = "/INDETBEAMSPOTFINDER/";
254  const std::string svrts = m_vertexTreeName;
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");
257  return m_thistSvc->regTree(inRootID+svrts,m_root_vrt);
258 }
259 
261  IInDetBeamSpotTool::FitStatus bsFitStatus;
262  std::vector<BeamSpot::VrtHolder> verticesToFit;
263 
264  for( auto & eventList: m_sortedEventList){
265  verticesToFit.clear();
266  if(eventList.size() > 0) {
267  BeamSpot::Event ev = *eventList.begin();
268  ATH_MSG_INFO( "Event list size/LB/bcid: " << eventList.size() << " " << ev.lumiBlock << " " << ev.bcid);
269  }
270  for( const auto & thisEvent: eventList){
271  for( const auto & thisVertex: thisEvent.vertices){
272  if( thisVertex.passed ) {
273  verticesToFit.push_back( thisVertex );
274  }
275  }
276  }
277 
278  for( unsigned int j = 0; j < m_beamSpotToolList.size(); j++){
279  IInDetBeamSpotTool * bs(nullptr);
280  bs = cloneTool(j);
281  if(!bs){ return StatusCode::FAILURE; }
282  if(not verticesToFit.empty()) { bsFitStatus = bs->fit(verticesToFit); }
283  else { bsFitStatus = IInDetBeamSpotTool::unsolved; }
284 
288  int fitStat;
289  if ( bsFitStatus == IInDetBeamSpotTool::successful)
290  fitStat = 3;
291  else if ( bsFitStatus == IInDetBeamSpotTool::problems)
292  fitStat = 1;
293  else if ( bsFitStatus == IInDetBeamSpotTool::failed || bsFitStatus == IInDetBeamSpotTool::unsolved)
294  fitStat = 0;
295  else
296  fitStat = 0;
298  if (bs->getParamMap()["sigmaX"] == 0 && bs->getParamMap()["sigmaY"] ==0 ) { m_BeamStatusCode.setFitWidth( false); }
299  else { m_BeamStatusCode.setFitWidth(true); }
300 
301  if(not eventList.empty()) writeToBeamSpotTree( bs, eventList, verticesToFit );
302  }
303  }
304  return StatusCode::SUCCESS;
305 }
306 
308  const std::string inRootID = "/INDETBEAMSPOTFINDER/";
309  const std::string sbs = "BeamSpotNt";//m_root_beamspotName;
310  m_root_bs = new TTree(sbs.data(),"Beamspot Solutions");
311  m_root_bs->Branch("bcid", &m_beamSpotNtuple.bcid,"bcid/I");
312  m_root_bs->Branch("pileup", &m_beamSpotNtuple.pileup,"pileup/I");
313  m_root_bs->Branch("defectWord", &m_beamSpotNtuple.defectWord, "defectWord/I");
314  m_root_bs->Branch("fill", &m_beamSpotNtuple.fill, "fill/I");
315  m_root_bs->Branch("lbEnd", &m_beamSpotNtuple.lbEnd, "lbEnd/I");
316  m_root_bs->Branch("lbStart", &m_beamSpotNtuple.lbStart, "lbStart/I");
317  m_root_bs->Branch("nEvents", &m_beamSpotNtuple.nEvents, "nEvents/I");
318  m_root_bs->Branch("nValid", &m_beamSpotNtuple.nValid, "nValid/I");
319  m_root_bs->Branch("nVtxAll", &m_beamSpotNtuple.nVtxAll, "nVtxAll/I");
320  m_root_bs->Branch("nVtxPrim", &m_beamSpotNtuple.nVtxPrim, "nVtxPrim/I");
321  m_root_bs->Branch("separation", &m_beamSpotNtuple.separation, "separation/I");
322  m_root_bs->Branch("status", &m_beamSpotNtuple.status, "status/I");
323  m_root_bs->Branch("timeEnd", &m_beamSpotNtuple.timeEnd, "timeEnd/I");
324  m_root_bs->Branch("timeStart", &m_beamSpotNtuple.timeStart, "timeStart/I");
325  m_root_bs->Branch("run", &m_beamSpotNtuple.run, "run/I");
326  m_root_bs->Branch("runEnd", &m_beamSpotNtuple.runEnd, "runEnd/I");
327 
328  for( auto &tool : m_beamSpotToolList ){
329  std::map<std::string,double> paramMap = tool->getParamMap();
330  std::map<std::string,double> covMap = tool->getCovMap();
331 
332  std::string slashD = "/D";
333  std::string keySlashD;
334 
335  //Loop over the parameters for a given fit tool, and create a branch for each if it doesn't exist
336  for( std::map<std::string,double>::iterator iter = paramMap.begin(); iter != paramMap.end(); ++iter){
337  std::string key = iter->first;
338  //double val = iter->second;
339  if( !(m_root_bs->GetBranch(key.c_str())) ){
341  keySlashD = key + slashD;
342  m_root_bs->Branch(key.c_str(), &m_beamSpotNtuple.paramMap[key], keySlashD.c_str());
343  }
344  }
345  //Loop over the covariance matrix for a given fit tool and create a branch for each element, if it doesn't already exist.
346  for( std::map<std::string,double>::iterator iter = covMap.begin(); iter != covMap.end(); ++iter){
347  const std::string & key = iter->first;
348  //double val = iter->second;
349  if( !(m_root_bs->GetBranch(key.c_str())) ){
351  keySlashD = key + slashD;
352  m_root_bs->Branch( key.c_str(), &m_beamSpotNtuple.covMap[key], keySlashD.c_str());
353  }
354  }
355  }
356  return m_thistSvc->regTree(inRootID+sbs,m_root_bs);
357 }
358 
360  m_root_vtx.x = vtx.x;
361  m_root_vtx.y = vtx.y;
362  m_root_vtx.z = vtx.z;
363  m_root_vtx.vxx = vtx.vxx;
364  m_root_vtx.vxy = vtx.vxy;
365  m_root_vtx.vyy = vtx.vyy;
366  m_root_vtx.vzz = vtx.vzz;
368  m_root_vtx.run = evt.runNumber;
369  m_root_vtx.lb = evt.lumiBlock;
370  m_root_vtx.bcid = evt.bcid;
371  m_root_vtx.pileup = evt.pileup;
372  m_root_vtx.nTracks = vtx.nTracks;
373  m_root_vtx.passed = vtx.passed;
374  m_root_vtx.valid = vtx.valid;
375  m_root_vtx.eventNumber = evt.eventNumber;
376  m_root_vtx.eventTime = evt.eventTime;
377  m_root_vtx.eventTime_NS = evt.eventTime_NS;
378  m_root_vrt->Fill();
379 }
380 
381 bool InDet::InDetBeamSpotFinder::iequals(const std::string& a, const std::string& b)
382 {
383  unsigned int sz = a.size();
384  if (b.size() != sz)
385  return false;
386  for (unsigned int i = 0; i < sz; ++i)
387  if (tolower(a[i]) != tolower(b[i]))
388  return false;
389  return true;
390 }
391 
392 void InDet::InDetBeamSpotFinder::writeToBeamSpotTree(const IInDetBeamSpotTool *bs, std::vector<BeamSpot::Event> &eventList, std::vector<BeamSpot::VrtHolder> &vertexList){
393  m_beamSpotNtuple.pileup = iequals(m_fitSortingKey,"pileup") ? eventList.at(0).pileup : 0;
394  m_beamSpotNtuple.bcid = iequals(m_fitSortingKey,"bcid") ? eventList.at(0).bcid : 0;
400  m_beamSpotNtuple.nValid = vertexList.size();
401  unsigned int nVtxAll = 0;
402  unsigned int nVtxPrim = 0;
403  auto isPrimaryVertex=[](const BeamSpot::VrtHolder & vertex){ return (vertex.vertexType == xAOD::VxType::PriVtx); };
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);
408  }
409  m_beamSpotNtuple.nVtxAll = nVtxAll;
410  m_beamSpotNtuple.nVtxPrim = nVtxPrim;
414  m_beamSpotNtuple.timeEnd = iequals(m_fitSortingKey,"time") ? eventList.back().eventTime : 0;
415  m_beamSpotNtuple.timeStart = iequals(m_fitSortingKey,"time") ? eventList.front().eventTime : 0;
417  const auto & bsToolParamMap = bs->getParamMap();
418  const auto & bsToolCovMap= bs->getCovMap();
419  for (auto & param:m_beamSpotNtuple.paramMap){
420  const std::string & key = param.first;
421  const auto & bsToolEquivalent =bsToolParamMap.find(key);
422  param.second = ( bsToolEquivalent == bsToolParamMap.end() ) ? 0 : bsToolEquivalent->second;
423  }
431  for (auto & covariance:m_beamSpotNtuple.covMap){
432  const std::string & key = covariance.first;
433  const auto & bsToolEquivalent = bsToolCovMap.find(key);
434  covariance.second = ( bsToolEquivalent == bsToolCovMap.end() ) ? 0 : bsToolEquivalent->second;
435  }
443  m_root_bs->Fill();
444 }
445 
448  IInDetBeamSpotTool * temp = orig->Clone();
449  return temp;
450 }
451 
452 int InDet::InDetBeamSpotFinder::min_lb( std::vector<BeamSpot::Event> & eventList ){
453  const auto smallestLbEvent=std::min_element(eventList.begin(),eventList.end(), lesserLumiBlock);
454  return smallestLbEvent->lumiBlock;
455 }
456 
457 int InDet::InDetBeamSpotFinder::max_lb( std::vector<BeamSpot::Event> & eventList ){
458  const auto largestLbEvent=std::max_element(eventList.begin(),eventList.end(), lesserLumiBlock);
459  return largestLbEvent->lumiBlock;
460 }
461 
462 int InDet::InDetBeamSpotFinder::min_run( std::vector<BeamSpot::Event> & eventList ){
463  const auto smallestRunEvent=std::min_element(eventList.begin(),eventList.end(), lesserRunNumber);
464  return smallestRunEvent->runNumber;
465 }
466 
467 int InDet::InDetBeamSpotFinder::max_run( std::vector<BeamSpot::Event> & eventList ){
468  const auto largestRunEvent=std::max_element(eventList.begin(),eventList.end(), lesserRunNumber);
469  return largestRunEvent->runNumber;
470 }
471 
InDet::InDetBeamSpotFinder::m_writeVertexNtuple
bool m_writeVertexNtuple
Definition: InDetBeamSpotFinder.h:65
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.scripts.list_events.eventList
eventList
Definition: list_events.py:153
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::lbStart
int lbStart
Definition: InDetBeamSpotFinder.h:72
InDet::InDetBeamSpotFinder::m_vertexTypes
std::vector< xAOD::VxType::VertexType > m_vertexTypes
Definition: InDetBeamSpotFinder.h:123
InDet::InDetBeamSpotFinder::convertVtxTypeNames
void convertVtxTypeNames()
Definition: InDetBeamSpotFinder.cxx:207
InDet::InDetBeamSpotFinder::cloneTool
IInDetBeamSpotTool * cloneTool(int)
Definition: InDetBeamSpotFinder.cxx:446
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
InDet::InDetBeamSpotFinder::vertexNtuple_struct::eventNumber
unsigned long long eventNumber
Definition: InDetBeamSpotFinder.h:83
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDet::InDetBeamSpotFinder::vertexNtuple_struct::run
unsigned int run
Definition: InDetBeamSpotFinder.h:82
InDetBeamSpotFinder.h
fitman.sz
sz
Definition: fitman.py:527
BeamSpot::VrtHolder::vxy
double vxy
Definition: IInDetBeamSpotTool.h:25
xAOD::Vertex_v1::nTrackParticles
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
Definition: Vertex_v1.cxx:270
InDet::InDetBeamSpotFinder::m_BCIDsToAccept
std::vector< unsigned int > m_BCIDsToAccept
Definition: InDetBeamSpotFinder.h:63
InDet::InDetBeamSpotFinder::initialize
virtual StatusCode initialize() override
Definition: InDetBeamSpotFinder.cxx:54
InDet::InDetBeamSpotFinder::min_run
int min_run(std::vector< BeamSpot::Event > &)
Definition: InDetBeamSpotFinder.cxx:462
InDet::InDetBeamSpotFinder::vertexNtuple_struct::vxx
double vxx
Definition: InDetBeamSpotFinder.h:80
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
InDet::InDetBeamSpotFinder::max_lb
int max_lb(std::vector< BeamSpot::Event > &)
Definition: InDetBeamSpotFinder.cxx:457
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
InDet::InDetBeamSpotFinder::m_useFilledBCIDsOnly
bool m_useFilledBCIDsOnly
Definition: InDetBeamSpotFinder.h:130
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
InDet::InDetBeamSpotFinder::m_vertexContainer
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer
Definition: InDetBeamSpotFinder.h:56
egammaEnergyPositionAllSamples::e1
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
InDet::BeamSpotStatusCode::setAlgType
void setAlgType(int type)
Definition: BeamSpotStatusCode.h:45
xAOD::VxType::V0Vtx
@ V0Vtx
Vertex from V0 decay.
Definition: TrackingPrimitives.h:576
InDet::InDetBeamSpotFinder::m_maxLBsPerFit
unsigned int m_maxLBsPerFit
Definition: InDetBeamSpotFinder.h:61
InDet::InDetBeamSpotFinder::passEventSelection
bool passEventSelection(const xAOD::EventInfo &)
Definition: InDetBeamSpotFinder.cxx:227
InDet::BeamSpotStatusCode::clearWord
void clearWord()
Definition: BeamSpotStatusCode.h:57
skel.it
it
Definition: skel.GENtoEVGEN.py:407
IInDetBeamSpotTool.h
InDet::InDetBeamSpotFinder::vertexNtuple_struct::pileup
unsigned int pileup
Definition: InDetBeamSpotFinder.h:82
BeamSpot::Event::vertices
std::vector< BeamSpot::VrtHolder > vertices
Definition: IInDetBeamSpotTool.h:36
InDet::BeamSpotStatusCode::getWord
int getWord() const
Definition: BeamSpotStatusCode.h:59
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
InDet::InDetBeamSpotFinder::m_bcDataKey
SG::ReadCondHandleKey< BunchCrossingCondData > m_bcDataKey
Definition: InDetBeamSpotFinder.h:51
InDet::InDetBeamSpotFinder::vertexNtuple_struct::vzz
double vzz
Definition: InDetBeamSpotFinder.h:80
InDet::IInDetBeamSpotTool::getFitID
virtual FitID getFitID() const =0
A unique ID for the specific fit type.
xAOD::EventInfo_v1::timeStampNSOffset
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
InDet::InDetBeamSpotFinder::m_maxEventsPerFit
unsigned int m_maxEventsPerFit
Definition: InDetBeamSpotFinder.h:60
InDet::InDetBeamSpotFinder::vertexNtuple_struct::z
double z
Definition: InDetBeamSpotFinder.h:80
InDet::InDetBeamSpotFinder::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition: InDetBeamSpotFinder.h:54
xAOD::Vertex_v1::vertexType
VxType::VertexType vertexType() const
The type of the vertex.
xAOD::VxType::NoVtx
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Definition: TrackingPrimitives.h:571
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
InDet::InDetBeamSpotFinder::m_writeAllVertices
bool m_writeAllVertices
Definition: InDetBeamSpotFinder.h:133
InDet::InDetBeamSpotFinder::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition: InDetBeamSpotFinder.h:47
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
InDet::InDetBeamSpotFinder::finalize
virtual StatusCode finalize() override
Definition: InDetBeamSpotFinder.cxx:93
InDet::InDetBeamSpotFinder::sortEvents
void sortEvents()
Definition: InDetBeamSpotFinder.cxx:156
EventID.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
BeamSpot::VrtHolder::passed
bool passed
Definition: IInDetBeamSpotTool.h:28
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::timeEnd
int timeEnd
Definition: InDetBeamSpotFinder.h:74
InDet::IInDetBeamSpotTool::successful
@ successful
Definition: IInDetBeamSpotTool.h:49
ev
int ev
Definition: globals.cxx:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDet::BeamSpotStatusCode::setFitStatus
void setFitStatus(int status)
Definition: BeamSpotStatusCode.h:38
BeamSpot::VrtHolder::valid
bool valid
Definition: IInDetBeamSpotTool.h:28
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
BeamSpot::VrtHolder::vzz
double vzz
Definition: IInDetBeamSpotTool.h:25
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::runEnd
int runEnd
Definition: InDetBeamSpotFinder.h:74
BeamSpot::VrtHolder::z
double z
Definition: IInDetBeamSpotTool.h:24
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::nVtxAll
int nVtxAll
Definition: InDetBeamSpotFinder.h:73
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::nEvents
int nEvents
Definition: InDetBeamSpotFinder.h:73
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::covMap
std::map< std::string, double > covMap
Definition: InDetBeamSpotFinder.h:76
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::VxType::SecVtx
@ SecVtx
Secondary vertex.
Definition: TrackingPrimitives.h:573
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::InDetBeamSpotFinder::vertexNtuple_struct::lb
unsigned int lb
Definition: InDetBeamSpotFinder.h:82
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::paramMap
std::map< std::string, double > paramMap
Definition: InDetBeamSpotFinder.h:75
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
BeamSpot::VrtHolder::y
double y
Definition: IInDetBeamSpotTool.h:24
BeamSpot::ID::lumiBlock
unsigned int lumiBlock() const
Definition: BeamSpotID.h:14
InDet::IInDetBeamSpotTool::problems
@ problems
Definition: IInDetBeamSpotTool.h:49
BeamSpot::ID::timeStamp
unsigned long timeStamp() const
Definition: BeamSpotID.h:17
EventInfo::event_ID
EventID * event_ID()
the unique identification of the event.
Definition: EventInfo/EventInfo/EventInfo.h:224
tolower
void tolower(std::string &s)
Definition: AthenaSummarySvc.cxx:108
InDet::IInDetBeamSpotTool::FitStatus
FitStatus
Internally used enum for fit status.
Definition: IInDetBeamSpotTool.h:49
InDet::InDetBeamSpotFinder::vertexNtuple_struct::passed
bool passed
Definition: InDetBeamSpotFinder.h:84
InDet::InDetBeamSpotFinder::min_lb
int min_lb(std::vector< BeamSpot::Event > &)
Definition: InDetBeamSpotFinder.cxx:452
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:572
InDet::InDetBeamSpotFinder::m_root_bs
TTree * m_root_bs
Definition: InDetBeamSpotFinder.h:68
InDet::InDetBeamSpotFinder::setupBeamSpotTree
StatusCode setupBeamSpotTree()
Definition: InDetBeamSpotFinder.cxx:307
InDetBeamSpotVertex.h
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::run
int run
Definition: InDetBeamSpotFinder.h:74
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::fill
int fill
Definition: InDetBeamSpotFinder.h:72
InDet::InDetBeamSpotFinder::m_maxChi2Vertex
double m_maxChi2Vertex
Definition: InDetBeamSpotFinder.h:116
InDet::InDetBeamSpotFinder::m_eventList
std::vector< BeamSpot::Event > m_eventList
Definition: InDetBeamSpotFinder.h:92
BeamSpot::ID::bcid
unsigned int bcid() const
Definition: BeamSpotID.h:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::InDetBeamSpotFinder::m_root_vtx
vertexNtuple_struct m_root_vtx
Definition: InDetBeamSpotFinder.h:88
BeamSpot::VrtHolder::vertexType
xAOD::VxType::VertexType vertexType
Definition: IInDetBeamSpotTool.h:26
BeamSpot::VrtHolder::vyy
double vyy
Definition: IInDetBeamSpotTool.h:25
xAOD::VxType::KinkVtx
@ KinkVtx
Kink vertex.
Definition: TrackingPrimitives.h:577
InDet::InDetBeamSpotFinder::m_vertexTreeName
std::string m_vertexTreeName
Definition: InDetBeamSpotFinder.h:91
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
InDet::IInDetBeamSpotTool::unsolved
@ unsolved
Definition: IInDetBeamSpotTool.h:49
InDet::InDetBeamSpotFinder::passVertexSelection
bool passVertexSelection(const xAOD::Vertex *)
Definition: InDetBeamSpotFinder.cxx:239
InDet::InDetBeamSpotFinder::vertexNtuple_struct::bcid
unsigned int bcid
Definition: InDetBeamSpotFinder.h:82
InDet::InDetBeamSpotFinder::performFits
StatusCode performFits()
Definition: InDetBeamSpotFinder.cxx:260
InDet::InDetBeamSpotFinder::writeToVertexTree
void writeToVertexTree(BeamSpot::Event &, BeamSpot::VrtHolder &)
Definition: InDetBeamSpotFinder.cxx:359
InDet::IInDetBeamSpotTool::failed
@ failed
Definition: IInDetBeamSpotTool.h:49
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
InDet::InDetBeamSpotFinder::m_sortedEventList
std::vector< std::vector< BeamSpot::Event > > m_sortedEventList
Definition: InDetBeamSpotFinder.h:94
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::defectWord
int defectWord
Definition: InDetBeamSpotFinder.h:72
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
InDet::InDetBeamSpotFinder::vertexNtuple_struct::y
double y
Definition: InDetBeamSpotFinder.h:80
AthAlgorithm
Definition: AthAlgorithm.h:47
InDet::InDetBeamSpotFinder::m_beamSpotNtuple
beamSpotNtuple_struct m_beamSpotNtuple
Definition: InDetBeamSpotFinder.h:87
BeamSpot::ID
Definition: BeamSpotID.h:10
InDet::InDetBeamSpotFinder::m_maxRunsPerFit
unsigned int m_maxRunsPerFit
Definition: InDetBeamSpotFinder.h:59
BeamSpot::ID::runNumber
unsigned int runNumber() const
Definition: BeamSpotID.h:13
InDet::InDetBeamSpotFinder::readEvent
BeamSpot::Event readEvent(const xAOD::EventInfo &, const xAOD::VertexContainer &)
Definition: InDetBeamSpotFinder.cxx:100
VxCandidate.h
InDet::InDetBeamSpotFinder::writeToBeamSpotTree
void writeToBeamSpotTree(const IInDetBeamSpotTool *bs, std::vector< BeamSpot::Event > &, std::vector< BeamSpot::VrtHolder > &)
Definition: InDetBeamSpotFinder.cxx:392
InDet::InDetBeamSpotFinder::vertexNtuple_struct::vxy
double vxy
Definition: InDetBeamSpotFinder.h:80
InDet::InDetBeamSpotFinder::m_fitSortingKey
std::string m_fitSortingKey
Definition: InDetBeamSpotFinder.h:131
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition: TrackingPrimitives.h:574
InDet::InDetBeamSpotFinder::m_eventMap
std::map< BeamSpot::ID, std::vector< BeamSpot::Event > > m_eventMap
Definition: InDetBeamSpotFinder.h:93
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::lbEnd
int lbEnd
Definition: InDetBeamSpotFinder.h:72
BeamSpot::VrtHolder::vxx
double vxx
Definition: IInDetBeamSpotTool.h:25
InDet::IInDetBeamSpotTool::getCovMap
virtual std::map< std::string, double > getCovMap() const =0
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
InDet::BeamSpotStatusCode::setFitWidth
void setFitWidth(bool fitWidth)
Definition: BeamSpotStatusCode.h:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:43
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:452
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
InDet::IInDetBeamSpotTool::getParamMap
virtual std::map< std::string, double > getParamMap() const =0
InDet::IInDetBeamSpotTool::Clone
virtual IInDetBeamSpotTool * Clone()=0
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::nVtxPrim
int nVtxPrim
Definition: InDetBeamSpotFinder.h:73
InDet::InDetBeamSpotFinder::InDetBeamSpotFinder
InDetBeamSpotFinder(const std::string &name, ISvcLocator *pSvcLocator)
Definition: InDetBeamSpotFinder.cxx:30
xAOD::Vertex_v1::numberDoF
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
TrackParticle.h
InDet::InDetBeamSpotFinder::m_root_vrt
TTree * m_root_vrt
Definition: InDetBeamSpotFinder.h:69
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::nValid
int nValid
Definition: InDetBeamSpotFinder.h:73
InDet::InDetBeamSpotFinder::m_maxTrackNum
int m_maxTrackNum
Definition: InDetBeamSpotFinder.h:115
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
InDet::InDetBeamSpotFinder::vertexNtuple_struct::nTracks
unsigned int nTracks
Definition: InDetBeamSpotFinder.h:82
VertexContainer.h
InDet::InDetBeamSpotFinder::m_maxAbsCorrelXY
double m_maxAbsCorrelXY
Definition: InDetBeamSpotFinder.h:118
a
TList * a
Definition: liststreamerinfos.cxx:10
BeamSpot::Event
Definition: IInDetBeamSpotTool.h:33
xAOD::Vertex_v1::chiSquared
float chiSquared() const
Returns the of the vertex fit as float.
InDetBeamSpotRooFit.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
InDet::InDetBeamSpotFinder::vertexNtuple_struct::x
double x
Definition: InDetBeamSpotFinder.h:80
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
InDet::IInDetBeamSpotTool::fit
virtual FitStatus fit(std::vector< BeamSpot::VrtHolder > &)=0
Attempt a to find a solution of the beamspot.
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::status
int status
Definition: InDetBeamSpotFinder.h:74
InDet::InDetBeamSpotFinder::m_beamSpotToolList
ToolHandleArray< IInDetBeamSpotTool > m_beamSpotToolList
Definition: InDetBeamSpotFinder.h:48
InDet::IInDetBeamSpotTool
Definition: IInDetBeamSpotTool.h:45
InDet::BeamSpotStatusCode::setOnlineStatus
void setOnlineStatus(bool isOnline)
Definition: BeamSpotStatusCode.h:31
InDet::InDetBeamSpotFinder::m_minVertexNum
unsigned int m_minVertexNum
Definition: InDetBeamSpotFinder.h:120
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::timeStart
int timeStart
Definition: InDetBeamSpotFinder.h:74
InDet::InDetBeamSpotFinder::execute
virtual StatusCode execute() override
Definition: InDetBeamSpotFinder.cxx:76
xAOD::EventInfo_v1::timeStamp
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
InDet::InDetBeamSpotFinder::max_run
int max_run(std::vector< BeamSpot::Event > &)
Definition: InDetBeamSpotFinder.cxx:467
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::bcid
int bcid
Definition: InDetBeamSpotFinder.h:72
InDet::InDetBeamSpotFinder::vertexNtuple_struct::eventTime
unsigned long long eventTime
Definition: InDetBeamSpotFinder.h:83
BeamSpot::VrtHolder::x
double x
Definition: IInDetBeamSpotTool.h:24
InDet::InDetBeamSpotFinder::setupVertexTree
StatusCode setupVertexTree()
Definition: InDetBeamSpotFinder.cxx:252
BeamSpot::VrtHolder
Definition: IInDetBeamSpotTool.h:22
InDet::InDetBeamSpotFinder::vertexNtuple_struct::eventTime_NS
unsigned long long eventTime_NS
Definition: InDetBeamSpotFinder.h:83
InDet::InDetBeamSpotFinder::vertexNtuple_struct::vyy
double vyy
Definition: InDetBeamSpotFinder.h:80
xAOD::VxType::ConvVtx
@ ConvVtx
Conversion vertex.
Definition: TrackingPrimitives.h:575
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::separation
int separation
Definition: InDetBeamSpotFinder.h:74
InDet::InDetBeamSpotFinder::m_toolSvc
ServiceHandle< IToolSvc > m_toolSvc
Definition: InDetBeamSpotFinder.h:46
InDet::InDetBeamSpotFinder::vertexNtuple_struct::vType
xAOD::VxType::VertexType vType
Definition: InDetBeamSpotFinder.h:81
InDet::InDetBeamSpotFinder::vertexNtuple_struct::valid
bool valid
Definition: InDetBeamSpotFinder.h:84
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
InDet::InDetBeamSpotFinder::m_minTrackNum
int m_minTrackNum
Definition: InDetBeamSpotFinder.h:114
InDet::InDetBeamSpotFinder::m_minVtxProb
double m_minVtxProb
Definition: InDetBeamSpotFinder.h:119
BeamSpot::VrtHolder::nTracks
unsigned int nTracks
Definition: IInDetBeamSpotTool.h:27
BeamSpot::ID::pileup
unsigned int pileup() const
Definition: BeamSpotID.h:15
xAOD::VxType::NotSpecified
@ NotSpecified
Default value, no explicit type set.
Definition: TrackingPrimitives.h:578
InDet::InDetBeamSpotFinder::beamSpotNtuple_struct::pileup
int pileup
Definition: InDetBeamSpotFinder.h:72
InDet::InDetBeamSpotFinder::m_BeamStatusCode
BeamSpotStatusCode m_BeamStatusCode
Definition: InDetBeamSpotFinder.h:89
InDet::InDetBeamSpotFinder::m_secondsPerFit
unsigned long m_secondsPerFit
Definition: InDetBeamSpotFinder.h:137
InDet::InDetBeamSpotFinder::m_vertexTypeNames
std::vector< std::string > m_vertexTypeNames
Definition: InDetBeamSpotFinder.h:122
BunchCrossingCondData::isFilled
bool isFilled(const bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
Definition: BunchCrossingCondData.h:339
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.
InDet::InDetBeamSpotFinder::m_maxTransverseError
double m_maxTransverseError
Definition: InDetBeamSpotFinder.h:117
xAOD::EventInfo_v1::actualInteractionsPerCrossing
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.
Definition: EventInfo_v1.cxx:380
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
InDet::InDetBeamSpotFinder::iequals
bool iequals(const std::string &, const std::string &)
Definition: InDetBeamSpotFinder.cxx:381