allow to cut on multiplicity
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Jun 2009 18:22:55 +0000 (18:22 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Jun 2009 18:22:55 +0000 (18:22 +0000)
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h
PWG2/FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEventSimpleMaker.h
PWG2/FLOW/macros/AddTaskFlow.C

index e719a1a..67c48f4 100644 (file)
 * provided "as is" without express or implied warranty.                  * 
 **************************************************************************/
 
+////////////////////////////////////////////////////
+// AliAnalysisTaskFlowEvent:
+//
+// analysis task for filling the flow event
+// from MCEvent, ESD, AOD ....
+// and put it in an output stream so it can 
+// be used by the various flow analysis methods 
+// for cuts the correction framework is used
+// which also outputs QA histograms to view
+// the effects of the cuts
+////////////////////////////////////////////////////
+
+
 #include "Riostream.h" //needed as include
 #include "TChain.h"
 #include "TTree.h"
@@ -48,16 +61,6 @@ class AliAnalysisTask;
 
 #include "AliAnalysisTaskFlowEvent.h"
 
-// AliAnalysisTaskFlowEvent:
-//
-// analysis task for filling the flow event
-// from MCEvent, ESD, AOD ....
-// and put it in an output stream so it can 
-// be used by the various flow analysis methods 
-// for cuts the correction framework is used
-// which also outputs QA histrograms to view
-// the effects of the cuts
-
 
 ClassImp(AliAnalysisTaskFlowEvent)
   
@@ -69,6 +72,8 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on)
   fAOD(NULL),
   fEventMaker(NULL),
   fAnalysisType("ESD"),
+  fMinMult(0),
+  fMaxMult(10000000),
   fCFManager1(NULL),
   fCFManager2(NULL),
   fQAInt(NULL),
@@ -87,7 +92,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on)
     DefineOutput(1, TList::Class());
     DefineOutput(2, TList::Class()); }  
   // and for testing open an output file
-  //  fOutputFile = new TFile("FlowEvents.root","RECREATE");
+  // fOutputFile = new TFile("FlowEvents.root","RECREATE");
 
 }
 
@@ -98,6 +103,8 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent() :
   fAOD(NULL),
   fEventMaker(NULL),
   fAnalysisType("ESD"),
+  fMinMult(0),
+  fMaxMult(10000000),
   fCFManager1(NULL),
   fCFManager2(NULL),
   fQAInt(NULL),
@@ -182,6 +189,7 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
   if (eventHandler) {
     mcEvent = eventHandler->MCEvent();
     if (mcEvent) {
+      //cout<<mcEvent-> GenEventHeader()->GetName()<<endl; //TEST
       //COCKTAIL with HIJING
       if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) { //returns 0 if matches
        AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader()); 
@@ -191,7 +199,7 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
            AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0)); 
            if (hdh) {
              fRP = hdh->ReactionPlaneAngle();
-             //cout<<"The reactionPlane from Hijing is: "<< fRP <<endl;
+             //cout<<"The reactionPlane from Cocktail + Hijing is: "<< fRP <<endl; 
            }
          }
        }
@@ -216,7 +224,7 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
        //else { cout<<"headerH is NULL"<<endl; }
       }
     }
-    //else {cout<<"No MC event!"<<endl; }
+    else {cout<<"No MC event!"<<endl; } //TEST
     
   }
   //else {cout<<"No eventHandler!"<<endl; }
@@ -238,6 +246,8 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
 
     // analysis 
     Printf("Number of MC particles: %d", mcEvent->GetNumberOfTracks());
+    fEventMaker->SetMinMult(fMinMult);
+    fEventMaker->SetMaxMult(fMaxMult);
     fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2);
     // here we have the fEvent and want to make it available as an output stream
     // so no delete fEvent;
@@ -251,6 +261,8 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
     Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
     
     // analysis 
+    fEventMaker->SetMinMult(fMinMult);
+    fEventMaker->SetMaxMult(fMaxMult);
     fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
   }
   // Fill the FlowEventSimple for ESD input combined with MC info  
@@ -265,7 +277,8 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
     fCFManager1->SetEventInfo(mcEvent);
     fCFManager2->SetEventInfo(mcEvent);
 
-
+    fEventMaker->SetMinMult(fMinMult);
+    fEventMaker->SetMaxMult(fMaxMult);
     if (fAnalysisType == "ESDMC0") { 
       fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 0); //0 = kine from ESD, 1 = kine from MC
     } else if (fAnalysisType == "ESDMC1") {
@@ -278,6 +291,8 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
     Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
 
     // analysis 
+    fEventMaker->SetMinMult(fMinMult);
+    fEventMaker->SetMaxMult(fMaxMult);
     //For the moment don't use CF //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD,fCFManager1,fCFManager2);
     fEvent = fEventMaker->FillTracks(fAOD);
   }
