3 // Container with name, TClonesArray and cuts for particles
7 #include <TClonesArray.h>
12 #include "AliClusterContainer.h"
14 ClassImp(AliClusterContainer)
16 //________________________________________________________________________
17 AliClusterContainer::AliClusterContainer():
18 AliEmcalContainer("AliClusterContainer"),
27 // Default constructor.
29 fClassName = "AliVCluster";
32 //________________________________________________________________________
33 AliClusterContainer::AliClusterContainer(const char *name):
34 AliEmcalContainer(name),
43 // Standard constructor.
45 fClassName = "AliVCluster";
48 //________________________________________________________________________
49 AliVCluster* AliClusterContainer::GetLeadingCluster(const char* opt)
51 // Get the leading cluster; use e if "e" is contained in opt (otherwise et)
56 Int_t tempID = fCurrentID;
58 AliVCluster *clusterMax = GetNextAcceptCluster(0);
59 AliVCluster *cluster = 0;
61 if (option.Contains("e")) {
62 while ((cluster = GetNextAcceptCluster())) {
63 if (cluster->E() > clusterMax->E()) clusterMax = cluster;
69 while ((cluster = GetNextAcceptCluster())) {
71 cluster->GetMomentum(mom,const_cast<Double_t*>(fVertex));
85 //________________________________________________________________________
86 AliVCluster* AliClusterContainer::GetCluster(Int_t i) const
88 //Get i^th cluster in array
90 if(i<0 || i>fClArray->GetEntriesFast()) return 0;
91 AliVCluster *vp = static_cast<AliVCluster*>(fClArray->At(i));
96 //________________________________________________________________________
97 AliVCluster* AliClusterContainer::GetAcceptCluster(Int_t i) const
99 //Return pointer to cluster if cluster is accepted
101 AliVCluster *vc = GetCluster(i);
104 if(AcceptCluster(vc))
107 AliDebug(2,"Cluster not accepted.");
112 //________________________________________________________________________
113 AliVCluster* AliClusterContainer::GetClusterWithLabel(Int_t lab) const
115 //Get particle with label lab in array
117 Int_t i = GetIndexFromLabel(lab);
118 return GetCluster(i);
121 //________________________________________________________________________
122 AliVCluster* AliClusterContainer::GetAcceptClusterWithLabel(Int_t lab) const
124 //Get particle with label lab in array
126 Int_t i = GetIndexFromLabel(lab);
127 return GetAcceptCluster(i);
130 //________________________________________________________________________
131 AliVCluster* AliClusterContainer::GetNextAcceptCluster(Int_t i)
133 //Get next accepted cluster; if i >= 0 (re)start counter from i; return 0 if no accepted cluster could be found
135 if (i>=0) fCurrentID = i;
137 const Int_t n = GetNEntries();
139 while (fCurrentID < n && !c) {
140 c = GetAcceptCluster(fCurrentID);
147 //________________________________________________________________________
148 AliVCluster* AliClusterContainer::GetNextCluster(Int_t i)
150 //Get next cluster; if i >= 0 (re)start counter from i; return 0 if no cluster could be found
152 if (i>=0) fCurrentID = i;
154 const Int_t n = GetNEntries();
156 while (fCurrentID < n && !c) {
157 c = GetCluster(fCurrentID);
164 //________________________________________________________________________
165 void AliClusterContainer::GetMomentum(TLorentzVector &mom, Int_t i) const
167 //Get momentum of the i^th cluster in array
169 AliVCluster *vc = GetCluster(i);
170 if(vc) vc->GetMomentum(mom,const_cast<Double_t*>(fVertex));
173 //________________________________________________________________________
174 Bool_t AliClusterContainer::AcceptCluster(AliVCluster *clus) const
176 // Return true if cluster is accepted.
181 if (!clus->IsEMCAL())
184 if (clus->GetLabel() > fMinMCLabel) {
185 if (clus->TestBits(fMCClusterBitMap) != (Int_t)fMCClusterBitMap) {
186 AliDebug(2,"MC Cluster not accepted because of MC bit map.");
191 if (clus->TestBits(fClusterBitMap) != (Int_t)fClusterBitMap) {
192 AliDebug(2,"Cluster not accepted because of bit map.");
197 if (clus->GetTOF() > fClusTimeCutUp || clus->GetTOF() < fClusTimeCutLow)
200 if (clus->E()<fClusECut)
203 TLorentzVector nPart;
204 clus->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
206 if (nPart.Et() < fClusPtCut)
212 //________________________________________________________________________
213 void AliClusterContainer::SetClassName(const char *clname)
215 // Set the class name
218 if (cls.InheritsFrom("AliVCluster")) fClassName = clname;
219 else AliError(Form("Unable to set class name %s for a AliClusterContainer, it must inherits from AliVCluster!",clname));