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 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:33
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 377 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().

377  {
378  bool flag(false);
379  int type, zside, layer, waferU, waferV, cellU, cellV;
380  HGCSiliconDetId(id).unpack(type, zside, layer, waferU, waferV, cellU, cellV);
382  bool hd = HGCalTypes::waferHD(info.type);
383  bool full = HGCalTypes::waferFull(info.part);
384  int indx = 100 * cellU + cellV;
385  if (hd) {
386  if (full)
387  flag = (std::find(calibCellFullHD_.begin(), calibCellFullHD_.end(), indx) != calibCellFullHD_.end());
388  else
389  flag = (std::find(calibCellPartHD_.begin(), calibCellPartHD_.end(), indx) != calibCellPartHD_.end());
390  } else {
391  if (full)
392  flag = (std::find(calibCellFullLD_.begin(), calibCellFullLD_.end(), indx) != calibCellFullLD_.end());
393  else
394  flag = (std::find(calibCellPartLD_.begin(), calibCellPartLD_.end(), indx) != calibCellPartLD_.end());
395  }
396  if (flag) {
397  int32_t place =
399  int32_t type = hd ? 0 : 1;
400  double num = hd ? (M_PI * calibCellRHD_ * calibCellRHD_) : (M_PI * calibCellRLD_ * calibCellRLD_);
401  double bot = cellOffset_->cellAreaUV(cellU, cellV, place, type, true);
402  fraction_ = (bot > 0 && bot > num) ? (num / bot) : 1.0;
403 #ifdef EDM_ML_DEBUG
404  edm::LogVerbatim("HGCSim") << HGCSiliconDetId(id) << " CalibrationCell flag " << flag << " and fraction " << num
405  << ":" << bot << ":" << fraction_;
406 #endif
407  } else {
408 #ifdef EDM_ML_DEBUG
409  edm::LogVerbatim("HGCSim") << HGCSiliconDetId(id) << " CalibrationCell flag " << flag;
410 #endif
411  }
412  return flag;
413 }
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
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 345 of file HGCalSD.cc.

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

345  {
346  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > eminHit_));
347 }
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:928
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 343 of file HGCalSD.cc.

343 {}

◆ isItinFidVolume()

bool HGCalSD::isItinFidVolume ( const G4ThreeVector &  )
private

◆ processSecondHit()

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

Reimplemented from CaloSD.

Definition at line 349 of file HGCalSD.cc.

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

