CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
HGCalSD Class Reference

#include <HGCalSD.h>

Inheritance diagram for HGCalSD:
CaloSD Observer< const BeginOfJob *> SensitiveCaloDetector Observer< const BeginOfRun *> Observer< const BeginOfEvent *> Observer< const BeginOfTrack *> Observer< const EndOfTrack *> Observer< const EndOfEvent *> SensitiveDetector

Public Member Functions

 HGCalSD (const std::string &, const HGCalDDDConstants *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
uint32_t setDetUnitId (const G4Step *step) override
 
 ~HGCalSD () override=default
 
- Public Member Functions inherited from CaloSD
 CaloSD (const std::string &aSDname, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false, const std::string &newcolname="")
 
void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PCaloHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
bool isItFineCalo (const G4VTouchable *touch)
 
void newCollection (const std::string &name, edm::ParameterSet const &p)
 
void PrintAll () override
 
G4bool ProcessHits (G4Step *step, G4TouchableHistory *) override
 
bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override
 
void reset () override
 
 ~CaloSD () override
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (const std::string &iname, const SensitiveDetectorCatalog &clg, const std::string &newcollname="")
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const SensitiveDetectorCatalog &, bool calo, const std::string &newcollname="")
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfRun *>
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent *>
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack *>
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack *>
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent *>
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfJob *>
 Observer ()
 
void slotForUpdate (const BeginOfJob * iT)
 
virtual ~Observer ()
 

Protected Member Functions

bool filterHit (CaloG4Hit *, double) override
 
double getEnergyDeposit (const G4Step *) override
 
void initRun () override
 
void processSecondHit (const G4Step *, const G4Track *) override
 
void update (const BeginOfEvent *) override
 
void update (const BeginOfRun *) override
 
void update (const ::EndOfEvent *) override
 
void update (const BeginOfTrack *trk) override
 
void update (const EndOfTrack *trk) override
 
void update (const BeginOfJob *) override
 This routine will be called when the appropriate signal arrives. More...
 
- Protected Member Functions inherited from CaloSD
bool checkHit (int k=0)
 
CaloG4HitcreateNewHit (const G4Step *, const G4Track *, int k)
 
virtual void endEvent ()
 
virtual double EnergyCorrected (const G4Step &step, const G4Track *)
 
unsigned int findBoundaryCrossingParent (const G4Track *track, bool markParentAsSaveable=true)
 
double getAttenuation (const G4Step *aStep, double birk1, double birk2, double birk3) const
 
virtual uint16_t getDepth (const G4Step *)
 
virtual bool getFromLibrary (const G4Step *step)
 
int getNumberOfHits (int k=0)
 
double getResponseWt (const G4Track *, int k=0)
 
virtual int getTrackID (const G4Track *)
 
bool hitExists (const G4Step *, int k)
 
void ignoreRejection ()
 
virtual void initEvent (const BeginOfEvent *)
 
void printDetectorLevels (const G4VTouchable *) const
 
void processHit (const G4Step *step)
 
void resetForNewPrimary (const G4Step *)
 
void setNumberCheckedHits (int val, int k=0)
 
void setParameterized (bool val)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *) const
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *) const
 
virtual int setTrackID (const G4Step *)
 
void setUseMap (bool val)
 
std::string shortreprID (const CaloHitID &ID)
 
std::string shortreprID (const CaloG4Hit *hit)
 
void update (const BeginOfRun *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const ::EndOfEvent *) override
 
void updateHit (CaloG4Hit *, int k)
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 
- Protected Member Functions inherited from Observer< const EndOfEvent *>
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 

Private Member Functions

bool calibCell (const uint32_t &id)
 
bool isItinFidVolume (const G4ThreeVector &)
 
uint32_t setDetUnitId (int, int, int, int, G4ThreeVector &)
 

Private Attributes

std::vector< double > angles_
 
bool calibCell_
 
std::vector< int > calibCellFullHD_
 
std::vector< int > calibCellFullLD_
 
std::vector< int > calibCellPartHD_
 
std::vector< int > calibCellPartLD_
 
double calibCellRHD_
 
double calibCellRLD_
 
bool calibCells_
 
std::unique_ptr< HGCalCellOffsetcellOffset_
 
bool checkID_
 
int cornerMinMask_
 
const double cos30deg_
 
bool dd4hep_
 
double distanceFromEdge_
 
double eminHit_
 
bool fiducialCut_
 
double fraction_
 
HGCalGeometryMode::GeometryMode geom_mode_
 
std::unique_ptr< HGCGuardRingguardRing_
 
double guardRingOffset_
 
std::unique_ptr< HGCGuardRingPartialguardRingPartial_
 
const HGCalDDDConstantshgcons_
 
int levelT1_
 
int levelT2_
 
std::string missingFile_
 
std::unique_ptr< HGCMouseBitemouseBite_
 
double mouseBiteCut_
 
DetId::Detector mydet_
 
std::string myName_
 
std::string nameX_
 
std::unique_ptr< HGCalNumberingSchemenumberingScheme_
 
edm::ParameterSet const & ps_
 
bool rejectMB_
 
double sensorSizeOffset_
 
double slopeMin_
 
bool storeAllG4Hits_
 
const double tan30deg_
 
int useSimWt_
 
int verbose_
 
bool waferRot_
 
double waferSize_
 
double weight_
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Static Protected Member Functions inherited from CaloSD
static std::string printableDecayChain (const std::vector< unsigned int > &decayChain)
 
- Protected Attributes inherited from CaloSD
std::string collName_ [2]
 
CaloG4HitcurrentHit [2]
 
CaloHitID currentID [2]
 
std::string detName_
 
float edepositEM
 
float edepositHAD
 
double eminHit
 
double energyCut
 
G4ThreeVector entranceLocal
 
G4ThreeVector entrancePoint
 
bool forceSave
 
std::vector< std::string > hcn_
 
float incidentEnergy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
int nHC_
 
G4ThreeVector posGlobal
 
CaloHitID previousID [2]
 
bool suppressHeavy
 
double tmaxHit
 
std::vector< int > useResMap_
 

Detailed Description

Definition at line 22 of file HGCalSD.h.

Constructor & Destructor Documentation

◆ HGCalSD()

HGCalSD::HGCalSD ( const std::string &  name,
const HGCalDDDConstants hgc,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 33 of file HGCalSD.cc.

References angles_, cellOffset_, checkID_, cornerMinMask_, dd4hep_, distanceFromEdge_, eminHit_, fiducialCut_, DetId::Forward, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), guardRing_, guardRingPartial_, DetId::HGCalEE, DetId::HGCalHSi, missingFile_, mouseBite_, mydet_, myName_, Skims_PA_cff::name, nameX_, CaloSD::nHC_, numberingScheme_, AlCaHLTBitMon_ParallelJobs::p, rejectMB_, CaloSD::setNumberCheckedHits(), CaloSD::setUseMap(), storeAllG4Hits_, AlCaHLTBitMon_QueryRunRegistry::string, verbose_, and waferRot_.

