]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AOD/AliAODHeader.cxx
Add comment about fixing the dependencies
[u/mrichter/AliRoot.git] / STEER / AOD / AliAODHeader.cxx
index 7ea7e788295b7974c3ed8863c09398e05e707e83..ab8e3e8e3ce62cd09a2920409247e4fff4bf47db 100644 (file)
@@ -23,6 +23,8 @@
 #include "AliAODHeader.h"
 #include "AliCentrality.h"
 #include "AliEventplane.h"
+#include "AliMagF.h"
+#include <TGeoGlobalMagField.h>
 #include <TGeoMatrix.h>
 #include <TObjString.h>
 
@@ -30,12 +32,14 @@ ClassImp(AliAODHeader)
 
 //______________________________________________________________________________
 AliAODHeader::AliAODHeader() : 
-  AliVHeader(),
+  AliVAODHeader(),
   fMagneticField(-999.),
   fMuonMagFieldScale(-999.),
   fCentrality(-999.),
   fEventplane(-999.),
   fEventplaneMag(-999.),
+  fEventplaneQx(-999.),
+  fEventplaneQy(-999.),
   fZDCN1Energy(-999.),
   fZDCP1Energy(-999.),
   fZDCN2Energy(-999.),
@@ -50,6 +54,8 @@ AliAODHeader::AliAODHeader() :
   fRefMultNeg(-999),
   fNMuons(0),
   fNDimuons(0),
+  fNGlobalMuons(0),               // AU
+  fNGlobalDimuons(0),             // AU
   fEventType(0),
   fOrbitNumber(0),
   fPeriodNumber(0),
@@ -62,6 +68,7 @@ AliAODHeader::AliAODHeader() :
   fOfflineTrigger(0),
   fESDFileName(""),
   fEventNumberESDFile(-1),
+  fNumberESDTracks(-1),
   fL0TriggerInputs(0),
   fL1TriggerInputs(0),
   fL2TriggerInputs(0),
@@ -91,12 +98,14 @@ AliAODHeader::AliAODHeader(Int_t nRun,
                           UInt_t nOrbit,
                           UInt_t nPeriod,
                           const Char_t *title) :
-  AliVHeader(),
+  AliVAODHeader(),
   fMagneticField(-999.),
   fMuonMagFieldScale(-999.),
   fCentrality(-999.),
   fEventplane(-999.),
   fEventplaneMag(-999.),
+  fEventplaneQx(-999.),
+  fEventplaneQy(-999.),
   fZDCN1Energy(-999.),
   fZDCP1Energy(-999.),
   fZDCN2Energy(-999.),
