18 #include <TClonesArray.h>
20 #include "AliVEvent.h"
38 fDefaultClusterEnergy(-1),
43 fBaseClassName =
"AliVCluster";
44 SetClassName(
"AliVCluster");
46 for (
Int_t i = 0; i <= AliVCluster::kLastUserDefEnergy; i++) {
56 AliEmcalContainer(name),
60 fDefaultClusterEnergy(-1),
65 fBaseClassName =
"AliVCluster";
66 SetClassName(
"AliVCluster");
68 for (
Int_t i = 0; i <= AliVCluster::kLastUserDefEnergy; i++) {
85 if (option.Contains(
"e")) {
86 momentum = &AliTLorentzVector::E;
89 momentum = &AliTLorentzVector::Et;
95 if ((clusterMax.first.*momentum)() < (cluster.first.*momentum)()) {
100 return clusterMax.second;
110 if(i<0 || i>fClArray->GetEntriesFast())
return 0;
111 AliVCluster *vp =
static_cast<AliVCluster*
>(fClArray->At(i));
126 UInt_t rejectionReason = 0;
130 AliDebug(2,
"Cluster not accepted.");
142 Int_t i = GetIndexFromLabel(lab);
153 Int_t i = GetIndexFromLabel(lab);
163 const Int_t n = GetNEntries();
167 if (fCurrentID >= n)
break;
180 const Int_t n = GetNEntries();
184 if (fCurrentID >= n)
break;
193 if (mass < 0) mass = 0;
204 Double_t p = TMath::Sqrt(energy*energy - mass*mass);
207 vc->GetPosition(pos);
213 Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]) ;
216 mom.SetPxPyPzE( p*pos[0]/r, p*pos[1]/r, p*pos[2]/r, energy) ;
219 AliInfo(
"Null cluster radius, momentum calculation not possible");
228 if (fMassHypothesis > 0)
return GetMomentum(mom, vc, fMassHypothesis);
235 vc->GetMomentum(mom, fVertex);
239 mom.SetPtEtaPhiM(0, 0, 0, 0.139);
294 if (!r)
return kFALSE;
299 return ApplyKinematicCuts(mom, rejectionReason);
305 if (!r)
return kFALSE;
310 return ApplyKinematicCuts(mom, rejectionReason);
321 rejectionReason |= kNullObject;
325 Bool_t bInAcceptance = clus->IsEMCAL();
326 if (
fIncludePHOS) bInAcceptance = clus->IsEMCAL() || (clus->GetType() == AliVCluster::kPHOSNeutral);
327 if (!bInAcceptance) {
328 rejectionReason |= kIsEMCalCut;
332 if (clus->TestBits(fBitMap) != (
Int_t)fBitMap) {
333 rejectionReason |= kBitMapCut;
337 if (fMinMCLabel >= 0 && TMath::Abs(clus->GetLabel()) < fMinMCLabel) {
338 rejectionReason |= kMCLabelCut;
342 if (fMaxMCLabel >= 0 && TMath::Abs(clus->GetLabel()) > fMaxMCLabel) {
343 rejectionReason |= kMCLabelCut;
348 rejectionReason |= kTimeCut;
353 rejectionReason |= kExoticCut;
357 for (
Int_t i = 0; i <= AliVCluster::kLastUserDefEnergy; i++) {
359 rejectionReason |= kEnergyCut;
364 if (
fIncludePHOS && clus->GetType() == AliVCluster::kPHOSNeutral) {
366 rejectionReason |= kExoticCut;
371 rejectionReason |= kExoticCut;
385 UInt_t rejectionReason = 0;
387 for(
int iclust = 0; iclust < this->fClArray->GetEntries(); ++iclust){
388 AliVCluster *clust = this->
GetCluster(iclust);
401 if (t >= 0 && t <= AliVCluster::kLastUserDefEnergy){
416 if (t >= 0 && t <= AliVCluster::kLastUserDefEnergy){
467 clusterString = TString::Format(
"%s_E0000", GetArrayName().
Data());
469 else if (Ecut < 1.0) {
470 clusterString = TString::Format(
"%s_E0%3.0f", GetArrayName().
Data(), Ecut*1000.0);
473 clusterString = TString::Format(
"%s_E%4.0f", GetArrayName().
Data(), Ecut*1000.0);
476 return clusterString.Data();
485 std::vector<AliVCluster *> reference, variation;
486 AliVCluster *test = NULL;
487 for(
int iclust = 0; iclust < cont->
GetNClusters(); iclust++){
490 UInt_t rejectionReason = 0;
493 reference.push_back(test);
498 for(
auto cluster : cont->
accepted()){
499 variation.push_back(cluster);
503 for(
auto cluster : cont->
all()){
504 variation.push_back(cluster);
510 if(reference.size() < 30){
511 std::cout <<
"Clusters in reference container: " << std::endl;
512 std::cout <<
"===========================================" << std::endl;
513 for(std::vector<AliVCluster *>::iterator refit = reference.begin(); refit != reference.end(); ++refit){
514 std::cout <<
"Address: " << *refit << std::endl;
517 if(variation.size() < 30){
518 std::cout <<
"Clusters in test container: " << std::endl;
519 std::cout <<
"===========================================" << std::endl;
520 for(std::vector<AliVCluster *>::iterator varit = variation.begin(); varit != variation.end(); ++varit){
521 std::cout <<
"Address: " << *varit << std::endl;
528 bool failure =
false;
530 for(std::vector<AliVCluster *>::iterator clit = reference.begin(); clit != reference.end(); ++clit){
531 if(std::find(variation.begin(), variation.end(), *clit) == variation.end()) {
533 std::cout <<
"Could not find cluster with address " << *clit <<
" in test container" << std::endl;
540 for(std::vector<AliVCluster *>::iterator clit = variation.begin(); clit != variation.end(); ++clit){
541 if(std::find(reference.begin(), reference.end(), *clit) == reference.end()) {
543 std::cout <<
"Could not find cluster with address " << *clit <<
" in reference container" << std::endl;
548 if(failure) testresult = 2;
554 std::cout <<
"Unit test cluster container, iterator type " << iteratorType << std::endl;
555 std::cout <<
"Number of expected clusters: " << reference.size() <<
", number of found clusters: " << variation.size() << std::endl;
556 std::cout <<
"Test result: " << testresult << std::endl;
557 std::cout <<
"-----------------------------------------------------------------------" << std::endl;
AliVCluster * GetAcceptClusterWithLabel(Int_t lab) const
virtual Bool_t ApplyClusterCuts(const AliVCluster *clus, UInt_t &rejectionReason) const
Bool_t GetNextAcceptMomentum(TLorentzVector &mom)
const char * GetTitle() const
EMCALIterableContainer::AliEmcalIterableContainerT< AliVCluster, EMCALIterableContainer::operator_star_object< AliVCluster > > AliClusterIterableContainer
Bool_t GetNextMomentum(TLorentzVector &mom)
const AliClusterIterableMomentumContainer accepted_momentum() const
Bool_t fIncludePHOS
whether or not to include PHOS clusters in addition to EMCal clusters
Declaration of class AliTLorentzVector.
Double_t fClusTimeCutLow
low time cut for clusters
Double_t fUserDefEnergyCut[AliVCluster::kLastUserDefEnergy+1]
cut on the energy of the cluster after higher level corrections (see AliVCluster.h) ...
void SetClusUserDefEnergyCut(Int_t t, Double_t cut)
AliVCluster * GetLeadingCluster(const char *opt="")
Double_t GetClusUserDefEnergyCut(Int_t t) const
Int_t GetDefaultClusterEnergy() const
const AliClusterIterableContainer all() const
enum AliVCluster::VCluUserDefEnergy_t VCluUserDefEnergy_t
std::pair< AliTLorentzVector, T * > momentum_object_pair
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
const AliClusterIterableContainer accepted() 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_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)
EMCALIterableContainer::AliEmcalIterableContainerT< AliVCluster, EMCALIterableContainer::operator_star_pair< AliVCluster > > AliClusterIterableMomentumContainer
const AliClusterIterableMomentumContainer all_momentum() const
Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const
AliVCluster * GetClusterWithLabel(Int_t lab) const
Double_t fPhosMinM02
min value of M02 for phos clusters
int TestClusterContainerIterator(const AliClusterContainer *const cont, int iteratorType, bool verbose)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Bool_t GetMomentum(TLorentzVector &mom, const AliVCluster *vc, Double_t mass) const
Int_t fDefaultClusterEnergy
default cluster energy: -1 for clus->E(); otherwise clus->GetUserDefEnergy(fDefaultClusterEnergy) ...
Container structure for EMCAL clusters.
AliVCluster * GetNextAcceptCluster()
Int_t fPhosMinNcells
min number of phos cells per cluster