// Out.C MDC1 tree output // // MDB 15-SEP-98 Extend tree to include SPC // DMcL 12-SEP-98 minor edits // AT/MDB 09-SEP-98 MDC1 Output // // definitions... don't need an Out.h??: TTree *ftree; typedef struct {Float_t xv,yv,zv;} TPhmypoint; typedef struct {Float_t runnum,evnum,mult;} TPhmyhead; typedef struct {Float_t Ntracks,Ntemplates;} TPhmytrkhd; void Out(Int_t phase = 0, Int_t dflag = 0) { if (ReportLevel >= 3) { printf("Out entered, phase = %d, dflag = %d\n",phase,dflag); } static TPhmypoint frvtx; static TPhmyhead fhead; static TPhmytrkhd ftrkhd; // INITIALIZATION if(phase == kIni1) { fout = new TFile(OuFile,"RECREATE","A Tree DST",0); if(!fout) { printf("FATAL.. OuFile,\, expanded name = %s, can't open!\n", gSystem->ExpandPathName(OuFile)); gSystem->Abort(); } else { printf("OuFile,\, expanded name = %s, created!\n", gSystem->ExpandPathName(OuFile)); } // fout->SetCompressionLevel(2); fout->ls(); ftree = new TTree("DST","PHOBOS Output DST Tree"); if (ReportLevel >= 3) printf("Tree created\n"); ftree->Branch("header",&fhead,"runnum:evnum:mult"); ftree->Branch("vertex",&frvtx,"xv:yv:zv"); ftree->Branch("trkhead",&ftrkhd,"Ntracks:Ntemplates"); ftree->Branch("Occ","TH2F",&dg[2],128000,0); ftree->Branch("dNdeta","TH2F",&dg[1],128000,0); ftree->Branch("dNdetadphi","TH2F",&dg[0],128000,0); ftree->Branch("VtxObject","TPhVertex",&v1,32000,0); ftrkhd.Ntracks = 0; ftrkhd.Ntemplates = 0; // if (doSpc) { // ftree->Branch(" // } if (ReportLevel >= 3) printf("End of Out Initialization\n"); } // IN RUN LOOP if(phase == kRun1 && !iev==0) { // MDB/AT Screw up the whole 0th event for everybody as MUL has done. if(iev%ReportFreq==0 && ReportLevel >=2 && iev ) ftree->Print(); // The above was moved from phat.C just before Vtx.C call DMcL if (v1) { frvtx.xv=v1->GetX(); frvtx.yv=v1->GetY(); frvtx.zv=v1->GetZ(); if (ReportLevel >= 2) printf("zv after GetZ: %f\n",frvtx.zv); } else { if (ReportLevel >= 2) printf("Oops. Where's v1?\n"); } fout.cd(); if (ReportLevel >= 2) fout.ls(); fhead.runnum=ev->GetNRun(); fhead.evnum=iev; // MDB 10SEP98 Normalization guess : 12 units of eta / 48 bins = 0.25 if (dg[1]) fhead.mult = 0.25*dg[1]->Integral(1,48,1,1); if (ReportLevel >= 2) { printf("Run # = %d, Event # = %d\n", fhead.runnum, fhead.evnum); if (dg[1]) printf("Mult = %f\n", fhead.mult); } if (ReportLevel >= 3) printf("OUT:ptrs: dg[0],dg[1]:%d,%d\n",dg[0],dg[1]); if (doSpc) { ftrkhd.Ntracks=ntrfound; ftrkhd.Ntemplates=templtested; } ftree->Fill(); if(iev%ReportFreq==0 && ReportLevel >=2 && iev) ftree->Print(); if (ReportLevel >= 3) { printf("post-fill\n"); // ftree->Print(); } } // End of run loop phase // DISPLAY if(phase == kDis3 && ReportLevel >= 3 ) { printf("Nothing to display in Out\n"); } // FINAL if(phase == kFin1) { if (ReportLevel >= 1) printf("Out.C:Writing out the tree.\n"); fout.Write(); fout.Close(); if (ReportLevel >= 1) printf("Out.C:Done writing out the tree.\n"); } }