349  {
350  if (calibCell_) {
351  float edEM(edepositEM), edHad(edepositHAD);
352  currentID[1] = currentID[0];
355  if (!hitExists(aStep, 1)) {
356  currentHit[1] = createNewHit(aStep, theTrack, 1);
357  }
358  edepositEM = edEM;
359  edepositHAD = edHad;
360  }
361 }
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:624
float edepositHAD
Definition: CaloSD.h:144
double fraction_
Definition: HGCalSD.h:71
bool hitExists(const G4Step *, int k)
Definition: CaloSD.cc:462
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  if ((rejectMB_ || fiducialCut_) && id != 0) {
194  auto uv = HGCSiliconDetId(id).waferUV();
195 #ifdef EDM_ML_DEBUG
196  edm::LogVerbatim("HGCSim") << "ID " << std::hex << id << std::dec << " " << HGCSiliconDetId(id);
197 #endif
198  G4ThreeVector local = (touch->GetHistory()->GetTransform(dn - moduleLev).TransformPoint(hitPoint));
199 #ifdef EDM_ML_DEBUG
200  edm::LogVerbatim("HGCSim") << "Global Point " << hitPoint << " Down0 "
201  << touch->GetHistory()->GetTransform(dn).TransformPoint(hitPoint) << " Down1 "
202  << touch->GetHistory()->GetTransform(dn - 1).TransformPoint(hitPoint) << " Down2 "
203  << touch->GetHistory()->GetTransform(dn - 2).TransformPoint(hitPoint) << " Down3 "
204  << touch->GetHistory()->GetTransform(dn - 3).TransformPoint(hitPoint) << " Local "
205  << local;
206 #endif
207  if (fiducialCut_) {
208  int layertype = hgcons_->layerType(layer);
209  int frontBack = HGCalTypes::layerFrontBack(layertype);
210  if (guardRing_->exclude(local, iz, frontBack, layer, uv.first, uv.second) ||
211  guardRingPartial_->exclude(local, iz, frontBack, layer, uv.first, uv.second)) {
212  id = 0;
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("HGCSim") << "Rejected by GuardRing cutoff *****";
215 #endif
216  }
217  }
218  if ((rejectMB_) && (mouseBite_->exclude(local, iz, layer, uv.first, uv.second))) {
219  id = 0;
220 #ifdef EDM_ML_DEBUG
221  edm::LogVerbatim("HGCSim") << "Rejected by MouseBite cutoff *****";
222 #endif
223  }
224  }
225 #ifdef EDM_ML_DEBUG
226  if (id != 0)
227  edm::LogVerbatim("HGCSim") << HGCSiliconDetId(id);
228 #endif
229  if ((id != 0) && checkID_) {
230  HGCSiliconDetId hid1(id);
231  bool cshift = (hgcons_->cassetteShiftSilicon(hid1.zside(), hid1.layer(), hid1.waferU(), hid1.waferV()));
232  std::string_view pid = (cshift ? "HGCSim" : "HGCalSim");
233  bool debug = (verbose_ > 0) ? true : false;
234  auto xy = hgcons_->locateCell(hid1, debug);
235  double xx = (hid1.zside() > 0) ? xy.first : -xy.first;
236  double dx = xx - (hitPoint.x() / CLHEP::cm);
237  double dy = xy.second - (hitPoint.y() / CLHEP::cm);
238  double diff = (dx * dx + dy * dy);
239  constexpr double tol = 2.0 * 2.0;
240  bool valid1 = hgcons_->isValidHex8(hid1.layer(), hid1.waferU(), hid1.waferV(), hid1.cellU(), hid1.cellV(), true);
241  if ((diff > tol) || (!valid1))
242  pid = "HGCalError";
243  auto partn = hgcons_->waferTypeRotation(hid1.layer(), hid1.waferU(), hid1.waferV(), false, false);
244  int indx = HGCalWaferIndex::waferIndex(layer, hid1.waferU(), hid1.waferV());
245  edm::LogVerbatim(pid) << "CheckID " << HGCSiliconDetId(id) << " Layer:Module:Cell:ModuleLev " << layer << ":"
246  << module << ":" << cell << ":" << moduleLev << " SimWt:history " << useSimWt_ << ":"
247  << touch->GetHistoryDepth() << ":" << levelT1_ << ":" << levelT2_ << " input position: ("
248  << hitPoint.x() / CLHEP::cm << ", " << hitPoint.y() / CLHEP::cm << ":"
249  << convertRadToDeg(std::atan2(hitPoint.y(), hitPoint.x())) << "); position from ID (" << xx
250  << ", " << xy.second << ") distance " << dx << ":" << dy << ":" << std::sqrt(diff)
251  << " Valid " << valid1 << " Wafer type|rotation " << partn.first << ":" << partn.second
252  << " Part:Orient:Cassette " << std::get<1>(hgcons_->waferFileInfo(indx)) << ":"
253  << std::get<2>(hgcons_->waferFileInfo(indx)) << ":"
254  << std::get<3>(hgcons_->waferFileInfo(indx)) << " CassetteShift " << cshift;
255  if ((diff > tol) || (!valid1)) {
256  printDetectorLevels(touch);
257  hgcons_->locateCell(hid1, true);
258  }
259  }
260 
261  if ((id != 0) && calibCells_)
262  calibCell_ = calibCell(id);
263 
264  return id;
265 }
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:19
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:377
#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:1158
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 363 of file HGCalSD.cc.

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

363  {
364  uint32_t id = numberingScheme_ ? numberingScheme_->getUnitID(layer, module, cell, iz, pos, weight_) : 0;
365  if (cornerMinMask_ > 2) {
366  if (hgcons_->maskCell(DetId(id), cornerMinMask_)) {
367  id = 0;
368  ignoreRejection();
369  }
370  }
371  if (hgcons_->waferHexagon8File() || (id == 0))
372  ignoreRejection();
373 
374  return id;
375 }
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 749 of file CaloSD.cc.

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

749 { initRun(); }
void initRun() override
Definition: HGCalSD.cc:343

◆ update() [2/6]

void CaloSD::update
overrideprotected

Definition at line 780 of file CaloSD.cc.

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

