]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMCEventHandler.h
Update TPCCEda to write output file in parts (to avoid too big files produced in...
[u/mrichter/AliRoot.git] / STEER / AliMCEventHandler.h
CommitLineData
969c7896 1// -*- mode: C++ -*-
5fe09262 2#ifndef ALIMCEVENTHANDLER_H
3#define ALIMCEVENTHANDLER_H
033693d3 4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7
8/* $Id$ */
9
10//-------------------------------------------------------------------------
11// Class AliMCEvent
12// This class gives access to MC truth during the analysis.
415d9f5c 13// Monte Carlo truth is contained in the kinematics tree (produced particles) and
033693d3 14// the tree of reference hits.
15//
16// Origin: Andreas Morsch, CERN, andreas.morsch@cern.ch
17//-------------------------------------------------------------------------
d2f1d9ef 18#include "AliVEventHandler.h"
47b95647 19#include "AliHeader.h"
da97a08a 20#include <TExMap.h>
21
033693d3 22class TFile;
23class TTree;
93836e1b 24class TList;
25
033693d3 26class TParticle;
0a05cd41 27class TString;
033693d3 28class TClonesArray;
5efedd31 29class TDirectoryFile;
30
415d9f5c 31class AliMCEvent;
32
033693d3 33
34
276be602 35class AliMCEventHandler : public AliVEventHandler
033693d3 36{
37public:
35152e4b 38
39 enum PreReadMode_t {kNoPreRead = 0, kLmPreRead = 1, kHmPreRead = 2};
40
5fe09262 41 AliMCEventHandler();
42 AliMCEventHandler(const char* name, const char* title);
43 virtual ~AliMCEventHandler();
0931e76a 44 virtual void SetOutputFileName(const char* /* fname */) {;}
45 virtual const char* GetOutputFileName() {return 0;}
46 virtual void SetInputPath(const char* fname);
933fd60f 47 virtual void SetInputTree(TTree* /*tree*/) {;}
d0916b2f 48 virtual TString* GetInputPath() const {return fPathName;}
300d5701 49 virtual Bool_t Init(Option_t* opt);
0d6a82a5 50 virtual Bool_t GetEntry() {return kTRUE;}
300d5701 51 virtual Bool_t InitIO(Option_t* opt) {return Init(opt);};
52 virtual Bool_t Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;}
ed97dc98 53 virtual Bool_t BeginEvent(Long64_t entry);
24e577e5 54 virtual Bool_t Notify() { return AliVEventHandler::Notify(); };
890126ab 55 virtual Bool_t Notify(const char* path);
033693d3 56 virtual Bool_t FinishEvent();
57 virtual Bool_t Terminate();
58 virtual Bool_t TerminateIO();
5fe09262 59 virtual void ResetIO();
9aea8469 60 virtual Bool_t GetEvent(Int_t iev);
969c7896 61 virtual void SetReadTR(Bool_t flag) { fReadTR = flag; }
93836e1b 62 virtual void AddSubsidiaryHandler(AliMCEventHandler* handler);
63 virtual void SetNumberOfEventsInContainer(Int_t nev) {fEventsInContainer = nev;}
35152e4b 64 virtual void SetPreReadMode(PreReadMode_t mode) {fPreReadMode = mode;}
033693d3 65 //
2bb794ba 66 AliMCEvent* MCEvent() const {return fMCEvent;}
d0916b2f 67 TTree* TreeTR() const {return fTreeTR;}
68 TTree* TreeK() const {return fTreeK;}
415d9f5c 69 Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs);
70 void DrawCheck(Int_t i, Int_t search=0);
b72029a3 71 Bool_t InitOk() {return fInitOk;}
72 // Label manipulation
73 void SelectParticle(Int_t i);
74 Bool_t IsParticleSelected(Int_t i);
75 void CreateLabelMap();
76 Int_t GetNewLabel(Int_t i);
da97a08a 77
5fe09262 78private:
415d9f5c 79 Bool_t OpenFile(Int_t i);
da97a08a 80 void VerifySelectedParticles();
87d395bd 81 AliMCEventHandler(const AliMCEventHandler& handler);
82 AliMCEventHandler& operator=(const AliMCEventHandler& handler);
033693d3 83private:
93836e1b 84 AliMCEvent *fMCEvent; //! MC Event
85 TFile *fFileE; //! File with TreeE
86 TFile *fFileK; //! File with TreeK
87 TFile *fFileTR; //! File with TreeTR
88 TTree *fTreeE; //! TreeE (Event Headers)
89 TTree *fTreeK; //! TreeK (kinematics tree)
90 TTree *fTreeTR; //! TreeTR (track references tree)
91 TDirectoryFile *fDirK; //! Directory for Kine Tree
92 TDirectoryFile *fDirTR; //! Directory for TR Tree
93 TExMap fParticleSelected; //! List of selected MC particles for t
94 TExMap fLabelMap; //! Stores the Map of MC (ESDLabel,AODlabel)
95 Int_t fNEvent; //! Number of events
96 Int_t fEvent; //! Current event
97 TString *fPathName; //! Input file path
98 const Char_t *fExtension; //! File name extension
99 Int_t fFileNumber; //! Input file number
100 Int_t fEventsPerFile; //! Number of events per file
101 Bool_t fReadTR; // determines if TR shall be read
102 Bool_t fInitOk; // Initialization ok
103 TList *fSubsidiaryHandlers; //! List of subsidiary MC handlers (for example for Background)
35152e4b 104 Int_t fEventsInContainer; //! Number of events in container class
105 PreReadMode_t fPreReadMode; //! Pre reading mode
106
969c7896 107 ClassDef(AliMCEventHandler,1) //MC Truth EventHandler class
033693d3 108};
109#endif
110