//____________________________________________________________________
//
// Atlas photon class
// 

//  
// Author: Oliver Maria Kind <mailto: kind@mail.desy.de>
// Update: $Id: AtlPhoton.cxx,v 1.24 2011/09/16 07:17:19 kind Exp $
// Copyright: 2008 (C) Oliver Maria Kind
//
#ifndef ATLAS_AtlPhoton
#include <AtlPhoton.h>
#endif
#include <TSystem.h>
#include <iostream>

using namespace std;

#ifndef __CINT__
ClassImp(AtlPhoton);
#endif

//____________________________________________________________________

AtlPhoton::AtlPhoton() {
  //
  // Default constructor
  //
}

//____________________________________________________________________

AtlPhoton::AtlPhoton(Int_t Id, Float_t Px, Float_t Py, Float_t Pz,
		     Float_t E, 
		     Float_t EMWeight, Float_t BkgWeight,
		     UInt_t OQFlag,
		     UInt_t IsEMBitField, EIsEM IsEM, EAuthor Author,
		     TLorentzVector PCluster) :
    HepPhoton(Id, Px, Py, Pz, E),
    AtlEMShower(Author, 
		IsEMBitField, IsEM, EMWeight, BkgWeight, OQFlag,
		PCluster) {
    //
    // Normal constructor
    //
}

//____________________________________________________________________

AtlPhoton::~AtlPhoton() {
    //
    // Default destructor
    //

}

//____________________________________________________________________

void AtlPhoton::Clear(Option_t *option) {
    //
    // Clear object
    //
    HepPhoton::Clear(option);
    AtlEMShower::Clear(option);
    AtlTriggerMatch::Clear(option);
}

//_____________________________________________________________

UInt_t AtlPhoton::IsGoodOQ() {
    //
    // OQ decision
    //
    // 0: is good OQ
    // 1: is bad OQ
    //
    return ( (fOQFlag & 34214) == 0 ) ? 0 : 1;
}

//_____________________________________________________________

void AtlPhoton::Print(Option_t *option) {
    //
    // Print photon information
    //
    // Note that in the standard view only the main authors and
    // quality flags are being displayed.
    //
    // Options available:
    //   "nohead" - No header containing the variable names is
    //              displayed. Useful when printing a whole table
    //              for a list of photons
    //
    TString opt = option;
    opt.ToLower();
    
    // Print header
    if ( !opt.Contains("nohead") ) PrintHeader();
    
    // Print
    cout.setf(ios::showpoint | ios::fixed, ios::floatfield);
    cout.precision(3);
    cout.width(4);  cout << fId;
    cout.width(10); cout << Pt();
    cout.width(9); cout << E();
    cout.precision(6);
    cout.width(11); cout << M("REC");
    cout.precision(3);
    cout.width(9); cout << Theta()*180/TMath::Pi();
    cout.width(9); cout << Phi()*180/TMath::Pi();
    cout.width(7); cout << Eta();
    cout.width(9); cout << GetEtCone20();
    cout << "   ";
    if ( HasInvalidIsEM() ) {
	cout << "i";
    } else {
	cout << "-";
    }
    if ( IsLoose() ) {
	cout << "l";
    } else {
	cout << "-";
    }
    if ( IsTight() ) {
	cout << "t";
    } else {
	cout << "-";
    }
    cout << "    ";
    if ( HasInvalidAuthor() ) {
	cout << "i";
    } else {
	cout << "-";
    }
    if ( IsPhoton() ) {
	cout << "p";
    } else {
	cout << "-";
    }
    if ( IsConvPhoton() ) {
	cout << "c";
    } else {
	cout << "-";
    }
    cout << "        " << IsGoodOQ();
    cout << endl;

    // Print footer
    if ( !opt.Contains("nohead") ) PrintFooter();
}

//____________________________________________________________________

void AtlPhoton::PrintHeader() {
    //
    // Print information header
    //
    cout << "-------------------------------------------------------------------------------------------"
	 << endl
	 << " Id   Pt (GeV) E (GeV)  Minv (GeV)    Theta      Phi    Eta EtCone20  IsEM  Author   OQ    "
	 << endl
	 << "-------------------------------------------------------------------------------------------"
	 << endl;

}

//____________________________________________________________________

void AtlPhoton::PrintFooter() {
    //
    // Print footer
    //
    cout << "   i=invalid l=loose t=tight p=photon c=conversion" << endl
       	 << "---------------------------------------------------------------------------------------------"
	 << endl;
}