index eeb4c5e..5f2754a 100644 (file)
@@ -2,13 +2,16 @@
 * See cxx source for full Copyright notice */
 /* $Id: $ */
 
-#ifndef AliAnalysisTaskFlowEvent_H
-#define AliAnalysisTaskFlowEvent_H
-
+//////////////////////////////////////////////////////
 // AliAnalysisTaskFlowEvent:
-// analysis task to fill the flow event and make it available to the methods
+// analysis task to fill the flow event 
+// and make it available to the flow analysis methods.
+//////////////////////////////////////////////////////
 
 
+#ifndef AliAnalysisTaskFlowEvent_H
+#define AliAnalysisTaskFlowEvent_H
+
 class AliESDEvent;
 class AliAODEvent;
 class AliCFManager;
@@ -29,8 +32,14 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTask {
   virtual void   Exec(Option_t *option);
   virtual void   Terminate(Option_t *);
 
-  void SetAnalysisType(TString type) { this->fAnalysisType = type; }
-  TString GetAnalysisType() const    { return this->fAnalysisType; }
+  void    SetAnalysisType(TString type){ this->fAnalysisType = type; }
+  TString GetAnalysisType() const      { return this->fAnalysisType; }
+
+  void    SetMinMult(Int_t multmin)    {this->fMinMult = multmin; }
+  Int_t   GetMinMult() const           {return this->fMinMult; }
+  void    SetMaxMult(Int_t multmax)    {this->fMaxMult = multmax; }
+  Int_t   GetMaxMult() const           {return this->fMaxMult; }
+
 
   void          SetCFManager1(AliCFManager* cfmgr) {this->fCFManager1 = cfmgr; } 
   AliCFManager* GetCFManager1()           {return this->fCFManager1; }
@@ -53,12 +62,13 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTask {
   AliAODEvent*  fAOD;                     // AOD object
   AliFlowEventSimpleMaker* fEventMaker;   // FlowEventSimple maker object
   TString       fAnalysisType;            // can be MC, ESD or AOD
+  Int_t         fMinMult;                 // Minimum multiplicity from tracks selected using CORRFW
+  Int_t         fMaxMult;                 // Maximum multiplicity from tracks selected using CORRFW
   AliCFManager* fCFManager1;              // correction framework manager
   AliCFManager* fCFManager2;              // correction framework manager
   TList*        fQAInt;                   // QA histogram list
   TList*        fQADiff;                  // QA histogram list
-
-  Bool_t fQA;                             // flag to set the filling of the QA hostograms
+  Bool_t        fQA;                      // flag to set the filling of the QA hostograms
 
   ClassDef(AliAnalysisTaskFlowEvent, 1); // example of analysis
 };
index ba2fa50..372f596 100644 (file)
@@ -48,7 +48,9 @@ AliFlowEventSimpleMaker::AliFlowEventSimpleMaker() :
   fCount(0),
   fNoOfLoops(1),
   fEllipticFlowValue(0.),
-  fMultiplicityOfEvent(1000000000)
+  fMultiplicityOfEvent(1000000000),
+  fMinMult(0),
+  fMaxMult(1000000000)
 {
   //constructor
 }
@@ -60,6 +62,388 @@ AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
 }
 
 //-----------------------------------------------------------------------   
+AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
+{
+  //Fills the event from the MC kinematic information
+  
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+
+  if (iNumberOfInputTracks==-1) {
+    cout<<"Skipping Event -- No MC information available for this event"<<endl;
+    return 0;
+  }
+
+  Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
+  Int_t iGoodTracks = 0;           //number of good tracks
+  Int_t itrkN = 0;                 //track counter
+  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
+  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
+
+  // cut on the multiplicity
+  if (intCFManager->CheckEventCuts(AliCFManager::kEvtGenCuts,anInput)) {
+    // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
+    // create an AliFlowEventSimple
+    AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+       
+    //loop over tracks
+    while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
+      //get input particle
+      AliMCParticle* pParticle = anInput->GetTrack(itrkN);   
+      //make new AliFlowTrackSimple
+      AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+      pTrack->SetPt(pParticle->Pt() );
+      pTrack->SetEta(pParticle->Eta() );
+      pTrack->SetPhi(pParticle->Phi() );
+    
+      //check if pParticle passes the cuts
+      if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
+       pTrack->SetForRPSelection(kTRUE);
+       //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl; 
+      }
+      if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
+       pTrack->SetForPOISelection(kTRUE);
+       //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl; 
+      }
+      
+      //check if any bits are set
+      TBits bFlowBits = pTrack->GetFlowBits();
+      if (bFlowBits.CountBits() ==0) {
+       delete pTrack; } //track will not be used anymore
+      else {
+       pEvent->TrackCollection()->Add(pTrack) ; 
+       iGoodTracks++;
+
+       if (pTrack->InRPSelection())
+         { iSelParticlesRP++; }
+       if (pTrack->InPOISelection())
+         { iSelParticlesPOI++; }
+      }
+      
+      itrkN++; 
+    }
+    
+    pEvent-> SetEventNSelTracksRP(iSelParticlesRP);  
+    pEvent-> SetNumberOfTracks(iGoodTracks);
+    pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
+        
+    if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) { 
+      if ( (++fCount % 100) == 0) {
+       if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
+       else cout<<" MC Reaction Plane Angle = unknown "<< endl;
+       cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+       cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
+       cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
+       cout << "# " << fCount << " events processed" << endl;
+      }
+      return pEvent;
+    }
+    else { 
+      cout<<"Not enough tracks in the FlowEventSimple"<<endl;
+      return 0;
+    }
+  }
+  else {
+    cout<<"Event does not pass multiplicity cuts"<<endl; 
+    return 0;
+  }
+  
+}
+
+//-----------------------------------------------------------------------   
+AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
+{
+  //Fills the event from the ESD
+  
+  //flags for particles passing int. and diff. flow cuts
+  Bool_t bPassedRPFlowCuts  = kFALSE;
+  Bool_t bPassedPOIFlowCuts = kFALSE;
+  
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+  
+  Int_t iGoodTracks = 0;           //number of good tracks
+  Int_t itrkN = 0;                 //track counter
+  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
+  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
+  
+  // cut on the multiplicity
+  if (intCFManager->CheckEventCuts(AliCFManager::kEvtRecCuts,anInput)) {
+    // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl; 
+    // create an AliFlowEventSimple
+    AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+
+    //loop over tracks
+    while (itrkN < iNumberOfInputTracks) {
+      AliESDtrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
+      
+      //check if pParticle passes the cuts
+      if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) && 
+         intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
+       bPassedRPFlowCuts = kTRUE;
+      }
+      if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) && 
+         diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
+       bPassedPOIFlowCuts = kTRUE;
+      }
+      
+      if (bPassedRPFlowCuts || bPassedPOIFlowCuts) {
+       //make new AliFLowTrackSimple
+       AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+       pTrack->SetPt(pParticle->Pt() );
+       pTrack->SetEta(pParticle->Eta() );
+       pTrack->SetPhi(pParticle->Phi() );
+       
+       //marking the particles used for int. flow:
+       if(bPassedRPFlowCuts) {  
+         pTrack->SetForRPSelection(kTRUE);
+         iSelParticlesRP++;
+       }
+       //marking the particles used for diff. flow:
+       if(bPassedPOIFlowCuts) {
+         pTrack->SetForPOISelection(kTRUE);
+         iSelParticlesPOI++;
+       }
+       //adding a particles which were used either for int. or diff. flow to the list
+       pEvent->TrackCollection()->Add(pTrack);
+       iGoodTracks++;
+      }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts) 
+      itrkN++; 
+      bPassedRPFlowCuts  = kFALSE;
+      bPassedPOIFlowCuts = kFALSE;
+    }//end of while (itrkN < iNumberOfInputTracks)
+    
+    pEvent->SetEventNSelTracksRP(iSelParticlesRP);  
+    pEvent->SetNumberOfTracks(iGoodTracks);
+    pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
+    
+    
+    if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) { 
+      if ( (++fCount % 100) == 0) {
+       if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
+       else cout<<" MC Reaction Plane Angle = unknown "<< endl;
+       cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+       cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
+       cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
+       cout << "# " << fCount << " events processed" << endl;
+      }
+      return pEvent;
+    }
+    else {
+      cout<<"Not enough tracks in the FlowEventSimple"<<endl;
+      return 0;
+    }
+  }
+  else {
+    cout<<"Event does not pass multiplicity cuts"<<endl; 
+    return 0;
+  }
+  
+}
+
+//-----------------------------------------------------------------------   
+AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput,  AliCFManager* intCFManager, AliCFManager* diffCFManager)
+{
+  //Fills the event from the AOD
+  
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+  
+  Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
+  Int_t iGoodTracks = 0;           //number of good tracks
+  Int_t itrkN = 0;                 //track counter
+  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
+  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
+
+  // cut on the multiplicity
+  if (intCFManager->CheckEventCuts(AliCFManager::kEvtRecCuts,anInput)) {
+    // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl; 
+    // create an AliFlowEventSimple
+    AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+
+    //loop over tracks
+    while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
+      AliAODTrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
+      //make new AliFlowTrackSimple
+      AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+      pTrack->SetPt(pParticle->Pt() );
+      pTrack->SetEta(pParticle->Eta() );
+      pTrack->SetPhi(pParticle->Phi() );
+      
+      //check if pParticle passes the cuts
+      if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
+         intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {          
+       pTrack->SetForRPSelection(kTRUE); }
+      if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
+         diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
+       pTrack->SetForPOISelection(kTRUE);}     
+      
+      
+      //check if any bits are set
+      TBits bFlowBits = pTrack->GetFlowBits();
+      if (bFlowBits.CountBits() ==0) {
+       delete pTrack; } //track will not be used anymore
+      else {
+       pEvent->TrackCollection()->Add(pTrack) ; 
+       iGoodTracks++;
+       
+       if (pTrack->InRPSelection())
+         { iSelParticlesRP++; }
+       if (pTrack->InPOISelection())
+         { iSelParticlesPOI++; }
+       
+      }
+      
+      itrkN++; 
+    }
+    
+    pEvent-> SetEventNSelTracksRP(iSelParticlesRP);  
+    pEvent->SetNumberOfTracks(iGoodTracks);
+    pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
+    
+    if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) { 
+      if ( (++fCount % 100) == 0) {
+       if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
+       else cout<<" MC Reaction Plane Angle = unknown "<< endl;
+       cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+       cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
+       cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
+       cout << "# " << fCount << " events processed" << endl;
+      }
+      return pEvent;
+    }
+    else {
+      cout<<"Not enough tracks in the FlowEventSimple"<<endl;
+      return 0;
+    }
+  }
+  else {
+    cout<<"Event does not pass multiplicity cuts"<<endl; 
+    return 0;
+  }
+  
+}
+
+//-----------------------------------------------------------------------   
+AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
+{
+  //fills the event with tracks from the ESD and kinematics from the MC info via the track label
+
+  
+  if (!(anOption ==0 || anOption ==1)) {
+    cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
+    exit(1);
+  }
+
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+
+  Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
+  if (iNumberOfInputTracksMC==-1) {
+    cout<<"Skipping Event -- No MC information available for this event"<<endl;
+    return 0;
+  }
+
+  Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
+  Int_t iGoodTracks = 0;           //number of good tracks
+  Int_t itrkN = 0;                 //track counter
+  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
+  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
+
+  // cut on the multiplicity
+  if (intCFManager->CheckEventCuts(AliCFManager::kEvtRecCuts,anInput)) {
+    // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl; 
+    // create an AliFlowEventSimple
+    AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+
+    //loop over ESD tracks
+    while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
+      AliESDtrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
+      //get Label
+      Int_t iLabel = pParticle->GetLabel();
+      //match to mc particle
+      AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
+      
+      //check
+      if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<"  "<<pMcParticle->Label()<<endl;
+      
+      //make new AliFlowTrackSimple
+      AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+      if(anOption == 0) { //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
+       pTrack->SetPt(pMcParticle->Pt() );
+       pTrack->SetEta(pMcParticle->Eta() );
+       pTrack->SetPhi(pMcParticle->Phi() );
+      }
+      else { cout<<"Not a valid option"<<endl; }
+      
+      //check if pParticle passes the cuts
+      if(anOption == 0) { 
+       //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
+       if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") && 
+           intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {  
+         pTrack->SetForRPSelection(kTRUE); }
+       if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
+           diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {  
+         pTrack->SetForPOISelection(kTRUE);}
+      }
+      else if (anOption == 1) { 
+       //cout<<"take the PID and kinematics from the MC"<<endl;
+       if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {  
+         pTrack->SetForRPSelection(kTRUE); }
+       if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {  
+         pTrack->SetForPOISelection(kTRUE);}
+      }
+      else { cout<<"Not a valid option"<<endl; }
+      
+      //check if any bits are set
+      TBits bFlowBits = pTrack->GetFlowBits();
+      if (bFlowBits.CountBits() ==0) {
+       delete pTrack; } //track will not be used anymore
+      else {
+       pEvent->TrackCollection()->Add(pTrack) ; 
+       iGoodTracks++;  
+       
+       if (pTrack->InRPSelection())
+         { iSelParticlesRP++; }
+       if (pTrack->InPOISelection())
+         { iSelParticlesPOI++; }
+       
+      }
+      
+      itrkN++; 
+    }
+    
+    pEvent->SetEventNSelTracksRP(iSelParticlesRP);  
+    pEvent->SetNumberOfTracks(iGoodTracks);
+    pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
+        
+    if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) { 
+      if ( (++fCount % 100) == 0) {
+       if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
+       else cout<<" MC Reaction Plane Angle = unknown "<< endl;
+       cout << " Number of MC input tracks = " << iNumberOfInputTracksMC << endl;
+       cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+       cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
+       cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
+       cout << "# " << fCount << " events processed" << endl;
+      }
+      return pEvent;
+    }
+    else {
+      cout<<"Not enough tracks in the FlowEventSimple"<<endl;
+      return 0;
+    }
+  }
+  else {
+    cout<<"Event does not pass multiplicity cuts"<<endl; 
+    return 0;
+  }
+    
+}
+
+//local methods
+//-----------------------------------------------------------------------   
 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* rpCuts, AliFlowTrackSimpleCuts* poiCuts)
 {
   //fills the event from a TTree of kinematic.root files
@@ -249,83 +633,6 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
 
 }
 
