KK. More...
#include <CSCTFPtLUT.h>
Public Member Functions | |
CSCTFPtLUT (const edm::EventSetup &c) | |
KK. | |
CSCTFPtLUT (const edm::ParameterSet &, const L1MuTriggerScales *scales, const L1MuTriggerPtScale *ptScale) | |
CSCTFPtLUT (const CSCTFPtLUT &) | |
CSCTFPtLUT & | operator= (const CSCTFPtLUT &) |
ptdat | Pt (const unsigned &) const |
ptdat | Pt (const unsigned &delta_phi_12, const unsigned &track_eta, const unsigned &track_mode, const unsigned &track_fr, const unsigned &delta_phi_sign) const |
ptdat | Pt (const unsigned &delta_phi_12, const unsigned &delta_phi23, const unsigned &track_eta, const unsigned &track_mode, const unsigned &track_fr, const unsigned &delta_phi_sign) const |
ptdat | Pt (const ptadd &) const |
~CSCTFPtLUT () | |
Private Member Functions | |
ptdat | calcPt (const ptadd &) const |
void | readLUT () |
unsigned | trackQuality (const unsigned &eta, const unsigned &mode) const |
Private Attributes | |
bool | isBeamStartConf |
bool | isBinary |
unsigned | lowQualityFlag |
edm::FileInPath | pt_lut_file |
unsigned | pt_method |
CSCTFPtMethods | ptMethods |
bool | read_pt_lut |
const L1MuTriggerPtScale * | trigger_ptscale |
const L1MuTriggerScales * | trigger_scale |
Static Private Attributes | |
static bool | lut_read_in = false |
static ptdat * | pt_lut = NULL |
KK.
Definition at line 14 of file CSCTFPtLUT.h.
CSCTFPtLUT::CSCTFPtLUT | ( | const edm::EventSetup & | c | ) |
KK.
Definition at line 33 of file CSCTFPtLUT.cc.
References edm::EventSetup::get(), isBeamStartConf, lowQualityFlag, L1MuCSCPtLut::lut(), lut_read_in, edm::ESHandle< T >::product(), pt_lut, pt_method, ptMethods, trigger_ptscale, and trigger_scale.
: read_pt_lut(false), isBinary(false) { pt_method = 4; lowQualityFlag = 4; isBeamStartConf = true; pt_lut = new ptdat[1<<21]; edm::ESHandle<L1MuCSCPtLut> ptLUT; es.get<L1MuCSCPtLutRcd>().get(ptLUT); const L1MuCSCPtLut *myConfigPt_ = ptLUT.product(); memcpy((void*)pt_lut,(void*)myConfigPt_->lut(),(1<<21)*sizeof(ptdat)); lut_read_in = true; edm::ESHandle< L1MuTriggerScales > scales ; es.get< L1MuTriggerScalesRcd >().get( scales ) ; trigger_scale = scales.product() ; edm::ESHandle< L1MuTriggerPtScale > ptScale ; es.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ; trigger_ptscale = ptScale.product() ; ptMethods = CSCTFPtMethods( ptScale.product() ) ; }
CSCTFPtLUT::CSCTFPtLUT | ( | const edm::ParameterSet & | pset, |
const L1MuTriggerScales * | scales, | ||
const L1MuTriggerPtScale * | ptScale | ||
) |
Definition at line 62 of file CSCTFPtLUT.cc.
References edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isBeamStartConf, isBinary, lowQualityFlag, lut_read_in, pt_lut, pt_lut_file, pt_method, read_pt_lut, and readLUT().
: trigger_scale( scales ), trigger_ptscale( ptScale ), ptMethods( ptScale ), read_pt_lut(false), isBinary(false) { //read_pt_lut = pset.getUntrackedParameter<bool>("ReadPtLUT",false); read_pt_lut = pset.getParameter<bool>("ReadPtLUT"); if(read_pt_lut) { pt_lut_file = pset.getParameter<edm::FileInPath>("PtLUTFile"); //isBinary = pset.getUntrackedParameter<bool>("isBinary", false); isBinary = pset.getParameter<bool>("isBinary"); edm::LogInfo("CSCTFPtLUT::CSCTFPtLUT") << "Reading file: " << pt_lut_file.fullPath().c_str() << " isBinary?(1/0): " << isBinary; } // Determine the pt assignment method to use // 1 - Darin's parameterization method // 2 - Cathy Yeh's chi-square minimization method // 3 - Hybrid // 4 - Anna's parameterization method pt_method = pset.getUntrackedParameter<unsigned>("PtMethod",4); // what does this mean??? lowQualityFlag = pset.getUntrackedParameter<unsigned>("LowQualityFlag",4); if(read_pt_lut && !lut_read_in) { pt_lut = new ptdat[1<<21]; readLUT(); lut_read_in = true; } isBeamStartConf = pset.getUntrackedParameter<bool>("isBeamStartConf", true); }
CSCTFPtLUT::CSCTFPtLUT | ( | const CSCTFPtLUT & | ) |
CSCTFPtLUT::~CSCTFPtLUT | ( | ) | [inline] |
Definition at line 152 of file CSCTFPtLUT.cc.
References DeDxDiscriminatorTools::charge(), gather_cfg::cout, eta(), L1MuScale::getLowEdge(), L1MuScale::getPacked(), L1MuTriggerPtScale::getPtScale(), L1MuTriggerScales::getRegionalEtaScale(), isBeamStartConf, mode, CSCTFPtMethods::Pt2Stn(), CSCTFPtMethods::Pt2Stn2010(), CSCTFPtMethods::Pt2StnChiSq(), CSCTFPtMethods::Pt2StnHybrid(), CSCTFPtMethods::Pt3Stn(), CSCTFPtMethods::Pt3Stn2010(), CSCTFPtMethods::Pt3StnChiSq(), CSCTFPtMethods::Pt3StnHybrid(), pt_method, ptMethods, query::result, CSCTFConstants::SECTOR_RAD, trackQuality(), trigger_ptscale, and trigger_scale.
Referenced by Pt().
{ ptdat result; float etaR = 0, ptR_front = 0, ptR_rear = 0, dphi12R = 0, dphi23R = 0; int charge12, charge23; unsigned type, mode, eta, fr, quality, charge, absPhi12, absPhi23; eta = address.track_eta; mode = address.track_mode; fr = address.track_fr; charge = address.delta_phi_sign; quality = trackQuality(eta, mode); unsigned front_pt, rear_pt; unsigned front_quality, rear_quality; etaR = trigger_scale->getRegionalEtaScale(2)->getLowEdge(2*eta+1); front_quality = rear_quality = quality; // kluge to use 2-stn track in overlap region // see also where this routine is called, and encode LUTaddress, and assignPT if (pt_method != 4 && (mode == 2 || mode == 3 || mode == 4) && (eta<3)) mode = 6; if (pt_method != 4 && (mode == 5) && (eta<3)) mode = 8; switch(mode) { case 2: case 3: case 4: case 5: type = mode - 1; charge12 = 1; absPhi12 = address.delta_phi_12; absPhi23 = address.delta_phi_23; if(charge) charge23 = 1; else charge23 = -1; // now convert to real numbers for input into PT assignment algos. if(pt_method == 4) // param method 2010 { dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; if(charge12 * charge23 < 0) dphi23R = -dphi23R; ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1); ptR_rear = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 0); } else if(pt_method == 1) // param method { dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; if(charge12 * charge23 < 0) dphi23R = -dphi23R; ptR_front = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 1); ptR_rear = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 0); } else if(pt_method == 2) // cathy's method { if(type <= 2) { ptR_front = ptMethods.Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1); ptR_rear = ptMethods.Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0); } else { ptR_front = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 1); ptR_rear = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 0); } } else // hybrid { if(type <= 2) { ptR_front = ptMethods.Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1); ptR_rear = ptMethods.Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0); } else { ptR_front = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 1); ptR_rear = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 0); } } break; case 6: case 7: case 8: case 9: case 10: type = mode - 5; if(charge) absPhi12 = address.delta_phi(); else { int temp_phi = address.delta_phi(); absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff; } if(absPhi12 < (1<<9)) { if(pt_method == 1 || type == 5) { dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1); ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0); } else if(pt_method == 2) { ptR_front = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 1); ptR_rear = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 0); } else { ptR_front = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 1); ptR_rear = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 0); } } else { ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1); ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1); } if(pt_method == 4) // param method 2010 { dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl; ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1); ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0); } break; case 12: // 1-2-b1 calculated only delta_phi12 = 2-b1 case 14: type = 2; if(charge) absPhi12 = address.delta_phi(); else { int temp_phi = address.delta_phi(); absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff; } if(absPhi12 < (1<<9)) { dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1); ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0); } else { ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1); ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1); } if(pt_method == 4) // param method 2010 { dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1); ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0); if(fabs(dphi12R)<0.01 && (ptR_rear < 10 || ptR_front < 10)) std::cout << "dphi12R = " << dphi12R << " ptR_rear = " << ptR_rear << " ptR_front = " << ptR_front << " etaR = " << etaR << " mode = " << mode << std::endl; } break; case 13: type = 4; if(charge) absPhi12 = address.delta_phi(); else { int temp_phi = address.delta_phi(); absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff; } if(absPhi12 < (1<<9)) { dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1); ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0); } else { ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1); ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1); } if(pt_method == 4) // param method 2010 { dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD; ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1); ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0); } break; case 11: // singles trigger ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5); ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5); //ptR_front = trigger_ptscale->getPtScale()->getLowEdge(31); //ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(31); break; case 15: // halo trigger ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5); ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5); break; case 1: // tracks that fail delta phi cuts ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5); ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5); break; default: // Tracks in this category are not considered muons. ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0); }; front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front); rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear); // kluge to set arbitrary Pt for some tracks with lousy resolution (and no param) if(pt_method != 4) { if ((front_pt==0 || front_pt==1) && (eta<3) && quality==1 && pt_method != 2) front_pt = 31; if ((rear_pt==0 || rear_pt==1) && (eta<3) && quality==1 && pt_method != 2) rear_pt = 31; } if(pt_method != 2 && pt_method != 4 && quality == 1) { if (front_pt < 5) front_pt = 5; if (rear_pt < 5) rear_pt = 5; } // in order to match the pt assignement of the previous routine if(isBeamStartConf && pt_method != 2 && pt_method != 4) { if(quality == 3 && mode == 5) { if (front_pt < 5) front_pt = 5; if (rear_pt < 5) rear_pt = 5; } if(quality == 2 && mode > 7 && mode < 11) { if (front_pt < 5) front_pt = 5; if (rear_pt < 5) rear_pt = 5; } } result.front_rank = front_pt | front_quality << 5; result.rear_rank = rear_pt | rear_quality << 5; result.charge_valid_front = 1; //ptMethods.chargeValid(front_pt, quality, eta, pt_method); result.charge_valid_rear = 1; //ptMethods.chargeValid(rear_pt, quality, eta, pt_method); /* if (mode == 1) { std::cout << "F_pt: " << front_pt << std::endl; std::cout << "R_pt: " << rear_pt << std::endl; std::cout << "F_quality: " << front_quality << std::endl; std::cout << "R_quality: " << rear_quality << std::endl; std::cout << "F_rank: " << std::hex << result.front_rank << std::endl; std::cout << "R_rank: " << std::hex << result.rear_rank << std::endl; } */ return result; }
CSCTFPtLUT& CSCTFPtLUT::operator= | ( | const CSCTFPtLUT & | ) |
Definition at line 104 of file CSCTFPtLUT.cc.
References calcPt(), pt_lut, read_pt_lut, and query::result.
Referenced by MuonCandProducerMon::produce(), Pt(), and CSCTFSectorProcessor::run().
ptdat CSCTFPtLUT::Pt | ( | const unsigned & | delta_phi_12, |
const unsigned & | delta_phi23, | ||
const unsigned & | track_eta, | ||
const unsigned & | track_mode, | ||
const unsigned & | track_fr, | ||
const unsigned & | delta_phi_sign | ||
) | const |
Definition at line 121 of file CSCTFPtLUT.cc.
References Pt().
ptdat CSCTFPtLUT::Pt | ( | const unsigned & | delta_phi_12, |
const unsigned & | track_eta, | ||
const unsigned & | track_mode, | ||
const unsigned & | track_fr, | ||
const unsigned & | delta_phi_sign | ||
) | const |
Definition at line 136 of file CSCTFPtLUT.cc.
References Pt().
ptdat CSCTFPtLUT::Pt | ( | const unsigned & | address | ) | const |
void CSCTFPtLUT::readLUT | ( | ) | [private] |
Definition at line 521 of file CSCTFPtLUT.cc.
References end, edm::FileInPath::fullPath(), i, isBinary, CSCBitWidths::kPtAddressWidth, pt_lut, pt_lut_file, and cond::rpcobtemp::temp.
Referenced by CSCTFPtLUT().
{ std::ifstream PtLUT; if(isBinary) { PtLUT.open(pt_lut_file.fullPath().c_str(), std::ios::binary); PtLUT.seekg(0, std::ios::end); int length = PtLUT.tellg();; if( length == (1<<CSCBitWidths::kPtAddressWidth)*sizeof(short) ) { PtLUT.seekg(0, std::ios::beg); PtLUT.read(reinterpret_cast<char*>(pt_lut),length); } else { edm::LogError("CSCPtLUT") << "File " << pt_lut_file.fullPath() << " is incorrect size!\n"; } PtLUT.close(); } else { PtLUT.open(pt_lut_file.fullPath().c_str()); unsigned i = 0; unsigned short temp = 0; while(!PtLUT.eof() && i < 1 << CSCBitWidths::kPtAddressWidth) { PtLUT >> temp; pt_lut[i++] = (*reinterpret_cast<ptdat*>(&temp)); } PtLUT.close(); } }
unsigned CSCTFPtLUT::trackQuality | ( | const unsigned & | eta, |
const unsigned & | mode | ||
) | const [private] |
DEA try increasing quality
Definition at line 429 of file CSCTFPtLUT.cc.
References isBeamStartConf, and lowQualityFlag.
Referenced by calcPt().
{ // eta and mode should be only 4-bits, since that is the input to the large LUT if (eta>15 || mode>15) { //std::cout << "Error: Eta or Mode out of range in AU quality assignment" << std::endl; edm::LogError("CSCTFPtLUT::trackQuality()")<<"Eta or Mode out of range in AU quality assignment"; return 0; } unsigned int quality; switch (mode) { case 2: quality = 3; break; case 3: quality = 3; break; case 4: // quality = 2; quality = 3; break; case 5: quality = 1; if (isBeamStartConf && eta >= 12) // eta > 2.1 quality = 3; break; case 6: if (eta>=3) quality = 2; else quality = 1; break; case 7: quality = 2; break; case 8: quality = 1; if (isBeamStartConf && eta >= 12) // eta > 2.1 quality = 2; break; case 9: quality = 1; if (isBeamStartConf && eta >= 12) // eta > 2.1 quality = 2; break; case 10: quality = 1; if (isBeamStartConf && eta >= 12) // eta > 2.1 quality = 2; break; case 11: // single LCTs quality = 1; break; case 12: quality = 3; break; case 13: quality = 2; break; case 14: quality = 2; break; case 15: // halo triggers quality = 1; break; //DEA: keep muons that fail delta phi cut case 1: quality = 1; break; default: quality = 0; break; } // allow quality = 1 only in overlap region or eta = 1.6 region // if ((quality == 1) && (eta >= 4) && (eta != 6) && (eta != 7)) quality = 0; // if ( (quality == 1) && (eta >= 4) ) quality = 0; if ( (quality == 1) && (eta >= 4) && (eta < 11) && ((lowQualityFlag&4)==0) ) quality = 0; if ( (quality == 1) && (eta < 4) && ((lowQualityFlag&1)==0) && ((lowQualityFlag&4)==0) ) quality = 0; if ( (quality == 1) && (eta >=11) && ((lowQualityFlag&2)==0) && ((lowQualityFlag&4)==0) ) quality = 0; return quality; }
bool CSCTFPtLUT::isBeamStartConf [private] |
Definition at line 49 of file CSCTFPtLUT.h.
Referenced by calcPt(), CSCTFPtLUT(), and trackQuality().
bool CSCTFPtLUT::isBinary [private] |
Definition at line 49 of file CSCTFPtLUT.h.
Referenced by CSCTFPtLUT(), and readLUT().
unsigned CSCTFPtLUT::lowQualityFlag [private] |
Definition at line 51 of file CSCTFPtLUT.h.
Referenced by CSCTFPtLUT(), and trackQuality().
bool CSCTFPtLUT::lut_read_in = false [static, private] |
Definition at line 44 of file CSCTFPtLUT.h.
Referenced by CSCTFPtLUT().
ptdat * CSCTFPtLUT::pt_lut = NULL [static, private] |
Definition at line 43 of file CSCTFPtLUT.h.
Referenced by CSCTFPtLUT(), Pt(), readLUT(), and ~CSCTFPtLUT().
edm::FileInPath CSCTFPtLUT::pt_lut_file [private] |
Definition at line 50 of file CSCTFPtLUT.h.
Referenced by CSCTFPtLUT(), and readLUT().
unsigned CSCTFPtLUT::pt_method [private] |
Definition at line 51 of file CSCTFPtLUT.h.
Referenced by calcPt(), and CSCTFPtLUT().
CSCTFPtMethods CSCTFPtLUT::ptMethods [private] |
Definition at line 47 of file CSCTFPtLUT.h.
Referenced by calcPt(), and CSCTFPtLUT().
bool CSCTFPtLUT::read_pt_lut [private] |
Definition at line 49 of file CSCTFPtLUT.h.
Referenced by CSCTFPtLUT(), and Pt().
const L1MuTriggerPtScale* CSCTFPtLUT::trigger_ptscale [private] |
Definition at line 46 of file CSCTFPtLUT.h.
Referenced by calcPt(), and CSCTFPtLUT().
const L1MuTriggerScales* CSCTFPtLUT::trigger_scale [private] |
Definition at line 45 of file CSCTFPtLUT.h.
Referenced by calcPt(), and CSCTFPtLUT().