]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnAnalysisSE.cxx
Implemented a static AliRsnEvent pointer to point to the current event being analyzed...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysisSE.cxx
index 6912e88b73afb20bf682a3a7898290cc5408c0a3..e37b1697fcfb14a5e96e22e2708903f2118ea7a2 100644 (file)
@@ -31,10 +31,10 @@ AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name, Bool_t useKine) :
 {
 //
 // Default constructor.
+// Defines another output slot for histograms/ntuples
 //
-  AliDebug(AliLog::kDebug+2, "<-");
+
   DefineOutput(2, TList::Class());
-  AliDebug(AliLog::kDebug+2,"->");
 }
 
 //_____________________________________________________________________________
@@ -55,7 +55,7 @@ AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) :
 AliRsnAnalysisSE& AliRsnAnalysisSE::operator=(const AliRsnAnalysisSE& copy)
 {
 //
-// Copy constructor.
+// Assigment operator.
 //
 
   AliRsnVAnalysisTaskSE::operator=(copy);
@@ -75,19 +75,16 @@ void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
 //
 // Creation of output objects.
 // These are created through the utility methods in the analysis manager,
-// which produces a list of histograms for each specified set of pairs.
-// Each of these lists is added to the main list of this task.
+// which asks all the AliRsnPair objects to initialize their output which
+// is then linked to the TList data member of this, which will contain all the output.
 //
 
-  AliDebug(AliLog::kDebug+2,"<-");
-
-  if (fOutList) fOutList->Clear();
-  fOutList = new TList;
+  if (!fOutList) fOutList = new TList;
+  fOutList->Clear();
+  
   fRsnAnalysisManager.InitAllPairs(fOutList);
 
   PostData(2, fOutList);
-
-  AliDebug(AliLog::kDebug+2,"->");
 }
 
 //_____________________________________________________________________________
@@ -95,71 +92,18 @@ void AliRsnAnalysisSE::RsnUserExec(Option_t*)
 {
 //
 // Execution of the analysis task.
-// Recovers the input event and processes it with all included pair objects.
+// Recovers the input event and processes it with all included pair objects,
+// using 'reconstructed' or 'MonteCarlo' functions depending on MC-only flag.
 //
 
-  AliDebug(AliLog::kDebug+2,"<-");
+  if (fMCOnly) 
+    fRsnAnalysisManager.ProcessAllPairsMC();
+  else 
+    fRsnAnalysisManager.ProcessAllPairs();
   
-  fTaskInfo.SetEventUsed(kFALSE);
-
-  if (fESDEvent) {
-    AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent));
-    AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks()));
-  }
-  if (fMCEvent) {
-    AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent));
-    AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks()));
-  }
-  if (fAODEventIn) {
-    AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn));
-    AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks()));
-  }
-  if (fAODEventOut) {
-    AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut));
-    AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks()));
-  }
-
-  // Removing empty events
-  if (fRsnEvent.GetMultiplicity()<=0) {
-    AliDebug(AliLog::kDebug, "Zero event!!! Skipping ...");
-    fTaskInfo.SetEventUsed(kFALSE);
-    if (fUseZeroEventWarning)
-    {
-      TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName());
-      if (!hist) return;
-      Double_t zeroEventPercent = 0.0;
-      if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100;
-      if ((zeroEventPercent>fZeroEventPercentWarning)&&(fEntry>100))
-        AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!",zeroEventPercent,fEntry));
-    }
-    return;
-  }
-
-  // if general event cuts are added to the task (recommended)
-  // they are checked here on the RSN event interface and,
-  // if the event does not pass them, it is skipped and ProcessInfo
-  // is updated accordingly
-//   if (fEventCuts) {
-    if (!fEventCuts.IsSelected(&fRsnEvent)) {
-      fTaskInfo.SetEventUsed(kFALSE);
-      return;
-    }
-//   }
-
-  // if cuts are passed or not cuts were defined,
-  // update the task info...
-  fTaskInfo.SetEventUsed(kTRUE);
-
-  // the virtual class has already sorted tracks in the PID index
-  // so we need here just to call the execution of analysis
-  if (!fMCOnly) fRsnAnalysisManager.ProcessAllPairs(&fRsnEvent, &fRsnEvent);
-  else fRsnAnalysisManager.ProcessAllPairsMC(&fRsnEvent, &fRsnEvent);
   PostData(2, fOutList);
-
-  AliDebug(AliLog::kDebug+2,"->");
 }
 
-
 //_____________________________________________________________________________
 void AliRsnAnalysisSE::RsnTerminate(Option_t*)
 {
@@ -167,8 +111,61 @@ void AliRsnAnalysisSE::RsnTerminate(Option_t*)
 // Termination.
 // Could be added some monitor histograms here.
 //
-
-  AliDebug(AliLog::kDebug+2,"<-");
-  AliDebug(AliLog::kDebug+2,"->");
 }
 
+//______________________________________________________________________________
+Bool_t AliRsnAnalysisSE::EventProcess()
+{
+//
+// Customized event pre-processing.
+// First checks if the current event passes all cuts,
+// and if it does, updates the informations and then
+// call the operations which are already defined in the
+// omonyme function in mother class
+//
+
+  // initially, an event is expected to be bad
+  fTaskInfo.SetEventUsed(kFALSE);
+  
+  // check #1: number of tracks in event (reject empty events)
+  Int_t    ntracks = fRsnEvent.GetMultiplicity();
+  Double_t zeroEventPercent = 0.0;
+  if (ntracks < 1) 
+  {
+    // if using the checker for amount of empty events, update it
+    if (fUseZeroEventWarning)
+    {
+      TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName());
+      if (hist)
+      {
+        if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100;
+        if ((zeroEventPercent > fZeroEventPercentWarning) && (fEntry > 100))
+          AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!", zeroEventPercent, fEntry));
+      }
+    }
+    
+    // empty events are rejected by default
+    fTaskInfo.SetEventUsed(kFALSE);
+    AliDebug(AliLog::kDebug, "Empty event. Skipping...");
+    return kFALSE;
+  }
+
+  // check the event cuts and update the info data accordingly
+  // events not passing the cuts must be rejected
+  if (!fEventCuts.IsSelected(&fRsnEvent))
+  {
+    fTaskInfo.SetEventUsed(kFALSE);
+    return kFALSE;
+  }
+  
+  // if we reach this point, cuts were passed;
+  // then additional operations can be done
+  
+  // find leading particle (without any PID/momentum restriction)
+  fRsnEvent.SelectLeadingParticle(0);
+  
+  // final return value is positive
+  // but call the mother class method which updates info object
+  fTaskInfo.SetEventUsed(kTRUE);
+  return AliRsnVAnalysisTaskSE::EventProcess();
+}