38  : CaloSD(name,
39  clg,
40  p,
41  manager,
42  static_cast<float>(p.getParameter<edm::ParameterSet>("HGCSD").getParameter<double>("TimeSliceUnit")),
43  p.getParameter<edm::ParameterSet>("HGCSD").getParameter<bool>("IgnoreTrackID"),
44  ("Calibration" + name)),
45  myName_(name),
46  hgcons_(hgc),
47  ps_(p),
48  slopeMin_(0),
49  levelT1_(99),
50  levelT2_(99),
51  useSimWt_(0),
52  calibCells_(false),
53  tan30deg_(std::tan(30.0 * CLHEP::deg)),
54  cos30deg_(std::cos(30.0 * CLHEP::deg)) {
55  numberingScheme_.reset(nullptr);
56  guardRing_.reset(nullptr);
57  guardRingPartial_.reset(nullptr);
58  mouseBite_.reset(nullptr);
59  cellOffset_.reset(nullptr);
60 
61  edm::ParameterSet m_HGC = p.getParameter<edm::ParameterSet>("HGCSD");
62  eminHit_ = m_HGC.getParameter<double>("EminHit") * CLHEP::MeV;
63  fiducialCut_ = m_HGC.getParameter<bool>("FiducialCut");
64  storeAllG4Hits_ = m_HGC.getParameter<bool>("StoreAllG4Hits");
65  rejectMB_ = m_HGC.getParameter<bool>("RejectMouseBite");
66  waferRot_ = m_HGC.getParameter<bool>("RotatedWafer");
67  cornerMinMask_ = m_HGC.getParameter<int>("CornerMinMask");
68  nHC_ = m_HGC.getParameter<int>("HitCollection");
69  angles_ = m_HGC.getUntrackedParameter<std::vector<double>>("WaferAngles");
70  missingFile_ = m_HGC.getUntrackedParameter<std::string>("MissingWaferFile");
71  checkID_ = m_HGC.getUntrackedParameter<bool>("CheckID");
72  verbose_ = m_HGC.getUntrackedParameter<int>("Verbosity");
73  dd4hep_ = p.getParameter<bool>("g4GeometryDD4hepSource");
74 
75  if (storeAllG4Hits_) {
76  setUseMap(false);
78  }
79 
80  //this is defined in the hgcsens.xml
82  nameX_ = "HGCal";
83  if (myName_.find("HitsEE") != std::string::npos) {
85  nameX_ = "HGCalEESensitive";
86  } else if (myName_.find("HitsHEfront") != std::string::npos) {
88  nameX_ = "HGCalHESiliconSensitive";
89  }
90 
91 #ifdef EDM_ML_DEBUG
92  edm::LogVerbatim("HGCSim") << "**************************************************"
93  << "\n"
94  << "* *"
95  << "\n"
96  << "* Constructing a HGCalSD with name " << name << "\n"
97  << "* *"
98  << "\n"
99  << "**************************************************";
100 #endif
101  edm::LogVerbatim("HGCSim") << "HGCalSD:: Threshold for storing hits: " << eminHit_ << " for " << nameX_
102  << " detector " << mydet_ << " with " << nHC_ << " hit collections";
103  edm::LogVerbatim("HGCSim") << "Flag for storing individual Geant4 Hits " << storeAllG4Hits_;
104  edm::LogVerbatim("HGCSim") << "Fiducial volume cut with cut from eta/phi "
105  << "boundary " << fiducialCut_ << " at " << distanceFromEdge_;
106  edm::LogVerbatim("HGCSim") << "Reject MosueBite Flag: " << rejectMB_ << " cuts along " << angles_.size()
107  << " axes: " << angles_[0] << ", " << angles_[1];
108 }
Log< level::Info, true > LogVerbatim
int verbose_
Definition: HGCalSD.h:62
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
double distanceFromEdge_
Definition: HGCalSD.h:57
int levelT2_
Definition: HGCalSD.h:59
edm::ParameterSet const & ps_
Definition: HGCalSD.h:48
double slopeMin_
Definition: HGCalSD.h:57
void setNumberCheckedHits(int val, int k=0)
Definition: CaloSD.h:126
std::string myName_
Definition: HGCalSD.h:46
std::unique_ptr< HGCalNumberingScheme > numberingScheme_
Definition: HGCalSD.h:49
std::string nameX_
Definition: HGCalSD.h:55
void setUseMap(bool val)
Definition: CaloSD.h:115
T getUntrackedParameter(std::string const &, T const &) const
int nHC_
Definition: CaloSD.h:158
bool calibCells_
Definition: HGCalSD.h:63
bool rejectMB_
Definition: HGCalSD.h:61
DetId::Detector mydet_
Definition: HGCalSD.h:54
const double cos30deg_
Definition: HGCalSD.h:67
std::string missingFile_
Definition: HGCalSD.h:69
bool storeAllG4Hits_
Definition: HGCalSD.h:60
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< double > angles_
Definition: HGCalSD.h:68
const HGCalDDDConstants * hgcons_
Definition: HGCalSD.h:47
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const double tan30deg_
Definition: HGCalSD.h:67
bool waferRot_
Definition: HGCalSD.h:61
bool dd4hep_
Definition: HGCalSD.h:63
CaloSD(const std::string &aSDname, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false, const std::string &newcolname="")
Definition: CaloSD.cc:34
bool checkID_
Definition: HGCalSD.h:61
int cornerMinMask_
Definition: HGCalSD.h:59
std::unique_ptr< HGCalCellOffset > cellOffset_
Definition: HGCalSD.h:53
bool fiducialCut_
Definition: HGCalSD.h:61
std::unique_ptr< HGCGuardRingPartial > guardRingPartial_
Definition: HGCalSD.h:51
int useSimWt_
Definition: HGCalSD.h:62
std::unique_ptr< HGCGuardRing > guardRing_
Definition: HGCalSD.h:50
int levelT1_
Definition: HGCalSD.h:59
std::unique_ptr< HGCMouseBite > mouseBite_
Definition: HGCalSD.h:52
double eminHit_
Definition: HGCalSD.h:57

◆ ~HGCalSD()

HGCalSD::~HGCalSD ( )
overridedefault

Member Function Documentation

◆ calibCell()

bool HGCalSD::calibCell ( const uint32_t &  id)
private

Definition at line 381 of file HGCalSD.cc.