@@ -111,6 +120,8 @@ AliAODHeader::AliAODHeader(Int_t nRun,
   fRefMultNeg(-999),
   fNMuons(0),
   fNDimuons(0),
+  fNGlobalMuons(0),               // AU
+  fNGlobalDimuons(0),             // AU
   fEventType(0),
   fOrbitNumber(nOrbit),
   fPeriodNumber(nPeriod),
@@ -123,6 +134,7 @@ AliAODHeader::AliAODHeader(Int_t nRun,
   fOfflineTrigger(0),
   fESDFileName(""),
   fEventNumberESDFile(-1),
+  fNumberESDTracks(-1),
   fL0TriggerInputs(0),
   fL1TriggerInputs(0),
   fL2TriggerInputs(0),
@@ -171,12 +183,17 @@ AliAODHeader::AliAODHeader(Int_t nRun,
                           const Float_t *vzeroEqFactors,
                           const Char_t *title,
                           Int_t nMuons,
-                          Int_t nDimuons) :
-  AliVHeader(),
+                          Int_t nDimuons,
+                          Int_t nGlobalMuons,                 // AU
+                          Int_t nGlobalDimuons) :             // AU
+  AliVAODHeader(),
   fMagneticField(magField),
   fMuonMagFieldScale(muonMagFieldScale),
   fCentrality(cent),
   fEventplane(eventplane),
+  fEventplaneMag(0),
+  fEventplaneQx(0),
+  fEventplaneQy(0),
   fZDCN1Energy(n1Energy),
   fZDCP1Energy(p1Energy),
   fZDCN2Energy(n2Energy),
@@ -191,6 +208,8 @@ AliAODHeader::AliAODHeader(Int_t nRun,
   fRefMultNeg(refMultNeg),
   fNMuons(nMuons),
   fNDimuons(nDimuons),
+  fNGlobalMuons(nGlobalMuons),               // AU
+  fNGlobalDimuons(nGlobalDimuons),           // AU
   fEventType(evttype),
   fOrbitNumber(nOrbit),
   fPeriodNumber(nPeriod),
@@ -203,6 +222,7 @@ AliAODHeader::AliAODHeader(Int_t nRun,
   fOfflineTrigger(0),
   fESDFileName(""),
   fEventNumberESDFile(-1),
+  fNumberESDTracks(-1),
   fL0TriggerInputs(0),
   fL1TriggerInputs(0),
   fL2TriggerInputs(0),
@@ -238,12 +258,14 @@ AliAODHeader::~AliAODHeader()
 
 //______________________________________________________________________________
 AliAODHeader::AliAODHeader(const AliAODHeader& hdr) :
-  AliVHeader(hdr),
+  AliVAODHeader(hdr),
   fMagneticField(hdr.fMagneticField),
   fMuonMagFieldScale(hdr.fMuonMagFieldScale),
   fCentrality(hdr.fCentrality),
   fEventplane(hdr.fEventplane),
   fEventplaneMag(hdr.fEventplaneMag),
+  fEventplaneQx(hdr.fEventplaneQx),
+  fEventplaneQy(hdr.fEventplaneQy),
   fZDCN1Energy(hdr.fZDCN1Energy),
   fZDCP1Energy(hdr.fZDCP1Energy),
   fZDCN2Energy(hdr.fZDCN2Energy),
@@ -258,6 +280,8 @@ AliAODHeader::AliAODHeader(const AliAODHeader& hdr) :
   fRefMultNeg(hdr.fRefMultNeg),
   fNMuons(hdr.fNMuons),
   fNDimuons(hdr.fNDimuons),
+  fNGlobalMuons(hdr.fNGlobalMuons),           // AU
+  fNGlobalDimuons(hdr.fNGlobalDimuons),       // AU
   fEventType(hdr.fEventType),
   fOrbitNumber(hdr.fOrbitNumber),
   fPeriodNumber(hdr.fPeriodNumber),
@@ -270,6 +294,7 @@ AliAODHeader::AliAODHeader(const AliAODHeader& hdr) :
   fOfflineTrigger(hdr.fOfflineTrigger),
   fESDFileName(hdr.fESDFileName),
   fEventNumberESDFile(hdr.fEventNumberESDFile),
+  fNumberESDTracks(hdr.fNumberESDTracks),
   fL0TriggerInputs(hdr.fL0TriggerInputs),
   fL1TriggerInputs(hdr.fL1TriggerInputs),
   fL2TriggerInputs(hdr.fL2TriggerInputs),
@@ -321,6 +346,8 @@ AliAODHeader& AliAODHeader::operator=(const AliAODHeader& hdr)
     fCentrality       = hdr.fCentrality;
     fEventplane       = hdr.fEventplane;
     fEventplaneMag    = hdr.fEventplaneMag;
+    fEventplaneQx     = hdr.fEventplaneQx;
+    fEventplaneQy     = hdr.fEventplaneQy;
     fZDCN1Energy      = hdr.fZDCN1Energy;
     fZDCP1Energy      = hdr.fZDCP1Energy;
     fZDCN2Energy      = hdr.fZDCN2Energy;
@@ -341,11 +368,14 @@ AliAODHeader& AliAODHeader::operator=(const AliAODHeader& hdr)
     fTriggerCluster   = hdr.fTriggerCluster;
     fNMuons           = hdr.fNMuons;
     fNDimuons         = hdr.fNDimuons;
+    fNGlobalMuons     = hdr.fNGlobalMuons;           // AU
+    fNGlobalDimuons   = hdr.fNGlobalDimuons;         // AU
     fDiamondZ         = hdr.fDiamondZ;
     fDiamondSig2Z     = hdr.fDiamondSig2Z;
     fOfflineTrigger   = hdr.fOfflineTrigger;
     fESDFileName      = hdr.fESDFileName;
     fEventNumberESDFile = hdr.fEventNumberESDFile;
+    fNumberESDTracks    = hdr.fNumberESDTracks;
     fL0TriggerInputs    = hdr.fL0TriggerInputs;
     fL1TriggerInputs    = hdr.fL1TriggerInputs;
     fL2TriggerInputs    = hdr.fL2TriggerInputs;
@@ -452,6 +482,8 @@ void AliAODHeader::Clear(Option_t* /*opt*/)
     fEventplaneP = 0;
     fEventplane = -999;
     fEventplaneMag = -999.;
+    fEventplaneQx = -999.;
+    fEventplaneQy = -999.;
   }
   return;
 }
@@ -472,8 +504,10 @@ void AliAODHeader::Print(Option_t* /*option*/) const
   printf("Muon mag. field scale   : %f\n", fMuonMagFieldScale);
   
   printf("Centrality              : %f\n", fCentrality);
-  printf("Event plane             : %f\n", fEventplane);
-  printf("Event plane             : %f\n", fEventplaneMag);
+  printf("Event plane Ang         : %f\n", fEventplane);
+  printf("Event plane Mag         : %f\n", fEventplaneMag);
+  printf("Event plane Qx          : %f\n", fEventplaneQx);
+  printf("Event plane Qy          : %f\n", fEventplaneQy);
   printf("ZDC N1 Energy           : %f\n", fZDCN1Energy);
   printf("ZDC P1 Energy           : %f\n", fZDCP1Energy);
   printf("ZDC N2 Energy           : %f\n", fZDCN2Energy);
@@ -502,7 +536,7 @@ void AliAODHeader::Print(Option_t* /*option*/) const
 }
 
 //__________________________________________________________________________
-Int_t AliAODHeader::FindIRIntInteractionsBXMap(Int_t difference)
+Int_t AliAODHeader::FindIRIntInteractionsBXMap(Int_t difference) const
 {
   //
   // The mapping is of 181 bits, from -90 to +90
@@ -516,7 +550,7 @@ Int_t AliAODHeader::FindIRIntInteractionsBXMap(Int_t difference)
 }
 
 //__________________________________________________________________________
-Int_t AliAODHeader::GetIRInt2ClosestInteractionMap()
+Int_t AliAODHeader::GetIRInt2ClosestInteractionMap() const
 {
   //
   // Calculation of the closest interaction
@@ -546,7 +580,39 @@ Int_t AliAODHeader::GetIRInt2ClosestInteractionMap()
 }
 
 //__________________________________________________________________________
-Int_t AliAODHeader::GetIRInt2LastInteractionMap()
+Int_t AliAODHeader::GetIRInt1ClosestInteractionMap(Int_t gap) const
+{
+  //
+  // 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
+
+  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 AliAODHeader::GetIRInt2LastInteractionMap() const
 {
   //
   // Calculation of the last interaction
@@ -573,3 +639,43 @@ Int_t AliAODHeader::GetIRInt2LastInteractionMap()
   Int_t last = lastPositive > TMath::Abs(lastNegative) ? lastPositive : TMath::Abs(lastNegative);
   return last;
 }
+
+//__________________________________________________________________________
+Bool_t AliAODHeader::InitMagneticField() const
+{
+  // Create mag field from stored information
+  //
+  const double def5kg = 5.00667905807495117e+00;
+  const double def2kg = 2.04487347602844238e+00;
+  //
+  AliMagF* fld = (AliMagF*) TGeoGlobalMagField::Instance()->GetField();
+  if (fld) {
+    if (TGeoGlobalMagField::Instance()->IsLocked()) {
+      if (fld->TestBit(AliMagF::kOverrideGRP)) {
+       AliInfo("ExpertMode!!! Information on magnet currents will be ignored !");
+       AliInfo("ExpertMode!!! Running with the externally locked B field !");
+       return kTRUE;
+      }
+    }
+    AliInfo("Destroying existing B field instance!");
+    delete TGeoGlobalMagField::Instance();
+  }
+  //
+  double fc5 = fMagneticField/def5kg;
+  double fc2 = fMagneticField/def2kg;
+  Bool_t use5 = TMath::Abs(TMath::Abs(fc5)-1.) < TMath::Abs(TMath::Abs(fc2)-1.);
+  //
+  fld = new AliMagF("mag","mag",use5 ? fc5 : fc2, fMuonMagFieldScale, use5 ? AliMagF::k5kG : AliMagF::k2kG);
+  //
+  if (fld) {
+    TGeoGlobalMagField::Instance()->SetField( fld );
+    TGeoGlobalMagField::Instance()->Lock();
+    AliInfo("Running with the B field constructed out of the AOD Header !");
+    return kTRUE;
+  }
+  else {
+    AliError("Failed to create a B field map !");
+    return kFALSE;
+  }
+  //
+}