#include <CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h>
Public Member Functions | |
EcalLaserDbService (const edm::ParameterSet &) | |
EcalLaserDbService () | |
const EcalLaserAlphas * | getAlphas () const |
const EcalLaserAPDPNRatios * | getAPDPNRatios () const |
const EcalLaserAPDPNRatiosRef * | getAPDPNRatiosRef () const |
float | getLaserCorrection (DetId const &xid, edm::Timestamp const &iTime) const |
void | setAlphaData (const EcalLaserAlphas *fItem) |
void | setAPDPNData (const EcalLaserAPDPNRatios *fItem) |
void | setAPDPNRefData (const EcalLaserAPDPNRatiosRef *fItem) |
Private Member Functions | |
int | getLMNumber (DetId const &xid) const |
Private Attributes | |
const EcalLaserAlphas * | mAlphas_ |
const EcalLaserAPDPNRatios * | mAPDPNRatios_ |
const EcalLaserAPDPNRatiosRef * | mAPDPNRatiosRef_ |
Definition at line 24 of file EcalLaserDbService.h.
EcalLaserDbService::EcalLaserDbService | ( | ) |
Definition at line 19 of file EcalLaserDbService.cc.
00020 : 00021 mAlphas_ (0), 00022 mAPDPNRatiosRef_ (0), 00023 mAPDPNRatios_ (0) 00024 {}
EcalLaserDbService::EcalLaserDbService | ( | const edm::ParameterSet & | ) |
const EcalLaserAlphas * EcalLaserDbService::getAlphas | ( | ) | const |
Definition at line 28 of file EcalLaserDbService.cc.
References mAlphas_.
00028 { 00029 return mAlphas_; 00030 }
const EcalLaserAPDPNRatios * EcalLaserDbService::getAPDPNRatios | ( | ) | const |
Definition at line 36 of file EcalLaserDbService.cc.
References mAPDPNRatios_.
00036 { 00037 return mAPDPNRatios_; 00038 }
const EcalLaserAPDPNRatiosRef * EcalLaserDbService::getAPDPNRatiosRef | ( | ) | const |
Definition at line 32 of file EcalLaserDbService.cc.
References mAPDPNRatiosRef_.
00032 { 00033 return mAPDPNRatiosRef_; 00034 }
float EcalLaserDbService::getLaserCorrection | ( | DetId const & | xid, | |
edm::Timestamp const & | iTime | |||
) | const |
Definition at line 41 of file EcalLaserDbService.cc.
References DetId::det(), DetId::Ecal, EcalCondObjectContainer< T >::end(), lat::endl(), EcalCondObjectContainer< T >::find(), EcalLaserAPDPNRatios::getLaserMap(), getLMNumber(), EcalCondObjectContainer< T >::getMap(), EcalLaserAPDPNRatios::getTimeMap(), mAlphas_, mAPDPNRatios_, mAPDPNRatiosRef_, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2, funct::pow(), EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2, cond::timestamp, and edm::Timestamp::value().
00041 { 00042 00043 float correctionFactor = 1.0; 00044 00045 const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = mAPDPNRatios_->getLaserMap(); 00046 const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = mAPDPNRatios_->getTimeMap(); 00047 const EcalLaserAPDPNRatiosRefMap& laserRefMap = mAPDPNRatiosRef_->getMap(); 00048 const EcalLaserAlphaMap& laserAlphaMap = mAlphas_->getMap(); 00049 00050 EcalLaserAPDPNRatios::EcalLaserAPDPNpair apdpnpair; 00051 EcalLaserAPDPNRatios::EcalLaserTimeStamp timestamp; 00052 EcalLaserAPDPNref apdpnref; 00053 EcalLaserAlpha alpha; 00054 00055 if (xid.det()==DetId::Ecal) { 00056 // std::cout << " XID is in Ecal : "; 00057 } else { 00058 // std::cout << " XID is NOT in Ecal : "; 00059 edm::LogError("EcalLaserDbService") << " DetId is NOT in ECAL" << endl; 00060 return correctionFactor; 00061 } 00062 00063 // int hi = -1; 00064 // if (xid.subdetId()==EcalBarrel) { 00065 // // std::cout << "EcalBarrel" << std::endl; 00066 // // std::cout << "--> rawId() = " << xid.rawId() << " id() = " << EBDetId( xid ).hashedIndex() << std::endl; 00067 // hi = EBDetId( xid ).hashedIndex(); 00068 // } else if (xid.subdetId()==EcalEndcap) { 00069 // // std::cout << "EcalEndcap" << std::endl; 00070 // hi = EEDetId( xid ).hashedIndex() + EBDetId::MAX_HASH + 1; 00071 // 00072 // } else { 00073 // // std::cout << "NOT EcalBarrel or EcalEndCap" << std::endl; 00074 // edm::LogError("EcalLaserDbService") << " DetId is NOT in ECAL Barrel or Endcap" << endl; 00075 // return correctionFactor; 00076 // } 00077 00078 int iLM = getLMNumber(xid); 00079 // std::cout << " LM num ====> " << iLM << endl; 00080 00081 // get alpha, apd/pn ref, apd/pn pairs and timestamps for interpolation 00082 00083 EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap::const_iterator itratio = laserRatiosMap.find(xid); 00084 if (itratio != laserRatiosMap.end()) { 00085 apdpnpair = (*itratio); 00086 } else { 00087 edm::LogError("EcalLaserDbService") << "error with laserRatiosMap!" << endl; 00088 return correctionFactor; 00089 } 00090 00091 if (iLM-1< (int)laserTimeMap.size()) { 00092 timestamp = laserTimeMap[iLM-1]; 00093 } else { 00094 edm::LogError("EcalLaserDbService") << "error with laserTimeMap!" << endl; 00095 return correctionFactor; 00096 } 00097 00098 EcalLaserAPDPNRatiosRefMap::const_iterator itref = laserRefMap.find(xid); 00099 if ( itref != laserRefMap.end() ) { 00100 apdpnref = (*itref); 00101 } else { 00102 edm::LogError("EcalLaserDbService") << "error with laserRefMap!" << endl; 00103 return correctionFactor; 00104 } 00105 00106 EcalLaserAlphaMap::const_iterator italpha = laserAlphaMap.find(xid); 00107 if ( italpha != laserAlphaMap.end() ) { 00108 alpha = (*italpha); 00109 } else { 00110 edm::LogError("EcalLaserDbService") << "error with laserAlphaMap!" << endl; 00111 return correctionFactor; 00112 } 00113 00114 // std::cout << " APDPN pair " << apdpnpair.p1 << " , " << apdpnpair.p2 << std::endl; 00115 // std::cout << " TIME pair " << timestamp.t1.value() << " , " << timestamp.t2.value() << " iLM " << iLM << std::endl; 00116 // std::cout << " LM module " << iLM << std::endl; 00117 // std::cout << " APDPN ref " << apdpnref << std::endl; 00118 // std::cout << " ALPHA " << alpha << std::endl; 00119 00120 // should implement some default in case of error... 00121 00122 // should do some quality checks first 00123 // ... 00124 00125 // we will need to treat time differently... 00126 // is time in DB same format as in MC? probably not... 00127 00128 // interpolation 00129 00130 if (apdpnref!=0&&(timestamp.t2.value()-timestamp.t1.value())!=0) { 00131 float interpolatedLaserResponse = apdpnpair.p1/apdpnref + (iTime.value()-timestamp.t1.value())*(apdpnpair.p2-apdpnpair.p1)/apdpnref/(timestamp.t2.value()-timestamp.t1.value()); 00132 // std::cout << " interpolatedLaserResponse = " << interpolatedLaserResponse << std::endl; 00133 00134 if (interpolatedLaserResponse<=0) { 00135 edm::LogError("EcalLaserDbService") << "interpolatedLaserResponse is <= zero!" << endl; 00136 return correctionFactor; 00137 } else { 00138 correctionFactor = 1/pow(interpolatedLaserResponse,alpha); 00139 } 00140 00141 } else { 00142 edm::LogError("EcalLaserDbService") << "apdpnref or timestamp.t2-timestamp.t1 is zero!" << endl; 00143 return correctionFactor; 00144 } 00145 00146 // std::cout << " correctionFactor = " << correctionFactor << std::endl; 00147 00148 return correctionFactor; 00149 00150 }
Definition at line 156 of file EcalLaserDbService.cc.
References EcalBarrel, EcalEndcap, lat::endl(), i, j, DetId::rawId(), and DetId::subdetId().
Referenced by getLaserCorrection().
00156 { 00157 00158 int iLM = 0; 00159 00160 if (xid.subdetId()==EcalBarrel) { 00161 00162 EBDetId tempid(xid.rawId()); 00163 00164 int iSM = tempid.ism(); 00165 int iETA = tempid.ietaSM(); 00166 int iPHI = tempid.iphiSM(); 00167 00168 const int nSM = 36; 00169 int numLM[nSM] = {37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35}; 00170 00171 if (iSM<=nSM) { 00172 iLM = numLM[iSM-1]; 00173 } 00174 // now assign light module within SM 00175 if (iPHI>10&&iETA>5) { iLM++; } 00176 00177 // std::cout << " SM , LM ---> " << iSM << " " << iLM << std::endl; 00178 00179 } else if (xid.subdetId()==EcalEndcap) { 00180 00181 EEDetId tempid(xid.rawId()); 00182 00183 int iSC = tempid.isc(); 00184 int iX = tempid.ix(); 00185 // int iY = tempid.iy(); 00186 int iZ = tempid.zside(); 00187 00188 const int nSC = 312; 00189 const int nEELM = 18; 00190 00191 // Z+ side 00192 00193 int indexSCpos[nSC] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 308, 309, 310, 311, 312, 313, 314, 315, 316 }; 00194 00195 int indexDCCpos[nSC] = { 48, 48, 48, 48, 48, 48, 48, 48, 47, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 46, 47, 47, 47, 48, 48, 48, 48,48, 46, 47, 47, 47, 47, 48, 48, 48, 48, 46, 47, 47, 47, 47, 47, 47, 48, 48, 46, 47, 47, 47, 47, 47, 47, 47, 46, 47, 47, 47, 47, 47, 47, 46, 46, 47, 47, 47, 47, 46, 46, 47, 49, 49, 49, 49, 49, 49, 49, 49, 50, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 51, 50, 50, 50, 49, 49, 49, 49, 49, 51, 50, 50, 50, 50, 49, 49, 49, 49, 51, 50, 50, 50, 50, 50, 50, 49, 49, 51, 50, 50, 50, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 51, 51, 50, 50, 50, 50, 51, 51, 50, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 53, 53, 53, 53, 53, 53, 51, 52, 52, 52, 52, 52, 52, 53, 53, 53, 51, 51, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 52, 52, 52, 52, 52, 52, 51, 51, 51, 52, 52, 52, 52, 52, 52,51, 51, 51, 51, 52, 52, 52, 52, 51, 51, 51, 51, 52, 52, 52, 51, 51, 51, 51, 51, 52, 51, 51, 51, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54,53, 53, 53, 53, 53, 53, 46, 54, 54, 54, 54, 54, 54, 53, 53, 53, 46, 46, 54, 54, 54, 54, 54, 54, 54, 46, 46, 46, 54, 54, 54, 54, 54, 54, 46, 46, 46, 54, 54, 54, 54, 54, 54, 46, 46, 46, 46, 54, 54, 54, 54, 46, 46, 46, 46, 54, 54, 54, 46, 46, 46, 46, 46, 54, 46, 46, 46 }; 00196 00197 // Z- side 00198 00199 int indexSCneg[nSC] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73,74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 308, 309, 310, 311, 312, 313, 314, 315, 316 }; 00200 00201 int indexDCCneg[nSC] = { 3, 3, 3, 3, 3, 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, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92 }; 00205 00206 int tempdcc = 0; 00207 00208 // assign SC to DCC 00209 if (iZ>0) { 00210 for (int i=0; i<nSC; i++) { 00211 if (indexSCpos[i]==iSC) { 00212 tempdcc = indexDCCpos[i]; 00213 break; 00214 } 00215 } 00216 } else { 00217 for (int i=0; i<nSC; i++) { 00218 if (indexSCneg[i]==iSC) { 00219 tempdcc = indexDCCneg[i]; 00220 break; 00221 } 00222 } 00223 } 00224 00225 // now assign LM number based on DCC 00226 for (int j=0; j<nEELM; j++) { 00227 if (tempdcc==numDCC[j]) { 00228 iLM = numLM[j]; 00229 break; 00230 } 00231 } 00232 00233 // now assign LM readout number for two exceptional cases: 00234 if (tempdcc==53&&iX>50) { 00235 iLM++; 00236 } else if (tempdcc==8&&iX>50) { 00237 iLM++; 00238 } 00239 00240 // std::cout << "DCC , LM ---> " << tempdcc << " " << iLM << std::endl; 00241 // std::cout << "SC DCC : LM : XYZ ---> " << iSC << " \t" << tempdcc << ": \t" << iLM << ": \t" << iX << " \t" << iY << " \t" << iZ << std::endl; 00242 00243 // iLM = tempid.isc(); 00244 } else { 00245 edm::LogError("EcalLaserDbService") << " getLMNumber: DetId is not in ECAL." << endl; 00246 00247 } 00248 00249 return iLM; 00250 00251 }
void EcalLaserDbService::setAlphaData | ( | const EcalLaserAlphas * | fItem | ) | [inline] |
void EcalLaserDbService::setAPDPNData | ( | const EcalLaserAPDPNRatios * | fItem | ) | [inline] |
Definition at line 36 of file EcalLaserDbService.h.
References mAPDPNRatios_.
00036 {mAPDPNRatios_ = fItem;}
void EcalLaserDbService::setAPDPNRefData | ( | const EcalLaserAPDPNRatiosRef * | fItem | ) | [inline] |
Definition at line 35 of file EcalLaserDbService.h.
References mAPDPNRatiosRef_.
00035 {mAPDPNRatiosRef_ = fItem;}
const EcalLaserAlphas* EcalLaserDbService::mAlphas_ [private] |
Definition at line 42 of file EcalLaserDbService.h.
Referenced by getAlphas(), getLaserCorrection(), and setAlphaData().
const EcalLaserAPDPNRatios* EcalLaserDbService::mAPDPNRatios_ [private] |
Definition at line 44 of file EcalLaserDbService.h.
Referenced by getAPDPNRatios(), getLaserCorrection(), and setAPDPNData().
const EcalLaserAPDPNRatiosRef* EcalLaserDbService::mAPDPNRatiosRef_ [private] |
Definition at line 43 of file EcalLaserDbService.h.
Referenced by getAPDPNRatiosRef(), getLaserCorrection(), and setAPDPNRefData().