References calibCellFullHD_, calibCellFullLD_, calibCellPartHD_, calibCellPartLD_, calibCellRHD_, calibCellRLD_, cellOffset_, HGCalCell::cellPlacementIndex(), spr::find(), RemoveAddSevLevel::flag, fraction_, full, hgcons_, info(), nano_mu_digi_cff::layer, HGCalTypes::layerFrontBack(), HGCalDDDConstants::layerType(), M_PI, EgammaValidation_cff::num, HGCSiliconDetId::unpack(), HGCalTypes::waferFull(), HGCalTypes::waferHD(), HGCalDDDConstants::waferInfo(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and ecaldqm::zside().

Referenced by setDetUnitId().

381  {
382  bool flag(false);
383  int type, zside, layer, waferU, waferV, cellU, cellV;
384  HGCSiliconDetId(id).unpack(type, zside, layer, waferU, waferV, cellU, cellV);
386  bool hd = HGCalTypes::waferHD(info.type);
387  bool full = HGCalTypes::waferFull(info.part);
388  int indx = 100 * cellU + cellV;
389  if (hd) {
390  if (full)
391  flag = (std::find(calibCellFullHD_.begin(), calibCellFullHD_.end(), indx) != calibCellFullHD_.end());
392  else
393  flag = (std::find(calibCellPartHD_.begin(), calibCellPartHD_.end(), indx) != calibCellPartHD_.end());
394  } else {
395  if (full)
396  flag = (std::find(calibCellFullLD_.begin(), calibCellFullLD_.end(), indx) != calibCellFullLD_.end());
397  else
398  flag = (std::find(calibCellPartLD_.begin(), calibCellPartLD_.end(), indx) != calibCellPartLD_.end());
399  }
400  if (flag) {
401  int32_t place =
403  int32_t type = hd ? 0 : 1;
404  double num = hd ? (M_PI * calibCellRHD_ * calibCellRHD_) : (M_PI * calibCellRLD_ * calibCellRLD_);
405  double bot = cellOffset_->cellAreaUV(cellU, cellV, place, type, true);
406  fraction_ = (bot > 0 && bot > num) ? (num / bot) : 1.0;
407 #ifdef EDM_ML_DEBUG
408  edm::LogVerbatim("HGCSim") << HGCSiliconDetId(id) << " CalibrationCell flag " << flag << " and fraction " << num
409  << ":" << bot << ":" << fraction_;
410 #endif
411  } else {
412 #ifdef EDM_ML_DEBUG
413  edm::LogVerbatim("HGCSim") << HGCSiliconDetId(id) << " CalibrationCell flag " << flag;
414 #endif
415  }
416  return flag;
417 }
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:239
static constexpr bool waferHD(int32_t type)
Definition: HGCalTypes.h:140
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< int > calibCellPartLD_
Definition: HGCalSD.h:66
int32_t waferU(const int32_t index)
std::vector< int > calibCellPartHD_
Definition: HGCalSD.h:65
HGCalParameters::waferInfo waferInfo(int lay, int waferU, int waferV) const
int zside(DetId const &)
static constexpr bool waferFull(int32_t type)
Definition: HGCalTypes.h:141
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
constexpr void unpack(int32_t &ty, int32_t &zs, int32_t &ly, int32_t &wU, int32_t &wV, int32_t &cU, int32_t &cV) const
std::vector< int > calibCellFullHD_
Definition: HGCalSD.h:65
double fraction_
Definition: HGCalSD.h:71
Definition: GenABIO.cc:168
const HGCalDDDConstants * hgcons_
Definition: HGCalSD.h:47
double calibCellRLD_
Definition: HGCalSD.h:64
#define M_PI
std::unique_ptr< HGCalCellOffset > cellOffset_
Definition: HGCalSD.h:53
std::vector< int > calibCellFullLD_
Definition: HGCalSD.h:66
int32_t waferV(const int32_t index)
double calibCellRHD_
Definition: HGCalSD.h:64
int layerType(int lay) const
static constexpr int32_t layerFrontBack(int32_t layerOrient)
Definition: HGCalTypes.h:137

◆ filterHit()

bool HGCalSD::filterHit ( CaloG4Hit aHit,
double  time 
)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 349 of file HGCalSD.cc.

References eminHit_, CaloG4Hit::getEnergyDeposit(), hcalRecHitTable_cff::time, and CaloSD::tmaxHit.

349  {
350  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > eminHit_));
351 }
double tmaxHit
Definition: CaloSD.h:148
double getEnergyDeposit() const
Definition: CaloG4Hit.h:79
double eminHit_
Definition: HGCalSD.h:57

◆ getEnergyDeposit()

double HGCalSD::getEnergyDeposit ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 110 of file HGCalSD.cc.

References funct::abs(), CaloSD::getResponseWt(), alignCSCRings::r, slopeMin_, weight_, and z.

110  {
111  double r = aStep->GetPreStepPoint()->GetPosition().perp();
112  double z = std::abs(aStep->GetPreStepPoint()->GetPosition().z());
113 #ifdef EDM_ML_DEBUG
114  G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
115  G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
116  G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
117  edm::LogVerbatim("HGCSim") << "HGCalSD: Hit from standard path from " << lv->GetName() << " for Track "
118  << aStep->GetTrack()->GetTrackID() << " (" << parCode << ":" << parName << ") R = " << r
119  << " Z = " << z << " slope = " << r / z << ":" << slopeMin_;
120 #endif
121  // Apply fiducial cut
122  if (r < z * slopeMin_) {
123 #ifdef EDM_ML_DEBUG
124  edm::LogVerbatim("HGCSim") << "HGCalSD: Fiducial Volume cut";
125 #endif
126  return 0.0;
127  }
128 
129  double wt1 = getResponseWt(aStep->GetTrack());
130  double wt2 = aStep->GetTrack()->GetWeight();
131  double destep = weight_ * wt1 * (aStep->GetTotalEnergyDeposit());
132  if (wt2 > 0)
133  destep *= wt2;
134 #ifdef EDM_ML_DEBUG
135  edm::LogVerbatim("HGCSim") << "HGCalSD: weights= " << weight_ << ":" << wt1 << ":" << wt2 << " Total weight "
136  << weight_ * wt1 * wt2 << " deStep: " << aStep->GetTotalEnergyDeposit() << ":" << destep;
137 #endif
138  return destep;
139 }
Log< level::Info, true > LogVerbatim
double slopeMin_
Definition: HGCalSD.h:57
double getResponseWt(const G4Track *, int k=0)
Definition: CaloSD.cc:929
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double weight_
Definition: HGCalSD.h:58

◆ initRun()

void HGCalSD::initRun ( )
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 347 of file HGCalSD.cc.

347 {}

◆ isItinFidVolume()

bool HGCalSD::isItinFidVolume ( const G4ThreeVector &  )
private

◆ processSecondHit()

void HGCalSD::processSecondHit ( const G4Step *  aStep,
const G4Track *  theTrack 
)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 353 of file HGCalSD.cc.

References calibCell_, CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, CaloSD::edepositEM, CaloSD::edepositHAD, fraction_, and CaloSD::hitExists().

353  {
354  if (calibCell_) {
355  float edEM(edepositEM), edHad(edepositHAD);
356  currentID[1] = currentID[0];
359  if (!hitExists(aStep, 1)) {
360  currentHit[1] = createNewHit(aStep, theTrack, 1);
361  }
362  edepositEM = edEM;
363  edepositHAD = edHad;
364  }
365 }
CaloG4Hit * currentHit[2]
Definition: CaloSD.h:152
float edepositEM
Definition: CaloSD.h:144
bool calibCell_
Definition: HGCalSD.h:70
CaloG4Hit * createNewHit(const G4Step *, const G4Track *, int k)
Definition: CaloSD.cc:625
float edepositHAD
Definition: CaloSD.h:144
double fraction_
Definition: HGCalSD.h:71
bool hitExists(const G4Step *, int k)
Definition: CaloSD.cc:463
CaloHitID currentID[2]
Definition: CaloSD.h:146

◆ setDetUnitId() [1/2]

uint32_t HGCalSD::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements CaloSD.

Definition at line 141 of file HGCalSD.cc.

