00001
00002
00003 #ifndef __CINT__
00004 # include "StuDraw3DEvent.h"
00005 # include "TColor.h"
00006 # include "StEvent.h"
00007 # include "StTrack.h"
00008 # include "StHit.h"
00009 # include "StFtpcHit.h"
00010 # include "StTrackNode.h"
00011 # include "StTrackGeometry.h"
00012 # include "StFtpcHitCollection.h"
00013 # include "StFtpcSectorHitCollection.h"
00014 # include "StFtpcPlaneHitCollection.h"
00015 # include "StMeasuredPoint.h"
00016 # include "StTrackDetectorInfo.h"
00017 # include "StChain.h"
00018 # include "TSystem.h"
00019 # include "TROOT.h"
00020 #endif
00021
00022 class StEvent;
00023 StEvent* event = 0;
00024 class StChain;
00025 StChain* ftpChain = 0;
00026 class StuDraw3DEvent;
00027 StuDraw3DEvent *gEdFtp = 0;
00028
00029 void DrawUnusedHits()
00030 {
00031 const StHit *hit= 0;
00032 std::vector<float> hitPoints;
00033 const StFtpcHitCollection* ftpHits = event->ftpcHitCollection();
00034 if (ftpHits->numberOfHits()>0) {
00035 unsigned int n,m,h;
00036 for (n=0;n<ftpHits-> numberOfPlanes();++n ) {
00037 for (m=0; m<ftpHits->plane(n)->numberOfSectors(); m++) {
00038 for (h=0; h<ftpHits->plane(n)->sector(m)->hits().size(); h++) {
00039 hit = ftpHits->plane(n)->sector(m)->hits()[h];
00040 hitPoints.push_back( hit->position().x());
00041 hitPoints.push_back( hit->position().y());
00042 hitPoints.push_back( hit->position().z());
00043 } } }
00044 std::vector<float>::iterator xyz = hitPoints.begin();
00045
00046 gEdFtp->Points(hitPoints.size()/3,&*xyz,kUnusedHit);
00047 gEdFtp->SetComment("Unused FTPC hits");
00048
00049 printf(" FTPC hits counter total : %d\n", hitPoints.size()/3);
00050 }
00051 }
00052
00053
00054 void DrawTrackHits()
00055 {
00056
00057 Style_t sty = gEdFtp->Style(kUsedHit).Sty();
00058 Size_t siz = gEdFtp->Style(kUsedHit).Siz();
00059
00060 Style_t styPnt = gEdFtp->Style(kTrackBegin).Sty();
00061 Size_t sizPnt = gEdFtp->Style(kTrackBegin).Siz();
00062
00063 StTrackType type = global;
00064
00065 int trackCounter = 0;
00066 const StSPtrVecTrackNode& theNodes = event->trackNodes();
00067 for (unsigned int i=0; i<theNodes.size(); i++) {
00068 StTrack *track = theNodes[i]->track(type);
00069 if (track && track->flag() > 0
00070 && track->detectorInfo()
00071 && ( track->detectorInfo()->numberOfPoints(kFtpcWestId) || track->detectorInfo()->numberOfPoints(kFtpcEastId) )
00072 && !track->bad()
00073 )
00074 {
00075 ++trackCounter;
00076 double pt = track->geometry()->momentum().perp();
00077 Color_t trackColor = StDraw3DStyle::Pt2Color(pt);
00078
00079 {
00080 gEdFtp->Track(*track,trackColor);
00081 gEdFtp->SetComment(Form("Pt=%f /Gev",pt));
00082 gEdFtp->TrackInOut(*track, true, trackColor, styPnt, sizPnt);
00083 gEdFtp->TrackInOut(*track, false, trackColor, styPnt, sizPnt);
00084 }
00085
00086 {
00087 gEdFtp->Hits(*track,trackColor,sty,siz);
00088
00089 }
00090 }
00091 }
00092 }
00093
00094
00095 void rd()
00096 {
00097
00098 bool clear = true;
00099 if (event) {
00100 if (clear) gEdFtp->Clear();
00101 DrawTrackHits();
00102 DrawUnusedHits();
00103 }
00104 }
00105
00106 void skip(int nEvents=1) {
00107 if(ftpChain) ftpChain->Skip(nEvents);
00108 }
00109
00110
00111 void ae()
00112 {
00113 gEdFtp->Clear();
00114 newevent:
00115 ftpChain->MakeEvent();
00116 event = (StEvent*)ftpChain->GetDataSet("StEvent");
00117 if (event && !event->trackNodes().empty()) {
00118 rd();
00119 } else {
00120 printf(" event is empty %p\n", event);
00121 goto newevent;
00122 }
00123 }
00124
00125
00126 void EdFtpc(const char* file =
00127 "/star/institutions/bnl/fine/testfiles/st_physics_10169042_raw_4030001.event.root"
00128 , unsigned int nEvent=44, const char * detectorNames="FTPC,StarFloor,StarCompass,StarBeam")
00129 {
00130
00131 if ( gSystem->AccessPathName(file)) {
00132 cout << endl << endl
00133 << "** Error ** : The input file: <"<< file << "> does not exist !!!"
00134 << endl << endl;
00135 return;
00136 }
00137
00138 gROOT->Macro("Load.C");
00139 gSystem->Load("StDetectorDbMaker");
00140 TString bfcchain = Form("bfc.C(0,\"doevents\",\"%s\")",file);
00141 if (nEvent > 1)
00142 bfcchain = Form("bfc.C(%d,%d-1,\"doevents\",\"%s\")",nEvent,nEvent,file);
00143 cout << bfcchain.Data() << endl;
00144 gROOT->Macro(bfcchain.Data());
00145
00146 delete gEventDisplay;
00147 ftpChain = (StChain *)StMaker::GetChain();
00148
00149 gEdFtp = new StuDraw3DEvent(detectorNames);
00150 gEdFtp->SetBkColor(kBlack);
00151
00152 ae();
00153 }