19 #include "CLHEP/Units/GlobalSystemOfUnits.h"
25 CaloSD(name, cpv, clg, p, manager) {
34 LogDebug(
"HcalTBSim") <<
"***************************************************"
38 <<
"* Constructing a HcalTB06BeamSD with name "
42 <<
"***************************************************";
44 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06BeamSD:: Use of Birks law is set to "
45 << useBirk <<
" with three constants kB = "
46 << birk1 <<
", C1 = " <<birk2 <<
", C2 = " <<
birk3;
48 std::string attribute,
value;
52 value =
"WireChamber";
54 DDValue ddv1(attribute,value,0);
59 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06BeamSD:: Names to be tested for "
60 << attribute <<
" = " << value <<
": "
63 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06BeamSD:: (" <<
i <<
") "
67 attribute =
"ReadOutName";
75 std::vector<G4String> matNames;
76 std::vector<int> nocc;
81 for (
unsigned int i=0;
i<matNames.size();
i++)
82 if (
matName == matNames[
i]) {notIn =
false; nocc[
i]++;}
89 if (matNames.size() > 0) {
92 for (
unsigned int i = 0;
i < matNames.size();
i++) {
102 edm::LogInfo(
"HcalTBSim") <<
"HcalTB06BeamSD: Material name for "
103 << attribute <<
" = " << name <<
":" <<
matName;
110 double destep = aStep->GetTotalEnergyDeposit();
113 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
117 LogDebug(
"HcalTBSim") <<
"HcalTB06BeamSD: Detector "
118 << aStep->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName()
120 return weight*destep;
126 const G4VTouchable* touch = preStepPoint->GetTouchable();
127 G4String
name = preStepPoint->GetPhysicalVolume()->GetName();
130 int lay = 0,
x = 0,
y = 0;
132 lay = (touch->GetReplicaNumber(0));
135 lay = (touch->GetReplicaNumber(1));
136 G4ThreeVector hitPoint = preStepPoint->GetPosition();
137 G4ThreeVector localPoint =
setToLocal(hitPoint, touch);
138 x = (int)(localPoint.x()/(0.2*mm));
139 y = (int)(localPoint.y()/(0.2*mm));
148 if (x < 0) { ix = 1;
ixx =-
x;}
150 if (y < 0) { iy = 1;
iyy =-
y;}
151 uint32_t idx = (det&15)<<28;
152 idx += (lay&127)<<21;
154 idx += (
iyy&511)<<10;
158 LogDebug(
"HcalTBSim") <<
"HcalTB06BeamSD: Detector " << det <<
" Layer "
159 << lay <<
" x " << x <<
" " << ix <<
" " <<
ixx
160 <<
" y " << y <<
" " << iy <<
" " <<
iyy <<
" ID "
161 << std::hex << idx << std::dec;
170 y = (idx>>10)&511;
if (((idx>>19)&1) == 1) y = -
y;
171 x = (idx)&511;
if (((idx>>9)&1) == 1) x = -
x;
177 std::vector<G4String>
tmp;
183 for (
unsigned int i=0;
i<tmp.size();
i++)
184 if (name == tmp[
i]) ok =
false;
185 if (ok) tmp.push_back(name);
193 std::vector<G4String>::const_iterator it =
wcNames.begin();
194 for (; it !=
wcNames.end(); it++)
195 if (name == *it)
return true;
G4ThreeVector setToLocal(G4ThreeVector, const G4VTouchable *)
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
void addFilter(const DDFilter &, log_op op=AND)
type of data representation of DDCompactView
const DDMaterial & material() const
Returns a reference object of the material this LogicalPart is made of.
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()
bool next()
set current node to the next node in the filtered tree
virtual uint32_t setDetUnitId(G4Step *step)
HcalTB06BeamSD(G4String, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
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
Log< T >::type log(const T &t)
std::vector< std::vector< double > > tmp
bool firstChild()
set the current node to the first child ...
bool isItWireChamber(G4String)
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
const std::string & name() const
Returns the name.
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.