1 //////////////////////////////////////////////////////////////////////
3 // The macro allows to make all needed cuts on V0 particles and //
4 // to remove from the V0Collection particles which share //
5 // at least one of their daughters with accepted ones using lower //
6 // DCA to primary vertex of V0 as the criterion. //
8 // Author: Dominik Arominski //
9 // Email: dominik.arominski@cern.ch //
11 //////////////////////////////////////////////////////////////////////
13 #include "AliFemtoV0SharedDaughterCut.h"
15 AliFemtoV0SharedDaughterCut::AliFemtoV0SharedDaughterCut() { }
16 AliFemtoV0SharedDaughterCut::~AliFemtoV0SharedDaughterCut() { }
18 AliFemtoV0Collection AliFemtoV0SharedDaughterCut::AliFemtoV0SharedDaughterCutCollection(AliFemtoV0Collection *V0Collection,
19 AliFemtoV0Cut *pCut) {
21 Int_t collectionSize = V0Collection->size(); //determination of collection size
22 Int_t positionInCollection=0; //used to iterate inside the collection
23 Int_t count_pass=0; //used to indicate how many V0s are accepted at the moment
24 Int_t *IdPosArray = new Int_t[collectionSize]; //used to determine if there is more than one pretendent for one daughter ID
25 Int_t *IdNegArray = new Int_t[collectionSize]; //same as above
26 Double_t *dcaToPrimVertex = new Double_t[collectionSize]; //used to discriminate between pretendents using DCA to primary vertex
27 bool acceptV0 = false; //used to determine if particle should be pushed to the collection
28 AliFemtoV0Collection V0CorrectedCollection; //collection to be returned
30 AliFemtoV0* pParticle;
31 AliFemtoV0Iterator iterator;
32 AliFemtoV0Iterator start = V0Collection->begin();
33 AliFemtoV0Iterator end = V0Collection->end();
35 for (iterator=start;iterator!=end;iterator++){
36 pParticle = *iterator;
37 bool tmpPassV0 = pCut->Pass(pParticle);
38 // it is not certain if particle which passed all the cuts will stay in the collection but if it fails - it fails for sure
39 pCut->FillCutMonitor(pParticle,tmpPassV0);
41 acceptV0=true; //it stays true if there are no conflicts
42 IdPosArray[count_pass] = pParticle->IdPos(); //id array of positive V0's daughters
43 IdNegArray[count_pass] = pParticle->IdNeg(); //id array of negative V0's daughters
44 dcaToPrimVertex[count_pass] = pParticle->DcaV0ToPrimVertex(); //array of corresponding values of V0's DCA to primary vertex
46 for(Int_t ii=0; ii<count_pass; ii++) { //used to check if in collection are already V0s with these daughters' IDs
47 if( (IdPosArray[count_pass]==IdPosArray[ii]) || (IdNegArray[count_pass]==IdNegArray[ii]) ) {
48 //checking if any of the new V0 daughters doesn't have the same ID value as particles already in the set
49 if(dcaToPrimVertex[count_pass] < dcaToPrimVertex[ii]) { //checking if new V0 is better than the old one
50 //if true there is a need to remove worse particle from the collection
51 for(AliFemtoV0Iterator iter=V0CorrectedCollection.begin(); iter!=V0CorrectedCollection.end(); iter++ ) {
52 if(positionInCollection==ii) {
53 V0CorrectedCollection.insert(iter, 1, pParticle); //inserting new better V0
54 V0CorrectedCollection.erase(iter); //removing old V0
55 IdPosArray[ii] = IdPosArray[count_pass]; //update of positive daughter's ID
56 IdNegArray[ii] = IdNegArray[count_pass]; //update of negative daughter's ID
57 dcaToPrimVertex[ii] = dcaToPrimVertex[count_pass]; //update of V0's DCA to primary vertex
60 positionInCollection++;
62 positionInCollection=0;
64 acceptV0=false; //conflict found - we don't need to change anything(worse DCA) or change has been already done
68 if(acceptV0) { //if there are no problems with the particle it is added to the collection
69 V0CorrectedCollection.push_back(pParticle); //finally particle is added to collection
70 count_pass++; //particle accepted so number of particles increases
78 delete [] dcaToPrimVertex;
80 return V0CorrectedCollection;