ATLAS Offline Software
Loading...
Searching...
No Matches
CaloGeometry.cxx File Reference
#include "ISF_FastCaloSimParametrization/CaloGeometry.h"
#include <TTree.h>
#include <TVector2.h>
#include <TRandom.h>
#include <TCanvas.h>
#include <TH2D.h>
#include <TGraphErrors.h>
#include <TVector3.h>
#include <TLegend.h>
#include <fstream>
#include <sstream>
#include "CaloDetDescr/CaloDetDescrElement.h"
#include "CaloGeoHelpers/CaloSampling.h"
#include "ISF_FastCaloSimEvent/FastCaloSim_CaloCell_ID.h"

Go to the source code of this file.

Functions

void CaloGeometry::Validate ATLAS_NOT_THREAD_SAFE (int nrnd)

Variables

const int CaloGeometry_calocol [24]

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

void CaloGeometry::Validate ATLAS_NOT_THREAD_SAFE ( int nrnd)

Definition at line 655 of file CaloGeometry.cxx.

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) {
661 const CaloDetDescrElement* cell=ic->second;
662 int sampling=cell->getSampling();
663 //if(sampling>=21) continue;
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;
674 int steps=0;
675 float distance=0;
676 bool is_inside;
677 bool is_inside_foundcell=false;
678 const CaloDetDescrElement* foundcell=nullptr;
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();
682 foundcell=getDDE(sampling,eta,phi,&distance,&steps);
683
684 pos<<"eta="<<eta<<" phi="<<phi;
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();
700 float z=cell->z();
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()
705 <<" ("<<(cell->x_raw()-cell->x())/cell->dx()<<") ; "
706 <<"y="<<cell->y()<<" y_raw="<<cell->y_raw()<<" dy="<<cell->dy()
707 <<" ("<<(cell->y_raw()-cell->y())/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 //m_debug=true;
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 //return;
735 }
736 if( is_inside && foundcell && !is_inside_foundcell) {
737 cout<<"cell id="<<cell->identify()<<" not found, but inside cell area!";
738 cout<<" Found instead id="<<foundcell->identify()<<" in "<<steps<<" steps, dist="<<distance<<" "<<pos.str()<<endl;
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
#define y
#define x
#define z
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
Identifier identify() const override final
cell identifier
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)
int ic
Definition grepfile.py:33

Variable Documentation

◆ CaloGeometry_calocol

const int CaloGeometry_calocol[24]
Initial value:
={1,2,3,4,
1,2,3,4,
1,2,3,4,
1,2,3,
-42,-28,6,
1,2,3,
1,2,3
}

Definition at line 27 of file CaloGeometry.cxx.

27 {1,2,3,4, // LAr barrel
28 1,2,3,4, // LAr EM endcap
29 1,2,3,4, // Hadronic end cap cal.
30 1,2,3, // Tile barrel
31 -42,-28,6, // Tile gap (ITC & scint)
32 1,2,3, // Tile extended barrel
33 1,2,3 // Forward EM endcap
34};