42 unsigned int idx=(det&15)<<28;
43 idx+=(((z+1)/2)&1)<<20;
47 G4cout <<
" ECAL packing " << det <<
" " << z <<
" " << eta <<
" " << phi
48 <<
" into " << idx <<
G4endl;
60 unsigned int idx=(det&15)<<28;
66 G4cout <<
" HCAL packing " << det <<
" " << depth <<
" " << z <<
" " << eta
67 <<
" " << phi <<
" into " << idx <<
G4endl;
74 int& eta,
int& phi)
const {
84 int& depth,
int&
z,
int& eta,
97 int UnitWithMaxEnergy = 0;
100 for(std::map<
int,
float,std::less<int> >::iterator iter = themap.begin();
101 iter != themap.end(); iter++){
103 if( maxEnergy < (*iter).second) {
104 maxEnergy = (*iter).second;
105 UnitWithMaxEnergy = (*iter).first;
109 G4cout <<
" *** max energy of " << maxEnergy <<
" MeV was found in Unit id "
110 << UnitWithMaxEnergy;
113 G4cout <<
" corresponding to z= " << z <<
" eta= " << eta <<
" phi = " << phi
116 return UnitWithMaxEnergy;
122 int crystalWithMaxEnergy,
123 std::map<
int,
float,std::less<int> >& themap){
126 this->
unpackindex(crystalWithMaxEnergy, det, z, eta, phi);
129 int goBackInEta = nCellInEta/2;
130 int goBackInPhi = nCellInPhi/2;
131 int startEta = eta-goBackInEta;
132 int startPhi = phi-goBackInPhi;
134 float totalEnergy = 0.;
136 for(
int ieta=startEta; ieta<startEta+nCellInEta; ieta++){
137 for(
int iphi=startPhi; iphi<startPhi+nCellInPhi; iphi++){
139 int index = this->
packindex(det,z,ieta,iphi);
140 totalEnergy += themap[index];
143 G4cout <<
"ieta - iphi - E = " << ieta <<
" " << iphi <<
" "
144 << themap[index] <<
G4endl;
150 G4cout <<
"Energy in " << nCellInEta <<
" cells in eta times "
151 << nCellInPhi <<
" cells in phi matrix = " << totalEnergy
152 <<
" for " << ncristals <<
" crystals" <<
G4endl;
void unpackindex(const unsigned int &idx, int &det, int &z, int &eta, int &phi) const
float energyInMatrix(int nCellInEta, int nCellInPhi, int crystalWithMaxEnergy, std::map< int, float, std::less< int > > &themap)
unsigned int packindex(int det, int z, int eta, int phi) const
G4GLOB_DLL std::ostream G4cout
int getUnitWithMaxEnergy(std::map< int, float, std::less< int > > &themap)