Parity.h 2.97 KB
Newer Older
Generic for IPNL's avatar
Generic for IPNL committed
1 2
/***************************************************************************
 *   Copyright (C) 2004 by Olivier Stezowski                               *
3
 *   stezow(AT)ipnl.in2p3.fr                                                  *
Generic for IPNL's avatar
Generic for IPNL committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *                                                                         *
 *   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.             *
 ***************************************************************************/
 
/** \file Parity.h header file for the Parity quantum number  */  

23 24 25
#ifndef Gw_Parity
#define Gw_Parity
#define GW_PARITY_H Gw_Parity
Generic for IPNL's avatar
Generic for IPNL committed
26

27
#ifndef GW_QNUMBER_H
28
#include "QNumber.h"
29 30 31
#endif

#ifndef GW_INFODATA_H
Generic for IPNL's avatar
Generic for IPNL committed
32
#include <InfoData.h>
33
#endif
Generic for IPNL's avatar
Generic for IPNL committed
34 35 36 37 38

// std includes
#include <iostream>
using namespace std;

39 40
namespace Gw {

Generic for IPNL's avatar
Generic for IPNL committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
/**
This class discribes a specific quantum number: the parity 

@author Olivier Stezowski
*/
class Parity : public QNumber, public InfoData
{
public:
    enum EParity { kMinus = -1, kPlus = 1 } ;
    
private:
    Short_t fParity;	// parity value 
    
public:
    Parity();
    Parity(const Parity &p) : QNumber(p), InfoData(p) { fParity = p.fParity; }
C. Finck [IPHC]'s avatar
C. Finck [IPHC] committed
57
    explicit Parity(Parity::EParity p) { Set(p); }
Generic for IPNL's avatar
Generic for IPNL committed
58 59 60 61 62 63
    virtual ~Parity();
    
    //! to identify this quantum number
    virtual bool IsQNumber(QNumber::EQtype) const;
    
    void Set(Parity::EParity);
64
    bool IsParity(Parity::EParity) const;
65 66 67
	
	virtual Short_t Get() ;

C. Finck [IPHC]'s avatar
C. Finck [IPHC] committed
68
    //! set the value, can be overloaded
69
    virtual void Set(const char *s) ;
C. Finck [IPHC]'s avatar
C. Finck [IPHC] committed
70
  
C. Finck [IPHC]'s avatar
C. Finck [IPHC] committed
71 72
    //! overload operator*
    Parity& operator*= (Parity& p);
C. Finck [IPHC]'s avatar
C. Finck [IPHC] committed
73
  
C. Finck [IPHC]'s avatar
C. Finck [IPHC] committed
74 75
    //! rootcint dictionary
    ClassDef(Parity,1); // the parity quantum number
Generic for IPNL's avatar
Generic for IPNL committed
76 77 78 79
};
// inline members
inline bool Parity::IsQNumber(QNumber::EQtype t) const { return kParity == t; }
inline void Parity::Set(Parity::EParity p) { fParity = p; }
80
inline bool Parity::IsParity(Parity::EParity p) const { return p == fParity; }
81 82
inline Short_t Parity::Get() { return fParity; }
	
83 84
}

85 86
//! to write a parity in a stream
std::ostream & operator << (std::ostream &, const Gw::Parity &);
Generic for IPNL's avatar
Generic for IPNL committed
87
#endif