4 #include "StFgtDbFileMaker.h"
5 #include "TDataSetIter.h"
6 #include "StDAQMaker/StDAQReader.h"
7 #include "StFgtUtil/geometry/StFgtGeom.h"
17 StFgtDbFileMaker::~StFgtDbFileMaker(){
22 Int_t StFgtDbFileMaker::Init(){
26 for (Int_t i = 0;i< 51200;i++){
29 return StMaker::Init();
38 printRealDbMappingFile();
45 for (Int_t i = 0;i< 51200;i++){
46 cout<<i<<
" "<< mapping[i]<<endl;
51 void StFgtDbFileMaker::printBigFgtGeomMap()
54 for (rdo=1;rdo<3;rdo++){
55 for (arm=0;arm<6;arm++){
56 for (apv=0;apv<24;apv++){
57 for (channel=0;channel<128;channel++){
59 if ((apv==10)||(apv==11)||(apv==22)||(apv==23))
continue;
62 if (apv > 11) apvMod = apv-2;
64 geoId = geom->getNaiveGeoIdFromElecCoord(rdo,arm,apv,channel);
65 geom->decodeGeoId(geoId,disk,quad,layer,strip);
66 electId = getElectId(rdo,arm,apvMod,channel);
67 cout<<
" geoId="<<geoId<<
" electId="<<electId<<
68 " rdo="<<rdo<<
" arm="<<arm<<
" apv="<<apv<<
" apvMod="<<apvMod<<
" channel="<<channel<<
69 " disk="<<disk<<
" quad="<<quad<<
" layer="<<layer<<
" strip="<<strip<<endl;
78 void StFgtDbFileMaker::printIdealDbMappingFile(){
80 for (rdo=1;rdo<3;rdo++){
81 for (arm=0;arm<6;arm++){
82 for (apv=0;apv<24;apv++){
83 for (channel=0;channel<128;channel++){
85 if ((apv==10)||(apv==11)||(apv==22)||(apv==23))
continue;
88 if (apv > 11) apvMod = apv-2;
90 geoId = geom->getNaiveGeoIdFromElecCoord(rdo,arm,apv,channel);
91 geom->decodeGeoId(geoId,disk,quad,layer,strip);
92 electId = getElectId(rdo,arm,apvMod,channel);
93 cout<<electId<<
" "<<geoId<<endl;
101 void StFgtDbFileMaker::printRealDbMappingFile(){
109 f.open(
"NewMappingFileMark2.txt");
117 Int_t electronicID,geoId;
120 while (f>>ch>>apv>>bs>>r>>phi)
124 if (0) cout<<
" ch = "<<ch<<
" apv = "<<apv<<
" bs="<<bs<<
" r="<<r<<
" phi="<<phi<<endl;
127 if (phi == -1) layer =
'R';
128 if (r == -1) layer =
'P';
138 for (
int disk= 0; disk< 6; ++disk)
140 for (
int quad = 0; quad<4; ++quad)
146 if (layer ==
'P') stripId = searchPhiStripId(phi);
147 if (layer ==
'R') stripId = searchRStripId_HighPhi(r);
360 if (layer ==
'P') stripId = searchPhiStripId(phi);
361 if (layer ==
'R') stripId = searchRStripId_LowPhi(r);
570 strip = stripId % kFgtNumStrips;
571 geoId= StFgtGeom::encodeGeoId(disk, quad,layer,strip);
573 Int_t real_apv = group*12 + apv;
574 electronicID = StFgtGeom::encodeElectronicId(rdo,arm, real_apv,ch);
576 mapping[electronicID]=geoId;
579 cout<<
" rdo="<<rdo<<
" arm="<<arm<<
" apv ="<<apv<<
" ch="<<ch<<
" electId="<<
580 electronicID<<
" disk="<<disk<<
" quad="<<quad<<
" layer="<<layer<<
" strip="<<
581 strip<<
" stripID="<<stripId<<
" geoID="<<geoId<<endl;
591 Int_t StFgtDbFileMaker::searchRStripId_HighPhi(Double_t r)
598 for (ii = 0; ii < 280; ++ii)
600 if (r == StFgtGeom::mStrips[ii].ordinate) {
610 Int_t StFgtDbFileMaker::searchRStripId_LowPhi(Double_t r)
618 for (ii = 400; ii < (kFgtNumStrips*2); ++ii)
620 if (r == StFgtGeom::mStrips[ii].ordinate) {
631 Int_t StFgtDbFileMaker::searchPhiStripId(Double_t p)
639 for (ii = 0; ii < (2*kFgtNumStrips); ++ii)
641 if (p == StFgtGeom::mStrips[ii].ordinate){
651 Int_t StFgtDbFileMaker::getElectId(Int_t rdo, Int_t arm, Int_t apvMod, Int_t channel){
654 if ((rdo > 0)&&( rdo < 3)){
655 if ((arm >= 0)&&(arm < 6)){
656 if ((apvMod >= 0)&&(apvMod < 20)){
657 if ((channel >= 0)&&(channel < 128)){
659 eID = channel + (128 * (apvMod + (20 * (arm + (6 * (rdo - 1))))));
virtual Int_t Make()
Make - this method is called in loop for each event.