References calibCell(), calibCell_, calibCells_, HGCalDDDConstants::cassetteShiftSilicon(), HGCSiliconDetId::cellU(), HGCSiliconDetId::cellV(), checkID_, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), angle_units::operators::convertRadToDeg(), debug, TauDecayModes::dec, change_name::diff, PVValHelper::dx, PVValHelper::dy, fiducialCut_, fraction_, guardRing_, guardRingPartial_, hgcons_, l1ctLayer2EG_cff::id, HGCalDDDConstants::isValidHex8(), nano_mu_digi_cff::layer, HGCSiliconDetId::layer(), HGCalTypes::layerFrontBack(), HGCalDDDConstants::layerType(), levelT1_, levelT2_, DTRecHitClients_cfi::local, HGCalDDDConstants::locateCell(), mouseBite_, CaloSD::printDetectorLevels(), rejectMB_, mathSSE::sqrt(), useSimWt_, verbose_, HGCalDDDConstants::waferFileInfo(), HGCalWaferIndex::waferIndex(), HGCalDDDConstants::waferTypeRotation(), HGCSiliconDetId::waferU(), HGCSiliconDetId::waferUV(), HGCSiliconDetId::waferV(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, and HGCSiliconDetId::zside().

141  {
142  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
143  const G4VTouchable* touch = preStepPoint->GetTouchable();
144  fraction_ = 1.0;
145  calibCell_ = false;
146  int dn = touch->GetHistoryDepth();
147 
148 #ifdef EDM_ML_DEBUG
149  edm::LogVerbatim("HGCSim") << "DepthsTop: " << dn << ":" << levelT1_ << ":" << levelT2_;
150  printDetectorLevels(touch);
151 #endif
152  //determine the exact position in global coordinates in the mass geometry
153  G4ThreeVector hitPoint = preStepPoint->GetPosition();
154  float globalZ = touch->GetTranslation(0).z();
155  int iz(globalZ > 0 ? 1 : -1);
156 
157  int layer(0), moduleLev(-1), cell(-1);
158  if (useSimWt_ > 0) {
159  layer = touch->GetReplicaNumber(2);
160  moduleLev = 1;
161  } else if (touch->GetHistoryDepth() > levelT2_) {
162  layer = touch->GetReplicaNumber(4);
163  cell = touch->GetReplicaNumber(1);
164  moduleLev = 3;
165  } else {
166  layer = touch->GetReplicaNumber(3);
167  moduleLev = 2;
168  }
169  int module = touch->GetReplicaNumber(moduleLev);
170  if (verbose_ && (cell == -1))
171  edm::LogVerbatim("HGCSim") << "Top " << touch->GetVolume(0)->GetName() << " Module "
172  << touch->GetVolume(moduleLev)->GetName();
173 #ifdef EDM_ML_DEBUG
174  edm::LogVerbatim("HGCSim") << "DepthsTop: " << touch->GetHistoryDepth() << ":" << levelT1_ << ":" << levelT2_ << ":"
175  << useSimWt_ << " name " << touch->GetVolume(0)->GetName() << " layer:module:cell "
176  << layer << ":" << moduleLev << ":" << module << ":" << cell;
177  printDetectorLevels(touch);
178  G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
179  edm::LogVerbatim("HGCSim") << "Depths: " << touch->GetHistoryDepth() << " name " << touch->GetVolume(0)->GetName()
180  << ":" << touch->GetReplicaNumber(0) << " " << touch->GetVolume(1)->GetName() << ":"
181  << touch->GetReplicaNumber(1) << " " << touch->GetVolume(2)->GetName() << ":"
182  << touch->GetReplicaNumber(2) << " " << touch->GetVolume(3)->GetName() << ":"
183  << touch->GetReplicaNumber(3) << " " << touch->GetVolume(4)->GetName() << ":"
184  << touch->GetReplicaNumber(4) << " "
185  << " layer:module:cell " << layer << ":" << module << ":" << cell << " Material "
186  << mat->GetName() << ":" << mat->GetRadlen();
187 #endif
188  // The following statement should be examined later before elimination
189  if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
190  return 0;
191 
192  uint32_t id = setDetUnitId(layer, module, cell, iz, hitPoint);
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("HGCSim") << "ID Layer " << layer << " Module " << module << " Cell " << cell << " " << std::hex
195  << id << std::dec << " " << HGCSiliconDetId(id);
196 #endif
197  if ((rejectMB_ || fiducialCut_) && id != 0) {
198  auto uv = HGCSiliconDetId(id).waferUV();
199 #ifdef EDM_ML_DEBUG
200  edm::LogVerbatim("HGCSim") << "ID " << std::hex << id << std::dec << " " << HGCSiliconDetId(id);
201 #endif
202  G4ThreeVector local = (touch->GetHistory()->GetTransform(dn - moduleLev).TransformPoint(hitPoint));
203 #ifdef EDM_ML_DEBUG
204  edm::LogVerbatim("HGCSim") << "Global Point " << hitPoint << " Down0 "
205  << touch->GetHistory()->GetTransform(dn).TransformPoint(hitPoint) << " Down1 "
206  << touch->GetHistory()->GetTransform(dn - 1).TransformPoint(hitPoint) << " Down2 "
207  << touch->GetHistory()->GetTransform(dn - 2).TransformPoint(hitPoint) << " Down3 "
208  << touch->GetHistory()->GetTransform(dn - 3).TransformPoint(hitPoint) << " Local "
209  << local;
210 #endif
211  if (fiducialCut_) {
212  int layertype = hgcons_->layerType(layer);
213  int frontBack = HGCalTypes::layerFrontBack(layertype);
214  if (guardRing_->exclude(local, iz, frontBack, layer, uv.first, uv.second) ||
215  guardRingPartial_->exclude(local, iz, frontBack, layer, uv.first, uv.second)) {
216  id = 0;
217 #ifdef EDM_ML_DEBUG
218  edm::LogVerbatim("HGCSim") << "Rejected by GuardRing cutoff *****";
219 #endif
220  }
221  }
222  if ((rejectMB_) && (mouseBite_->exclude(local, iz, layer, uv.first, uv.second))) {
223  id = 0;
224 #ifdef EDM_ML_DEBUG
225  edm::LogVerbatim("HGCSim") << "Rejected by MouseBite cutoff *****";
226 #endif
227  }
228  }
229 #ifdef EDM_ML_DEBUG
230  if (id != 0)
231  edm::LogVerbatim("HGCSim") << HGCSiliconDetId(id);
232 #endif
233  if ((id != 0) && checkID_) {
234  HGCSiliconDetId hid1(id);
235  bool cshift = (hgcons_->cassetteShiftSilicon(hid1.zside(), hid1.layer(), hid1.waferU(), hid1.waferV()));
236  std::string_view pid = (cshift ? "HGCSim" : "HGCalSim");
237  bool debug = (verbose_ > 0) ? true : false;
238  auto xy = hgcons_->locateCell(hid1, debug);
239  double xx = (hid1.zside() > 0) ? xy.first : -xy.first;
240  double dx = xx - (hitPoint.x() / CLHEP::cm);
241  double dy = xy.second - (hitPoint.y() / CLHEP::cm);
242  double diff = (dx * dx + dy * dy);
243  constexpr double tol = 2.0 * 2.0;
244  bool valid1 = hgcons_->isValidHex8(hid1.layer(), hid1.waferU(), hid1.waferV(), hid1.cellU(), hid1.cellV(), true);
245  if ((diff > tol) || (!valid1))
246  pid = "HGCalError";
247  auto partn = hgcons_->waferTypeRotation(hid1.layer(), hid1.waferU(), hid1.waferV(), false, false);
248  int indx = HGCalWaferIndex::waferIndex(layer, hid1.waferU(), hid1.waferV());
249  edm::LogVerbatim(pid) << "CheckID " << HGCSiliconDetId(id) << " Layer:Module:Cell:ModuleLev " << layer << ":"
250  << module << ":" << cell << ":" << moduleLev << " SimWt:history " << useSimWt_ << ":"
251  << touch->GetHistoryDepth() << ":" << levelT1_ << ":" << levelT2_ << " input position: ("
252  << hitPoint.x() / CLHEP::cm << ", " << hitPoint.y() / CLHEP::cm << ":"
253  << convertRadToDeg(std::atan2(hitPoint.y(), hitPoint.x())) << "); position from ID (" << xx
254  << ", " << xy.second << ") distance " << dx << ":" << dy << ":" << std::sqrt(diff)
255  << " Valid " << valid1 << " Wafer type|rotation " << partn.first << ":" << partn.second
256  << " Part:Orient:Cassette " << std::get<1>(hgcons_->waferFileInfo(indx)) << ":"
257  << std::get<2>(hgcons_->waferFileInfo(indx)) << ":"
258  << std::get<3>(hgcons_->waferFileInfo(indx)) << " CassetteShift " << cshift;
259  if ((diff > tol) || (!valid1)) {
260  printDetectorLevels(touch);
261  hgcons_->locateCell(hid1, true);
262  }
263  }
264 
265  if ((id != 0) && calibCells_)
266  calibCell_ = calibCell(id);
267 
268  return id;
269 }
int verbose_
Definition: HGCalSD.h:62
Log< level::Info, true > LogVerbatim
bool calibCell_
Definition: HGCalSD.h:70
int levelT2_
Definition: HGCalSD.h:59
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::pair< int, int > waferTypeRotation(int layer, int waferU, int waferV, bool fromFile, bool debug) const
bool isValidHex8(int lay, int waferU, int waferV, bool fullAndPart) const
bool calibCells_
Definition: HGCalSD.h:63
bool rejectMB_
Definition: HGCalSD.h:61
uint32_t setDetUnitId(const G4Step *step) override
Definition: HGCalSD.cc:141
std::tuple< int, int, int, int > waferFileInfo(unsigned int kk) const
T sqrt(T t)
Definition: SSEVec.h:23
double fraction_
Definition: HGCalSD.h:71
const HGCalDDDConstants * hgcons_
Definition: HGCalSD.h:47
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
bool checkID_
Definition: HGCalSD.h:61
bool calibCell(const uint32_t &id)
Definition: HGCalSD.cc:381
#define debug
Definition: HDRShower.cc:19
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
bool fiducialCut_
Definition: HGCalSD.h:61
void printDetectorLevels(const G4VTouchable *) const
Definition: CaloSD.cc:1159
std::unique_ptr< HGCGuardRingPartial > guardRingPartial_
Definition: HGCalSD.h:51
bool cassetteShiftSilicon(int zside, int layer, int waferU, int waferV) const
int useSimWt_
Definition: HGCalSD.h:62
std::unique_ptr< HGCGuardRing > guardRing_
Definition: HGCalSD.h:50
int levelT1_
Definition: HGCalSD.h:59
std::unique_ptr< HGCMouseBite > mouseBite_
Definition: HGCalSD.h:52
constexpr std::pair< int32_t, int32_t > waferUV() const
int layerType(int lay) const
static constexpr int32_t layerFrontBack(int32_t layerOrient)
Definition: HGCalTypes.h:137

◆ setDetUnitId() [2/2]

uint32_t HGCalSD::setDetUnitId ( int  layer,
int  module,
int  cell,
int  iz,
G4ThreeVector &  pos 
)
private

Definition at line 367 of file HGCalSD.cc.

References cornerMinMask_, hgcons_, l1ctLayer2EG_cff::id, CaloSD::ignoreRejection(), nano_mu_digi_cff::layer, HGCalDDDConstants::maskCell(), numberingScheme_, HGCalDDDConstants::waferHexagon8File(), and weight_.

367  {
368  uint32_t id = numberingScheme_ ? numberingScheme_->getUnitID(layer, module, cell, iz, pos, weight_) : 0;
369  if (cornerMinMask_ > 2) {
370  if (hgcons_->maskCell(DetId(id), cornerMinMask_)) {
371  id = 0;
372  ignoreRejection();
373  }
374  }
375  if (hgcons_->waferHexagon8File() || (id == 0))
376  ignoreRejection();
377 
378  return id;
379 }
bool maskCell(const DetId &id, int corners) const
std::unique_ptr< HGCalNumberingScheme > numberingScheme_
Definition: HGCalSD.h:49
void ignoreRejection()
Definition: CaloSD.h:112
const HGCalDDDConstants * hgcons_
Definition: HGCalSD.h:47
Definition: DetId.h:17
int cornerMinMask_
Definition: HGCalSD.h:59
bool waferHexagon8File() const
double weight_
Definition: HGCalSD.h:58

◆ update() [1/6]

void CaloSD::update
overrideprotected

Definition at line 750 of file CaloSD.cc.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

750 { initRun(); }
void initRun() override
Definition: HGCalSD.cc:347

◆ update() [2/6]

void CaloSD::update
overrideprotected

Definition at line 781 of file CaloSD.cc.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

781  {
782  endEvent();
783  for (int k = 0; k < nHC_; ++k) {
784  slave[k].get()->ReserveMemory(theHC[k]->entries());
785 
786  int count(0);
787  double eEM(0.0);
788  double eHAD(0.0);
789  double eEM2(0.0);
790  double eHAD2(0.0);
791 #ifdef EDM_ML_DEBUG
792  int wrong(0);
793  double tt(0.0);
794  double zloc(0.0);
795  double zglob(0.0);
796  double ee(0.0);
797 #endif
798  int hc_entries = theHC[k]->entries();
799  for (int i = 0; i < hc_entries; ++i) {
800 #ifdef EDM_ML_DEBUG
801  if (!saveHit((*theHC[k])[i], k)) {
802  ++wrong;
803  }
804 #else
805  saveHit((*theHC[k])[i], k);
806 #endif
807 
808  ++count;
809  double x = (*theHC[k])[i]->getEM();
810  eEM += x;
811  eEM2 += x * x;
812  x = (*theHC[k])[i]->getHadr();
813  eHAD += x;
814  eHAD2 += x * x;
815 #ifdef EDM_ML_DEBUG
816  tt += (*theHC[k])[i]->getTimeSlice();
817  ee += (*theHC[k])[i]->getIncidentEnergy();
818  zglob += std::abs((*theHC[k])[i]->getEntry().z());
819  zloc += std::abs((*theHC[k])[i]->getEntryLocal().z());
820 #endif
821  }
822 
823  double norm = (count > 0) ? 1.0 / count : 0.0;
824  eEM *= norm;
825  eEM2 *= norm;
826  eHAD *= norm;
827  eHAD2 *= norm;
828  eEM2 = std::sqrt(eEM2 - eEM * eEM);
829  eHAD2 = std::sqrt(eHAD2 - eHAD * eHAD);
830 #ifdef EDM_ML_DEBUG
831  tt *= norm;
832  ee *= norm;
833  zglob *= norm;
834  zloc *= norm;
835  edm::LogVerbatim("CaloSim") << "CaloSD: " << GetName() << " store " << count << " hits; " << wrong
836  << " track IDs not given properly and " << totalHits - count
837  << " hits not passing cuts\n EmeanEM= " << eEM << " ErmsEM= " << eEM2
838  << "\n EmeanHAD= " << eHAD << " ErmsHAD= " << eHAD2 << " TimeMean= " << tt
839  << " E0mean= " << ee << " Zglob= " << zglob << " Zloc= " << zloc << " ";
840 #endif
841  std::vector<std::unique_ptr<CaloG4Hit>>().swap(reusehit[k]);
842  if (useMap)
843  hitMap[k].erase(hitMap[k].begin(), hitMap[k].end());
844  }
845  tkMap.erase(tkMap.begin(), tkMap.end());
847 }
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:527
Log< level::Info, true > LogVerbatim
std::map< CaloHitID, CaloG4Hit * > hitMap[2]
Definition: CaloSD.h:195
bool useMap
Definition: CaloSD.h:179
CaloG4HitCollection * theHC[2]
Definition: CaloSD.h:174
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
bool saveHit(CaloG4Hit *, int k=0)
Definition: CaloSD.cc:950
std::unordered_map< unsigned int, unsigned int > boundaryCrossingParentMap_
Definition: CaloSD.h:197
int nHC_
Definition: CaloSD.h:158
Definition: TTTypes.h:54
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::unique_ptr< CaloG4Hit > > reusehit[2]
Definition: CaloSD.h:198
int totalHits[2]
Definition: CaloSD.h:185
virtual void endEvent()
Definition: CaloSD.cc:872
std::map< int, TrackWithHistory * > tkMap
Definition: CaloSD.h:196
std::unique_ptr< CaloSlaveSD > slave[2]
Definition: CaloSD.h:171

◆ update() [3/6]

void CaloSD::update
overrideprotected

Definition at line 760 of file CaloSD.cc.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

760  {
761  int id = (*trk)()->GetTrackID();
762  TrackInformation* trkI = cmsTrackInformation((*trk)());
763  int lastTrackID = -1;
764  if (trkI)
765  lastTrackID = trkI->getIDonCaloSurface();
766  if (id == lastTrackID) {
767  auto trksForThisEvent = m_trackManager->trackContainer();
768  if (!trksForThisEvent->empty()) {
769  TrackWithHistory* trkH = trksForThisEvent->back();
770  if (trkH->trackID() == id) {
771  tkMap[id] = trkH;
772 #ifdef EDM_ML_DEBUG
773  edm::LogVerbatim("CaloSim") << "CaloSD: get track " << id << " from Container of size "
774  << trksForThisEvent->size() << " with ID " << trkH->trackID();
775 #endif
776  }
777  }
778  }
779 }
Log< level::Info, true > LogVerbatim
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
int getIDonCaloSurface() const
const std::vector< TrackWithHistory * > * trackContainer() const
int trackID() const
std::map< int, TrackWithHistory * > tkMap
Definition: CaloSD.h:196
const SimTrackManager * m_trackManager
Definition: CaloSD.h:169

◆ update() [4/6]

void CaloSD::update
overrideprotected

Definition at line 752 of file CaloSD.cc.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

752  {
753 #ifdef EDM_ML_DEBUG
754  edm::LogVerbatim("CaloSim") << "CaloSD: Dispatched BeginOfEvent for " << GetName() << " !";
755 #endif
756  clearHits();
757  initEvent(g4Event);
758 }
Log< level::Info, true > LogVerbatim
virtual void initEvent(const BeginOfEvent *)
Definition: CaloSD.cc:870
void clearHits() override
Definition: CaloSD.cc:849

◆ update() [5/6]

void CaloSD::update
overrideprotected

Definition at line 1014 of file CaloSD.cc.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

1014  {
1015  int primary = -1;
1016  TrackInformation* trkInfo = cmsTrackInformation((*trk)());
1017  if (trkInfo->isPrimary())
1018  primary = (*trk)()->GetTrackID();
1019 
1020 #ifdef EDM_ML_DEBUG
1021  edm::LogVerbatim("CaloSim") << "New track: isPrimary " << trkInfo->isPrimary() << " primary ID = " << primary
1022  << " primary ancestor ID " << primAncestor;
1023 #endif
1024 
1025  // update the information if a different primary track ID
1026 
1027  if (primary > 0 && primary != primAncestor) {
1028  primAncestor = primary;
1029 
1030  // clean the hits information
1031 
1032  bool clean(false);
1033  for (int k = 0; k < nHC_; ++k)
1034  if (theHC[k]->entries() > 0)
1035  clean = true;
1036  if (clean)
1038  }
1039 }
Log< level::Info, true > LogVerbatim
bool isPrimary() const
CaloG4HitCollection * theHC[2]
Definition: CaloSD.h:174
int primAncestor
Definition: CaloSD.h:183
void cleanHitCollection()
Definition: CaloSD.cc:1041
static void clean(char *s)
int nHC_
Definition: CaloSD.h:158
TrackInformation * cmsTrackInformation(const G4Track *aTrack)

◆ update() [6/6]

void HGCalSD::update ( const BeginOfJob )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob *>.

Definition at line 271 of file HGCalSD.cc.

References angles_, calibCellFullHD_, calibCellFullLD_, calibCellPartHD_, calibCellPartLD_, HGCalDDDConstants::calibCellRad(), calibCellRHD_, calibCellRLD_, HGCalDDDConstants::calibCells(), calibCells_, cellOffset_, CaloSD::collName_, cos30deg_, dd4hep_, Exception, fiducialCut_, geom_mode_, HGCalDDDConstants::geomMode(), HGCalDDDConstants::getParameter(), HGCalDDDConstants::getUVMax(), guardRing_, HGCalDDDConstants::guardRingOffset(), guardRingOffset_, guardRingPartial_, hgcons_, levelT1_, levelT2_, HGCalDDDConstants::levelTop(), HGCalDDDConstants::minSlope(), missingFile_, HGCalDDDConstants::mouseBite(), mouseBite_, mouseBiteCut_, mydet_, nameX_, CaloSD::newCollection(), CaloSD::nHC_, numberingScheme_, ps_, rejectMB_, HGCalDDDConstants::sensorSizeOffset(), sensorSizeOffset_, slopeMin_, tan30deg_, HGCalParameters::useOffset_, useSimWt_, HGCalParameters::useSimWt_, waferRot_, HGCalDDDConstants::waferSize(), and waferSize_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

271  {
272  if (hgcons_ != nullptr) {
275  levelT1_ = hgcons_->levelTop(0);
276  levelT2_ = hgcons_->levelTop(1);
277  if (dd4hep_) {
278  ++levelT1_;
279  ++levelT2_;
280  }
282  int useOffset = hgcons_->getParameter()->useOffset_;
283  waferSize_ = hgcons_->waferSize(false);
284  double mouseBite = hgcons_->mouseBite(false);
287  if (useOffset > 0) {
288  rejectMB_ = true;
289  fiducialCut_ = true;
290  }
291  double mouseBiteNew = (fiducialCut_) ? (mouseBite + guardRingOffset_ + sensorSizeOffset_ / cos30deg_) : mouseBite;
292  mouseBiteCut_ = waferSize_ * tan30deg_ - mouseBiteNew;
293 #ifdef EDM_ML_DEBUG
294  edm::LogVerbatim("HGCSim") << "HGCalSD::Initialized with mode " << geom_mode_ << " Slope cut " << slopeMin_
295  << " top Level " << levelT1_ << ":" << levelT2_ << " useSimWt " << useSimWt_ << " wafer "
296  << waferSize_ << ":" << mouseBite << ":" << guardRingOffset_ << ":" << sensorSizeOffset_
297  << ":" << mouseBiteNew << ":" << mouseBiteCut_ << " useOffset " << useOffset
298  << " dd4hep " << dd4hep_;
299 #endif
300 
301  numberingScheme_ = std::make_unique<HGCalNumberingScheme>(*hgcons_, mydet_, nameX_, missingFile_);
302  if (rejectMB_)
303  mouseBite_ = std::make_unique<HGCMouseBite>(*hgcons_, angles_, mouseBiteCut_, waferRot_);
304  if (fiducialCut_) {
305  guardRing_ = std::make_unique<HGCGuardRing>(*hgcons_);
306  guardRingPartial_ = std::make_unique<HGCGuardRingPartial>(*hgcons_);
307  }
308 
309  //Now for calibration cells
312  calibCellFullHD_ = hgcons_->calibCells(true, true);
313  calibCellPartHD_ = hgcons_->calibCells(true, false);
314  calibCellFullLD_ = hgcons_->calibCells(false, true);
315  calibCellPartLD_ = hgcons_->calibCells(false, false);
316  calibCells_ = ((!calibCellFullHD_.empty()) || (!calibCellPartHD_.empty()));
317  calibCells_ |= ((!calibCellFullLD_.empty()) || (!calibCellPartLD_.empty()));
318 #ifdef EDM_ML_DEBUG
319  edm::LogVerbatim("HGCSim") << "HGCalSD::Calibration cells initialized with flag " << calibCells_;
320  edm::LogVerbatim("HGCSim") << " Radii " << calibCellRHD_ << ":" << calibCellRLD_;
321  std::ostringstream st1;
322  for (const auto& cell : calibCellFullHD_)
323  st1 << " " << cell;
324  edm::LogVerbatim("HGCSim") << calibCellFullHD_.size() << " cells for High Density full wafers: " << st1.str();
325  std::ostringstream st2;
326  for (const auto& cell : calibCellPartHD_)
327  st2 << " " << cell;
328  edm::LogVerbatim("HGCSim") << calibCellPartHD_.size() << " cells for High Density partial wafers: " << st2.str();
329  std::ostringstream st3;
330  for (const auto& cell : calibCellFullLD_)
331  st3 << " " << cell;
332  edm::LogVerbatim("HGCSim") << calibCellFullLD_.size() << " cells for Low Density full wafers: " << st3.str();
333  std::ostringstream st4;
334  for (const auto& cell : calibCellPartLD_)
335  st4 << " " << cell;
336  edm::LogVerbatim("HGCSim") << calibCellPartLD_.size() << " cells for Low Density partial wafers: " << st4.str();
337 #endif
338  } else {
339  throw cms::Exception("Unknown", "HGCalSD") << "Cannot find HGCalDDDConstants for " << nameX_ << "\n";
340  }
341  if ((nHC_ > 1) && calibCells_)
343  cellOffset_ = std::make_unique<HGCalCellOffset>(
345 }
Log< level::Info, true > LogVerbatim
int levelT2_
Definition: HGCalSD.h:59
edm::ParameterSet const & ps_
Definition: HGCalSD.h:48
std::vector< int > calibCellPartLD_
Definition: HGCalSD.h:66
double slopeMin_
Definition: HGCalSD.h:57
const HGCalParameters * getParameter() const
std::vector< int > calibCellPartHD_
Definition: HGCalSD.h:65
void newCollection(const std::string &name, edm::ParameterSet const &p)
Definition: CaloSD.cc:177
std::unique_ptr< HGCalNumberingScheme > numberingScheme_
Definition: HGCalSD.h:49
std::string nameX_
Definition: HGCalSD.h:55
double mouseBiteCut_
Definition: HGCalSD.h:58
HGCalGeometryMode::GeometryMode geomMode() const
int nHC_
Definition: CaloSD.h:158
bool calibCells_
Definition: HGCalSD.h:63
bool rejectMB_
Definition: HGCalSD.h:61
DetId::Detector mydet_
Definition: HGCalSD.h:54
std::vector< int > calibCellFullHD_
Definition: HGCalSD.h:65
const double cos30deg_
Definition: HGCalSD.h:67
std::string missingFile_
Definition: HGCalSD.h:69
std::vector< double > angles_
Definition: HGCalSD.h:68
const HGCalDDDConstants * hgcons_
Definition: HGCalSD.h:47
int getUVMax(int type) const
const double tan30deg_
Definition: HGCalSD.h:67
double mouseBite(bool reco) const
bool waferRot_
Definition: HGCalSD.h:61
double waferSize_
Definition: HGCalSD.h:58
bool dd4hep_
Definition: HGCalSD.h:63
double calibCellRLD_
Definition: HGCalSD.h:64
double minSlope() const
HGCalGeometryMode::GeometryMode geom_mode_
Definition: HGCalSD.h:56
std::unique_ptr< HGCalCellOffset > cellOffset_
Definition: HGCalSD.h:53
bool fiducialCut_
Definition: HGCalSD.h:61
std::unique_ptr< HGCGuardRingPartial > guardRingPartial_
Definition: HGCalSD.h:51
std::vector< int > calibCellFullLD_
Definition: HGCalSD.h:66
std::vector< int > calibCells(bool hd, bool full) const
double guardRingOffset(bool reco) const
std::string collName_[2]
Definition: CaloSD.h:159
int useSimWt_
Definition: HGCalSD.h:62
double sensorSizeOffset_
Definition: HGCalSD.h:58
std::unique_ptr< HGCGuardRing > guardRing_
Definition: HGCalSD.h:50
double sensorSizeOffset(bool reco) const
int levelT1_
Definition: HGCalSD.h:59
double calibCellRad(bool hd) const
double guardRingOffset_
Definition: HGCalSD.h:58
std::unique_ptr< HGCMouseBite > mouseBite_
Definition: HGCalSD.h:52
int levelTop(int ind=0) const
double calibCellRHD_
Definition: HGCalSD.h:64
double waferSize(bool reco) const

Member Data Documentation

◆ angles_

std::vector<double> HGCalSD::angles_
private

Definition at line 68 of file HGCalSD.h.

Referenced by HGCalSD(), and update().

◆ calibCell_

bool HGCalSD::calibCell_
private

Definition at line 70 of file HGCalSD.h.

Referenced by processSecondHit(), and setDetUnitId().

◆ calibCellFullHD_

std::vector<int> HGCalSD::calibCellFullHD_
private

Definition at line 65 of file HGCalSD.h.

Referenced by calibCell(), and update().

◆ calibCellFullLD_

std::vector<int> HGCalSD::calibCellFullLD_
private

Definition at line 66 of file HGCalSD.h.

Referenced by calibCell(), and update().

◆ calibCellPartHD_

std::vector<int> HGCalSD::calibCellPartHD_
private

Definition at line 65 of file HGCalSD.h.

Referenced by calibCell(), and update().

◆ calibCellPartLD_

std::vector<int> HGCalSD::calibCellPartLD_
private

Definition at line 66 of file HGCalSD.h.

Referenced by calibCell(), and update().

◆ calibCellRHD_

double HGCalSD::calibCellRHD_
private

Definition at line 64 of file HGCalSD.h.

Referenced by calibCell(), and update().

◆ calibCellRLD_

double HGCalSD::calibCellRLD_
private

Definition at line 64 of file HGCalSD.h.

Referenced by calibCell(), and update().

◆ calibCells_

bool HGCalSD::calibCells_
private

Definition at line 63 of file HGCalSD.h.

Referenced by setDetUnitId(), and update().

◆ cellOffset_

std::unique_ptr<HGCalCellOffset> HGCalSD::cellOffset_
private

Definition at line 53 of file HGCalSD.h.

Referenced by calibCell(), HGCalSD(), and update().

◆ checkID_

bool HGCalSD::checkID_
private

Definition at line 61 of file HGCalSD.h.

Referenced by HGCalSD(), and setDetUnitId().

◆ cornerMinMask_

int HGCalSD::cornerMinMask_
private

Definition at line 59 of file HGCalSD.h.

Referenced by HGCalSD(), and setDetUnitId().

◆ cos30deg_

const double HGCalSD::cos30deg_
private

Definition at line 67 of file HGCalSD.h.

Referenced by update().

◆ dd4hep_

bool HGCalSD::dd4hep_
private

Definition at line 63 of file HGCalSD.h.

Referenced by HGCalSD(), and update().

◆ distanceFromEdge_

double HGCalSD::distanceFromEdge_
private

Definition at line 57 of file HGCalSD.h.

Referenced by HGCalSD().

◆ eminHit_

double HGCalSD::eminHit_
private

Definition at line 57 of file HGCalSD.h.

Referenced by filterHit(), and HGCalSD().

◆ fiducialCut_

bool HGCalSD::fiducialCut_
private

Definition at line 61 of file HGCalSD.h.

Referenced by HGCalSD(), setDetUnitId(), and update().

◆ fraction_

double HGCalSD::fraction_
private

Definition at line 71 of file HGCalSD.h.

Referenced by calibCell(), processSecondHit(), and setDetUnitId().

◆ geom_mode_

HGCalGeometryMode::GeometryMode HGCalSD::geom_mode_
private

Definition at line 56 of file HGCalSD.h.

Referenced by update().

◆ guardRing_

std::unique_ptr<HGCGuardRing> HGCalSD::guardRing_
private

Definition at line 50 of file HGCalSD.h.

Referenced by HGCalSD(), setDetUnitId(), and update().

◆ guardRingOffset_

double HGCalSD::guardRingOffset_
private

Definition at line 58 of file HGCalSD.h.

Referenced by update().

◆ guardRingPartial_

std::unique_ptr<HGCGuardRingPartial> HGCalSD::guardRingPartial_
private

Definition at line 51 of file HGCalSD.h.

Referenced by HGCalSD(), setDetUnitId(), and update().

◆ hgcons_

const HGCalDDDConstants* HGCalSD::hgcons_
private

Definition at line 47 of file HGCalSD.h.

Referenced by calibCell(), setDetUnitId(), and update().

◆ levelT1_

int HGCalSD::levelT1_
private

Definition at line 59 of file HGCalSD.h.

Referenced by setDetUnitId(), and update().

◆ levelT2_

int HGCalSD::levelT2_
private

Definition at line 59 of file HGCalSD.h.

Referenced by setDetUnitId(), and update().

◆ missingFile_

std::string HGCalSD::missingFile_
private

Definition at line 69 of file HGCalSD.h.

Referenced by HGCalSD(), and update().

◆ mouseBite_

std::unique_ptr<HGCMouseBite> HGCalSD::mouseBite_
private

Definition at line 52 of file HGCalSD.h.

Referenced by HGCalSD(), setDetUnitId(), and update().

◆ mouseBiteCut_

double HGCalSD::mouseBiteCut_
private

Definition at line 58 of file HGCalSD.h.

Referenced by update().

◆ mydet_

DetId::Detector HGCalSD::mydet_
private

Definition at line 54 of file HGCalSD.h.

Referenced by HGCalSD(), and update().

◆ myName_

std::string HGCalSD::myName_
private

Definition at line 46 of file HGCalSD.h.

Referenced by HGCalSD().

◆ nameX_

std::string HGCalSD::nameX_
private

Definition at line 55 of file HGCalSD.h.

Referenced by HGCalSD(), and update().

◆ numberingScheme_

std::unique_ptr<HGCalNumberingScheme> HGCalSD::numberingScheme_
private

Definition at line 49 of file HGCalSD.h.

Referenced by HGCalSD(), setDetUnitId(), and update().

◆ ps_

edm::ParameterSet const& HGCalSD::ps_
private

Definition at line 48 of file HGCalSD.h.

Referenced by update().

◆ rejectMB_

bool HGCalSD::rejectMB_
private

Definition at line 61 of file HGCalSD.h.

Referenced by HGCalSD(), setDetUnitId(), and update().

◆ sensorSizeOffset_

double HGCalSD::sensorSizeOffset_
private

Definition at line 58 of file HGCalSD.h.

Referenced by update().

◆ slopeMin_

double HGCalSD::slopeMin_
private

Definition at line 57 of file HGCalSD.h.

Referenced by getEnergyDeposit(), and update().

◆ storeAllG4Hits_

bool HGCalSD::storeAllG4Hits_
private

Definition at line 60 of file HGCalSD.h.

Referenced by HGCalSD().

◆ tan30deg_

const double HGCalSD::tan30deg_
private

Definition at line 67 of file HGCalSD.h.

Referenced by update().

◆ useSimWt_

int HGCalSD::useSimWt_
private

Definition at line 62 of file HGCalSD.h.

Referenced by setDetUnitId(), and update().

◆ verbose_

int HGCalSD::verbose_
private

Definition at line 62 of file HGCalSD.h.

Referenced by HGCalSD(), and setDetUnitId().

◆ waferRot_

bool HGCalSD::waferRot_
private

Definition at line 61 of file HGCalSD.h.

Referenced by HGCalSD(), and update().

◆ waferSize_

double HGCalSD::waferSize_
private

Definition at line 58 of file HGCalSD.h.

Referenced by update().

◆ weight_

double HGCalSD::weight_
private

Definition at line 58 of file HGCalSD.h.

Referenced by getEnergyDeposit(), and setDetUnitId().