Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-hcx353 Merging the changes of ZDC code from Anna which was used by the ZDC collaboration for the Run2 setup #43161

Merged
merged 10 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,844 changes: 1,844 additions & 0 deletions Geometry/ForwardCommonData/data/zdc/2021/v3/zdc.xml

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions SimG4CMS/Forward/interface/ZdcNumberingScheme.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
#ifndef SimG4CMSForwardZdcNumberingScheme_h
#define SimG4CMSForwardZdcNumberingScheme_h
///////////////////////////////////////////////////////////////////////////////
// File: ZdcNumberingScheme.h
// Date: 03.06
// Description: Numbering scheme for Zdc
// Modifications:
///////////////////////////////////////////////////////////////////////////////
#undef debug
#ifndef ZdcNumberingScheme_h
#define ZdcNumberingScheme_h

#include <vector>
#include "G4Step.hh"

namespace ZdcNumberingScheme {
class ZdcNumberingScheme {
public:
ZdcNumberingScheme(int);
~ZdcNumberingScheme();

void setVerbosity(const int);

unsigned int getUnitID(const G4Step* aStep);

/** pack the Unit ID for Zdc <br>
* z = 1,2 = -z,+z; subDet = 1,2,3 = EM,Lum,HAD; fiber = 1-96 (EM,HAD), 1 (Lum);
* channel = 1-5 (EM), layer# (Lum), 1-3 (HAD)
*/
unsigned int packZdcIndex(int subDet, int layer, int fiber, int channel, int z);
static unsigned int packZdcIndex(int subDet, int layer, int fiber, int channel, int z);

// unpacking Unit ID for Zdc (-z=1, +z=2)
void unpackZdcIndex(const unsigned int& idx, int& subDet, int& layer, int& fiber, int& channel, int& z);
}; // namespace ZdcNumberingScheme
static void unpackZdcIndex(const unsigned int& idx, int& subDet, int& layer, int& fiber, int& channel, int& z);

int detectorLevel(const G4Step*);
void detectorLevel(const G4Step*, int&, std::vector<int>&, std::vector<G4String>&);

private:
int verbosity;
};

#endif
28 changes: 20 additions & 8 deletions SimG4CMS/Forward/interface/ZdcSD.h
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
#ifndef SimG4CMSForwardZdcSD_h
#define SimG4CMSForwardZdcSD_h
///////////////////////////////////////////////////////////////////////////////
// File: ZdcSD.h
// Date: 02.04
// Description: Stores hits of Zdc in appropriate container
//
///////////////////////////////////////////////////////////////////////////////
#ifndef ZdcSD_h
#define ZdcSD_h
#include "SimG4CMS/Calo/interface/CaloSD.h"
#include "SimG4CMS/Forward/interface/ZdcShowerLibrary.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "SimG4CMS/Forward/interface/ZdcNumberingScheme.h"

class ZdcSD : public CaloSD {
public:
ZdcSD(const std::string &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *);

~ZdcSD() override = default;

bool ProcessHits(G4Step *step, G4TouchableHistory *tHistory) override;
uint32_t setDetUnitId(const G4Step *step) override;

// bool getFromLibrary(const G4Step * step) override;

double calculateCherenkovDeposit(G4Step *);
double calculateMeanNumberOfPhotons(int, double, double);
double photonEnergyDist(int, double, double);
double generatePhotonEnergy(int, double, double);
double pmtEfficiency(double);
double convertEnergyToWavelength(double);

double calculateN2InvIntegral(double);
double evaluateFunction(const std::vector<double>, const std::vector<double>, double);
double linearInterpolation(double, double, double, double, double);

protected:
double getEnergyDeposit(const G4Step *) override;
bool getFromLibrary(const G4Step *) override;
void initRun() override;

private:
int verbosity;
bool useShowerLibrary, useShowerHits;
int setTrackID(G4Step *step);
double thFibDir;
double zdcHitEnergyCut;

std::unique_ptr<ZdcShowerLibrary> showerLibrary;
std::unique_ptr<ZdcNumberingScheme> numberingScheme;

std::vector<ZdcShowerLibrary::Hit> hits;
};

Expand Down
10 changes: 7 additions & 3 deletions SimG4CMS/Forward/interface/ZdcShowerLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "G4ParticleTable.hh"
#include "G4ThreeVector.hh"
#include "DetectorDescription/Core/interface/DDsvalues.h"
#include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"

#include <string>
Expand All @@ -24,7 +25,6 @@ class ZdcShowerLibrary {
ZdcShowerLibrary(const std::string& name, edm::ParameterSet const& p);
~ZdcShowerLibrary();

public:
struct Hit {
Hit() {}
G4ThreeVector entryLocal;
Expand All @@ -36,7 +36,8 @@ class ZdcShowerLibrary {
double DeEM;
};

std::vector<Hit>& getHits(const G4Step* aStep, bool& ok);
void initRun(G4ParticleTable* theParticleTable);
std::vector<Hit>& getHits(G4Step* aStep, bool& ok);
int getEnergyFromLibrary(const G4ThreeVector& posHit,
const G4ThreeVector& momDir,
double energy,
Expand All @@ -45,10 +46,13 @@ class ZdcShowerLibrary {
bool side,
int channel);
int photonFluctuation(double eav, double esig, double edis);
int encodePartID(G4int parCode);

private:
bool verbose;

G4int emPDG, epPDG, gammaPDG;
G4int pi0PDG, etaPDG, nuePDG, numuPDG, nutauPDG;
G4int anuePDG, anumuPDG, anutauPDG, geantinoPDG;
int npe;
std::vector<ZdcShowerLibrary::Hit> hits;
};
Expand Down
Loading