move of class to other lib and an added method to add flow
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Apr 2010 13:49:58 +0000 (13:49 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Apr 2010 13:49:58 +0000 (13:49 +0000)
PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx
PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.h
PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx
PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.h
PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx [moved from PWG2/FLOW/AliFlowCommon/AliFlowEvent.cxx with 94% similarity]
PWG2/FLOW/AliFlowTasks/AliFlowEvent.h [moved from PWG2/FLOW/AliFlowCommon/AliFlowEvent.h with 94% similarity]
PWG2/PWG2flowCommonLinkDef.h
PWG2/PWG2flowTasksLinkDef.h
PWG2/libPWG2flowCommon.pkg
PWG2/libPWG2flowTasks.pkg

index 34932ac..ce58e14 100644 (file)
@@ -75,7 +75,7 @@ AliFlowEventSimple::AliFlowEventSimple(Int_t aLenght):
 //-----------------------------------------------------------------------
 AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent):
   TObject(),
-  fTrackCollection(anEvent.fTrackCollection),
+  fTrackCollection(NULL),
   fNumberOfTracks(anEvent.fNumberOfTracks),
   fEventNSelTracksRP(anEvent.fEventNSelTracksRP),
   fMCReactionPlaneAngle(anEvent.fMCReactionPlaneAngle),
@@ -85,13 +85,15 @@ AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent):
   fMCReactionPlaneAngleWrap(anEvent.fMCReactionPlaneAngleWrap)
 {
   //copy constructor
+  fTrackCollection = (TObjArray*)anEvent.Clone(); //deep copy
 }
 
 //-----------------------------------------------------------------------
 AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent)
 {
-  if (!fTrackCollection) fTrackCollection = new TObjArray();
-  *fTrackCollection = *anEvent.fTrackCollection ;
+  //assignment operator
+  delete fTrackCollection;
+  fTrackCollection = (TObjArray*)anEvent.Clone(); //deep copy
   fNumberOfTracks = anEvent.fNumberOfTracks;
   fEventNSelTracksRP = anEvent.fEventNSelTracksRP;
   fMCReactionPlaneAngle = anEvent.fMCReactionPlaneAngle;
@@ -99,7 +101,6 @@ AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEv
   fNumberOfTracksWrap = anEvent.fNumberOfTracksWrap;
   fEventNSelTracksRPWrap = anEvent.fEventNSelTracksRPWrap;
   fMCReactionPlaneAngleWrap=anEvent.fMCReactionPlaneAngleWrap;
-
   return *this;
 }
 
@@ -119,7 +120,7 @@ AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
 {
   //get track i from collection
   if (i>=fNumberOfTracks) return NULL;
-  AliFlowTrackSimple* pTrack = static_cast<AliFlowTrackSimple*>(TrackCollection()->At(i)) ;
+  AliFlowTrackSimple* pTrack = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)) ;
   return pTrack;
 }
 
@@ -193,7 +194,7 @@ AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePh
   // loop over tracks
   for(Int_t i=0; i<fNumberOfTracks; i++)
   {
-    pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i);
+    pTrack = (AliFlowTrackSimple*)fTrackCollection->At(i);
     if(pTrack)
     {
       if(pTrack->InRPSelection())
@@ -306,7 +307,7 @@ void AliFlowEventSimple::Get2Qsub(AliFlowVector* Qarray, Int_t n, TList *weights
     // loop over tracks
     for(Int_t i=0; i<fNumberOfTracks; i++)
     {
-      pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i);
+      pTrack = (AliFlowTrackSimple*)fTrackCollection->At(i);
       if(pTrack)
       {
         if(pTrack->InRPSelection())
@@ -451,8 +452,7 @@ AliFlowEventSimple::AliFlowEventSimple( TTree* inputTree,
         iSelParticlesPOI++;
       }
       //adding a particles which were used either for int. or diff. flow to the list
-      fTrackCollection->Add(pTrack);
-      fNumberOfTracks++;
+      AddTrack(pTrack);
     }
   }//for i
   delete pParticle;
@@ -468,9 +468,7 @@ void AliFlowEventSimple::CloneTracks(Int_t n)
     {
       AliFlowTrackSimple* track = dynamic_cast<AliFlowTrackSimple*>(fTrackCollection->At(itrack));
       if (!track) continue;
-      fTrackCollection->Add(new AliFlowTrackSimple(*track));
-      fNumberOfTracks++;
-
+      AddTrack(new AliFlowTrackSimple(*track));
     }
   }
 }
