#include "AliHBTParticleCut.h"
+//__________________________________________________________________________
+////////////////////////////////////////////////////////////////////////////
+// //
+// class AliHBTParticleCut //
+// //
+// Classes for single particle cuts //
+// User should use only AliHBTParticleCut, eventually //
+// EmptyCut which passes all particles //
+// There is all interface for setting cuts on all particle properties //
+// The main method is Pass - which returns //
+// True to reject particle //
+// False in case it meets all the criteria of the given cut //
+// //
+// User should create (and also destroy) cuts himself //
+// and then pass them to the Analysis And Function by a proper method //
+// //
+// //
+// more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html //
+// resonsible: Piotr Skowronski@cern.ch //
+// //
+////////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
+
ClassImp(AliHBTParticleCut)
-const Int_t AliHBTParticleCut::fkgMaxCuts = 50;
+const Int_t AliHBTParticleCut::fgkMaxCuts = 50;
/******************************************************************/
-AliHBTParticleCut::AliHBTParticleCut()
- {
- fCuts = new AliHbtBaseCut* [fkgMaxCuts];//last property in the property
- //property enum => defines number of properties
- fNCuts = 0;
- fPID = 0;
- }
+AliHBTParticleCut::AliHBTParticleCut():
+ fCuts(new AliHbtBaseCut* [fgkMaxCuts]),//last property in the property enum => defines number of properties
+ fNCuts(0),
+ fPID(0)
+{
+ //default ctor
+}
/******************************************************************/
-AliHBTParticleCut::AliHBTParticleCut(const AliHBTParticleCut& in)
+AliHBTParticleCut::AliHBTParticleCut(const AliHBTParticleCut& in):
+ TObject(in)
{
- fCuts = new AliHbtBaseCut* [fkgMaxCuts];//last property in the property
+ //cpy ctor
+ fCuts = new AliHbtBaseCut* [fgkMaxCuts];//last property in the property
//property enum => defines number of properties
fNCuts = in.fNCuts;
fPID = in.fPID;
}
}
/******************************************************************/
+AliHBTParticleCut& AliHBTParticleCut::operator=(const AliHBTParticleCut& in)
+{
+ //assigment operator
+ Info("operator=","operator=operator=operator=operator=\noperator=operator=operator=operator=");
+ for (Int_t i = 0;i<fNCuts;i++)
+ {
+ delete fCuts[i];
+ }
+
+ fNCuts = in.fNCuts;
+ fPID = in.fPID;
+ for (Int_t i = 0;i<fNCuts;i++)
+ {
+ fCuts[i] = (AliHbtBaseCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it
+ }
+ return *this;
+}
+/******************************************************************/
AliHBTParticleCut::~AliHBTParticleCut()
{
+ //dtor
for (Int_t i = 0;i<fNCuts;i++)
{
delete fCuts[i];
}
/******************************************************************/
-Bool_t AliHBTParticleCut::Pass(AliHBTParticle* p)
+Bool_t AliHBTParticleCut::Pass(AliHBTParticle* p) const
{
//method checks all the cuts that are set (in the list)
//If any of the baseCuts rejects particle False(rejection) is returned
+
if(!p)
{
Warning("Pass()","No Pasaran! We never accept NULL pointers");
//adds the base pair cut (cut on one value)
if (!basecut) return;
- if( fNCuts == (fkgMaxCuts-1) )
+ if( fNCuts == (fgkMaxCuts-1) )
{
Warning("AddBasePartCut","Not enough place for another cut");
return;
/******************************************************************/
AliHbtBaseCut* AliHBTParticleCut::FindCut(AliHBTCutProperty property)
{
-
+ //returns pointer to the cut checking the given property
for (Int_t i = 0;i<fNCuts;i++)
{
if (fCuts[i]->GetProperty() == property)
void AliHBTParticleCut::SetMomentumRange(Double_t min, Double_t max)
{
+ //Sets momentum range
AliHBTMomentumCut* cut= (AliHBTMomentumCut*)FindCut(kHbtP);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTMomentumCut(min,max);
void AliHBTParticleCut::SetPtRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHBTPtCut* cut= (AliHBTPtCut*)FindCut(kHbtPt);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTPtCut(min,max);
void AliHBTParticleCut::SetEnergyRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHBTEnergyCut* cut= (AliHBTEnergyCut*)FindCut(kHbtE);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTEnergyCut(min,max);
void AliHBTParticleCut::SetRapidityRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtRapidity);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTRapidityCut(min,max);
void AliHBTParticleCut::SetPseudoRapidityRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtPseudoRapidity);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTPseudoRapidityCut(min,max);
void AliHBTParticleCut::SetPxRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtPx);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTPxCut(min,max);
void AliHBTParticleCut::SetPyRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtPy);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTPyCut(min,max);
void AliHBTParticleCut::SetPzRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtPz);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTPzCut(min,max);
void AliHBTParticleCut::SetPhiRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtPhi);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTPhiCut(min,max);
void AliHBTParticleCut::SetThetaRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtTheta);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTThetaCut(min,max);
void AliHBTParticleCut::SetVxRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtVx);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTVxCut(min,max);
void AliHBTParticleCut::SetVyRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtVy);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTVyCut(min,max);
void AliHBTParticleCut::SetVzRange(Double_t min, Double_t max)
{
+ //name self descriptive
AliHbtBaseCut* cut = FindCut(kHbtVz);
if(cut) cut->SetRange(min,max);
else fCuts[fNCuts++] = new AliHBTVzCut(min,max);
/******************************************************************/
void AliHBTParticleCut::Streamer(TBuffer &b)
{
- // Stream all objects in the array to or from the I/O buffer.
+ // Stream all objects in the array to or from the I/O buffer.
UInt_t R__s, R__c;
if (b.IsReading())
b.SetByteCount(R__c, kTRUE);
}
}
+/******************************************************************/
-void AliHBTParticleCut::Print(void)
+void AliHBTParticleCut::Print(void) const
{
+ //prints all information about the cut to stdout
cout<<"Printing AliHBTParticleCut, this = "<<this<<endl;
cout<<"fPID "<<fPID<<endl;
cout<<"fNCuts "<<fNCuts <<endl;
ClassImp(AliHBTEmptyParticleCut)
void AliHBTEmptyParticleCut::Streamer(TBuffer &b)
{
+ //stramer
AliHBTParticleCut::Streamer(b);
}
/******************************************************************/
/******************************************************************/
ClassImp(AliHbtBaseCut)
-void AliHbtBaseCut::Print(void)
+void AliHbtBaseCut::Print(void) const
{
+ // prints the information anout the base cut to stdout
cout<<"fMin="<<fMin <<", fMax=" <<fMax<<" ";
PrintProperty();
}
-void AliHbtBaseCut::PrintProperty(void)
+/******************************************************************/
+
+void AliHbtBaseCut::PrintProperty(void) const
{
+ //prints the property name
switch (fProperty)
{
case kHbtP:
fFirst(new AliHBTDummyBaseCut),
fSecond(new AliHBTDummyBaseCut)
{
-
+ //ctor
}
/******************************************************************/
fFirst((first)?(AliHbtBaseCut*)first->Clone():0x0),
fSecond((second)?(AliHbtBaseCut*)second->Clone():0x0)
{
+ //ctor
if ( (fFirst && fSecond) == kFALSE)
{
Fatal("AliHBTLogicalOperCut","One of parameters is NULL!");
AliHBTLogicalOperCut::~AliHBTLogicalOperCut()
{
-//destructor
+ //destructor
delete fFirst;
delete fSecond;
}
/******************************************************************/
-Bool_t AliHBTLogicalOperCut::AliHBTDummyBaseCut::Pass(AliHBTParticle*p)
+Bool_t AliHBTLogicalOperCut::AliHBTDummyBaseCut::Pass(AliHBTParticle* /*part*/) const
{
+ //checks if particles passes properties defined by this cut
Warning("Pass","You are using dummy base cut! Probobly some logical cut is not set up properly");
return kFALSE;//accept
}
/******************************************************************/
ClassImp(AliHBTOrCut)
-Bool_t AliHBTOrCut::Pass(AliHBTParticle * p)
+Bool_t AliHBTOrCut::Pass(AliHBTParticle * p) const
{
//returns true when rejected
//AND operation is a little bit misleading but is correct
ClassImp(AliHBTAndCut)
-Bool_t AliHBTAndCut::Pass(AliHBTParticle * p)
+Bool_t AliHBTAndCut::Pass(AliHBTParticle * p) const
{
//returns true when rejected
//OR operation is a little bit misleading but is correct