ATLAS Offline Software
Loading...
Searching...
No Matches
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
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

◆ EntryExitPerLayerVector

◆ 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

◆ 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 }
helper class to encode and decode a TrackParametersIdentifier
CaloSampling::CaloSample caloSample(TrackParametersIdentifier id) const
CaloSample encoded in id, returns CaloSampling::Unknown if id is not valid.
std::map< CaloSampling::CaloSample, double > ScalarLayerMap
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
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
extract(histogram, bin1, bin2)

◆ 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 }
std::vector< size_t > vec
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
std::vector< std::tuple< bool, double, double > > EtaPhiHashLookupVector

◆ 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());
253 entryExitProcessor(extension,result,extract,selection);
254 }
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
const std::string selection
std::vector< std::tuple< CaloSampling::CaloSample, double, double > > EtaPhiPerLayerVector

◆ 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();
202 entryExitProcessor(extension,result,extract,selection);
203 }
std::map< CaloSampling::CaloSample, std::pair< Amg::Vector3D, Amg::Vector3D > > EntryExitLayerMap

◆ 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;
183 void operator()(EntryExitPerLayerVector& vec, const Trk::CurvilinearParameters& entry,const Trk::CurvilinearParameters& exit ){
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());
189 entryExitProcessor(extension,result,extract,selection);
190 }
std::vector< std::tuple< CaloSampling::CaloSample, Amg::Vector3D, Amg::Vector3D > > EntryExitPerLayerVector

◆ entryExitProcessor()

template<class T, class O>
void CaloExtensionHelpers::entryExitProcessor ( const Trk::CaloExtension & extension,
T & result,
O 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 }
bool isEntryToVolume(TrackParametersIdentifier id) const
returns true if the id belongs to the volume entrance

◆ 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;
259 void operator()(EtaPhiHashLookupVector& vec, const Trk::CurvilinearParameters& entry,const Trk::CurvilinearParameters& exit ){
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 }
Eigen::Matrix< double, 3, 1 > Vector3D

◆ 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;
278 void operator()(EtaPhiPerLayerVector& vec, const Trk::CurvilinearParameters& entry,const Trk::CurvilinearParameters& exit ){
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());
285 entryExitProcessor(extension,result,extract,selection);
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 }
std::vector< std::pair< bool, Amg::Vector3D > > MidPointsHashLookupVector

◆ 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 }