ATLAS Offline Software
Typedefs | Functions
CaloExtensionHelpers Namespace Reference

Typedefs

typedef std::vector< std::pair< bool, Amg::Vector3D > > MidPointsHashLookupVector
 
typedef std::vector< std::tuple< CaloSampling::CaloSample, Amg::Vector3D, Amg::Vector3D > > EntryExitPerLayerVector
 
typedef std::map< CaloSampling::CaloSample, std::pair< Amg::Vector3D, Amg::Vector3D > > EntryExitLayerMap
 
typedef std::map< CaloSampling::CaloSample, double > ScalarLayerMap
 
typedef std::vector< std::tuple< bool, double, double > > EtaPhiHashLookupVector
 
typedef std::vector< std::tuple< CaloSampling::CaloSample, double, double > > EtaPhiPerLayerVector
 
typedef std::set< CaloSampling::CaloSampleLayersToSelect
 

Functions

template<class T , class O >
void entryExitProcessor (const Trk::CaloExtension &extension, T &result, O oper, const LayersToSelect *selection=nullptr)
 the header provides a set of helper functions to extract per layer information from the CaloExtension More...
 
void midPointsHashLookupVector (const Trk::CaloExtension &extension, MidPointsHashLookupVector &result)
 
void entryExitPerLayerVector (const Trk::CaloExtension &extension, EntryExitPerLayerVector &result, const LayersToSelect *selection=nullptr)
 
void entryExitLayerMap (const Trk::CaloExtension &extension, EntryExitLayerMap &result, const LayersToSelect *selection=nullptr)
 
void pathLenLayerMap (const Trk::CaloExtension &extension, ScalarLayerMap &result)
 
void eLossLayerMap (const Trk::CaloExtension &extension, ScalarLayerMap &result)
 
void entryEtaPhiHashLookupVector (const Trk::CaloExtension &extension, EtaPhiHashLookupVector &result)
 
void entryEtaPhiPerLayerVector (const Trk::CaloExtension &extension, EtaPhiPerLayerVector &result, const LayersToSelect *selection=nullptr)
 
void midPointEtaPhiHashLookupVector (const Trk::CaloExtension &extension, EtaPhiHashLookupVector &result)
 
void midPointEtaPhiPerLayerVector (const Trk::CaloExtension &extension, EtaPhiPerLayerVector &result, const LayersToSelect *selection=nullptr)
 

Typedef Documentation

◆ EntryExitLayerMap

Definition at line 21 of file CaloExtensionHelpers.h.

◆ EntryExitPerLayerVector

Definition at line 20 of file CaloExtensionHelpers.h.

◆ EtaPhiHashLookupVector

typedef std::vector< std::tuple<bool, double, double> > CaloExtensionHelpers::EtaPhiHashLookupVector

Definition at line 24 of file CaloExtensionHelpers.h.

◆ EtaPhiPerLayerVector

typedef std::vector< std::tuple<CaloSampling::CaloSample, double, double> > CaloExtensionHelpers::EtaPhiPerLayerVector

Definition at line 25 of file CaloExtensionHelpers.h.

◆ LayersToSelect

Definition at line 27 of file CaloExtensionHelpers.h.

◆ MidPointsHashLookupVector

typedef std::vector< std::pair<bool,Amg::Vector3D> > CaloExtensionHelpers::MidPointsHashLookupVector

Definition at line 19 of file CaloExtensionHelpers.h.

◆ ScalarLayerMap

Definition at line 22 of file CaloExtensionHelpers.h.

Function Documentation

◆ eLossLayerMap()

void CaloExtensionHelpers::eLossLayerMap ( const Trk::CaloExtension extension,
ScalarLayerMap result 
)
inline

Definition at line 216 of file CaloExtensionHelpers.h.

216  {
217  struct Extractor {
218  Trk::TrackParametersIdHelper parsIdHelper;
219  void operator()(ScalarLayerMap& thisResult, const Trk::CurvilinearParameters& entry,const Trk::CurvilinearParameters& exit ){
220  thisResult[ parsIdHelper.caloSample(entry.cIdentifier()) ] = fabs(entry.momentum().mag()-exit.momentum().mag());
221  }
222  } extract;
223  result.clear();
224  entryExitProcessor(extension,result,extract);
225  }

◆ entryEtaPhiHashLookupVector()

void CaloExtensionHelpers::entryEtaPhiHashLookupVector ( const Trk::CaloExtension extension,
EtaPhiHashLookupVector result 
)
inline

Definition at line 227 of file CaloExtensionHelpers.h.

