From: hristov Date: Wed, 27 Feb 2013 17:14:04 +0000 (+0000) Subject: #100350: Pileup rejection on 2013 pA data (Zaida) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=4ccebdbab8571b76f9a550e57d032a35ecb619ae;p=u%2Fmrichter%2FAliRoot.git #100350: Pileup rejection on 2013 pA data (Zaida) --- diff --git a/ANALYSIS/AliAnalysisTaskESDfilter.cxx b/ANALYSIS/AliAnalysisTaskESDfilter.cxx index ab31f223f0f..a9cc15414d8 100644 --- a/ANALYSIS/AliAnalysisTaskESDfilter.cxx +++ b/ANALYSIS/AliAnalysisTaskESDfilter.cxx @@ -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(); diff --git a/STEER/AOD/AliAODHeader.cxx b/STEER/AOD/AliAODHeader.cxx index d4e56d6dfe7..7ea7e788295 100644 --- a/STEER/AOD/AliAODHeader.cxx +++ b/STEER/AOD/AliAODHeader.cxx @@ -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; +} diff --git a/STEER/AOD/AliAODHeader.h b/STEER/AOD/AliAODHeader.h index 67ea4565a78..e94542a21ea 100644 --- a/STEER/AOD/AliAODHeader.h +++ b/STEER/AOD/AliAODHeader.h @@ -15,6 +15,7 @@ #include "AliVHeader.h" #include "AliAODVertex.h" #include +#include #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)&&(iGetNWord() == 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; +} diff --git a/STEER/ESD/AliESDHeader.h b/STEER/ESD/AliESDHeader.h index 3cd0410d099..2271496e71d 100644 --- a/STEER/ESD/AliESDHeader.h +++ b/STEER/ESD/AliESDHeader.h @@ -14,6 +14,7 @@ #include #include +#include #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