1 #include "CtbMatching.h"
3 #include "StMuLcp2TreeMaker.h"
5 #include "StCtbTriggerDetector.h"
6 #include "StMuDSTMaker/COMMON/StMuEvent.h"
7 #include "StarClassLibrary/StPhysicalHelixD.hh"
8 #include "StarClassLibrary/StThreeVectorD.hh"
9 #include "StMuDSTMaker/COMMON/StMuTrack.h"
14 CtbMatching::CtbMatching() {
15 ctbHits=
new vector<ctbHit>();
23 void CtbMatching::loadHits(
StMuEvent* muEve) {
31 for (UInt_t slat = 0; slat < ctbDet->numberOfSlats(); slat++) {
32 for (UInt_t tray = 0; tray < ctbDet->numberOfTrays(); tray++) {
34 curHit.adc = ctbDet->mips(tray,slat,0);
37 ctb_get_slat_from_data(slat, tray, curHit.phi, curHit.eta);
38 ctbHits->push_back(curHit);
52 void CtbMatching::ctb_get_slat_from_data(
int slat,
int tray,
double & ctbphi,
double & ctbeta) {
56 float phiZero2 = 108 ;
65 phi = phiZero1 - tray * deltaPhi ;
68 phi = phiZero2 + (tray-60) * deltaPhi ;
72 if ( phi < 0. ) phi += 360 ;
73 if ( phi > 360. ) phi -= 360 ;
77 ctbeta =(1-2*iz)*(1+2*slat)*0.25;
86 unsigned int CtbMatching::match(
const StMuTrack* rTrack) {
89 const double Rctb=213.6;
99 if(pathLength.second < 0){
100 cout <<
"pathLength is bad" << endl;
106 double phi = atan2(pos.y(),pos.x())*180/TMath::Pi();
107 if(phi < 0) phi+= 360;
109 double theta = atan2(pos.perp(),pos.z());
110 double eta = -log(tan(theta/2.0));
116 for(
unsigned int i = 0; i < ctbHits->size() ; i++){
117 ctbHit curHit = (*ctbHits)[i];
118 deta = fabs(curHit.eta - eta);
119 dphi = fabs(curHit.phi - phi);
120 if(dphi>180) dphi=360.-dphi;
121 if( dphi < (3.+phiToll) && deta < (.25+etaToll)){
122 return static_cast<unsigned int>(curHit.adc);
130 globalTrackJG* glTrack =
new globalTrackJG();
131 bool shouldHitCTB =
false;
132 double etaInCTBFrame = -999;
133 double phiInCTBFrame = -999;
135 glTrack->matchToCTB = EtaAndPhiToOrriginAtCTB(rTrack,ctbHits,shouldHitCTB,etaInCTBFrame,phiInCTBFrame);
136 glTrack->shouldMatchToCTB = shouldHitCTB;
137 glTrack->etaInCTBFrame = etaInCTBFrame;
138 glTrack->phiInCTBFrame = phiInCTBFrame;
142 unsigned int matchToCTB = EtaAndPhiToOrriginAtCTB(rTrack,ctbHits,shouldHitCTB,etaInCTBFrame,phiInCTBFrame);
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
StPhysicalHelixD helix() const
Returns inner helix (first measured point)