227  {
228  struct Extractor {
229  Trk::TrackParametersIdHelper parsIdHelper;
231  auto& val = vec[parsIdHelper.caloSample(entry.cIdentifier())];
232  std::get<0>(val) = true;
233  std::get<1>(val) = entry.position().eta();
234  std::get<2>(val) = entry.position().phi();
235  }
236  } extract;
237  result.clear();
238  result.resize(CaloSampling::getNumberOfSamplings(),std::make_tuple(false,0.,0.));
239  entryExitProcessor(extension,result,extract);
240  }

◆ entryEtaPhiPerLayerVector()

void CaloExtensionHelpers::entryEtaPhiPerLayerVector ( const Trk::CaloExtension extension,
EtaPhiPerLayerVector result,
const LayersToSelect selection = nullptr 
)
inline

Definition at line 242 of file CaloExtensionHelpers.h.

244  {
245  struct Extractor {
246  Trk::TrackParametersIdHelper parsIdHelper;
248  vec.push_back( std::make_tuple(parsIdHelper.caloSample(entry.cIdentifier()),entry.position().eta(),entry.position().phi()) );
249  }
250  } extract;
251  result.clear();
252  result.reserve(extension.caloLayerIntersections().size());
254  }

◆ entryExitLayerMap()

void CaloExtensionHelpers::entryExitLayerMap ( const Trk::CaloExtension extension,
EntryExitLayerMap result,
const LayersToSelect selection = nullptr 
)
inline

Definition at line 192 of file CaloExtensionHelpers.h.

194  {
195  struct Extractor {
196  Trk::TrackParametersIdHelper parsIdHelper;
197  void operator()(EntryExitLayerMap& thisResult, const Trk::CurvilinearParameters& entry,const Trk::CurvilinearParameters& exit ){
198  thisResult[ parsIdHelper.caloSample(entry.cIdentifier()) ] = std::make_pair(entry.position(),exit.position());
199  }
200  } extract;
201  result.clear();
203  }

◆ entryExitPerLayerVector()

void CaloExtensionHelpers::entryExitPerLayerVector ( const Trk::CaloExtension extension,
EntryExitPerLayerVector result,
const LayersToSelect selection = nullptr 
)
inline

Definition at line 178 of file CaloExtensionHelpers.h.

180  {
181  struct Extractor {
182  Trk::TrackParametersIdHelper parsIdHelper;
184  vec.push_back( std::make_tuple(parsIdHelper.caloSample(entry.cIdentifier()),entry.position(),exit.position()) );
185  }
186  } extract;
187  result.clear();
188  result.reserve(extension.caloLayerIntersections().size());
190  }

◆ entryExitProcessor()

template<class T , class O >
void CaloExtensionHelpers::entryExitProcessor ( const Trk::CaloExtension extension,
T &  result,
oper,
const LayersToSelect selection = nullptr 
)
inline

the header provides a set of helper functions to extract per layer information from the CaloExtension

All functions with HashLookup in the name return a vector that has a length equal to the maximum number of samplings, the first entry in the pair/tuple is a boolean indicating that the layer was crossed

If the vector contains a tuple use std::get<0>(entry),std::get<1>(entry), std::get<2>(entry) to get the elements

  void midPointsHashLookupVector( const Trk::CaloExtension& extension, MidPointsHashLookupVector& result )

  - fills a vector with the mid-points in the layers. 
    usage:

    CaloExtensionHelpers::MidPointsHashLookupVector result;
    CaloExtensionHelpers::midPointsHashLookupVector(extension,result);

check if layer was crossed bool isCrossed; const Amg::Vector3D& position; std::tie(isCrossed, position) = result[CaloSampling::theSample] if( isCrossed ){ std::cout << " radius " << position.perp() << std::endl; }

  void entryExitPerLayerVector( const Trk::CaloExtension& extension, EntryExitPerLayerVector& result, const LayersToSelect* selection = nullptr )

  - fills a vector with a tuple for every crossed layer. The first element is in the tuple is the Sampling enum,
    the second the entry position, the third the exit position
    usage: 

    CaloExtensionHelpers::EntryExitPerLayerVector result;
    CaloExtensionHelpers::entryExitPerLayerVector( extension, result );
    std::cout << " number of crossed layers " << result.size() << std::endl;


  void entryExitLayerMap( const Trk::CaloExtension& extension, EntryExitLayerMap& result, const LayersToSelect* selection = nullptr )

  - fills a map with the CaloSampling as key and a pair of entry/exit positions as content

    EntryExitLayerMap result;
    entryExitPerLayerVector( extension,result );
    auto pos = result.find(CaloSampling::theSample);
    if( pos != result.end() ){
      std::cout << " radius entry " << pos.second.first.perp() << std::endl;
    }


  void entryEtaPhiHashLookupVector( const Trk::CaloExtension& extension, EtaPhiHashLookupVector& result )

  - fills a vector with the eta-phi positions of the entry point in the layers. 
    usage:

    CaloExtensionHelpers::EtaPhiHashLookupVector result;
    CaloExtensionHelpers::entryEtaPhiHashLookupVector( extension, result );
    bool isCrossed; double eta,phi;
    std::tie(isCrossed, eta, phi) = result[CaloSampling::theSample]

