]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMCEventHandler.h
silvermy@ornl.gov - SMcalib - directory with tools for SuperModule calibrations at...
[u/mrichter/AliRoot.git] / STEER / AliMCEventHandler.h
1 // -*- mode: C++ -*-
2 #ifndef ALIMCEVENTHANDLER_H
3 #define ALIMCEVENTHANDLER_H
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.
13 // Monte Carlo truth is contained in the kinematics tree (produced particles) and 
14 // the tree of reference hits.
15 //      
16 // Origin: Andreas Morsch, CERN, andreas.morsch@cern.ch 
17 //-------------------------------------------------------------------------
18 #include "AliVEventHandler.h"
19 #include "AliHeader.h"
20 #include <TExMap.h>
21
22 class TFile;
23 class TTree;
24 class TParticle;
25 class TString;
26 class TClonesArray;
27 class TDirectoryFile;
28
29 class AliMCEvent;
30
31
32
33 class AliMCEventHandler : public AliVEventHandler
34 {
35 public:
36     AliMCEventHandler();
37     AliMCEventHandler(const char* name, const char* title);
38     virtual ~AliMCEventHandler();
39     virtual void         SetOutputFileName(const char* /* fname */) {;}
40     virtual const char*  GetOutputFileName() {return 0;}
41     virtual void         SetInputPath(const char* fname); 
42     virtual void         SetInputTree(TTree* /*tree*/) {;}
43     virtual TString*     GetInputPath() const {return fPathName;}
44     virtual Bool_t       Init(Option_t* opt);
45     virtual Bool_t       InitIO(Option_t* opt) {return Init(opt);};
46     virtual Bool_t       Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;}
47     virtual Bool_t       BeginEvent(Long64_t entry);
48     virtual Bool_t       Notify() { return AliVEventHandler::Notify(); };
49     virtual Bool_t       Notify(const char* path);
50     virtual Bool_t       FinishEvent();
51     virtual Bool_t       Terminate();
52     virtual Bool_t       TerminateIO();
53     virtual void         ResetIO();
54     virtual Bool_t       GetEvent(Int_t iev);
55     virtual void         SetReadTR(Bool_t flag) { fReadTR = flag; }
56     //
57     AliMCEvent* MCEvent() const {return fMCEvent;} 
58     TTree*      TreeTR()  const {return fTreeTR;}
59     TTree*      TreeK()   const {return fTreeK;}
60     Int_t       GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs);
61     void        DrawCheck(Int_t i, Int_t search=0);
62
63   // label manipulation
64   void   SelectParticle(Int_t i);
65   Bool_t IsParticleSelected(Int_t i);
66   void   CreateLabelMap();
67   Int_t  GetNewLabel(Int_t i);
68
69 private:
70     Bool_t      OpenFile(Int_t i);
71     void  VerifySelectedParticles();
72     AliMCEventHandler(const AliMCEventHandler& handler);             
73     AliMCEventHandler& operator=(const AliMCEventHandler& handler);  
74 private:
75     AliMCEvent       *fMCEvent;          //! MC Event
76     TFile            *fFileE;            //! File with TreeE
77     TFile            *fFileK;            //! File with TreeK
78     TFile            *fFileTR;           //! File with TreeTR
79     TTree            *fTreeE;            //! TreeE  (Event Headers)
80     TTree            *fTreeK;            //! TreeK  (kinematics tree)
81     TTree            *fTreeTR;           //! TreeTR (track references tree)
82     TDirectoryFile   *fDirK;             //! Directory for Kine Tree
83     TDirectoryFile   *fDirTR;            //! Directory for TR Tree
84     TExMap            fParticleSelected; //! List of selected MC particles for t
85     TExMap            fLabelMap;         //! Stores the Map of MC (ESDLabel,AODlabel)  
86     Int_t             fNEvent;           //! Number of events
87     Int_t             fEvent;            //! Current event
88     TString          *fPathName;         //! Input file path 
89     char             *fExtension;        //! File name extension 
90     Int_t             fFileNumber;       //! Input file number
91     Int_t             fEventsPerFile;    //! Number of events per file
92     Bool_t            fReadTR;           // determines if TR shall be read
93     Bool_t            fInitOk;           // Initialization ok
94     ClassDef(AliMCEventHandler,1)  //MC Truth EventHandler class
95 };
96 #endif 
97