6 #include <TClonesArray.h>
11 #include "AliClusterContainer.h"
13 ClassImp(AliClusterContainer)
15 //________________________________________________________________________
16 AliClusterContainer::AliClusterContainer():
17 AliEmcalContainer("AliClusterContainer"),
25 // Default constructor.
27 fClassName = "AliVCluster";
30 //________________________________________________________________________
31 AliClusterContainer::AliClusterContainer(const char *name):
32 AliEmcalContainer(name),
40 // Standard constructor.
42 fClassName = "AliVCluster";
45 //________________________________________________________________________
46 AliVCluster* AliClusterContainer::GetLeadingCluster(const char* opt)
48 // Get the leading cluster; use e if "e" is contained in opt (otherwise et)
53 Int_t tempID = fCurrentID;
55 AliVCluster *clusterMax = GetNextAcceptCluster(0);
56 AliVCluster *cluster = 0;
58 if (option.Contains("e")) {
59 while ((cluster = GetNextAcceptCluster())) {
60 if (cluster->E() > clusterMax->E()) clusterMax = cluster;
66 while ((cluster = GetNextAcceptCluster())) {
68 cluster->GetMomentum(mom,const_cast<Double_t*>(fVertex));
82 //________________________________________________________________________
83 AliVCluster* AliClusterContainer::GetCluster(Int_t i) const {
85 //Get i^th cluster in array
87 if(i<0 || i>fClArray->GetEntriesFast()) return 0;
88 AliVCluster *vp = static_cast<AliVCluster*>(fClArray->At(i));
93 //________________________________________________________________________
94 AliVCluster* AliClusterContainer::GetAcceptCluster(Int_t i) const {
95 //return pointer to cluster if cluster is accepted
97 AliVCluster *vc = GetCluster(i);
100 if(AcceptCluster(vc))
103 AliDebug(2,"Cluster not accepted.");
108 //________________________________________________________________________
109 AliVCluster* AliClusterContainer::GetNextAcceptCluster(Int_t i) {
111 //Get next accepted cluster; if i >= 0 (re)start counter from i; return 0 if no accepted particle could be found
113 if (i>=0) fCurrentID = i;
115 const Int_t n = GetNEntries();
117 while (fCurrentID < n && !c) {
118 c = GetAcceptCluster(fCurrentID);
125 //________________________________________________________________________
126 void AliClusterContainer::GetMomentum(TLorentzVector &mom, Int_t i) const
128 //Get momentum of the i^th cluster in array
130 AliVCluster *vc = GetCluster(i);
131 if(vc) vc->GetMomentum(mom,const_cast<Double_t*>(fVertex));
134 //________________________________________________________________________
135 Bool_t AliClusterContainer::AcceptCluster(AliVCluster *clus) const
137 // Return true if cluster is accepted.
142 if (!clus->IsEMCAL())
145 if (clus->GetLabel() > fMinMCLabel) {
146 if (clus->TestBits(fMCClusterBitMap) != (Int_t)fMCClusterBitMap) {
147 AliDebug(2,"MC Cluster not accepted because of MC bit map.");
152 if (clus->TestBits(fClusterBitMap) != (Int_t)fClusterBitMap) {
153 AliDebug(2,"Cluster not accepted because of bit map.");
158 if (clus->GetTOF() > fClusTimeCutUp || clus->GetTOF() < fClusTimeCutLow)
161 TLorentzVector nPart;
162 clus->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
164 if (nPart.Et() < fClusPtCut)
171 //________________________________________________________________________
172 void AliClusterContainer::SetClassName(const char *clname)
174 // Set the class name
177 if (cls.InheritsFrom("AliVCluster")) fClassName = clname;
178 else AliError(Form("Unable to set class name %s for a AliClusterContainer, it must inherits from AliVCluster!",clname));