check if layer was crossed if( isCrossed ){ std::cout << " eta " << eta << " phi " << phi << std::endl; }

  void entryEtaPhiPerLayerVector( const Trk::CaloExtension& extension, EtaPhiPerLayerVector& result, const LayersToSelect* selection = nullptr )

  - fills  a vector with a tuple for every crossed layer. The first element is in the tuple is the Sampling enum,
    the second the entry position, the third the exit position
    usage: 

    CaloExtensionHelpers::EtaPhiPerLayerVector result;
    CaloExtensionHelpers::entryEtaPhiPerLayerVector( extension, result );
    std::cout << " number of crossed layers " << result.size() << std::endl;



  void midPointEtaPhiHashLookupVector( const Trk::CaloExtension& extension, EtaPhiHashLookupVector& result ) 

  - fills a vector with the eta-phi positions of the mid point point in the layers. 
    usage:

    CaloExtensionHelpers::EtaPhiHashLookupVector result;
    CaloExtensionHelpers::midPointEtaPhiHashLookupVector( extension, result );
    bool isCrossed; double eta,phi;
    std::tie(isCrossed, eta, phi) = result[CaloSampling::theSample]

check if layer was crossed if( isCrossed ){ std::cout << " eta " << eta << " phi " << phi << std::endl; }

  void midPointEtaPhiPerLayerVector( const Trk::CaloExtension& extension, EtaPhiPerLayerVector& result, const LayersToSelect* selection = nullptr ) 

  - fills  a vector with a tuple for every crossed layer. The first element is in the tuple is the Sampling enum,
    the second the entry position, the third the exit position
    usage: 

    CaloExtensionHelpers::EtaPhiPerLayerVector result;
    CaloExtensionHelpers::midPointEtaPhiPerLayerVector( extension, result );
    std::cout << " number of crossed layers " << result.size() << std::endl;


  if you need something else, have a look at the functions below, you can easily create your own...

Definition at line 137 of file CaloExtensionHelpers.h.

139  {
140 
141  Trk::TrackParametersIdHelper parsIdHelper;
142  // loop over calo layers, keep track of previous layer
143  auto cur = extension.caloLayerIntersections().begin();
144  auto prev = cur;
145  for( ; cur != extension.caloLayerIntersections().end() ; ++cur ){
146  // check that prev and cur are not the same, if not fill if the previous was an entry layer
147  if( prev != cur && parsIdHelper.isEntryToVolume((*prev).cIdentifier()) ) {
148 
149  // apply selection
150  if( !selection || selection->count(parsIdHelper.caloSample((*prev).cIdentifier())) ){
151  oper(result,*prev,*cur);
152  }
153  }
154  prev=cur;
155  }
156  }

◆ midPointEtaPhiHashLookupVector()

void CaloExtensionHelpers::midPointEtaPhiHashLookupVector ( const Trk::CaloExtension extension,
EtaPhiHashLookupVector result 
)
inline

Definition at line 256 of file CaloExtensionHelpers.h.

256  {
257  struct Extractor {
258  Trk::TrackParametersIdHelper parsIdHelper;
260  auto& val = vec[parsIdHelper.caloSample(entry.cIdentifier())];
261  Amg::Vector3D pos = 0.5*( exit.position() + entry.position() );
262  std::get<0>(val) = true;
263  std::get<1>(val) = pos.eta();
264  std::get<2>(val) = pos.phi();
265  //std::cout << " adding sampling " << parsIdHelper.caloSample(entry.cIdentifier()) << " eta " << std::get<1>(val) << " phi " << std::get<2>(val) << std::endl;
266  }
267  } extract;
268  result.clear();
269  result.resize(CaloSampling::getNumberOfSamplings(),std::make_tuple(false,0.,0.));
270  entryExitProcessor(extension,result,extract);
271  }

◆ midPointEtaPhiPerLayerVector()

void CaloExtensionHelpers::midPointEtaPhiPerLayerVector ( const Trk::CaloExtension extension,
EtaPhiPerLayerVector result,
const LayersToSelect selection = nullptr 
)
inline

Definition at line 273 of file CaloExtensionHelpers.h.

275  {
276  struct Extractor {
277  Trk::TrackParametersIdHelper parsIdHelper;
279  Amg::Vector3D pos = 0.5*( exit.position() + entry.position() );
280  vec.push_back( std::make_tuple(parsIdHelper.caloSample(entry.cIdentifier()),pos.eta(),pos.phi()) );
281  }
282  } extract;
283  result.clear();
284  result.reserve(extension.caloLayerIntersections().size());
286  }

