00001
00002
00003
00004
00005 #include "BesVisLib/BesEventHeader.h"
00006 #include <iostream>
00007
00008 using namespace std;
00009
00010 #ifndef __CINT__
00011 ClassImp(BesEventHeader)
00012 #endif
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 BesEventHeader::BesEventHeader() : TObject()
00030 {
00031
00032
00033 if ( gDebug ) cout << "BesEventHeader ctor called" << endl;
00034
00035 fRun = 0;
00036 fEvent = 0;
00037 fMC = true;
00038 fDay = 20;
00039 fMonth = 7;
00040 fYear = 2008;
00041 fHour = 1;
00042 fMin = 4;
00043 fSec = 4;
00044 fP = 0.0;
00045 fPt = 0.0;
00046 }
00047
00048
00049
00050 BesEventHeader::~BesEventHeader() {
00051
00052
00053 if ( gDebug ) cout << "BesEventHeader dtor called" << endl;
00054
00055 }
00056
00057
00058 void BesEventHeader::SetEventTrig(Int_t timeType,
00059 vector<Int_t>& trigConditionVector,
00060 vector<Int_t>& trigChannelVector ){
00061
00062 fTimeType = timeType;
00063 fTrigChannelVector.clear();
00064 fTrigConditionVector.clear();
00065 fTrigChannelVector = trigChannelVector;
00066 fTrigConditionVector = trigConditionVector;
00067
00068 cout << "BesEventHeader::time Type: " << timeType << endl;
00069 vector<Int_t>::iterator pTrigVector;
00070 for (pTrigVector = trigConditionVector.begin();
00071 pTrigVector != trigConditionVector.end();
00072 pTrigVector++){
00073 cout << "BesEventHeader::trigCondition: " << *pTrigVector << endl;
00074 }
00075 for (pTrigVector = trigChannelVector.begin();
00076 pTrigVector != trigChannelVector.end();
00077 pTrigVector++){
00078 cout << "BesEventHeader::trigChannel: " << *pTrigVector << endl;
00079 }
00080
00081 }
00082
00083
00084 void BesEventHeader::SetEventHeaderGeneral(Long64_t run, Long64_t event,Int_t time1,Int_t time2) {
00085
00086
00087 fRun = run;
00088 fEvent = event;
00089
00090
00091
00092 if (time1 > 0) {
00093 int a,b;
00094 a=time1%100;
00095 fDay=a;
00096
00097 b=(time1-a)%10000;
00098 fMonth=b/100;
00099
00100 fYear=(time1-a-b)/10000;
00101 }
00102
00103
00104 if (time2 > 0) {
00105 int c,d;
00106 c=time2%100;
00107 fSec=c;
00108
00109 d=(time2-c)%10000;
00110 fMin=d/100;
00111
00112 fHour=(time2-c-d)/10000;
00113 }
00114 }
00115
00116
00117
00118 void BesEventHeader::SetEventMC(Bool_t mc)
00119 {
00120 fMC = mc;
00121 }
00122
00123
00124
00125 void BesEventHeader::SetEventEvTime(Double_t time, Int_t status, Double_t quality)
00126 {
00127 fEvTime = time;
00128 fEvTimeStatus = status;
00129 fEvTimeQuality = quality;
00130 }
00131
00132
00133
00134 void BesEventHeader::SetEventMdc(Double_t p, Double_t pt, Double_t px, Double_t py, Double_t pz)
00135 {
00136 fP = p;
00137 fPt = pt;
00138 fPx = px;
00139 fPy = py;
00140 fPz = pz;
00141 }
00142
00143
00144
00145 void BesEventHeader::SetEventTof(Double_t t)
00146 {
00147 fT = t;
00148 }
00149
00150
00151
00152 void BesEventHeader::SetEventEmc(Double_t e)
00153 {
00154 fE = e;
00155 }
00156
00157
00158 void BesEventHeader::PrintWord(TString & word,Int_t nbits, Int_t trigger,Int_t trigger2) const {
00159 Int_t j;
00160 if (trigger!=0){
00161 for (j=0;j<nbits;j++){
00162 if ((trigger>>j)&0x1) word+=Form(" %.2d",j+1);
00163 }
00164 }
00165 if (trigger2!=0){
00166 for (j=0;j<nbits;j++){
00167 if ((trigger2>>j)&0x1) word+=Form(" %.2d",j+17);
00168 }
00169 }
00170 }