/************************************************************************** * 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 "AliCFEventRecCuts.h" ClassImp(AliCFEventRecCuts) //____________________________________________________________________ AliCFEventRecCuts::AliCFEventRecCuts() : AliCFCutBase(), fNTracksMin(-1), fNTracksMax(1000000), fRequireVtxCuts(kFALSE), fVtxXMax(1.e99), fVtxYMax(1.e99), fVtxZMax(1.e99), fVtxXMin(-1.e99), fVtxYMin(-1.e99), fVtxZMin(-1.e99), 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) { // //ctor // fBitMap=new TBits(0); Initialise(); } //____________________________________________________________________ AliCFEventRecCuts::AliCFEventRecCuts(Char_t* name, Char_t* title) : AliCFCutBase(name,title), fNTracksMin(-1), fNTracksMax(1000000), fRequireVtxCuts(kFALSE), fVtxXMax(1.e99), fVtxYMax(1.e99), fVtxZMax(1.e99), fVtxXMin(-1.e99), fVtxYMin(-1.e99), fVtxZMin(-1.e99), 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) { // //ctor // fBitMap=new TBits(0); Initialise(); } //____________________________________________________________________ AliCFEventRecCuts::AliCFEventRecCuts(const AliCFEventRecCuts& c) : AliCFCutBase(c), fNTracksMin(c.fNTracksMin), fNTracksMax(c.fNTracksMax), fRequireVtxCuts(c.fRequireVtxCuts), fVtxXMax(c.fVtxXMax), fVtxYMax(c.fVtxYMax), fVtxZMax(c.fVtxZMax), fVtxXMin(c.fVtxXMin), fVtxYMin(c.fVtxYMin), fVtxZMin(c.fVtxZMin), 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) { // //copy constructor // for (Int_t i=0; iClone(); } } } //____________________________________________________________________ AliCFEventRecCuts::~AliCFEventRecCuts() { // //dtor // for (Int_t i=0; iClone(); } } return *this ; } //____________________________________________________________________ Bool_t AliCFEventRecCuts::IsSelected(TObject* obj) { // //Check if the requested cuts are passed // TBits *bitmap = SelectionBitMap(obj); Bool_t isSelected = kTRUE; for (UInt_t icut=0; icutGetNbits();icut++) if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE; return isSelected; } //____________________________________________________________________ TBits *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;jSetBitNumber(j,kFALSE); AliESDEvent* esd = dynamic_cast(obj); if ( !esd ) return fBitMap ; //now start checking the cuts, //first assume the event will be accepted: for(Int_t j=0;jSetBitNumber(j,kTRUE); //Number of charged tracks: Int_t nTracks = esd->GetNumberOfTracks(); if(nTracksfNTracksMax) fBitMap->SetBitNumber(0,kFALSE); if(fRequireVtxCuts){ const AliESDVertex* vtxESD = esd->GetVertex(); if(!vtxESD){ for(Int_t j=1;jSetBitNumber(j,kFALSE); return fBitMap; } // 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;jSetBitNumber(j,kFALSE); return fBitMap; } // Pick up the position and uncertainties Double_t vtxPos[3]; vtxPos[0] = vtxESD->GetXv(); vtxPos[1] = vtxESD->GetYv(); vtxPos[2] = vtxESD->GetZv(); Double_t vtxRes[3]; vtxRes[0] = vtxESD->GetXRes(); vtxRes[1] = vtxESD->GetYRes(); vtxRes[2] = vtxESD->GetZRes(); // Apply the cut if (vtxPos[0]>fVtxXMax || vtxPos[0]SetBitNumber(1,kFALSE); if (vtxPos[1]>fVtxYMax || vtxPos[1]SetBitNumber(2,kFALSE); if (vtxPos[2]>fVtxZMax || vtxPos[2]SetBitNumber(3,kFALSE); if (vtxRes[0]==0 || vtxRes[0]>fVtxXResMax) fBitMap->SetBitNumber(4,kFALSE); if (vtxRes[1]==0 || vtxRes[1]>fVtxYResMax) fBitMap->SetBitNumber(5,kFALSE); 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); } //_____________________________________________________________________________ void AliCFEventRecCuts::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); //number of charged tracks: Int_t nTracks = esd->GetNumberOfTracks(); fhQA[kNTracks][index]->Fill(nTracks); //look at vertex parameters: const AliESDVertex* vtxESD = esd->GetVertex(); if(!vtxESD)return; // Require the vertex to have been reconstructed successfully if (strcmp(vtxESD->GetName(), "default")==0)return; // vertex position and uncertainties fhQA[kVtxPosX][index]->Fill(vtxESD->GetXv()); fhQA[kVtxPosY][index]->Fill(vtxESD->GetYv()); fhQA[kVtxPosZ][index]->Fill(vtxESD->GetZv()); fhQA[kVtxResX][index]->Fill(vtxESD->GetXRes()); fhQA[kVtxResY][index]->Fill(vtxESD->GetYRes()); fhQA[kVtxResZ][index]->Fill(vtxESD->GetZRes()); } //_____________________________________________________________________________ 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 // switch(index){ case kNTracks: fhNBinsNTracks=nbins+1; fhBinLimNTracks=new Double_t[nbins+1]; for(Int_t i=0;iSetXTitle("Number of ESD tracks"); fhQA[kVtxPosX][i] ->SetXTitle("Vertex Position X (cm)"); fhQA[kVtxPosY][i] ->SetXTitle("Vertex Position Y (cm)"); fhQA[kVtxPosZ][i] ->SetXTitle("Vertex Position Z (cm)"); fhQA[kVtxResX][i] ->SetXTitle("Vertex Resolution X (cm)"); fhQA[kVtxResY][i] ->SetXTitle("Vertex Resolution Y (cm)"); fhQA[kVtxResZ][i] ->SetXTitle("Vertex Resolution Z (cm)"); } for(Int_t i=0; iSetLineColor(color); } //_____________________________________________________________________________ void AliCFEventRecCuts::AddQAHistograms(TList *list) const { // // saves the histograms in a TList // if(!fIsQAOn) return; for (Int_t j=0; jAdd(fhQA[i][j]); } }