00001
00002
00003 #include "StuDraw3DEvent.h"
00004 #ifndef __CINT__
00005 # include "TVirtualPad.h"
00006 # include "TColor.h"
00007 # include "StEventHelper.h"
00008 # include "StEvent.h"
00009 # include "StTrack.h"
00010 # include "StHit.h"
00011 # include "StTpcHit.h"
00012 # include "StTrackNode.h"
00013 # include "StTrackGeometry.h"
00014 # include "StTpcHitCollection.h"
00015 # include "StMeasuredPoint.h"
00016 # include "StTrackDetectorInfo.h"
00017 #endif
00018
00019 class EveDis : public StuDraw3DEvent {
00020
00021
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00039 public:
00040
00041 EveDis(const char *detectorName="TPC",TVirtualPad *pad=0)
00042 : StuDraw3DEvent(detectorName,pad)
00043 {
00044
00045
00046
00047 }
00048
00049
00050 ~EveDis(){ }
00051
00052
00053 void AddHits(const StEvent *event,EStuDraw3DEvent trackHitsOnly, StTrackType type)
00054 {
00055 if (!event) return;
00056 const StTpcHitCollection* hits = event->tpcHitCollection();
00057 if (!hits) return;
00058 unsigned int m, n, h;
00059 if (trackHitsOnly != kUnusedHitsOnly) {
00060 StHit *hit=0;
00061 Style_t sty = Style(kUsedHit).Sty();
00062 Size_t siz = Style(kUsedHit).Siz();
00063 Style_t styPnt = Style(kTrackBegin).Sty();
00064 Size_t sizPnt = Style(kTrackBegin).Siz();
00065
00066 const StSPtrVecTrackNode& theNodes = event->trackNodes();
00067 for (unsigned int i=0; i<theNodes.size(); i++) {
00068 StTrack *track = theNodes[i]->track(type);
00069
00070
00071
00072
00073
00074 if (track && track->flag() > 0
00075 && track->detectorInfo()
00076
00077 )
00078 {
00079
00080
00081
00082 double pt = track->geometry()->momentum().perp();
00083 Color_t trackColor = StDraw3DStyle::Pt2Color (pt);
00084 if ( trackHitsOnly != kUsedHits) {
00085
00086
00087
00088 Track(*track,trackColor);
00089 TrackInOut(*track, true, trackColor, styPnt, sizPnt);
00090 TrackInOut(*track, false, trackColor, styPnt, sizPnt);
00091 }
00092 if ( trackHitsOnly != kTracksOnly) {
00093
00094
00095
00096
00097 std::vector<float> hitPoints;
00098 const StPtrVecHit& trackHits = track->detectorInfo()->hits(kTpcId);
00099 for (m=0; m<trackHits.size(); m++) {
00100
00101
00102
00103 hit = trackHits[m];
00104
00105
00106
00107 hitPoints.push_back( hit->position().x());
00108 hitPoints.push_back( hit->position().y());
00109 hitPoints.push_back( hit->position().z());
00110 }
00111
00112
00113
00114 std::vector<float>::iterator xyz = hitPoints.begin();
00115 Points(hitPoints.size()/3,&*xyz,trackColor,sty,siz);
00116 if (trackHitsOnly == kUsedHits) SetModel(track);
00117 }
00118 }
00119 }
00120 } else {
00121 const StTpcHit *hit;
00122
00123
00124
00125 std::vector<float> hitPoints;
00126 for (n=0; n<hits->numberOfSectors(); n++) {
00127 for (m=0; m<hits->sector(n)->numberOfPadrows(); m++) {
00128 for (h=0; h<hits->sector(n)->padrow(m)->hits().size(); h++) {
00129
00130
00131
00132 hit = hits->sector(n)->padrow(m)->hits()[h];
00133
00134
00135
00136 hitPoints.push_back( hit->position().x());
00137 hitPoints.push_back( hit->position().y());
00138 hitPoints.push_back( hit->position().z());
00139 }
00140 }
00141 }
00142 std::vector<float>::iterator xyz = hitPoints.begin();
00143
00144
00145
00146 Points(hitPoints.size()/3,&*xyz,kUnusedHit);
00147 SetComment("Unused TPC hits");
00148 }
00149 }
00150 ClassDef(EveDis,0);
00151 };
00152