1 /*************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////
17 // Dielectron TrackRotator //
26 ///////////////////////////////////////////////////////////////////////////
30 #include <TObjArray.h>
32 #include <AliVTrack.h>
34 #include "AliDielectronHelper.h"
36 #include "AliDielectronTrackRotator.h"
38 ClassImp(AliDielectronTrackRotator)
40 AliDielectronTrackRotator::AliDielectronTrackRotator() :
43 fRotationType(kRotateBothRandom),
44 fStartAnglePhi(TMath::Pi()),
45 fConeAnglePhi(TMath::Pi()/6.),
60 // Default Constructor
65 //______________________________________________
66 AliDielectronTrackRotator::AliDielectronTrackRotator(const char* name, const char* title) :
69 fRotationType(kRotateBothRandom),
70 fStartAnglePhi(TMath::Pi()),
71 fConeAnglePhi(TMath::Pi()/6.),
91 //______________________________________________
92 AliDielectronTrackRotator::~AliDielectronTrackRotator()
100 //______________________________________________
101 void AliDielectronTrackRotator::Reset()
104 // Reset the current iterators
111 //______________________________________________
112 Bool_t AliDielectronTrackRotator::NextCombination()
115 // Perform track rotation of the tracks in the track arrays as long as there are possible combinations
117 if (!fkArrTracksP || !fkArrTracksP) {
122 Int_t nP=fkArrTracksP->GetEntriesFast();
123 Int_t nN=fkArrTracksN->GetEntriesFast();
129 if (fCurrentIteration==fIterations){
134 if (fCurrentTackP==nP){
139 if (fCurrentTackN==nN){
144 if (!RotateTracks()){
153 //______________________________________________
154 Bool_t AliDielectronTrackRotator::RotateTracks()
157 // Actual track rotation
158 // Find out particle type and perform the rotation
161 AliVTrack *trackP=dynamic_cast<AliVTrack*>(fkArrTracksP->UncheckedAt(fCurrentTackP));
162 AliVTrack *trackN=dynamic_cast<AliVTrack*>(fkArrTracksN->UncheckedAt(fCurrentTackN));
163 fTrackP.Initialize();
164 fTrackN.Initialize();
167 if (!trackP||!trackN) return kFALSE;
168 fTrackP+=AliKFParticle(*trackP,fPdgLeg1);
169 fTrackN+=AliKFParticle(*trackN,fPdgLeg2);
174 Double_t angle = fStartAnglePhi+(2*gRandom->Rndm()-1)*fConeAnglePhi;
175 Int_t charge = TMath::Nint(gRandom->Rndm());
177 if (fRotationType==kRotatePositive||(fRotationType==kRotateBothRandom&&charge==0)){
178 AliDielectronHelper::RotateKFParticle(&fTrackP, angle, fEvent);
181 if (fRotationType==kRotateNegative||(fRotationType==kRotateBothRandom&&charge==1)){
182 AliDielectronHelper::RotateKFParticle(&fTrackN, angle, fEvent);