ATLAS Offline Software
Loading...
Searching...
No Matches
BunchCrossingCondData.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
4 */
11
12
13#ifndef LUMIBLOCKDATA_BUNCHCROSSINGCONDDATA_H
14#define LUMIBLOCKDATA_BUNCHCROSSINGCONDDATA_H
15
16
19#include <vector>
20#include <bitset>
21
22
24
25public:
26
27 typedef unsigned int bcid_type;
28 static constexpr int m_MAX_BCID=3564;
29 static constexpr int m_BUNCH_SPACING = 25;
30
31
33
44 bool isFilled(const bcid_type bcid ) const;
45
46
48
57 bool isInTrain(const bcid_type bcid ) const;
58
60
71 bool isUnpaired(const bcid_type bcid ) const;
72
74
82 bool isBeam1(const bcid_type bcid ) const;
83
85
93 bool isBeam2(const bcid_type bcid ) const;
94
96
101 {
102 Empty = 0,
105 Single = 100,
106 Front = 200,
107 Middle = 201,
108 Tail = 202,
109 Unpaired = 300
110 };
111
113
122 BunchCrossingType bcType(const bcid_type bcid ) const;
123
125
136
138
153 int gapBeforeTrain( bcid_type bcid = 0,
155
171 int gapBeforeBunch( bcid_type bcid = 0,
173
174
176
191 int gapAfterTrain( bcid_type bcid = 0,
193
209
210 int gapAfterBunch( bcid_type bcid = 0,
212
213
215
231 int distanceFromFront( const bcid_type bcid,
232 const BunchDistanceType type = NanoSec ) const;
233
235
251 int distanceFromTail( const bcid_type bcid,
252 const BunchDistanceType type = NanoSec ) const;
253
255
270
271 unsigned int numberOfFilledBunches() const;
272
274
280 unsigned int numberOfUnpairedBunches() const;
281
283
290 unsigned int numberOfBunchTrains() const;
291
292
294
301 std::pair<unsigned,unsigned> bunchTrainPopulation(const bcid_type bcid) const;
302
303
304private:
305
306 friend class BunchCrossingCondAlg;// The cond-alg filling this class
307
308
309 // Data
310 std::bitset<m_MAX_BCID> m_beam1;
311 std::bitset<m_MAX_BCID> m_beam2;
312 std::bitset<m_MAX_BCID> m_luminous;
313 const static int m_headTailLength = 300; // magic number 300 ns from Run 2 tool
314
316 bunchTrain_t(bcid_type first, bcid_type last, unsigned ncoll) :
317 m_first(first),m_last(last),m_nColl(ncoll) {};
318 int m_first{};
319 int m_last{};
320 unsigned m_nColl{};
321 };
322
323 std::vector<bunchTrain_t> m_trains;
324
325 unsigned m_nTrains{}; //might be one less than the size of m_trains
326
328 const bunchTrain_t* findTrain(const bcid_type bcid) const;
329
331 unsigned countColliding(int from, int to) const;
332
333};
334
335CLASS_DEF (BunchCrossingCondData, 158463439, 0)
337
338inline
340 if (ATH_UNLIKELY(bcid>=m_MAX_BCID)) return false;
341 return m_luminous.test(bcid);
342}
343
344inline
346 if (ATH_UNLIKELY(bcid>=m_MAX_BCID)) return false;
347 return m_beam1.test(bcid);
348}
349
350inline
352 if (ATH_UNLIKELY(bcid>=m_MAX_BCID)) return false;
353 return m_beam2.test(bcid);
354}
355
356
357inline
359 if (ATH_UNLIKELY(bcid>=m_MAX_BCID)) return false;
360 return ((m_beam1.test(bcid) || m_beam2.test(bcid)) && !m_luminous.test(bcid));
361
362}
363
364inline
366 return m_luminous.count();
367}
368
369
370inline
372 return m_trains.size();
373}
374
375inline
377 return (findTrain(bcid) != nullptr);
378}
379
380#endif // not COOLLUMIUTILITIES_FILLPARAMSCONDDATA_H
#define ATH_UNLIKELY(x)
Hold mappings of ranges to condition objects.
#define CONDCONT_MIXED_DEF(...)
Definition CondCont.h:1446
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
std::pair< unsigned, unsigned > bunchTrainPopulation(const bcid_type bcid) const
Get colliding and total bcids in a train.
std::vector< bunchTrain_t > m_trains
int distanceFromFront(const bcid_type bcid, const BunchDistanceType type=NanoSec) const
The distance of the specific bunch crossing from the front of the train.
static constexpr int m_BUNCH_SPACING
bool isBeam1(const bcid_type bcid) const
Function deciding if there was a bunch from "beam 1" in this bunch crossing.
const bunchTrain_t * findTrain(const bcid_type bcid) const
Helper method to find the train of a bcid (nullptr if bcd is not in a train)
std::bitset< m_MAX_BCID > m_beam1
BunchDistanceType
Enumeration specifying the units in which to expect the bunch distance type.
@ BunchCrossings
Distance in units of 25 nanoseconds.
@ FilledBunches
Distance in units of filled bunches (depends on filling scheme)
@ NanoSec
Distance in nanoseconds.
static constexpr int m_MAX_BCID
BunchCrossingType bcType(const bcid_type bcid) const
Convenience function for the type of the specific bunch crossing.
unsigned int numberOfUnpairedBunches() const
Get the number of unpaired bunches in the current configuration.
bool isBeam2(const bcid_type bcid) const
Function deciding if there was a bunch from "beam 2" in this bunch crossing.
bool isInTrain(const bcid_type bcid) const
Function deciding if a given bunch crossing is in a filled train.
std::bitset< m_MAX_BCID > m_luminous
unsigned int numberOfFilledBunches() const
Gap before the train this BCID is in.
int distanceFromTail(const bcid_type bcid, const BunchDistanceType type=NanoSec) const
The distance of the specific bunch crossing from the tail of the train.
int gapBeforeBunch(bcid_type bcid=0, BunchDistanceType type=NanoSec) const
Get the distance of the specified bunch crossing to the preceeding filled bunch.
bool isFilled(const bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
std::bitset< m_MAX_BCID > m_beam2
unsigned int numberOfBunchTrains() const
Get the number of the bunch trains in the current configuration.
int gapAfterBunch(bcid_type bcid=0, BunchDistanceType type=NanoSec) const
Get the distance of the specified bunch crossing to the next filled bunch.
bool isUnpaired(const bcid_type bcid) const
Function deciding if a given bunch crossing has an unpaired bunch.
int gapBeforeTrain(bcid_type bcid=0, BunchDistanceType type=NanoSec) const
Gap before the train this BCID is in.
unsigned countColliding(int from, int to) const
Helper method to count colliding bunches in the range from-to.
int gapAfterTrain(bcid_type bcid=0, BunchDistanceType type=NanoSec) const
Gap after the train this BCID is in.
BunchCrossingType
Enumeration type for a given bunch crossing.
@ Unpaired
This is an unpaired bunch (either beam1 or beam2)
@ FirstEmpty
The first empty bunch after a train.
@ Single
This is a filled, single bunch (not in a train)
@ Front
The BCID belongs to the first few bunches in a train.
@ Middle
The BCID belongs to the middle bunches in a train.
@ Empty
An empty bunch far away from filled bunches.
@ Tail
The BCID belongs to the last few bunces in a train.
@ MiddleEmpty
An empty BCID in the middle of a train.
static const int m_headTailLength
unsigned m_nColl
Last BCID of this train.
bunchTrain_t(bcid_type first, bcid_type last, unsigned ncoll)