-
-//-----------------------------------------------------------------------   
-AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
-{
-  //Fills the event from the MC kinematic information
-  
-  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
-
-  if (iNumberOfInputTracks==-1) {
-    cout<<"Skipping Event -- No MC information available for this event"<<endl;
-    return 0;
-  }
-
-  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
-    
-  Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
-  Int_t iGoodTracks = 0;           //number of good tracks
-  Int_t itrkN = 0;                 //track counter
-  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
-  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
-
-   
-  //normal loop
-  while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
-    //get input particle
-    AliMCParticle* pParticle = anInput->GetTrack(itrkN);   
-    //make new AliFlowTrackSimple
-    AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
-    pTrack->SetPt(pParticle->Pt() );
-    pTrack->SetEta(pParticle->Eta() );
-    pTrack->SetPhi(pParticle->Phi() );
-
-    //check if pParticle passes the cuts
-    if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
-      pTrack->SetForRPSelection(kTRUE);
-      //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl; 
-    }
-    if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
-      pTrack->SetForPOISelection(kTRUE);
-      //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl; 
-    }
-
-    //check if any bits are set
-    TBits bFlowBits = pTrack->GetFlowBits();
-    if (bFlowBits.CountBits() ==0) {
-      delete pTrack; } //track will not be used anymore
-    else {
-      pEvent->TrackCollection()->Add(pTrack) ; 
-      iGoodTracks++;
-
-      if (pTrack->InRPSelection())
-       { iSelParticlesRP++; }
-      if (pTrack->InPOISelection())
-       { iSelParticlesPOI++; }
-    }
-    
-    itrkN++; 
-  }
-  
-  pEvent-> SetEventNSelTracksRP(iSelParticlesRP);  
-  pEvent-> SetNumberOfTracks(iGoodTracks);
-  pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
-
-  if ( (++fCount % 100) == 0) {
-    if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
-    else cout<<" MC Reaction Plane Angle = unknown "<< endl;
-    cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-    cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
-    cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
-    cout << "# " << fCount << " events processed" << endl;
-  }
-
-  return pEvent;
-
-}
-
-
 //-----------------------------------------------------------------------   
 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
 {
@@ -387,83 +694,6 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
   return pEvent;
 }
 
