X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PWG2%2FRESONANCES%2FAliRsnVAnalysisTaskSE.cxx;h=e7d2f082df6fcb1afd057645eacb192fb9927c3c;hb=2a1c76964ec70e2a3df481d30b458763eb997722;hp=7720935058da677bc8b5407ef7fa6fbd59a4e929;hpb=cfaba8346a06048dcb2413c979caccbac59da523;p=u%2Fmrichter%2FAliRoot.git diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx index 7720935058d..e7d2f082df6 100644 --- a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx +++ b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx @@ -23,40 +23,40 @@ ClassImp(AliRsnVAnalysisTaskSE) //_____________________________________________________________________________ AliRsnVAnalysisTaskSE::AliRsnVAnalysisTaskSE (const char *name, Bool_t mcOnly) : - AliAnalysisTaskSE(name), - fLogType(AliLog::kInfo), - fLogClassesString(""), - fESDEvent(0x0), - fMCEvent(0x0), - fAODEventIn(0x0), - fAODEventOut(0x0), - fMCOnly(mcOnly), - fRsnEvent(), - fInfoList(0x0), - fTaskInfo(name) + AliAnalysisTaskSE(name), + fLogType(AliLog::kInfo), + fLogClassesString(""), + fESDEvent(0x0), + fMCEvent(0x0), + fAODEventIn(0x0), + fAODEventOut(0x0), + fMCOnly(mcOnly), + fRsnEvent(), + fInfoList(0x0), + fTaskInfo(name) { // // Default constructor. // Define the output slot for histograms. // - DefineOutput(1, TList::Class()); - DefineOutput(2, TList::Class()); + DefineOutput(1, TList::Class()); + DefineOutput(2, TList::Class()); } //_____________________________________________________________________________ AliRsnVAnalysisTaskSE::AliRsnVAnalysisTaskSE(const AliRsnVAnalysisTaskSE& copy) : - AliAnalysisTaskSE(copy), - fLogType(copy.fLogType), - fLogClassesString(copy.fLogClassesString), - fESDEvent(copy.fESDEvent), - fMCEvent(copy.fMCEvent), - fAODEventIn(copy.fAODEventIn), - fAODEventOut(copy.fAODEventOut), - fMCOnly(copy.fMCOnly), - fRsnEvent(), - fInfoList(0x0), - fTaskInfo(copy.fTaskInfo) + AliAnalysisTaskSE(copy), + fLogType(copy.fLogType), + fLogClassesString(copy.fLogClassesString), + fESDEvent(copy.fESDEvent), + fMCEvent(copy.fMCEvent), + fAODEventIn(copy.fAODEventIn), + fAODEventOut(copy.fAODEventOut), + fMCOnly(copy.fMCOnly), + fRsnEvent(), + fInfoList(0x0), + fTaskInfo(copy.fTaskInfo) { // // Copy constructor. @@ -72,8 +72,8 @@ void AliRsnVAnalysisTaskSE::LocalInit() // Defines the debug message level and calls the mother class LocalInit(). // - AliAnalysisTaskSE::LocalInit(); - SetDebugForAllClasses(); + AliAnalysisTaskSE::LocalInit(); + SetDebugForAllClasses(); } //_____________________________________________________________________________ @@ -83,7 +83,7 @@ Bool_t AliRsnVAnalysisTaskSE::UserNotify() // Calls the mother class Notify() // - return AliAnalysisTaskSE::UserNotify(); + return AliAnalysisTaskSE::UserNotify(); } //_____________________________________________________________________________ @@ -94,34 +94,31 @@ void AliRsnVAnalysisTaskSE::ConnectInputData(Option_t *opt) // the pointer to the input event, which is dynamically casted // to all available types, and this allows to know its type. // Calls also the mother class omonyme method. -// - - AliAnalysisTaskSE::ConnectInputData(opt); - - // get AliESDEvent and, if successful - // retrieve the corresponding MC if exists - fESDEvent = dynamic_cast(fInputEvent); - if (fESDEvent) - { - fMCEvent = (AliMCEvent*) MCEvent(); - AliInfo(Form("Input event is of type ESD (%p)", fESDEvent)); - if (fMCEvent) AliInfo(Form("Input has an associated MC (%p)", fMCEvent)); - } - - // get AliAODEvent from input and, if successful - // it will contain both the reconstructed and MC informations - fAODEventIn = dynamic_cast(fInputEvent); - if (fAODEventIn) - { - AliInfo(Form("Input event if of type native AOD (%p)", fAODEventIn)); - } - - // get AliAODEvent from output of previous task - fAODEventOut = dynamic_cast(AODEvent()); - if (fAODEventOut) - { - AliInfo(Form("Input event if of type produced AOD from previous step (%p)",fAODEventOut)); - } +// + + AliAnalysisTaskSE::ConnectInputData(opt); + + // get AliESDEvent and, if successful + // retrieve the corresponding MC if exists + fESDEvent = dynamic_cast(fInputEvent); + if (fESDEvent) { + fMCEvent = (AliMCEvent*) MCEvent(); + AliInfo(Form("Input event is of type ESD (%p)", fESDEvent)); + if (fMCEvent) AliInfo(Form("Input has an associated MC (%p)", fMCEvent)); + } + + // get AliAODEvent from input and, if successful + // it will contain both the reconstructed and MC informations + fAODEventIn = dynamic_cast(fInputEvent); + if (fAODEventIn) { + AliInfo(Form("Input event if of type native AOD (%p)", fAODEventIn)); + } + + // get AliAODEvent from output of previous task + fAODEventOut = dynamic_cast(AODEvent()); + if (fAODEventOut) { + AliInfo(Form("Input event if of type produced AOD from previous step (%p)", fAODEventOut)); + } } //_____________________________________________________________________________ @@ -134,17 +131,17 @@ void AliRsnVAnalysisTaskSE::UserCreateOutputObjects() // in the applications of this base class. // - SetDebugForAllClasses(); + SetDebugForAllClasses(); - // set event info outputs - fInfoList = new TList(); - fInfoList->SetOwner(); - fTaskInfo.GenerateInfoList(fInfoList); - - // create customized outputs - RsnUserCreateOutputObjects(); + // set event info outputs + fInfoList = new TList(); + fInfoList->SetOwner(); + fTaskInfo.GenerateInfoList(fInfoList); - PostData(1, fInfoList); + // create customized outputs + RsnUserCreateOutputObjects(); + + PostData(1, fInfoList); } //_____________________________________________________________________________ @@ -156,58 +153,48 @@ void AliRsnVAnalysisTaskSE::UserExec(Option_t* opt) // objects obtained from dynamic-casts called in ConnectInputData(). // - if (fMCOnly && fMCEvent) - { - fRsnEvent.SetRef (fMCEvent); - fRsnEvent.SetRefMC(fMCEvent); - } - else if (fESDEvent) - { - fRsnEvent.SetRef (fESDEvent); - fRsnEvent.SetRefMC(fMCEvent); - } - else if (fAODEventOut) - { - fRsnEvent.SetRef (fAODEventOut); - fRsnEvent.SetRefMC(fAODEventOut); - } - else if (fAODEventIn) - { - fRsnEvent.SetRef (fAODEventIn); - fRsnEvent.SetRefMC(fAODEventIn); - } - else - { - AliError("Unknown input event format. Skipping"); - return; - } - - // since this class is for single-event analysis - // both static pointers of AliRsnEvent class - // will point to the same unique datamember - AliRsnEvent::SetCurrentEvent1(&fRsnEvent, fEntry); - AliRsnEvent::SetCurrentEvent2(&fRsnEvent, fEntry); - AliRsnTarget::SwitchToFirst(); - - // call event preprocessing... - Bool_t preCheck = EventProcess(); - // ...then fill the information object and print informations... - fTaskInfo.FillInfo(); - fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); - // ...and return if event did not pass selections - if (!preCheck) - { - AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); - return; - } - - - // call customized implementation for execution - RsnUserExec(opt); - - // post outputs for the info object - // (eventually others are done in the derived classes) - PostData(1, fInfoList); + if (fMCOnly && fMCEvent) { + fRsnEvent.SetRef(fMCEvent); + fRsnEvent.SetRefMC(fMCEvent); + } else if (fESDEvent) { + fRsnEvent.SetRef(fESDEvent); + fRsnEvent.SetRefMC(fMCEvent); + } else if (fAODEventOut) { + fRsnEvent.SetRef(fAODEventOut); + fRsnEvent.SetRefMC(fAODEventOut); + } else if (fAODEventIn) { + fRsnEvent.SetRef(fAODEventIn); + fRsnEvent.SetRefMC(fAODEventIn); + } else { + AliError("Unknown input event format. Skipping"); + return; + } + + // since this class is for single-event analysis + // both static pointers of AliRsnEvent class + // will point to the same unique datamember + AliRsnEvent::SetCurrentEvent1(&fRsnEvent, fEntry); + AliRsnEvent::SetCurrentEvent2(&fRsnEvent, fEntry); + AliRsnTarget::SwitchToFirst(); + + // call event preprocessing... + Bool_t preCheck = EventProcess(); + // ...then fill the information object and print informations... + fTaskInfo.FillInfo(); + fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); + // ...and return if event did not pass selections + if (!preCheck) { + AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); + return; + } + + + // call customized implementation for execution + RsnUserExec(opt); + + // post outputs for the info object + // (eventually others are done in the derived classes) + PostData(1, fInfoList); } //_____________________________________________________________________________ @@ -219,30 +206,28 @@ void AliRsnVAnalysisTaskSE::Terminate(Option_t* opt) // and includes to the TList all task informations. // - AliAnalysisTask::Terminate(); - - TList* list = dynamic_cast(GetOutputData(1)); - if (!list) - { - AliError(Form("At end of analysis, fOutList is %p", list)); - return; - } - - RsnTerminate(opt); - - TH1I *hEventInfo = (TH1I*) list->FindObject(fTaskInfo.GetEventHistogramName()); - if (!hEventInfo) - { - AliError(Form("hEventInfo is %p", hEventInfo)); - return; - } - AliInfo(Form("=== %s ==================",GetName())); - AliInfo(Form("Number Of Events Processed : %10lld",(Long64_t)hEventInfo->Integral())); - AliInfo(Form("Number Of Events Accepted : %10lld",(Long64_t)hEventInfo->GetBinContent(2))); - AliInfo(Form("Number Of Events Skipped : %10lld",(Long64_t)hEventInfo->GetBinContent(1))); - AliInfo(Form("=== end %s ==============",GetName())); - - AliDebug(AliLog::kDebug+2, "->"); + AliAnalysisTask::Terminate(); + + TList* list = dynamic_cast(GetOutputData(1)); + if (!list) { + AliError(Form("At end of analysis, fOutList is %p", list)); + return; + } + + RsnTerminate(opt); + + TH1I *hEventInfo = (TH1I*) list->FindObject(fTaskInfo.GetEventHistogramName()); + if (!hEventInfo) { + AliError(Form("hEventInfo is %p", hEventInfo)); + return; + } + AliInfo(Form("=== %s ==================", GetName())); + AliInfo(Form("Number Of Events Processed : %10lld", (Long64_t)hEventInfo->Integral())); + AliInfo(Form("Number Of Events Accepted : %10lld", (Long64_t)hEventInfo->GetBinContent(2))); + AliInfo(Form("Number Of Events Skipped : %10lld", (Long64_t)hEventInfo->GetBinContent(1))); + AliInfo(Form("=== end %s ==============", GetName())); + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -254,7 +239,7 @@ void AliRsnVAnalysisTaskSE::RsnUserCreateOutputObjects() // in the used task. // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -264,7 +249,7 @@ void AliRsnVAnalysisTaskSE::RsnUserExec(Option_t*) // // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -274,7 +259,7 @@ void AliRsnVAnalysisTaskSE::RsnTerminate(Option_t*) // Overload this to add additional termination operations // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -282,12 +267,12 @@ Bool_t AliRsnVAnalysisTaskSE::EventProcess() { // // Performs some pre-processing of current event, -// which is useful for all the operations which +// which is useful for all the operations which // need to be done only once for each event. // - - // in this case, return always a success - return kTRUE; + + // in this case, return always a success + return kTRUE; } //_____________________________________________________________________________ @@ -297,17 +282,16 @@ void AliRsnVAnalysisTaskSE::SetDebugForAllClasses() // Set debug level for all classes for which it is required // - TObjArray *array = fLogClassesString.Tokenize(":"); - TObjString *objStr; - TString str; - Int_t i, n = array->GetEntriesFast(); - - for (i = 0; i < n; i++) - { - objStr = (TObjString*)array->At(i); - str = objStr->GetString(); - AliLog::SetClassDebugLevel(str.Data(), fLogType); - AliInfo(Form("Setting Debug to %s", str.Data())); - } + TObjArray *array = fLogClassesString.Tokenize(":"); + TObjString *objStr; + TString str; + Int_t i, n = array->GetEntriesFast(); + + for (i = 0; i < n; i++) { + objStr = (TObjString*)array->At(i); + str = objStr->GetString(); + AliLog::SetClassDebugLevel(str.Data(), fLogType); + AliInfo(Form("Setting Debug to %s", str.Data())); + } }