Adding getter for closest VZERO-AND interaction record.
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Apr 2013 13:20:23 +0000 (13:20 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Apr 2013 13:20:23 +0000 (13:20 +0000)
STEER/ESD/AliESDHeader.cxx
STEER/ESD/AliESDHeader.h

index 9456740..6c7cc37 100644 (file)
@@ -570,6 +570,40 @@ Int_t AliESDHeader::GetIRInt2ClosestInteractionMap()
 }
 
 //__________________________________________________________________________
+Int_t AliESDHeader::GetIRInt1ClosestInteractionMap(Int_t gap)
+{
+  //
+  // Calculation of the closest interaction
+  // In case of VZERO (Int1) one has to introduce a gap
+  // in order to avoid false positivies from after-pulses
+
+  SetIRInteractionMap();
+
+  Int_t firstNegative=100;
+  for(Int_t item=-1; item>=-90; item--) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt1InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      firstNegative = item;
+      break;
+    }
+  }
+  Int_t firstPositive=100;
+  for(Int_t item=1+gap; item<=90; item++) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt1InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      firstPositive = item;
+      break;
+    }
+  }
+
+  Int_t closest = firstPositive < TMath::Abs(firstNegative) ? firstPositive : TMath::Abs(firstNegative);
+  if(firstPositive==100 && firstNegative==100) closest=0;
+  return closest;
+}
+
+//__________________________________________________________________________
 Int_t  AliESDHeader::GetIRInt2LastInteractionMap()
 {
   //
index 2271496..69f6dd7 100644 (file)
@@ -68,6 +68,7 @@ public:
   TBits  GetIRInt2InteractionMap() { SetIRInteractionMap(); return fIRInt2InteractionsMap; }
   TBits  GetIRInt1InteractionMap() { SetIRInteractionMap(); return fIRInt1InteractionsMap; }
   Int_t  GetIRInt2ClosestInteractionMap();
+  Int_t  GetIRInt1ClosestInteractionMap(Int_t gap = 3);
   Int_t  GetIRInt2LastInteractionMap();
 //**************************************************************************