]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisTaskFilterFriend.cxx
support for par files, multiple tasks, and collection of local AODs (Matthias)
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskFilterFriend.cxx
index 7c0053e7ba3fe9a2c2b853ada213f91459fd8d66..b33c30788805ca35cca37b96e9e18479394e6e30 100644 (file)
@@ -97,10 +97,12 @@ void AliAnalysisTaskFilterFriend::UserCreateOutputObjects()
 void AliAnalysisTaskFilterFriend::UserExec(Option_t */*option*/)
 {
 
-       AliInfo("Filling Friends");
+       //
+       // Filtering
+       //
 
        fESDInput = dynamic_cast<AliESDEvent*>(InputEvent()); // get the input ESD
-       fESDfriendInput = (AliESDfriend*)(fESDInput->FindListObject("AliESDfriend"));
+       fESDfriendInput = InputFriend(); // get the input friend
        if(!fESDInput) {
                printf("AliAnalysisTaskFilterFriend::Exec(): no ESD \n");
                return;
@@ -112,12 +114,10 @@ void AliAnalysisTaskFilterFriend::UserExec(Option_t */*option*/)
        // attach ESDfriend
        
        AliESDfriend* esdFriendOutput = (AliESDfriend*)ESDfriend();  
-       AliDebug(2,Form("Number of ESD tracks in input = %d ",fESDInput->GetNumberOfTracks()));
-       AliDebug(2,Form("Number of tracks in input friends = %d ",fESDfriendInput->GetNumberOfTracks()));
-       AliDebug(2,Form("Number of tracks in output friendsNew before filtering = %d ",esdFriendOutput->GetNumberOfTracks()));
+       AliDebug(3,Form("Number of ESD tracks in input = %d ",fESDInput->GetNumberOfTracks()));
+       AliDebug(3,Form("Number of tracks in input friends = %d ",fESDfriendInput->GetNumberOfTracks()));
+       AliDebug(3,Form("Number of tracks in output friendsNew before filtering = %d ",esdFriendOutput->GetNumberOfTracks()));
        
-       AliESDfriendTrack* tNull = new AliESDfriendTrack();
-
        for (Int_t i = 0; i< fESDInput->GetNumberOfTracks(); i++){
                if (i%2 ==0){
                        // keep friend
@@ -131,7 +131,7 @@ void AliAnalysisTaskFilterFriend::UserExec(Option_t */*option*/)
                }
                else {
                        //discard friend 
-                       AddFriendTrackAt(tNull,i);
+                       SkipFriendTrackAt(i);
                }
                
        } 
@@ -157,13 +157,14 @@ Bool_t AliAnalysisTaskFilterFriend::UserSelectESDfriendForCurrentEvent()
 
        
        fESDInput = dynamic_cast<AliESDEvent*>(InputEvent()); // get the input ESD
+       if (!fESDInput){
+               AliError("No ESD Input, discarding event...");
+               return kFALSE;
+       }
        if ((fESDInput->GetNumberOfTracks())%2 == 0) {
-               AliDebug(2,"Selecting event");
+               AliDebug(2,"******************Selecting event");
                return kTRUE;
        }
-       AliDebug(2,"Discarding event"); 
+       AliDebug(2,"*******************Discarding event");      
        return kFALSE;
-       /*
-       return kTRUE;
-       */
 }