]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
#100350: Pileup rejection on 2013 pA data (Zaida)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Feb 2013 17:14:04 +0000 (17:14 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Feb 2013 17:14:04 +0000 (17:14 +0000)
ANALYSIS/AliAnalysisTaskESDfilter.cxx
STEER/AOD/AliAODHeader.cxx
STEER/AOD/AliAODHeader.h
STEER/ESD/AliESDHeader.cxx
STEER/ESD/AliESDHeader.h

index ab31f223f0ffd4627d199170b1ca3a837a252475..a9cc15414d866b9830dc03e5b2fd3f584c6c822a 100644 (file)
@@ -402,6 +402,9 @@ AliAODHeader* AliAnalysisTaskESDfilter::ConvertHeader(const AliESDEvent& esd)
   header->SetZDCN2Energy(esd.GetZDCN2Energy());
   header->SetZDCP2Energy(esd.GetZDCP2Energy());
   header->SetZDCEMEnergy(esd.GetZDCEMEnergy(0),esd.GetZDCEMEnergy(1));
+
+  header->SetIRInt2InteractionMap(esd.GetHeader()->GetIRInt2InteractionMap());
+  header->SetIRInt1InteractionMap(esd.GetHeader()->GetIRInt1InteractionMap());
   
   // ITS Cluster Multiplicty
   const AliMultiplicity *mult = esd.GetMultiplicity();
index d4e56d6dfe7bbdcd36879d2e1749d59e1d34e03d..7ea7e788295b7974c3ed8863c09398e05e707e83 100644 (file)
@@ -67,7 +67,9 @@ AliAODHeader::AliAODHeader() :
   fL2TriggerInputs(0),
   fTPConlyRefMult(-1), 
   fCentralityP(0),