◆ midPointsHashLookupVector()

void CaloExtensionHelpers::midPointsHashLookupVector ( const Trk::CaloExtension extension,
MidPointsHashLookupVector result 
)
inline

Definition at line 159 of file CaloExtensionHelpers.h.

159  {
160 
161  // create output vector
162  struct Extractor {
163  Trk::TrackParametersIdHelper parsIdHelper;
164  void operator()(MidPointsHashLookupVector& vec,
166  auto& val = vec[parsIdHelper.caloSample(entry.cIdentifier())];
167  val.first = true;
168  val.second = 0.5*( exit.position() + entry.position() );
169  //std::cout << " adding mid point, sampling " << parsIdHelper.caloSample(entry.cIdentifier()) << std::endl;
170  }
171  } extract;
172  result.clear();
173  result.resize(CaloSampling::getNumberOfSamplings(),std::make_pair(false,Amg::Vector3D()));
174  entryExitProcessor(extension,result,extract);
175  }

◆ pathLenLayerMap()

void CaloExtensionHelpers::pathLenLayerMap ( const Trk::CaloExtension extension,
ScalarLayerMap result 
)
inline

Definition at line 205 of file CaloExtensionHelpers.h.

205  {
206  struct Extractor {
207  Trk::TrackParametersIdHelper parsIdHelper;
208  void operator()(ScalarLayerMap& thisResult, const Trk::CurvilinearParameters& entry,const Trk::CurvilinearParameters& exit ){
209  thisResult[ parsIdHelper.caloSample(entry.cIdentifier()) ] = (entry.position()-exit.position()).mag();
210  }
211  } extract;
212  result.clear();
213  entryExitProcessor(extension,result,extract);
214  }
get_generator_info.result
result
Definition: get_generator_info.py:21
CaloExtensionHelpers::ScalarLayerMap
std::map< CaloSampling::CaloSample, double > ScalarLayerMap
Definition: CaloExtensionHelpers.h:22
CaloExtensionHelpers::MidPointsHashLookupVector
std::vector< std::pair< bool, Amg::Vector3D > > MidPointsHashLookupVector
Definition: CaloExtensionHelpers.h:19
beamspotman.cur
def cur
Definition: beamspotman.py:671
Trk::TrackParametersIdHelper::caloSample
CaloSampling::CaloSample caloSample(TrackParametersIdentifier id) const
CaloSample encoded in id, returns CaloSampling::Unknown if id is not valid
Definition: TrackParametersIdHelper.h:91
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
Trk::TrackParametersIdHelper::isEntryToVolume
bool isEntryToVolume(TrackParametersIdentifier id) const
returns true if the id belongs to the volume entrance
Definition: TrackParametersIdHelper.h:81
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Trk::TrackParametersIdHelper
helper class to encode and decode a TrackParametersIdentifier
Definition: TrackParametersIdHelper.h:18
CaloExtensionHelpers::EtaPhiHashLookupVector
std::vector< std::tuple< bool, double, double > > EtaPhiHashLookupVector
Definition: CaloExtensionHelpers.h:24
CaloExtensionHelpers::EtaPhiPerLayerVector
std::vector< std::tuple< CaloSampling::CaloSample, double, double > > EtaPhiPerLayerVector
Definition: CaloExtensionHelpers.h:25
Trk::CurvilinearParametersT
Definition: CurvilinearParametersT.h:48
CaloExtensionHelpers::EntryExitPerLayerVector
std::vector< std::tuple< CaloSampling::CaloSample, Amg::Vector3D, Amg::Vector3D > > EntryExitPerLayerVector
Definition: CaloExtensionHelpers.h:20
CaloExtensionHelpers::EntryExitLayerMap
std::map< CaloSampling::CaloSample, std::pair< Amg::Vector3D, Amg::Vector3D > > EntryExitLayerMap
Definition: CaloExtensionHelpers.h:21
selection
std::string selection
Definition: fbtTestBasics.cxx:73
calibdata.exit
exit
Definition: calibdata.py:236
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
CaloSampling::getNumberOfSamplings
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:30
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
Trk::CaloExtension::caloLayerIntersections
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
Definition: CaloExtension.h:76
CaloExtensionHelpers::entryExitProcessor
void entryExitProcessor(const Trk::CaloExtension &extension, T &result, O oper, const LayersToSelect *selection=nullptr)
the header provides a set of helper functions to extract per layer information from the CaloExtension
Definition: CaloExtensionHelpers.h:137
tools.zlumi_alleff.extract
def extract(histogram, bin1, bin2)
Definition: zlumi_alleff.py:272
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25