00001
00002
00003
00004 class StChain;
00005 class StEEmcIUPi0Reader;
00006 class StEEmcIUMixEvent;
00007
00008 StChain *chain = 0;
00009 StEEmcIUPi0Reader *reader = 0;
00010 StEEmcIUMixEvent *realEvent = 0;
00011
00012 Long64_t nevents = 0;
00013
00014
00015
00016 void readPi02(Int_t nevents=-1,
00017 const Char_t *mydir="/star/institutions/iucf/hew/7863/7136033/",
00018 const Char_t *ofile="/star/u/hew/pionCVS/7136033.root")
00019 {
00020
00021 const Double_t ptbins[]={0.0,2.5,4.5,5.5,6.5,8.5,10.5,14.5,20.0};
00022 Int_t nptbins=sizeof(ptbins)/sizeof(Double_t) - 1;
00023
00024 TFile *file=new TFile(ofile,"RECREATE");
00025 hEtavsMass = new TH2F("hEtavsMass","Detector #eta of #pi^{0} candidates vs Mass;Mass; #eta",120,0.,1.2,180,1.,2.5);
00026 hPhivsMass = new TH2F("hPhivsMass","#Phi of #pi^{0} candidates vs Mass; Mass, #Phi",120,0.,1.2,360,-180.,180.);
00027 hPhi= new TH1F("hPhi","#Phi",30,0.,30.);
00028 hPhiEta1= new TH1F("hPhiEta1","#Phi with #eta at [1.089,1.268)",30,0.,30.);
00029 hPhiEta2= new TH1F("hPhiEta2","#Phi with #eta at [1.268,1.476)",30,0.,30.);
00030 hPhiEta3= new TH1F("hPhiEta3","#Phi with #eta at [1.476,1.718)",30,0.,30.);
00031 hPhiEta4= new TH1F("hPhiEta4","#Phi with #eta at [1.718,2.000)",30,0.,30.);
00032 hZggPt= new TH2F("hZggPt","Pi0 Zgg vs Pt;pT[Gev/c];Zgg",50,0.,25.,50,0.,1.);
00033
00034 LoadLibs();
00035
00036
00037 chain = new StChain("chain");
00038
00039
00040 reader = new StEEmcIUPi0Reader();
00041 chainFiles(mydir);
00042
00043 nevents = reader->getNumberOfEvents();
00044
00045 chain->ls(3);
00046 chain->Init();
00047
00048 Int_t stat = 0;
00049 Int_t event = 0;
00050 while ( !stat )
00051 {
00052
00053 if ( nevents>=0 )
00054 if ( event>=nevents ) break;
00055
00056 chain -> Clear();
00057 stat = chain->Make();
00058
00059 realEvent = reader->event();
00060
00061 Int_t nPairs = reader -> event() -> nPairs;
00062 for ( Int_t i=0;i<nPairs;i++ )
00063 {
00064
00065 Float_t mass = reader->event()->mMass[i];
00066 Float_t pt = reader->event()->mPT[i];
00067 Float_t zgg = reader->event()->mZgg[i];
00068 Float_t meta = reader->event()->mEEmcEta[i];
00069 Float_t mphi = reader->event()->mPhi[i];
00070
00071 hEtavsMass->Fill(mass,meta);
00072 hPhivsMass->Fill(mass,mphi*180./3.14159265);
00073 Int_t mod_phi=int(mphi*180./3.14159265+180.)%30;
00074 hPhi->Fill(mod_phi);
00075 if(meta>=1.089 && meta<1.268) hPhiEta1->Fill(mod_phi);
00076 if(meta>=1.268 && meta<1.476) hPhiEta2->Fill(mod_phi);
00077 if(meta>=1.476 && meta<1.718) hPhiEta3->Fill(mod_phi);
00078 if(meta>=1.718 && meta<2.) hPhiEta4->Fill(mod_phi);
00079
00080
00081 Float_t diff = realEvent->mEsmdu[i] - realEvent->mEsmdv[i];
00082 Float_t sum = realEvent->mEsmdu[i] + realEvent->mEsmdv[i];
00083 Float_t zuv = TMath::Abs(diff)/sum;
00084
00085
00086 }
00087 event++;
00088
00089
00090
00091 }
00092
00093 file->cd();
00094 hEtavsMass->Write();
00095 hPhivsMass->Write();
00096 hPhi->Write();
00097 hPhiEta1->Write();
00098 hPhiEta2->Write();
00099 hPhiEta3->Write();
00100 hPhiEta4->Write();
00101 hZggPt->Write();
00102 delete file;
00103
00104
00105 }
00106
00107 void chainFiles(const Char_t *path)
00108 {
00109
00110 std::cout << "chaining files " << path << std::endl;
00111
00112 TSystemDirectory *dir = new TSystemDirectory("dir",path);
00113
00114 TIter next( dir->GetListOfFiles() );
00115 TObject *file = 0;
00116 while ( file = (TObject*)next() )
00117 {
00118 TString name=file->GetName();
00119
00120 if ( name.Contains("root") ) {
00121 reader->chainFile(name);
00122
00123 }
00124
00125 }
00126
00127 delete dir;
00128
00129
00130 }
00131
00132
00133 void LoadLibs()
00134 {
00135
00136 gROOT -> LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
00137 loadSharedLibraries();
00138
00139 gSystem->Load("StDbLib");
00140 gSystem->Load("StDbBroker");
00141 gSystem->Load("St_db_Maker");
00142 gSystem->Load("StEEmcUtil");
00143 gSystem->Load("StEEmcDbMaker");
00144 gSystem->Load("StEEmcSimulatorMaker");
00145
00146 gSystem->Load("StEEmcA2EMaker");
00147 gSystem->Load("StEEmcIUPi0");
00148 gSystem->Load("StSpinDbMaker");
00149
00150 }