ATLAS Offline Software
Functions | Variables
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 }

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.

CaloDetDescrElement::deta
float deta() const
cell deta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:356
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloDetDescrElement::y
float y() const
cell y
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:365
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
x
#define x
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloDetDescrElement::identify
Identifier identify() const override final
cell identifier
Definition: CaloDetDescrElement.cxx:64
beamspotman.steps
int steps
Definition: beamspotman.py:505
z
#define z
CaloGpuGeneral_fnc::getDDE
__DEVICE__ long long getDDE(GeoGpu *geo, int sampling, float eta, float phi)
Definition: CaloGpuGeneral_fnc.cxx:13
grepfile.ic
int ic
Definition: grepfile.py:33
CaloDetDescrElement::x_raw
float x_raw() const
cell x_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:369
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CaloDetDescrElement::x
float x() const
cell x
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
CaloDetDescrElement::dphi
float dphi() const
cell dphi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:358
y
#define y
CaloDetDescrElement::dx
float dx() const
cell dx
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:375
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
CaloDetDescrElement::y_raw
float y_raw() const
cell y_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:371
CaloDetDescrElement::dy
float dy() const
cell dy
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:377
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352