]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- prevent accessing a null pointer in case the calo cluster branch does not exist
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jan 2013 17:37:41 +0000 (17:37 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jan 2013 17:37:41 +0000 (17:37 +0000)
- allow to reset the event plane pointer
- add the length of the q vector the AODheader
Jens Wiechula

STEER/AOD/AliAODEvent.h
STEER/AOD/AliAODHeader.cxx
STEER/AOD/AliAODHeader.h

index 6cfed747ac5be2dc1fcf56bbed0c50caccf64cdc..0d5f2e9bed1ea43563b57c51a7a9ff8badda7d6b 100644 (file)
@@ -184,8 +184,8 @@ class AliAODEvent : public AliVEvent {
 
   // -- EMCAL and PHOS Cluster
   TClonesArray *GetCaloClusters()          const { return fCaloClusters; }
-  Int_t         GetNumberOfCaloClusters()  const { return fCaloClusters->GetEntriesFast(); }
-  AliAODCaloCluster *GetCaloCluster(Int_t nCluster) const { return (AliAODCaloCluster*)fCaloClusters->UncheckedAt(nCluster); }
+  Int_t         GetNumberOfCaloClusters()  const { return fCaloClusters?fCaloClusters->GetEntriesFast():0; }
+  AliAODCaloCluster *GetCaloCluster(Int_t nCluster) const { return fCaloClusters?(AliAODCaloCluster*)fCaloClusters->UncheckedAt(nCluster):0x0; }
   Int_t         AddCaloCluster(const AliAODCaloCluster* clus)
   {new((*fCaloClusters)[fCaloClusters->GetEntriesFast()]) AliAODCaloCluster(*clus); return fCaloClusters->GetEntriesFast()-1;}
   AliAODCaloTrigger *GetCaloTrigger(TString calo) const 
index 27b4690961b851401ec16108cbe41b5fa61bd2ff..4efe07ee88f62e6666c128b14875fade0552a61d 100644 (file)
@@ -35,6 +35,7 @@ AliAODHeader::AliAODHeader() :
   fMuonMagFieldScale(-999.),
   fCentrality(-999.),
   fEventplane(-999.),
+  fEventplaneMag(-999.),
   fZDCN1Energy(-999.),
   fZDCP1Energy(-999.),
   fZDCN2Energy(-999.),
@@ -91,6 +92,7 @@ AliAODHeader::AliAODHeader(Int_t nRun,
   fMuonMagFieldScale(-999.),
   fCentrality(-999.),
   fEventplane(-999.),
+  fEventplaneMag(-999.),
   fZDCN1Energy(-999.),
   fZDCP1Energy(-999.),
   fZDCN2Energy(-999.),
@@ -227,6 +229,7 @@ AliAODHeader::AliAODHeader(const AliAODHeader& hdr) :
   fMuonMagFieldScale(hdr.fMuonMagFieldScale),
   fCentrality(hdr.fCentrality),
   fEventplane(hdr.fEventplane),
+  fEventplaneMag(hdr.fEventplaneMag),
   fZDCN1Energy(hdr.fZDCN1Energy),
   fZDCP1Energy(hdr.fZDCP1Energy),
   fZDCN2Energy(hdr.fZDCN2Energy),
@@ -299,6 +302,7 @@ AliAODHeader& AliAODHeader::operator=(const AliAODHeader& hdr)
     fMuonMagFieldScale= hdr.fMuonMagFieldScale;
     fCentrality       = hdr.fCentrality;
     fEventplane       = hdr.fEventplane;
+    fEventplaneMag    = hdr.fEventplaneMag;
     fZDCN1Energy      = hdr.fZDCN1Energy;
     fZDCP1Energy      = hdr.fZDCP1Energy;
     fZDCN2Energy      = hdr.fZDCN2Energy;
@@ -423,6 +427,7 @@ void AliAODHeader::Clear(Option_t* /*opt*/)
     delete fEventplaneP;
     fEventplaneP = 0;
     fEventplane = -999;
+    fEventplaneMag = -999.;
   }
   return;
 }
@@ -444,6 +449,7 @@ void AliAODHeader::Print(Option_t* /*option*/) const
   
   printf("Centrality              : %f\n", fCentrality);
   printf("Event plane             : %f\n", fEventplane);
+  printf("Event plane             : %f\n", fEventplaneMag);
   printf("ZDC N1 Energy           : %f\n", fZDCN1Energy);
   printf("ZDC P1 Energy           : %f\n", fZDCP1Energy);
   printf("ZDC N2 Energy           : %f\n", fZDCN2Energy);
index edb82832fa378466c3e4418d9c8c459cd3e6561f..7ba1c1f44cbd5d94c906705e1464ab1b14b74e73 100644 (file)
@@ -10,6 +10,8 @@
 //     Author: Markus Oldenburg, CERN
 //-------------------------------------------------------------------------
 
+#include <TVector2.h>
+
 #include "AliVHeader.h"
 #include "AliAODVertex.h"
 #include <TString.h>
@@ -126,6 +128,8 @@ class AliAODHeader : public AliVHeader {
   void SetQTheta(Double_t *QTheta, UInt_t size = 5);  
   void RemoveQTheta();
 
+  void ResetEventplanePointer();
+  
   void SetDiamond(Float_t xy[2],Float_t cov[3]) { 
     for(Int_t i=0;i<3;i++) {fDiamondCovXY[i] = cov[i];}
     for(Int_t i=0;i<2;i++) {fDiamondXY[i]    = xy[i] ;}
@@ -183,6 +187,7 @@ class AliAODHeader : public AliVHeader {
   Double32_t  fMuonMagFieldScale;   // magnetic field scale of muon arm magnet
   Double32_t  fCentrality;          // Centrality
   Double32_t  fEventplane;          // Event plane angle
+  Double32_t  fEventplaneMag;       // Length of Q vector from TPC event plance
   Double32_t  fZDCN1Energy;         // reconstructed energy in the neutron1 ZDC
   Double32_t  fZDCP1Energy;         // reconstructed energy in the proton1 ZDC
   Double32_t  fZDCN2Energy;         // reconstructed energy in the neutron2 ZDC
@@ -221,7 +226,7 @@ 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, 18);
+  ClassDef(AliAODHeader, 19);
 };
 inline
 void AliAODHeader::SetCentrality(const AliCentrality* cent)      { 
@@ -240,11 +245,20 @@ void AliAODHeader::SetEventplane(AliEventplane* eventplane)      {
        if(fEventplaneP)*fEventplaneP = *eventplane;
        else fEventplaneP = new AliEventplane(*eventplane);
        fEventplane = eventplane->GetEventplane("Q");
+        const TVector2* qvect=eventplane->GetQVector();
+        fEventplaneMag = -999;
+        if (qvect) fEventplaneMag=qvect->Mod();
     }
     else{
        fEventplane = -999;
+        fEventplaneMag = -999;
     }
 }
+inline
+void AliAODHeader::ResetEventplanePointer()      {
+  delete fEventplaneP;
+  fEventplaneP = 0x0;
+}
 
 inline
 void AliAODHeader::SetITSClusters(Int_t ilay, UInt_t nclus)