-
-//-----------------------------------------------------------------------   
-AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
-{
-  //Fills the event from the ESD
-  
-  //flags for particles passing int. and diff. flow cuts
-  Bool_t bPassedRPFlowCuts  = kFALSE;
-  Bool_t bPassedPOIFlowCuts = kFALSE;
-  
-  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
-  
-  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
-    
-  Int_t iGoodTracks = 0;           //number of good tracks
-  Int_t itrkN = 0;                 //track counter
-  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
-  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
-
-  //normal loop
-  while (itrkN < iNumberOfInputTracks) {
-    AliESDtrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
-    
-    //check if pParticle passes the cuts
-    if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) && 
-       intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
-      bPassedRPFlowCuts = kTRUE;
-    }
-    if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) && 
-       diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
-      bPassedPOIFlowCuts = kTRUE;
-    }
-    
-    if (bPassedRPFlowCuts || bPassedPOIFlowCuts) {
-      for(Int_t d=0;d<fNoOfLoops;d++) {
-        //make new AliFLowTrackSimple
-        AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
-        pTrack->SetPt(pParticle->Pt() );
-        pTrack->SetEta(pParticle->Eta() );
-        pTrack->SetPhi(pParticle->Phi()-fEllipticFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle)) );
-      
-        //marking the particles used for int. flow:
-         if(bPassedRPFlowCuts && iSelParticlesRP < fMultiplicityOfEvent) {  
-          pTrack->SetForRPSelection(kTRUE);
-          iSelParticlesRP++;
-         }
-         //marking the particles used for diff. flow:
-        if(bPassedPOIFlowCuts && iGoodTracks%fNoOfLoops==0) {
-          pTrack->SetForPOISelection(kTRUE);
-          iSelParticlesPOI++;
-        }
-       //adding a particles which were used either for int. or diff. flow to the list
-       pEvent->TrackCollection()->Add(pTrack);
-       iGoodTracks++;
-       }//end of for(Int_t d=0;d<iLoops;d++)
-    }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts) 
-    itrkN++; 
-    bPassedRPFlowCuts  = kFALSE;
-    bPassedPOIFlowCuts = kFALSE;
-  }//end of while (itrkN < iNumberOfInputTracks)
-  
-  pEvent->SetEventNSelTracksRP(iSelParticlesRP);  
-  pEvent->SetNumberOfTracks(iGoodTracks);
-  pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
-
-  if ( (++fCount % 100) == 0) {
-    if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
-    else cout<<" MC Reaction Plane Angle = unknown "<< endl;
-    cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-    cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
-    cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
-    cout << "# " << fCount << " events processed" << endl;
-  }
-
-  return pEvent;
-}
-
 //-----------------------------------------------------------------------   
 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
 {
@@ -520,73 +750,6 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
   return pEvent;
 }
 