@@ -482,7 +480,31 @@ void AliFlowEventSimple::ResolutionPt(Double_t res)
   for (Int_t i=0; i<fNumberOfTracks; i++)
   {
     AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
-    if (!track) continue;
-    track->ResolutionPt(res);
+    if (track) track->ResolutionPt(res);
   }
 }
+
+//_____________________________________________________________________________
+void AliFlowEventSimple::SubeventsInEta(Double_t etaMinA, Double_t etaMaxA, Double_t etaMinB, Double_t etaMaxB )
+{
+  //Flag two subevents in given eta ranges
+  for (Int_t i=0; i<fNumberOfTracks; i++)
+  {
+    AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
+    Double_t eta=track->Eta();
+    if (eta >= etaMinA && eta <= etaMaxA) track->SetForSubevent(0);
+    if (eta >= etaMinB && eta <= etaMaxB) track->SetForSubevent(1);
+  }
+}
+
+//_____________________________________________________________________________
+void AliFlowEventSimple::AddFlow(Double_t flow)
+{
+  //add flow to all tracks wrt the reaction plane angle
+  for (Int_t i=0; i<fNumberOfTracks; i++)
+  {
+    AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
+    if (track) track->AddFlow(flow, fMCReactionPlaneAngle);
+  }
+}
+
index a260013..322eab0 100644 (file)
@@ -37,23 +37,27 @@ class AliFlowEventSimple: public TObject {
   void    Print(Option_t* option = "") const;      //method to print stats
   
   Int_t    NumberOfTracks() const                   { return fNumberOfTracks; }
-  void     SetNumberOfTracks(Int_t nr)              { fNumberOfTracks = nr; }
   Int_t    GetEventNSelTracksRP() const             { return fEventNSelTracksRP; } 
   void     SetEventNSelTracksRP(Int_t nr)           { fEventNSelTracksRP = nr; }  
   Double_t GetMCReactionPlaneAngle() const          { return fMCReactionPlaneAngle; }
   void     SetMCReactionPlaneAngle(Double_t fPhiRP) { fMCReactionPlaneAngle=fPhiRP; fMCReactionPlaneAngleIsSet=kTRUE; }
+  Bool_t   IsSetMCReactionPlaneAngle() const        { return fMCReactionPlaneAngleIsSet; }
 
   void ResolutionPt(Double_t res);
-
   void CloneTracks(Int_t n);
+  void SubeventsInEta(Double_t etaMinA, Double_t etaMaxA, Double_t etaMinB, Double_t etaMaxB );
+  void AddFlow( Double_t flow );
  
   AliFlowTrackSimple* GetTrack(Int_t i);
   void AddTrack( AliFlowTrackSimple* track ); 
-  TObjArray* TrackCollection() const                { return fTrackCollection; } //deprecated!
  
   AliFlowVector GetQ(Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE);
   void Get2Qsub(AliFlowVector* Qarray, Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE);  
 
+  //these should go away!!!!
+  TObjArray* TrackCollection() const                { return fTrackCollection; } //deprecated!
+  void     SetNumberOfTracks(Int_t nr)              { fNumberOfTracks = nr; }
+
  protected:
   TObjArray*              fTrackCollection;           // collection of tracks
   Int_t                   fNumberOfTracks;            // number of tracks
index 69766fe..df345dd 100644 (file)
@@ -75,7 +75,6 @@ AliFlowTrackSimple& AliFlowTrackSimple::operator=(const AliFlowTrackSimple& aTra
   fSubEventBits = aTrack.fSubEventBits;
 
   return *this;
-
 }
 
 
@@ -88,10 +87,10 @@ AliFlowTrackSimple::~AliFlowTrackSimple()
 }
 
 //----------------------------------------------------------------------- 
-void AliFlowTrackSimple::AddFlow( Double_t flow, Double_t planeAngle )
+void AliFlowTrackSimple::AddFlow( Double_t flow, Double_t reactionPlaneAngle )
 {
   //add flow wrt the eventplane
-  fPhi -= flow*TMath::Sin(2*(fPhi-planeAngle));
+  fPhi -= flow*TMath::Sin(2*(fPhi-reactionPlaneAngle));
 }
 
 //----------------------------------------------------------------------- 
