// // Translation Manager in L2STT // // history: // may 00 - STR from WT changed (il-1) back to il again for iladder // #include #include #include #include "tsim_l2stt/TranslationMgr.hpp" #include "framework/Registry.hpp" #include "rcp/RCP.hpp" using namespace std; using namespace edm; using namespace fwk; FWK_REGISTRY_IMPL(TranslationMgr, "$Name: $") TranslationMgr::TranslationMgr(Context* context): Package(context), Dump(context) { RCP rcp = packageRCP(); cout << "Initializing Translation Manager..." << "to take care of the Coordinate Translations and Lookup Tables" << endl; bool UseMap = false; _SMTaddrTranslation = new SmtAddressTranslation(UseMap); setupTrans(); // lookup_table(_CombStripFELookup,_CFTaddressLookup); } std::map TranslationMgr::_StripFEAddressmap; std::map TranslationMgr::_StripRPHImap; SmtAddressTranslation* TranslationMgr::_SMTaddrTranslation; std::map TranslationMgr::_CombStripFELookup; std::map TranslationMgr::_CFTaddressLookup; Result TranslationMgr::dumpEvent(const edm::Event &event){ return Result::success; } TranslationMgr::~TranslationMgr() { delete _SMTaddrTranslation; } void TranslationMgr::setupTrans() { d0_Ref theDetector = smt_build_default(); SiGeometer* theGeometer = SiGeometer::get_instance(); SiChannelGeometer* chgeom = SiChannelGeometer::get_instance(); float pi; pi = acos(-1.0); int crateID, vrbID, hdiID, chipID, chanID; int isector, detpos, ioff; for( int ib = 1 ; ib <= SmtParams::numBarrels() ; ib++ ) { // cout << "Number of Layers for barrel..."<< ib <<" is " // << SmtParams::numLayers()<get_ladder(ib,il,ilad); if (ladderPtr){ // Modified way to get the Ladder details stripPtr = chgeom->get_ladder_strips(ib, il, ilad, iview); } else break; if (stripPtr == NULL) break; float pitch = stripPtr->get_pitch(); float zero = stripPtr->get_strip0(); int maxStrip = SmtParams::numLadderStrips(ib,il,iview); /* Sanity Check for debugging purposes... cout << " Number of strips for ladder..."<< ilad <<" is " << maxStrip<< " view "<get_global(localpoint); float x,y,z; x = gH.x(); y = gH.y(); z = gH.z(); // _clxy->accumulate(x,y); rad = sqrt (x*x+y*y); phi = asin(1.0); if (x != 0){ phi = atan(y/x); if (x < 0)phi=phi+pi; // if (x < 0 && y<0)phi=phi+3*pi/2.0; if (x > 0 && y<0)phi=phi+2*pi; } StripRPHI aStripRPHI = StripRPHI(rad,phi,x,y,z); _StripFEAddressmap[aStripFEAddr] = aStripRPHI; _StripRPHImap[aStripRPHI] = aStripFEAddr; } // end of istrip loop } // end of iview loop } //end of ilad loop } // end of Ilayer loop } //end of Ibarrel loop } bool TranslationMgr::translator(StripFEAddress& hwaddr, StripRPHI& rphiaddr) { bool ok; ok = true; map::const_iterator p; p = _StripFEAddressmap.find(hwaddr); if (p != _StripFEAddressmap.end()) rphiaddr = _StripFEAddressmap[hwaddr]; else ok = false; return ok; } bool TranslationMgr::translator(StripRPHI& rphiaddr, StripFEAddress& hwaddr) { bool ok = true; map ::const_iterator p; p = _StripRPHImap.find(rphiaddr); if (p != _StripRPHImap.end()) hwaddr = _StripRPHImap[rphiaddr]; else ok = false; return ok; } const CartesianCoordinate TranslationMgr::_getLocalPosition(int _barrel, int _layer, int _view, int strip, float pitch, float zero) { // WARNING: Some of this stuff I'm not sure about. The code is taken // from smt_hitalgs/src/algs/SMTDetClusPosAlg::ubar // Positive sign for barrels 1 to 3, -ve for 4 to 6 int sign = _barrel < 4 ? 1.0 : -1.0; // For time being hard-code these numbers // They come from /d0dist/dist/releases/t00.55.00/rcpdb/SMTBarrel1DPos.rcp float pside_strip_adjust = 0.001; float nside_strip_adjust = 0.0023; float nside90_strip_adjust = 0.0; // Get strip adjustment float adjustment = 0.0; int which; if ( _view == 1 ) // p-side { adjustment = pside_strip_adjust*sign; which = 0; // axial? } else if ( _view == 2 ) // n-side { if ( (_layer == 1) || (_layer == 2) || (_layer == 5) || (_layer == 6)) { adjustment = nside90_strip_adjust; which = 2; // 90 degrees stereo? } else { adjustment = nside_strip_adjust*sign; which = 1; // small angle stereo? } } // This may NOT be correct! // convert from Svx Chan to offline strip number // QUESTION? Does chip number start from 0 or 1 ? //Commented by me, will pass strip number as Input parameter. // int strip = 128*_chip + 1; float pos = adjustment + zero + strip*pitch; float xlocal, ylocal, zlocal; if ( which < 2 ) { xlocal = pos; ylocal = 0.0; zlocal = 0.0; } else { xlocal = 0.0; ylocal = 0.0; zlocal = pos; } return CartesianCoordinate(xlocal,ylocal,zlocal); } int TranslationMgr::assignVRB(int ibar, int ilay){ int vrbID; if (ilay<=6){ if (ibar == 1 || ibar == 3 || ibar == 5) { vrbID = (ibar-3)/2 + ibar; } else { if (ibar == 2 || ibar == 4 || ibar == 6) { vrbID = (ibar-2)/2 + ibar; } } } else { if ( ibar == 1 || ibar == 2) {vrbID = 1;} if ( ibar == 3 || ibar == 4) {vrbID = 4;} if ( ibar == 5 || ibar == 6) {vrbID = 7;} } return vrbID; } int TranslationMgr::assignHDI(int layer, int barrel, int ladder){ int hdi_index; if ((layer <= 4) && (layer >= 1)){ // layer 1..4 hdi_index = layer - 1; } else if ((layer <= 6) && (layer >= 5)) { // layer 5..6 if (ladder % 2 == 0) { // ladder is even hdi_index = layer; } else if ((ladder % 2) == 1) { // ladder is odd hdi_index = layer + 2 * (layer / 6) - 1; // cout << "layer % 6 = "<= 7)){ // layer 7..8 if ((barrel <= 3) && (barrel >= 1)){ // barrel 1..3 if (layer == 7) // ladder is odd hdi_index = ((barrel-1)%2)*4+ladder%2; if (layer == 8) hdi_index = ((barrel-1)%2)*4+(ladder-1)%2+2; // if(barrel != 2) hdi_index = hdi_index - 6; } else if ((barrel <= 6) && (barrel >= 4)){ // barrel 4..6 if(layer == 7) hdi_index = ((barrel-1)%2)*4+(ladder-1)%2; if(layer ==8) hdi_index = ((barrel-1)%2)*4+ladder%2+2; } } return hdi_index; } void TranslationMgr::assignChanID(int barrel, int layer, int view, int strip, int& chip_index, int& channel_index){ if ((barrel<=5)&&(barrel>=2)) { // barrel 2..5 if (((layer==3)||(layer==4))||((layer==7)||(layer==8))){ chip_index = (strip - 1) / 128 + 5*(view-1) ; channel_index = (strip-1) - ( chip_index - 5*(view-1) )*128; } else{ chip_index = 3*(view-1)+((strip>384?strip-384:strip)-1)/128; channel_index = ((strip>384?strip-384:strip)-1) - (chip_index - 3*(view-1))*128; } } else{ // p-side // int xxx1 = ceil((strip + 1) / 128); if (((layer==3)||(layer==4))||((layer==7)||(layer==8))){ chip_index = (strip - 1) / 128 + 5*(view-1) ; channel_index = (strip-1) - (chip_index - 5*(view-1))*128; } else{ chip_index = (strip - 1)/128; channel_index = strip - 1 - chip_index*128; } // cout << " huh B " << xxx1 << " " << chip_index << endl; } // calculate channel number } void TranslationMgr::assignChanID(int istrip, int& chipID, int& chanID){ chipID = (istrip-1)/128; chanID = (istrip-1) -128 *chipID; } void TranslationMgr::assignSector(int layer, int ladder, int barrel, int& sector, int& detpos){ detpos = 0; if ((barrel <= 3) && (barrel >= 1)){ // barrel 1..3 if ((layer <= 4) && (layer >= 1)){ // layer 1..4 sector = ladder; } else { if (layer <= 8 && layer >= 5){ // layer 5..8 sector = ceil(ladder / 2.0); if( (layer == 6 || layer == 7) && ladder%2==0) { sector = ceil(ladder/2)+1; if(sector > 6) sector = 1; } } } } else if ((barrel <= 6) && (barrel >= 4)) { // barrel 4..6 if ((layer <= 4) && (layer >= 1)){ // layer 1..4 sector = ladder; } else { if ((layer <= 8) && (layer >= 5)) { sector = ceil(ladder / 2.0); if( (layer == 6 || layer == 8) && ladder%2==0) { sector = ceil(ladder/2)+1; if(sector > 6) sector = 1; } } } } } void TranslationMgr::lookup_table( std::map& CombStripFEAddressMap, std::map& CFTaddressMap) { // Open file for writing out the Lookup Table fstream Lookout; bool use_input_file = false; Lookout.open("lookup_table.dat", ios::in); if(!Lookout){ cout << "Cannot open the Lookup table file for input" <> trkpt >>trksign >> trksect >> trkphi_h; CFTaddress CFTaddr = CFTaddress(trksign,trkpt,trksect,trkphi_h); for(int ib = 0; ib<6; ib++){ for(int i = 0; i<8; i++){ Lookout>>b>>l>>packed_address; StripFEAddress StripFEAddr = StripFEAddress(packed_address); CombStripFEAddr.set_layer_min(b,l,0.0,StripFEAddr); } } CombStripFEAddressMap[CombStripFEAddr] = CFTaddr; CFTaddressMap[CFTaddr] = CombStripFEAddr; /* if(countn - nn > 0){ cout << countn< theDetector = smt_build_default(); SiGeometer* theGeometer = SiGeometer::get_instance(); SiChannelGeometer* chgeom = SiChannelGeometer::get_instance(); float highest_avg[4] = {11.42857, 16.0, 26.66667, 80.0000}; float high_avg[4] = {5.333333, 6.15385, 7.27273, 8.88889}; float pi; int crateID, vrbID, hdiID, chipID, chanID, isector, detpos; pi = acos(-1.0); int NHfiber = 3520; int NAfiber = 1280; // A & Hlayer radii Hard coded for now...0 float Hrad = 51.6335; float Arad = 20.0786; int tot_count=0; for(int ih = 1; ih<= NHfiber; ih++){ for(int isign = -1; isign<2; isign=isign+2){ for(int aoffset = 3; aoffset<=14; aoffset++){ tot_count++; // cout< NAfiber)afiber = afiber-NAfiber; // Now set the CFT parameters int trksign, trkpt, trksect, trkphi_h; trksign = isign; // Create trkpt word for alayer offset (low pt) int hi2, low3; hi2 = (aoffset<=6)?2:3; low3 = (aoffset<=6)?aoffset-3:aoffset-7; trkpt = (hi2&0x0003)<<3|(low3&0x0007); // Create Phi sector for H layer doublet trksect = ih/44; trkphi_h = (ih - trksect*44)%44; CFTaddress CFTaddr = CFTaddress(trksign, trkpt, trksect, trkphi_h); float Hlayer_phi, Alayer_phi,Trk_pt,Trk_00_phi; // Hlayer_phi = CFTaddr.get_Hphi(); Alayer_phi = CFTaddr.get_Aphi(); Trk_pt = CFTaddr.get_trkpt(); Trk_00_phi = Hlayer_phi - isign*0.003*Hrad/Trk_pt; if(Trk_00_phi < 0)Trk_00_phi = 2*pi+Trk_00_phi; if(Trk_00_phi > 2*pi) Trk_00_phi = Trk_00_phi-2*pi; CombStripFEAddress CombStripFEAddr; for(int ib = 1; ib<= SmtParams::numBarrels() ; ib++){ for(int il = 1; il <= SmtParams::numLayers(); il++) { // Variables to store the SMTFE address of the closest phi match // for given layer and barrel float CFT_SMT_match = 999.0; StripFEAddress CFT_match_StripFEAddr; bool found_match = false; // vrbID = assignVRB(ib, il); double xlocal, ylocal, zlocal; float rad,phi; // changed (il-1) to il STR from WT - may00 for(int ilad = 1; ilad <= SmtParams::numLadders(il) ; ilad++){ assignSector(il, ilad, ib,isector, detpos); crateID = isector - 1; hdiID = assignHDI(il, ib, detpos); const SiStrips* stripPtr; int iview = 1; const SiLadder* ladderPtr = theGeometer->get_ladder(ib, il, ilad); if(ladderPtr){ stripPtr = chgeom->get_ladder_strips(ib, il, ilad, iview); } else break; if(stripPtr == NULL)break; float pitch = stripPtr->get_pitch(); float zero = stripPtr->get_strip0(); int maxStrip = SmtParams::numLadderStrips(ib,il,iview); // Compute Delta phi for 1st strip and Last strip in the ladder, if Delta // phi changes sign then minimum delta phi lies in that ladder find it and skip // rest of the ladders in that layer.... assignChanID(ib,il,iview,1,chipID,chanID); StripFEAddress aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); StripRPHI rphiaddr; bool ok = translator(aStripFEAddr, rphiaddr); float rad, phi, phi_diff_low, phi_diff_high,phil,phih; if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); phil = phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; if(CFT_SMT_match > delta_phi(phi, CFT_trk_phi) ){ CFT_SMT_match = delta_phi(phi, CFT_trk_phi); CFT_match_StripFEAddr = aStripFEAddr; } phi_diff_low = signed_delta_phi(phi, CFT_trk_phi); //for last strip in the ladder assignChanID(ib,il,iview,maxStrip,chipID,chanID); aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); ok = translator(aStripFEAddr, rphiaddr); if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); phih=phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; if(CFT_SMT_match > delta_phi(phi, CFT_trk_phi) ){ CFT_SMT_match = delta_phi(phi, CFT_trk_phi); CFT_match_StripFEAddr = aStripFEAddr; } phi_diff_high = signed_delta_phi(phi, CFT_trk_phi); //check sign of phi_diff_high and phi_diff_low, if they have same sign means //matched strip is not in this ladder go to next ladder...if sign is different //then match is in this ladder...loop over all the strips and find minimum //delta phi. if (phi_diff_high == 0 || phi_diff_low ==0){ found_match = true; break; } else if(abs(phih-phil)>pi){ } else if( (int)(phi_diff_high/abs(phi_diff_high)) == (int)(phi_diff_low/abs(phi_diff_low)) ){ continue; //goto next ladder } // // Use the Binary search method to look for minimum in a ladder // int hi,lo,mid; float midphi,lophi; hi = maxStrip; lo = 1; // while((hi-lo)>1){ mid = (hi+lo)/2; assignChanID(ib,il,iview,lo,chipID,chanID); aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); ok = translator(aStripFEAddr, rphiaddr); if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); lophi=phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; phi_diff_low = CFT_trk_phi - lophi; if(CFT_SMT_match > abs(delta_phi(phi, CFT_trk_phi)) ){ CFT_SMT_match = abs(delta_phi(phi, CFT_trk_phi)); CFT_match_StripFEAddr = aStripFEAddr; } assignChanID(ib,il,iview,mid,chipID,chanID); aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); ok = translator(aStripFEAddr, rphiaddr); if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); midphi=phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; phi_diff_high =CFT_trk_phi - midphi; if(CFT_SMT_match > abs(delta_phi(phi, CFT_trk_phi)) ){ CFT_SMT_match = abs(delta_phi(phi, CFT_trk_phi)); CFT_match_StripFEAddr = aStripFEAddr; } int signlo; int signmid; signmid = (int)(phi_diff_high/abs(phi_diff_high)); signlo = (int)(phi_diff_low/abs(phi_diff_low)); if (phi_diff_high == 0 || phi_diff_low ==0){ found_match = true; break; } else if(abs(lophi-midphi)>pi){ if(signlo != signmid) lo = mid; else hi = mid; } else if( signlo == signmid ) lo = mid; else hi = mid; } //While loop for binary search of closest strip; // // End of Binary search for the minimum // // if match is found in this ladder break out of the ilad loop // if(found_match) break; } //end of ilad loop CombStripFEAddr.set_layer_min(ib,il,CFT_SMT_match,CFT_match_StripFEAddr); } // end of Ilayer loop } //end of Ibarrel loop CombStripFEAddressMap[CombStripFEAddr] = CFTaddr; CFTaddressMap[CFTaddr] = CombStripFEAddr; CFTaddr.output_file(Lookout); CombStripFEAddr.output_file(Lookout); Lookout << endl; // cout << " for layer H and A -layer offset "<< ih <<" - " // < 2*pi) Trk_00_phi = Trk_00_phi-2*pi; CombStripFEAddress CombStripFEAddr; // insert from top for(int ib = 1; ib<= SmtParams::numBarrels() ; ib++){ for(int il = 1; il <= SmtParams::numLayers(); il++) { // Variables to store the SMTFE address of the closest phi match // for given layer and barrel float CFT_SMT_match = 999.0; StripFEAddress CFT_match_StripFEAddr; bool found_match = false; // vrbID = assignVRB(ib, il); double xlocal, ylocal, zlocal; float rad,phi; // changed (il-1) to il STR from WT may00 for(int ilad = 1; ilad <= SmtParams::numLadders(il) ; ilad++){ assignSector(il, ilad, ib,isector, detpos); crateID = isector - 1; hdiID = assignHDI(il, ib, detpos); const SiStrips* stripPtr; int iview = 1; const SiLadder* ladderPtr = theGeometer->get_ladder(ib, il, ilad); if(ladderPtr){ stripPtr = chgeom->get_ladder_strips(ib, il, ilad, iview); } else break; if(stripPtr == NULL)break; float pitch = stripPtr->get_pitch(); float zero = stripPtr->get_strip0(); int maxStrip = SmtParams::numLadderStrips(ib,il,iview); // Compute Delta phi for 1st strip and Last strip in the ladder, if Delta // phi changes sign then minimum delta phi lies in that ladder find it and skip // rest of the ladders in that layer.... assignChanID(ib,il,iview,1,chipID,chanID); StripFEAddress aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); StripRPHI rphiaddr; bool ok = translator(aStripFEAddr, rphiaddr); float rad, phi, phi_diff_low, phi_diff_high,phil,phih; if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); phil = phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; if(CFT_SMT_match > delta_phi(phi, CFT_trk_phi) ){ CFT_SMT_match = delta_phi(phi, CFT_trk_phi); CFT_match_StripFEAddr = aStripFEAddr; } phi_diff_low = signed_delta_phi(phi, CFT_trk_phi); //for last strip in the ladder assignChanID(ib,il,iview,maxStrip,chipID,chanID); aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); ok = translator(aStripFEAddr, rphiaddr); if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); phih=phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; if(CFT_SMT_match > delta_phi(phi, CFT_trk_phi) ){ CFT_SMT_match = delta_phi(phi, CFT_trk_phi); CFT_match_StripFEAddr = aStripFEAddr; } phi_diff_high = signed_delta_phi(phi, CFT_trk_phi); //check sign of phi_diff_high and phi_diff_low, if they have same sign means //matched strip is not in this ladder go to next ladder...if sign is different //then match is in this ladder...loop over all the strips and find minimum //delta phi. if (phi_diff_high == 0 || phi_diff_low ==0){ found_match = true; break; } else if(abs(phih-phil)>pi){ } else if( (int)(phi_diff_high/abs(phi_diff_high)) == (int)(phi_diff_low/abs(phi_diff_low)) ){ continue; //goto next ladder } // // Use the Binary search method to look for minimum in a ladder // int hi,lo,mid; float midphi,lophi; hi = maxStrip; lo = 1; // while((hi-lo)>1){ mid = (hi+lo)/2; assignChanID(ib,il,iview,lo,chipID,chanID); aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); ok = translator(aStripFEAddr, rphiaddr); if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); lophi=phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; phi_diff_low = CFT_trk_phi - lophi; if(CFT_SMT_match > abs(delta_phi(phi, CFT_trk_phi)) ){ CFT_SMT_match = abs(delta_phi(phi, CFT_trk_phi)); CFT_match_StripFEAddr = aStripFEAddr; } assignChanID(ib,il,iview,mid,chipID,chanID); aStripFEAddr = StripFEAddress(SmtFEAddress::Encoder(crateID, vrbID, hdiID, chipID, chanID)); ok = translator(aStripFEAddr, rphiaddr); if(ok){ rad = rphiaddr.get_Stripradius(); phi = rphiaddr.get_Stripphi(); midphi=phi; } else{ cout << "Couldn't get the address translation for " << "Barrel, layer,ladder "<< ib << " "< 2*pi)CFT_trk_phi = CFT_trk_phi - 2*pi; phi_diff_high =CFT_trk_phi - midphi; if(CFT_SMT_match > abs(delta_phi(phi, CFT_trk_phi)) ){ CFT_SMT_match = abs(delta_phi(phi, CFT_trk_phi)); CFT_match_StripFEAddr = aStripFEAddr; } int signlo; int signmid; signmid = (int)(phi_diff_high/abs(phi_diff_high)); signlo = (int)(phi_diff_low/abs(phi_diff_low)); if (phi_diff_high == 0 || phi_diff_low ==0){ found_match = true; break; } else if(abs(lophi-midphi)>pi){ if(signlo != signmid) lo = mid; else hi = mid; } else if( signlo == signmid ) lo = mid; else hi = mid; } //While loop for binary search of closest strip; // // End of Binary search for the minimum // // if match is found in this ladder break out of the ilad loop // if(found_match) break; } //end of ilad loop CombStripFEAddr.set_layer_min(ib,il,CFT_SMT_match,CFT_match_StripFEAddr); } // end of Ilayer loop } //end of Ibarrel loop CombStripFEAddressMap[CombStripFEAddr] = CFTaddr; CFTaddressMap[CFTaddr] = CombStripFEAddr; CFTaddr.output_file(Lookout); CombStripFEAddr.output_file(Lookout); Lookout << endl; // cout << "For Barrel, Layer..."<< ib << " "<< il< pi)dphi = 2*pi-dphi; return dphi; } float TranslationMgr::signed_delta_phi(float phi1, float phi2) { // float pi = 3.141592654; float dphi; /* float x, y, dphi; x = cos(phi2-phi1); y = sin(phi2-phi1); dphi = pi/2.0; if(x == 0.0) return dphi; dphi = atan(y/x); */ dphi = phi1-phi2; // if(dphi < 0)dphi = phi2-phi1; // if(abs(dphi) > pi && dphi<0)dphi = 2*pi-abs(dphi); // if(abs(dphi) > pi && dphi>0)dphi = abs(dphi)-2*pi; return dphi; }