-
-//-----------------------------------------------------------------------   
-AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput,  AliCFManager* intCFManager, AliCFManager* diffCFManager)
-{
-  //Fills the event from the AOD
-  
-  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
-  
-  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
-  
-  Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
-  Int_t iGoodTracks = 0;           //number of good tracks
-  Int_t itrkN = 0;                 //track counter
-  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
-  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
-
-  //normal loop
-  while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
-    AliAODTrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
-    //make new AliFlowTrackSimple
-    AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
-    pTrack->SetPt(pParticle->Pt() );
-    pTrack->SetEta(pParticle->Eta() );
-    pTrack->SetPhi(pParticle->Phi() );
-
-    //check if pParticle passes the cuts
-    if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
-       intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {          
-      pTrack->SetForRPSelection(kTRUE); }
-    if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
-       diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
-      pTrack->SetForPOISelection(kTRUE);}      
-
-    //check if any bits are set
-    TBits bFlowBits = pTrack->GetFlowBits();
-    if (bFlowBits.CountBits() ==0) {
-      delete pTrack; } //track will not be used anymore
-    else {
-      pEvent->TrackCollection()->Add(pTrack) ; 
-      iGoodTracks++;
-
-      if (pTrack->InRPSelection())
-       { iSelParticlesRP++; }
-      if (pTrack->InPOISelection())
-       { iSelParticlesPOI++; }
-            
-    }
-       
-    itrkN++; 
-  }
-  
-  pEvent-> SetEventNSelTracksRP(iSelParticlesRP);  
-  pEvent->SetNumberOfTracks(iGoodTracks);
-  pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
-
-  if ( (++fCount % 100) == 0) {
-    if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
-    else cout<<" MC Reaction Plane Angle = unknown "<< endl;
-    cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-    cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
-    cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
-    cout << "# " << fCount << " events processed" << endl;
-  }
-
-  return pEvent;
-}
-
 //-----------------------------------------------------------------------   
 AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)
 {
@@ -671,111 +834,3 @@ AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, A
 
   return pEvent;
 }
-
-//-----------------------------------------------------------------------   
-AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
-{
-  //fills the event with tracks from the ESD and kinematics from the MC info via the track label
-
-  
-  if (!(anOption ==0 || anOption ==1)) {
-    cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
-    exit(1);
-  }
-
-  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
-
-  Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
-  if (iNumberOfInputTracksMC==-1) {
-    cout<<"Skipping Event -- No MC information available for this event"<<endl;
-    return 0;
-  }
-
-  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
-    
-  Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
-  Int_t iGoodTracks = 0;           //number of good tracks
-  Int_t itrkN = 0;                 //track counter
-  Int_t iSelParticlesPOI = 0;     //number of tracks selected for Diff
-  Int_t iSelParticlesRP = 0;      //number of tracks selected for Int
-
-  //normal loop
-  while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
-    AliESDtrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
-    //get Label
-    Int_t iLabel = pParticle->GetLabel();
-    //match to mc particle
-    AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
-    
-    //check
-    if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<"  "<<pMcParticle->Label()<<endl;
-    
-    //make new AliFlowTrackSimple
-    AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
-    if(anOption == 0) { //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
-      pTrack->SetPt(pMcParticle->Pt() );
-      pTrack->SetEta(pMcParticle->Eta() );
-      pTrack->SetPhi(pMcParticle->Phi() );
-    }
-    else { cout<<"Not a valid option"<<endl; }
-
-    //check if pParticle passes the cuts
-    if(anOption == 0) { 
-      //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
-      if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") && 
-         intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {  
-       pTrack->SetForRPSelection(kTRUE); }
-      if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
-         diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {  
-       pTrack->SetForPOISelection(kTRUE);}
-    }
-    else if (anOption == 1) { 
-      //cout<<"take the PID and kinematics from the MC"<<endl;
-      if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {  
-       pTrack->SetForRPSelection(kTRUE); }
-      if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {  
-       pTrack->SetForPOISelection(kTRUE);}
-    }
-    else { cout<<"Not a valid option"<<endl; }
-      
-    //check if any bits are set
-    TBits bFlowBits = pTrack->GetFlowBits();
-    if (bFlowBits.CountBits() ==0) {
-      delete pTrack; } //track will not be used anymore
-    else {
-      pEvent->TrackCollection()->Add(pTrack) ; 
-      iGoodTracks++;  
-    
-      if (pTrack->InRPSelection())
-       { iSelParticlesRP++; }
-      if (pTrack->InPOISelection())
-       { iSelParticlesPOI++; }
-            
-    }
-    
-    itrkN++; 
-  }
-  
-  pEvent-> SetEventNSelTracksRP(iSelParticlesRP);  
-  pEvent->SetNumberOfTracks(iGoodTracks);
-  pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
-
-  if ( (++fCount % 100) == 0) {
-    if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<<  fMCReactionPlaneAngle << endl;
-    else cout<<" MC Reaction Plane Angle = unknown "<< endl;
-    cout << " Number of MC input tracks = " << iNumberOfInputTracksMC << endl;
-    cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-    cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
-    cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
-    cout << "# " << fCount << " events processed" << endl;
-  }
-
-  return pEvent;
-}
-
index 4a805d3..56bf7c8 100644 (file)
@@ -3,6 +3,14 @@
 
 /* $Id$ */
 
+//////////////////////////////////////////////////////////////////////////
+// AliFlowEventSimpleMaker:
+// Class to fill the AliFlowEventSimple with AliFlowTrackSimple objects
+// author: N. van der Kolk (kolk@nikhef.nl),  Ante Bilandzic (anteb@nikhef.nl),  
+// Raimond Snellings (Raimond.Snellings@nikhef.nl) 
+//////////////////////////////////////////////////////////////////////////
+
+
 #ifndef AliFlowEventSimpleMaker_H
 #define AliFlowEventSimpleMaker_H
 
@@ -15,9 +23,6 @@ class AliMCEvent;
 class AliESDEvent;
 class AliAODEvent;
 