//____________________________________________________________________
 AtlPhoton.cxx:1
 AtlPhoton.cxx:2
 AtlPhoton.cxx:3
 AtlPhoton.cxx:4
 AtlPhoton.cxx:5
 AtlPhoton.cxx:6
 AtlPhoton.cxx:7
 AtlPhoton.cxx:8
 AtlPhoton.cxx:9
 AtlPhoton.cxx:10
 AtlPhoton.cxx:11
 AtlPhoton.cxx:12
 AtlPhoton.cxx:13
 AtlPhoton.cxx:14
 AtlPhoton.cxx:15
 AtlPhoton.cxx:16
 AtlPhoton.cxx:17
 AtlPhoton.cxx:18
 AtlPhoton.cxx:19
 AtlPhoton.cxx:20
 AtlPhoton.cxx:21
 AtlPhoton.cxx:22
 AtlPhoton.cxx:23
 AtlPhoton.cxx:24
 AtlPhoton.cxx:25
 AtlPhoton.cxx:26
 AtlPhoton.cxx:27
 AtlPhoton.cxx:28
 AtlPhoton.cxx:29
 AtlPhoton.cxx:30
 AtlPhoton.cxx:31
 AtlPhoton.cxx:32
 AtlPhoton.cxx:33
 AtlPhoton.cxx:34
 AtlPhoton.cxx:35
 AtlPhoton.cxx:36
 AtlPhoton.cxx:37
 AtlPhoton.cxx:38
 AtlPhoton.cxx:39
 AtlPhoton.cxx:40
 AtlPhoton.cxx:41
 AtlPhoton.cxx:42
 AtlPhoton.cxx:43
 AtlPhoton.cxx:44
 AtlPhoton.cxx:45
 AtlPhoton.cxx:46
 AtlPhoton.cxx:47
 AtlPhoton.cxx:48
 AtlPhoton.cxx:49
 AtlPhoton.cxx:50
 AtlPhoton.cxx:51
 AtlPhoton.cxx:52
 AtlPhoton.cxx:53
 AtlPhoton.cxx:54
 AtlPhoton.cxx:55
 AtlPhoton.cxx:56
 AtlPhoton.cxx:57
 AtlPhoton.cxx:58
 AtlPhoton.cxx:59
 AtlPhoton.cxx:60
 AtlPhoton.cxx:61
 AtlPhoton.cxx:62
 AtlPhoton.cxx:63
 AtlPhoton.cxx:64
 AtlPhoton.cxx:65
 AtlPhoton.cxx:66
 AtlPhoton.cxx:67
 AtlPhoton.cxx:68
 AtlPhoton.cxx:69
 AtlPhoton.cxx:70
 AtlPhoton.cxx:71
 AtlPhoton.cxx:72
 AtlPhoton.cxx:73
 AtlPhoton.cxx:74
 AtlPhoton.cxx:75
 AtlPhoton.cxx:76
 AtlPhoton.cxx:77
 AtlPhoton.cxx:78
 AtlPhoton.cxx:79
 AtlPhoton.cxx:80
 AtlPhoton.cxx:81
 AtlPhoton.cxx:82
 AtlPhoton.cxx:83
 AtlPhoton.cxx:84
 AtlPhoton.cxx:85
 AtlPhoton.cxx:86
 AtlPhoton.cxx:87
 AtlPhoton.cxx:88
 AtlPhoton.cxx:89
 AtlPhoton.cxx:90
 AtlPhoton.cxx:91
 AtlPhoton.cxx:92
 AtlPhoton.cxx:93
 AtlPhoton.cxx:94
 AtlPhoton.cxx:95
 AtlPhoton.cxx:96
 AtlPhoton.cxx:97
 AtlPhoton.cxx:98
 AtlPhoton.cxx:99
 AtlPhoton.cxx:100
 AtlPhoton.cxx:101
 AtlPhoton.cxx:102
 AtlPhoton.cxx:103
 AtlPhoton.cxx:104
 AtlPhoton.cxx:105
 AtlPhoton.cxx:106
 AtlPhoton.cxx:107
 AtlPhoton.cxx:108
 AtlPhoton.cxx:109
 AtlPhoton.cxx:110
 AtlPhoton.cxx:111
 AtlPhoton.cxx:112
 AtlPhoton.cxx:113
 AtlPhoton.cxx:114
 AtlPhoton.cxx:115
 AtlPhoton.cxx:116
 AtlPhoton.cxx:117
 AtlPhoton.cxx:118
 AtlPhoton.cxx:119
 AtlPhoton.cxx:120
 AtlPhoton.cxx:121
 AtlPhoton.cxx:122
 AtlPhoton.cxx:123
 AtlPhoton.cxx:124
 AtlPhoton.cxx:125
 AtlPhoton.cxx:126
 AtlPhoton.cxx:127
 AtlPhoton.cxx:128
 AtlPhoton.cxx:129
 AtlPhoton.cxx:130
 AtlPhoton.cxx:131
 AtlPhoton.cxx:132
 AtlPhoton.cxx:133
 AtlPhoton.cxx:134
 AtlPhoton.cxx:135
 AtlPhoton.cxx:136
 AtlPhoton.cxx:137
 AtlPhoton.cxx:138
 AtlPhoton.cxx:139
 AtlPhoton.cxx:140
 AtlPhoton.cxx:141
 AtlPhoton.cxx:142
 AtlPhoton.cxx:143
 AtlPhoton.cxx:144
 AtlPhoton.cxx:145
 AtlPhoton.cxx:146
 AtlPhoton.cxx:147
 AtlPhoton.cxx:148
 AtlPhoton.cxx:149
 AtlPhoton.cxx:150
 AtlPhoton.cxx:151
 AtlPhoton.cxx:152
 AtlPhoton.cxx:153
 AtlPhoton.cxx:154
 AtlPhoton.cxx:155
 AtlPhoton.cxx:156
 AtlPhoton.cxx:157
 AtlPhoton.cxx:158
 AtlPhoton.cxx:159
 AtlPhoton.cxx:160
 AtlPhoton.cxx:161
 AtlPhoton.cxx:162
 AtlPhoton.cxx:163
 AtlPhoton.cxx:164
 AtlPhoton.cxx:165
 AtlPhoton.cxx:166
 AtlPhoton.cxx:167
 AtlPhoton.cxx:168
 AtlPhoton.cxx:169
 AtlPhoton.cxx:170
 AtlPhoton.cxx:171
 AtlPhoton.cxx:172
 AtlPhoton.cxx:173
 AtlPhoton.cxx:174
 AtlPhoton.cxx:175
 AtlPhoton.cxx:176
 AtlPhoton.cxx:177
 AtlPhoton.cxx:178