adding hardware trigger selection
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jan 2010 15:52:08 +0000 (15:52 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jan 2010 15:52:08 +0000 (15:52 +0000)
ANALYSIS/AliPhysicsSelection.cxx

index 6eb7cd5..ec2bbc5 100644 (file)
@@ -186,56 +186,70 @@ Bool_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
       triggerAnalysis->FillHistograms(aEsd);
   
       fHistStatistics->Fill(1, i);
-    
-      Int_t fastOR = triggerAnalysis->SPDFiredChips(aEsd, 0);
+      
+      // hardware trigger (should only remove events for MC)
+      // replay CINT1B hardware trigger
+      // TODO this has to depend on the actual hardware trigger (and that depends on the run...)
+      Int_t fastORHW = triggerAnalysis->SPDFiredChips(aEsd, 1); // SPD number of chips from trigger bits (!)
       Bool_t v0A = triggerAnalysis->IsOfflineTriggerFired(aEsd, AliTriggerAnalysis::kV0A);
       Bool_t v0C = triggerAnalysis->IsOfflineTriggerFired(aEsd, AliTriggerAnalysis::kV0C);
+        
+      if (fastORHW == 0 && !v0A && !v0C)
+      {
+        AliDebug(AliLog::kDebug, "Rejecting event because hardware trigger is not fired");
+        continue;
+      }
+      
+      fHistStatistics->Fill(2, i);
+    
+      // offline trigger
+      Int_t fastOROffline = triggerAnalysis->SPDFiredChips(aEsd, 0); // SPD number of chips from clusters (!)
       Bool_t v0ABG = triggerAnalysis->IsOfflineTriggerFired(aEsd, AliTriggerAnalysis::kV0ABG);
       Bool_t v0CBG = triggerAnalysis->IsOfflineTriggerFired(aEsd, AliTriggerAnalysis::kV0CBG);
       Bool_t v0BG = v0ABG || v0CBG;
     
-      if (fastOR > 0)
-        fHistStatistics->Fill(2, i);
-      if (fastOR > 1)
+      if (fastOROffline > 0)
         fHistStatistics->Fill(3, i);
+      if (fastOROffline > 1)
+        fHistStatistics->Fill(4, i);
         
       if (v0A)
-        fHistStatistics->Fill(4, i);
-      if (v0C)
         fHistStatistics->Fill(5, i);
-      if (v0ABG)
+      if (v0C)
         fHistStatistics->Fill(6, i);
-      if (v0CBG)
+      if (v0ABG)
         fHistStatistics->Fill(7, i);
-        
-      if (fastOR > 1 && !v0BG)
+      if (v0CBG)
         fHistStatistics->Fill(8, i);
         
-      if ((fastOR > 0 || v0A || v0C) && !v0BG)
+      if (fastOROffline > 1 && !v0BG)
         fHistStatistics->Fill(9, i);
-    
-      if (fastOR > 0 && (v0A || v0C) && !v0BG)
+        
+      if ((fastOROffline > 0 || v0A || v0C) && !v0BG)
         fHistStatistics->Fill(10, i);
+    
+      if (fastOROffline > 0 && (v0A || v0C) && !v0BG)
+        fHistStatistics->Fill(11, i);
   
       if (v0A && v0C && !v0BG)
-        fHistStatistics->Fill(11, i);
+        fHistStatistics->Fill(12, i);
         
-      if (fastOR > 1 || (fastOR > 0 && (v0A || v0C)) || (v0A && v0C))
+      if (fastOROffline > 1 || (fastOROffline > 0 && (v0A || v0C)) || (v0A && v0C))
       {
         if (!v0BG)
         {
-          fHistStatistics->Fill(12, i);
+          fHistStatistics->Fill(13, i);
       
           if (fBackgroundIdentification && !fBackgroundIdentification->IsSelected(const_cast<AliESDEvent*> (aEsd)))
           {
             AliDebug(AliLog::kDebug, "Rejecting event because of background identification");
-            fHistStatistics->Fill(13, i);
+            fHistStatistics->Fill(14, i);
           }
           else
           {
             AliDebug(AliLog::kDebug, "Accepted event for histograms");
             
-            fHistStatistics->Fill(14, i);
+            fHistStatistics->Fill(15, i);
             fHistBunchCrossing->Fill(aEsd->GetBunchCrossNumber(), i);
             if (i < fCollTrigClasses.GetEntries())
               accept = kTRUE;
@@ -322,10 +336,11 @@ Bool_t AliPhysicsSelection::Initialize(UInt_t runNumber)
     if (fHistStatistics)
       delete fHistStatistics;
   
-    fHistStatistics = new TH2F("fHistStatistics", "fHistStatistics;;", 14, 0.5, 14.5, count, -0.5, -0.5 + count);
+    fHistStatistics = new TH2F("fHistStatistics", "fHistStatistics;;", 15, 0.5, 15.5, count, -0.5, -0.5 + count);
       
     Int_t n = 1;
-    fHistStatistics->GetXaxis()->SetBinLabel(n++, "Triggered");
+    fHistStatistics->GetXaxis()->SetBinLabel(n++, "Trigger class");
+    fHistStatistics->GetXaxis()->SetBinLabel(n++, "Hardware trigger");
     fHistStatistics->GetXaxis()->SetBinLabel(n++, "FO >= 1");
     fHistStatistics->GetXaxis()->SetBinLabel(n++, "FO >= 2");
     fHistStatistics->GetXaxis()->SetBinLabel(n++, "V0A");
@@ -410,9 +425,9 @@ void AliPhysicsSelection::Print(Option_t* /* option */) const
     triggerAnalysis->PrintTriggerClasses();
   }
   
-  if (fHistStatistics)
+  if (fHistStatistics && fCollTrigClasses.GetEntries() > 0)
   {
-    Printf("\nSelection statistics for first collision trigger:");
+    Printf("\nSelection statistics for first collision trigger (%s):", ((TObjString*) fCollTrigClasses.First())->String().Data());
     
     Printf("Total events with correct trigger class: %d", (Int_t) fHistStatistics->GetBinContent(1, 1));
     Printf("Selected collision candidates: %d", (Int_t) fHistStatistics->GetBinContent(fHistStatistics->GetXaxis()->FindBin("Accepted"), 1));