#include "AliESDEvent.h"
#include "AliMCEvent.h"
+#include "AliHLTMCEvent.h"
/**
* @class AliHLTESDMCEventPublisherComponent
* Library: \b libAliHLTUtil.so <br>
* Input Data Types: none <br>
* Output Data Types: according to arguments <br>
- * - AliESDEvent -> kAliHLTDataTypeESDObject
- * - HLTESD -> kAliHLTDataOriginHLT
- * - ESD -> kAliHLTDataOriginOffline
+ * - AliESDEvent -> kAliHLTDataTypeESDObject
+ * - HLTESD -> kAliHLTDataOriginHLT
+ * - ESD -> kAliHLTDataOriginOffline
*
- * - AliMCEvent -> kAliHLTDataTypeMCObject
- * -> kAliHLTDataOriginOffline
+ * - AliMCEvent -> kAliHLTDataTypeMCObject
+ * -> kAliHLTDataOriginOffline
+ *
+ * - AliHLTMCEvent -> kAliHLTDataTypeMCObject
+ * -> kAliHLTDataOriginHLT
+ *
*
* <h2>Mandatory arguments:</h2>
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
* Can be one, all or some of :<br>
* - ESD<br>
* - HLTESD<br>
- * - MC<br>
+ * - MC (publishes both AliHLTMCEvent and AliMCEvent) <br>
*
* \li -datapath <i> Path to list of data files </i><br>
* - AliESDs.root<br>
/* Ptr to current AliMCEvent, to be shipped out*/
AliMCEvent* fpMC; //! transient
+ /* Ptr to current AliHLTMCEvent, to be shipped out*/
+ AliHLTMCEvent* fpHLTMC; //! transient
+
ClassDef(AliHLTESDMCEventPublisherComponent, 0)
};
#endif
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id: AliHLTMCEvent.cxx $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
+ * for The ALICE HLT Project. *
+ * *
+ * 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. *
+ **************************************************************************/
+
+/** @file AliHLTMCEvent.h
+ @author Jochen Thaeder
+ @date
+ @brief Container class for an AliMCEvent
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "AliHLTMCEvent.h"
+#include "AliStack.h"
+
+#include "TParticlePDG.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTMCEvent)
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+AliHLTMCEvent::AliHLTMCEvent()
+ :
+ fNParticles(0),
+ fCurrentParticleIndex(-1),
+ fCurrentParticle(NULL),
+ fStack( new TClonesArray("TParticle", 1000 ) ) {
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+// #################################################################################
+AliHLTMCEvent::AliHLTMCEvent( Int_t iNumberTracks)
+ :
+ fNParticles(0),
+ fCurrentParticleIndex(-1),
+ fCurrentParticle(NULL),
+ fStack( new TClonesArray("TParticle", iNumberTracks ) ) {
+ // see header file for class documentation
+
+}
+// #################################################################################
+AliHLTMCEvent::AliHLTMCEvent( AliMCEvent *pMCEvent )
+ :
+ fNParticles(0),
+ fCurrentParticleIndex(-1),
+ fCurrentParticle(NULL),
+ fStack(NULL) {
+ // see header file for class documentation
+
+ FillMCEvent( pMCEvent );
+}
+
+// #################################################################################
+AliHLTMCEvent::~AliHLTMCEvent() {
+ // see header file for class documentation
+
+ if ( fStack ) {
+ fStack->Delete();
+ delete fStack;
+ }
+ fStack = NULL;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Getter
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+TParticle* AliHLTMCEvent::Particle( Int_t iParticle ) {
+ // see header file for class documentation
+
+ if ( iParticle >= fNParticles || !fStack )
+ return NULL;
+
+ return (TParticle*) (*fStack)[iParticle];
+}
+
+// #################################################################################
+TParticle* AliHLTMCEvent::NextParticle() {
+ // see header file for class documentation
+
+ fCurrentParticleIndex++;
+
+ return Particle( fCurrentParticleIndex );
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Setter
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+void AliHLTMCEvent::AddParticle( const TParticle* particle ) {
+ // see header file for class documentation
+
+ new( (*fStack) [fNParticles] ) TParticle( *particle );
+ fNParticles++;
+
+ return;
+}
+
+// #################################################################################
+void AliHLTMCEvent::FillMCEvent( AliMCEvent *pMCEvent ) {
+ // see header file for class documentation
+
+ AliStack *stack = pMCEvent->Stack();
+
+ // -- Create local stack
+ if ( stack && stack->GetNtrack() > 0 )
+ fStack = new TClonesArray("TParticle", stack->GetNtrack() );
+ else
+ return;
+
+ // -- Loop over off-line stack and fill local stack
+ for (Int_t iterStack = 0; iterStack < stack->GetNtrack(); iterStack++) {
+
+ TParticle *particle = stack->Particle(iterStack);
+ if ( !particle) {
+ printf( "Error reading particle %i out of %i \n", iterStack,stack->GetNtrack() );
+ continue;
+ }
+
+ // ----------------
+ // -- Apply cuts --> Do be done better XXX
+ // ----------------
+
+ TParticlePDG * foo = particle->GetPDG();
+ printf (" Particle2 -- %i - (PHI:%f - ETA:%f - PT:%f) \n",
+ iterStack,
+ particle->Phi(), particle->Eta(), particle->Pt() );
+
+ if ( foo )
+ printf (" Particle3 -- %i - (MASS:%f - CHARGE:%f - PDGCODE:%i) \n",
+ iterStack,
+ foo->Mass(), foo->Charge(), foo->PdgCode() );
+ else
+ printf (" Particle3 -- %i - (MASS:xx - CHARGE:xx - PDGCODE:xx) \n",
+ iterStack);
+
+ // -- only charged particles
+ //if ( !(particle->GetPDG()->Charge()) )
+ //continue;
+
+ // -- primary
+ if ( !(stack->IsPhysicalPrimary(iterStack)) )
+ continue;
+
+ // -- final state
+ if ( particle->GetNDaughters() != 0 )
+ continue;
+
+
+ // -- Add particle after cuts
+ AddParticle ( particle );
+ }
+
+ Compress();
+
+ return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Helper
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+void AliHLTMCEvent::Compress() {
+ // see header file for class documentation
+
+ fStack->Compress();
+}
+
+// #################################################################################
+void AliHLTMCEvent::Reset() {
+ // see header file for class documentation
+
+ fCurrentParticleIndex = -1;
+ fCurrentParticle = NULL;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTEventStatistics.h 25559 2008-05-02 13:49:18Z richterm $
+
+#ifndef ALIHLTMCEVENT_H
+#define ALIHLTMCEVENT_H
+
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/** @file AliHLTMCEvent.h
+ @author Jochen Thaeder
+ @date
+ @brief Container class for an AliMCEvent
+*/
+
+#include "TObject.h"
+#include "TParticle.h"
+#include "TClonesArray.h"
+
+#include "AliMCEvent.h"
+
+/**
+ * @class AliHLTMCEvent
+ * Container class for off-line AliMCEvent, as this class is coupled to
+ * TTrees an can not be easily copied and send via the HLT chain.
+ *
+ * This class as the complete functionality as the off-line class,
+ * only the ones needed so far.
+ *
+ * There is no extra "stack" class, the stack is included in this class
+ * a TClonesArray of TParticles
+ *
+ */
+
+class AliHLTMCEvent : public TObject {
+
+public:
+
+ /*
+ * ---------------------------------------------------------------------------------
+ * Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+ /** standard constructor */
+ AliHLTMCEvent();
+
+ /** constructor
+ * @param iNumberTracks number of initial tracks
+ */
+ AliHLTMCEvent( Int_t iNumberTracks );
+
+ /** constructor
+ * @param pMCEvent ptr to off-line AliMCEvent
+ */
+ AliHLTMCEvent( AliMCEvent *pMCEvent );
+
+ /** destructor */
+ virtual ~AliHLTMCEvent();
+
+ /*
+ * ---------------------------------------------------------------------------------
+ * Getter
+ * ---------------------------------------------------------------------------------
+ */
+
+ /** Get number of particles
+ * @return number of particles
+ */
+ Int_t GetNumberOfTracks() const { return fNParticles; }
+
+ /** Return particle at index iParticle
+ * @param iParticle Particle index in local stack
+ * @return ptr on success, NULL on failure
+ */
+ TParticle* Particle( Int_t iParticle );
+
+ /** Return next particle
+ * @return ptr on success, NULL on failure
+ */
+ TParticle* NextParticle();
+
+ /*
+ * ---------------------------------------------------------------------------------
+ * Setter
+ * ---------------------------------------------------------------------------------
+ */
+
+ /** Add a prticle to this container
+ * @param particle ptr to TParticle classs
+ */
+ void AddParticle( const TParticle* particle);
+
+ /** Fill the off-line MC event in to this class
+ * @param pMCEvent ptr to off-line AliMCEvent
+ */
+ void FillMCEvent( AliMCEvent *pMCEvent );
+
+ /*
+ * ---------------------------------------------------------------------------------
+ * Helper
+ * ---------------------------------------------------------------------------------
+ */
+
+ /** Compress the TClonesArray fStack */
+ void Compress();
+
+ /** Reset index for next particle */
+ void Reset();
+
+ ///////////////////////////////////////////////////////////////////////////////////
+
+private:
+
+ /** copy constructor prohibited */
+ AliHLTMCEvent (const AliHLTMCEvent&);
+
+ /** assignment operator prohibited */
+ AliHLTMCEvent& operator= (const AliHLTMCEvent&);
+
+ /*
+ * ---------------------------------------------------------------------------------
+ * Members - private
+ * ---------------------------------------------------------------------------------
+ */
+
+ /** Number of particles */
+ Int_t fNParticles; // see above
+
+ /** Current particle */
+ Int_t fCurrentParticleIndex; // see above
+
+ /** Ptr to current particle */
+ TParticle *fCurrentParticle; // see above
+
+ /** Stack of particles */
+ TClonesArray *fStack; // see above
+
+ ClassDef(AliHLTMCEvent, 1)
+
+};
+#endif
+