/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ // Cut on the Event at reconstructed level: for the moment // the requirements on the number of charged tracks and on // the vertex position and resolution are implemented // The argument of IsSelected member function (passed object) is cast into // an AliESDEvent. In the future may be modified to use AliVEvent interface // and include more cut variables. // The class derives from AliCFCutBase // Author:S.Arcelli Silvia.Arcelli@cern.ch // // #include "TH1F.h" #include "TList.h" #include "TBits.h" #include "AliLog.h" #include "AliESDEvent.h" #include "AliESDVertex.h" #include "AliAODEvent.h" #include "AliAODVertex.h" #include "AliHFEextraEventCuts.h" ClassImp(AliHFEextraEventCuts) //____________________________________________________________________ AliHFEextraEventCuts::AliHFEextraEventCuts() : AliCFCutBase(), fRequireVtxCuts(kFALSE), fVtxZMax(1.e99), fVtxZMin(-1.e99), fVtxNCtrbMin(0), fVtxMixed(0), fVtxSPD(0), fCheckCorrelationSPDVtx(0), fBitMap(0x0) { // //ctor // } //____________________________________________________________________ AliHFEextraEventCuts::AliHFEextraEventCuts(Char_t* name, Char_t* title) : AliCFCutBase(name,title), fRequireVtxCuts(kFALSE), fVtxZMax(1.e99), fVtxZMin(-1.e99), fVtxNCtrbMin(0), fVtxMixed(0), fVtxSPD(0), fCheckCorrelationSPDVtx(0), fBitMap(0x0) { // //ctor // fBitMap=new TBits(0); Initialise(); } //____________________________________________________________________ AliHFEextraEventCuts::AliHFEextraEventCuts(const AliHFEextraEventCuts& c) : AliCFCutBase(c), fRequireVtxCuts(c.fRequireVtxCuts), fVtxZMax(c.fVtxZMax), fVtxZMin(c.fVtxZMin), fVtxNCtrbMin(c.fVtxNCtrbMin), fVtxMixed(c.fVtxMixed), fVtxSPD(c.fVtxSPD), fCheckCorrelationSPDVtx(c.fCheckCorrelationSPDVtx), fBitMap(c.fBitMap) { // //copy constructor // for (Int_t i=0; iClone(); } } } //____________________________________________________________________ AliHFEextraEventCuts::~AliHFEextraEventCuts() { // //dtor // for (Int_t i=0; iClone(); } } return *this ; } //____________________________________________________________________ Bool_t AliHFEextraEventCuts::IsSelected(TObject* obj) { // //Check if the requested cuts are passed // SelectionBitMap(obj); if (fIsQAOn) FillHistograms(obj,0); Bool_t isSelected = kTRUE; for (UInt_t icut=0; icutGetNbits();icut++) if(!fBitMap->TestBitNumber(icut)) isSelected = kFALSE; if (!isSelected) return kFALSE ; if (fIsQAOn) FillHistograms(obj,1); return kTRUE; } //____________________________________________________________________ void AliHFEextraEventCuts::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;jSetBitNumber(j,kFALSE); AliESDEvent* esd = dynamic_cast(obj); AliAODEvent* aod = dynamic_cast(obj); // ESD if ( esd ) { //now start checking the cuts, //first assume the event will be accepted: for(Int_t j=0;jSetBitNumber(j,kTRUE); if(fRequireVtxCuts){ const AliESDVertex* vtxESD = 0x0; if (fVtxMixed) { vtxESD = esd->GetPrimaryVertexTracks() ; if((!vtxESD) || (vtxESD->GetNContributors() <= 0)) { vtxESD = esd->GetPrimaryVertexSPD() ; if((!vtxESD) || (vtxESD->GetNContributors() <= 0)) { for(Int_t j=1;jSetBitNumber(j,kFALSE); AliWarning("Cannot get vertex, skipping event"); return; } } } else if(fVtxSPD) { vtxESD = esd->GetPrimaryVertexSPD() ; if(fCheckCorrelationSPDVtx) { const AliESDVertex* vtxESDtr = esd->GetPrimaryVertexTracks(); if((vtxESD) && (vtxESD->GetNContributors() > 0) && (vtxESDtr) && (vtxESDtr->GetNContributors() > 0)) { if(TMath::Abs(vtxESD->GetZv()-vtxESDtr->GetZv())>0.5) return; } else return; } } else { vtxESD = esd->GetPrimaryVertexTracks() ; } if(!vtxESD){ for(Int_t j=1;jSetBitNumber(j,kFALSE); AliWarning("Cannot get vertex, skipping event"); return; } // Pick up the position and uncertainties Double_t vtxPos[3]; vtxPos[0] = vtxESD->GetXv(); vtxPos[1] = vtxESD->GetYv(); vtxPos[2] = vtxESD->GetZv(); Int_t nCtrb = vtxESD->GetNContributors(); // Apply the cut if (vtxPos[2]>fVtxZMax || vtxPos[2]SetBitNumber(0,kFALSE); if (nCtrbSetBitNumber(1,kFALSE); } return; } // // AOD if ( aod ) { //now start checking the cuts, //first assume the event will be accepted: for(Int_t j=0;jSetBitNumber(j,kTRUE); if(fRequireVtxCuts){ const AliAODVertex* vtxAOD = 0x0; if (fVtxMixed) { vtxAOD = aod->GetPrimaryVertex(); if((!vtxAOD) || (vtxAOD->GetNContributors() <= 0)) { vtxAOD = aod->GetPrimaryVertexSPD() ; if((!vtxAOD) || (vtxAOD->GetNContributors() <= 0)) { for(Int_t j=1;jSetBitNumber(j,kFALSE); AliWarning("Cannot get vertex, skipping event"); return; } } } else if(fVtxSPD) { vtxAOD = aod->GetPrimaryVertexSPD() ; if(fCheckCorrelationSPDVtx) { const AliAODVertex* vtxAODtr = aod->GetPrimaryVertex(); if((vtxAOD) && (vtxAOD->GetNContributors() > 0) && (vtxAODtr) && (vtxAODtr->GetNContributors() > 0)) { if(TMath::Abs(vtxAOD->GetZ()-vtxAODtr->GetZ())>0.5) return; } else return; } } else { vtxAOD = aod->GetPrimaryVertex() ; } if(!vtxAOD){ for(Int_t j=1;jSetBitNumber(j,kFALSE); AliWarning("Cannot get vertex, skipping event"); return; } // Pick up the position and uncertainties Double_t vtxPos[3]; vtxPos[0] = vtxAOD->GetX(); vtxPos[1] = vtxAOD->GetY(); vtxPos[2] = vtxAOD->GetZ(); Int_t nCtrb = vtxAOD->GetNContributors(); //printf("AliHFEextraCuts:: %d, %f, %f, %f\n",nCtrb,vtxPos[0],vtxPos[1],vtxPos[2]); // Apply the cut if (vtxPos[2]>fVtxZMax || vtxPos[2]SetBitNumber(0,kFALSE); if (nCtrbSetBitNumber(1,kFALSE); } return; } return; } //_____________________________________________________________________________ void AliHFEextraEventCuts::FillHistograms(TObject* obj, Bool_t b) { // // fill the QA histograms // if(!fIsQAOn) return; // cast TObject into VParticle AliESDEvent* esd = dynamic_cast(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 vertex parameters: const AliESDVertex* vtxESD = 0x0; if (fVtxMixed) { vtxESD = esd->GetPrimaryVertexTracks() ; if((!vtxESD) || (vtxESD->GetNContributors() <= 0)) { vtxESD = esd->GetPrimaryVertexSPD() ; if((!vtxESD) || (vtxESD->GetNContributors() <= 0)) { return; } } } else { vtxESD = esd->GetPrimaryVertexTracks() ; } if(!vtxESD)return; // vertex position and uncertainties fhQA[kVtxPosZ] [index]->Fill(vtxESD->GetZv()); fhQA[kVtxNCtrb][index]->Fill(vtxESD->GetNContributors()); } //____________________________________________________________________ void AliHFEextraEventCuts::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;iGetXaxis()->Set(nbins,bins); } } //____________________________________________________________________ void AliHFEextraEventCuts::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;iGetXaxis()->Set(nbins,xmin,xmax); } } //_____________________________________________________________________________ void AliHFEextraEventCuts::DefineHistograms() { // // histograms for cut variables // Int_t color = 2; if(!fIsQAOn) { AliInfo(Form("No QA histos requested, Please first set the QA flag on!")); return; } // book QA histograms Char_t str[5]; for (Int_t i=0; iSetXTitle("Vertex Position Z (cm)"); fhQA[kVtxNCtrb][i] ->SetXTitle("Number of contributors"); } for(Int_t i=0; iSetLineColor(color); } //_____________________________________________________________________________ void AliHFEextraEventCuts::AddQAHistograms(TList *qaList) { // // saves the histograms in a TList // DefineHistograms(); for (Int_t j=0; jAdd(fhQA[i][j]); } }