780  {
781  endEvent();
782  for (int k = 0; k < nHC_; ++k) {
783  slave[k].get()->ReserveMemory(theHC[k]->entries());
784 
785  int count(0);
786  double eEM(0.0);
787  double eHAD(0.0);
788  double eEM2(0.0);
789  double eHAD2(0.0);
790 #ifdef EDM_ML_DEBUG
791  int wrong(0);
792  double tt(0.0);
793  double zloc(0.0);
794  double zglob(0.0);
795  double ee(0.0);
796 #endif
797  int hc_entries = theHC[k]->entries();
798  for (int i = 0; i < hc_entries; ++i) {
799 #ifdef EDM_ML_DEBUG
800  if (!saveHit((*theHC[k])[i], k)) {
801  ++wrong;
802  }
803 #else
804  saveHit((*theHC[k])[i], k);
805 #endif
806 
807  ++count;
808  double x = (*theHC[k])[i]->getEM();
809  eEM += x;
810  eEM2 += x * x;
811  x = (*theHC[k])[i]->getHadr();
812  eHAD += x;
813  eHAD2 += x * x;
814 #ifdef EDM_ML_DEBUG
815  tt += (*theHC[k])[i]->getTimeSlice();
816  ee += (*theHC[k])[i]->getIncidentEnergy();
817  zglob += std::abs((*theHC[k])[i]->getEntry().z());
818  zloc += std::abs((*theHC[k])[i]->getEntryLocal().z());
819 #endif
820  }
821 
822  double norm = (count > 0) ? 1.0 / count : 0.0;
823  eEM *= norm;
824  eEM2 *= norm;
825  eHAD *= norm;
826  eHAD2 *= norm;
827  eEM2 = std::sqrt(eEM2 - eEM * eEM);
828  eHAD2 = std::sqrt(eHAD2 - eHAD * eHAD);
829 #ifdef EDM_ML_DEBUG
830  tt *= norm;
831  ee *= norm;
832  zglob *= norm;
833  zloc *= norm;
834  edm::LogVerbatim("CaloSim") << "CaloSD: " << GetName() << " store " << count << " hits; " << wrong
835  << " track IDs not given properly and " << totalHits - count
836  << " hits not passing cuts\n EmeanEM= " << eEM << " ErmsEM= " << eEM2
837  << "\n EmeanHAD= " << eHAD << " ErmsHAD= " << eHAD2 << " TimeMean= " << tt
838  << " E0mean= " << ee << " Zglob= " << zglob << " Zloc= " << zloc << " ";
839 #endif
840  std::vector<std::unique_ptr<CaloG4Hit>>().swap(reusehit[k]);
841  if (useMap)
842  hitMap[k].erase(hitMap[k].begin(), hitMap[k].end());
843  }
844  tkMap.erase(tkMap.begin(), tkMap.end());
846 }
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:949
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:19
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:871
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 759 of file CaloSD.cc.

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

759  {
760  int id = (*trk)()->GetTrackID();
761  TrackInformation* trkI = cmsTrackInformation((*trk)());
762  int lastTrackID = -1;
763  if (trkI)
764  lastTrackID = trkI->getIDonCaloSurface();
765  if (id == lastTrackID) {
766  auto trksForThisEvent = m_trackManager->trackContainer();
767  if (!trksForThisEvent->empty()) {
768  TrackWithHistory* trkH = trksForThisEvent->back();
769  if (trkH->trackID() == id) {
770  tkMap[id] = trkH;
771 #ifdef EDM_ML_DEBUG
772  edm::LogVerbatim("CaloSim") << "CaloSD: get track " << id << " from Container of size "
773  << trksForThisEvent->size() << " with ID " << trkH->trackID();
774 #endif
775  }
776  }
777  }
778 }
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 751 of file CaloSD.cc.

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

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

◆ update() [5/6]

void CaloSD::update
overrideprotected

Definition at line 1013 of file CaloSD.cc.

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

1013  {
1014  int primary = -1;
1015  TrackInformation* trkInfo = cmsTrackInformation((*trk)());
1016  if (trkInfo->isPrimary())
1017  primary = (*trk)()->GetTrackID();
1018 
1019 #ifdef EDM_ML_DEBUG
1020  edm::LogVerbatim("CaloSim") << "New track: isPrimary " << trkInfo->isPrimary() << " primary ID = " << primary
1021  << " primary ancestor ID " << primAncestor;
1022 #endif
1023 
1024  // update the information if a different primary track ID
1025 
1026  if (primary > 0 && primary != primAncestor) {
1027  primAncestor = primary;
1028 
1029  // clean the hits information
1030 
1031  bool clean(false);
1032  for (int k = 0; k < nHC_; ++k)
1033  if (theHC[k]->entries() > 0)
1034  clean = true;
1035  if (clean)
1037  }
1038 }
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:1040
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 267 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(), 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().

