LCOV - code coverage report
Current view: top level - ANALYSIS/ANALYSISalice - AliAnalysisTaskSE.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 84 518 16.2 %
Date: 2016-06-14 17:26:59 Functions: 9 20 45.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       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             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             :  
      18             : #include <TROOT.h>
      19             : #include <TSystem.h>
      20             : #include <TInterpreter.h>
      21             : #include <TChain.h>
      22             : #include <TFile.h>
      23             : #include <TList.h>
      24             : 
      25             : #include "AliAnalysisTaskSE.h"
      26             : #include "AliAnalysisManager.h"
      27             : #include "AliAnalysisCuts.h"
      28             : #include "AliAnalysisDataSlot.h"
      29             : #include "AliAnalysisDataContainer.h"
      30             : 
      31             : #include "AliESDEvent.h"
      32             : #include "AliESDfriend.h"
      33             : #include "AliESD.h"
      34             : #include "AliAODEvent.h"
      35             : #include "AliAODHeader.h"
      36             : #include "AliAODVZERO.h"
      37             : #include "AliTOFHeader.h"
      38             : #include "AliAODTracklets.h"
      39             : #include "AliAODCaloCells.h"
      40             : #include "AliAODCaloTrigger.h"
      41             : #include "AliAODMCParticle.h"
      42             : #include "AliVEvent.h"
      43             : #include "AliAODHandler.h"
      44             : #include "AliAODInputHandler.h"
      45             : #include "AliMCEventHandler.h"
      46             : #include "AliInputEventHandler.h"
      47             : #include "AliMultiInputEventHandler.h"
      48             : #include "AliESDInputHandler.h"
      49             : #include "AliMCEvent.h"
      50             : #include "AliStack.h"
      51             : #include "AliTrackSelectionFactory.h"
      52             : #include "AliVTrackSelection.h"
      53             : #include "AliLog.h"
      54             : #include "AliAODDimuon.h"
      55             : 
      56             : 
      57         170 : ClassImp(AliAnalysisTaskSE)
      58             : 
      59             : ////////////////////////////////////////////////////////////////////////
      60             : AliVHeader*      AliAnalysisTaskSE::fgAODHeader         = NULL;
      61             : AliTOFHeader*    AliAnalysisTaskSE::fgTOFHeader         = NULL;
      62             : AliAODVZERO*     AliAnalysisTaskSE::fgAODVZERO          = NULL;
      63             : TClonesArray*    AliAnalysisTaskSE::fgAODTracks         = NULL;
      64             : TClonesArray*    AliAnalysisTaskSE::fgAODVertices       = NULL;
      65             : TClonesArray*    AliAnalysisTaskSE::fgAODV0s            = NULL;
      66             : TClonesArray*    AliAnalysisTaskSE::fgAODPMDClusters    = NULL;
      67             : TClonesArray*    AliAnalysisTaskSE::fgAODJets           = NULL;
      68             : TClonesArray*    AliAnalysisTaskSE::fgAODFMDClusters    = NULL;
      69             : TClonesArray*    AliAnalysisTaskSE::fgAODCaloClusters   = NULL;
      70             : TClonesArray*    AliAnalysisTaskSE::fgAODMCParticles    = NULL;
      71             : AliAODTracklets* AliAnalysisTaskSE::fgAODTracklets      = NULL;
      72             : AliAODCaloCells* AliAnalysisTaskSE::fgAODEmcalCells     = NULL;
      73             : AliAODCaloCells* AliAnalysisTaskSE::fgAODPhosCells      = NULL;
      74             : AliAODCaloTrigger* AliAnalysisTaskSE::fgAODEMCALTrigger = NULL;
      75             : AliAODCaloTrigger* AliAnalysisTaskSE::fgAODPHOSTrigger  = NULL;
      76             : TClonesArray*    AliAnalysisTaskSE::fgAODDimuons        = NULL;
      77             : TClonesArray*    AliAnalysisTaskSE::fgAODHmpidRings     = NULL;
      78             : 
      79             : AliAnalysisTaskSE::AliAnalysisTaskSE():
      80           0 :     AliAnalysisTask(),
      81           0 :     fDebug(0),
      82           0 :     fEntry(0),
      83           0 :     fInputEvent(0x0),
      84           0 :     fESDfriend(0x0),
      85           0 :     fInputHandler(0x0),
      86           0 :     fOutputAOD(0x0),
      87           0 :     fMCEvent(0x0),
      88           0 :     fTreeA(0x0),
      89           0 :     fCurrentRunNumber(-1),
      90           0 :     fHistosQA(0x0),
      91           0 :     fOfflineTriggerMask(0),
      92           0 :     fMultiInputHandler(0),
      93           0 :     fMCEventHandler(0),
      94           0 :     fTrackSelectionFactory(0),
      95           0 :     fTrackSelection(0)
      96           0 : {
      97             :   // Default constructor
      98           0 : }
      99             : 
     100             : AliAnalysisTaskSE::AliAnalysisTaskSE(const char* name):
     101           8 :     AliAnalysisTask(name, "AnalysisTaskSE"),
     102           8 :     fDebug(0),
     103           8 :     fEntry(0),
     104           8 :     fInputEvent(0x0),
     105           8 :     fESDfriend(0x0),
     106           8 :     fInputHandler(0x0),
     107           8 :     fOutputAOD(0x0),
     108           8 :     fMCEvent(0x0),
     109           8 :     fTreeA(0x0),
     110           8 :     fCurrentRunNumber(-1),
     111           8 :     fHistosQA(0x0),
     112           8 :     fOfflineTriggerMask(0),
     113           8 :     fMultiInputHandler(0),
     114           8 :     fMCEventHandler(0),
     115           8 :     fTrackSelectionFactory(0),
     116           8 :     fTrackSelection(0)
     117          24 : {
     118             :   // Default constructor
     119          16 :     DefineInput (0, TChain::Class());
     120          16 :     DefineOutput(0,  TTree::Class());
     121           8 : }
     122             : 
     123             : AliAnalysisTaskSE::AliAnalysisTaskSE(const AliAnalysisTaskSE& obj):
     124           0 :     AliAnalysisTask(obj),
     125           0 :     fDebug(0),
     126           0 :     fEntry(0),
     127           0 :     fInputEvent(0x0),
     128           0 :     fESDfriend(0x0),
     129           0 :     fInputHandler(0x0),
     130           0 :     fOutputAOD(0x0),
     131           0 :     fMCEvent(0x0),
     132           0 :     fTreeA(0x0),
     133           0 :     fCurrentRunNumber(-1),
     134           0 :     fHistosQA(0x0),
     135           0 :     fOfflineTriggerMask(0),
     136           0 :     fMultiInputHandler(obj.fMultiInputHandler),
     137           0 :     fMCEventHandler(obj.fMCEventHandler),
     138           0 :     fTrackSelectionFactory(obj.fTrackSelectionFactory),
     139           0 :     fTrackSelection(obj.fTrackSelection)
     140           0 : {
     141             : // Copy constructor
     142           0 :     fDebug            = obj.fDebug;
     143           0 :     fEntry            = obj.fEntry;
     144           0 :     fInputEvent       = obj.fInputEvent;
     145           0 :     fESDfriend        = obj.fESDfriend;
     146           0 :     fInputHandler     = obj.fInputHandler;
     147           0 :     fOutputAOD        = obj.fOutputAOD;
     148           0 :     fMCEvent          = obj.fMCEvent;
     149           0 :     fTreeA            = obj.fTreeA;    
     150           0 :     fCurrentRunNumber = obj.fCurrentRunNumber;
     151           0 :     fHistosQA         = obj.fHistosQA;
     152             : 
     153           0 : }
     154             : 
     155             : 
     156             : AliAnalysisTaskSE& AliAnalysisTaskSE::operator=(const AliAnalysisTaskSE& other)
     157             : {
     158             : // Assignment
     159           0 :   if(&other == this) return *this;
     160           0 :   AliAnalysisTask::operator=(other);
     161             : 
     162           0 :     AliAnalysisTask::operator=(other);
     163           0 :     fDebug            = other.fDebug;
     164           0 :     fEntry            = other.fEntry;
     165           0 :     fInputEvent       = other.fInputEvent;
     166           0 :     fESDfriend        = other.fESDfriend;
     167           0 :     fInputHandler     = other.fInputHandler;
     168           0 :     fOutputAOD        = other.fOutputAOD;
     169           0 :     fMCEvent          = other.fMCEvent;
     170           0 :     fTreeA            = other.fTreeA;    
     171           0 :     fCurrentRunNumber = other.fCurrentRunNumber;
     172           0 :     fHistosQA         = other.fHistosQA;
     173           0 :     fOfflineTriggerMask = other.fOfflineTriggerMask;
     174           0 :     fMultiInputHandler  = other.fMultiInputHandler;
     175           0 :     fMCEventHandler     = other.fMCEventHandler;
     176           0 :     fTrackSelectionFactory = other.fTrackSelectionFactory;
     177           0 :     fTrackSelection = other.fTrackSelection;
     178           0 :     return *this;
     179           0 : }
     180             : 
     181             : //______________________________________________________________________________
     182             : void AliAnalysisTaskSE::ConnectInputData(Option_t* /*option*/)
     183             : {
     184             : // Connect the input data
     185          10 :     if (fDebug > 1) printf("AnalysisTaskSE::ConnectInputData() \n");
     186             : 
     187             :    // Connect input handlers (multi input handler is handled)
     188           5 :     ConnectMultiHandler();
     189             :     
     190          10 :     if (fInputHandler && fInputHandler->GetTree()) {
     191           5 :         if (fInputHandler->GetTree()->GetBranch("ESDfriend."))
     192           0 :             fESDfriend = ((AliESDInputHandler*)fInputHandler)->GetESDfriend();
     193             : 
     194           5 :         fInputEvent = fInputHandler->GetEvent();
     195           5 :     } else if( fMCEvent ) {
     196           0 :          AliWarning("No Input Event Handler connected, only MC Truth Event Handler") ; 
     197             :     } else {
     198           0 :          AliError("No Input Event Handler connected") ; 
     199           0 :          return ; 
     200             :     }
     201             :     // Disconnect multi handler
     202           5 :     DisconnectMultiHandler();
     203          10 : }
     204             : 
     205             : void AliAnalysisTaskSE::CreateOutputObjects()
     206             : {
     207             : // Create the output container
     208             : //
     209             : //  Default AOD
     210          14 :     if (fDebug > 1) printf("AnalysisTaskSE::CreateOutPutData() \n");
     211             : 
     212          21 :     AliAODHandler* handler = dynamic_cast<AliAODHandler*> 
     213           7 :          ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
     214             :     
     215             :     Bool_t merging = kFALSE;
     216           7 :     AliAODInputHandler* aodIH = static_cast<AliAODInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
     217           7 :     if (aodIH) {
     218           7 :         if (aodIH->GetMergeEvents()) merging = kTRUE;
     219             :     }
     220             : 
     221             :     // Check if AOD replication has been required
     222           7 :     if (handler) {
     223           7 :         fOutputAOD   = handler->GetAOD();
     224           7 :         fTreeA = handler->GetTree();
     225          14 :         if (fOutputAOD && !(handler->IsStandard())) {
     226           0 :             if ((handler->NeedsHeaderReplication() || merging) && !(fgAODHeader)) 
     227             :                 {
     228           0 :                  if (fDebug > 1) AliInfo("Replicating header");
     229           0 :                  fgAODHeader = new AliAODHeader;
     230           0 :                  handler->AddBranch("AliAODHeader", &fgAODHeader);
     231           0 :                 }
     232           0 :             if ((handler->NeedsTOFHeaderReplication() || merging) && !(fgTOFHeader))
     233             :                 {
     234           0 :                  if (fDebug > 1) AliInfo("Replicating TOFheader");
     235           0 :                  fgTOFHeader = new AliTOFHeader;
     236           0 :                  handler->AddBranch("AliTOFHeader", &fgTOFHeader);
     237           0 :                 }
     238           0 :             if ((handler->NeedsVZEROReplication() || merging) && !(fgAODVZERO))
     239             :                 {
     240           0 :                  if (fDebug > 1) AliInfo("Replicating VZERO");
     241           0 :                  fgAODVZERO = new AliAODVZERO;
     242           0 :                  handler->AddBranch("AliAODVZERO", &fgAODVZERO);
     243           0 :                 }
     244             : 
     245           0 :             if ((handler->NeedsTracksBranchReplication() || merging) && !(fgAODTracks))      
     246             :             {   
     247           0 :                 if (fDebug > 1) AliInfo("Replicating track branch\n");
     248           0 :                 fgAODTracks = new TClonesArray("AliAODTrack",500);
     249           0 :                 fgAODTracks->SetName("tracks");
     250           0 :                 handler->AddBranch("TClonesArray", &fgAODTracks);
     251           0 :             }    
     252           0 :             if ((handler->NeedsVerticesBranchReplication() || merging) && !(fgAODVertices))
     253             :             {
     254           0 :                 if (fDebug > 1) AliInfo("Replicating vertices branch\n");
     255           0 :                 fgAODVertices = new TClonesArray("AliAODVertex",500);
     256           0 :                 fgAODVertices->SetName("vertices");
     257           0 :                 handler->AddBranch("TClonesArray", &fgAODVertices);
     258           0 :             }   
     259           0 :             if ((handler->NeedsV0sBranchReplication()) && !(fgAODV0s))         
     260             :             {   
     261           0 :                 if (fDebug > 1) AliInfo("Replicating V0s branch\n");
     262           0 :                 fgAODV0s = new TClonesArray("AliAODv0",500);
     263           0 :                 fgAODV0s->SetName("v0s");
     264           0 :                 handler->AddBranch("TClonesArray", &fgAODV0s);
     265           0 :             }
     266           0 :             if ((handler->NeedsTrackletsBranchReplication()) && !(fgAODTracklets))     
     267             :             {   
     268           0 :                 if (fDebug > 1) AliInfo("Replicating Tracklets branch\n");
     269           0 :                 fgAODTracklets = new AliAODTracklets("tracklets","tracklets");
     270           0 :                 handler->AddBranch("AliAODTracklets", &fgAODTracklets);
     271           0 :             }
     272           0 :             if ((handler->NeedsPMDClustersBranchReplication()) && !(fgAODPMDClusters))         
     273             :             {   
     274           0 :                 if (fDebug > 1) AliInfo("Replicating PMDClusters branch\n");
     275           0 :                 fgAODPMDClusters = new TClonesArray("AliAODPmdCluster",500);
     276           0 :                 fgAODPMDClusters->SetName("pmdClusters");
     277           0 :                 handler->AddBranch("TClonesArray", &fgAODPMDClusters);
     278           0 :             }
     279           0 :             if ((handler->NeedsJetsBranchReplication() || merging) && !(fgAODJets))    
     280             :             {   
     281           0 :                 if (fDebug > 1) AliInfo("Replicating Jets branch\n");
     282           0 :                 fgAODJets = new TClonesArray("AliAODJet",500);
     283           0 :                 fgAODJets->SetName("jets");
     284           0 :                 handler->AddBranch("TClonesArray", &fgAODJets);
     285           0 :             }
     286           0 :             if ((handler->NeedsFMDClustersBranchReplication()) && !(fgAODFMDClusters))         
     287             :             {   
     288           0 :                 AliInfo("Replicating FMDClusters branch\n");
     289           0 :                 fgAODFMDClusters = new TClonesArray("AliAODFmdCluster",500);
     290           0 :                 fgAODFMDClusters->SetName("fmdClusters");
     291           0 :                 handler->AddBranch("TClonesArray", &fgAODFMDClusters);
     292           0 :             }
     293           0 :             if ((handler->NeedsCaloClustersBranchReplication() || merging) && !(fgAODCaloClusters))    
     294             :             {   
     295           0 :                 if (fDebug > 1) AliInfo("Replicating CaloClusters branch\n");
     296           0 :                 fgAODCaloClusters = new TClonesArray("AliAODCaloCluster",500);
     297           0 :                 fgAODCaloClusters->SetName("caloClusters");
     298           0 :                 handler->AddBranch("TClonesArray", &fgAODCaloClusters);
     299             : 
     300           0 :                 fgAODEmcalCells = new AliAODCaloCells("emcalCells","emcalCells",AliVCaloCells::kEMCALCell);
     301           0 :                 handler->AddBranch("AliAODCaloCells", &fgAODEmcalCells);
     302             : 
     303           0 :                 fgAODPhosCells = new AliAODCaloCells("phosCells","phosCells",AliVCaloCells::kPHOSCell);
     304           0 :                 handler->AddBranch("AliAODCaloCells", &fgAODPhosCells);
     305           0 :                 }
     306           0 :             if ((handler->NeedsCaloTriggerBranchReplication() || merging) && !(fgAODEMCALTrigger))     
     307             :             {   
     308           0 :                 if (fDebug > 1) AliInfo("Replicating EMCAL Calo Trigger branches\n");
     309           0 :                 fgAODEMCALTrigger = new AliAODCaloTrigger("emcalTrigger","emcalTrigger");
     310           0 :                 handler->AddBranch("AliAODCaloTrigger", &fgAODEMCALTrigger);
     311           0 :                 }
     312           0 :                 if ((handler->NeedsCaloTriggerBranchReplication() || merging) && !(fgAODPHOSTrigger))          
     313             :                 {   
     314           0 :                 if (fDebug > 1) AliInfo("Replicating PHOS Calo Trigger branches\n");
     315           0 :                 fgAODPHOSTrigger = new AliAODCaloTrigger("phosTrigger","phosTrigger");
     316           0 :                 handler->AddBranch("AliAODCaloTrigger", &fgAODPHOSTrigger);
     317           0 :             }
     318           0 :             if ((handler->NeedsMCParticlesBranchReplication() || merging) && !(fgAODMCParticles))      
     319             :             {   
     320           0 :                 if (fDebug > 1) AliInfo("Replicating MCParticles branch\n");
     321           0 :                 fgAODMCParticles = new TClonesArray("AliAODMCParticle",500);
     322           0 :                 fgAODMCParticles->SetName("mcparticles");
     323           0 :                 handler->AddBranch("TClonesArray", &fgAODMCParticles);
     324           0 :             }
     325           0 :             if ((handler->NeedsDimuonsBranchReplication() || merging) && !(fgAODDimuons))      
     326             :             {   
     327           0 :                 if (fDebug > 1) AliInfo("Replicating dimuon branch\n");
     328           0 :                 fgAODDimuons = new TClonesArray("AliAODDimuon",0);
     329           0 :                 fgAODDimuons->SetName("dimuons");
     330           0 :                 handler->AddBranch("TClonesArray", &fgAODDimuons);
     331           0 :             }    
     332           0 :             if ((handler->NeedsHMPIDBranchReplication() || merging) && !(fgAODHmpidRings))      
     333             :             {   
     334           0 :                 if (fDebug > 1) AliInfo("Replicating HMPID branch\n");
     335           0 :                 fgAODHmpidRings = new TClonesArray("AliAODHMPIDrings",0);
     336           0 :                 fgAODHmpidRings->SetName("hmpidRings");
     337           0 :                 handler->AddBranch("TClonesArray", &fgAODHmpidRings);
     338           0 :             }
     339             :                 
     340             : 
     341             :             // cache the pointerd in the AODEvent
     342           0 :             fOutputAOD->GetStdContent();
     343           0 :         }
     344             :     }
     345             : 
     346           7 :     if(fTrackSelectionFactory && !fTrackSelection)
     347           0 :       fTrackSelection = fTrackSelectionFactory->CreateTrackCuts(
     348           0 :           AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->IsA() == AliAODInputHandler::Class() ?
     349             :               AliTrackSelectionFactory::kAOD :
     350             :               AliTrackSelectionFactory::kESD
     351             :               );
     352           7 :     ConnectMultiHandler();
     353           7 :     UserCreateOutputObjects();
     354           7 :     DisconnectMultiHandler();
     355           7 : }
     356             : 
     357             : void AliAnalysisTaskSE::Exec(Option_t* option)
     358             : {
     359             : //
     360             : // Exec analysis of one event
     361             :     
     362          56 :     ConnectMultiHandler();
     363          28 :     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
     364          28 :     if (mgr->GetDebugLevel() > 1) {
     365           0 :        if (!mgr->GetTopTasks()->FindObject(this))
     366           0 :           printf("    -> Executing sub-task %s\n", GetName());
     367             :     }   
     368          28 :     if ( fDebug >= 10)
     369           0 :       printf("Task is active %5d\n", IsActive());
     370             :     
     371          28 :     if (fDebug > 1) AliInfo("AliAnalysisTaskSE::Exec() \n");
     372             : //
     373          84 :     AliAODHandler* handler = dynamic_cast<AliAODHandler*>(mgr->GetOutputEventHandler());
     374             : 
     375          84 :     AliAODInputHandler* aodH = dynamic_cast<AliAODInputHandler*>(fInputHandler);
     376             : //
     377             : // Was event selected ? If no event selection mechanism, the event SHOULD be selected (AG)
     378             :     UInt_t isSelected = AliVEvent::kAny;
     379          56 :     if( fInputHandler && (fInputHandler->GetEventSelection() || aodH)) {
     380             :       // Get the actual offline trigger mask for the event and AND it with the
     381             :       // requested mask. If no mask requested select by default the event.
     382           0 :       if (fOfflineTriggerMask)
     383           0 :         isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
     384             :     }
     385             : //  Functionality below moved in the filter tasks (AG)
     386             : //    if (handler) handler->SetFillAOD(isSelected);
     387             : 
     388          28 :     if( fInputHandler ) {
     389          28 :       fEntry = fInputHandler->GetReadEntry();
     390          28 :       fESDfriend = ((AliESDInputHandler*)fInputHandler)->GetESDfriend();
     391          28 :     }
     392             :     
     393             : 
     394             :     // Notify the change of run number
     395          48 :     if (InputEvent() && (InputEvent()->GetRunNumber() != fCurrentRunNumber)) {
     396           5 :         fCurrentRunNumber = InputEvent()->GetRunNumber();
     397           5 :         NotifyRun();
     398          28 :     } else if( fMCEvent )
     399          13 :       fEntry = fMCEvent->Header()->GetEvent(); 
     400             : 
     401          35 :     if ( !((Entry()-1)%100) && fDebug > 0) 
     402           0 :       AliInfo(Form("%s ----> Processing event # %lld", CurrentFileName(), Entry()));
     403             :     
     404          28 :     if (aodH) fMCEvent = aodH->MCEvent();
     405             : 
     406          28 :     if (handler && aodH) {
     407           0 :         Bool_t merging = aodH->GetMergeEvents();
     408             :         // Do not analyze merged events if last embedded file has less events than normal event, 
     409             :         // skip analysis after last embeded event 
     410           0 :         if(merging){
     411           0 :           if(aodH->GetReadEntry() + aodH->GetMergeOffset() >= aodH->GetTreeToMerge()->GetEntriesFast()){
     412             :             // Do I need to add the lines before the return?
     413             :             // Added protection in case the derived task is not an AOD producer.
     414           0 :             AliAnalysisDataSlot *out0 = GetOutputSlot(0);
     415           0 :             if (out0 && out0->IsConnected()) PostData(0, fTreeA);    
     416           0 :             DisconnectMultiHandler();
     417             :             return;
     418             :           }
     419             :         }
     420             :       
     421           0 :         AliAODEvent* aod = dynamic_cast<AliAODEvent*>(InputEvent());
     422             : 
     423           0 :         if (aod && !(handler->IsStandard()) && !(handler->AODIsReplicated())) {
     424           0 :             if ((handler->NeedsHeaderReplication() || merging) && (fgAODHeader))
     425             :             {
     426             :               // copy the contents by assigment
     427           0 :               *fgAODHeader =  *(aod->GetHeader());
     428           0 :             }
     429           0 :             if ((handler->NeedsTOFHeaderReplication() || merging) && (fgTOFHeader))
     430             :             {
     431           0 :               if (aod->GetTOFHeader()) *fgTOFHeader =  *(aod->GetTOFHeader());
     432             :             }
     433           0 :             if ((handler->NeedsVZEROReplication() || merging) && (fgAODVZERO) && aod->GetVZEROData())
     434             :             {
     435           0 :               *fgAODVZERO = *(aod->GetVZEROData());
     436           0 :             }
     437             : 
     438           0 :             if ((handler->NeedsTracksBranchReplication() || (merging &&  aodH->GetMergeTracks())) && (fgAODTracks))
     439             :             {
     440           0 :                 TClonesArray* tracks = aod->GetTracks();
     441           0 :                 new (fgAODTracks) TClonesArray(*tracks);
     442           0 :             }
     443           0 :             if ((handler->NeedsVerticesBranchReplication() || merging) && (fgAODVertices))
     444             :             {
     445           0 :                 TClonesArray* vertices = aod->GetVertices();
     446           0 :                 new (fgAODVertices) TClonesArray(*vertices);
     447           0 :             }
     448           0 :             if ((handler->NeedsV0sBranchReplication()) && (fgAODV0s))
     449             :             {
     450           0 :                 TClonesArray* v0s = aod->GetV0s();
     451           0 :                 new (fgAODV0s) TClonesArray(*v0s);
     452           0 :             }
     453           0 :             if ((handler->NeedsTrackletsBranchReplication()) && (fgAODTracklets))
     454             :             {
     455           0 :               *fgAODTracklets = *aod->GetTracklets();
     456           0 :             }
     457           0 :             if ((handler->NeedsPMDClustersBranchReplication()) && (fgAODPMDClusters))
     458             :             {
     459           0 :                 TClonesArray* pmdClusters = aod->GetPmdClusters();
     460           0 :                 new (fgAODPMDClusters) TClonesArray(*pmdClusters);
     461           0 :             }
     462           0 :             if ((handler->NeedsJetsBranchReplication() || (merging &&aodH->GetMergeTracks())) && (fgAODJets))
     463             :             {
     464           0 :                 TClonesArray* jets = aod->GetJets();
     465           0 :                 new (fgAODJets) TClonesArray(*jets);
     466           0 :             }
     467           0 :             if ((handler->NeedsFMDClustersBranchReplication()) && (fgAODFMDClusters))
     468             :             {
     469           0 :                 TClonesArray* fmdClusters = aod->GetFmdClusters();
     470           0 :                 new (fgAODFMDClusters) TClonesArray(*fmdClusters);
     471           0 :             }
     472           0 :             if ((handler->NeedsCaloClustersBranchReplication() || 
     473           0 :                  (merging && (aodH->GetMergeEMCALClusters() || aodH->GetMergePHOSClusters()))) 
     474           0 :                 && (fgAODCaloClusters))
     475             :             {
     476           0 :                 TClonesArray* caloClusters = aod->GetCaloClusters();
     477           0 :                 new (fgAODCaloClusters) TClonesArray(*caloClusters);
     478           0 :             }
     479             : 
     480           0 :             if ((handler->NeedsMCParticlesBranchReplication() || merging) && (fgAODMCParticles))
     481             :             {
     482           0 :                 TClonesArray* mcParticles = (TClonesArray*) (aod->FindListObject("mcparticles"));
     483           0 :                 if( mcParticles )
     484           0 :                   new (fgAODMCParticles) TClonesArray(*mcParticles);
     485           0 :             }
     486             :             
     487           0 :             if ((handler->NeedsDimuonsBranchReplication() || (merging && aodH->GetMergeTracks())) && (fgAODDimuons))
     488             :             {
     489           0 :                 fgAODDimuons->Clear();
     490           0 :                 TClonesArray& dimuons = *fgAODDimuons;
     491           0 :                 TClonesArray& tracksnew = *fgAODTracks;
     492             :                 
     493           0 :                 Int_t nMuonTrack[100]; 
     494           0 :                 for(Int_t imuon = 0; imuon < 100; imuon++) nMuonTrack[imuon] = 0;
     495             :                 Int_t nMuons=0;
     496           0 :                 for(Int_t ii=0; ii < fgAODTracks->GetEntries(); ii++){
     497           0 :                     AliAODTrack *track = (AliAODTrack*) fgAODTracks->At(ii);
     498           0 :                     if(track->IsMuonTrack()) {
     499           0 :                         nMuonTrack[nMuons]= ii;
     500           0 :                         nMuons++;
     501           0 :                     }  
     502             :                 }
     503             :                 Int_t jDimuons=0;
     504           0 :                 if(nMuons >= 2){
     505           0 :                     for(Int_t i = 0; i < nMuons; i++){
     506           0 :                         Int_t index0 = nMuonTrack[i];
     507           0 :                         for(Int_t j = i+1; j < nMuons; j++){
     508           0 :                             Int_t index1 = nMuonTrack[j];
     509           0 :                             tracksnew.At(index0)->ResetBit(kIsReferenced);
     510           0 :                             tracksnew.At(index0)->SetUniqueID(0); 
     511           0 :                             tracksnew.At(index1)->ResetBit(kIsReferenced);
     512           0 :                             tracksnew.At(index1)->SetUniqueID(0);
     513           0 :                             new(dimuons[jDimuons++]) AliAODDimuon(tracksnew.At(index0),tracksnew.At(index1));
     514             :                         }
     515             :                     }    
     516           0 :                 }
     517           0 :             }
     518           0 :             if ((handler->NeedsHMPIDBranchReplication()) && (fgAODHmpidRings))
     519             :             {
     520           0 :                 TClonesArray* hmpidRings = aod->GetHMPIDrings();
     521           0 :                 new (fgAODHmpidRings) TClonesArray(*hmpidRings);
     522           0 :             }
     523             :             
     524             :             
     525             :             
     526             :             // Additional merging if needed
     527           0 :             if (merging) {
     528             :               Int_t nc;
     529             : 
     530             :                 // mcParticles
     531           0 :                 TClonesArray* mcparticles = (TClonesArray*) ((aodH->GetEventToMerge())->FindListObject("mcparticles"));
     532           0 :                 if( mcparticles ){
     533           0 :                   Int_t npart = mcparticles->GetEntries();
     534           0 :                   nc = fgAODMCParticles->GetEntries();
     535             :                   
     536           0 :                   for (Int_t i = 0; i < npart; i++) {
     537           0 :                     AliAODMCParticle* particle = (AliAODMCParticle*) mcparticles->At(i);
     538           0 :                     new((*fgAODMCParticles)[nc++]) AliAODMCParticle(*particle);
     539             :                   }
     540           0 :                 }
     541             : 
     542             :                 // tracks
     543           0 :                 TClonesArray* tracks = aodH->GetEventToMerge()->GetTracks();
     544           0 :                 if(tracks && aodH->GetMergeTracks()){
     545           0 :                   Int_t ntr = tracks->GetEntries();
     546           0 :                   nc  = fgAODTracks->GetEntries();   
     547           0 :                   for (Int_t i = 0; i < ntr; i++) {
     548           0 :                     AliAODTrack*    track = (AliAODTrack*) tracks->At(i);
     549           0 :                     AliAODTrack* newtrack = new((*fgAODTracks)[nc++]) AliAODTrack(*track);
     550           0 :                     newtrack->SetLabel(newtrack->GetLabel() + fgAODMCParticles->GetEntries());
     551             :                   }
     552             :                   
     553           0 :                   for (Int_t i = 0; i < nc; i++) 
     554             :                     {
     555           0 :                       AliAODTrack* track = (AliAODTrack*) fgAODTracks->At(i);
     556           0 :                       track->ResetBit(kIsReferenced);
     557           0 :                       track->SetUniqueID(0);
     558             :                     }
     559           0 :                 }
     560             :                 
     561             :                 // clusters
     562           0 :                 TClonesArray* clusters = aodH->GetEventToMerge()->GetCaloClusters();
     563           0 :                 if( clusters  && (aodH->GetMergeEMCALClusters() || aodH->GetMergePHOSClusters())) {
     564           0 :                   Int_t ncl  = clusters->GetEntries();
     565           0 :                   nc         =  fgAODCaloClusters->GetEntries();
     566           0 :                   for (Int_t i = 0; i < ncl; i++) {
     567           0 :                     AliAODCaloCluster*    cluster = (AliAODCaloCluster*) clusters->At(i);
     568           0 :                     if(cluster->IsEMCAL() && !aodH->GetMergeEMCALClusters() ) continue;
     569           0 :                     if(cluster->IsPHOS()  && !aodH->GetMergePHOSClusters()  ) continue;   
     570           0 :                     new((*fgAODCaloClusters)[nc++]) AliAODCaloCluster(*cluster);
     571           0 :                   }
     572           0 :                 }
     573             : 
     574             :                 // EMCAL cells
     575             :                 //*fgAODEmcalCells =  *(aod->GetEMCALCells()); // This will be valid after 10.Mar.2011.
     576           0 :                 if(aodH->GetMergeEMCALCells()) 
     577             :                   {
     578           0 :                     AliAODCaloCells* copycells = aod->GetEMCALCells();
     579           0 :                     fgAODEmcalCells->CreateContainer(copycells->GetNumberOfCells());
     580           0 :                     nc  = copycells->GetNumberOfCells();
     581             :                     
     582           0 :                     while( nc-- ){ fgAODEmcalCells->SetCell(nc,copycells->GetCellNumber(nc),copycells->GetAmplitude(nc),
     583           0 :                                                             copycells->GetTime(nc),copycells->GetMCLabel(nc),copycells->GetEFraction(nc)); }
     584             :                     
     585           0 :                     AliAODCaloCells* cellsA = aodH->GetEventToMerge()->GetEMCALCells();
     586           0 :                     if( cellsA )
     587             :                       {
     588           0 :                         Int_t ncells  = cellsA->GetNumberOfCells();
     589           0 :                         nc = fgAODEmcalCells->GetNumberOfCells();
     590             :                         
     591           0 :                         for (Int_t i  = 0; i < ncells; i++) 
     592             :                           {
     593           0 :                             Int_t cn  = cellsA->GetCellNumber(i);
     594           0 :                             Int_t pos = fgAODEmcalCells->GetCellPosition(cn);
     595             :                             
     596           0 :                             if (pos >= 0) 
     597             :                               {
     598           0 :                                 Double_t amp = cellsA->GetAmplitude(i) + fgAODEmcalCells->GetAmplitude(pos);
     599             :                                 
     600             :                                 //Check if it is MC, depending on that assing the mc lable, time and e fraction
     601             : //                              Double_t time    = 0;
     602             :                                 Int_t    mclabel =-1;
     603             :                                 Double_t efrac   = 0;
     604           0 :                                 if(cellsA->GetMCLabel(i) >= 0 && fgAODEmcalCells->GetMCLabel(pos) < 0)
     605             :                                   {
     606           0 :                                     mclabel = cellsA->GetMCLabel(i) ;
     607             : //                                  time    = fgAODEmcalCells->GetTime(pos) ; // Time from data
     608           0 :                                     if(amp > 0) efrac = cellsA->GetAmplitude(i) / amp;
     609             :                                   }
     610           0 :                                 else if(fgAODEmcalCells->GetMCLabel(pos) >= 0 &&  cellsA->GetMCLabel(i) < 0)
     611             :                                   {
     612           0 :                                     mclabel = fgAODEmcalCells->GetMCLabel(pos) ;
     613             : //                                  time    = cellsA->GetTime(i) ; // Time from data
     614           0 :                                     if(amp > 0) efrac = fgAODEmcalCells->GetAmplitude(pos) / amp;
     615             :                                   }
     616             :                                 else 
     617             :                                   { // take all from input
     618           0 :                                     mclabel = cellsA->GetMCLabel(i) ;
     619             : //                                  time    = cellsA->GetTime(i) ; 
     620           0 :                                     if(amp > 0) efrac = cellsA->GetAmplitude(i) / amp;  
     621             :                                   }
     622             :                                 
     623           0 :                                 fgAODEmcalCells->SetCell(pos, cn, amp,cellsA->GetTime(i),mclabel,efrac);
     624             :                                 
     625           0 :                               } else 
     626             :                               {
     627           0 :                                 AliAODCaloCells* copycells1 = new AliAODCaloCells(*fgAODEmcalCells);
     628           0 :                                 fgAODEmcalCells->CreateContainer(nc+1);
     629           0 :                                 Int_t nn = copycells1->GetNumberOfCells();
     630             :                                 
     631           0 :                                 while( nn-- ){ fgAODEmcalCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn),
     632           0 :                                                                         copycells1->GetTime(nn),copycells1->GetMCLabel(nn),copycells1->GetEFraction(nn)); }
     633             :                                 
     634           0 :                                 fgAODEmcalCells->SetCell(nc++,cn,cellsA->GetAmplitude(i),cellsA->GetTime(i), cellsA->GetMCLabel(i),1.);
     635             :                                 
     636           0 :                                 delete copycells1;
     637             :                               }
     638             :                           }
     639           0 :                         fgAODEmcalCells->Sort();
     640           0 :                       }
     641           0 :                   } // merge emcal cells
     642             :                 
     643             :                 
     644             :                 // PHOS cells
     645             :                 //*fgAODPhosCells =  *(aod->GetPHOSCells()); // This will be valid after 10.Mar.2011.
     646           0 :                 if(aodH->GetMergePHOSCells()) 
     647             :                   {
     648           0 :                     AliAODCaloCells* copycells = aod->GetPHOSCells();
     649           0 :                     fgAODPhosCells->CreateContainer(copycells->GetNumberOfCells());
     650           0 :                     nc  = copycells->GetNumberOfCells();
     651             :                     
     652           0 :                     while( nc-- ){ fgAODPhosCells->SetCell(nc,copycells->GetCellNumber(nc),copycells->GetAmplitude(nc),
     653           0 :                                                            copycells->GetTime(nc),copycells->GetMCLabel(nc),copycells->GetEFraction(nc)); }
     654             :                     
     655           0 :                     AliAODCaloCells* cellsP = aodH->GetEventToMerge()->GetPHOSCells();
     656           0 :                     if( cellsP )
     657             :                       {
     658           0 :                         Int_t ncellsP  = cellsP->GetNumberOfCells();
     659           0 :                         nc = fgAODPhosCells->GetNumberOfCells();
     660             :                         
     661           0 :                         for (Int_t i  = 0; i < ncellsP; i++) 
     662             :                           {
     663           0 :                             Int_t cn  = cellsP->GetCellNumber(i);
     664           0 :                             Int_t pos = fgAODPhosCells->GetCellPosition(cn);
     665             :                             
     666           0 :                             if (pos >= 0) 
     667             :                               {
     668           0 :                                 Double_t amp = cellsP->GetAmplitude(i) + fgAODPhosCells->GetAmplitude(pos);
     669             :                                 
     670             :                                 //Check if it is MC, depending on that assing the mc lable, time and e fraction
     671             : //                              Double_t time    = 0;
     672             :                                 Int_t    mclabel =-1;
     673             :                                 Double_t    efrac   = 0;
     674           0 :                                 if(cellsP->GetMCLabel(i) >= 0 && fgAODPhosCells->GetMCLabel(pos) < 0)
     675             :                                   {
     676           0 :                                     mclabel = cellsP->GetMCLabel(i) ;
     677             : //                                  time    = fgAODPhosCells->GetTime(pos) ; // Time from data
     678           0 :                                     if(amp > 0) efrac = cellsP->GetAmplitude(i) / amp;
     679             :                                   }
     680           0 :                                 else if(fgAODPhosCells->GetMCLabel(pos) >= 0 &&  cellsP->GetMCLabel(i) < 0)
     681             :                                   {
     682           0 :                                     mclabel = fgAODPhosCells->GetMCLabel(pos) ;
     683             : //                                  time    = cellsP->GetTime(i) ; // Time from data
     684           0 :                                     if(amp > 0) efrac = fgAODPhosCells->GetAmplitude(pos) / amp;
     685             :                                   }
     686             :                                 else 
     687             :                                   { // take all from input
     688           0 :                                     mclabel = cellsP->GetMCLabel(i) ;
     689             : //                                  time    = cellsP->GetTime(i) ; 
     690           0 :                                     if(amp > 0) efrac = cellsP->GetAmplitude(i) / amp;  
     691             :                                   }
     692             :                                 
     693           0 :                                 fgAODPhosCells->SetCell(pos, cn, amp,cellsP->GetTime(i),mclabel,efrac);                
     694             :                                 
     695           0 :                               } else 
     696             :                               {
     697           0 :                                 AliAODCaloCells* copycells1 = new AliAODCaloCells(*fgAODPhosCells);
     698           0 :                                 fgAODPhosCells->CreateContainer(nc+1);
     699           0 :                                 Int_t nn = copycells1->GetNumberOfCells();
     700             :                                 
     701           0 :                                 while( nn-- ){ fgAODPhosCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn), 
     702           0 :                                                                        copycells1->GetTime(nn),copycells1->GetMCLabel(nn),copycells1->GetEFraction(nn)); }
     703             :                                 
     704           0 :                                 fgAODPhosCells->SetCell(nc++,cn,cellsP->GetAmplitude(i),cellsP->GetTime(i), cellsP->GetMCLabel(i),1.);
     705             :                                 
     706           0 :                                 delete copycells1;
     707             :                               }
     708             :                           }
     709           0 :                         fgAODPhosCells->Sort();
     710           0 :                       }
     711           0 :                   } // Merge PHOS Cells
     712             :                 
     713           0 :                 if (aodH->GetMergeEMCALTrigger() && aod->GetCaloTrigger("EMCAL")) 
     714             :                 {
     715           0 :                         Int_t   tsEMCAL[48][64], px, py, ts;
     716           0 :                         Float_t foEMCAL[48][64], am;
     717             :                         
     718           0 :                         for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) 
     719             :                         {
     720           0 :                                 tsEMCAL[i][j] = 0;
     721           0 :                                 foEMCAL[i][j] = 0.;
     722             :                         }
     723             :       
     724           0 :       AliAODCaloTrigger& trg0 = *(aod->GetCaloTrigger("EMCAL"));
     725           0 :       trg0.Reset();
     726           0 :       while (trg0.Next())
     727             :       {
     728           0 :         trg0.GetPosition(px, py);
     729             :         
     730           0 :         if (px > -1 && py > -1) 
     731             :         {
     732           0 :           trg0.GetL1TimeSum(ts);
     733           0 :           if (ts > -1) tsEMCAL[px][py] += ts;
     734             :           
     735           0 :           trg0.GetAmplitude(am);
     736           0 :           if (am > -1) foEMCAL[px][py] += am;
     737             :         }
     738             :       }
     739             :       
     740           0 :       AliAODCaloTrigger& trg1 = *((aodH->GetEventToMerge())->GetCaloTrigger("EMCAL"));
     741             :       
     742           0 :       trg1.Reset();
     743           0 :       while (trg1.Next())
     744             :       {
     745           0 :         trg1.GetPosition(px, py);
     746             :         
     747           0 :         if (px > -1 && py > -1) 
     748             :         {
     749           0 :           trg1.GetL1TimeSum(ts);
     750           0 :           if (ts > -1) tsEMCAL[px][py] += ts;
     751             :           
     752           0 :           trg1.GetAmplitude(am);
     753           0 :           if (am > -1) foEMCAL[px][py] += am;
     754             :         }
     755             :       }
     756             :       
     757             :       int nEntries = 0;
     758           0 :       for (Int_t i = 0; i < 48; i++) 
     759           0 :         for (Int_t j = 0; j < 64; j++) 
     760           0 :           if (tsEMCAL[i][j] || foEMCAL[i][j]) nEntries++;
     761             :       
     762           0 :       fgAODEMCALTrigger->Allocate(nEntries);
     763           0 :       Int_t timesL0[10]; for (int i = 0; i < 10; i++) timesL0[i] = -1;
     764             :       
     765           0 :       for (Int_t i = 0; i < 48; i++) 
     766           0 :         for (Int_t j = 0; j < 64; j++) 
     767           0 :           if (tsEMCAL[i][j] || foEMCAL[i][j]) 
     768           0 :             fgAODEMCALTrigger->Add(i, j, foEMCAL[i][j], -1., timesL0, 0, tsEMCAL[i][j], 0);
     769           0 :     }
     770             :                 
     771           0 :                 if (aodH->GetMergePHOSTrigger()) 
     772             :                 {
     773             :                         // To be implemented by PHOS
     774             :                 }
     775           0 :             } // merging
     776             :             
     777           0 :             handler->SetAODIsReplicated();
     778           0 :         }
     779           0 :     }
     780             : 
     781             : 
     782             : // Call the user analysis    
     783          56 :         if (isSelected) UserExec(option);
     784             :     
     785             : // Added protection in case the derived task is not an AOD producer.
     786          28 :     AliAnalysisDataSlot *out0 = GetOutputSlot(0);
     787          68 :     if (out0 && out0->IsConnected()) PostData(0, fTreeA);    
     788             : 
     789          28 :     DisconnectMultiHandler();
     790          56 : }
     791             : 
     792             : const char* AliAnalysisTaskSE::CurrentFileName()
     793             : {
     794             : // Returns the current file name    
     795           0 :     if( fInputHandler )
     796           0 :       return fInputHandler->GetTree()->GetCurrentFile()->GetName();
     797           0 :     else if( fMCEvent )
     798           0 :       return ((AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()))->TreeK()->GetCurrentFile()->GetName();
     799           0 :     else return "";
     800           0 : }
     801             : 
     802             : void AliAnalysisTaskSE::AddAODBranch(const char* cname, void* addobj, const char *fname)
     803             : {
     804             :     // Add a new branch to the aod tree
     805           6 :     AliAODHandler* handler = dynamic_cast<AliAODHandler*> 
     806           4 :         ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
     807           2 :     if (handler) {
     808           2 :         handler->AddBranch(cname, addobj, fname);
     809           2 :     }
     810           2 : }
     811             : 
     812             : Bool_t AliAnalysisTaskSE::IsStandardAOD() const
     813             : {
     814             : // Check if the output AOD handler is configured for standard or delta AOD.
     815             : // Users should first check that AODEvent() returns non-null.
     816           0 :     AliAODHandler* handler = dynamic_cast<AliAODHandler*> 
     817           0 :          ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
     818           0 :     if (!handler) {
     819           0 :        Error("IsStandardAOD", "No AOD handler. Please use AODEvent() to check this first");
     820           0 :        return kTRUE;
     821             :     }
     822           0 :     return handler->IsStandard();   
     823           0 : }
     824             : 
     825             : Bool_t AliAnalysisTaskSE::Notify()
     826             : {
     827           4 :     return (UserNotify());
     828             : }
     829             : 
     830             : const AliEventTag *AliAnalysisTaskSE::EventTag() const
     831             : {
     832             : // Returns tag for the current event, if any. The return value should always be checked by the user.
     833           0 :    if (!fInputHandler) {
     834           0 :       Error("EventTag", "Input handler not yet available. Call this in UserExec");
     835           0 :       return NULL;
     836             :    }
     837           0 :    return fInputHandler->GetEventTag();
     838           0 : }
     839             : 
     840             : void AliAnalysisTaskSE::LoadBranches() const
     841             : {
     842             : // Load all branches declared in fBranchNames data member of the parent class.
     843             : // Should be called in UserExec.
     844           0 :   if (!fInputHandler) {
     845           0 :      Error("LoadBranches", "Input handler not available yet. Call this in UserExec");
     846           0 :      return;
     847             :   }
     848           0 :   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
     849           0 :   if (mgr->GetAutoBranchLoading()) return;
     850           0 :   TString taskbranches;
     851           0 :   GetBranches(fInputHandler->GetDataType(), taskbranches);
     852           0 :   if (taskbranches.IsNull()) return;
     853           0 :   TObjArray *arr = taskbranches.Tokenize(",");
     854           0 :   TIter next(arr);
     855             :   TObject *obj;
     856           0 :   while ((obj=next())) mgr->LoadBranch(obj->GetName());
     857           0 :   delete arr;
     858           0 : }
     859             : 
     860             : 
     861             : //_________________________________________________________________________________________________
     862             : void AliAnalysisTaskSE::ConnectMultiHandler()
     863             : {
     864             :    //
     865             :    // Connect MultiHandler
     866             :    //
     867          80 :    fInputHandler = (AliInputEventHandler *)((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
     868         120 :    fMultiInputHandler = dynamic_cast<AliMultiInputEventHandler *>(fInputHandler);
     869          40 :    if (fMultiInputHandler) {
     870           0 :       fInputHandler = dynamic_cast<AliInputEventHandler *>(fMultiInputHandler->GetFirstInputEventHandler());
     871           0 :       fMCEventHandler = dynamic_cast<AliInputEventHandler *>(fMultiInputHandler->GetFirstMCEventHandler());
     872           0 :    } else { 
     873         103 :       fMCEventHandler = dynamic_cast<AliInputEventHandler *>((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
     874             :    }
     875          63 :    if (fMCEventHandler) fMCEvent = fMCEventHandler->MCEvent();
     876          40 : }
     877             : 
     878             : //_________________________________________________________________________________________________
     879             : void AliAnalysisTaskSE::DisconnectMultiHandler()
     880             : {
     881             :    //
     882             :    // Disconnect MultiHandler
     883             :    //
     884          80 :    if (fMultiInputHandler) fInputHandler = fMultiInputHandler;
     885          40 : }
     886             : 
     887             : /**
     888             :  * Perform track selection in case a virtual track selection is provided.
     889             :  * @return List of accepted tracks in case a track selection is provided, null otherwise
     890             :  */
     891             : TObjArray *AliAnalysisTaskSE::GetAcceptedTracks(){
     892             :   TObjArray *result = NULL;
     893           0 :   if(fTrackSelection) result = fTrackSelection->GetAcceptedTracks(InputEvent());
     894           0 :   return result;
     895             : }

Generated by: LCOV version 1.11