#include <EmcRecDigit2Hit.h>
Public Member Functions | |
EmcRecDigit2Hit () | |
~EmcRecDigit2Hit () | |
void | Convert (const RecEmcDigitMap &aDigitMap, RecEmcHitMap &aHitMap) |
void | Output (const RecEmcHitMap &aHitMap) const |
void | OutputEndcap (const RecEmcHitMap &aHitMap, const unsigned int module_ew) const |
void | SetAlgName (const string &name) |
Private Attributes | |
std::string | m_algName |
Definition at line 12 of file EmcRecDigit2Hit.h.
EmcRecDigit2Hit::EmcRecDigit2Hit | ( | ) |
EmcRecDigit2Hit::~EmcRecDigit2Hit | ( | ) |
void EmcRecDigit2Hit::Convert | ( | const RecEmcDigitMap & | aDigitMap, | |
RecEmcHitMap & | aHitMap | |||
) |
Definition at line 28 of file EmcRecDigit2Hit.cxx.
References EmcID::barrel_ec(), RecEmcHit::CellId(), EmcRecParameter::DataMode(), EmcRecParameter::DigiCalib(), EmcRecParameter::ElecBias(), EmcRecParameter::ElecSaturation(), EmcRecParameter::ElectronicsNoiseLevel(), RecEmcHit::Energy(), RecEmcHit::getCellId(), IEmcCalibConstSvc::getCrystalEmaxData(), IEmcCalibConstSvc::getDigiCalibConst(), RecEmcHit::getEnergy(), IEmcCalibConstSvc::getIndex(), EmcRecParameter::GetInstance(), IRawDataProviderSvc::isOnlineMode(), m_algName, EmcID::phi_module(), deljobs::string, EmcID::theta_module(), and RecEmcHit::Time().
Referenced by EmcRec::execute().
00030 { 00031 RecEmcDigitMap::const_iterator ciDigitMap; 00032 RecEmcHit aHit; 00033 00034 EmcRecParameter& Para=EmcRecParameter::GetInstance(); 00035 00036 StatusCode sc; 00037 // Get EmcCalibConstSvc. 00038 IEmcCalibConstSvc *emcCalibConstSvc; 00039 sc= Gaudi::svcLocator()->service("EmcCalibConstSvc", emcCalibConstSvc); 00040 if(sc != StatusCode::SUCCESS) { 00041 //cout << "EmcRecDigit2Hit Error: Can't get EmcCalibConstSvc." << endl; 00042 } 00043 00044 // Get RawDataProviderSvc 00045 IRawDataProviderSvc *rawDataProviderSvc; 00046 // tianhl for mt 00047 std::string rawDataProviderSvc_name("RawDataProviderSvc"); 00048 if(isGaudiThreaded(m_algName)) { 00049 rawDataProviderSvc_name += getGaudiThreadIDfromName(m_algName); 00050 } 00051 // tianhl for mt 00052 sc = Gaudi::svcLocator()->service(rawDataProviderSvc_name.c_str(), rawDataProviderSvc); 00053 if(sc != StatusCode::SUCCESS) { 00054 //cout << "EmcRecDigit2Hit Error: Can't get RawDataProviderSvc." << endl; 00055 } 00056 00057 for(ciDigitMap=aDigitMap.begin(); 00058 ciDigitMap!=aDigitMap.end(); 00059 ++ciDigitMap) { 00060 00061 const RecEmcDigit &aDigit=ciDigitMap->second; 00062 00063 aHit.CellId(aDigit.CellId()); 00064 00065 double ein,ecorr,eout; 00066 ein=aDigit.ADC(); 00067 00068 //Times the calibration constant in offline mode 00069 if(!(rawDataProviderSvc->isOnlineMode()) && Para.DigiCalib()) { 00070 00071 unsigned int partId = EmcID::barrel_ec(aDigit.CellId()); 00072 unsigned int theta = EmcID::theta_module(aDigit.CellId()); 00073 unsigned int phi = EmcID::phi_module(aDigit.CellId()); 00074 00075 int index = emcCalibConstSvc->getIndex(partId,theta,phi); 00076 00077 //liucx 00078 00079 double adc2e = emcCalibConstSvc->getDigiCalibConst(index); 00080 00081 if(Para.DataMode()==0) { 00082 if(Para.ElecSaturation()==1){ 00083 double emaxData = emcCalibConstSvc->getCrystalEmaxData(index); 00084 if (emaxData>0) { 00085 // cout<<adc2e<<"\t"<<emaxData/2.5<<endl; 00086 adc2e=emaxData/2.5; 00087 } 00088 } 00089 } 00090 00091 ein *= adc2e ; 00092 //liucx 00093 00094 //liucx ein *= emcCalibConstSvc->getDigiCalibConst(index); 00095 00096 } 00097 00098 // Correct electronic noise bias. Not used now. 00099 if(ein<Para.ElecBias(4)) { 00100 ecorr=Para.ElecBias(0)*log(ein/Para.ElecBias(1)); //noise=0.5 00101 } else { 00102 ecorr=Para.ElecBias(2)+Para.ElecBias(3)*ein; 00103 } 00104 eout=ein; 00105 aHit.Energy(eout/GeV); 00106 00107 aHit.Time(aDigit.TDC()); 00108 // For some reason, there are 0 energy hit. 00109 // Avoid this to happen, dangerous! 00110 if(aHit.getEnergy()>=Para.ElectronicsNoiseLevel()){// && 00111 //(aHit.time()>=Para.TimeMin()) && 00112 //(aHit.time()<=Para.TimeMax())) 00113 aHitMap[aHit.getCellId()]=aHit; 00114 } 00115 } 00116 00117 }
void EmcRecDigit2Hit::Output | ( | const RecEmcHitMap & | aHitMap | ) | const |
Definition at line 119 of file EmcRecDigit2Hit.cxx.
References EmcID::crystal_id(), EmcID::getBARREL(), EmcID::getENDCAP_EAST(), EmcID::getENDCAP_WEST(), EmcID::getPHI_BARREL_MAX(), EmcID::getPHI_BARREL_MIN(), EmcID::getTHETA_BARREL_MAX(), EmcID::getTHETA_BARREL_MIN(), and OutputEndcap().
Referenced by EmcRec::execute().
00120 { 00121 unsigned int module,theta,phi; 00122 RecEmcID id; 00123 RecEmcHitMap::const_iterator ci_HitMap; 00124 RecEmcEnergy e; 00125 int ie; 00126 00127 //cout<<"Output a hitmap:"<<endl; 00128 00129 module=EmcID::EmcID::getBARREL(); 00130 00131 //cout<<"Barrel:"<<endl; 00132 //cout<<"+--------------------------------------------+"<<endl; 00133 for(phi=EmcID::getPHI_BARREL_MAX(); 00134 phi!=EmcID::getPHI_BARREL_MIN()-1; 00135 --phi) { 00136 //cout<<"|"; 00137 for(theta=EmcID::getTHETA_BARREL_MIN(); 00138 theta<=EmcID::getTHETA_BARREL_MAX(); 00139 ++theta) { 00140 id=EmcID::crystal_id(module,theta,phi); 00141 ci_HitMap=aHitMap.find(id); 00142 if(ci_HitMap!=aHitMap.end()) { 00143 e=ci_HitMap->second.getEnergy(); 00144 ie=(int)(e*10); 00145 if(ie>9) { 00146 ie=9; 00147 } 00148 //cout<<ie; 00149 } else { 00150 //cout<<" "; 00151 } 00152 } 00153 //cout<<"|"<<endl; 00154 } 00155 //cout<<"+--------------------------------------------+"<<endl; 00156 00157 module=EmcID::EmcID::getENDCAP_EAST(); 00158 OutputEndcap(aHitMap,module); 00159 module=EmcID::EmcID::getENDCAP_WEST(); 00160 OutputEndcap(aHitMap,module); 00161 }
void EmcRecDigit2Hit::OutputEndcap | ( | const RecEmcHitMap & | aHitMap, | |
const unsigned int | module_ew | |||
) | const |
Definition at line 163 of file EmcRecDigit2Hit.cxx.
References EmcID::crystal_id(), EmcID::getPHI_ENDCAP_MAX(), EmcID::getPHI_ENDCAP_MIN(), EmcID::getTHETA_ENDCAP_MAX(), and EmcID::getTHETA_ENDCAP_MIN().
Referenced by Output().
00164 { 00165 unsigned int module,theta,phi; 00166 RecEmcID id; 00167 RecEmcHitMap::const_iterator ci_HitMap; 00168 RecEmcEnergy e; 00169 int ie; 00170 00171 module=module_ew; 00172 if(module==EmcID::EmcID::getENDCAP_EAST()){ 00173 //cout<<"East endcap:"<<endl; 00174 } 00175 else if(module==EmcID::EmcID::getENDCAP_WEST()){ 00176 //cout<<"West endcap:"<<endl; 00177 } 00178 00179 //cout<<"+--------------------------------------------------------+"<<endl; 00180 for(theta=EmcID::getTHETA_ENDCAP_MAX(); 00181 theta!=EmcID::getTHETA_ENDCAP_MIN()-1; 00182 theta--){ 00183 //cout<<"|"; 00184 for(phi=(EmcID::getPHI_ENDCAP_MAX(theta)-1)/2; 00185 phi!=EmcID::getPHI_ENDCAP_MIN()-1; 00186 phi--) { 00187 id=EmcID::crystal_id(module,theta,phi); 00188 ci_HitMap=aHitMap.find(id); 00189 if(ci_HitMap!=aHitMap.end()) { 00190 e=ci_HitMap->second.getEnergy(); 00191 ie=(int)(e*10); 00192 if(ie>9) { 00193 ie=9; 00194 } 00195 if((theta<4) && 00196 (phi%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==(EmcID::getPHI_ENDCAP_MAX(theta)+1)/16-1)){ 00197 //cout<<"*"; 00198 } 00199 //cout<<ie; 00200 if((theta==0||theta==1)&&(phi%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0)){ 00201 //cout<<"*"; 00202 } 00203 } 00204 else{ 00205 if((theta<4) && 00206 (phi%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==(EmcID::getPHI_ENDCAP_MAX(theta)+1)/16-1)){ 00207 //cout<<" "; 00208 } 00209 //cout<<" "; 00210 if((theta==0||theta==1)&&(phi%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0)){ 00211 //cout<<" "; 00212 } 00213 } 00214 if(phi%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0){ 00215 //cout<<"|"; 00216 } 00217 if(phi==(EmcID::getPHI_ENDCAP_MAX(theta)+1)/4){ 00218 //cout<<"|"; 00219 } 00220 } 00221 //cout<<endl; 00222 } 00223 //cout<<"+--------------------------------------------------------+"<<endl; 00224 00225 for(theta=EmcID::getTHETA_ENDCAP_MIN(); 00226 theta!=EmcID::getTHETA_ENDCAP_MAX()+1; 00227 theta++){ 00228 //cout<<"|"; 00229 for(phi=(EmcID::getPHI_ENDCAP_MAX(theta)+1)/2; 00230 phi!=EmcID::getPHI_ENDCAP_MAX(theta)+1; 00231 phi++) { 00232 id=EmcID::crystal_id(module,theta,phi); 00233 ci_HitMap=aHitMap.find(id); 00234 if(ci_HitMap!=aHitMap.end()) { 00235 e=ci_HitMap->second.getEnergy(); 00236 ie=(int)(e*10); 00237 if(ie>9) { 00238 ie=9; 00239 } 00240 if((theta<4) && 00241 (phi%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0)){ 00242 //cout<<"*"; 00243 } 00244 //cout<<ie; 00245 if((theta==0||theta==1)&&((phi+1)%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0)){ 00246 //cout<<"*"; 00247 } 00248 } 00249 else{ 00250 if((theta<4) && 00251 (phi%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0)){ 00252 //cout<<" "; 00253 } 00254 //cout<<" "; 00255 if((theta==0||theta==1)&&((phi+1)%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0)){ 00256 //cout<<" "; 00257 } 00258 } 00259 if((phi+1)%((EmcID::getPHI_ENDCAP_MAX(theta)+1)/16)==0){ 00260 //cout<<"|"; 00261 } 00262 if(phi==3*(EmcID::getPHI_ENDCAP_MAX(theta)+1)/4-1){ 00263 //cout<<"|"; 00264 } 00265 } 00266 //cout<<endl; 00267 } 00268 //cout<<"+--------------------------------------------------------+"<<endl; 00269 00270 }
void EmcRecDigit2Hit::SetAlgName | ( | const string & | name | ) | [inline] |
Definition at line 24 of file EmcRecDigit2Hit.h.
References m_algName.
Referenced by EmcRec::initialize().
00024 { m_algName=name; }
std::string EmcRecDigit2Hit::m_algName [private] |