#include <Validation/EcalHits/interface/EcalSimHitsValidProducer.h>
Definition at line 21 of file EcalSimHitsValidProducer.h.
typedef std::vector<float> EcalSimHitsValidProducer::FloatVector [private] |
Definition at line 26 of file EcalSimHitsValidProducer.h.
typedef std::map<uint32_t,float,std::less<uint32_t> > EcalSimHitsValidProducer::MapType [private] |
Definition at line 27 of file EcalSimHitsValidProducer.h.
EcalSimHitsValidProducer::EcalSimHitsValidProducer | ( | const edm::ParameterSet & | iPSet | ) |
Definition at line 20 of file EcalSimHitsValidProducer.cc.
References eBX0, eEX0, i, and label.
00020 : 00021 ee1(0.0),ee4(0.0),ee9(0.0),ee16(0.0),ee25(0.0), 00022 eb1(0.0),eb4(0.0),eb9(0.0),eb16(0.0),eb25(0.0), 00023 totalEInEE(0.0),totalEInEB(0),totalEInES(0.0),totalEInEEzp(0.0),totalEInEEzm(0.0), 00024 totalEInESzp(0.0),totalEInESzm(0.0), 00025 totalHits(0),nHitsInEE(0),nHitsInEB(0),nHitsInES(0),nHitsIn1ES(0),nHitsIn2ES(0), 00026 nCrystalInEB(0),nCrystalInEEzp(0),nCrystalInEEzm(0), 00027 nHitsIn1ESzp(0),nHitsIn1ESzm(0),nHitsIn2ESzp(0),nHitsIn2ESzm(0), 00028 thePID(0), 00029 label(iPSet.getUntrackedParameter<std::string>("instanceLabel","EcalValidInfo") ) 00030 { 00031 produces<PEcalValidInfo>(label); 00032 00033 for ( int i = 0; i<26; i++ ) { 00034 eBX0[i] = 0.0; 00035 eEX0[i] = 0.0; 00036 } 00037 00038 }
EcalSimHitsValidProducer::~EcalSimHitsValidProducer | ( | ) | [virtual] |
EcalSimHitsValidProducer::EcalSimHitsValidProducer | ( | const EcalSimHitsValidProducer & | ) | [private] |
float EcalSimHitsValidProducer::eCluster2x2 | ( | MapType & | themap | ) | [private] |
Definition at line 512 of file EcalSimHitsValidProducer.cc.
Referenced by update().
00512 { 00513 float E22=0.; 00514 float e012 = themap[0]+themap[1]+themap[2]; 00515 float e036 = themap[0]+themap[3]+themap[6]; 00516 float e678 = themap[6]+themap[7]+themap[8]; 00517 float e258 = themap[2]+themap[5]+themap[8]; 00518 00519 if ( (e012>e678 || e012==e678) && (e036>e258 || e036==e258)) 00520 return E22=themap[0]+themap[1]+themap[3]+themap[4]; 00521 else if ( (e012>e678 || e012==e678) && (e036<e258 || e036==e258) ) 00522 return E22=themap[1]+themap[2]+themap[4]+themap[5]; 00523 else if ( (e012<e678 || e012==e678) && (e036>e258 || e036==e258)) 00524 return E22=themap[3]+themap[4]+themap[6]+themap[7]; 00525 else if ( (e012<e678|| e012==e678) && (e036<e258|| e036==e258) ) 00526 return E22=themap[4]+themap[5]+themap[7]+themap[8]; 00527 else { 00528 return E22; 00529 } 00530 }
float EcalSimHitsValidProducer::eCluster4x4 | ( | float | e33, | |
MapType & | themap | |||
) | [private] |
Definition at line 532 of file EcalSimHitsValidProducer.cc.
Referenced by update().
00532 { 00533 float E44=0.; 00534 float e0_4 = themap[0]+themap[1]+themap[2]+themap[3]+themap[4]; 00535 float e0_20 = themap[0]+themap[5]+themap[10]+themap[15]+themap[20]; 00536 float e4_24 = themap[4]+themap[9]+themap[14]+themap[19]+themap[24]; 00537 float e0_24 = themap[20]+themap[21]+themap[22]+themap[23]+themap[24]; 00538 00539 if ((e0_4>e0_24 || e0_4==e0_24) && (e0_20>e4_24|| e0_20==e4_24)) 00540 return E44=e33+themap[0]+themap[1]+themap[2]+themap[3]+themap[5]+themap[10]+themap[15]; 00541 else if ((e0_4>e0_24 || e0_4==e0_24) && (e0_20<e4_24 || e0_20==e4_24)) 00542 return E44=e33+themap[1]+themap[2]+themap[3]+themap[4]+themap[9]+themap[14]+themap[19]; 00543 else if ((e0_4<e0_24|| e0_4==e0_24) && (e0_20>e4_24 || e0_20==e4_24)) 00544 return E44=e33+themap[5]+themap[10]+themap[15]+themap[20]+themap[21]+themap[22]+themap[23]; 00545 else if ((e0_4<e0_24|| e0_4==e0_24) && (e0_20<e4_24 || e0_20==e4_24)) 00546 return E44=e33+themap[21]+themap[22]+themap[23]+themap[24]+themap[9]+themap[14]+themap[19]; 00547 else{ 00548 return E44; 00549 } 00550 }
float EcalSimHitsValidProducer::energyInEBMatrix | ( | int | nCellInX, | |
int | nCellInY, | |||
int | centralX, | |||
int | centralY, | |||
int | centralZ, | |||
MapType & | themap | |||
) | [private] |
Definition at line 592 of file EcalSimHitsValidProducer.cc.
References funct::abs(), index, and LogDebug.
Referenced by update().
00594 { 00595 00596 int ncristals = 0; 00597 float totalEnergy = 0.; 00598 00599 int goBackInEta = nCellInEta/2; 00600 int goBackInPhi = nCellInPhi/2; 00601 int startEta = centralZ*centralEta-goBackInEta; 00602 int startPhi = centralPhi-goBackInPhi; 00603 00604 for (int ieta=startEta; ieta<startEta+nCellInEta; ieta++) { 00605 for (int iphi=startPhi; iphi<startPhi+nCellInPhi; iphi++) { 00606 00607 uint32_t index ; 00608 if (abs(ieta) > 85 || abs(ieta)<1 ) { continue; } 00609 if (iphi< 1) { index = EBDetId(ieta,iphi+360).rawId(); } 00610 else if(iphi>360) { index = EBDetId(ieta,iphi-360).rawId(); } 00611 else { index = EBDetId(ieta,iphi).rawId(); } 00612 00613 totalEnergy += themap[index]; 00614 ncristals += 1; 00615 00616 LogDebug("EcalSimHitsValidProducer") 00617 << " EnergyInEBMatrix: ieta - iphi - E = " << ieta 00618 << " " << iphi << " " << themap[index]; 00619 00620 } 00621 } 00622 00623 LogDebug("EcalSimHitsValidProducer") 00624 << " EnergyInEBMatrix: energy in " << nCellInEta 00625 << " cells in eta times " << nCellInPhi 00626 << " cells in phi matrix = " << totalEnergy 00627 << " for " << ncristals << " crystals"; 00628 00629 return totalEnergy; 00630 00631 }
float EcalSimHitsValidProducer::energyInEEMatrix | ( | int | nCellInX, | |
int | nCellInY, | |||
int | centralX, | |||
int | centralY, | |||
int | centralZ, | |||
MapType & | themap | |||
) | [private] |
Definition at line 552 of file EcalSimHitsValidProducer.cc.
References index, LogDebug, and EEDetId::validDetId().
Referenced by update().
00554 { 00555 00556 int ncristals = 0; 00557 float totalEnergy = 0.; 00558 00559 int goBackInX = nCellInX/2; 00560 int goBackInY = nCellInY/2; 00561 int startX = centralX-goBackInX; 00562 int startY = centralY-goBackInY; 00563 00564 for (int ix=startX; ix<startX+nCellInX; ix++) { 00565 for (int iy=startY; iy<startY+nCellInY; iy++) { 00566 00567 uint32_t index ; 00568 if (EEDetId::validDetId(ix, iy,centralZ)) { 00569 index = EEDetId(ix,iy,centralZ).rawId(); 00570 } else { continue; } 00571 00572 totalEnergy += themap[index]; 00573 ncristals += 1; 00574 00575 LogDebug("EcalSimHitsValidProducer") 00576 << " EnergyInEEMatrix: ix - iy - E = " << ix 00577 << " " << iy << " " << themap[index] ; 00578 00579 } 00580 } 00581 00582 LogDebug("EcalSimHitsValidProducer") 00583 << " EnergyInEEMatrix: energy in " << nCellInX 00584 << " cells in x times " << nCellInY 00585 << " cells in y matrix = " << totalEnergy 00586 << " for " << ncristals << " crystals"; 00587 00588 return totalEnergy; 00589 00590 }
bool EcalSimHitsValidProducer::fillEBMatrix | ( | int | nCellInEta, | |
int | nCellInPhi, | |||
int | CentralEta, | |||
int | CentralPhi, | |||
int | CentralZ, | |||
MapType & | fillmap, | |||
MapType & | themap | |||
) | [private] |
Definition at line 481 of file EcalSimHitsValidProducer.cc.
References funct::abs(), getUnitWithMaxEnergy(), i, and index.
Referenced by update().
00484 { 00485 int goBackInEta = nCellInEta/2; 00486 int goBackInPhi = nCellInPhi/2; 00487 00488 int startEta = CentralZ*CentralEta - goBackInEta; 00489 int startPhi = CentralPhi - goBackInPhi; 00490 00491 int i = 0 ; 00492 for ( int ieta = startEta; ieta < startEta+nCellInEta; ieta ++ ) { 00493 for( int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++ ) { 00494 uint32_t index; 00495 if (abs(ieta) > 85 || abs(ieta)<1 ) { continue; } 00496 if (iphi< 1) { index = EBDetId(ieta,iphi+360).rawId(); } 00497 else if(iphi>360) { index = EBDetId(ieta,iphi-360).rawId(); } 00498 else { index = EBDetId(ieta,iphi).rawId(); } 00499 fillmap[i++] = themap[index]; 00500 } 00501 } 00502 00503 uint32_t ebcenterid = getUnitWithMaxEnergy(themap); 00504 00505 if ( fillmap[i/2] == themap[ebcenterid] ) 00506 return true; 00507 else 00508 return false; 00509 }
bool EcalSimHitsValidProducer::fillEEMatrix | ( | int | nCellInEta, | |
int | nCellInPhi, | |||
int | CentralEta, | |||
int | CentralPhi, | |||
int | CentralZ, | |||
MapType & | fillmap, | |||
MapType & | themap | |||
) | [private] |
Definition at line 450 of file EcalSimHitsValidProducer.cc.
References getUnitWithMaxEnergy(), i, index, and EEDetId::validDetId().
Referenced by update().
00453 { 00454 int goBackInEta = nCellInEta/2; 00455 int goBackInPhi = nCellInPhi/2; 00456 00457 int startEta = CentralEta - goBackInEta; 00458 int startPhi = CentralPhi - goBackInPhi; 00459 00460 int i = 0 ; 00461 for ( int ieta = startEta; ieta < startEta+nCellInEta; ieta ++ ) { 00462 00463 for( int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++ ) { 00464 uint32_t index; 00465 00466 if (EEDetId::validDetId(ieta, iphi,CentralZ)) { 00467 index = EEDetId( ieta, iphi,CentralZ).rawId(); 00468 } else { continue; } 00469 00470 fillmap[i++] = themap[index]; 00471 } 00472 } 00473 uint32_t centerid = getUnitWithMaxEnergy(themap); 00474 00475 if ( fillmap[i/2] == themap[centerid] ) 00476 return true; 00477 else 00478 return false; 00479 }
void EcalSimHitsValidProducer::fillEventInfo | ( | PEcalValidInfo & | product | ) | [private] |
Definition at line 54 of file EcalSimHitsValidProducer.cc.
References eb1, PEcalValidInfo::eb1, PEcalValidInfo::eb16, eb16, PEcalValidInfo::eb25, eb25, PEcalValidInfo::eb4, eb4, PEcalValidInfo::eb9, eb9, eBX0, PEcalValidInfo::eBX0, PEcalValidInfo::ee1, ee1, ee16, PEcalValidInfo::ee16, PEcalValidInfo::ee25, ee25, ee4, PEcalValidInfo::ee4, ee9, PEcalValidInfo::ee9, PEcalValidInfo::eEX0, eEX0, PEcalValidInfo::eOf1ES, eOf1ES, PEcalValidInfo::eOf1ESzm, eOf1ESzm, eOf1ESzp, PEcalValidInfo::eOf1ESzp, PEcalValidInfo::eOf2ES, eOf2ES, PEcalValidInfo::eOf2ESzm, eOf2ESzm, eOf2ESzp, PEcalValidInfo::eOf2ESzp, PEcalValidInfo::eOfEBCaloG4Hit, eOfEBCaloG4Hit, eOfEECaloG4Hit, PEcalValidInfo::eOfEECaloG4Hit, PEcalValidInfo::eOfEEMinusCaloG4Hit, eOfEEMinusCaloG4Hit, eOfEEPlusCaloG4Hit, PEcalValidInfo::eOfEEPlusCaloG4Hit, PEcalValidInfo::eOfESCaloG4Hit, eOfESCaloG4Hit, PEcalValidInfo::etaOfEBCaloG4Hit, etaOfEBCaloG4Hit, PEcalValidInfo::etaOfEECaloG4Hit, etaOfEECaloG4Hit, PEcalValidInfo::etaOfESCaloG4Hit, etaOfESCaloG4Hit, i, nCrystalInEB, PEcalValidInfo::nCrystalInEB, PEcalValidInfo::nCrystalInEEzm, nCrystalInEEzm, nCrystalInEEzp, PEcalValidInfo::nCrystalInEEzp, PEcalValidInfo::nHitsIn1ES, nHitsIn1ES, PEcalValidInfo::nHitsIn1ESzm, nHitsIn1ESzm, nHitsIn1ESzp, PEcalValidInfo::nHitsIn1ESzp, nHitsIn2ES, PEcalValidInfo::nHitsIn2ES, PEcalValidInfo::nHitsIn2ESzm, nHitsIn2ESzm, nHitsIn2ESzp, PEcalValidInfo::nHitsIn2ESzp, PEcalValidInfo::nHitsInEB, nHitsInEB, PEcalValidInfo::nHitsInEE, nHitsInEE, PEcalValidInfo::nHitsInES, nHitsInES, PEcalValidInfo::phiOfEBCaloG4Hit, phiOfEBCaloG4Hit, phiOfEECaloG4Hit, PEcalValidInfo::phiOfEECaloG4Hit, phiOfESCaloG4Hit, PEcalValidInfo::phiOfESCaloG4Hit, theMomentum, PEcalValidInfo::theMomentum, PEcalValidInfo::thePID, thePID, theVertex, PEcalValidInfo::theVertex, PEcalValidInfo::tOfEBCaloG4Hit, tOfEBCaloG4Hit, tOfEECaloG4Hit, PEcalValidInfo::tOfEECaloG4Hit, PEcalValidInfo::tOfESCaloG4Hit, tOfESCaloG4Hit, totalEInEB, PEcalValidInfo::totalEInEB, totalEInEE, PEcalValidInfo::totalEInEE, totalEInEEzm, PEcalValidInfo::totalEInEEzm, PEcalValidInfo::totalEInEEzp, totalEInEEzp, totalEInES, PEcalValidInfo::totalEInES, PEcalValidInfo::totalEInESzm, totalEInESzm, PEcalValidInfo::totalEInESzp, totalEInESzp, PEcalValidInfo::totalHits, totalHits, PEcalValidInfo::zOfES, and zOfES.
Referenced by produce().
00055 { 00056 if( ee1 != 0 ){ 00057 product.ee1 = ee1; 00058 product.ee4 = ee4; 00059 product.ee9 = ee9; 00060 product.ee16 = ee16; 00061 product.ee25 = ee25; 00062 for ( int i = 0; i<26; i++ ) { 00063 product.eEX0.push_back( eEX0[i]); 00064 } 00065 } 00066 00067 if( eb1 != 0 ){ 00068 product.eb1 = eb1; 00069 product.eb4 = eb4; 00070 product.eb9 = eb9; 00071 product.eb16 = eb16; 00072 product.eb25 = eb25; 00073 for ( int i = 0; i<26; i++ ) { 00074 product.eBX0.push_back( eBX0[i]); 00075 } 00076 } 00077 00078 product.totalEInEE = totalEInEE; 00079 product.totalEInEB = totalEInEB; 00080 product.totalEInES = totalEInES; 00081 00082 product.totalEInEEzp = totalEInEEzp; 00083 product.totalEInEEzm = totalEInEEzm; 00084 00085 product.totalEInESzp = totalEInESzp; 00086 product.totalEInESzm = totalEInESzm; 00087 00088 product.totalHits = totalHits; 00089 product.nHitsInEE = nHitsInEE; 00090 product.nHitsInEB = nHitsInEB; 00091 product.nHitsInES = nHitsInES; 00092 product.nHitsIn1ES = nHitsIn1ES; 00093 product.nHitsIn2ES = nHitsIn2ES; 00094 product.nCrystalInEB = nCrystalInEB; 00095 product.nCrystalInEEzp = nCrystalInEEzp; 00096 product.nCrystalInEEzm = nCrystalInEEzm; 00097 00098 product.nHitsIn1ESzp = nHitsIn1ESzp; 00099 product.nHitsIn1ESzm = nHitsIn1ESzm; 00100 product.nHitsIn2ESzp = nHitsIn2ESzp; 00101 product.nHitsIn2ESzm = nHitsIn2ESzm; 00102 00103 00104 product.eOf1ES = eOf1ES; 00105 product.eOf2ES = eOf2ES; 00106 product.zOfES = zOfES; 00107 00108 product.eOf1ESzp = eOf1ESzp; 00109 product.eOf1ESzm = eOf1ESzm; 00110 product.eOf2ESzp = eOf2ESzp; 00111 product.eOf2ESzm = eOf2ESzm; 00112 00113 00114 product.phiOfEECaloG4Hit = phiOfEECaloG4Hit; 00115 product.etaOfEECaloG4Hit = etaOfEECaloG4Hit; 00116 product.eOfEECaloG4Hit = eOfEECaloG4Hit; 00117 product.eOfEEPlusCaloG4Hit = eOfEEPlusCaloG4Hit; 00118 product.eOfEEMinusCaloG4Hit = eOfEEMinusCaloG4Hit; 00119 product.tOfEECaloG4Hit = tOfEECaloG4Hit; 00120 00121 product.phiOfESCaloG4Hit = phiOfESCaloG4Hit; 00122 product.etaOfESCaloG4Hit = etaOfESCaloG4Hit; 00123 product.eOfESCaloG4Hit = eOfESCaloG4Hit; 00124 product.tOfESCaloG4Hit = tOfESCaloG4Hit; 00125 00126 product.phiOfEBCaloG4Hit = phiOfEBCaloG4Hit; 00127 product.etaOfEBCaloG4Hit = etaOfEBCaloG4Hit; 00128 product.eOfEBCaloG4Hit = eOfEBCaloG4Hit; 00129 product.tOfEBCaloG4Hit = tOfEBCaloG4Hit; 00130 00131 00132 product.theMomentum = theMomentum; 00133 product.theVertex = theVertex; 00134 product.thePID = thePID; 00135 }
uint32_t EcalSimHitsValidProducer::getUnitWithMaxEnergy | ( | MapType & | themap | ) | [private] |
Definition at line 633 of file EcalSimHitsValidProducer.cc.
References iter, and LogDebug.
Referenced by fillEBMatrix(), fillEEMatrix(), and update().
00633 { 00634 00635 uint32_t unitWithMaxEnergy = 0; 00636 float maxEnergy = 0.; 00637 00638 MapType::iterator iter; 00639 for (iter = themap.begin(); iter != themap.end(); iter++) { 00640 00641 if (maxEnergy < (*iter).second) { 00642 maxEnergy = (*iter).second; 00643 unitWithMaxEnergy = (*iter).first; 00644 } 00645 } 00646 00647 00648 LogDebug("EcalSimHitsValidProducer") 00649 << " Max energy of " << maxEnergy 00650 << " MeV was found in Unit id 0x" << std::hex 00651 << unitWithMaxEnergy << std::dec; 00652 00653 return unitWithMaxEnergy; 00654 }
const EcalSimHitsValidProducer& EcalSimHitsValidProducer::operator= | ( | const EcalSimHitsValidProducer & | ) | [private] |
void EcalSimHitsValidProducer::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | ||||
) | [virtual] |
Implements SimProducer.
Definition at line 46 of file EcalSimHitsValidProducer.cc.
References fillEventInfo(), label, and edm::Event::put().
00047 { 00048 std::auto_ptr<PEcalValidInfo> product(new PEcalValidInfo ); 00049 fillEventInfo(*product); 00050 e.put(product,label); 00051 }
void EcalSimHitsValidProducer::update | ( | const EndOfEvent * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const EndOfEvent * >.
Definition at line 209 of file EcalSimHitsValidProducer.cc.
References eb1, eb16, eb25, eb4, eb9, eCluster2x2(), eCluster4x4(), ee1, ee16, ee25, ee4, ee9, energyInEBMatrix(), energyInEEMatrix(), eOf1ESzm, eOf1ESzp, eOf2ESzm, eOf2ESzp, eOfEBCaloG4Hit, eOfEECaloG4Hit, eOfEEMinusCaloG4Hit, eOfEEPlusCaloG4Hit, etaOfEBCaloG4Hit, etaOfEECaloG4Hit, fillEBMatrix(), fillEEMatrix(), CaloG4Hit::getEnergyDeposit(), CaloG4Hit::getEntry(), CaloG4Hit::getTimeSlice(), CaloG4Hit::getUnitID(), getUnitWithMaxEnergy(), i, EBDetId::ietaAbs(), EBDetId::iphi(), EEDetId::ix(), EEDetId::iy(), j, funct::log(), max, min, nCrystalInEB, nCrystalInEEzm, nCrystalInEEzp, nHitsIn1ESzm, nHitsIn1ESzp, nHitsIn2ESzm, nHitsIn2ESzp, nHitsInEB, nHitsInEE, nHitsInES, npart, phiOfEBCaloG4Hit, phiOfEECaloG4Hit, ESDetId::plane(), funct::pow(), funct::sqrt(), funct::tan(), theMomentum, thePID, theta, theVertex, tOfEBCaloG4Hit, tOfEECaloG4Hit, totalEInEB, totalEInEE, totalEInEEzm, totalEInEEzp, totalEInES, totalEInESzm, totalEInESzp, totalHits, ESDetId::zside(), EEDetId::zside(), and EBDetId::zside().
00209 { 00210 00211 int trackID = 0; 00212 G4PrimaryParticle * thePrim = 0; 00213 int nvertex = (*evt)()->GetNumberOfPrimaryVertex(); 00214 if ( nvertex <= 0) { 00215 edm::LogWarning("EcalSimHitsValidProducer") 00216 <<" No Vertex in this Event!"; 00217 }else { 00218 for ( int i = 0; i< nvertex; i++){ 00219 G4PrimaryVertex * avertex =(*evt)()->GetPrimaryVertex(i); 00220 if ( avertex == 0 ) 00221 edm::LogWarning("EcalSimHitsValidProducer") 00222 <<" Pointer to vertex is NULL!"; 00223 else { 00224 float x0 = avertex->GetX0(); 00225 float y0 = avertex->GetY0(); 00226 float z0 = avertex->GetZ0(); 00227 float t0 = avertex->GetT0(); 00228 theVertex.SetCoordinates(x0,y0,z0,t0); 00229 00230 int npart = avertex->GetNumberOfParticle(); 00231 if ( npart == 0) 00232 edm::LogWarning("EcalSimHitsValidProducer") 00233 <<" No primary particle in this event"; 00234 else { 00235 if ( thePrim == 0) 00236 thePrim = avertex->GetPrimary(trackID); 00237 } 00238 } 00239 } 00240 00241 // the direction of momentum of primary particles 00242 double etaInit =0, phiInit =0, pInit =0; 00243 if ( thePrim != 0){ 00244 double px = thePrim -> GetPx(); 00245 double py = thePrim -> GetPy(); 00246 double pz = thePrim -> GetPz(); 00247 theMomentum.SetCoordinates(px,py,pz,0.); 00248 00249 pInit =sqrt( pow(px,2.) + pow(py,2.) + pow(pz,2.)); 00250 if ( pInit == 0) 00251 edm::LogWarning("EcalSimHitsValidProducer") 00252 <<" Primary has p = 0 ; "; 00253 else { 00254 theMomentum.SetE(pInit); 00255 double costheta = pz/pInit; 00256 double theta = acos(std::min(std::max(costheta, -1.),1.)); 00257 etaInit = -log(tan(theta/2)); 00258 00259 if ( px != 0 || py != 0) 00260 phiInit = atan2(py,px); 00261 } 00262 00263 thePID = thePrim->GetPDGcode(); 00264 }else { 00265 edm::LogWarning("EcalSimHitsValidProducer") 00266 <<" Could not find the primary particle!!"; 00267 } 00268 } 00269 // hit map for EB for matrices 00270 G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); 00271 int EBHCid = G4SDManager::GetSDMpointer()->GetCollectionID("EcalHitsEB"); 00272 int EEHCid = G4SDManager::GetSDMpointer()->GetCollectionID("EcalHitsEE"); 00273 int SEHCid = G4SDManager::GetSDMpointer()->GetCollectionID("EcalHitsES"); 00274 00275 00276 CaloG4HitCollection* theEBHC = (CaloG4HitCollection*) allHC->GetHC(EBHCid); 00277 CaloG4HitCollection* theEEHC = (CaloG4HitCollection*) allHC->GetHC(EEHCid); 00278 CaloG4HitCollection* theSEHC = (CaloG4HitCollection*) allHC->GetHC(SEHCid); 00279 00280 nHitsInEE = theEEHC->entries(); 00281 nHitsInEB = theEBHC->entries(); 00282 nHitsInES = theSEHC->entries(); 00283 totalHits = nHitsInEE + nHitsInEB + nHitsInES; 00284 00285 // EB Hit collection start 00286 MapType ebmap; 00287 for (int j=0; j<theEBHC->entries(); j++) { 00288 CaloG4Hit* aHit = (*theEBHC)[j]; 00289 totalEInEB += aHit->getEnergyDeposit(); 00290 float he = aHit->getEnergyDeposit(); 00291 float htime = aHit->getTimeSlice(); 00292 00293 math::XYZPoint hpos = aHit->getEntry(); 00294 float htheta = hpos.theta(); 00295 float heta = -log(tan(htheta * 0.5)); 00296 float hphi = hpos.phi(); 00297 00298 phiOfEBCaloG4Hit.push_back( hphi); 00299 etaOfEBCaloG4Hit.push_back(heta); 00300 tOfEBCaloG4Hit.push_back(htime); 00301 eOfEBCaloG4Hit.push_back(he); 00302 uint32_t crystid = aHit->getUnitID(); 00303 ebmap[crystid] += aHit->getEnergyDeposit(); 00304 } 00305 00306 nCrystalInEB = ebmap.size(); 00307 00308 // EE Hit collection start 00309 MapType eemap,eezpmap,eezmmap; 00310 00311 for (int j=0; j<theEEHC->entries(); j++) { 00312 CaloG4Hit* aHit = (*theEEHC)[j]; 00313 totalEInEE += aHit->getEnergyDeposit(); 00314 float he = aHit->getEnergyDeposit(); 00315 float htime = aHit->getTimeSlice(); 00316 00317 math::XYZPoint hpos = aHit->getEntry(); 00318 float htheta = hpos.theta(); 00319 float heta = -log(tan(htheta * 0.5)); 00320 float hphi = hpos.phi(); 00321 phiOfEECaloG4Hit.push_back( hphi); 00322 etaOfEECaloG4Hit.push_back(heta); 00323 tOfEECaloG4Hit.push_back(htime); 00324 eOfEECaloG4Hit.push_back(he); 00325 00326 uint32_t crystid = aHit->getUnitID(); 00327 EEDetId myEEid(crystid); 00328 if ( myEEid.zside() == -1 ) { 00329 totalEInEEzm += aHit->getEnergyDeposit(); 00330 eOfEEMinusCaloG4Hit.push_back(he); 00331 eezmmap[crystid] += aHit->getEnergyDeposit(); 00332 } 00333 if ( myEEid.zside() == 1 ) { 00334 totalEInEEzp += aHit->getEnergyDeposit(); 00335 eOfEEPlusCaloG4Hit.push_back(he); 00336 eezpmap[crystid] += aHit->getEnergyDeposit(); 00337 } 00338 00339 00340 eemap[crystid] += aHit->getEnergyDeposit(); 00341 } 00342 00343 nCrystalInEEzm = eezmmap.size(); 00344 nCrystalInEEzp = eezpmap.size(); 00345 00346 //Hits from ES 00347 for (int j=0; j<theSEHC->entries(); j++) { 00348 CaloG4Hit* aHit = (*theSEHC)[j]; 00349 totalEInES += aHit->getEnergyDeposit(); 00350 ESDetId esid = ESDetId( aHit->getUnitID()); 00351 00352 if (esid.zside() == -1) { 00353 00354 totalEInESzm += aHit->getEnergyDeposit(); 00355 00356 if (esid.plane() == 1) { 00357 nHitsIn1ESzm++; 00358 eOf1ESzm.push_back(aHit->getEnergyDeposit()); 00359 }else if ( esid.plane() == 2){ 00360 nHitsIn2ESzm++; 00361 eOf2ESzm.push_back(aHit->getEnergyDeposit()); 00362 } 00363 } 00364 if (esid.zside() == 1) { 00365 00366 totalEInESzp += aHit->getEnergyDeposit(); 00367 00368 if (esid.plane() == 1) { 00369 nHitsIn1ESzp++; 00370 eOf1ESzp.push_back(aHit->getEnergyDeposit()); 00371 }else if ( esid.plane() == 2){ 00372 nHitsIn2ESzp++; 00373 eOf2ESzp.push_back(aHit->getEnergyDeposit()); 00374 } 00375 } 00376 00377 00378 00379 } 00380 00381 uint32_t eemaxid = getUnitWithMaxEnergy(eemap); 00382 uint32_t ebmaxid = getUnitWithMaxEnergy(ebmap); 00383 if ( eemap[eemaxid] > ebmap[ebmaxid] ) { 00384 uint32_t centerid = getUnitWithMaxEnergy(eemap); 00385 EEDetId myEEid(centerid); 00386 int ix = myEEid.ix(); 00387 int iy = myEEid.iy(); 00388 int iz = myEEid.zside(); 00389 00390 ee1 = energyInEEMatrix(1,1,ix,iy,iz,eemap); 00391 ee9 = energyInEEMatrix(3,3,ix,iy,iz,eemap); 00392 ee25= energyInEEMatrix(5,5,ix,iy,iz,eemap); 00393 MapType neweemap; 00394 if( fillEEMatrix(3,3,ix,iy,iz,neweemap, eemap)) { 00395 ee4 = eCluster2x2(neweemap); 00396 } 00397 if ( fillEEMatrix(5,5,ix,iy,iz,neweemap, eemap)) { 00398 ee16 = eCluster4x4(ee9,neweemap); 00399 } 00400 } else { 00401 uint32_t ebcenterid = getUnitWithMaxEnergy(ebmap); 00402 EBDetId myEBid(ebcenterid); 00403 int bx = myEBid.ietaAbs(); 00404 int by = myEBid.iphi(); 00405 int bz = myEBid.zside(); 00406 eb1 = energyInEBMatrix(1,1,bx,by,bz,ebmap); 00407 eb9 = energyInEBMatrix(3,3,bx,by,bz,ebmap); 00408 eb25= energyInEBMatrix(5,5,bx,by,bz,ebmap); 00409 00410 MapType newebmap; 00411 if( fillEBMatrix(3,3,bx,by,bz,newebmap, ebmap)){ 00412 eb4 = eCluster2x2(newebmap); 00413 } 00414 if( fillEBMatrix(5,5,bx,by,bz,newebmap, ebmap)){ 00415 eb16 = eCluster4x4(eb9,newebmap); 00416 } 00417 } 00418 00419 }
void EcalSimHitsValidProducer::update | ( | const G4Step * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const G4Step * >.
Definition at line 422 of file EcalSimHitsValidProducer.cc.
References eBX0, eEX0, int, name, r, funct::sqrt(), x, y, and z.
00422 { 00423 G4StepPoint* preStepPoint = aStep->GetPreStepPoint(); 00424 G4ThreeVector hitPoint = preStepPoint->GetPosition(); 00425 G4VPhysicalVolume* currentPV = preStepPoint->GetPhysicalVolume(); 00426 G4String name = currentPV->GetName(); 00427 std::string crystal; 00428 crystal.assign(name,0,4); 00429 00430 float Edeposit = aStep->GetTotalEnergyDeposit(); 00431 if ( crystal == "EFRY"&& Edeposit > 0.0){ 00432 float z = hitPoint.z(); 00433 float detz = fabs(fabs(z)-3200); 00434 int x0 = (int)floor( detz/8.9 ); 00435 if ( x0< 26){ 00436 eEX0[x0] += Edeposit; 00437 } 00438 } 00439 if(crystal == "EBRY" && Edeposit > 0.0) { 00440 float x = hitPoint.x(); 00441 float y = hitPoint.y(); 00442 float r = sqrt(x*x +y*y); 00443 float detr = r -1290; 00444 int x0 = (int)floor( detr/8.9); 00445 eBX0[x0] += Edeposit; 00446 } 00447 00448 }
void EcalSimHitsValidProducer::update | ( | const BeginOfEvent * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfEvent * >.
Definition at line 138 of file EcalSimHitsValidProducer.cc.
References eb1, eb16, eb25, eb4, eb9, eBX0, ee1, ee16, ee25, ee4, ee9, eEX0, eOf1ES, eOf1ESzm, eOf1ESzp, eOf2ES, eOf2ESzm, eOf2ESzp, eOfEBCaloG4Hit, eOfEECaloG4Hit, eOfEEMinusCaloG4Hit, eOfEEPlusCaloG4Hit, eOfESCaloG4Hit, etaOfEBCaloG4Hit, etaOfEECaloG4Hit, etaOfESCaloG4Hit, i, nCrystalInEB, nCrystalInEEzm, nCrystalInEEzp, nHitsIn1ES, nHitsIn1ESzm, nHitsIn1ESzp, nHitsIn2ES, nHitsIn2ESzm, nHitsIn2ESzp, nHitsInEB, nHitsInEE, nHitsInES, phiOfEBCaloG4Hit, phiOfEECaloG4Hit, phiOfESCaloG4Hit, tOfEBCaloG4Hit, tOfEECaloG4Hit, tOfESCaloG4Hit, totalEInEB, totalEInEE, totalEInEEzm, totalEInEEzp, totalEInES, totalEInESzm, totalEInESzp, totalHits, and zOfES.
00138 { 00139 ee1 = 0.0; 00140 ee4 = 0.0; 00141 ee9 = 0.0; 00142 ee16 = 0.0; 00143 ee25 = 0.0; 00144 00145 eb1 = 0.0; 00146 eb4 = 0.0; 00147 eb9 = 0.0; 00148 eb16 = 0.0; 00149 eb25 = 0.0; 00150 00151 totalEInEE = 0.0 ; 00152 totalEInEB = 0.0 ; 00153 totalEInES = 0.0 ; 00154 00155 totalEInEEzp = 0.0 ; 00156 totalEInEEzm = 0.0 ; 00157 totalEInESzp = 0.0 ; 00158 totalEInESzm = 0.0 ; 00159 00160 totalHits = 0 ; 00161 nHitsInEE = 0 ; 00162 nHitsInEB = 0 ; 00163 nHitsInES = 0 ; 00164 nHitsIn1ES = 0 ; 00165 nHitsIn2ES = 0 ; 00166 nCrystalInEB = 0; 00167 nCrystalInEEzp = 0; 00168 nCrystalInEEzm = 0; 00169 00170 00171 nHitsIn1ESzp = 0 ; 00172 nHitsIn1ESzm = 0 ; 00173 nHitsIn2ESzp = 0 ; 00174 nHitsIn2ESzm = 0 ; 00175 00176 for ( int i = 0; i<26; i++ ) { 00177 eBX0[i] = 0.0; 00178 eEX0[i] = 0.0; 00179 } 00180 00181 eOf1ES.clear(); 00182 eOf2ES.clear(); 00183 zOfES.clear(); 00184 00185 eOf1ESzp.clear(); 00186 eOf1ESzm.clear(); 00187 eOf2ESzp.clear(); 00188 eOf2ESzm.clear(); 00189 00190 phiOfEECaloG4Hit.clear(); 00191 etaOfEECaloG4Hit.clear(); 00192 tOfEECaloG4Hit.clear(); 00193 eOfEECaloG4Hit.clear(); 00194 eOfEEPlusCaloG4Hit.clear(); 00195 eOfEEMinusCaloG4Hit.clear(); 00196 00197 phiOfESCaloG4Hit.clear(); 00198 etaOfESCaloG4Hit.clear(); 00199 tOfESCaloG4Hit.clear(); 00200 eOfESCaloG4Hit.clear(); 00201 00202 phiOfEBCaloG4Hit.clear(); 00203 etaOfEBCaloG4Hit.clear(); 00204 tOfEBCaloG4Hit.clear(); 00205 eOfEBCaloG4Hit.clear(); 00206 }
float EcalSimHitsValidProducer::eb1 [private] |
Definition at line 75 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::eb16 [private] |
Definition at line 78 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::eb25 [private] |
Definition at line 79 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::eb4 [private] |
Definition at line 76 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::eb9 [private] |
Definition at line 77 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::eBX0[26] [private] |
Definition at line 105 of file EcalSimHitsValidProducer.h.
Referenced by EcalSimHitsValidProducer(), fillEventInfo(), and update().
float EcalSimHitsValidProducer::ee1 [private] |
Definition at line 69 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::ee16 [private] |
Definition at line 72 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::ee25 [private] |
Definition at line 73 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::ee4 [private] |
Definition at line 70 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::ee9 [private] |
Definition at line 71 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::eEX0[26] [private] |
Definition at line 106 of file EcalSimHitsValidProducer.h.
Referenced by EcalSimHitsValidProducer(), fillEventInfo(), and update().
FloatVector EcalSimHitsValidProducer::eOf1ES [private] |
Definition at line 109 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 112 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 111 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
FloatVector EcalSimHitsValidProducer::eOf2ES [private] |
Definition at line 110 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 114 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 113 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 128 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 121 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 123 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 122 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 133 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 126 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 119 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 131 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
std::string EcalSimHitsValidProducer::label [private] |
Definition at line 139 of file EcalSimHitsValidProducer.h.
Referenced by EcalSimHitsValidProducer(), and produce().
int EcalSimHitsValidProducer::nCrystalInEB [private] |
Definition at line 96 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nCrystalInEEzm [private] |
Definition at line 98 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nCrystalInEEzp [private] |
Definition at line 97 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsIn1ES [private] |
Definition at line 94 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsIn1ESzm [private] |
Definition at line 101 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsIn1ESzp [private] |
Definition at line 100 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsIn2ES [private] |
Definition at line 95 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsIn2ESzm [private] |
Definition at line 103 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsIn2ESzp [private] |
Definition at line 102 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsInEB [private] |
Definition at line 92 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsInEE [private] |
Definition at line 91 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::nHitsInES [private] |
Definition at line 93 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 125 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 118 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 130 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 135 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::thePID [private] |
Definition at line 138 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 136 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 127 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 120 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
Definition at line 132 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::totalEInEB [private] |
Definition at line 82 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::totalEInEE [private] |
Definition at line 81 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::totalEInEEzm [private] |
Definition at line 86 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::totalEInEEzp [private] |
Definition at line 85 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::totalEInES [private] |
Definition at line 83 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::totalEInESzm [private] |
Definition at line 88 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
float EcalSimHitsValidProducer::totalEInESzp [private] |
Definition at line 87 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
int EcalSimHitsValidProducer::totalHits [private] |
Definition at line 90 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().
FloatVector EcalSimHitsValidProducer::zOfES [private] |
Definition at line 117 of file EcalSimHitsValidProducer.h.
Referenced by fillEventInfo(), and update().