AliPhysics  9b6b435 (9b6b435)
AliEmcalContainerUtils Class Reference

Helper functions related to AliEmcalContainer derived objects. More...

#include <AliEmcalContainerUtils.h>

Public Types

enum  InputObject_t { kNoDefinedInputObject = -1, kCaloCells = 0, kCluster = 1, kTrack = 2 }
 Type of input object to be created More...
 

Static Public Member Functions

static UInt_t DeterminePhysicsSelectionFromYAML (const std::vector< std::string > &selections)
 
static std::string DetermineUseDefaultName (InputObject_t objType)
 
static std::string DetermineUseDefaultName (InputObject_t objType, bool esdMode, bool returnObjectType=false)
 
static const AliVEvent * GetEvent (const AliVEvent *inputEvent, bool isEmbedding=false)
 
static AliVEvent * GetEvent (AliVEvent *inputEvent, bool isEmbedding=false)
 
template<class T >
static TAddContainer (const char *n, TObjArray &collection)
 
template<class T >
static TGetContainer (Int_t i, const TObjArray &collection)
 
template<class T >
static TGetContainer (const char *name, const TObjArray &collection)
 

Static Public Attributes

static const std::map< std::string, AliVEvent::EOfflineTriggerTypes > fgkPhysicsSelectionMap
 Relates string to the physics selection enumeration for YAML configuration. More...
 

Detailed Description

Helper functions related to AliEmcalContainer derived objects.

This namespace includes a variety of helper functions related to AliEmcalContainer derived objects, as well as configuring input objects.

Functions include:

  • Automatically determine the proper input object branch name based on the input object and file (AOD or ESD) types. This is determined by the "usedefault" pattern (see the code for precise implementation). It can also return the proper type input object to be stored in a collection such as a TClonesArray.
  • Centralizing the code to add and get containers from the collections of containers often stored in analysis tasks.

Usage of the add, and get containers code should be something like (for cluster containers):

AliClusterContainer * AddClusterContainer(const char * name) { AddContainer<AliClusterContainer>(name, fClusterCollArray); }
AliClusterContainer * GetClusterContainer(Int_t i) { GetContainer<AliClusterContainer>(i, fClusterCollArray); }
AliClusterContainer * GetClusterContainer(const char * name) { GetContainer<AliClusterContainer>(name, fClusterCollArray); }

The code is similar for other containers. See AliEmcalCorrectionTask for an example.

Author
Raymond Ehlers raymo.nosp@m.nd.e.nosp@m.hlers.nosp@m.@cer.nosp@m.n.ch, Yale University
Date
Dec 6, 2016

Definition at line 39 of file AliEmcalContainerUtils.h.

Member Enumeration Documentation

Type of input object to be created

Enumerator
kNoDefinedInputObject 

! Not initialized type

kCaloCells 

! Calo cells

kCluster 

! Cluster container

kTrack 

! Track container

Definition at line 45 of file AliEmcalContainerUtils.h.

Member Function Documentation

template<class T >
T * AliEmcalContainerUtils::AddContainer ( const char *  n,
TObjArray collection 
)
inlinestatic

Create new container and attach it to the passed collection. The name provided to this function must match the name of the array attached to the new container inside the input event.

Parameters
[in]nName of the container and the array the container points to
[in]collectionCollection into which the new container will be added
Returns
Pointer to the new container

Definition at line 90 of file AliEmcalContainerUtils.h.

UInt_t AliEmcalContainerUtils::DeterminePhysicsSelectionFromYAML ( const std::vector< std::string > &  selections)
static

Determines the physics selection that is retrieved from a YAML configuration. Note that the result is an OR of all of the individual selections in the input.

Returns
The desired trigger selection. Note that a UInt_t is what is used for fOfflineTriggerMask, so it's fine to return it here.

Definition at line 77 of file AliEmcalContainerUtils.cxx.

