657{
658 int ntest=0;
659 cout<<"start CaloGeometry::Validate()"<<endl;
660 for(t_cellmap::iterator ic=m_cells.begin();ic!=m_cells.end();++ic) {
662 int sampling=
cell->getSampling();
663
664
665 if(m_debug_identify==
cell->identify()) {
666 cout<<
"CaloGeometry::Validate(), cell "<<ntest<<
" id="<<
cell->identify()<<endl;
667 m_debug=true;
668 }
669
670 for(int irnd=0;irnd<nrnd;++irnd) {
671 std::stringstream
pos;
672 std::stringstream cellpos;
673 std::stringstream foundcellpos;
676 bool is_inside;
677 bool is_inside_foundcell=false;
679 if(sampling<21) {
680 float eta=
cell->eta()+1.95*(gRandom->Rndm()-0.5)*
cell->deta();
681 float phi=
cell->phi()+1.95*(gRandom->Rndm()-0.5)*
cell->dphi();
683
685 cellpos<<
"eta="<<
cell->eta()<<
" eta_raw="<<
cell->eta_raw()<<
" deta="<<
cell->deta()
686 <<
" ("<<(
cell->eta_raw()-
cell->eta())/
cell->deta()<<
") ; "
687 <<
"phi="<<
cell->phi()<<
" phi_raw="<<
cell->phi_raw()<<
" dphi="<<
cell->dphi()
688 <<
" ("<<(
cell->phi_raw()-
cell->phi())/
cell->dphi()<<
")";
689 if(foundcell) {
690 foundcellpos<<
"eta="<<foundcell->
eta()<<
" eta_raw="<<foundcell->
eta_raw()<<
" deta="<<foundcell->
deta()
691 <<
" ("<<(foundcell->
eta_raw()-foundcell->
eta())/foundcell->
deta()<<
") ; "
692 <<
"phi="<<foundcell->
phi()<<
" phi_raw="<<foundcell->
phi_raw()<<
" dphi="<<foundcell->
dphi()
693 <<
" ("<<(foundcell->
phi_raw()-foundcell->
phi())/
cell->dphi()<<
")";
694 is_inside_foundcell=TMath::Abs( (
eta-foundcell->
eta())/foundcell->
deta() )<0.55 && TMath::Abs( (
phi-foundcell->
phi())/foundcell->
dphi() )<0.55;
695 }
696 is_inside=TMath::Abs( (
eta-
cell->eta())/
cell->deta() )<0.49 && TMath::Abs( (
phi-
cell->phi())/
cell->dphi() )<0.49;
697 } else {
698 float x=
cell->x()+1.95*(gRandom->Rndm()-0.5)*
cell->dx();
699 float y=
cell->y()+1.95*(gRandom->Rndm()-0.5)*
cell->dy();
701 foundcell=getFCalDDE(sampling,
x,
y,
z);
702
703 pos<<
"x="<<
x<<
" y="<<
y<<
" z="<<
z;
704 cellpos<<
"x="<<
cell->x()<<
" x_raw="<<
cell->x_raw()<<
" dx="<<
cell->dx()
706 <<
"y="<<
cell->y()<<
" y_raw="<<
cell->y_raw()<<
" dy="<<
cell->dy()
708 if(foundcell) {
709 foundcellpos<<
"x="<<foundcell->
x()<<
" x_raw="<<foundcell->
x_raw()<<
" dx="<<foundcell->
dx()
710 <<
" ("<<(foundcell->
x_raw()-foundcell->
x())/foundcell->
dx()<<
") ; "
711 <<
"y="<<foundcell->
y()<<
" y_raw="<<foundcell->
y_raw()<<
" dy="<<foundcell->
dy()
712 <<
" ("<<(foundcell->
y_raw()-foundcell->
y())/
cell->dy()<<
")";
713 is_inside_foundcell=TMath::Abs( (
x-foundcell->
x())/foundcell->
dx() )<0.75 && TMath::Abs( (
y-foundcell->
y())/foundcell->
dy() )<0.75;
714 }
715 is_inside=TMath::Abs( (
x-
cell->x())/
cell->dx() )<0.49 && TMath::Abs( (
y-
cell->y())/
cell->dy() )<0.49;
716
717 }
718
719 if(m_debug && foundcell) {
720 cout<<
"CaloGeometry::Validate(), irnd="<<irnd<<
": cell id="<<
cell->identify()<<
", sampling="<<sampling
721 <<
", foundcell id="<<foundcell->
identify()<<
", "<<
steps<<
" steps"<<endl;
722 cout<<" "<<cellpos.str()<<endl;
723 }
724 if(cell==foundcell) {
725 if(steps>3 && distance<-0.01) {
726 cout<<
"cell id="<<
cell->identify()<<
", sampling="<<sampling<<
" found in "<<
steps<<
" steps, dist="<<
distance<<
" "<<
pos.str()<<endl;
727 cout<<" "<<cellpos.str()<<endl;
728 }
729 } else {
730 if(!foundcell) {
731 cout<<
"cell id="<<
cell->identify()<<
" not found!";
732 cout<<
" No cell found in "<<
steps<<
" steps, dist="<<
distance<<
" "<<
pos.str()<<endl;
733 cout<<" input sampling="<<sampling<<" "<<cellpos.str()<<endl;
734
735 }
736 if( is_inside && foundcell && !is_inside_foundcell) {
737 cout<<
"cell id="<<
cell->identify()<<
" not found, but inside cell area!";
739 cout<<" input sampling="<<sampling<<" "<<cellpos.str()<<endl;
740 cout<<
" output sampling="<<foundcell->
getSampling()<<
" "<<foundcellpos.str()<<endl;
741 return;
742 }
743 }
744 }
745 m_debug=false;
746 if(ntest%25000==0) cout<<"Validate cell "<<ntest<<" with "<<nrnd<<" random hits"<<endl;
747 ++ntest;
748 }
749 cout<<"end CaloGeometry::Validate()"<<endl;
750}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
This class groups all DetDescr information related to a CaloCell.
float y_raw() const
cell y_raw
float eta_raw() const
cell eta_raw
float dphi() const
cell dphi
CaloCell_ID::CaloSample getSampling() const
cell sampling
float x_raw() const
cell x_raw
Identifier identify() const override final
cell identifier
float eta() const
cell eta
float phi() const
cell phi
float phi_raw() const
cell phi_raw
float deta() const
cell deta
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
__DEVICE__ long long getDDE(GeoGpu *geo, int sampling, float eta, float phi)