00001
00002
00003 #include <assert.h>
00004 #include <stdlib.h>
00005
00006 #include <TClonesArray.h>
00007 #include <TObjArray.h>
00008 #include <TH1.h>
00009 #include <TH2.h>
00010 #include <TFile.h>
00011
00012 #include "EEtower.h"
00013
00014 ClassImp(EEtower)
00015
00016
00017 EEtower::EEtower(){
00018 setThres(0.3,0);
00019 printf("EEtower() constructed\n");
00020 nInpEve=0;
00021 HList=0;
00022 eeDb=0;
00023 }
00024
00025
00026
00027 EEtower::~EEtower() {}
00028
00029
00030
00031
00032
00033 void EEtower::init( ){
00034 int i;
00035 float Emax=2;
00036 memset(hA,0,sizeof(hA));
00037
00038 hA[0]=new TH1F ("tE","Eneregy (GeV) from any tower",100,0.,Emax);
00039 hA[1]=new TH1F ("sE","Total Eneregy in event (GeV) (sum from all tower)",200,0.,Emax*10);
00040 hA[4]=new TH1F ("tN","No. of towers with energy above th1",30,-0.5,29.5);
00041
00042
00043 if(HList) {
00044 for(i=0;i<32;i++) {
00045 if(hA[i]==0) continue;
00046 HList->Add(hA[i]);
00047 }
00048 }
00049
00050 }
00051
00052
00053
00054
00055 void EEtower::clear(){
00056 memset(towerE,0,sizeof(towerE));
00057 }
00058
00059
00060
00061
00062 void EEtower::finish(){
00063 printf("\n EEtower::finish() nInpEve=%d\n",nInpEve);
00064 }
00065
00066
00067
00068 void EEtower::print(){
00069 printf("\n EEtower::print()\n dump event:\n");
00070 int i,j;
00071 printf("phiBin, towerE for %d eta bins \n",MaxPhiBins);
00072 for(j=0;j<MaxPhiBins;j++) {
00073 printf("%4d: ",j);
00074 for(i=0;i<MaxEtaBins;i++)
00075 printf("%8.3f ",towerE[i][j]);
00076 printf("\n");
00077 }
00078 }
00079
00080
00081
00082
00083
00084 void EEtower::task1(){
00085
00086 int i,j;
00087 int nd=0;
00088 float totE=0;
00089 for(j=0;j<MaxPhiBins;j++) {
00090 for(i=0;i<MaxEtaBins;i++) {
00091 float e=towerE[i][j];
00092 totE+=e;
00093 if(e>th1) nd++;
00094 hA[0]->Fill(e);
00095 }
00096 }
00097
00098 hA[1]->Fill(totE);
00099 hA[4]->Fill(nd);
00100 }
00101
00102
00103
00104
00105 void EEtower:: saveHisto(TString fname){
00106 TString outName=fname+".hist.root";
00107 TFile f( outName,"recreate");
00108 assert(f.IsOpen());
00109 printf("%d histos are written to '%s' ...\n",HList->GetEntries(),outName.Data());
00110 HList->Write();
00111 f.Close();
00112 }
00113