EventNEDAWatchers.h 4.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/***************************************************************************
 *   Copyright (C) 2010 by Olivier Stezowski                               *
 *   stezow(AT)ipnl.in2p3.fr                                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef _EventNEDAWatchers
#define _EventNEDAWatchers

// Watcher definition
#include "Watchers.h"
#include "TTreeWatchers.h"
27
#include "BashColor.h"
28 29 30 31 32 33 34 35

// ADF definitions
#include "AgataRawFrame.h"

// ROOT definitions
#include "Rtypes.h"

// MFM
36
#include "MFMNedaCompFrame.h"
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51


class TH1F;
class TH2F;
class TH3F;

using namespace ADF;
using namespace Gw;

//! Base Watcher working for any event:data:ranc0
/*!
	
 */
class EventNEDAWatchers : public WatcherWithTag
{
52 53
protected:
    BashColor *fBashColor;
54 55 56
protected:
    //! current data:ranc0 frame to help decoding one by one
    Frame *fSubFrame;
57
    MFMNedaCompFrame *fMFMFrame;
58 59 60 61 62 63 64 65
    
protected:
    //! main frame i.e. event:data:ranc0
    SharedFP *fFrame;
    
protected:
    //! number of sub Frames extracted from the current event
    UInt_t GetNbSubFrame();
66
    MFMNedaCompFrame *GetMFM(UInt_t i);
67 68 69 70

public:
    EventNEDAWatchers(const char *name, const char *title,  TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0) :
        WatcherWithTag(name,title,sp_dir,tag_dir),
71
        fBashColor(new BashColor()),
72
        fSubFrame(0x0),
73
        fMFMFrame(new MFMNedaCompFrame()),
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
        fFrame(0x0)
    {;}
    virtual ~EventNEDAWatchers()
    {
        if (fMFMFrame)
            delete fMFMFrame;
        fMFMFrame = 0x0;
        if (fSubFrame)
            delete fSubFrame;
        fSubFrame = 0x0;
    }
    
    //! Set the trigger attached to this watcher
    /*!
     look in the list of input Frame one called Agata data:tracked
     */
    virtual Bool_t SetTrigger( ADF::DFTrigger */*trigger*/ = 0x0 );
    
    ClassDef(EventNEDAWatchers,0)  // Trigger on tracked Frame
};


class EventNEDASpectra : public EventNEDAWatchers
{
private:
    TH1 *fFold;             //! Crystal fold
    TH1 *fBoardxChannel;    //! Board versus channel

public:
    EventNEDASpectra(const char *name, const char *title,  TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
    virtual ~EventNEDASpectra()
    {;}
    
    //! watch the current frame
    virtual void Exec(Option_t *option="");
};

class EventNEDATree : public EventNEDAWatchers, public TTreeBuilder
{
113
    static const Int_t MaxNEDA = 128; //8 boards * 16 channels
114 115

private:
116 117 118 119 120
    Int_t nbNEDA;           // Number of hits in the array
    UShort_t BoardId[MaxNEDA], ChannelId[MaxNEDA];
    UShort_t NEDATdc[MaxNEDA], NEDAFast[MaxNEDA], NEDASlow[MaxNEDA] ,NEDAZco[MaxNEDA];
    ULong64_t fTimestamp;

121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
protected:
    virtual void SetBranches();
    
public:
    EventNEDATree(const char *name, const char *title, TTree *tree = 0x0);
    virtual ~EventNEDATree();
    
    //! watch the current frame
    virtual void Exec(Option_t *option="");
    
    //! Filling the spectra
    void FillSpectraByUser()
    {;}
    
    //virtual void Print(Option_t *option="") const;  //*MENU*
    
    ClassDef(EventNEDATree,0)  // built a root tree for the neda comp part
};





#endif