42 #include "G4NavigationHistory.hh" 43 #include "G4TouchableHistory.hh" 45 #include "CLHEP/Units/GlobalSystemOfUnits.h" 46 #include "CLHEP/Units/GlobalPhysicalConstants.h" 57 public Observer<const BeginOfEvent *>,
111 edm::LogInfo(
"ValidHGCal") <<
"HGCalTestAnalysis:: Initialised as observer " 112 <<
"of begin events and of G4step with Parameter " 113 <<
"values: \n\tLabel : " << labelLayer_
114 <<
" and with " << names_.size() <<
" detectors" 116 for (
unsigned int k=0;
k<names_.size(); ++
k)
117 edm::LogInfo(
"ValidHGCal") <<
" [" <<
k <<
"] " << names_[
k] <<
" Type " 118 << types_[
k] << std::endl;
139 G4String nameX =
"HGCal";
144 nameX =
"HGCalEESensitive";
145 }
else if (
type == 1) {
147 nameX =
"HGCalHESiliconSensitive";
150 nameX =
"HGCalHEScintillatorSensitive";
159 layers = hdc->
layers(
false);
161 edm::LogError(
"ValidHGCal") <<
"Cannot find HGCalDDDConstants for " 163 throw cms::Exception(
"Unknown",
"ValidHGCal") <<
"Cannot find HGCalDDDConstants for " << nameX <<
"\n";
166 nameX =
"HcalEndcap";
176 edm::LogError(
"ValidHGCal") <<
"Cannot find HcalDDDSimConstant";
177 throw cms::Exception(
"Unknown",
"ValidHGCal") <<
"Cannot find HcalDDDSimConstant\n";
182 }
else if (
type == 1) {
189 <<
" with " << layers <<
" layers" << std::endl;
196 int iev = (*evt)()->GetEventID();
197 edm::LogInfo(
"ValidHGCal") <<
"SimG4HGCalValidation: =====> Begin event = " 216 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
217 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
221 G4String
name = curPV->GetName();
223 for (
unsigned int k=0;
k<
names_.size(); ++
k) {
224 if (name.find(
names_[
k].c_str()) != std::string::npos) {
232 G4TouchableHistory* touchable = (G4TouchableHistory*)aStep->GetPreStepPoint()->GetTouchable();
233 unsigned int index(0);
235 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
238 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
239 float globalZ=touchable->GetTranslation(0).z();
240 int iz( globalZ>0 ? 1 : -1);
243 layer = touchable->GetReplicaNumber(0);
244 module = touchable->GetReplicaNumber(1);
246 layer = touchable->GetReplicaNumber(2);
247 module = touchable->GetReplicaNumber(1);
248 cell = touchable->GetReplicaNumber(0);
253 int depth = (touchable->GetReplicaNumber(0))%10 + 1;
254 int lay = (touchable->GetReplicaNumber(0)/10)%100 + 1;
255 int det = (touchable->GetReplicaNumber(1))/1000;
259 edm::LogInfo(
"ValidHGCal") <<
"HCAL: " << det <<
":" << depth <<
":" 260 << lay <<
" o/p " << tmp.
subdet <<
":" 262 << tmp.
etaR <<
":" << tmp.
phis <<
":" 263 << tmp.
lay <<
" point " << hitPoint <<
" " 264 << hitPoint.rho() <<
":" << hitPoint.eta()
265 <<
":" << hitPoint.phi();
268 double edeposit = aStep->GetTotalEnergyDeposit();
269 edm::LogInfo(
"ValidHGCal") <<
"Layer " << layer <<
" Index " 271 <<
" Edep " << edeposit <<
" hit at " 276 }
else if (type == 1) {
283 G4String nextVolume(
"XXX");
284 if (aStep->GetTrack()->GetNextVolume()!=0)
285 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
287 if (nextVolume.c_str()!=name.c_str()) {
305 edm::LogInfo(
"ValidHGCal") <<
"\n ===>>> SimG4HGCalValidation: Energy deposit" 306 <<
"\n at EE : " << std::setw(6) <<
edepEE_/
MeV std::vector< unsigned int > hgchitIndex_
T getParameter(std::string const &) const
std::vector< double > hgchitY_
std::vector< int > subdet_
#define DEFINE_SIMWATCHER(type)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
SimG4HGCalValidation(const edm::ParameterSet &p)
std::vector< double > hgchitZ_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void produce(edm::Event &, const edm::EventSetup &)
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
void fillhgcLayers(const double edepEE, const double edepHEF, const double edepHEB, const std::vector< double > &eedep, const std::vector< double > &hefdep, const std::vector< double > &hebdep)
unsigned int layers(bool reco) const
void update(const BeginOfJob *job)
This routine will be called when the appropriate signal arrives.
const SimG4HGCalValidation & operator=(const SimG4HGCalValidation &)
virtual ~SimG4HGCalValidation()
std::vector< unsigned int > dets_
HcalNumberingFromDDD * numberingFromDDD_
void layerAnalysis(PHGCalValidInfo &)
HGCalGeometryMode::GeometryMode geomMode() const
std::vector< unsigned int > hgchitDets_
std::vector< double > hgcHEFedep_
std::vector< HGCNumberingScheme * > hgcNumbering_
std::vector< std::string > names_
std::vector< double > hgcHEBedep_
std::vector< int > types_
std::vector< double > hgcEEedep_
std::vector< std::vector< double > > tmp
void fillhgcHits(const std::vector< unsigned int > &hitdets, const std::vector< unsigned int > &hitindex, const std::vector< double > &hitvtxX, const std::vector< double > &hitvtxY, const std::vector< double > &hitvtxZ)
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
std::vector< double > hgchitX_