#include "AliLog.h"
#include "AliMCParticle.h"
#include "AliCFAcceptanceCuts.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TList.h"
+#include "TBits.h"
ClassImp(AliCFAcceptanceCuts)
fMinNHitTPC(0),
fMinNHitTRD(0),
fMinNHitTOF(0),
- fMinNHitMUON(0)
-
+ fMinNHitMUON(0),
+ fhCutStatistics(0x0),
+ fhCutCorrelation(0x0),
+ fBitmap(new TBits(0))
{
//
//ctor
//
+ for (int i=0; i<kNCuts; i++) for (int j=0; j<kNStepQA; j++) fhQA[i][j]=0x0;
}
//______________________________
fMinNHitTPC(0),
fMinNHitTRD(0),
fMinNHitTOF(0),
- fMinNHitMUON(0)
+ fMinNHitMUON(0),
+ fhCutStatistics(0x0),
+ fhCutCorrelation(0x0),
+ fBitmap(new TBits(0))
{
//
//ctor
//
+ for (int i=0; i<kNCuts; i++) for (int j=0; j<kNStepQA; j++) fhQA[i][j]=0x0;
}
//______________________________
fMinNHitTPC(c.fMinNHitTPC),
fMinNHitTRD(c.fMinNHitTRD),
fMinNHitTOF(c.fMinNHitTOF),
- fMinNHitMUON(c.fMinNHitMUON)
+ fMinNHitMUON(c.fMinNHitMUON),
+ fhCutStatistics(c.fhCutStatistics),
+ fhCutCorrelation(c.fhCutCorrelation),
+ fBitmap(c.fBitmap)
{
//
//copy ctor
//
+ for (int i=0; i<kNCuts; i++) for (int j=0; j<kNStepQA; j++) fhQA[i][j]=c.fhQA[i][j];
}
//______________________________
fMinNHitTRD=c.fMinNHitTRD;
fMinNHitTOF=c.fMinNHitTOF;
fMinNHitMUON=c.fMinNHitMUON;
+ fhCutStatistics = c.fhCutStatistics ;
+ fhCutCorrelation = c.fhCutCorrelation ;
+ fBitmap = c.fBitmap ;
+ for (int i=0; i<kNCuts; i++) for (int j=0; j<kNStepQA; j++) fhQA[i][j]=c.fhQA[i][j];
}
return *this ;
}
+//______________________________________________________________
+Bool_t AliCFAcceptanceCuts::IsSelected(TObject *obj) {
+ //
+ // check if selections on 'obj' are passed
+ // 'obj' must be an AliMCParticle
+ //
+
+ SelectionBitMap(obj);
+
+ if (fIsQAOn) FillHistograms(obj,kFALSE);
+
+ for (UInt_t icut=0; icut<fBitmap->GetNbits(); icut++)
+ if (!fBitmap->TestBitNumber(icut)) return kFALSE ;
+
+ if (fIsQAOn) FillHistograms(obj,kTRUE);
+ return kTRUE;
+}
+
//______________________________
-Bool_t AliCFAcceptanceCuts::IsSelected(TObject* obj) {
+void AliCFAcceptanceCuts::SelectionBitMap(TObject* obj) {
//
// checks the number of track references associated to 'obj'
// 'obj' must be an AliMCParticle
//
- if (!obj) return kFALSE ;
+ for (UInt_t i=0; i<kNCuts; i++) fBitmap->SetBitNumber(i,kFALSE);
+ if (!obj) return;
TString className(obj->ClassName());
if (className.CompareTo("AliMCParticle") != 0) {
- AliError("obj must point to a AliMCParticle !");
- return kFALSE ;
+ AliError("obj must point to an AliMCParticle !");
+ return ;
}
- AliMCParticle* part = (AliMCParticle*) obj ;
- if(!part) return kFALSE;
+ AliMCParticle * part = dynamic_cast<AliMCParticle*>(obj);
+ if(!part) return ;
Int_t nHitsITS=0, nHitsTPC=0, nHitsTRD=0, nHitsTOF=0, nHitsMUON=0 ;
for (Int_t iTrackRef=0; iTrackRef<part->GetNumberOfTrackReferences(); iTrackRef++) {
}
}
- if (nHitsITS < fMinNHitITS ) return kFALSE;
- if (nHitsTPC < fMinNHitTPC ) return kFALSE;
- if (nHitsTRD < fMinNHitTRD ) return kFALSE;
- if (nHitsTOF < fMinNHitTOF ) return kFALSE;
- if (nHitsMUON < fMinNHitMUON ) return kFALSE;
-
+ Int_t iCutBit = 0;
- return kTRUE ;
+ if (nHitsITS >= fMinNHitITS ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if (nHitsTPC >= fMinNHitTPC ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if (nHitsTRD >= fMinNHitTRD ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if (nHitsTOF >= fMinNHitTOF ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if (nHitsMUON >= fMinNHitMUON) fBitmap->SetBitNumber(iCutBit,kTRUE);
}
void AliCFAcceptanceCuts::SetEvtInfo(TObject* mcInfo) {
//
- // Sets pointer to MC event information (AliMCEventHandler)
+ // Sets pointer to MC event information (AliMCEvent)
//
if (!mcInfo) {
- AliError("Pointer to MC Event Handler is null !");
+ AliError("Pointer to AliMCEvent !");
return;
}
TString className(mcInfo->ClassName());
- if (className.CompareTo("AliMCEventHandler") != 0) {
- AliError("argument must point to an AliMCEventHandler !");
+ if (className.CompareTo("AliMCEvent") != 0) {
+ AliError("argument must point to an AliMCEvent !");
return ;
}
- fMCInfo = (AliMCEventHandler*) mcInfo ;
+ fMCInfo = (AliMCEvent*) mcInfo ;
+}
+
+
+//__________________________________________________________________________________
+void AliCFAcceptanceCuts::AddQAHistograms(TList *qaList) {
+ //
+ // saves the histograms in a TList
+ //
+
+ DefineHistograms();
+
+ qaList->Add(fhCutStatistics);
+ qaList->Add(fhCutCorrelation);
+
+ for (Int_t j=0; j<kNStepQA; j++) {
+ for(Int_t i=0; i<kNCuts; i++)
+ qaList->Add(fhQA[i][j]);
+ }
+}
+
+//__________________________________________________________________________________
+void AliCFAcceptanceCuts::DefineHistograms() {
+ //
+ // histograms for cut variables, cut statistics and cut correlations
+ //
+ Int_t color = 2;
+
+ // book cut statistics and cut correlation histograms
+ fhCutStatistics = new TH1F(Form("%s_cut_statistics",GetName()),"",kNCuts,0.5,kNCuts+0.5);
+ fhCutStatistics->SetLineWidth(2);
+ int k = 1;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"hits ITS") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"hits TPC") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"hits TRD") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"hits TOF") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"hits MUON"); k++;
+
+
+ fhCutCorrelation = new TH2F(Form("%s_cut_correlation",GetName()),"",kNCuts,0.5,kNCuts+0.5,kNCuts,0.5,kNCuts+0.5);
+ fhCutCorrelation->SetLineWidth(2);
+ for (k=1; k<=kNCuts; k++) {
+ fhCutCorrelation->GetXaxis()->SetBinLabel(k,fhCutStatistics->GetXaxis()->GetBinLabel(k));
+ fhCutCorrelation->GetYaxis()->SetBinLabel(k,fhCutStatistics->GetXaxis()->GetBinLabel(k));
+ }
+
+ Char_t str[256];
+ for (int i=0; i<kNStepQA; i++) {
+ if (i==0) sprintf(str," ");
+ else sprintf(str,"_cut");
+ fhQA[kCutHitsITS] [i] = new TH1F(Form("%s_HitsITS%s" ,GetName(),str),"",10,0,10);
+ fhQA[kCutHitsTPC] [i] = new TH1F(Form("%s_HitsTPC%s" ,GetName(),str),"",5,0,5);
+ fhQA[kCutHitsTRD] [i] = new TH1F(Form("%s_HitsTRD%s" ,GetName(),str),"",10,0,10);
+ fhQA[kCutHitsTOF] [i] = new TH1F(Form("%s_HitsTOF%s" ,GetName(),str),"",5,0,5);
+ fhQA[kCutHitsMUON][i] = new TH1F(Form("%s_HitsMUON%s" ,GetName(),str),"",5,0,5);
+ }
+ for(Int_t i=0; i<kNCuts; i++) fhQA[i][1]->SetLineColor(color);
+}
+
+//__________________________________________________________________________________
+void AliCFAcceptanceCuts::FillHistograms(TObject* obj, Bool_t afterCuts)
+{
+ //
+ // fill the QA histograms
+ //
+ AliMCParticle* part = dynamic_cast<AliMCParticle *>(obj);
+
+ Int_t nHitsITS=0, nHitsTPC=0, nHitsTRD=0, nHitsTOF=0, nHitsMUON=0 ;
+ for (Int_t iTrackRef=0; iTrackRef<part->GetNumberOfTrackReferences(); iTrackRef++) {
+ AliTrackReference * trackRef = part->GetTrackReference(iTrackRef);
+ if(trackRef){
+ Int_t detectorId = trackRef->DetectorId();
+ switch(detectorId) {
+ case AliTrackReference::kITS : nHitsITS++ ; break ;
+ case AliTrackReference::kTPC : nHitsTPC++ ; break ;
+ case AliTrackReference::kTRD : nHitsTRD++ ; break ;
+ case AliTrackReference::kTOF : nHitsTOF++ ; break ;
+ case AliTrackReference::kMUON : nHitsMUON++ ; break ;
+ default : break ;
+ }
+ }
+ }
+
+ fhQA[kCutHitsITS ][afterCuts]->Fill(nHitsITS );
+ fhQA[kCutHitsTPC ][afterCuts]->Fill(nHitsTPC );
+ fhQA[kCutHitsTRD ][afterCuts]->Fill(nHitsTRD );
+ fhQA[kCutHitsTOF ][afterCuts]->Fill(nHitsTOF );
+ fhQA[kCutHitsMUON][afterCuts]->Fill(nHitsMUON);
+
+ // fill cut statistics and cut correlation histograms with information from the bitmap
+ if (afterCuts) return;
+
+ // Number of single cuts in this class
+ UInt_t ncuts = fBitmap->GetNbits();
+ for(UInt_t bit=0; bit<ncuts;bit++) {
+ if (!fBitmap->TestBitNumber(bit)) {
+ fhCutStatistics->Fill(bit+1);
+ for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
+ if (!fBitmap->TestBitNumber(bit2))
+ fhCutCorrelation->Fill(bit+1,bit2+1);
+ }
+ }
+ }
}
#include "AliCFCutBase.h"
-class AliMCEventHandler;
+class AliMCEvent;
+class TH1F ;
+class TH2F ;
+class TBits;
class AliCFAcceptanceCuts : public AliCFCutBase
{
void SetMinNHitTOF (Int_t nhits) {fMinNHitTOF=nhits;}
void SetMinNHitMUON(Int_t nhits) {fMinNHitMUON=nhits;}
+ enum {
+ kCutHitsITS ,
+ kCutHitsTPC ,
+ kCutHitsTRD ,
+ kCutHitsTOF ,
+ kCutHitsMUON,
+ kNCuts, // number of single selections
+ kNStepQA=2 // number of QA steps (before/after the cuts)
+ };
+
protected:
- AliMCEventHandler *fMCInfo; // pointer to MC Information
- Int_t fMinNHitITS ; // min number of track references in ITS
- Int_t fMinNHitTPC ; // min number of track references in TPC
- Int_t fMinNHitTRD ; // min number of track references in TRD
- Int_t fMinNHitTOF ; // min number of track references in TOF
- Int_t fMinNHitMUON ; // min number of track references in MUON
+ AliMCEvent *fMCInfo; // pointer to MC Information
+ Int_t fMinNHitITS ; // min number of track references in ITS
+ Int_t fMinNHitTPC ; // min number of track references in TPC
+ Int_t fMinNHitTRD ; // min number of track references in TRD
+ Int_t fMinNHitTOF ; // min number of track references in TOF
+ Int_t fMinNHitMUON ; // min number of track references in MUON
+ //QA histos
+ TH1F* fhCutStatistics; // Histogram: statistics of what cuts the tracks did not survive
+ TH2F* fhCutCorrelation; // Histogram: 2d statistics plot
+ TH1F* fhQA[kNCuts][kNStepQA]; // QA Histograms
+ TBits* fBitmap ; // stores single selection decisions
+ void SelectionBitMap(TObject* obj);
+ void FillHistograms(TObject* obj, Bool_t afterCuts);
+ void AddQAHistograms(TList *qaList) ;
+ void DefineHistograms();
+
ClassDef(AliCFAcceptanceCuts,1);
};
AliCFCutBase(const AliCFCutBase& obj); //copy ctor
virtual ~AliCFCutBase() {;} //dtor
virtual Bool_t IsQAOn() const {return fIsQAOn;}; //QA flag getter
- virtual void SetQAOn(Bool_t flagQA) {fIsQAOn=flagQA;}; //QA flag setter
- virtual void FillHistogramsBeforeCuts(TObject* ) {;}; //QA histos
- virtual void FillHistogramsAfterCuts(TObject* ) {;}; //QA histos
- virtual void DefineHistograms(){;}; //QA histos
- virtual void AddQAHistograms(TList*) const {;}; //QA Histos
- virtual void GetBitMap(TObject*, TBits*){;} //selection bitmap
+ virtual void SetQAOn(TList* list) {fIsQAOn=kTRUE; AddQAHistograms(list);} //QA flag setter
virtual void SetEvtInfo(TObject *) {;}; //Pass pointer to event-level info
- protected:
+
+ protected:
Bool_t fIsQAOn;//qa checking on/off
- private:
+ virtual void AddQAHistograms(TList*) {;}; //QA Histos
+
ClassDef(AliCFCutBase, 1); // Base class for Correction Framework Cuts
};
#include "TH1F.h"
#include "TList.h"
#include "AliLog.h"
-#include "TMath.h"
#include "AliVEvent.h"
#include "AliCFEventClassCuts.h"
ClassImp(AliCFEventClassCuts)
fZDCP2EnergyMax(1.e99),
fZDCEM1EnergyMax(1.e99),
fZDCEM2EnergyMax(1.e99),
- fBitMap(0x0),
- fhNBinsTrigger(0),
- fhBinLimTrigger(0),
- fhNBinsZDCEnN1(0),
- fhBinLimZDCEnN1(0),
- fhNBinsZDCEnP1(0),
- fhBinLimZDCEnP1(0),
- fhNBinsZDCEnN2(0),
- fhBinLimZDCEnN2(0),
- fhNBinsZDCEnP2(0),
- fhBinLimZDCEnP2(0),
- fhNBinsZDCEnEM1(0),
- fhBinLimZDCEnEM1(0),
- fhNBinsZDCEnEM2(0),
- fhBinLimZDCEnEM2(0)
+ fBitMap(0x0)
{
//
//ctor
fZDCP2EnergyMax(1.e99),
fZDCEM1EnergyMax(1.e99),
fZDCEM2EnergyMax(1.e99),
- fBitMap(0x0),
- fhNBinsTrigger(0),
- fhBinLimTrigger(0),
- fhNBinsZDCEnN1(0),
- fhBinLimZDCEnN1(0),
- fhNBinsZDCEnP1(0),
- fhBinLimZDCEnP1(0),
- fhNBinsZDCEnN2(0),
- fhBinLimZDCEnN2(0),
- fhNBinsZDCEnP2(0),
- fhBinLimZDCEnP2(0),
- fhNBinsZDCEnEM1(0),
- fhBinLimZDCEnEM1(0),
- fhNBinsZDCEnEM2(0),
- fhBinLimZDCEnEM2(0)
+ fBitMap(0x0)
{
//
//ctor
fZDCP2EnergyMax(c.fZDCP2EnergyMax),
fZDCEM1EnergyMax(c.fZDCEM1EnergyMax),
fZDCEM2EnergyMax(c.fZDCEM2EnergyMax),
- fBitMap(c.fBitMap),
- fhNBinsTrigger(c.fhNBinsTrigger),
- fhBinLimTrigger(c.fhBinLimTrigger ),
- fhNBinsZDCEnN1(c.fhNBinsZDCEnN1),
- fhBinLimZDCEnN1(c.fhBinLimZDCEnN1),
- fhNBinsZDCEnP1(c.fhNBinsZDCEnP1),
- fhBinLimZDCEnP1(c.fhBinLimZDCEnP1),
- fhNBinsZDCEnN2(c.fhNBinsZDCEnN2),
- fhBinLimZDCEnN2(c.fhBinLimZDCEnN2),
- fhNBinsZDCEnP2(c.fhNBinsZDCEnP2),
- fhBinLimZDCEnP2(c.fhBinLimZDCEnP2),
- fhNBinsZDCEnEM1(c.fhNBinsZDCEnEM1),
- fhBinLimZDCEnEM1(c.fhBinLimZDCEnEM1),
- fhNBinsZDCEnEM2(c.fhNBinsZDCEnEM2),
- fhBinLimZDCEnEM2(c.fhBinLimZDCEnEM2)
+ fBitMap(c.fBitMap)
{
//
fZDCEM1EnergyMax = c.fZDCEM1EnergyMax;
fZDCEM2EnergyMax = c.fZDCEM2EnergyMax;
fBitMap = c.fBitMap;
- fhNBinsTrigger = c.fhNBinsTrigger;
- fhBinLimTrigger = c.fhBinLimTrigger ;
- fhNBinsZDCEnN1 = c.fhNBinsZDCEnN1;
- fhBinLimZDCEnN1 = c.fhBinLimZDCEnN1;
- fhNBinsZDCEnP1 = c.fhNBinsZDCEnP1;
- fhBinLimZDCEnP1 = c.fhBinLimZDCEnP1;
- fhNBinsZDCEnN2 = c.fhNBinsZDCEnN2;
- fhBinLimZDCEnN2 = c.fhBinLimZDCEnN2;
- fhNBinsZDCEnP2 = c.fhNBinsZDCEnP2;
- fhBinLimZDCEnP2 = c.fhBinLimZDCEnP2;
- fhNBinsZDCEnEM1 = c.fhNBinsZDCEnEM1;
- fhBinLimZDCEnEM1 = c.fhBinLimZDCEnEM1;
- fhNBinsZDCEnEM2 = c.fhNBinsZDCEnEM2;
- fhBinLimZDCEnEM2 = c.fhBinLimZDCEnEM2;
}
}
if(fBitMap)delete fBitMap;
- if(fhBinLimTrigger)delete fhBinLimTrigger;
- if(fhBinLimZDCEnN1)delete fhBinLimZDCEnN1;
- if(fhBinLimZDCEnP1)delete fhBinLimZDCEnP1;
- if(fhBinLimZDCEnN2)delete fhBinLimZDCEnN2;
- if(fhBinLimZDCEnP2)delete fhBinLimZDCEnP2;
- if(fhBinLimZDCEnEM1)delete fhBinLimZDCEnEM1;
- if(fhBinLimZDCEnEM2)delete fhBinLimZDCEnEM2;
}
-//_____________________________________________________________________________
-void AliCFEventClassCuts::Init() {
- //
- // initialises all QA histograms
- //
- if(fIsQAOn)
- DefineHistograms();
-}
-
//_____________________________________________________________________________
void AliCFEventClassCuts::Initialise()
{
//
//initialization
- //
-
-
//
// sets pointers to histos to zero
- //
-
for(Int_t i=0; i<kNCuts; i++){
for(Int_t j =0; j<kNStepQA; j++){
fhQA[i][j]=0x0;
}
}
-
- //set default bin number/ranges for QA histograms
-
- SetHistogramBins(kTrigger,23,-0.5,22.5);
- SetHistogramBins(kZDCEnergyN1,800,-500,7500);
- SetHistogramBins(kZDCEnergyP1,800,-500,7500);
- SetHistogramBins(kZDCEnergyN2,800,-500,7500);
- SetHistogramBins(kZDCEnergyP2,800,-500,7500);
- SetHistogramBins(kZDCEnergyEM1,800,-500,7500);
- SetHistogramBins(kZDCEnergyEM2,800,-500,7500);
-
}
//____________________________________________________________________
//Check if the requested cuts are passed
//
- TBits* bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
+ if (fIsQAOn) FillHistograms(obj,0);
Bool_t isSelected = kTRUE;
- for (UInt_t icut=0; icut<bitmap->GetNbits();icut++)
- if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE;
+ for (UInt_t icut=0; icut<fBitMap->GetNbits();icut++)
+ if(!fBitMap->TestBitNumber(icut)) isSelected = kFALSE;
- return isSelected;
+ if (!isSelected) return kFALSE ;
+ if (fIsQAOn) FillHistograms(obj,1);
+ return kTRUE;
}
//____________________________________________________________________
-TBits *AliCFEventClassCuts::SelectionBitMap(TObject* obj) {
+void AliCFEventClassCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
+{
+ //
+ //setting x-axis bin limits of QA histogram fhQA[index]
+ //
+ for(Int_t i=0;i<kNStepQA;i++){
+ if(!fhQA[index][i]){AliWarning("non-existing histogram!");
+ return;
+ }
+ fhQA[index][i]->GetXaxis()->Set(nbins,bins);
+ }
+}
+//____________________________________________________________________
+void AliCFEventClassCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax)
+{
+ //
+ //setting x-axis bins and range of QA histogram fhQA[index]
+ //
+ for(Int_t i=0;i<kNStepQA;i++){
+ if(!fhQA[index][i]){AliWarning("non-existing histogram!");
+ return;
+ }
+ fhQA[index][i]->GetXaxis()->Set(nbins,xmin,xmax);
+ }
+}
+//____________________________________________________________________
+void AliCFEventClassCuts::SelectionBitMap(TObject* obj) {
//
//cut on trigger type (just pp running trigger types implemented so far)
//and on the energy observed in the ZDC. The argument is cast into
//
for(Int_t j=0;j<kNCuts;j++)fBitMap->SetBitNumber(j,kFALSE);
+
AliVEvent* esd = dynamic_cast<AliVEvent *>(obj);
- if (!esd ) return fBitMap ;
+ if (!esd ) return;
//now start checking the cuts
if( esd->GetZDCP2Energy()<fZDCP2EnergyMin || esd->GetZDCP2Energy()>fZDCP2EnergyMax)fBitMap->SetBitNumber(4,kFALSE);
if( esd->GetZDCEMEnergy(0)<fZDCEM1EnergyMin || esd->GetZDCEMEnergy(0)>fZDCEM1EnergyMax)fBitMap->SetBitNumber(5,kFALSE);
if( esd->GetZDCEMEnergy(1)<fZDCEM2EnergyMin || esd->GetZDCEMEnergy(1)>fZDCEM2EnergyMax)fBitMap->SetBitNumber(6,kFALSE);
- return fBitMap;
+ return ;
}
return;
}
-//_____________________________________________________________________________
-void AliCFEventClassCuts::GetBitMap(TObject* obj, TBits* bitmap){
- //
- // retrieve the pointer to the bitmap
- //
-
- bitmap = SelectionBitMap(obj);
-
-}
-
-//_____________________________________________________________________________
-void AliCFEventClassCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
-{
- //
- // QA histogram axis parameters
- // variable bin size:user inputs nbins and the vector of bin limits
- //
-
- switch(index){
- case kTrigger:
- fhNBinsTrigger=nbins+1;
- fhBinLimTrigger=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimTrigger[i]=bins[i];
- break;
-
- case kZDCEnergyN1:
- fhNBinsZDCEnN1=nbins+1;
- fhBinLimZDCEnN1=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN1[i]=bins[i];
- break;
-
- case kZDCEnergyP1:
- fhNBinsZDCEnP1=nbins+1;
- fhBinLimZDCEnP1=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP1[i]=bins[i];
- break;
-
- case kZDCEnergyN2:
- fhNBinsZDCEnN2=nbins+1;
- fhBinLimZDCEnN2=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN2[i]=bins[i];
- break;
-
- case kZDCEnergyP2:
- fhNBinsZDCEnP2=nbins+1;
- fhBinLimZDCEnP2=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP2[i]=bins[i];
- break;
-
- case kZDCEnergyEM1:
- fhNBinsZDCEnEM1=nbins+1;
- fhBinLimZDCEnEM1=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM1[i]=bins[i];
- break;
-
- case kZDCEnergyEM2:
- fhNBinsZDCEnEM2=nbins+1;
- fhBinLimZDCEnEM2=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM2[i]=bins[i];
- break;
-
- }
-
-}
-
-//_____________________________________________________________________________
-void AliCFEventClassCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax)
-{
- //
- // QA histogram axis parameters
- // fixed bin size: user inputs nbins, xmin and xmax
- //
- switch(index){
- case kTrigger:
- fhNBinsTrigger=nbins+1;
- fhBinLimTrigger=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimTrigger[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
-
- case kZDCEnergyN1:
- fhNBinsZDCEnN1=nbins+1;
- fhBinLimZDCEnN1=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN1[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
-
- case kZDCEnergyP1:
- fhNBinsZDCEnP1=nbins+1;
- fhBinLimZDCEnP1=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP1[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
-
- case kZDCEnergyN2:
- fhNBinsZDCEnN2=nbins+1;
- fhBinLimZDCEnN2=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN2[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
-
- case kZDCEnergyP2:
- fhNBinsZDCEnP2=nbins+1;
- fhBinLimZDCEnP2=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP2[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
-
- case kZDCEnergyEM1:
- fhNBinsZDCEnEM1=nbins+1;
- fhBinLimZDCEnEM1=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM1[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
-
- case kZDCEnergyEM2:
- fhNBinsZDCEnEM2=nbins+1;
- fhBinLimZDCEnEM2=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM2[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
- }
-}
-
//_____________________________________________________________________________
void AliCFEventClassCuts::DefineHistograms() {
//
Int_t color = 2;
if(!fIsQAOn) {
- AliInfo(Form("Nn QA histos requested, Please first set the QA flag on!"));
+ AliInfo(Form("No QA histos requested, Please first set the QA flag on!"));
return;
}
// book QA histograms
-
Char_t str[256];
for (Int_t i=0; i<kNStepQA; i++) {
if (i==0) sprintf(str," ");
else sprintf(str,"_cut");
- fhQA[kTrigger][i] = new TH1F(Form("%s_TriggerBits%s",GetName(),str), "",fhNBinsTrigger-1,fhBinLimTrigger);
- fhQA[kZDCEnergyN1][i] = new TH1F(Form("%s_ZDC_Energy_N1%s",GetName(),str), "",fhNBinsZDCEnN1-1,fhBinLimZDCEnN1);
- fhQA[kZDCEnergyP1][i] = new TH1F(Form("%s_ZDC_Energy_P1%s",GetName(),str), "",fhNBinsZDCEnP1-1,fhBinLimZDCEnP1);
- fhQA[kZDCEnergyN2][i] = new TH1F(Form("%s_ZDC_Energy_N2%s",GetName(),str), "",fhNBinsZDCEnN2-1,fhBinLimZDCEnN2);
- fhQA[kZDCEnergyP2][i] = new TH1F(Form("%s_ZDC_Energy_P2%s",GetName(),str), "",fhNBinsZDCEnP2-1,fhBinLimZDCEnP2);
- fhQA[kZDCEnergyEM1][i] = new TH1F(Form("%s_ZDC_Energy_EM1%s",GetName(),str), "",fhNBinsZDCEnEM1-1,fhBinLimZDCEnEM1);
- fhQA[kZDCEnergyEM2][i] = new TH1F(Form("%s_ZDC_Energy_EM2%s",GetName(),str), "",fhNBinsZDCEnEM2-1,fhBinLimZDCEnEM2);
-
+ fhQA[kTrigger][i] = new TH1F(Form("%s_TriggerBits%s",GetName(),str), "",23,-0.5,22.5);
+ fhQA[kZDCEnergyN1][i] = new TH1F(Form("%s_ZDC_Energy_N1%s",GetName(),str), "",800,-500,7500);
+ fhQA[kZDCEnergyP1][i] = new TH1F(Form("%s_ZDC_Energy_P1%s",GetName(),str), "",800,-500,7500);
+ fhQA[kZDCEnergyN2][i] = new TH1F(Form("%s_ZDC_Energy_N2%s",GetName(),str), "",800,-500,7500);
+ fhQA[kZDCEnergyP2][i] = new TH1F(Form("%s_ZDC_Energy_P2%s",GetName(),str), "",800,-500,7500);
+ fhQA[kZDCEnergyEM1][i] = new TH1F(Form("%s_ZDC_Energy_EM1%s",GetName(),str), "",800,-500,7500);
+ fhQA[kZDCEnergyEM2][i] = new TH1F(Form("%s_ZDC_Energy_EM2%s",GetName(),str), "",800,-500,7500);
fhQA[kTrigger][i] ->SetXTitle("Trigger Bits");
fhQA[kZDCEnergyN1][i] ->SetXTitle("ZDC Energy N1 (GeV)");
}
//_____________________________________________________________________________
-void AliCFEventClassCuts::FillHistograms(TObject* obj, Bool_t b)
+void AliCFEventClassCuts::FillHistograms(TObject* obj, Bool_t afterCuts)
{
//
// fill the QA histograms
AliVEvent* esd = dynamic_cast<AliVEvent *>(obj);
if (!esd ) return ;
- // index = 0: fill histograms before cuts
- // index = 1: fill histograms after cuts
- Int_t index = -1;
- index = ((b) ? 1 : 0);
-
-
//look at the Trigger mask in current event
TBits *triggerBitMap=new TBits(0);
TriggerBitMap(esd, triggerBitMap);
//trigger Mask
for(Int_t itrig=0;itrig<kNTriggers+kNTriggersMB;itrig++){
if(triggerBitMap->TestBitNumber(itrig)){
- fhQA[kTrigger][index]->Fill(itrig);
+ fhQA[kTrigger][afterCuts]->Fill(itrig);
}
}
delete triggerBitMap;
//ZDC Quantities
- fhQA[kZDCEnergyN1][index]->Fill(esd->GetZDCN1Energy());
- fhQA[kZDCEnergyP1][index]->Fill(esd->GetZDCP1Energy());
- fhQA[kZDCEnergyN2][index]->Fill(esd->GetZDCN2Energy());
- fhQA[kZDCEnergyP2][index]->Fill(esd->GetZDCP2Energy());
- fhQA[kZDCEnergyEM1][index]->Fill(esd->GetZDCEMEnergy(0));
- fhQA[kZDCEnergyEM2][index]->Fill(esd->GetZDCEMEnergy(1));
+ fhQA[kZDCEnergyN1][afterCuts] ->Fill(esd->GetZDCN1Energy());
+ fhQA[kZDCEnergyP1][afterCuts] ->Fill(esd->GetZDCP1Energy());
+ fhQA[kZDCEnergyN2][afterCuts] ->Fill(esd->GetZDCN2Energy());
+ fhQA[kZDCEnergyP2][afterCuts] ->Fill(esd->GetZDCP2Energy());
+ fhQA[kZDCEnergyEM1][afterCuts]->Fill(esd->GetZDCEMEnergy(0));
+ fhQA[kZDCEnergyEM2][afterCuts]->Fill(esd->GetZDCEMEnergy(1));
}
//_____________________________________________________________________________
-void AliCFEventClassCuts::AddQAHistograms(TList *list) const {
+void AliCFEventClassCuts::AddQAHistograms(TList *qaList) {
//
// saves the histograms in a TList
//
- if(!fIsQAOn) return;
+
+ DefineHistograms();
for (Int_t j=0; j<kNStepQA; j++) {
for(Int_t i=0; i<kNCuts; i++)
- list->Add(fhQA[i][j]);
+ qaList->Add(fhQA[i][j]);
}
}
~AliCFEventClassCuts();
Bool_t IsSelected(TObject* obj);
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- void Init();
- void GetBitMap(TObject *obj, TBits *bitmap);
- void AddQAHistograms(TList *list) const;
//Association to The Trigger bits in the mask.
//They correspond to the PP running descriptor as in
Double_t GetZDCEM2EnergyCutMax() const {return fZDCEM2EnergyMax;};//ZDC EM2 Emax
- // QA histograms
- void FillHistogramsBeforeCuts(TObject* obj) {return FillHistograms(obj,kFALSE);}
- void FillHistogramsAfterCuts(TObject* obj) {return FillHistograms(obj,kTRUE);}
// QA histogram setter
// please use indices from the enumeration below
void SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins);
kNCuts=7,
kNStepQA=2
};
- private:
- TBits* SelectionBitMap(TObject* obj);
+ protected:
+ void SelectionBitMap(TObject* obj);
static void TriggerBitMap(AliVEvent* ev,TBits *bitmapT);
void DefineHistograms(); // books histograms and TList
+ void AddQAHistograms(TList *qaList) ;
void Initialise(); // sets everything to 0
void FillHistograms(TObject* obj, Bool_t b);
Double_t fZDCEM2EnergyMax; //Max Energy in ZDCEM2
TBits *fBitMap ; //cut mask
-
TH1F* fhQA[kNCuts][kNStepQA]; // QA Histograms
- //QA Histogram parameters
- Int_t fhNBinsTrigger;//size of array of bin limits, Trigger Mask
- Double_t *fhBinLimTrigger;//[fhNBinsTrigger] bin limits, Trigger Mask
- Int_t fhNBinsZDCEnN1;//size of array of bin limits, Energy in ZDC N1
- Double_t *fhBinLimZDCEnN1;//[fhNBinsZDCEnN1] bin limits, Energy in ZDC N1
- Int_t fhNBinsZDCEnP1;//size of array of bin limits, Energy in ZDC P1
- Double_t *fhBinLimZDCEnP1;//[fhNBinsZDCEnP1] bin limits, Energy in ZDC P1
- Int_t fhNBinsZDCEnN2;//size of array of bin limits, Energy in ZDC N2
- Double_t *fhBinLimZDCEnN2;//[fhNBinsZDCEnN2] bin limits, Energy in ZDC N2
- Int_t fhNBinsZDCEnP2;//size of array of bin limits, Energy in ZDC P2
- Double_t *fhBinLimZDCEnP2;//[fhNBinsZDCEnP2] bin limits, Energy in ZDC P2
- Int_t fhNBinsZDCEnEM1;//size of array of bin limits, Energy in ZDC EM1
- Double_t *fhBinLimZDCEnEM1;//[fhNBinsZDCEnEM1] bin limits, Energy in ZDC EM1
- Int_t fhNBinsZDCEnEM2;//size of array of bin limits, Energy in ZDC EM2
- Double_t *fhBinLimZDCEnEM2;//[fhNBinsZDCEnEM1] bin limits, Energy in ZDC EM2
- ClassDef(AliCFEventClassCuts,1);
+ ClassDef(AliCFEventClassCuts,2);
};
#endif
//Check if the requested cuts are passed
//
- TBits *bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
Bool_t isSelected = kTRUE;
- for (UInt_t icut=0; icut<bitmap->GetNbits();icut++)
- if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE;
+ for (UInt_t icut=0; icut<fBitMap->GetNbits();icut++)
+ if(!fBitMap->TestBitNumber(icut)) isSelected = kFALSE;
return isSelected;
}
//____________________________________________________________________
-TBits * AliCFEventGenCuts::SelectionBitMap(TObject* obj){
+void AliCFEventGenCuts::SelectionBitMap(TObject* obj){
//
//cut on the MB process type, the number of charged and neutral
//tracks and on the event vertex. So far specific to AliMCEvents
//Check if the requested cuts are passed and return a bitmap
for(Int_t j=0;j<kNCuts;j++)fBitMap->SetBitNumber(j,kFALSE);
AliMCEvent* ev = dynamic_cast<AliMCEvent *>(obj);
- if ( !ev ) return fBitMap ;
+ if ( !ev ) return;
AliGenEventHeader*genHeader = ev->GenEventHeader();
if (vtxPos[2]>fVtxZMax || vtxPos[2]<fVtxZMin)
fBitMap->SetBitNumber(4,kFALSE);
}
- return fBitMap;
+ return;
}
//______________________________________________________________________
return process;
}
-//_____________________________________________________________________________
-void AliCFEventGenCuts::GetBitMap(TObject* obj, TBits *bitmap){
- //
- // retrieve the pointer to the bitmap
- //
- bitmap=SelectionBitMap(obj);
-
-}
-
#ifndef ALICFEVENTGENCUTS_H
#define ALICFEVENTGENCUTS_H
/**************************************************************************
#include "AliCFCutBase.h"
class TBits;
-class AliEventGenHeader;
+class AliGenEventHeader;
class AliMCEvent;
//____________________________________________________________________________
class AliCFEventGenCuts: public AliCFCutBase
AliCFEventGenCuts(const AliCFEventGenCuts& c) ;
AliCFEventGenCuts& operator=(const AliCFEventGenCuts& c) ;
~AliCFEventGenCuts();
- void GetBitMap(TObject *obj, TBits *bitmap);
Bool_t IsSelected(TObject* obj);
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- void Init(){;};
//number of embedded cuts
enum{kNCuts=5};
Double_t GetVertexZMin() const {return fVtxZMin;} // cut values getter
- private:
+ protected:
- TBits * SelectionBitMap(TObject* obj);
+ void SelectionBitMap(TObject* obj);
Int_t fMBProcType ; //the type of selected MB process
Int_t fNTracksMin; //minimum number of particles in the event
TBits *fBitMap ; //cut mask
- ClassDef(AliCFEventGenCuts,1);
+ ClassDef(AliCFEventGenCuts,2);
};
#endif
fVtxXResMax(1.e99),
fVtxYResMax(1.e99),
fVtxZResMax(1.e99),
- fBitMap(0x0),
- fhNBinsNTracks(0),
- fhBinLimNTracks(0),
- fhNBinsVtxPosX(0),
- fhBinLimVtxPosX(0),
- fhNBinsVtxPosY(0),
- fhBinLimVtxPosY(0),
- fhNBinsVtxPosZ(0),
- fhBinLimVtxPosZ(0),
- fhNBinsVtxResX(0),
- fhBinLimVtxResX(0),
- fhNBinsVtxResY(0),
- fhBinLimVtxResY(0),
- fhNBinsVtxResZ(0),
- fhBinLimVtxResZ(0)
+ fBitMap(0x0)
{
//
//ctor
fVtxXResMax(1.e99),
fVtxYResMax(1.e99),
fVtxZResMax(1.e99),
- fBitMap(0x0),
- fhNBinsNTracks(0),
- fhBinLimNTracks(0),
- fhNBinsVtxPosX(0),
- fhBinLimVtxPosX(0),
- fhNBinsVtxPosY(0),
- fhBinLimVtxPosY(0),
- fhNBinsVtxPosZ(0),
- fhBinLimVtxPosZ(0),
- fhNBinsVtxResX(0),
- fhBinLimVtxResX(0),
- fhNBinsVtxResY(0),
- fhBinLimVtxResY(0),
- fhNBinsVtxResZ(0),
- fhBinLimVtxResZ(0)
+ fBitMap(0x0)
{
//
//ctor
fVtxXResMax(c.fVtxXResMax),
fVtxYResMax(c.fVtxYResMax),
fVtxZResMax(c.fVtxZResMax),
- fBitMap(c.fBitMap),
- fhNBinsNTracks(c.fhNBinsNTracks),
- fhBinLimNTracks(c.fhBinLimNTracks),
- fhNBinsVtxPosX(c.fhNBinsVtxPosX),
- fhBinLimVtxPosX(c.fhBinLimVtxPosX),
- fhNBinsVtxPosY(c.fhNBinsVtxPosY),
- fhBinLimVtxPosY(c.fhBinLimVtxPosY),
- fhNBinsVtxPosZ(c.fhNBinsVtxPosZ),
- fhBinLimVtxPosZ(c.fhBinLimVtxPosZ),
- fhNBinsVtxResX(c.fhNBinsVtxResX),
- fhBinLimVtxResX(c.fhBinLimVtxResX),
- fhNBinsVtxResY(c.fhNBinsVtxResY),
- fhBinLimVtxResY(c.fhBinLimVtxResY),
- fhNBinsVtxResZ(c.fhNBinsVtxResZ),
- fhBinLimVtxResZ(c.fhBinLimVtxResZ)
+ fBitMap(c.fBitMap)
{
//
//copy constructor
}
}
- if(fhBinLimNTracks)delete fhBinLimNTracks;
- if(fhBinLimVtxPosX)delete fhBinLimVtxPosX;
- if(fhBinLimVtxPosY)delete fhBinLimVtxPosY;
- if(fhBinLimVtxPosZ)delete fhBinLimVtxPosZ;
- if(fhBinLimVtxResX)delete fhBinLimVtxResX;
- if(fhBinLimVtxResY)delete fhBinLimVtxResY;
- if(fhBinLimVtxResZ)delete fhBinLimVtxResZ;
-
if(fBitMap)delete fBitMap;
}
-
-//_____________________________________________________________________________
-void AliCFEventRecCuts::Init() {
- //
- // initialises all QA histograms
- //
- if(fIsQAOn)
- DefineHistograms();
-}
-
//_____________________________________________________________________________
void AliCFEventRecCuts::Initialise()
{
fhQA[i][j]=0x0;
}
}
-
- //set default bin number/ranges for QA histograms
-
- SetHistogramBins(kNTracks,23,-0.5,22.5);
- SetHistogramBins(kVtxPosX,100,-5,5);
- SetHistogramBins(kVtxPosY,100,-5,5);
- SetHistogramBins(kVtxPosZ,100,-50,50);
- SetHistogramBins(kVtxResX,100,-1,1);
- SetHistogramBins(kVtxResY,100,-1,1);
- SetHistogramBins(kVtxResZ,100,-1,1);
-
}
//____________________________________________________________________
fVtxYResMax=c.fVtxYResMax;
fVtxZResMax=c.fVtxZResMax;
fBitMap=c.fBitMap;
- fhNBinsNTracks=c.fhNBinsNTracks;
- fhBinLimNTracks=c.fhBinLimNTracks;
- fhNBinsVtxPosX=c.fhNBinsVtxPosX;
- fhBinLimVtxPosX=c.fhBinLimVtxPosX;
- fhNBinsVtxPosY=c.fhNBinsVtxPosY;
- fhBinLimVtxPosY=c.fhBinLimVtxPosY;
- fhNBinsVtxPosZ=c.fhNBinsVtxPosZ;
- fhBinLimVtxPosZ=c.fhBinLimVtxPosZ;
- fhNBinsVtxResX=c.fhNBinsVtxResX;
- fhBinLimVtxResX=c.fhBinLimVtxResX;
- fhNBinsVtxResY=c.fhNBinsVtxResY;
- fhBinLimVtxResY=c.fhBinLimVtxResY;
- fhNBinsVtxResZ=c.fhNBinsVtxResZ;
- fhBinLimVtxResZ=c.fhBinLimVtxResZ;
}
for (Int_t i=0; i<c.kNCuts; i++){
//Check if the requested cuts are passed
//
- TBits *bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
+
+ if (fIsQAOn) FillHistograms(obj,0);
Bool_t isSelected = kTRUE;
- for (UInt_t icut=0; icut<bitmap->GetNbits();icut++)
- if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE;
+ for (UInt_t icut=0; icut<fBitMap->GetNbits();icut++)
+ if(!fBitMap->TestBitNumber(icut)) isSelected = kFALSE;
- return isSelected;
+ if (!isSelected) return kFALSE ;
+ if (fIsQAOn) FillHistograms(obj,1);
+ return kTRUE;
}
-
//____________________________________________________________________
-TBits *AliCFEventRecCuts::SelectionBitMap(TObject* obj) {
+void AliCFEventRecCuts::SelectionBitMap(TObject* obj) {
//
//cut on the number of charged tracks and on the event vertex.
//so far specific to AliESDEvents
//Check if the requested cuts are passed and return a bitmap
for(Int_t j=0;j<kNCuts;j++)fBitMap->SetBitNumber(j,kFALSE);
AliESDEvent* esd = dynamic_cast<AliESDEvent *>(obj);
- if ( !esd ) return fBitMap ;
+ if ( !esd ) return;
//now start checking the cuts,
//first assume the event will be accepted:
const AliESDVertex* vtxESD = esd->GetVertex();
if(!vtxESD){
for(Int_t j=1;j<kNCuts;j++)fBitMap->SetBitNumber(j,kFALSE);
- return fBitMap;
+ return;
}
// Require the vertex to have been reconstructed successfully
if (strcmp(vtxESD->GetName(), "default")==0){
AliWarning(Form(" No reconstructed vertex found, skip event"));
for(Int_t j=1;j<kNCuts;j++)fBitMap->SetBitNumber(j,kFALSE);
- return fBitMap;
+ return;
}
// Pick up the position and uncertainties
if (vtxRes[2]==0 || vtxRes[2]>fVtxZResMax)
fBitMap->SetBitNumber(6,kFALSE);
}
- return fBitMap;
-}
-
-//_____________________________________________________________________________
-void AliCFEventRecCuts::GetBitMap(TObject* obj, TBits *bitmap) {
- //
- // retrieve the pointer to the bitmap
- //
- bitmap = SelectionBitMap(obj);
-
+ return;
}
//_____________________________________________________________________________
}
-//_____________________________________________________________________________
+//____________________________________________________________________
void AliCFEventRecCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
{
//
- // QA histogram axis parameters
- // variable bin size:user inputs nbins and the vector of bin limits
- //
+ //setting x-axis bin limits of QA histogram fhQA[index]
+ //
- switch(index){
- case kNTracks:
- fhNBinsNTracks=nbins+1;
- fhBinLimNTracks=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimNTracks[i]=bins[i];
- break;
- case kVtxPosX:
- fhNBinsVtxPosX=nbins+1;
- fhBinLimVtxPosX=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxPosX[i]=bins[i];
- break;
- case kVtxPosY:
- fhNBinsVtxPosY=nbins+1;
- fhBinLimVtxPosY=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxPosY[i]=bins[i];
- break;
- case kVtxPosZ:
- fhNBinsVtxPosZ=nbins+1;
- fhBinLimVtxPosZ=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxPosZ[i]=bins[i];
- break;
- case kVtxResX:
- fhNBinsVtxResX=nbins+1;
- fhBinLimVtxResX=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxResX[i]=bins[i];
- break;
- case kVtxResY:
- fhNBinsVtxResY=nbins+1;
- fhBinLimVtxResY=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxResY[i]=bins[i];
- break;
- case kVtxResZ:
- fhNBinsVtxResZ=nbins+1;
- fhBinLimVtxResZ=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxResZ[i]=bins[i];
- break;
+ for(Int_t i=0;i<kNStepQA;i++){
+ if(!fhQA[index][i]){AliWarning("non-existing histogram!");
+ return;
+ }
+ fhQA[index][i]->GetXaxis()->Set(nbins,bins);
}
-
}
-
-//_____________________________________________________________________________
+//____________________________________________________________________
void AliCFEventRecCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax)
{
//
- // QA histogram axis parameters
- // fixed bin size: user inputs nbins, xmin and xmax
- //
- switch(index){
- case kNTracks:
- fhNBinsNTracks=nbins+1;
- fhBinLimNTracks=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimNTracks[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
- case kVtxPosX:
- fhNBinsVtxPosX=nbins+1;
- fhBinLimVtxPosX=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxPosX[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
- case kVtxPosY:
- fhNBinsVtxPosY=nbins+1;
- fhBinLimVtxPosY=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxPosY[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
- case kVtxPosZ:
- fhNBinsVtxPosZ=nbins+1;
- fhBinLimVtxPosZ=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxPosZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
- case kVtxResX:
- fhNBinsVtxResX=nbins+1;
- fhBinLimVtxResX=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxResX[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
- case kVtxResY:
- fhNBinsVtxResY=nbins+1;
- fhBinLimVtxResY=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxResY[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
- case kVtxResZ:
- fhNBinsVtxResZ=nbins+1;
- fhBinLimVtxResZ=new Double_t[nbins+1];
- for(Int_t i=0;i<nbins+1;i++)fhBinLimVtxResZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
- break;
+ //setting x-axis bins and range of QA histogram fhQA[index]
+ //
+
+ for(Int_t i=0;i<kNStepQA;i++){
+ if(!fhQA[index][i]){AliWarning("non-existing histogram!");
+ return;
+ }
+ fhQA[index][i]->GetXaxis()->Set(nbins,xmin,xmax);
}
}
if (i==0) sprintf(str," ");
else sprintf(str,"_cut");
- fhQA[kNTracks][i] = new TH1F(Form("%s_NTracks%s",GetName(),str), "",fhNBinsNTracks-1,fhBinLimNTracks);
- fhQA[kVtxPosX][i] = new TH1F(Form("%s_Vtx_Pos_X%s",GetName(),str), "",fhNBinsVtxPosX-1,fhBinLimVtxPosX);
- fhQA[kVtxPosY][i] = new TH1F(Form("%s_Vtx_Pos_Y%s",GetName(),str), "",fhNBinsVtxPosY-1,fhBinLimVtxPosY);
- fhQA[kVtxPosZ][i] = new TH1F(Form("%s_Vtx_Pos_Z%s",GetName(),str), "",fhNBinsVtxPosZ-1,fhBinLimVtxPosZ);
+ fhQA[kNTracks][i] = new TH1F(Form("%s_NTracks%s",GetName(),str), "",501,-0.5,500.5);
+ fhQA[kVtxPosX][i] = new TH1F(Form("%s_Vtx_Pos_X%s",GetName(),str), "",100,-5.,5.);
+ fhQA[kVtxPosY][i] = new TH1F(Form("%s_Vtx_Pos_Y%s",GetName(),str), "",100,-5.,5.);
+ fhQA[kVtxPosZ][i] = new TH1F(Form("%s_Vtx_Pos_Z%s",GetName(),str), "",200,-50.,50.);
- fhQA[kVtxResX][i] = new TH1F(Form("%s_Vtx_Res_X%s",GetName(),str), "",fhNBinsVtxResX-1,fhBinLimVtxResX);
- fhQA[kVtxResY][i] = new TH1F(Form("%s_Vtx_Res_Y%s",GetName(),str), "",fhNBinsVtxResY-1,fhBinLimVtxResY);
- fhQA[kVtxResZ][i] = new TH1F(Form("%s_Vtx_Res_Z%s",GetName(),str), "",fhNBinsVtxResZ-1,fhBinLimVtxResZ);
+ fhQA[kVtxResX][i] = new TH1F(Form("%s_Vtx_Res_X%s",GetName(),str), "",100,-1.,1.);
+ fhQA[kVtxResY][i] = new TH1F(Form("%s_Vtx_Res_Y%s",GetName(),str), "",100,-1.,1.);
+ fhQA[kVtxResZ][i] = new TH1F(Form("%s_Vtx_Res_Z%s",GetName(),str), "",100,-1.,1.);
fhQA[kNTracks][i] ->SetXTitle("Number of ESD tracks");
fhQA[kVtxPosX][i] ->SetXTitle("Vertex Position X (cm)");
}
//_____________________________________________________________________________
-void AliCFEventRecCuts::AddQAHistograms(TList *list) const {
+void AliCFEventRecCuts::AddQAHistograms(TList *qaList) {
//
// saves the histograms in a TList
//
- if(!fIsQAOn) return;
+
+ DefineHistograms();
for (Int_t j=0; j<kNStepQA; j++) {
for(Int_t i=0; i<kNCuts; i++)
- list->Add(fhQA[i][j]);
+ qaList->Add(fhQA[i][j]);
}
}
AliCFEventRecCuts(const AliCFEventRecCuts& c) ;
AliCFEventRecCuts& operator=(const AliCFEventRecCuts& c) ;
~AliCFEventRecCuts();
- void GetBitMap(TObject *obj, TBits*bitmap);
Bool_t IsSelected(TObject* obj);
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- void Init();
- void AddQAHistograms(TList *list) const;
void SetNTracksCut(Int_t xMin=-1, Int_t xMax=1000000) {fNTracksMin=xMin; fNTracksMax=xMax;} // cut values setter
Double_t GetVertexYResMax() const {return fVtxYResMax;} // cut values getter
Double_t GetVertexZResMax() const {return fVtxZResMax;} // cut values getter
- // QA histograms
- void FillHistogramsBeforeCuts(TObject* obj) {return FillHistograms(obj,kFALSE);}
- void FillHistogramsAfterCuts(TObject* obj) {return FillHistograms(obj,kTRUE);}
// QA histogram setter
// please use indices from the enumeration below
void SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins);
kNStepQA=2
};
- private:
- TBits *SelectionBitMap(TObject* obj);
+ protected:
+ void SelectionBitMap(TObject* obj);
+ void AddQAHistograms(TList *qaList) ;
void DefineHistograms(); // books histograms
void Initialise(); // sets everything to 0
void FillHistograms(TObject* obj, Bool_t b);
+
Int_t fNTracksMin; //minimum number of esd tracks
Int_t fNTracksMax; //maximum number of esd tracks
Bool_t fRequireVtxCuts ; //The type of trigger to be checked
Double_t fVtxYResMax ;//Maximum value of sigma_vtx in X
Double_t fVtxZResMax ;//Maximum value of sigma_vtx in X
-
TBits *fBitMap ; //cut mask
-
TH1F* fhQA[kNCuts][kNStepQA]; // QA Histograms
- //QA Histogram parameters
- Int_t fhNBinsNTracks;//size of array of bin limits, N Tracks ESD
- Double_t *fhBinLimNTracks;//[fhNBinsNTracks] bin limits, N Tracks ESD
- Int_t fhNBinsVtxPosX;//size of array of bin limits, Vtx Pos X
- Double_t *fhBinLimVtxPosX;//[fhNBinsVtxPosX] bin limits, Vtx Pos X
- Int_t fhNBinsVtxPosY;//size of array of bin limits, Vtx Pos Y
- Double_t *fhBinLimVtxPosY;//[fhNBinsVtxPosY] bin limits, Vtx Pos Y
- Int_t fhNBinsVtxPosZ;//size of array of bin limits, Vtx Pos Z
- Double_t *fhBinLimVtxPosZ;//[fhNBinsVtxPosZ] bin limits, Vtx Pos Z
- Int_t fhNBinsVtxResX;//size of array of bin limits, Vtx Res X
- Double_t *fhBinLimVtxResX;//[fhNBinsVtxResX] bin limits, Vtx Res X
- Int_t fhNBinsVtxResY;//size of array of bin limits, Vtx Res Y
- Double_t *fhBinLimVtxResY;//[fhNBinsVtxResY] bin limits, Vtx Res Y
- Int_t fhNBinsVtxResZ;//size of array of bin limits, Vtx Res Z
- Double_t *fhBinLimVtxResZ;//[fhNBinsVtxResZ] bin limits, Vtx Res Z
- ClassDef(AliCFEventRecCuts,2);
+ ClassDef(AliCFEventRecCuts,3);
};
#endif
#include "AliMCParticle.h"
#include "AliCFPairAcceptanceCuts.h"
-#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
+#include "TBits.h"
+#include "AliLog.h"
ClassImp(AliCFPairAcceptanceCuts)
AliCFCutBase(),
fMCInfo(0x0),
fCutNeg(new AliCFAcceptanceCuts()),
- fCutPos(new AliCFAcceptanceCuts())
+ fCutPos(new AliCFAcceptanceCuts()),
+ fBitmap(new TBits(0))
{
//
//Default Constructor
AliCFCutBase(name,title),
fMCInfo(0x0),
fCutNeg(new AliCFAcceptanceCuts(name,title)),
- fCutPos(new AliCFAcceptanceCuts(name,title))
+ fCutPos(new AliCFAcceptanceCuts(name,title)),
+ fBitmap(new TBits(0))
{
//
//Named Constructor
AliCFCutBase(c),
fMCInfo(c.fMCInfo),
fCutNeg(c.fCutNeg),
- fCutPos(c.fCutPos)
+ fCutPos(c.fCutPos),
+ fBitmap(c.fBitmap)
{
//
//Copy Constructor
fMCInfo = c.fMCInfo ;
fCutNeg = c.fCutNeg ;
fCutPos = c.fCutPos ;
+ fBitmap = c.fBitmap ;
}
return *this ;
}
-//______________________________
+//__________________________________________________________
Bool_t AliCFPairAcceptanceCuts::IsSelected(TObject* obj) {
//
// checks the number of track references associated to 'obj'
// 'obj' must be an AliMCParticle
//
+ //
+ // check if selections on 'obj' are passed
+ // 'obj' must be an AliMCParticle
+ //
+
+ SelectionBitMap(obj);
+
+ // if (fIsQAOn) FillHistograms(obj,kFALSE);
+ Bool_t isSelected = kTRUE;
+
+ for (UInt_t icut=0; icut<fBitmap->GetNbits(); icut++) {
+ if (!fBitmap->TestBitNumber(icut)) {
+ isSelected = kFALSE;
+ break;
+ }
+ }
+
+ if (!isSelected) return kFALSE ;
+ // if (fIsQAOn) FillHistograms(obj,kTRUE);
+ return kTRUE;
+}
+
+//__________________________________________________________
+void AliCFPairAcceptanceCuts::SelectionBitMap(TObject* obj)
+{
+ //
+ // test if the track passes the single cuts
+ // and store the information in a bitmap
+ //
+
+ for (UInt_t i=0; i<kNCuts; i++) fBitmap->SetBitNumber(i,kFALSE);
- if (!obj) return kFALSE ;
+ if (!obj) return;
TString className(obj->ClassName());
if (className.CompareTo("AliMCParticle") != 0) {
- Error("IsSelected","obj must point to a AliMCParticle !");
- return kFALSE ;
+ AliError("obj must point to an AliMCParticle !");
+ return ;
}
- TParticle* part = ((AliMCParticle*)obj)->Particle() ;
- if (!part || part->GetNDaughters()!=2) return kFALSE ;
+ TParticle* part = (dynamic_cast<AliMCParticle*>(obj))->Particle() ;
+ if (!part || part->GetNDaughters() !=2) return ;
+
Int_t lab0 = part->GetDaughter(0);
Int_t lab1 = part->GetDaughter(1);
-
- AliMCParticle* negDaughter = fMCInfo->MCEvent()->GetTrack(lab0) ;
- AliMCParticle* posDaughter = fMCInfo->MCEvent()->GetTrack(lab1) ;
+ AliMCParticle* negDaughter = fMCInfo->GetTrack(lab0) ;
+ AliMCParticle* posDaughter = fMCInfo->GetTrack(lab1) ;
- if (!fCutNeg->IsSelected(negDaughter)) return kFALSE;
- if (!fCutPos->IsSelected(posDaughter)) return kFALSE;
+ Int_t iCutBit = 0;
- return kTRUE ;
+ if (fCutNeg->IsSelected(negDaughter)) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+
+ if (fCutPos->IsSelected(posDaughter)) fBitmap->SetBitNumber(iCutBit,kTRUE);
}
//______________________________
void AliCFPairAcceptanceCuts::SetEvtInfo(TObject* mcInfo) {
//
- // Sets pointer to MC event information (AliMCEventHandler)
+ // Sets pointer to MC event information (AliMCEvent)
//
if (!mcInfo) {
- Error("SetEvtInfo","Pointer to MC Event Handler is null !");
+ Error("SetEvtInfo","Pointer to MC Event is null !");
return;
}
TString className(mcInfo->ClassName());
- if (className.CompareTo("AliMCEventHandler") != 0) {
- Error("SetEvtInfo","argument must point to an AliMCEventHandler !");
+ if (className.CompareTo("AliMCEvent") != 0) {
+ Error("SetEvtInfo","argument must point to an AliMCEvent !");
return ;
}
- fMCInfo = (AliMCEventHandler*) mcInfo ;
+ fMCInfo = (AliMCEvent*) mcInfo ;
}
#include "AliCFAcceptanceCuts.h"
#include "AliCFCutBase.h"
-class AliMCEventHandler;
+class AliMCEvent;
+class TBits;
class AliCFPairAcceptanceCuts : public AliCFCutBase
{
AliCFPairAcceptanceCuts(const AliCFPairAcceptanceCuts& c) ;
AliCFPairAcceptanceCuts& operator=(const AliCFPairAcceptanceCuts& c) ;
virtual ~AliCFPairAcceptanceCuts() {delete fCutNeg; delete fCutPos; }
- virtual Bool_t IsSelected(TObject* obj) ;
+ Bool_t IsSelected(TObject* obj) ;
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
virtual void SetEvtInfo(TObject *mcInfo) ;
virtual void SetMinNHitITS (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitITS (nHitNeg); fCutPos->SetMinNHitITS (nHitPos);}
virtual void SetMinNHitTOF (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitTOF (nHitNeg); fCutPos->SetMinNHitTOF (nHitPos);}
virtual void SetMinNHitMUON (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitMUON(nHitNeg); fCutPos->SetMinNHitMUON(nHitPos);}
+ enum {
+ kNCuts=2
+ };
+
protected:
- AliMCEventHandler *fMCInfo ; // global event information
+ AliMCEvent *fMCInfo ; // global event information
AliCFAcceptanceCuts *fCutNeg ; // acceptance cut on negative daughter
AliCFAcceptanceCuts *fCutPos ; // acceptance cut on positive daughter
-
+ TBits *fBitmap ; // cut bitmap
+
+ private:
+ void SelectionBitMap(TObject* obj);
+
ClassDef(AliCFPairAcceptanceCuts,1);
};
AliCFPairIsPrimaryCuts& operator=(const AliCFPairIsPrimaryCuts& c) ;
virtual ~AliCFPairIsPrimaryCuts() {delete fCutNeg; delete fCutPos; }
- virtual Bool_t IsSelected(TObject* obj) ;
+ Bool_t IsSelected(TObject* obj) ;
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
virtual void SetMaxNSigmaToVertex(Double32_t neg, Double32_t pos)
{fCutNeg->SetMaxNSigmaToVertex(neg); fCutPos->SetMaxNSigmaToVertex(pos);}
void SetMinDiffProb(Bool_t check1, Double_t mindiff1, Bool_t check2, Double_t mindiff2)
{fCutNeg->SetMinDiffProb(check1,mindiff1); fCutPos->SetMinDiffProb(check2,mindiff2);} //set checking at probability level
- virtual Bool_t IsSelected(TObject *obj); //boolena for detectors
+ Bool_t IsSelected(TObject *obj); //boolean for detectors
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
private:
AliCFTrackCutPid* fCutNeg; //! PID cut on negative daughter
AliCFPairQualityCuts& operator=(const AliCFPairQualityCuts& c) ;
virtual ~AliCFPairQualityCuts() {delete fCutNeg; delete fCutPos; }
- virtual Bool_t IsSelected(TObject* obj) ;
+ Bool_t IsSelected(TObject* obj) ;
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
virtual void SetMinNClusterTPC (UInt_t nClusNeg, UInt_t nClusPos)
{fCutNeg->SetMinNClusterTPC(nClusNeg); fCutPos->SetMinNClusterTPC(nClusPos);}
#include "AliCFParticleGenCuts.h"
#include "TParticle.h"
#include "TParticlePDG.h"
-#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
#include "TObject.h"
#include "AliStack.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TBits.h"
+#include "TList.h"
ClassImp(AliCFParticleGenCuts)
AliCFCutBase(),
fMCInfo(0x0),
fRequireIsCharged(0),
+ fRequireIsNeutral(0),
fRequireIsPrimary(0),
fRequireIsSecondary(0),
fRequirePdgCode(0),
fDecayVtxXMax( 1.e+09),
fDecayVtxYMax( 1.e+09),
fDecayVtxZMax( 1.e+09),
- fDecayLengthMin(0),
+ fDecayLengthMin(-1.),
fDecayLengthMax(1.e+09),
- fDecayRxyMin(0),
- fDecayRxyMax(1.e+09)
+ fDecayRxyMin(-1),
+ fDecayRxyMax(1.e+09),
+ fhCutStatistics(0x0),
+ fhCutCorrelation(0x0),
+ fBitmap(new TBits(0))
{
//
//ctor
//
+ for (int i=0; i<kNCuts; i++)
+ for (int j=0; j<kNStepQA; j++)
+ fhQA[i][j]=0x0;
}
//______________________________
AliCFCutBase(name,title),
fMCInfo(0x0),
fRequireIsCharged(0),
+ fRequireIsNeutral(0),
fRequireIsPrimary(0),
fRequireIsSecondary(0),
fRequirePdgCode(0),
fDecayVtxXMax( 1.e+09),
fDecayVtxYMax( 1.e+09),
fDecayVtxZMax( 1.e+09),
- fDecayLengthMin(0),
+ fDecayLengthMin(-1.),
fDecayLengthMax(1.e+09),
- fDecayRxyMin(0),
- fDecayRxyMax(1.e+09)
+ fDecayRxyMin(-1.),
+ fDecayRxyMax(1.e+09),
+ fhCutStatistics(0x0),
+ fhCutCorrelation(0x0),
+ fBitmap(new TBits(0))
{
//
//ctor
//
+ for (int i=0; i<kNCuts; i++)
+ for (int j=0; j<kNStepQA; j++)
+ fhQA[i][j]=0x0;
}
//______________________________
AliCFCutBase(c),
fMCInfo(c.fMCInfo),
fRequireIsCharged(c.fRequireIsCharged),
+ fRequireIsNeutral(c.fRequireIsNeutral),
fRequireIsPrimary(c.fRequireIsPrimary),
fRequireIsSecondary(c.fRequireIsSecondary),
fRequirePdgCode(c.fRequirePdgCode),
fDecayLengthMin(c.fDecayLengthMin),
fDecayLengthMax(c.fDecayLengthMin),
fDecayRxyMin(c.fDecayLengthMin),
- fDecayRxyMax(c.fDecayLengthMin)
+ fDecayRxyMax(c.fDecayLengthMin),
+ fhCutStatistics(new TH1F(*c.fhCutStatistics)),
+ fhCutCorrelation(new TH2F(*c.fhCutCorrelation)),
+ fBitmap(new TBits(*c.fBitmap))
{
//
//copy ctor
//
+ if (c.fhCutStatistics) fhCutStatistics = new TH1F(*c.fhCutStatistics) ;
+ if (c.fhCutCorrelation) fhCutCorrelation = new TH2F(*c.fhCutCorrelation) ;
+
+ for (int i=0; i<kNCuts; i++)
+ for (int j=0; j<kNStepQA; j++)
+ fhQA[i][j]=(TH1F*)c.fhQA[i][j]->Clone();
}
//______________________________
AliCFCutBase::operator=(c) ;
fMCInfo=c.fMCInfo;
fRequireIsCharged=c.fRequireIsCharged;
+ fRequireIsNeutral=c.fRequireIsNeutral;
fRequireIsPrimary=c.fRequireIsPrimary;
fRequireIsSecondary=c.fRequireIsSecondary;
fRequirePdgCode=c.fRequirePdgCode;
fDecayLengthMax=c.fDecayLengthMax;
fDecayRxyMin=c.fDecayRxyMin;
fDecayRxyMax=c.fDecayRxyMax;
+ fBitmap=new TBits(*c.fBitmap);
+
+ if (fhCutStatistics) fhCutStatistics =new TH1F(*c.fhCutStatistics) ;
+ if (fhCutCorrelation) fhCutCorrelation=new TH2F(*c.fhCutCorrelation);
+
+ for (int i=0; i<kNCuts; i++)
+ for (int j=0; j<kNStepQA; j++)
+ fhQA[i][j]=(TH1F*)c.fhQA[i][j]->Clone();
}
return *this ;
}
// 'obj' must be an AliMCParticle
//
- if (!obj) return kFALSE ;
+ SelectionBitMap(obj);
+
+ if (fIsQAOn) FillHistograms(obj,0);
+
+ for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++)
+ if (!fBitmap->TestBitNumber(icut)) return kFALSE ;
+
+ if (fIsQAOn) FillHistograms(obj,1);
+ return kTRUE;
+}
+
+//__________________________________________________________________________________
+void AliCFParticleGenCuts::SelectionBitMap(TObject* obj)
+{
+ //
+ // test if the track passes the single cuts
+ // and store the information in a bitmap
+ //
+
+ for (UInt_t i=0; i<kNCuts; i++) fBitmap->SetBitNumber(i,kFALSE);
+
+ if (!obj) return ;
TString className(obj->ClassName());
if (className.CompareTo("AliMCParticle") != 0) {
AliError("argument must point to an AliMCParticle !");
- return kFALSE ;
+ return ;
}
AliMCParticle* mcPart = (AliMCParticle*) obj ;
TParticle* part = mcPart->Particle();
- AliStack *stack=fMCInfo->MCEvent()->Stack();
+ AliStack* stack = fMCInfo->Stack();
- // is this particle charged?
- if ( fRequireIsCharged ) {
- if(!IsCharged(mcPart))return kFALSE;
+ Double32_t partVx=(Double32_t)part->Vx();
+ Double32_t partVy=(Double32_t)part->Vy();
+ Double32_t partVz=(Double32_t)part->Vz();
+
+ TParticle* daughter=0x0;
+ Double32_t decayVx=0.;
+ Double32_t decayVy=0.;
+ Double32_t decayVz=0.;
+ Double32_t decayL=0.;
+ Double32_t decayRxy=0.;
+
+ if ( part->GetNDaughters() > 0 ) {
+ daughter = stack->Particle(part->GetFirstDaughter()) ;
+ decayVx=(Double32_t)daughter->Vx();
+ decayVy=(Double32_t)daughter->Vy();
+ decayVz=(Double32_t)daughter->Vz();
+ decayL = TMath::Sqrt(TMath::Power(partVx-decayVx,2) +
+ TMath::Power(partVy-decayVy,2) +
+ TMath::Power(partVz-decayVz,2) ) ;
+ decayRxy = TMath::Sqrt(TMath::Power(decayVx,2) + TMath::Power(decayVy,2) ) ;
+ }
+
+
+ Int_t iCutBit = 0;
+
+ // cut on charge
+ if ( fRequireIsCharged || fRequireIsNeutral ) {
+ if(fRequireIsCharged && IsCharged(mcPart)) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ if(fRequireIsNeutral && !IsCharged(mcPart)) fBitmap->SetBitNumber(iCutBit,kTRUE);
}
+ else fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
- // primary cuts
- if ( fRequireIsPrimary ) {
- if(!IsPrimary(mcPart,stack))return kFALSE;
+ // cut on primary/secondary
+ if ( fRequireIsPrimary || fRequireIsSecondary) {
+ if (fRequireIsPrimary && IsPrimary(mcPart,stack)) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ if (fRequireIsSecondary && !IsPrimary(mcPart,stack)) fBitmap->SetBitNumber(iCutBit,kTRUE);
}
+ else fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
- //secondary cut
- if ( fRequireIsSecondary && part->IsPrimary() ) return kFALSE ;
-
- //PDG code cut
- if ( fRequirePdgCode){
- if(!IsA(mcPart,fPdgCode)) return kFALSE ;
+ // cut on PDG code
+ if ( fRequirePdgCode ){
+ if (IsA(mcPart,fPdgCode,kTRUE)) fBitmap->SetBitNumber(iCutBit,kTRUE);
}
+ else fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+
// production vertex cuts
- Double32_t partVx=(Double32_t)part->Vx();
- Double32_t partVy=(Double32_t)part->Vy();
- Double32_t partVz=(Double32_t)part->Vz();
- if ( partVx < fProdVtxXMin || partVx > fProdVtxXMax ) return kFALSE ;
- if ( partVy < fProdVtxYMin || partVy > fProdVtxYMax ) return kFALSE ;
- if ( partVz < fProdVtxZMin || partVz > fProdVtxZMax ) return kFALSE ;
+ if ( partVx > fProdVtxXMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( partVx < fProdVtxXMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( partVy > fProdVtxYMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( partVy < fProdVtxYMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( partVz > fProdVtxZMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( partVz < fProdVtxZMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+
+ // decay vertex cuts
+ if ( decayVx > fDecayVtxXMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( decayVx < fDecayVtxXMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( decayVy > fDecayVtxYMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( decayVy < fDecayVtxYMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( decayVz > fDecayVtxZMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( decayVz < fDecayVtxZMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
- //decay vertex cuts
- if ( part->GetNDaughters() > 0 ) {
- TParticle* daughter = fMCInfo->MCEvent()->Stack()->Particle(part->GetFirstDaughter()) ;
- Double32_t decayVx=(Double32_t)daughter->Vx();
- Double32_t decayVy=(Double32_t)daughter->Vy();
- Double32_t decayVz=(Double32_t)daughter->Vz();
- if ( decayVx < fDecayVtxXMin || decayVx > fDecayVtxXMax ) return kFALSE ;
- if ( decayVy < fDecayVtxYMin || decayVy > fDecayVtxYMax ) return kFALSE ;
- if ( decayVz < fDecayVtxZMin || decayVz > fDecayVtxZMax ) return kFALSE ;
-
- //decay length cut
- Double32_t decayL = TMath::Sqrt(TMath::Power(partVx-decayVx,2) +
- TMath::Power(partVy-decayVy,2) +
- TMath::Power(partVz-decayVz,2) ) ;
- if (decayL < fDecayLengthMin || decayL > fDecayLengthMax) return kFALSE ;
-
- Double32_t decayRxy = TMath::Sqrt(TMath::Power(decayVx,2) +
- TMath::Power(decayVy,2) ) ;
- if (decayRxy < fDecayRxyMin || decayRxy > fDecayRxyMax) return kFALSE ;
+ // decay length cuts
+ if ( decayL > fDecayLengthMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( decayL < fDecayLengthMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+
+ // transverse decay length cuts
+ if ( decayRxy > fDecayRxyMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+ iCutBit++;
+ if ( decayRxy < fDecayRxyMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
+
+}
+
+//__________________________________________________________________________________
+void AliCFParticleGenCuts::FillHistograms(TObject* obj, Bool_t afterCuts)
+{
+ //
+ // fill the QA histograms
+ //
+
+ for (int iCutNumber = 0; iCutNumber < kNCuts; iCutNumber++)
+ fhQA[iCutNumber][afterCuts]->Fill(fBitmap->TestBitNumber(iCutNumber));
+
+ // fill cut statistics and cut correlation histograms with information from the bitmap
+ if (afterCuts) return;
+
+ // Number of single cuts in this class
+ UInt_t ncuts = fBitmap->GetNbits();
+ for(UInt_t bit=0; bit<ncuts;bit++) {
+ if (!fBitmap->TestBitNumber(bit)) {
+ fhCutStatistics->Fill(bit+1);
+ for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
+ if (!fBitmap->TestBitNumber(bit2))
+ fhCutCorrelation->Fill(bit+1,bit2+1);
+ }
+ }
}
+}
+
+//__________________________________________________________________________________
+void AliCFParticleGenCuts::AddQAHistograms(TList *qaList) {
+ //
+ // saves the histograms in a TList
+ //
+ DefineHistograms();
- return kTRUE ;
+ qaList->Add(fhCutStatistics);
+ qaList->Add(fhCutCorrelation);
+
+ for (Int_t j=0; j<kNStepQA; j++) {
+ for(Int_t i=0; i<kNCuts; i++)
+ qaList->Add(fhQA[i][j]);
+ }
+}
+
+//__________________________________________________________________________________
+void AliCFParticleGenCuts::DefineHistograms() {
+ //
+ // histograms for cut variables, cut statistics and cut correlations
+ //
+ Int_t color = 2;
+
+ // book cut statistics and cut correlation histograms
+ fhCutStatistics = new TH1F(Form("%s_cut_statistics",GetName()),"",kNCuts,0.5,kNCuts+0.5);
+ fhCutStatistics->SetLineWidth(2);
+ int k = 1;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"charge") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"prim/sec") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"PDG") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxXMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxXMax") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxYMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxYMax") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxZMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecZMax") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecXMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecXMax") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecYMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecYMax") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecZMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecZMax") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecLgthMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecLgthMax") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecRxyMin") ; k++;
+ fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecRxyMax") ; k++;
+
+
+ fhCutCorrelation = new TH2F(Form("%s_cut_correlation",GetName()),"",kNCuts,0.5,kNCuts+0.5,kNCuts,0.5,kNCuts+0.5);
+ fhCutCorrelation->SetLineWidth(2);
+ for (k=1; k<=kNCuts; k++) {
+ fhCutCorrelation->GetXaxis()->SetBinLabel(k,fhCutStatistics->GetXaxis()->GetBinLabel(k));
+ fhCutCorrelation->GetYaxis()->SetBinLabel(k,fhCutStatistics->GetXaxis()->GetBinLabel(k));
+ }
+
+ Char_t str[256];
+ for (int i=0; i<kNStepQA; i++) {
+ if (i==0) sprintf(str," ");
+ else sprintf(str,"_cut");
+ fhQA[kCutCharge] [i] = new TH1F(Form("%s_charge%s" ,GetName(),str),"",2,-0.5,1.5);
+ fhQA[kCutPrimSec] [i] = new TH1F(Form("%s_primSec%s" ,GetName(),str),"",2,-0.5,1.5);
+ fhQA[kCutPDGCode] [i] = new TH1F(Form("%s_pdgCode%s" ,GetName(),str),"",10000,-5000,5000);
+ fhQA[kCutProdVtxXMin][i] = new TH1F(Form("%s_prodVtxXMin%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutProdVtxXMax][i] = new TH1F(Form("%s_prodVtxXMax%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutProdVtxYMin][i] = new TH1F(Form("%s_prodVtxYMin%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutProdVtxYMax][i] = new TH1F(Form("%s_prodVtxYMax%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutProdVtxZMin][i] = new TH1F(Form("%s_prodVtxZMin%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutProdVtxZMax][i] = new TH1F(Form("%s_prodVtxZMax%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecVtxXMin] [i] = new TH1F(Form("%s_decVtxXMin%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecVtxXMax] [i] = new TH1F(Form("%s_decVtxXMax%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecVtxYMin] [i] = new TH1F(Form("%s_decVtxYMin%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecVtxYMax] [i] = new TH1F(Form("%s_decVtxYMax%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecVtxZMin] [i] = new TH1F(Form("%s_decVtxZMin%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecVtxZMax] [i] = new TH1F(Form("%s_decVtxZMax%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecLgthMin] [i] = new TH1F(Form("%s_decLengthMin%s",GetName(),str),"",100,0,10);
+ fhQA[kCutDecLgthMax] [i] = new TH1F(Form("%s_decLengthMax%s",GetName(),str),"",100,0,10);
+ fhQA[kCutDecRxyMin] [i] = new TH1F(Form("%s_decRxyMin%s" ,GetName(),str),"",100,0,10);
+ fhQA[kCutDecRxyMax] [i] = new TH1F(Form("%s_decRxyMax%s" ,GetName(),str),"",100,0,10);
+ }
+ for(Int_t i=0; i<kNCuts; i++) fhQA[i][1]->SetLineColor(color);
}
+
+
//______________________________
Bool_t AliCFParticleGenCuts::IsCharged(AliMCParticle *mcPart) {
//
//
TParticle* part = mcPart->Particle();
Int_t pdgCode = part->GetPdgCode();
- if(abs)pdgCode=TMath::Abs(pdgCode);
- if(pdgCode != pdg )return kFALSE;
+ if (abs) pdgCode = TMath::Abs(pdgCode);
+ if (pdgCode != pdg ) return kFALSE;
return kTRUE;
}
//______________________________
-void AliCFParticleGenCuts::SetEvtInfo(TObject* mcInfo) {
+void AliCFParticleGenCuts::SetEvtInfo(TObject* mcEvent) {
//
- // Sets pointer to MC event information (AliMCEventHandler)
+ // Sets pointer to MC event information (AliMCEvent)
//
- if (!mcInfo) {
- AliError("Pointer to MC Event Handler is null !");
+ if (!mcEvent) {
+ AliError("Pointer to MC Event is null !");
return;
}
- TString className(mcInfo->ClassName());
- if (className.CompareTo("AliMCEventHandler") != 0) {
- AliError("argument must point to an AliMCEventHandler !");
+ TString className(mcEvent->ClassName());
+ if (className.CompareTo("AliMCEvent") != 0) {
+ AliError("argument must point to an AliMCEvent !");
return ;
}
- fMCInfo = (AliMCEventHandler*) mcInfo ;
+ fMCInfo = (AliMCEvent*) mcEvent ;
}
#include "AliCFCutBase.h"
-class AliMCEventHandler;
+class AliMCEvent;
class TObject;
class AliMCParticle;
class AliStack;
+class TList;
+class TH1F;
+class TH2F;
+class TBits;
class AliCFParticleGenCuts : public AliCFCutBase
{
virtual ~AliCFParticleGenCuts() { };
virtual Bool_t IsSelected(TObject* obj) ;
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- virtual void SetEvtInfo(TObject* mcInfo) ;
+ virtual void SetEvtInfo(TObject* mcEvent) ;
//static checkers
static Bool_t IsPrimaryCharged(AliMCParticle *mcPart,AliStack*stack);
static Bool_t IsPrimary(AliMCParticle *mcPart,AliStack*stack);
static Bool_t IsCharged(AliMCParticle *mcPart);
static Bool_t IsA(AliMCParticle *mcPart, Int_t pdg, Bool_t abs=kFALSE);
- void SetRequireIsCharged (Bool_t b=kTRUE) {fRequireIsCharged=b;}
- void SetRequireIsPrimary (Bool_t b=kTRUE) {fRequireIsPrimary=b;}
- void SetRequireIsSecondary (Bool_t b=kTRUE) {fRequireIsSecondary=b;}
+ void SetRequireIsCharged () {fRequireIsCharged =kTRUE; fRequireIsNeutral =kFALSE;}
+ void SetRequireIsNeutral () {fRequireIsNeutral =kTRUE; fRequireIsCharged =kFALSE;}
+ void SetRequireIsPrimary () {fRequireIsPrimary =kTRUE; fRequireIsSecondary=kFALSE;}
+ void SetRequireIsSecondary () {fRequireIsSecondary=kTRUE; fRequireIsPrimary =kFALSE;}
void SetRequirePdgCode (Int_t pdg) {fRequirePdgCode=kTRUE; fPdgCode=pdg;}
void SetProdVtxRangeX (Double32_t xmin, Double32_t xmax) {fProdVtxXMin =xmin; fProdVtxXMax =xmax;}
void SetProdVtxRangeY (Double32_t ymin, Double32_t ymax) {fProdVtxYMin =ymin; fProdVtxYMax =ymax;}
void SetDecayLengthRange (Double32_t rmin, Double32_t rmax) {fDecayLengthMin=rmin; fDecayLengthMax=rmax;}
void SetDecayRxyRange (Double32_t rmin, Double32_t rmax) {fDecayRxyMin =rmin; fDecayRxyMax =rmax;}
- protected:
- AliMCEventHandler* fMCInfo ; // pointer to the MC event information
+ enum {
+ kCutCharge, // ischarged cut
+ kCutPrimSec, // isprimary cut
+ kCutPDGCode, // PDG code cut
+ kCutProdVtxXMin, // production vertex cut
+ kCutProdVtxXMax, // production vertex cut
+ kCutProdVtxYMin, // production vertex cut
+ kCutProdVtxYMax, // production vertex cut
+ kCutProdVtxZMin, // production vertex cut
+ kCutProdVtxZMax, // production vertex cut
+ kCutDecVtxXMin, // decay vertex cut
+ kCutDecVtxXMax, // decay vertex cut
+ kCutDecVtxYMin, // decay vertex cut
+ kCutDecVtxYMax, // decay vertex cut
+ kCutDecVtxZMin, // decay vertex cut
+ kCutDecVtxZMax, // decay vertex cut
+ kCutDecLgthMin, // decay length cut
+ kCutDecLgthMax, // decay length cut
+ kCutDecRxyMin, // transverse decay length cut
+ kCutDecRxyMax, // transverse decay length cut
+ kNCuts, // number of single selections
+ kNStepQA=2 // number of QA steps (before/after the cuts)
+ };
+
+ private:
+ AliMCEvent* fMCInfo ; // pointer to the MC event information
Bool_t fRequireIsCharged; // require charged particle
+ Bool_t fRequireIsNeutral; // require neutral particle
Bool_t fRequireIsPrimary; // require primary particle
Bool_t fRequireIsSecondary; // require secondary particle
Bool_t fRequirePdgCode; // require check of the PDG code
Double32_t fDecayRxyMin; // min decay length in transverse plane wrt (0,0,0)
Double32_t fDecayRxyMax; // max decay length in transverse plane wrt (0,0,0)
+ //QA histos
+ TH1F* fhCutStatistics; // Histogram: statistics of what cuts the tracks did not survive
+ TH2F* fhCutCorrelation; // Histogram: 2d statistics plot
+ TH1F* fhQA[kNCuts][kNStepQA]; // QA Histograms
+ TBits* fBitmap ; // stores single selection decisions
+
+ void SelectionBitMap(TObject* obj);
+ void FillHistograms(TObject* obj, Bool_t afterCuts);
+ void AddQAHistograms(TList *qaList) ;
+ void DefineHistograms();
+
ClassDef(AliCFParticleGenCuts,1);
};
else fhCombResp[nn]->Fill(combpid[nn]);
}//fIsQAOn
}//loop on species
- if(sumesdpid > 0) for(Int_t ih = 0; ih < AliPID::kSPECIES; ih++) fhCombProb[ih]->Fill(fPriors[ih]*combpid[ih]/sumesdpid);
+ if(sumesdpid > 0) for(Int_t ih = 0; ih < AliPID::kSPECIES; ih++) {
+ if(!fhCombResp[ih]) AliDebug(1,Form("\n no fhCombResp[%i], check if pidcut->Init() was called \n",ih));
+ else fhCombProb[ih]->Fill(fPriors[ih]*combpid[ih]/sumesdpid);
+ }
else AliDebug(1,"priors or ESDpid are zero, please check them");
}// end no det
for(Int_t n=0; n<AliPID::kSPECIES; n++) {
combpid[n]=fPriors[n]*prod[n]/sum;
if(fIsQAOn) {
- if(!fhCombProb[n]) AliDebug(1,Form("no fhCombRespi[%i] defined, check if pidcut->Init() was called",n));
+ if(!fhCombProb[n]) AliDebug(1,Form("no fhCombProb[%i] defined, check if pidcut->Init() was called",n));
else fhCombProb[n]->Fill(combpid[n]);
}
}
}
}
//______________________________________________
-void AliCFTrackCutPid::Init()
-{
- //
- // initialises QA histograms
- //
-
- if(fIsQAOn) DefineHistograms();
-}
-//_________________________________________________
void AliCFTrackCutPid::DefineHistograms()
{
//
for(Int_t iPart =0; iPart < AliPID::kSPECIES; iPart++)
{
fhCombResp[iPart] = new TH1F(Form("rCombPart%i",iPart),Form(" %s combined response ",partic[iPart]),fNbins,fXmin,fXmax);
+ Printf(Form( "rCombPart%i is booked!!",iPart));
fhCombProb[iPart] = new TH1F(Form("pCombPart%i",iPart),Form("%s combined probability ",partic[iPart]),fNbins,fXmin,fXmax);
+ Printf(Form( "rCombProb%i is booked!!",iPart));
}
}
}
//___________________________________________________
-void AliCFTrackCutPid::AddQAHistograms(TList *qalist) const
+void AliCFTrackCutPid::AddQAHistograms(TList *qalist)
{
//
// adds QA histograms in a TList
//
if(!fIsQAOn) return;
+ DefineHistograms();
if(fgIsComb){
for(Int_t iPart =0; iPart<AliPID::kSPECIES; iPart++){
//main
virtual Bool_t IsSelected(TObject *track);
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- //histo booking
- void Init();
-
//histos are added to a list
- void AddQAHistograms(TList *qalist) const;
+ void AddQAHistograms(TList *qalist);
private:
void SetPPriors(AliESDtrack *pTrk);
ULong_t StatusForAND(ULong_t status[kNdets+1]) const; //
void InitialiseHisto();
- void DefineHistograms();
+ void DefineHistograms(); //histo booking
Bool_t Check(const Double_t *p, Int_t iPsel, Double_t minDiff) const;
void CombPID(ULong_t status[kNdets+1],Double_t pid[kNdets+1][AliPID::kSPECIES],Double_t *combpid) const;
//__________________________________________________________________________________
AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts() :
AliCFCutBase(),
+ fNSigmaToVertex(0),
fNSigmaToVertexMax(0),
fRequireSigmaToVertex(0),
fAcceptKinkDaughters(0),
//__________________________________________________________________________________
AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts(Char_t* name, Char_t* title) :
AliCFCutBase(name,title),
+ fNSigmaToVertex(0),
fNSigmaToVertexMax(0),
fRequireSigmaToVertex(0),
fAcceptKinkDaughters(0),
//__________________________________________________________________________________
AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts(const AliCFTrackIsPrimaryCuts& c) :
AliCFCutBase(c),
+ fNSigmaToVertex(c.fNSigmaToVertex),
fNSigmaToVertexMax(c.fNSigmaToVertexMax),
fRequireSigmaToVertex(c.fRequireSigmaToVertex),
fAcceptKinkDaughters(c.fAcceptKinkDaughters),
//
if (this != &c) {
AliCFCutBase::operator=(c) ;
+ fNSigmaToVertex = c.fNSigmaToVertex ;
fNSigmaToVertexMax = c.fNSigmaToVertexMax ;
fRequireSigmaToVertex = c.fRequireSigmaToVertex ;
fAcceptKinkDaughters = c.fAcceptKinkDaughters ;
//
// sets everything to zero
//
+ fNSigmaToVertex = 0;
fNSigmaToVertexMax = 0;
fRequireSigmaToVertex = 0;
fAcceptKinkDaughters = 0;
TNamed::Copy(c);
}
//____________________________________________________________________
-Float_t AliCFTrackIsPrimaryCuts::GetSigmaToVertex(AliESDtrack* esdTrack) const
+void AliCFTrackIsPrimaryCuts::GetSigmaToVertex(AliESDtrack* esdTrack)
{
//
// Calculates the number of sigma to the vertex.
// It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-x**2)/2)
// Can this be expressed in a different way?
- if (bRes[0] == 0 || bRes[1] ==0)
- return -1;
+ if (bRes[0] == 0 || bRes[1] ==0) {
+ fNSigmaToVertex = -1;
+ return;
+ }
Float_t d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
// stupid rounding problem screws up everything:
// if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
- if (TMath::Exp(-d * d / 2) < 1e-10)
- return 1000;
+ if (TMath::Exp(-d * d / 2) < 1e-10) {
+ fNSigmaToVertex = 1000;
+ return;
+ }
d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
- return d;
-}
-//__________________________________________________________________________________
-void AliCFTrackIsPrimaryCuts::GetBitMap(TObject* obj, TBits *bitmap) {
- //
- // retrieve the pointer to the bitmap
- //
- TBits *bm = SelectionBitMap(obj);
- *bitmap = *bm;
+ fNSigmaToVertex = d;
+ return;
}
//__________________________________________________________________________________
-TBits* AliCFTrackIsPrimaryCuts::SelectionBitMap(TObject* obj)
+void AliCFTrackIsPrimaryCuts::SelectionBitMap(TObject* obj)
{
//
// test if the track passes the single cuts
// bitmap stores the decision of each single cut
for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kFALSE);
- // cast TObject into ESDtrack
+ // check TObject and cast into ESDtrack
+ if (!obj) return;
+ if (!obj->InheritsFrom("AliESDtrack")) AliError("object must derived from AliESDtrack !");
AliESDtrack* esdTrack = dynamic_cast<AliESDtrack *>(obj);
- if ( !esdTrack ) return fBitmap ;
-
- for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kTRUE);
+ if ( !esdTrack ) return;
// get the track to vertex parameter
- Float_t nSigmaToVertex = GetSigmaToVertex(esdTrack);
+ GetSigmaToVertex(esdTrack);
// fill the bitmap
Int_t iCutBit = 0;
- if (nSigmaToVertex > fNSigmaToVertexMax)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (fNSigmaToVertex <= fNSigmaToVertexMax)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (nSigmaToVertex<0 && fRequireSigmaToVertex)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (!fRequireSigmaToVertex || (fNSigmaToVertex>=0 && fRequireSigmaToVertex))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (fAcceptKinkDaughters || (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)<=0))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
- return fBitmap;
+ return;
}
//__________________________________________________________________________________
Bool_t AliCFTrackIsPrimaryCuts::IsSelected(TObject* obj) {
//
// loops over decisions of single cuts and returns if the track is accepted
//
- TBits* bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
+ if (fIsQAOn) FillHistograms(obj,0);
Bool_t isSelected = kTRUE;
- for (UInt_t icut=0; icut<bitmap->GetNbits();icut++)
- if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE;
-
- return isSelected;
-}
-//__________________________________________________________________________________
-void AliCFTrackIsPrimaryCuts::Init() {
- //
- // initialises all histograms and the TList which holds the histograms
- //
- if(fIsQAOn)
- DefineHistograms();
+ for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++) {
+ if(!fBitmap->TestBitNumber(icut)) {
+ isSelected = kFALSE;
+ break;
+ }
+ }
+ if (!isSelected) return kFALSE ;
+ if (fIsQAOn) FillHistograms(obj,1);
+ return kTRUE;
}
//__________________________________________________________________________________
void AliCFTrackIsPrimaryCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
//
// fill the QA histograms
//
- if(!fIsQAOn) return;
// cast TObject into ESDtrack
+ if (!obj) return;
AliESDtrack* esdTrack = dynamic_cast<AliESDtrack *>(obj);
if ( !esdTrack ) return;
- // index = 0: fill histograms before cuts
- // index = 1: fill histograms after cuts
- Int_t index = -1;
- index = ((f) ? 1 : 0);
+ // f = 0: fill histograms before cuts
+ // f = 1: fill histograms after cuts
Float_t b[2];
Float_t bRes[2];
bRes[0] = TMath::Sqrt(bCov[0]);
bRes[1] = TMath::Sqrt(bCov[2]);
- fhQA[kDcaZ][index]->Fill(b[1]);
- fhQA[kDcaXY][index]->Fill(b[0]);
- fhDcaXYvsDcaZ[index]->Fill(b[1],b[0]);
+ fhQA[kDcaZ][f]->Fill(b[1]);
+ fhQA[kDcaXY][f]->Fill(b[0]);
+ fhDcaXYvsDcaZ[f]->Fill(b[1],b[0]);
if (bRes[0]!=0 && bRes[1]!=0) {
- fhQA[kDcaZnorm][index]->Fill(b[1]/bRes[1]);
- fhQA[kDcaXYnorm][index]->Fill(b[0]/bRes[0]);
- fhDcaXYvsDcaZnorm[index]->Fill(b[1]/bRes[1], b[0]/bRes[0]);
+ fhQA[kDcaZnorm][f]->Fill(b[1]/bRes[1]);
+ fhQA[kDcaXYnorm][f]->Fill(b[0]/bRes[0]);
+ fhDcaXYvsDcaZnorm[f]->Fill(b[1]/bRes[1], b[0]/bRes[0]);
}
- // getting the track to vertex parameters
- Float_t nSigmaToVertex = GetSigmaToVertex(esdTrack);
+ fhQA[kCutNSigmaToVertex][f]->Fill(fNSigmaToVertex);
+ if (fNSigmaToVertex<0 && fRequireSigmaToVertex) fhQA[kCutRequireSigmaToVertex][f]->Fill(0.);
+ if (!(fNSigmaToVertex<0 && fRequireSigmaToVertex)) fhQA[kCutRequireSigmaToVertex][f]->Fill(1.);
- fhQA[kCutNSigmaToVertex][index]->Fill(nSigmaToVertex);
- if (nSigmaToVertex<0 && fRequireSigmaToVertex) fhQA[kCutRequireSigmaToVertex][index]->Fill(0.);
- if (!(nSigmaToVertex<0 && fRequireSigmaToVertex)) fhQA[kCutRequireSigmaToVertex][index]->Fill(1.);
-
- if (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0) fhQA[kCutAcceptKinkDaughters][index]->Fill(0.);
- if (!(!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0)) fhQA[kCutAcceptKinkDaughters][index]->Fill(0.);
+ if (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0) fhQA[kCutAcceptKinkDaughters][f]->Fill(0.);
+ if (!(!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0)) fhQA[kCutAcceptKinkDaughters][f]->Fill(0.);
// fill cut statistics and cut correlation histograms with information from the bitmap
if (f) return;
// Get the bitmap of the single cuts
if ( !obj ) return;
- TBits* bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
// Number of single cuts in this class
- UInt_t ncuts = bitmap->GetNbits();
+ UInt_t ncuts = fBitmap->GetNbits();
for(UInt_t bit=0; bit<ncuts;bit++) {
- if (!bitmap->TestBitNumber(bit)) {
+ if (!fBitmap->TestBitNumber(bit)) {
fhCutStatistics->Fill(bit+1);
for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
- if (!bitmap->TestBitNumber(bit2))
+ if (!fBitmap->TestBitNumber(bit2))
fhCutCorrelation->Fill(bit+1,bit2+1);
}
}
canvas4->SaveAs(Form("%s.ps", canvas4->GetName()));
}
//__________________________________________________________________________________
-void AliCFTrackIsPrimaryCuts::AddQAHistograms(TList *qaList) const {
+void AliCFTrackIsPrimaryCuts::AddQAHistograms(TList *qaList) {
//
// saves the histograms in a TList
//
- if(!fIsQAOn) return;
+ DefineHistograms();
qaList->Add(fhCutStatistics);
qaList->Add(fhCutCorrelation);
~AliCFTrackIsPrimaryCuts();
void Copy(TObject &c) const;
- void GetBitMap(TObject* obj, TBits *bitmap);
Bool_t IsSelected(TObject* obj);
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- void Init();
- Float_t GetSigmaToVertex(AliESDtrack* esdTrack) const;
+ void GetSigmaToVertex(AliESDtrack* esdTrack);
// cut value setter
void SetMaxNSigmaToVertex(Double_t sigma=3) {fNSigmaToVertexMax = sigma;}
void SetAcceptKinkDaughters(Bool_t b=kTRUE) {fAcceptKinkDaughters=b;}
// QA histograms
- void FillHistogramsBeforeCuts(TObject* obj) {return FillHistograms(obj,kFALSE);}
- void FillHistogramsAfterCuts(TObject* obj) {return FillHistograms(obj,kTRUE);}
void DrawHistograms();
void SaveHistograms(const Char_t* dir = 0);
- void AddQAHistograms(TList *qaList) const;
+ void AddQAHistograms(TList *qaList);
// QA histogram setter
// please use indices from the enumeration below
void SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins);
};
private:
- TBits* SelectionBitMap(TObject* obj);
+ void SelectionBitMap(TObject* obj);
void DefineHistograms(); // books histograms and TList
void Initialise(); // sets everything to 0
void FillHistograms(TObject* obj, Bool_t b);
// Fills histograms before and after cuts
- Double_t fNSigmaToVertexMax; // max distance to main vertex in units of sigma
+ Double_t fNSigmaToVertex; // track distance to main vertex in units of sigma
+ Double_t fNSigmaToVertexMax; // cut value: max distance to main vertex in units of sigma
Bool_t fRequireSigmaToVertex; // require calculable distance to main vertex
TH2F* fhDcaXYvsDcaZ[2]; // Histogram: dca xy vs. z
TNamed::Copy(c);
}
//__________________________________________________________________________________
-void AliCFTrackKineCuts::GetBitMap(TObject* obj, TBits *bitmap) {
- //
- // retrieve the pointer to the bitmap
- //
- TBits *bm = SelectionBitMap(obj);
- *bitmap = *bm;
-}
-//__________________________________________________________________________________
-TBits* AliCFTrackKineCuts::SelectionBitMap(TObject* obj) {
+void AliCFTrackKineCuts::SelectionBitMap(TObject* obj) {
//
// test if the track passes the single cuts
// and store the information in a bitmap
// bitmap stores the decision of each single cut
for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kFALSE);
- // cast TObject into VParticle
+ // check TObject and cast into VParticle
+ if (!obj) return ;
+ if (!obj->InheritsFrom("AliVParticle")) AliError("object must derived from AliVParticle !");
AliVParticle* particle = dynamic_cast<AliVParticle *>(obj);
- if ( !particle ) return fBitmap ;
-
- for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kTRUE);
+ if ( !particle ) return;
Int_t iCutBit = 0;
- if((particle->P() < fMomentumMin) || (particle->P() > fMomentumMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if((particle->P() >= fMomentumMin) && (particle->P() <= fMomentumMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if ((particle->Pt() < fPtMin) || (particle->Pt() > fPtMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if ((particle->Pt() >= fPtMin) && (particle->Pt() <= fPtMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if ((particle->Px() < fPxMin) || (particle->Px() > fPxMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if ((particle->Px() >= fPxMin) && (particle->Px() <= fPxMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if ((particle->Py() < fPyMin) || (particle->Py() > fPyMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if ((particle->Py() >= fPyMin) && (particle->Py() <= fPyMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if ((particle->Pz() < fPzMin) || (particle->Pz() > fPzMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if ((particle->Pz() >= fPzMin) && (particle->Pz() <= fPzMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if ((particle->Eta() < fEtaMin) || (particle->Eta() > fEtaMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if ((particle->Eta() >= fEtaMin) && (particle->Eta() <= fEtaMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if ((particle->Y() < fRapidityMin) || (particle->Y() > fRapidityMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if ((particle->Y() >= fRapidityMin) && (particle->Y() <= fRapidityMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if ((particle->Phi() < fPhiMin) || (particle->Phi() > fPhiMax))
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if ((particle->Phi() >= fPhiMin) && (particle->Phi() <= fPhiMax))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (fCharge < 10 && particle->Charge() != fCharge)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (fCharge == 10 || (particle->Charge() == fCharge))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (fRequireIsCharged && particle->Charge()==0)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (fRequireIsCharged && particle->Charge()!=0)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
+ if (!fRequireIsCharged)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
- return fBitmap;
+ return;
}
//__________________________________________________________________________________
Bool_t AliCFTrackKineCuts::IsSelected(TObject* obj) {
//
// loops over decisions of single cuts and returns if the track is accepted
//
- TBits* bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
+ if (fIsQAOn) FillHistograms(obj,0);
Bool_t isSelected = kTRUE;
- for (UInt_t icut=0; icut<bitmap->GetNbits();icut++)
- if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE;
-
- return isSelected;
-}
-//__________________________________________________________________________________
-void AliCFTrackKineCuts::Init() {
- //
- // initialises all histograms and the TList which holds the histograms
- //
- if(fIsQAOn)
- DefineHistograms();
+ for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++) {
+ if(!fBitmap->TestBitNumber(icut)) {
+ isSelected = kFALSE;
+ break;
+ }
+ }
+ if (!isSelected) return kFALSE ;
+ if (fIsQAOn) FillHistograms(obj,1);
+ return kTRUE;
}
//__________________________________________________________________________________
void AliCFTrackKineCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
//
// fill the QA histograms
//
- if(!fIsQAOn) return;
// cast TObject into VParticle
+ if (!obj) return;
AliVParticle* particle = dynamic_cast<AliVParticle *>(obj);
if ( !particle ) return;
- // index = 0: fill histograms before cuts
- // index = 1: fill histograms after cuts
- Int_t index = -1;
- index = ((b) ? 1 : 0);
-
- fhQA[kCutP][index]->Fill(particle->P());
- fhQA[kCutPt][index]->Fill(particle->Pt());
- fhQA[kCutPx][index]->Fill(particle->Px());
- fhQA[kCutPy][index]->Fill(particle->Py());
- fhQA[kCutPz][index]->Fill(particle->Pz());
- fhQA[kCutRapidity][index]->Fill(particle->Y());
- fhQA[kCutEta][index]->Fill(particle->Eta());
- fhQA[kCutPhi][index]->Fill(particle->Phi());
- fhQA[kCutCharge][index]->Fill((float)particle->Charge());
+ // b = 0: fill histograms before cuts
+ // b = 1: fill histograms after cuts
+ fhQA[kCutP][b]->Fill(particle->P());
+ fhQA[kCutPt][b]->Fill(particle->Pt());
+ fhQA[kCutPx][b]->Fill(particle->Px());
+ fhQA[kCutPy][b]->Fill(particle->Py());
+ fhQA[kCutPz][b]->Fill(particle->Pz());
+ fhQA[kCutRapidity][b]->Fill(particle->Y());
+ fhQA[kCutEta][b]->Fill(particle->Eta());
+ fhQA[kCutPhi][b]->Fill(particle->Phi());
+ fhQA[kCutCharge][b]->Fill((float)particle->Charge());
// fill cut statistics and cut correlation histograms with information from the bitmap
if (b) return;
- if (!obj) return;
- TBits* bitmap = SelectionBitMap(obj);
-
// Number of single cuts in this class
- UInt_t ncuts = bitmap->GetNbits();
+ UInt_t ncuts = fBitmap->GetNbits();
for(UInt_t bit=0; bit<ncuts;bit++) {
- if (!bitmap->TestBitNumber(bit)) {
- fhCutStatistics->Fill(bit+1);
- for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
- if (!bitmap->TestBitNumber(bit2))
- fhCutCorrelation->Fill(bit+1,bit2+1);
- }
+ if (!fBitmap->TestBitNumber(bit)) {
+ fhCutStatistics->Fill(bit+1);
+ for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
+ if (!fBitmap->TestBitNumber(bit2))
+ fhCutCorrelation->Fill(bit+1,bit2+1);
+ }
}
}
}
canvas3->SaveAs(Form("%s.ps", canvas3->GetName()));
}
//__________________________________________________________________________________
-void AliCFTrackKineCuts::AddQAHistograms(TList *qaList) const {
+void AliCFTrackKineCuts::AddQAHistograms(TList *qaList) {
//
// saves the histograms in a TList
//
- if(!fIsQAOn) return;
+ DefineHistograms();
qaList->Add(fhCutStatistics);
qaList->Add(fhCutCorrelation);
~AliCFTrackKineCuts();
void Copy(TObject &c) const;
- void GetBitMap(TObject* obj, TBits *bitmap);
Bool_t IsSelected(TObject* obj);
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- void Init();
-
// cut value setter
void SetMomentumRange(Double_t momentumMin=0., Double_t momentumMax=1e99) {fMomentumMin=momentumMin; fMomentumMax=momentumMax;}
void SetPtRange(Double_t ptMin=0., Double_t ptMax=1e99) {fPtMin=ptMin; fPtMax=ptMax;}
void SetRequireIsCharged(Bool_t b=kFALSE) {fRequireIsCharged=b;}
// QA histograms
- void FillHistogramsBeforeCuts(TObject* obj) {return FillHistograms(obj,kFALSE);}
- void FillHistogramsAfterCuts(TObject* obj) {return FillHistograms(obj,kTRUE);}
void DrawHistograms(Bool_t drawLogScale=kTRUE);
void SaveHistograms(const Char_t* dir = 0);
- void AddQAHistograms(TList *qaList) const;
+ void AddQAHistograms(TList *qaList);
// QA histogram setter
// please use indices from the enumeration below
void SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins);
};
private:
- TBits* SelectionBitMap(TObject* obj);
+ void SelectionBitMap(TObject* obj);
void DefineHistograms(); // books histograms and TList
void Initialise(); // sets everything to 0
void FillHistograms(TObject* obj, Bool_t b);
TNamed::Copy(c);
}
//__________________________________________________________________________________
-void AliCFTrackQualityCuts::GetBitMap(TObject* obj, TBits *bitmap) {
- //
- // retrieve the pointer to the bitmap
- //
- TBits *bm = SelectionBitMap(obj);
- *bitmap = *bm;
-}
-//__________________________________________________________________________________
-TBits* AliCFTrackQualityCuts::SelectionBitMap(TObject* obj)
+void AliCFTrackQualityCuts::SelectionBitMap(TObject* obj)
{
//
// test if the track passes the single cuts
// bitmap stores the decision of each single cut
for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kFALSE);
- // cast TObject into ESDtrack
+ // check TObject and cast into ESDtrack
+ if (!obj) return ;
+ if (!obj->InheritsFrom("AliESDtrack")) AliError("object must derived from AliESDtrack !");
AliESDtrack* esdTrack = dynamic_cast<AliESDtrack *>(obj);
- if ( !esdTrack ) return fBitmap ;
-
- for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kTRUE);
+ if ( !esdTrack ) return ;
// get cut quantities
Int_t fIdxInt[200];
// fill the bitmap
Int_t iCutBit = 0;
- if (nClustersTPC < fMinNClusterTPC)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (nClustersTPC >= fMinNClusterTPC)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (nClustersITS < fMinNClusterITS)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (nClustersITS >= fMinNClusterITS)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (chi2PerClusterTPC > fMaxChi2PerClusterTPC)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (chi2PerClusterTPC <= fMaxChi2PerClusterTPC)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (chi2PerClusterITS > fMaxChi2PerClusterITS)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (chi2PerClusterITS <= fMaxChi2PerClusterITS)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (fRequireTPCRefit && (esdTrack->GetStatus()&AliESDtrack::kTPCrefit)==0)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (!fRequireTPCRefit || (fRequireTPCRefit && (esdTrack->GetStatus()&AliESDtrack::kTPCrefit)!=0))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (fRequireITSRefit && (esdTrack->GetStatus()&AliESDtrack::kITSrefit)==0)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (!fRequireITSRefit || (fRequireITSRefit && (esdTrack->GetStatus()&AliESDtrack::kITSrefit)!=0))
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (extCov[0] > fCovariance11Max)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (extCov[0] <= fCovariance11Max)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (extCov[2] > fCovariance22Max)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (extCov[2] <= fCovariance22Max)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (extCov[5] > fCovariance33Max)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (extCov[5] <= fCovariance33Max)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (extCov[9] > fCovariance44Max)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (extCov[9] <= fCovariance44Max)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
iCutBit++;
- if (extCov[14] > fCovariance55Max)
- fBitmap->SetBitNumber(iCutBit,kFALSE);
+ if (extCov[14] <= fCovariance55Max)
+ fBitmap->SetBitNumber(iCutBit,kTRUE);
- return fBitmap;
+ return;
}
//__________________________________________________________________________________
Bool_t AliCFTrackQualityCuts::IsSelected(TObject* obj) {
//
// loops over decisions of single cuts and returns if the track is accepted
//
- TBits* bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
+ if (fIsQAOn) FillHistograms(obj,0);
Bool_t isSelected = kTRUE;
- for (UInt_t icut=0; icut<bitmap->GetNbits();icut++)
- if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE;
-
- return isSelected;
-}
-//__________________________________________________________________________________
-void AliCFTrackQualityCuts::Init() {
- //
- // initialises all histograms and the TList which holds the histograms
- //
- if(fIsQAOn)
- DefineHistograms();
+ for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++) {
+ if(!fBitmap->TestBitNumber(icut)) {
+ isSelected = kFALSE;
+ break;
+ }
+ }
+ if (!isSelected) return kFALSE ;
+ if (fIsQAOn) FillHistograms(obj,1);
+ return kTRUE;
}
//__________________________________________________________________________________
void AliCFTrackQualityCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
//
// fill the QA histograms
//
- if(!fIsQAOn) return;
// cast TObject into ESDtrack
+ if (!obj) return;
AliESDtrack* esdTrack = dynamic_cast<AliESDtrack *>(obj);
if ( !esdTrack ) return;
- // index = 0: fill histograms before cuts
- // index = 1: fill histograms after cuts
- Int_t index = -1;
- index = ((b) ? 1 : 0);
+ // b = 0: fill histograms before cuts
+ // b = 1: fill histograms after cuts
Int_t fIdxInt[200];
Int_t nClustersTPC = esdTrack->GetTPCclusters(fIdxInt);
- fhQA[kCutClusterTPC][index]->Fill((float)nClustersTPC);
+ fhQA[kCutClusterTPC][b]->Fill((float)nClustersTPC);
Float_t chi2PerClusterTPC = -1.;
if (nClustersTPC!=0)
chi2PerClusterTPC = esdTrack->GetTPCchi2()/((float)nClustersTPC);
- fhQA[kCutChi2TPC][index]->Fill(chi2PerClusterTPC);
+ fhQA[kCutChi2TPC][b]->Fill(chi2PerClusterTPC);
Int_t nClustersITS = esdTrack->GetITSclusters(fIdxInt);
- fhQA[kCutClusterITS][index]->Fill((float)nClustersITS);
+ fhQA[kCutClusterITS][b]->Fill((float)nClustersITS);
Float_t chi2PerClusterITS = -1.;
if (nClustersITS!=0)
chi2PerClusterITS = esdTrack->GetITSchi2()/((float)nClustersITS);
- fhQA[kCutChi2ITS][index]->Fill(chi2PerClusterITS);
+ fhQA[kCutChi2ITS][b]->Fill(chi2PerClusterITS);
if ((esdTrack->GetStatus()&AliESDtrack::kTPCrefit)==0)
- fhQA[kCutRefitTPC][index]->Fill(0.);
+ fhQA[kCutRefitTPC][b]->Fill(0.);
if (!((esdTrack->GetStatus()&AliESDtrack::kTPCrefit)==0))
- fhQA[kCutRefitTPC][index]->Fill(1.);
+ fhQA[kCutRefitTPC][b]->Fill(1.);
if ((esdTrack->GetStatus()&AliESDtrack::kITSrefit)==0)
- fhQA[kCutRefitITS][index]->Fill(0.);
+ fhQA[kCutRefitITS][b]->Fill(0.);
if (!((esdTrack->GetStatus()&AliESDtrack::kITSrefit)==0))
- fhQA[kCutRefitITS][index]->Fill(1.);
+ fhQA[kCutRefitITS][b]->Fill(1.);
Double_t extCov[15];
esdTrack->GetExternalCovariance(extCov);
- fhQA[kCutCovElement11][index]->Fill(extCov[0]);
- fhQA[kCutCovElement22][index]->Fill(extCov[2]);
- fhQA[kCutCovElement33][index]->Fill(extCov[5]);
- fhQA[kCutCovElement44][index]->Fill(extCov[9]);
- fhQA[kCutCovElement55][index]->Fill(extCov[14]);
+ fhQA[kCutCovElement11][b]->Fill(extCov[0]);
+ fhQA[kCutCovElement22][b]->Fill(extCov[2]);
+ fhQA[kCutCovElement33][b]->Fill(extCov[5]);
+ fhQA[kCutCovElement44][b]->Fill(extCov[9]);
+ fhQA[kCutCovElement55][b]->Fill(extCov[14]);
// fill cut statistics and cut correlation histograms with information from the bitmap
if (b) return;
// Get the bitmap of the single cuts
if ( !obj ) return;
- TBits* bitmap = SelectionBitMap(obj);
+ SelectionBitMap(obj);
// Number of single cuts in this class
- UInt_t ncuts = bitmap->GetNbits();
+ UInt_t ncuts = fBitmap->GetNbits();
for(UInt_t bit=0; bit<ncuts;bit++) {
- if (!bitmap->TestBitNumber(bit)) {
+ if (!fBitmap->TestBitNumber(bit)) {
fhCutStatistics->Fill(bit+1);
for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
- if (!bitmap->TestBitNumber(bit2))
+ if (!fBitmap->TestBitNumber(bit2))
fhCutCorrelation->Fill(bit+1,bit2+1);
}
}
canvas3->SaveAs(Form("%s.ps", canvas3->GetName()));
}
//__________________________________________________________________________________
-void AliCFTrackQualityCuts::AddQAHistograms(TList *qaList) const {
+void AliCFTrackQualityCuts::AddQAHistograms(TList *qaList) {
//
// saves the histograms in a TList
//
- if(!fIsQAOn) return;
+ DefineHistograms();
qaList->Add(fhCutStatistics);
qaList->Add(fhCutCorrelation);
~AliCFTrackQualityCuts();
void Copy(TObject &c) const;
- void GetBitMap(TObject* obj, TBits *bitmap) ;
Bool_t IsSelected(TObject* obj);
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
- void Init();
// cut value setter
void SetMinNClusterTPC(Int_t cluster=-1) {fMinNClusterTPC = cluster;}
{fCovariance11Max=c1;fCovariance22Max=c2;fCovariance33Max=c3;fCovariance44Max=c4;fCovariance55Max=c5;}
// QA histograms
- void FillHistogramsBeforeCuts(TObject* obj) {return FillHistograms(obj,kFALSE);}
- void FillHistogramsAfterCuts(TObject* obj) {return FillHistograms(obj,kTRUE);}
void DrawHistograms(Bool_t drawLogScale=kTRUE);
void SaveHistograms(const Char_t* dir = 0);
- void AddQAHistograms(TList *qaList) const;
+ void AddQAHistograms(TList *qaList);
// QA histogram setter
// please use indices from the enumeration below
void SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins);
};
private:
- TBits* SelectionBitMap(TObject* obj);
+ void SelectionBitMap(TObject* obj);
void DefineHistograms(); // books histograms and TList
void Initialise(); // sets everything to 0
void FillHistograms(TObject* obj, Bool_t b);
AliCFV0TopoCuts (const AliCFV0TopoCuts& c) ;
AliCFV0TopoCuts& operator=(const AliCFV0TopoCuts& c) ;
virtual ~AliCFV0TopoCuts() { } ;
- virtual Bool_t IsSelected(TObject* v0) ;
+ Bool_t IsSelected(TObject* v0) ;
Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
void SetMaxDcaDaughters (Double32_t dca) {fMaxDcaDaughters = dca;}
void SetMinDcaNeg (Double32_t dca) {fMinDcaNeg = dca;}