Referenced by PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance::RetrieveAndSetTaskPropertiesFromYAMLConfig(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations::RetrieveAndSetTaskPropertiesFromYAMLConfig(), and AliAnalysisTaskEmcalEmbeddingHelper::RetrieveTaskPropertiesFromYAMLConfig().

std::string AliEmcalContainerUtils::DetermineUseDefaultName ( InputObject_t  objType)
static

Determines the "usedefault" pattern using the Analysis Manager to determine the datatype automatically. This will often work fine, but it may not always. Note that the use cause for this function is assumed to be solely about returning the "usedefault" collection name and not the object type.

Parameters
[in]objTypeType of the input object
Returns
The name corresponding to the request branch name.

Definition at line 95 of file AliEmcalContainerUtils.cxx.

Referenced by AliEmcalCorrectionTask::AddContainer(), AliEmcalCorrectionTask::CheckForContainerArray(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations::ConfigureForEmbeddingAnalysis(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations::ConfigureForStandardAnalysis(), AliEmcalCopyCollection::CreateNewObjectBranch(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations::CreateParticleOrTrackContainer(), AliEmcalCorrectionCellCombineCollections::Initialize(), AliEmcalCopyCollection::NewBranch(), PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations::RetrieveAndInitializeJESCorrectionHist(), and AliEmcalCorrectionTask::SetupCellsInfo().

std::string AliEmcalContainerUtils::DetermineUseDefaultName ( InputObject_t  objType,
bool  esdMode,
bool  returnObjectType = false 
)
static

Given a container type, it returns the proper default branch name based on the "usedefault" pattern. This is useful to properly handle creating input objects such as AliEmcalContainer derived objects. If returnObjectType is true, it returns the "default" (unlikely to change) object type instead of the branch name. This is useful to properly determine the type of an object for a TClonesArray.

This function can also be very useful in places such as an AddTask(). Using it can significantly reduce code duplication!

Parameters
[in]objTypeType of the input object
[in]esdModeTrue if running with an ESD
[in]returnObjectTypeReturns the "default" type of the object rather than the branch name
Returns
The name corresponding to the request branch name or object type.

Definition at line 148 of file AliEmcalContainerUtils.cxx.

template<class T >
T * AliEmcalContainerUtils::GetContainer ( Int_t  i,
const TObjArray collection 
)
inlinestatic

Get \( i^{th} \) container contained in the collection

Parameters
[in]iIndex of the container
[in]collectionCollection which stores available containers
Returns
Container found for the given index (NULL if no container exists for that index)

Definition at line 108 of file AliEmcalContainerUtils.h.

template<class T >
T * AliEmcalContainerUtils::GetContainer ( const char *  name,
const TObjArray collection 
)
inlinestatic

Find container container in the collection according to its name

Parameters
[in]nameName of the container
[in]collectionCollection which stores available containers
Returns
Container found under the given name

Definition at line 122 of file AliEmcalContainerUtils.h.

const AliVEvent * AliEmcalContainerUtils::GetEvent ( const AliVEvent *  inputEvent,
bool  isEmbedding = false 
)
static

Get the proper event based on whether embedding is enabled or not. Useful when determining from which event an input object should be retrieved. It could either be the current input event or an embedded event. This is the const version.

Parameters
[in]inputEventThe input event of the analysis. Will be returned if nothing else is requested. Usually just InputEvent().
[in]isEmbeddingTrue if the event from embedding should be used.
Returns
The input event to be used

Definition at line 224 of file AliEmcalContainerUtils.cxx.

Referenced by AliEmcalCorrectionTask::CheckForContainerArray(), AliEmcalCopyCollection::CreateNewObjectBranch(), AliAnalysisTaskJetExtractor::ExecOnce(), GetEvent(), AliEmcalCorrectionEventManager::InputEvent(), AliEmcalContainer::NextEvent(), AliEmcalContainer::SetArray(), and AliEmcalCorrectionTask::SetCellsObjectInCellContainerBasedOnProperties().

AliVEvent * AliEmcalContainerUtils::GetEvent ( AliVEvent *  inputEvent,
bool  isEmbedding = false 
)
static

Get the proper event based on whether embedding is enabled or not. Useful when determining from which event an input object should be retrieved. It could either be the current input event or an embedded event. This is the non-const version.

Parameters
[in]inputEventThe input event of the analysis. Will be returned if nothing else is requested. Usually just InputEvent().
[in]isEmbeddingTrue if the event from embedding should be used.
Returns
The input event to be used

Definition at line 251 of file AliEmcalContainerUtils.cxx.

Member Data Documentation

const std::map< std::string, AliVEvent::EOfflineTriggerTypes > AliEmcalContainerUtils::fgkPhysicsSelectionMap
static

Relates string to the physics selection enumeration for YAML configuration.

!

Definition at line 54 of file AliEmcalContainerUtils.h.

Referenced by DeterminePhysicsSelectionFromYAML().


The documentation for this class was generated from the following files: