#include <TClonesArray.h>
#include <TRefArray.h>
#include <TList.h>
+#include <TArrayF.h>
#include "AliLog.h"
#include "AliMCEvent.h"
+#include "AliMCVertex.h"
#include "AliStack.h"
#include "AliTrackReference.h"
#include "AliHeader.h"
fSubsidiaryEvents(0),
fPrimaryOffset(0),
fSecondaryOffset(0),
- fExternal(0)
+ fExternal(0),
+ fVertex(0)
{
// Default constructor
}
fSubsidiaryEvents(0),
fPrimaryOffset(0),
fSecondaryOffset(0),
- fExternal(0)
+ fExternal(0),
+ fVertex(mcEvnt.fVertex)
{
// Copy constructor
}
void AliMCEvent::Clean()
{
// Clean-up before new trees are connected
-// if (fHeader) {
-// delete fHeader;
-// fHeader = 0;
-// }
-
delete fStack; fStack = 0;
// Clear TR
delete fTRBuffer;
fTRBuffer = 0;
}
+ if (fVertex) {
+ delete fVertex;
+ fVertex = 0;
+ }
+
}
void AliMCEvent::FinishEvent()
return mcParticle;
}
- AliGenEventHeader* AliMCEvent::GenEventHeader() {return (fHeader->GenEventHeader());}
+AliGenEventHeader* AliMCEvent::GenEventHeader() const {return (fHeader->GenEventHeader());}
void AliMCEvent::AddSubsidiaryEvent(AliMCEvent* event)
}
+const AliVVertex * AliMCEvent::GetPrimaryVertex() const
+{
+ // Create a MCVertex object from the MCHeader information
+ if (!fVertex) {
+ TArrayF v;
+ GenEventHeader()->PrimaryVertex(v) ;
+ fVertex = new AliMCVertex(v[0], v[1], v[2]);
+ }
+
+ return fVertex;
+}
+
+
ClassImp(AliMCEvent)
#include <AliVEvent.h>
#include "AliVHeader.h"
#include "AliVParticle.h"
+#include "AliVVertex.h"
#include "AliMCParticle.h"
class AliStack;
virtual Int_t GetNumberOfTracks() const {return fNparticles;}
virtual Int_t GetNumberOfV0s() const {return -1;}
virtual Int_t GetNumberOfCascades() const {return -1;}
-
+ // Vertex
+ virtual const AliVVertex *GetPrimaryVertex() const;
+
//
// MC Specific methods
//
// Getters
AliStack* Stack() {return fStack;}
AliHeader* Header() {return fHeader;}
- AliGenEventHeader* GenEventHeader();
+ AliGenEventHeader* GenEventHeader() const;
// Services
virtual void ConnectTreeE (TTree* tree);
virtual void ConnectTreeK (TTree* tree);
Int_t fPrimaryOffset; // Offset for primaries
Int_t fSecondaryOffset; // Offset for secondaries
Bool_t fExternal; // True if external particle array
- static Int_t fgkBgLabelOffset; // Standard branch name
+ static Int_t fgkBgLabelOffset; // Standard branch name
+ mutable AliVVertex* fVertex; // MC Vertex
ClassDef(AliMCEvent, 1) // AliVEvent realisation for MC data
};
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+//-------------------------------------------------------------------------
+// MC Vertex class
+// Class to be used for Kinematics MC Data
+// andreas.morsch@cern.ch
+//-------------------------------------------------------------------------
+
+#include "AliMCVertex.h"
+
+ClassImp(AliMCVertex)
--- /dev/null
+#ifndef AliMCVertex_H
+#define AliMCVertex_H
+/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+//-------------------------------------------------------------------------
+// Simple MC vertex class
+// To be used with Kinematics MC data
+// Inherits from AliVVertex
+//-------------------------------------------------------------------------
+
+#include "AliVVertex.h"
+
+class AliMCVertex : public AliVVertex {
+ public:
+ AliMCVertex() {;}
+ AliMCVertex(Double_t xv, Double_t yv, Double_t zv)
+ {fPosition[0] = xv; fPosition[1] = yv; fPosition[2] = zv;}
+ virtual ~AliMCVertex() {;}
+ virtual void GetXYZ(Double_t position[3]) const
+ {for(Int_t i = 0; i < 3; i++) position[i] = fPosition[i];}
+ virtual Double_t GetX() const {return fPosition[0];}
+ virtual Double_t GetY() const {return fPosition[1];}
+ virtual Double_t GetZ() const {return fPosition[2];}
+ virtual void GetCovarianceMatrix(Double_t covmatrix[6]) const
+ {for(Int_t i = 0; i < 6; i++) covmatrix[i] = 0.;}
+ virtual Double_t GetChi2perNDF() const {return -1.;}
+ virtual Double_t GetChi2() const {return -1.;}
+ virtual Int_t GetNDF() const {return -1 ;}
+
+ virtual Int_t GetNContributors() const {return -1;}
+ virtual void PrintIndices() const {;}
+ virtual void Print(Option_t* option = "") const {;}
+ virtual void Clear(Option_t* option) {TNamed::Clear(option);}
+ private:
+ Double32_t fPosition[3]; // vertex position
+ ClassDef(AliMCVertex, 1);
+};
+
+#endif
#pragma link C++ class AliMCEvent+;
#pragma link C++ class AliMCParticle+;
+#pragma link C++ class AliMCVertex+;
#pragma link C++ class AliMagF+;
#pragma link C++ class AliMagWrapCheb+;
AliGenEposEventHeader.cxx \
AliStack.cxx AliMCEventHandler.cxx AliInputEventHandler.cxx \
AliTrackReference.cxx AliSysInfo.cxx \
- AliMCEvent.cxx AliMCParticle.cxx \
+ AliMCEvent.cxx AliMCParticle.cxx AliMCVertex.cxx \
AliMagF.cxx AliMagWrapCheb.cxx AliCheb3D.cxx AliCheb3DCalc.cxx \
AliCodeTimer.cxx \
AliPDG.cxx \