DIAMANTWatchers.h 3.48 KB
Newer Older
J.Dudouet [IPNL/CSNSM]'s avatar
J.Dudouet [IPNL/CSNSM] committed
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
/***************************************************************************
 *   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 _DIAMANTWatchers
#define _DIAMANTWatchers

// Watcher definition
#include "Watchers.h"
#include "TTreeWatchers.h"
#include "BashColor.h"

// ADF definitions
#include "AgataRawFrame.h"

// ROOT definitions
#include "Rtypes.h"

// MFM
#include "MFMNedaFrame.h"


class TH1F;
class TH2F;
class TH3F;

using namespace ADF;
using namespace Gw;

//! Base Watcher working for any event:data:ranc0
/*!

 */
class DIAMANTWatchers : public WatcherWithTag
{
52
protected:
J.Dudouet [IPNL/CSNSM]'s avatar
J.Dudouet [IPNL/CSNSM] committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 113 114 115 116 117 118 119 120 121 122
    static const Int_t MaxDIAMANT = 100;
    static const Int_t MaxChannel = 16;

protected:
    BashColor *fBashColor;

protected:
    //! main frame i.e. data:ranc0
    SharedFP *fFrame = 0x0;
    //! current data:ranc0 frame to help decoding one by one
    MFMNedaFrame *fMFMFrame = 0x0;

protected:
    //! number of sub Frames extracted from the current event
    MFMNedaFrame *GetMFM();

protected:
    ULong64_t fADFTimestamp;
    ULong64_t fLastADFTimestamp = 0;
    ULong64_t fMFMTimestamp;

    Int_t fBoardID;
    Int_t fChannelID;

    UInt_t fNEvts = 0;
    UInt_t fStatPerBoard[MaxDIAMANT][MaxChannel+1];

public:
    DIAMANTWatchers(const char *name, const char *title,  TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
    virtual ~DIAMANTWatchers()
    {
        if (fMFMFrame)
            delete fMFMFrame;
        fMFMFrame = 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 );

    //! watch the current frame
    virtual void Exec(Option_t *option="");

    virtual void Print(const char *option="") const;  //*MENU*

    ClassDef(DIAMANTWatchers,0)
};

class DIAMANTSpectra : public DIAMANTWatchers
{
private:
    TH1 *fBoardxChannel;    //! Board versus channel

public:
    DIAMANTSpectra(const char *name, const char *title,  TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
    virtual ~DIAMANTSpectra()
    {;}

    //! watch the current frame
    virtual void Exec(Option_t *option="");

    ClassDef(DIAMANTSpectra,0)
};



#endif