-// AliFlowEventSimpleMaker:
-// Class to fill the AliFlowEventSimple with AliFlowTrackSimple objects
-// author: N. van der Kolk (kolk@nikhef.nl),  Ante Bilandzic (anteb@nikhef.nl),  Raimond Snellings (Raimond.Snellings@nikhef.nl) 
           
 class AliFlowEventSimpleMaker {
 
@@ -44,24 +49,34 @@ class AliFlowEventSimpleMaker {
   AliFlowEventSimple* FillTracks(AliAODEvent* anInput); //use own cuts
   AliFlowEventSimple* FillTracks(AliAODEvent* anInput, AliCFManager* rpCFManager, AliCFManager* poiCFManager);  //use CF(2x)
   
-  void SetNoOfLoops(Int_t noofl) {this->fNoOfLoops = noofl;}
-  Int_t GetNoOfLoops() const {return this->fNoOfLoops;} 
+  void  SetNoOfLoops(Int_t noofl) {this->fNoOfLoops = noofl;}
+  Int_t GetNoOfLoops() const      {return this->fNoOfLoops;} 
   
-  void SetEllipticFlowValue(Double_t elfv) {this->fEllipticFlowValue = elfv;}
-  Double_t GetEllipticFlowValue() const {return this->fEllipticFlowValue;} 
+  void     SetEllipticFlowValue(Double_t elfv) {this->fEllipticFlowValue = elfv;}
+  Double_t GetEllipticFlowValue() const        {return this->fEllipticFlowValue;} 
   
-  void SetMultiplicityOfEvent(Int_t multevnt) {this->fMultiplicityOfEvent = multevnt;}
-  Int_t GetMultiplicityOfEvent() const {return this->fMultiplicityOfEvent;} 
+  void  SetMultiplicityOfEvent(Int_t multevnt) {this->fMultiplicityOfEvent = multevnt;}
+  Int_t GetMultiplicityOfEvent() const         {return this->fMultiplicityOfEvent;} 
   
+  void  SetMinMult(Int_t multmin) {this->fMinMult = multmin; }
+  Int_t GetMinMult() const        {return this->fMinMult; }
+  void  SetMaxMult(Int_t multmax) {this->fMaxMult = multmax; }
+  Int_t GetMaxMult() const        {return this->fMaxMult; }
+
  private:
   AliFlowEventSimpleMaker(const AliFlowEventSimpleMaker& anAnalysis);            //copy constructor
   AliFlowEventSimpleMaker& operator=(const AliFlowEventSimpleMaker& anAnalysis); //assignment operator
-  Double_t  fMCReactionPlaneAngle;   // the angle of the reaction plane from the MC truth
-  Int_t     fCount;   // counter for the number of events processed
 
-  Int_t     fNoOfLoops; // number of times to use the same particle (nonflow) 
-  Double_t  fEllipticFlowValue; // Add Flow. Must be in range [0,1].
-  Int_t     fMultiplicityOfEvent; // Set maximal multiplicity.
+  Double_t  fMCReactionPlaneAngle; // the angle of the reaction plane from the MC truth
+  Int_t     fCount;                // counter for the number of events processed
+
+  Int_t     fNoOfLoops;            // number of times to use the same particle (nonflow) 
+  Double_t  fEllipticFlowValue;    // Add Flow. Must be in range [0,1].
+  Int_t     fMultiplicityOfEvent;  // Set maximal multiplicity (when manipulating the event).
+
+  Int_t     fMinMult;              // Minimum multiplicity from tracks selected using CORRFW
+  Int_t     fMaxMult;              // Maximum multiplicity from tracks selected using CORRFW
+
      
   ClassDef(AliFlowEventSimpleMaker,0)    // macro for rootcint
 };
index 115158a..44e67cc 100644 (file)
 
 // SETTING THE CUTS
 
+// event selection
+const Int_t multmin = 10;  //used for CORRFW cuts and for AliFlowEventSimple!
+const Int_t multmax = 100; //used for CORRFW cuts and for AliFlowEventSimple!
+
 // For RP selection
 const Double_t ptmin1 = 0.0;
 const Double_t ptmax1 = 10.0;
@@ -153,11 +157,15 @@ if (LYZ2PROD){
   if (QA) { 
     taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kTRUE); 
     taskFE->SetAnalysisType(type);
+    taskFE->SetMinMult(multmin);
+    taskFE->SetMaxMult(multmax);
     mgr->AddTask(taskFE);
   }
   else { 
     taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kFALSE); 
     taskFE->SetAnalysisType(type);
+    taskFE->SetMinMult(multmin);
+    taskFE->SetMaxMult(multmax);
     mgr->AddTask(taskFE);
   }
  
@@ -169,6 +177,18 @@ if (LYZ2PROD){
     TList* qaPOI = new TList();
   }
 
+  //############# event cuts on multiplicity
+  AliCFEventGenCuts* mcEventCuts = new AliCFEventGenCuts("mcEventCuts","MC-level event cuts");
+  mcEventCuts->SetNTracksCut(multmin,multmax); 
+  if (QA) { 
+    mcEventCuts->SetQAOn(qaRP);
+  }
+  AliCFEventRecCuts* recEventCuts = new AliCFEventRecCuts("recEventCuts","rec-level event cuts");
+  recEventCuts->SetNTracksCut(multmin,multmax); 
+  if (QA) { 
+    recEventCuts->SetQAOn(qaRP);
+  }
+
   //############# cuts on MC
   AliCFTrackKineCuts* mcKineCuts1 = new AliCFTrackKineCuts("mcKineCuts1","MC-level kinematic cuts");
   mcKineCuts1->SetPtRange(ptmin1,ptmax1);
@@ -303,6 +323,13 @@ if (LYZ2PROD){
     }
   }
   
+  printf("CREATE EVENT CUTS\n");
+  TObjArray* mcEventList = new TObjArray(0);
+  mcEventList->AddLast(mcEventCuts);
+    
+  TObjArray* recEventList = new TObjArray(0);
+  recEventList->AddLast(recEventCuts);
+
   printf("CREATE MC KINE CUTS\n");
   TObjArray* mcList1 = new TObjArray(0);
   mcList1->AddLast(mcKineCuts1);
@@ -339,6 +366,9 @@ if (LYZ2PROD){
   
   printf("CREATE INTERFACE AND CUTS\n");
   AliCFManager* cfmgr1 = new AliCFManager();
+  cfmgr1->SetNStepEvent(3);
+  cfmgr1->SetEventCutsList(AliCFManager::kEvtGenCuts,mcEventList); 
+  cfmgr1->SetEventCutsList(AliCFManager::kEvtRecCuts,recEventList); 
   cfmgr1->SetNStepParticle(4); 
   cfmgr1->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList1);
   cfmgr1->SetParticleCutsList(AliCFManager::kPartAccCuts,accList1);