index 04f68f5..be1613a 100644 (file)
@@ -45,7 +45,7 @@ class AliFlowTrackSimple: public TNamed {
   
   void ResolutionPt(Double_t resolution);
 
-  void AddFlow( Double_t flow, Double_t planeAngle);
+  void AddFlow( Double_t flow, Double_t reactionPlaneAngle);
     
  private:
   Double_t fEta;    // eta
similarity index 94%
rename from PWG2/FLOW/AliFlowCommon/AliFlowEvent.cxx
rename to PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx
index 8ec917f..1ce65f5 100644 (file)
@@ -82,16 +82,19 @@ void AliFlowEvent::SetMCReactionPlaneAngle(const AliMCEvent* mcEvent)
       }
     }
   }
+  //GEVSIM
   else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"GeVSim header"))   //returns 0 if matches
   {
     AliGenGeVSimEventHeader* headerG = dynamic_cast<AliGenGeVSimEventHeader*>(mcEvent->GenEventHeader());
     if (headerG) AliFlowEventSimple::SetMCReactionPlaneAngle( headerG->GetEventPlane() );
   }
+  //HIJING
   else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Hijing"))   //returns 0 if matches
   {
     AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
     if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
   }
+  //EPOS
   else if (!strcmp(mcEvent->GenEventHeader()->GetName(),"EPOS"))
   {
     AliGenEposEventHeader* headerE = dynamic_cast<AliGenEposEventHeader*>(mcEvent->GenEventHeader());
@@ -132,12 +135,12 @@ AliFlowEvent::AliFlowEvent( const AliMCEvent* anInput,
       pTrack->SetPhi(pParticle->Phi());
       pTrack->SetPt(pParticle->Pt());
 
-      if (rpOK)
+      if (rpOK && intCFManager)
       {
         pTrack->SetForRPSelection(kTRUE);
         fEventNSelTracksRP++;
       }
-      if (poiOK)
+      if (poiOK && diffCFManager)
       {
         pTrack->SetForPOISelection(kTRUE);
       }
@@ -181,13 +184,13 @@ AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
     pTrack->SetPhi(pParticle->Phi() );
 
     //marking the particles used for int. flow:
-    if(rpOK)
+    if(rpOK && intCFManager)
     {
       pTrack->SetForRPSelection(kTRUE);
       fEventNSelTracksRP++;
     }
     //marking the particles used for diff. flow:
-    if(poiOK)
+    if(poiOK && diffCFManager)
     {
       pTrack->SetForPOISelection(kTRUE);
     }
@@ -228,12 +231,12 @@ AliFlowEvent::AliFlowEvent( const AliAODEvent* anInput,
       pTrack->SetEta(pParticle->Eta() );
       pTrack->SetPhi(pParticle->Phi() );
 
-      if (rpOK)
+      if (rpOK && intCFManager)
       {
         pTrack->SetForRPSelection(kTRUE);
         fEventNSelTracksRP++;
       }
-      if (poiOK)
+      if (poiOK && diffCFManager)
       {
         pTrack->SetForPOISelection(kTRUE);
       }
@@ -270,15 +273,15 @@ AliFlowEvent::AliFlowEvent( const AliAODEvent* anInput,
 //-----------------------------------------------------------------------
 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
                             const AliMCEvent* anInputMc,
-                            Int_t anOption,
+                            KineSource anOption,
                             const AliCFManager* intCFManager,
                             const AliCFManager* diffCFManager ):
   AliFlowEventSimple(20)
 {
   //fills the event with tracks from the ESD and kinematics from the MC info via the track label
-  if (!(anOption ==0 || anOption ==1))
+  if (anOption==kNoKine)
   {
-    cout<<"WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
+    cout<<"WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, KineSource anOption)"<<endl;
     exit(1);
   }
 
@@ -308,7 +311,7 @@ AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
       Bool_t poiOK = kTRUE;
       if (intCFManager && diffCFManager)
       {
-      if(anOption == 0)
+      if(anOption == kESDkine)
       {
         //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
         if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
@@ -318,7 +321,7 @@ AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
             diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
           poiOK=kTRUE;
       }
-      else if (anOption == 1)
+      else if (anOption == kMCkine)
       {
         //cout<<"take the PID and kinematics from the MC"<<endl;
         if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
@@ -332,13 +335,13 @@ AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
 
       //make new AliFlowTrackSimple
       AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
-      if(anOption == 0)   //take the PID from the MC & the kinematics from the ESD
+      if(anOption == kESDkine)   //take the PID from the MC & the kinematics from the ESD
       {
         pTrack->SetPt(pParticle->Pt() );
         pTrack->SetEta(pParticle->Eta() );
         pTrack->SetPhi(pParticle->Phi() );
       }
-      else if (anOption == 1)   //take the PID and kinematics from the MC
+      else if (anOption == kMCkine)   //take the PID and kinematics from the MC
       {
         pTrack->SetPt(pMcParticle->Pt() );
         pTrack->SetEta(pMcParticle->Eta() );
@@ -349,12 +352,12 @@ AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
         cout<<"Not a valid option"<<endl;
       }
 
-      if (rpOK)
+      if (rpOK && intCFManager)
       {
         fEventNSelTracksRP++;
         pTrack->SetForRPSelection();
       }
-      if (poiOK) pTrack->SetForPOISelection();
+      if (poiOK && diffCFManager) pTrack->SetForPOISelection();
 
       AddTrack(pTrack);
     }
similarity index 94%
rename from PWG2/FLOW/AliFlowCommon/AliFlowEvent.h
rename to PWG2/FLOW/AliFlowTasks/AliFlowEvent.h
index 0373b1f..614926e 100644 (file)
@@ -23,6 +23,9 @@ class AliAODEvent;
 
 class AliFlowEvent: public AliFlowEventSimple {
 public:
+
+  enum KineSource { kNoKine, kESDkine, kMCkine };
+
   AliFlowEvent();
   AliFlowEvent(const AliFlowEvent& event);
   AliFlowEvent& operator=(const AliFlowEvent& event);
@@ -39,7 +42,7 @@ public:
                 const AliCFManager* poiCFManager=NULL );  //use CF(2x)
   AliFlowEvent( const AliESDEvent* anInput, 
                 const AliMCEvent* anInputMc, 
-                Int_t anOption=-1,
+                KineSource anOption=kNoKine,
                 const AliCFManager* rpCFManager=NULL, 
                 const AliCFManager* poiCFManager=NULL );  //use CF(2x)
 
index a8d638b..699d8a5 100644 (file)
@@ -10,7 +10,6 @@
 
 #pragma link C++ class AliFlowVector+;
 #pragma link C++ class AliFlowTrackSimple+;
-#pragma link C++ class AliFlowEvent+;
 #pragma link C++ class AliFlowEventSimple+;
 
 #pragma link C++ class AliFlowTrackSimpleCuts+;
index b2397fe..647ed67 100644 (file)
@@ -4,6 +4,7 @@
 #pragma link off all classes;
 #pragma link off all functions;
 
+#pragma link C++ class AliFlowEvent+;
 #pragma link C++ class AliFlowEventSimpleMaker+;
 
 #pragma link C++ class AliAnalysisTaskScalarProduct+;
index e0f7e63..655be1f 100644 (file)
@@ -1,7 +1,6 @@
 #-*- Mode: Makefile -*-
 
-SRCS= FLOW/AliFlowCommon/AliFlowEvent.cxx \
-      FLOW/AliFlowCommon/AliFlowEventSimple.cxx \
+SRCS= FLOW/AliFlowCommon/AliFlowEventSimple.cxx \
       FLOW/AliFlowCommon/AliFlowTrackSimple.cxx \
       FLOW/AliFlowCommon/AliFlowTrackSimpleCuts.cxx \
       FLOW/AliFlowCommon/AliFlowVector.cxx \
index 9102b1e..af4a3e9 100644 (file)
@@ -1,6 +1,7 @@
 #-*- Mode: Makefile -*-
 
 SRCS= FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx \
+      FLOW/AliFlowTasks/AliFlowEvent.cxx \
       FLOW/AliFlowTasks/AliAnalysisTaskScalarProduct.cxx \
       FLOW/AliFlowTasks/AliAnalysisTaskMCEventPlane.cxx \
       FLOW/AliFlowTasks/AliAnalysisTaskLYZEventPlane.cxx \