267  {
268  if (hgcons_ != nullptr) {
271  levelT1_ = hgcons_->levelTop(0);
272  levelT2_ = hgcons_->levelTop(1);
273  if (dd4hep_) {
274  ++levelT1_;
275  ++levelT2_;
276  }
278  int useOffset = hgcons_->getParameter()->useOffset_;
279  waferSize_ = hgcons_->waferSize(false);
280  double mouseBite = hgcons_->mouseBite(false);
282  double sensorSizeOffset = hgcons_->sensorSizeOffset(false);
283  if (useOffset > 0) {
284  rejectMB_ = true;
285  fiducialCut_ = true;
286  }
287  double mouseBiteNew = (fiducialCut_) ? (mouseBite + guardRingOffset_ + sensorSizeOffset / cos30deg_) : mouseBite;
288  mouseBiteCut_ = waferSize_ * tan30deg_ - mouseBiteNew;
289 #ifdef EDM_ML_DEBUG
290  edm::LogVerbatim("HGCSim") << "HGCalSD::Initialized with mode " << geom_mode_ << " Slope cut " << slopeMin_
291  << " top Level " << levelT1_ << ":" << levelT2_ << " useSimWt " << useSimWt_ << " wafer "
292  << waferSize_ << ":" << mouseBite << ":" << guardRingOffset_ << ":" << sensorSizeOffset
293  << ":" << mouseBiteNew << ":" << mouseBiteCut_ << " useOffset " << useOffset
294  << " dd4hep " << dd4hep_;
295 #endif
296 
297  numberingScheme_ = std::make_unique<HGCalNumberingScheme>(*hgcons_, mydet_, nameX_, missingFile_);
298  if (rejectMB_)
299  mouseBite_ = std::make_unique<HGCMouseBite>(*hgcons_, angles_, mouseBiteCut_, waferRot_);
300  if (fiducialCut_) {
301  guardRing_ = std::make_unique<HGCGuardRing>(*hgcons_);
302  guardRingPartial_ = std::make_unique<HGCGuardRingPartial>(*hgcons_);
303  }
304 
305  //Now for calibration cells
308  calibCellFullHD_ = hgcons_->calibCells(true, true);
309  calibCellPartHD_ = hgcons_->calibCells(true, false);
310  calibCellFullLD_ = hgcons_->calibCells(false, true);
311  calibCellPartLD_ = hgcons_->calibCells(false, false);
312  calibCells_ = ((!calibCellFullHD_.empty()) || (!calibCellPartHD_.empty()));
313  calibCells_ |= ((!calibCellFullLD_.empty()) || (!calibCellPartLD_.empty()));
314 #ifdef EDM_ML_DEBUG
315  edm::LogVerbatim("HGCSim") << "HGCalSD::Calibration cells initialized with flag " << calibCells_;
316  edm::LogVerbatim("HGCSim") << " Radii " << calibCellRHD_ << ":" << calibCellRLD_;
317  std::ostringstream st1;
318  for (const auto& cell : calibCellFullHD_)
319  st1 << " " << cell;
320  edm::LogVerbatim("HGCSim") << calibCellFullHD_.size() << " cells for High Density full wafers: " << st1.str();
321  std::ostringstream st2;
322  for (const auto& cell : calibCellPartHD_)
323  st2 << " " << cell;
324  edm::LogVerbatim("HGCSim") << calibCellPartHD_.size() << " cells for High Density partial wafers: " << st2.str();
325  std::ostringstream st3;
326  for (const auto& cell : calibCellFullLD_)
327  st3 << " " << cell;
328  edm::LogVerbatim("HGCSim") << calibCellFullLD_.size() << " cells for Low Density full wafers: " << st3.str();
329  std::ostringstream st4;
330  for (const auto& cell : calibCellPartLD_)
331  st4 << " " << cell;
332  edm::LogVerbatim("HGCSim") << calibCellPartLD_.size() << " cells for Low Density partial wafers: " << st4.str();
333 #endif
334  } else {
335  throw cms::Exception("Unknown", "HGCalSD") << "Cannot find HGCalDDDConstants for " << nameX_ << "\n";
336  }
337  if ((nHC_ > 1) && calibCells_)
339  cellOffset_ = std::make_unique<HGCalCellOffset>(
341 }
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:176
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
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().

◆ 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().