36 #include "TGeoVolume.h"
38 #include "TGeoManager.h"
39 #include "TGeoMedium.h"
40 #include "TGeoMatrix.h"
43 #include "StarClassLibrary/StPhysicalHelixD.hh"
44 #include "StMuDSTMaker/COMMON/StMuTrack.h"
45 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
47 #include "EEmcTower.h"
48 #include "EEmcTTMatch.h"
49 #include "EEmcTTMMaker.h"
50 #include "EEmcTTDisplay.h"
53 static const double cLight = 3e10*centimeter/second;
56 static const int kSectorColors[] = {
81 mShowExtrapolatedTracks =
false;
88 if(mEEmc)
delete mEEmc;
89 if(mTrackHits)
delete mTrackHits;
90 if(mTowerHits)
delete mTowerHits;
95 EEmcTTDisplay::initGeometry(
const char *topName)
97 const double kDPhi = -15.0/180.0*M_PI;
99 if(mEEmc!=NULL)
return;
101 double eta1 = mEtaBin[0];
102 double eta2 = mEtaBin[mNumEta];
104 double rmin1 = mZ1/TMath::SinH(eta1);
105 double rmax1 = mZ1/TMath::SinH(eta2);
107 double rmin2 = mZ2/TMath::SinH(eta1);
108 double rmax2 = mZ2/TMath::SinH(eta2);
110 double dz = TMath::Abs(mZ2-mZ1)/2.0;
112 int numSSec = mNumSec*mNumSSec;
114 TGeoMedium *medVac =
new TGeoMedium (
"Vacuum",1,
new TGeoMaterial(
"Vacuum") );
115 TGeoCone *econe =
new TGeoCone(dz,rmin1,rmax1,rmin2,rmax2);
116 mEEmc =
new TGeoVolume(topName,econe,medVac);
117 mEEmc->SetLineColor(kWhite);
118 TGeoConeSeg *geosector =
new TGeoConeSeg(dz,rmin1,rmax1,rmin2,rmax2,0.0,360.0/mNumSec);
119 TGeoConeSeg *geosubsec =
new TGeoConeSeg(dz,rmin1,rmax1,rmin2,rmax2,0.0,360.0/numSSec);
120 for(
unsigned s=0;s<mNumSec;s++) {
122 sprintf(rotName,
"RotSec%02d",s+1);
123 TGeoRotation *rots =
new TGeoRotation(rotName,phi/M_PI*180.0,0.0,0.0);
124 TGeoVolume *sector =
new TGeoVolume(volumeName(s),geosector,medVac);
125 sector->SetVisibility(kTRUE);
126 sector->SetLineColor (kSectorColors[s]);
127 mEEmc->AddNode(sector,1,rots);
129 for(
unsigned ss=0;ss<mNumSSec;ss++) {
131 sprintf(rotName,
"Rot%02dT%1c",s+1,ss+
'A');
132 TGeoRotation *rotss =
new TGeoRotation(rotName,phi/M_PI*180.0,0.0,0.0);
133 TGeoVolume *subsector =
new TGeoVolume(volumeName(s,ss),geosubsec,medVac);
134 subsector->SetVisibility(kFALSE);
135 sector->AddNode(subsector,1,rotss);
137 for(
unsigned e=0;e<mNumEta;e++) {
140 rmin1 = mZ1/TMath::SinH(eta1);
141 rmax1 = mZ1/TMath::SinH(eta2);
142 rmin2 = mZ2/TMath::SinH(eta1);
143 rmax2 = mZ2/TMath::SinH(eta2);
145 TGeoConeSeg *geotile =
new TGeoConeSeg(dz,rmin1,rmax1,rmin2,rmax2,0.0,360.0/numSSec);
146 TGeoVolume *tile =
new TGeoVolume(volumeName(s,ss,e),geotile,medVac);
147 tile->SetVisibility(kFALSE);
148 subsector->AddNode(tile,1);
158 TIter nextTower(mTowerHits);
159 TIter nextTrack(mTrackHits);
164 while( (gnode=(TGeoNode *)nextTower())!=NULL ) {
165 vol=gnode->GetVolume();
166 vol->SetLineColor(kRed);
167 vol->SetVisibility(kTRUE);
169 while( (helix=(THelix *)nextTrack())!=NULL ) {
178 TIter nextTower(mTowerHits);
180 while( (gnode=(TGeoNode *)nextTower())!=NULL ) {
182 gnode->GetVolume()->SetLineColor(kBlack);
183 gnode->GetVolume()->SetVisibility(kFALSE);
186 mTrackHits->Delete();
200 TIter sector(mEEmc->GetNodes());
201 while( (node=(TGeoNode *)sector())!=NULL ) {
202 if(strncmp(vname,node->GetVolume()->GetName(),kSecLen)!=0)
continue;
203 TIter subsector(node->GetVolume()->GetNodes());
204 while( (node=(TGeoNode *)subsector())!=NULL ) {
205 if(strncmp(vname,node->GetVolume()->GetName(),kSubLen)!=0)
continue;
206 TIter tile(node->GetVolume()->GetNodes());
207 while( (node=(TGeoNode *)tile())!=NULL ) {
208 if(strncmp(vname,node->GetVolume()->GetName(),kEtaLen)!=0)
continue;
210 mTowerHits->Add(node);
227 Double_t px, Double_t py, Double_t pz,
228 Double_t qB, Double_t zMin, Double_t zMax)
230 THelix *helix =
new THelix(x,y,z,px,py,pz,cLight*qB);
232 if(zMin<=0.0) zMin=z;
233 if(zMax<=0.0) zMax=mZ2;
235 helix->SetRange(zMin,zMax);
236 helix->SetLineColor(102);
237 helix->SetLineWidth(2);
239 if(mShowExtrapolatedTracks) {
240 THelix *helixExt =
new THelix(x,y,z,px,py,pz,cLight*qB);
241 helixExt->SetRange(z ,mZ2);
242 helixExt->SetLineColor(20);
243 helixExt->SetLineWidth(1);
244 mTrackHits->Add(helixExt);
246 mTrackHits->Add(helix);
256 double q = h.charge(mBField*tesla);
261 q*mBField*tesla,zMin,zMax);
270 if(!
AddTower(*tower))
return kFALSE;
271 TIter nextTrack(tmatch.
Tracks());
283 TIter nextTrack(tmatch.
Tracks());
291 const int bufLen=1024;
292 static char buff[bufLen];
297 TIter nextTrack(tmatch.
Tracks());
298 while((track=(
StMuTrack *)nextTrack())) {
299 sprintf(buff,
"ADC(%s)=%4.1f pT=%.2f GeV/c\n",volumeName(*tower),tower->
ADC(),track->
pt());
311 EEmcTTDisplay::volumeName (
int sec,
int sub,
int eta)
313 const int vnameLen=1024;
314 static char vname[vnameLen];
317 memset(vname,0x00,vnameLen);
318 if( 0<=sec && sec<
int(mNumSec ) ) kCase |=0x4;
else kCase &=0x3;
319 if( 0<=sub && sub<
int(mNumSSec) ) kCase |=0x2;
else kCase &=0x5;
320 if( 0<=eta && eta<
int(mNumEta ) ) kCase |=0x1;
else kCase &=0x6;
323 case 0x07: sprintf(vname,
"%02dT%1c%02d",sec+1,sub+
'A',eta+1);
break;
324 case 0x06: sprintf(vname,
"%02dT%1c" ,sec+1,sub+
'A');
break;
325 case 0x04: sprintf(vname,
"%02d" ,sec+1) ;
break;
332 EEmcTTDisplay::volumeName(
const EEmcTower& tower)
334 return volumeName(tower.
Sec(),tower.
SubSec(),tower.
Eta());
float ADC() const
gets adc value associated with the tower (pedestal adjusted)
Bool_t AddMatch(EEmcTTMatch &tmatch)
Double_t pt() const
Returns pT at point of dca to primary vertex.
void Out(ostream &out, EEmcTTMatch &tmatch)
TList * Tracks()
returns a list of matched tracks
Float_t getPhiMean(UInt_t sec) const
StPhysicalHelixD helix() const
Returns inner helix (first measured point)
Bool_t AddTower(const char *tile)
EEmcTTDisplay(const char *name="eemc")
const StThreeVectorF & firstPoint() const
Returns positions of first measured point.
EEmcTower * Tower()
returns a tower data
int SubSec() const
gets tower subsector index, computer offset [0,....)
void Draw(const Option_t *option="")
void Clear(const Option_t *option="")
const StThreeVector< double > & origin() const
-sign(q*B);
int Sec() const
gets tower sector index, computer offset [0,....)
~EEmcTTDisplay()
the destructor
const StThreeVectorF & lastPoint() const
Returns positions of last measured point.
EEmcTTMatch class contains results of TPC track to EEMC tower matching.
Bool_t AddTrack(Double_t x, Double_t y, Double_t z, Double_t px, Double_t py, Double_t pz, Double_t qB, Double_t zMin=0.0, Double_t zMax=0.0)
int Eta() const
gets tower eta index, computer offset [0,....)
EEmcTower holds information about an EEMC tower 'hit'.