18 #include <TClonesArray.h>
20 #include "AliVEvent.h"
22 #include "AliTLorentzVector.h"
38 fDefaultClusterEnergy(-1)
40 fClassName =
"AliVCluster";
42 for (Int_t i = 0; i <= AliVCluster::kLastUserDefEnergy; i++) {
43 fUserDefEnergyCut[i] = 0.;
56 fDefaultClusterEnergy(-1)
60 for (Int_t i = 0; i <= AliVCluster::kLastUserDefEnergy; i++) {
79 AliVCluster *cluster = 0;
81 if (option.Contains(
"e")) {
83 if (cluster->E() > clusterMax->E()) clusterMax = cluster;
91 cluster->GetMomentum(mom,const_cast<Double_t*>(
fVertex));
112 if(i<0 || i>
fClArray->GetEntriesFast())
return 0;
113 AliVCluster *vp =
static_cast<AliVCluster*
>(
fClArray->At(i));
128 UInt_t rejectionReason = 0;
132 AliDebug(2,
"Cluster not accepted.");
195 if (mass < 0) mass = 0;
206 Double_t p = TMath::Sqrt(energy*energy - mass*mass);
209 vc->GetPosition(pos);
215 Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]) ;
218 mom.SetPxPyPzE( p*pos[0]/r, p*pos[1]/r, p*pos[2]/r, energy) ;
221 AliInfo(
"Null cluster radius, momentum calculation not possible");
241 mom.SetPtEtaPhiM(0, 0, 0, 0.139);
296 if (!r)
return kFALSE;
298 AliTLorentzVector mom;
307 if (!r)
return kFALSE;
309 AliTLorentzVector mom;
327 if (!clus->IsEMCAL()) {
357 for (Int_t i = 0; i <= AliVCluster::kLastUserDefEnergy; i++) {
373 UInt_t rejectionReason = 0;
375 for(
int iclust = 0; iclust < this->
fClArray->GetEntries(); ++iclust){
376 AliVCluster *clust = this->
GetCluster(iclust);
384 if (t >= 0 && t <= AliVCluster::kLastUserDefEnergy){
394 if (t >= 0 && t <= AliVCluster::kLastUserDefEnergy){
410 if (cls.InheritsFrom(
"AliVCluster"))
fClassName = clname;
411 else AliError(Form(
"Unable to set class name %s for a AliClusterContainer, it must inherits from AliVCluster!",clname));
416 static TString clusterString;
423 else if (Ecut < 1.0) {
424 clusterString = TString::Format(
"%s_E0%3.0f",
GetArrayName().
Data(), Ecut*1000.0);
427 clusterString = TString::Format(
"%s_E%4.0f",
GetArrayName().
Data(), Ecut*1000.0);
430 return clusterString.Data();
537 UInt_t rejection = 0;
552 fkContainer(other.fkContainer),
553 fAcceptIndices(other.fAcceptIndices),
554 fCurrentPos(other.fCurrentPos),
555 fForward(other.fForward)
643 if(fCurrentPos < 0 || fCurrentPos >= fAcceptIndices.GetSize()){
646 return fkContainer->GetCluster(fAcceptIndices[fCurrentPos]);
673 fCurrentPos(startpos),
684 fkContainer(other.fkContainer),
685 fCurrentPos(other.fCurrentPos),
686 fForward(other.fForward)
773 if(fCurrentPos >= 0 && fCurrentPos < fkContainer->
GetNClusters())
774 return fkContainer->GetCluster(fCurrentPos);
783 std::vector<AliVCluster *> reference, variation;
784 AliVCluster *test = NULL;
785 for(
int iclust = 0; iclust < cont->
GetNClusters(); iclust++){
788 UInt_t rejectionReason = 0;
791 reference.push_back(test);
797 variation.push_back(*iter);
802 variation.push_back(*iter);
808 if(reference.size() < 30){
809 std::cout <<
"Clusters in reference container: " << std::endl;
810 std::cout <<
"===========================================" << std::endl;
811 for(std::vector<AliVCluster *>::iterator refit = reference.begin(); refit != reference.end(); ++refit){
812 std::cout <<
"Address: " << *refit << std::endl;
815 if(variation.size() < 30){
816 std::cout <<
"Clusters in test container: " << std::endl;
817 std::cout <<
"===========================================" << std::endl;
818 for(std::vector<AliVCluster *>::iterator varit = variation.begin(); varit != variation.end(); ++varit){
819 std::cout <<
"Address: " << *varit << std::endl;
826 bool failure =
false;
828 for(std::vector<AliVCluster *>::iterator clit = reference.begin(); clit != reference.end(); ++clit){
829 if(std::find(variation.begin(), variation.end(), *clit) == variation.end()) {
831 std::cout <<
"Could not find cluster with address " << *clit <<
" in test container" << std::endl;
838 for(std::vector<AliVCluster *>::iterator clit = variation.begin(); clit != variation.end(); ++clit){
839 if(std::find(reference.begin(), reference.end(), *clit) == reference.end()) {
841 std::cout <<
"Could not find cluster with address " << *clit <<
" in reference container" << std::endl;
846 if(failure) testresult = 2;
852 std::cout <<
"Unit test cluster container, iterator type " << iteratorType << std::endl;
853 std::cout <<
"Number of expected clusters: " << reference.size() <<
", number of found clusters: " << variation.size() << std::endl;
854 std::cout <<
"Test result: " << testresult << std::endl;
855 std::cout <<
"-----------------------------------------------------------------------" << std::endl;
AliVCluster * GetAcceptClusterWithLabel(Int_t lab) const
bool fForward
Direction, expressed in forward direction.
bool fForward
Direction, expressed in forward direction.
virtual Bool_t ApplyClusterCuts(const AliVCluster *clus, UInt_t &rejectionReason) const
Bool_t GetNextAcceptMomentum(TLorentzVector &mom)
virtual Bool_t ApplyKinematicCuts(const AliTLorentzVector &mom, UInt_t &rejectionReason) const
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
stl iterator over accepted clusters
const char * GetTitle() const
all_iterator begin() const
accept_iterator accept_rbegin() const
Double_t fMinE
Max. cut on particle energy.
Bool_t GetNextMomentum(TLorentzVector &mom)
Int_t GetIndexFromLabel(Int_t lab) const
bool operator!=(const accept_iterator &other) const
all_iterator & operator++()
accept_iterator accept_end() const
UInt_t fBitMap
bitmap mask
Double_t fClusTimeCutLow
low time cut for clusters
TString fClassName
name of the class in the TClonesArray
Double_t fUserDefEnergyCut[AliVCluster::kLastUserDefEnergy+1]
cut on the energy of the cluster after higher level corrections (see AliVCluster.h) ...
const AliClusterContainer * fkContainer
Container iterated over.
accept_iterator accept_begin() const
int fCurrentPos
Current position inside the container.
void SetClusUserDefEnergyCut(Int_t t, Double_t cut)
AliVCluster * GetLeadingCluster(const char *opt="")
Cell time cut not passed.
accept_iterator & operator++()
Double_t GetClusUserDefEnergyCut(Int_t t) const
Int_t GetDefaultClusterEnergy() const
accept_iterator & operator=(const accept_iterator &other)
enum AliVCluster::VCluUserDefEnergy_t VCluUserDefEnergy_t
all_iterator & operator--()
Cluster is exotic cluster.
stl iterator over all clusters
all_iterator & operator=(const all_iterator &other)
Base class for container structures within the EMCAL framework.
virtual Bool_t AcceptCluster(Int_t i, UInt_t &rejectionReason) const
AliVCluster * GetAcceptCluster(Int_t i) const
Int_t GetNClusters() const
Int_t GetNAcceptedClusters() const
int fCurrentPos
Current position inside the container.
all_iterator rend() const
Double_t fClusTimeCutUp
up time cut for clusters
AliVCluster * GetCluster(Int_t i) const
Bool_t fExoticCut
reject clusters marked as "exotic"
AliVCluster * GetNextCluster()
bool operator!=(const all_iterator &other) const
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void SetClassName(const char *clname)
Int_t fMinMCLabel
minimum MC label
accept_iterator accept_rend() const
const TString & GetArrayName() const
AliVCluster * operator*() const
Double_t fMassHypothesis
if < 0 it will use a PID mass when available
Cluster not in the EMCAL.
Double_t fVertex[3]
! event vertex array
Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const
AliVCluster * GetClusterWithLabel(Int_t lab) const
int TestClusterContainerIterator(const AliClusterContainer *const cont, int iteratorType, bool verbose)
TArrayI fAcceptIndices
Indices of accepted clusters.
Bool_t GetMomentum(TLorentzVector &mom, const AliVCluster *vc, Double_t mass) const
Int_t fMaxMCLabel
maximum MC label
TClonesArray * fClArray
! Pointer to array in input event
Int_t GetNEntries() const
Int_t fDefaultClusterEnergy
default cluster energy: -1 for clus->E(); otherwise clus->GetUserDefEnergy(fDefaultClusterEnergy) ...
const AliClusterContainer * fkContainer
Container iterated over.
all_iterator rbegin() const
Int_t fCurrentID
! current ID for automatic loops
accept_iterator & operator--()
Container structure for EMCAL clusters.
AliVCluster * GetNextAcceptCluster()
void ResetCurrentID(Int_t i=-1)
AliVCluster * operator*() const