-  fEventplaneP(0)
+  fEventplaneP(0),
+  fIRInt2InteractionsMap(0),
+  fIRInt1InteractionsMap(0)
 {
   // default constructor
 
@@ -126,7 +128,9 @@ AliAODHeader::AliAODHeader(Int_t nRun,
   fL2TriggerInputs(0),
   fTPConlyRefMult(-1), 
   fCentralityP(0),
-  fEventplaneP(0)
+  fEventplaneP(0),
+  fIRInt2InteractionsMap(0),
+  fIRInt1InteractionsMap(0)
 {
   // constructor
 
@@ -204,7 +208,9 @@ AliAODHeader::AliAODHeader(Int_t nRun,
   fL2TriggerInputs(0),
   fTPConlyRefMult(-1), 
   fCentralityP(0),
-  fEventplaneP(0)
+  fEventplaneP(0),
+  fIRInt2InteractionsMap(0),
+  fIRInt1InteractionsMap(0)
 {
   // constructor
 
@@ -269,7 +275,9 @@ AliAODHeader::AliAODHeader(const AliAODHeader& hdr) :
   fL2TriggerInputs(hdr.fL2TriggerInputs),
   fTPConlyRefMult(hdr.fTPConlyRefMult), 
   fCentralityP(new AliCentrality(*hdr.fCentralityP)),
-  fEventplaneP(new AliEventplane(*hdr.fEventplaneP))
+  fEventplaneP(new AliEventplane(*hdr.fEventplaneP)),
+  fIRInt2InteractionsMap(hdr.fIRInt2InteractionsMap),
+  fIRInt1InteractionsMap(hdr.fIRInt1InteractionsMap)
 {
   // Copy constructor.
   
@@ -343,6 +351,9 @@ AliAODHeader& AliAODHeader::operator=(const AliAODHeader& hdr)
     fL2TriggerInputs    = hdr.fL2TriggerInputs;
     fTPConlyRefMult     = hdr.fTPConlyRefMult;
 
+    fIRInt2InteractionsMap  = hdr.fIRInt2InteractionsMap;
+    fIRInt1InteractionsMap  = hdr.fIRInt1InteractionsMap;
+
     if(hdr.fEventplaneP){
       if(fEventplaneP)*fEventplaneP = *hdr.fEventplaneP;
       else fEventplaneP = new AliEventplane(*hdr.fEventplaneP);
@@ -489,3 +500,76 @@ void AliAODHeader::Print(Option_t* /*option*/) const
 
   return;
 }
+
+//__________________________________________________________________________
+Int_t AliAODHeader::FindIRIntInteractionsBXMap(Int_t difference)
+{
+  //
+  // The mapping is of 181 bits, from -90 to +90
+  //
+  Int_t bin=-1;
+
+  if(difference<-90 || difference>90) return bin;
+  else { bin = 90 + difference; }
+  
+  return bin;
+}
+
+//__________________________________________________________________________
+Int_t AliAODHeader::GetIRInt2ClosestInteractionMap()
+{
+  //
+  // Calculation of the closest interaction
+  //
+  Int_t firstNegative=100;
+  for(Int_t item=-1; item>=-90; item--) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      firstNegative = item;
+      break;
+    }
+  }
+  Int_t firstPositive=100;
+  for(Int_t item=1; item<=90; item++) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.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 AliAODHeader::GetIRInt2LastInteractionMap()
+{
+  //
+  // Calculation of the last interaction
+  //
+  Int_t lastNegative=0;
+  for(Int_t item=-90; item<=-1; item++) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      lastNegative = item;
+      break;
+    }
+  }
+  Int_t lastPositive=0;
+  for(Int_t item=90; item>=1; item--) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      lastPositive = item;
+      break;
+    }
+  }
+
+  Int_t last = lastPositive > TMath::Abs(lastNegative) ? lastPositive : TMath::Abs(lastNegative);
+  return last;
+}
index 67ea4565a78ebb4d50456a2231fe699093add41c..e94542a21eae9757f657f24a188a7ec82a78498b 100644 (file)
@@ -15,6 +15,7 @@
 #include "AliVHeader.h"
 #include "AliAODVertex.h"
 #include <TString.h>
+#include <TBits.h>
 #include "AliCentrality.h"
 #include "AliEventplane.h"
 
@@ -187,6 +188,13 @@ class AliAODHeader : public AliVHeader {
   void       SetT0spread(Int_t i, Float_t t) {
     if ((i>=0)&&(i<kT0SpreadSize)) fT0spread[i]=t;}
 
+  Int_t  FindIRIntInteractionsBXMap(Int_t difference);
+  void   SetIRInt2InteractionMap(TBits bits) { fIRInt2InteractionsMap = bits; }
+  void   SetIRInt1InteractionMap(TBits bits) { fIRInt1InteractionsMap = bits; }
+  TBits  GetIRInt2InteractionMap() { return fIRInt2InteractionsMap; }
+  TBits  GetIRInt1InteractionMap() { return fIRInt1InteractionsMap; }
+  Int_t  GetIRInt2ClosestInteractionMap();
+  Int_t  GetIRInt2LastInteractionMap();
   
  private :
   
@@ -235,7 +243,9 @@ class AliAODHeader : public AliVHeader {
   AliEventplane* fEventplaneP;     // Pointer to full event plane information
   Float_t     fVZEROEqFactors[64];  // V0 channel equalization factors for event-plane reconstruction
   Float_t     fT0spread[kT0SpreadSize]; // spread of time distributions: (TOA+T0C/2), T0A, T0C, (T0A-T0C)/2
-  ClassDef(AliAODHeader, 20);
+  TBits   fIRInt2InteractionsMap;  // map of the Int2 events (normally 0TVX) near the event, that's Int2Id-EventId in a -90 to 90 window
+  TBits   fIRInt1InteractionsMap;  // map of the Int1 events (normally V0A&V0C) near the event, that's Int1Id-EventId in a -90 to 90 window
+  ClassDef(AliAODHeader, 21);
 };
 inline
 void AliAODHeader::SetCentrality(const AliCentrality* cent)      { 
index 23c48c33bbb772902b6689e56de78fc5c4ed4d11..945674026a97f8a6165776484a9e1cff87ffe963 100644 (file)
@@ -49,7 +49,9 @@ AliESDHeader::AliESDHeader() :
   fTriggerScalersDeltaRun(),
   fTriggerInputsNames(kNTriggerInputs),
   fCTPConfig(NULL),
-  fIRBufferArray()
+  fIRBufferArray(),
+  fIRInt2InteractionsMap(0),
+  fIRInt1InteractionsMap(0)
 {
   // default constructor
 
@@ -87,7 +89,9 @@ AliESDHeader::AliESDHeader(const AliESDHeader &header) :
   fTriggerScalersDeltaRun(header.fTriggerScalersDeltaRun),
   fTriggerInputsNames(TObjArray(kNTriggerInputs)),
   fCTPConfig(header.fCTPConfig),
-  fIRBufferArray()
+  fIRBufferArray(),
+  fIRInt2InteractionsMap(header.fIRInt2InteractionsMap),
+  fIRInt1InteractionsMap(header.fIRInt1InteractionsMap)
 {
   // copy constructor
   for(Int_t i = 0; i<kNMaxIR ; i++) {
@@ -125,6 +129,9 @@ AliESDHeader& AliESDHeader::operator=(const AliESDHeader &header)
     fTriggerScalers = header.fTriggerScalers;
     fTriggerScalersDeltaEvent = header.fTriggerScalersDeltaEvent;
     fTriggerScalersDeltaRun = header.fTriggerScalersDeltaRun;
+    fIRInt2InteractionsMap = header.fIRInt2InteractionsMap;
+    fIRInt1InteractionsMap = header.fIRInt1InteractionsMap;
+
     delete fCTPConfig;
     fCTPConfig = header.fCTPConfig;
 
@@ -180,6 +187,10 @@ void AliESDHeader::Reset()
   fTriggerScalersDeltaEvent.Reset();
   fTriggerScalersDeltaRun.Reset();
   fTriggerInputsNames.Clear();
+
+  fIRInt2InteractionsMap.ResetAllBits();
+  fIRInt1InteractionsMap.ResetAllBits();
+
   delete fCTPConfig;
   fCTPConfig = 0;
   for(Int_t i=0;i<kNMaxIR;i++)if(fIRArray[i]){
@@ -467,3 +478,124 @@ TObjArray AliESDHeader::GetIRArray(Int_t int1, Int_t int2, Float_t deltaTime) co
   
   return arr;
 }
+
+//__________________________________________________________________________
+void AliESDHeader::SetIRInteractionMap()
+{
+  //
+  // Function to compute the map of interations 
+  // within 0TVX (int2) or V0A&V0C (int1) and the Event Id 
+  // Note, the zero value is excluded
+  //
+  const AliTriggerIR *ir[5] = {GetTriggerIR(0),GetTriggerIR(1),GetTriggerIR(2),GetTriggerIR(3),GetTriggerIR(4)};
+
+  Long64_t orb = (Long64_t)GetOrbitNumber();
+  Long64_t bc = (Long64_t)GetBunchCrossNumber();
+  
+  Long64_t evId = orb*3564 + bc;
+
+  for(Int_t i = 0; i < 5; ++i) {
+    if (ir[i] == NULL || ir[i]->GetNWord() == 0) continue;
+    Long64_t irOrb = (Long64_t)ir[i]->GetOrbit();
+    Bool_t* int2 = ir[i]->GetInt2s();
+    Bool_t* int1 = ir[i]->GetInt1s();
+    UShort_t* bcs = ir[i]->GetBCs();
+    for(UInt_t nW = 0; nW < ir[i]->GetNWord(); ++nW) {
+      Long64_t intId = irOrb*3564 + (Long64_t)bcs[nW];
+      if (int2[nW] == kTRUE) {
+         Int_t item = (intId-evId);
+         Int_t bin = FindIRIntInteractionsBXMap(item);
+         if(bin>=0) {
+           fIRInt2InteractionsMap.SetBitNumber(bin,kTRUE);
+         }
+      }
+      if (int1[nW] == kTRUE) {
+         Int_t item = (intId-evId);
+         Int_t bin = FindIRIntInteractionsBXMap(item);
+         if(bin>=0) {
+           fIRInt1InteractionsMap.SetBitNumber(bin,kTRUE);
+         }
+      }
+    }
+  }
+
+  fIRInt2InteractionsMap.Compact();
+  fIRInt1InteractionsMap.Compact();
+}
+
+//__________________________________________________________________________
+Int_t AliESDHeader::FindIRIntInteractionsBXMap(Int_t difference)
+{
+  //
+  // The mapping is of 181 bits, from -90 to +90
+  //
+  Int_t bin=-1;
+
+  if(difference<-90 || difference>90) return bin;
+  else { bin = 90 + difference; }
+  
+  return bin;
+}
+
+//__________________________________________________________________________
+Int_t AliESDHeader::GetIRInt2ClosestInteractionMap()
+{
+  //
+  // Calculation of the closest interaction
+  //
+  SetIRInteractionMap();
+
+  Int_t firstNegative=100;
+  for(Int_t item=-1; item>=-90; item--) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      firstNegative = item;
+      break;
+    }
+  }
+  Int_t firstPositive=100;
+  for(Int_t item=1; item<=90; item++) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.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()
+{
+  //
+  // Calculation of the last interaction
+  //
+  SetIRInteractionMap();
+
+  Int_t lastNegative=0;
+  for(Int_t item=-90; item<=-1; item++) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      lastNegative = item;
+      break;
+    }
+  }
+  Int_t lastPositive=0;
+  for(Int_t item=90; item>=1; item--) {
+    Int_t bin = FindIRIntInteractionsBXMap(item);
+    Bool_t isFired = fIRInt2InteractionsMap.TestBitNumber(bin);
+    if(isFired) {
+      lastPositive = item;
+      break;
+    }
+  }
+
+  Int_t last = lastPositive > TMath::Abs(lastNegative) ? lastPositive : TMath::Abs(lastNegative);
+  return last;
+}
index 3cd0410d099ecac85fbc4f02306bc996a372e695..2271496e71dc1fb041502254f6b2c1ee2bc87158 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <TObjArray.h>
 #include <TClonesArray.h>
+#include <TBits.h>
 #include "AliVHeader.h"
 #include "AliTriggerScalersESD.h"
 #include "AliTriggerScalersRecordESD.h"
@@ -62,6 +63,12 @@ public:
   TString     GetFiredTriggerInputs() const;
   Bool_t      IsTriggerInputFired(const char *name) const;
   const AliTriggerConfiguration*  GetCTPConfig() const { return fCTPConfig;}
+  void   SetIRInteractionMap();
+  Int_t  FindIRIntInteractionsBXMap(Int_t difference);
+  TBits  GetIRInt2InteractionMap() { SetIRInteractionMap(); return fIRInt2InteractionsMap; }
+  TBits  GetIRInt1InteractionMap() { SetIRInteractionMap(); return fIRInt1InteractionsMap; }
+  Int_t  GetIRInt2ClosestInteractionMap();
+  Int_t  GetIRInt2LastInteractionMap();
 //**************************************************************************
 
   ULong64_t GetTriggerMask() const {return fTriggerMask;}
@@ -104,10 +111,11 @@ private:
   TObjArray    fTriggerInputsNames;// Array of TNamed of the active trigger inputs (L0,L1 and L2)
   AliTriggerConfiguration*  fCTPConfig; // Trigger configuration for the run
   TObjArray    fIRBufferArray;// Array with interaction records before and after triggered event
+  TBits   fIRInt2InteractionsMap;  // map of the Int2 events (normally 0TVX) near the event, that's Int2Id-EventId within -90 +90 BXs
+  TBits   fIRInt1InteractionsMap;  // map of the Int1 events (normally V0A&V0C) near the event, that's Int1Id-EventId within -90 +90 BXs
 
 
-
-  ClassDef(AliESDHeader,10)
+  ClassDef(AliESDHeader,11)
 };
 
 #endif