19 #include "G4Material.hh"
20 #include "CLHEP/Units/GlobalSystemOfUnits.h"
26 CaloSD(name, cpv, clg, p, manager) {
35 edm::LogInfo(
"HcalTB06BeamSD") <<
"HcalTB06BeamSD:: Use of Birks law is set to "
36 << useBirk <<
" with three constants kB = "
37 << birk1 <<
", C1 = " <<birk2 <<
", C2 = " <<
birk3;
43 value =
"WireChamber";
45 DDValue ddv1(attribute,value,0);
51 <<
"HcalTB06BeamSD:: Names to be tested for "
52 << attribute <<
" = " << value <<
": " <<
wcNames.size() <<
" paths";
54 edm::LogInfo(
"HcalTB06BeamSD") <<
"HcalTB06BeamSD:: (" <<
i <<
") "
58 attribute =
"ReadOutName";
66 std::vector<G4String> matNames;
67 std::vector<int> nocc;
72 for (
unsigned int i=0;
i<matNames.size();
i++) {
73 if (
matName == matNames[
i]) {notIn =
false; nocc[
i]++;}
81 if (matNames.size() > 0) {
84 for (
unsigned int i = 0;
i < matNames.size();
i++) {
95 <<
"HcalTB06BeamSD: Material name for "
96 << attribute <<
" = " << name <<
":" <<
matName;
97 matScin = G4Material::GetMaterial(matName);
104 double destep = aStep->GetTotalEnergyDeposit();
106 if (
useBirk &&
matScin == aStep->GetPreStepPoint()->GetMaterial()) {
110 <<
"HcalTB06BeamSD: Detector "
111 << aStep->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName()
113 return weight*destep;
119 const G4VTouchable* touch = preStepPoint->GetTouchable();
120 G4String
name = preStepPoint->GetPhysicalVolume()->GetName();
123 int lay = 0,
x = 0,
y = 0;
125 lay = (touch->GetReplicaNumber(0));
128 lay = (touch->GetReplicaNumber(1));
129 G4ThreeVector hitPoint = preStepPoint->GetPosition();
130 G4ThreeVector localPoint =
setToLocal(hitPoint, touch);
131 x = (int)(localPoint.x()/(0.2*mm));
132 y = (int)(localPoint.y()/(0.2*mm));
141 if (x < 0) { ix = 1;
ixx =-
x;}
143 if (y < 0) { iy = 1;
iyy =-
y;}
144 uint32_t
idx = (det&15)<<28;
145 idx += (lay&127)<<21;
147 idx += (
iyy&511)<<10;
151 LogDebug(
"HcalTB06BeamSD") <<
"HcalTB06BeamSD: Detector " << det <<
" Layer "
152 << lay <<
" x " << x <<
" " << ix <<
" " <<
ixx
153 <<
" y " << y <<
" " << iy <<
" " <<
iyy <<
" ID "
163 y = (idx>>10)&511;
if (((idx>>19)&1) == 1) y = -
y;
164 x = (
idx)&511;
if (((idx>>9)&1) == 1) x = -
x;
170 std::vector<G4String>
tmp;
176 for (
unsigned int i=0;
i<tmp.size();
i++)
177 if (name == tmp[
i]) ok =
false;
178 if (ok) tmp.push_back(name);
186 std::vector<G4String>::const_iterator it =
wcNames.begin();
187 for (; it !=
wcNames.end(); it++)
188 if (name == *it)
return true;
virtual double getEnergyDeposit(G4Step *)
T getParameter(std::string const &) const
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< G4String > wcNames
HcalTB06BeamSD(G4String, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void addFilter(const DDFilter &, DDLogOp op=DDLogOp::AND)
type of data representation of DDCompactView
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
virtual ~HcalTB06BeamSD()
T x() const
Cartesian x coordinate.
bool next()
set current node to the next node in the filtered tree
virtual uint32_t setDetUnitId(G4Step *step)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
double getAttenuation(G4Step *aStep, double birk1, double birk2, double birk3)
virtual std::vector< std::string > getNames()
static uint32_t packIndex(int det, int lay, int x, int y)
G4StepPoint * preStepPoint
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
std::vector< std::vector< double > > tmp
const G4Material * matScin
bool firstChild()
set the current node to the first child ...
bool isItWireChamber(G4String)
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
const std::string & name() const
Returns the name.
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *)