#include "AliESD.h"
#include "AliAODEvent.h"
#include "AliAODHeader.h"
+#include "AliAODVZERO.h"
+#include "AliTOFHeader.h"
#include "AliAODTracklets.h"
#include "AliAODCaloCells.h"
#include "AliAODCaloTrigger.h"
ClassImp(AliAnalysisTaskSE)
////////////////////////////////////////////////////////////////////////
-AliAODHeader* AliAnalysisTaskSE::fgAODHeader = NULL;
+AliVHeader* AliAnalysisTaskSE::fgAODHeader = NULL;
+AliTOFHeader* AliAnalysisTaskSE::fgTOFHeader = NULL;
+AliAODVZERO* AliAnalysisTaskSE::fgAODVZERO = NULL;
TClonesArray* AliAnalysisTaskSE::fgAODTracks = NULL;
TClonesArray* AliAnalysisTaskSE::fgAODVertices = NULL;
TClonesArray* AliAnalysisTaskSE::fgAODV0s = NULL;
AliAODCaloTrigger* AliAnalysisTaskSE::fgAODEMCALTrigger = NULL;
AliAODCaloTrigger* AliAnalysisTaskSE::fgAODPHOSTrigger = NULL;
TClonesArray* AliAnalysisTaskSE::fgAODDimuons = NULL;
+TClonesArray* AliAnalysisTaskSE::fgAODHmpidRings = NULL;
AliAnalysisTaskSE::AliAnalysisTaskSE():
AliAnalysisTask(),
// Connect input handlers (multi input handler is handled)
ConnectMultiHandler();
- if (fInputHandler) {
- if ((fInputHandler->GetTree())->GetBranch("ESDfriend."))
+ if (fInputHandler && fInputHandler->GetTree()) {
+ if (fInputHandler->GetTree()->GetBranch("ESDfriend."))
fESDfriend = ((AliESDInputHandler*)fInputHandler)->GetESDfriend();
fInputEvent = fInputHandler->GetEvent();
fgAODHeader = new AliAODHeader;
handler->AddBranch("AliAODHeader", &fgAODHeader);
}
+ if ((handler->NeedsTOFHeaderReplication() || merging) && !(fgTOFHeader))
+ {
+ if (fDebug > 1) AliInfo("Replicating TOFheader");
+ fgTOFHeader = new AliTOFHeader;
+ handler->AddBranch("AliTOFHeader", &fgTOFHeader);
+ }
+ if ((handler->NeedsVZEROReplication() || merging) && !(fgAODVZERO))
+ {
+ if (fDebug > 1) AliInfo("Replicating VZERO");
+ fgAODVZERO = new AliAODVZERO;
+ handler->AddBranch("AliAODVZERO", &fgAODVZERO);
+ }
+
if ((handler->NeedsTracksBranchReplication() || merging) && !(fgAODTracks))
{
if (fDebug > 1) AliInfo("Replicating track branch\n");
fgAODMCParticles->SetName("mcparticles");
handler->AddBranch("TClonesArray", &fgAODMCParticles);
}
- if ((handler->NeedsDimuonsBranchReplication() || merging) && !(fgAODDimuons))
+ if ((handler->NeedsDimuonsBranchReplication() || merging) && !(fgAODDimuons))
{
if (fDebug > 1) AliInfo("Replicating dimuon branch\n");
fgAODDimuons = new TClonesArray("AliAODDimuon",0);
fgAODDimuons->SetName("dimuons");
handler->AddBranch("TClonesArray", &fgAODDimuons);
}
+ if ((handler->NeedsHMPIDBranchReplication() || merging) && !(fgAODHmpidRings))
+ {
+ if (fDebug > 1) AliInfo("Replicating HMPID branch\n");
+ fgAODHmpidRings = new TClonesArray("AliAODHMPIDrings",0);
+ fgAODHmpidRings->SetName("hmpidRings");
+ handler->AddBranch("TClonesArray", &fgAODHmpidRings);
+ }
+
// cache the pointerd in the AODEvent
fOutputAOD->GetStdContent();
{
//
// Exec analysis of one event
-
+
ConnectMultiHandler();
-
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (mgr->GetDebugLevel() > 1) {
+ if (!mgr->GetTopTasks()->FindObject(this))
+ printf(" -> Executing sub-task %s\n", GetName());
+ }
if ( fDebug >= 10)
printf("Task is active %5d\n", IsActive());
if (fDebug > 1) AliInfo("AliAnalysisTaskSE::Exec() \n");
//
- AliAODHandler* handler = dynamic_cast<AliAODHandler*>
- ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
+ AliAODHandler* handler = dynamic_cast<AliAODHandler*>(mgr->GetOutputEventHandler());
AliAODInputHandler* aodH = dynamic_cast<AliAODInputHandler*>(fInputHandler);
//
// Get the actual offline trigger mask for the event and AND it with the
// requested mask. If no mask requested select by default the event.
if (fOfflineTriggerMask)
- isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
+ isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
}
// Functionality below moved in the filter tasks (AG)
// if (handler) handler->SetFillAOD(isSelected);
if( fInputHandler ) {
- fEntry = fInputHandler->GetReadEntry();
- fESDfriend = ((AliESDInputHandler*)fInputHandler)->GetESDfriend();
+ fEntry = fInputHandler->GetReadEntry();
+ fESDfriend = ((AliESDInputHandler*)fInputHandler)->GetESDfriend();
}
-// Notify the change of run number
+ // Notify the change of run number
if (InputEvent() && (InputEvent()->GetRunNumber() != fCurrentRunNumber)) {
fCurrentRunNumber = InputEvent()->GetRunNumber();
NotifyRun();
- }
-
- else if( fMCEvent )
- fEntry = fMCEvent->Header()->GetEvent();
- if ( !((Entry()-1)%100) && fDebug > 0)
- AliInfo(Form("%s ----> Processing event # %lld", CurrentFileName(), Entry()));
+ } else if( fMCEvent )
+ fEntry = fMCEvent->Header()->GetEvent();
+ if ( !((Entry()-1)%100) && fDebug > 0)
+ AliInfo(Form("%s ----> Processing event # %lld", CurrentFileName(), Entry()));
-
+ if (aodH) fMCEvent = aodH->MCEvent();
if (handler && aodH) {
- fMCEvent = aodH->MCEvent();
Bool_t merging = aodH->GetMergeEvents();
-
- // Do not analyze merged events if last embedded file has less events than normal event,
- // skip analysis after last embeded event
- if(merging){
- if(aodH->GetReadEntry() + aodH->GetMergeOffset() >= aodH->GetTreeToMerge()->GetEntriesFast()){
- //printf("Skip Entry %lld, Offset %d, Tree Entries %d\n",aodH->GetReadEntry(),aodH->GetMergeOffset(), aodH->GetTreeToMerge()->GetEntries());
-
- // Do I need to add the lines before the return?
- // Added protection in case the derived task is not an AOD producer.
- AliAnalysisDataSlot *out0 = GetOutputSlot(0);
- if (out0 && out0->IsConnected()) PostData(0, fTreeA);
-
- DisconnectMultiHandler();
-
- return;
- }
- //else printf("MERGE Entry %lld, Offset %d, Tree Entries %d\n",aodH->GetReadEntry(),aodH->GetMergeOffset(), aodH->GetTreeToMerge()->GetEntries());
- }
+ // Do not analyze merged events if last embedded file has less events than normal event,
+ // skip analysis after last embeded event
+ if(merging){
+ if(aodH->GetReadEntry() + aodH->GetMergeOffset() >= aodH->GetTreeToMerge()->GetEntriesFast()){
+ // Do I need to add the lines before the return?
+ // Added protection in case the derived task is not an AOD producer.
+ AliAnalysisDataSlot *out0 = GetOutputSlot(0);
+ if (out0 && out0->IsConnected()) PostData(0, fTreeA);
+ DisconnectMultiHandler();
+ return;
+ }
+ }
AliAODEvent* aod = dynamic_cast<AliAODEvent*>(InputEvent());
// copy the contents by assigment
*fgAODHeader = *(aod->GetHeader());
}
+ if ((handler->NeedsTOFHeaderReplication() || merging) && (fgTOFHeader))
+ {
+ if (aod->GetTOFHeader()) *fgTOFHeader = *(aod->GetTOFHeader());
+ }
+ if ((handler->NeedsVZEROReplication() || merging) && (fgAODVZERO) && aod->GetVZEROData())
+ {
+ *fgAODVZERO = *(aod->GetVZEROData());
+ }
+
if ((handler->NeedsTracksBranchReplication() || (merging && aodH->GetMergeTracks())) && (fgAODTracks))
{
TClonesArray* tracks = aod->GetTracks();
}
}
}
+ if ((handler->NeedsHMPIDBranchReplication()) && (fgAODHmpidRings))
+ {
+ TClonesArray* hmpidRings = aod->GetHMPIDrings();
+ new (fgAODHmpidRings) TClonesArray(*hmpidRings);
+ }
+
+
+
// Additional merging if needed
if (merging) {
Int_t nc;
Double_t amp = cellsA->GetAmplitude(i) + fgAODEmcalCells->GetAmplitude(pos);
//Check if it is MC, depending on that assing the mc lable, time and e fraction
- Double_t time = 0;
+// Double_t time = 0;
Int_t mclabel =-1;
- Int_t efrac = 0;
- if(cellsA->GetMCLabel(i) >= 0 && fgAODEmcalCells->GetMCLabel(i) < 0)
+ Double_t efrac = 0;
+ if(cellsA->GetMCLabel(i) >= 0 && fgAODEmcalCells->GetMCLabel(pos) < 0)
{
mclabel = cellsA->GetMCLabel(i) ;
- time = fgAODEmcalCells->GetTime(i) ; // Time from data
+// time = fgAODEmcalCells->GetTime(pos) ; // Time from data
if(amp > 0) efrac = cellsA->GetAmplitude(i) / amp;
}
- else if(fgAODEmcalCells->GetMCLabel(i) >= 0 && cellsA->GetMCLabel(i) < 0)
+ else if(fgAODEmcalCells->GetMCLabel(pos) >= 0 && cellsA->GetMCLabel(i) < 0)
{
- mclabel = fgAODEmcalCells->GetMCLabel(i) ;
- time = cellsA->GetTime(i) ; // Time from data
- if(amp > 0) efrac = fgAODEmcalCells->GetAmplitude(i) / amp;
+ mclabel = fgAODEmcalCells->GetMCLabel(pos) ;
+// time = cellsA->GetTime(i) ; // Time from data
+ if(amp > 0) efrac = fgAODEmcalCells->GetAmplitude(pos) / amp;
}
else
{ // take all from input
mclabel = cellsA->GetMCLabel(i) ;
- time = cellsA->GetTime(i) ;
+// time = cellsA->GetTime(i) ;
if(amp > 0) efrac = cellsA->GetAmplitude(i) / amp;
}
Int_t nn = copycells1->GetNumberOfCells();
while( nn-- ){ fgAODEmcalCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn),
- copycells1->GetTime(nn),copycells1->GetMCLabel(nn),0.); }
+ copycells1->GetTime(nn),copycells1->GetMCLabel(nn),copycells1->GetEFraction(nn)); }
- fgAODEmcalCells->SetCell(nc++,cn,cellsA->GetAmplitude(i),cellsA->GetTime(i), cellsA->GetMCLabel(i),0.);
+ fgAODEmcalCells->SetCell(nc++,cn,cellsA->GetAmplitude(i),cellsA->GetTime(i), cellsA->GetMCLabel(i),1.);
delete copycells1;
}
Double_t amp = cellsP->GetAmplitude(i) + fgAODPhosCells->GetAmplitude(pos);
//Check if it is MC, depending on that assing the mc lable, time and e fraction
- Double_t time = 0;
+// Double_t time = 0;
Int_t mclabel =-1;
- Int_t efrac = 0;
- if(cellsP->GetMCLabel(i) >= 0 && fgAODPhosCells->GetMCLabel(i) < 0)
+ Double_t efrac = 0;
+ if(cellsP->GetMCLabel(i) >= 0 && fgAODPhosCells->GetMCLabel(pos) < 0)
{
mclabel = cellsP->GetMCLabel(i) ;
- time = fgAODPhosCells->GetTime(i) ; // Time from data
+// time = fgAODPhosCells->GetTime(pos) ; // Time from data
if(amp > 0) efrac = cellsP->GetAmplitude(i) / amp;
}
- else if(fgAODPhosCells->GetMCLabel(i) >= 0 && cellsP->GetMCLabel(i) < 0)
+ else if(fgAODPhosCells->GetMCLabel(pos) >= 0 && cellsP->GetMCLabel(i) < 0)
{
- mclabel = fgAODPhosCells->GetMCLabel(i) ;
- time = cellsP->GetTime(i) ; // Time from data
- if(amp > 0) efrac = fgAODPhosCells->GetAmplitude(i) / amp;
+ mclabel = fgAODPhosCells->GetMCLabel(pos) ;
+// time = cellsP->GetTime(i) ; // Time from data
+ if(amp > 0) efrac = fgAODPhosCells->GetAmplitude(pos) / amp;
}
else
{ // take all from input
mclabel = cellsP->GetMCLabel(i) ;
- time = cellsP->GetTime(i) ;
+// time = cellsP->GetTime(i) ;
if(amp > 0) efrac = cellsP->GetAmplitude(i) / amp;
}
Int_t nn = copycells1->GetNumberOfCells();
while( nn-- ){ fgAODPhosCells->SetCell(nn,copycells1->GetCellNumber(nn),copycells1->GetAmplitude(nn),
- copycells1->GetTime(nn),copycells1->GetMCLabel(nn),0.); }
+ copycells1->GetTime(nn),copycells1->GetMCLabel(nn),copycells1->GetEFraction(nn)); }
- fgAODPhosCells->SetCell(nc++,cn,cellsP->GetAmplitude(i),cellsP->GetTime(i), cellsP->GetMCLabel(i),0.);
+ fgAODPhosCells->SetCell(nc++,cn,cellsP->GetAmplitude(i),cellsP->GetTime(i), cellsP->GetMCLabel(i),1.);
delete copycells1;
}
// Call the user analysis
- if (!fMCEventHandler) {
- if (isSelected)
- UserExec(option);
- } else {
- if (isSelected && (fMCEventHandler->InitOk()))
- UserExec(option);
- }
+ if (isSelected) UserExec(option);
// Added protection in case the derived task is not an AOD producer.
AliAnalysisDataSlot *out0 = GetOutputSlot(0);
TIter next(arr);
TObject *obj;
while ((obj=next())) mgr->LoadBranch(obj->GetName());
+ delete arr;
}
fMultiInputHandler = dynamic_cast<AliMultiInputEventHandler *>(fInputHandler);
if (fMultiInputHandler) {
fInputHandler = dynamic_cast<AliInputEventHandler *>(fMultiInputHandler->GetFirstInputEventHandler());
- fMCEventHandler = dynamic_cast<AliMCEventHandler *>(fMultiInputHandler->GetFirstMCEventHandler());
+ fMCEventHandler = dynamic_cast<AliInputEventHandler *>(fMultiInputHandler->GetFirstMCEventHandler());
} else {
- fMCEventHandler = dynamic_cast<AliMCEventHandler *>((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
+ fMCEventHandler = dynamic_cast<AliInputEventHandler *>((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
}
if (fMCEventHandler) fMCEvent = fMCEventHandler->MCEvent();
}