Commit in projects/lcdd/branches/v04-01-00-pre on MAIN | |||
include/lcdd/detectors/Cerenkov.hh | -50 | 3222 removed | |
/OpticalCalorimeterHitProcessor.hh | -73 | 3222 removed | |
/UnsegmentedCalorimeterHitProcessor.hh | -51 | 3222 removed | |
include/lcdd/schema/NonprojectiveCylinderSegmentationType.hh | -79 | 3222 removed | |
/nonprojective_cylinder.hh | -38 | 3222 removed | |
include/lcdd/segmentation/NonprojectiveCylinderSegmentation.hh | -118 | 3222 removed | |
schemas/lcdd/1.0/lcdd_sensitive_detectors.xsd | -23 | 3222 -> 3223 | |
src/lcdd/detectors/Cerenkov.cc | -153 | 3222 removed | |
/HitProcessorManager.cc | -4 | 3222 -> 3223 | |
/OpticalCalorimeterHitProcessor.cc | -95 | 3222 removed | |
/UnsegmentedCalorimeterHitProcessor.cc | -50 | 3222 removed | |
src/lcdd/processes/nonprojective_cylinderProcess.cc | -69 | 3222 removed | |
src/lcdd/segmentation/NonprojectiveCylinderSegmentation.cc | -229 | 3222 removed | |
/SegmentationFactory.cc | +1 | -27 | 3222 -> 3223 |
+1 | -1059 |
Delete some classes for branch cleanup.
--- projects/lcdd/branches/v04-01-00-pre/include/lcdd/detectors/Cerenkov.hh 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/include/lcdd/detectors/Cerenkov.hh 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,50 +0,0 @@
-#ifndef LCDD_DETECTORS_CERENKOV_HH_ -#define LCDD_DETECTORS_CERENKOV_HH_ 1 - -// Geant4 -#include "G4PhysicsOrderedFreeVector.hh" -#include "G4Material.hh" -#include "G4MaterialPropertyVector.hh" - -// STL -#include <vector> - -/** - * @class Cerenkov - * @brief A physics utility class modeling optical photon production. - * @author Hans Wenzel - */ -class Cerenkov { -public: - - /** - * Class constructor. - */ - Cerenkov(); - - /** - * Class destructor. - */ - ~Cerenkov(); - - /** - * Initialize the Cerenkov data. - */ - void Initialize(); - - /** - * Compute average number of photons. - * @param[in] charge The particle PDG charge value. - * @param[in] beta Velocity of the track in unit of c (light velocity). - * @param[in] material The name of the G4Material. - */ - G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4String material) const; - -private: - std::vector<G4String> _CAI; - std::vector<G4PhysicsOrderedFreeVector*> _cerenkovAngleIntegrals; - std::vector<G4MaterialPropertyVector*> _refractionIndeces; -}; - -#endif -
--- projects/lcdd/branches/v04-01-00-pre/include/lcdd/detectors/OpticalCalorimeterHitProcessor.hh 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/include/lcdd/detectors/OpticalCalorimeterHitProcessor.hh 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,73 +0,0 @@
-// $Header: /nfs/slac/g/lcd/cvs/lcdroot/lcdd/include/lcdd/detectors/OpticalCalorimeterHitProcessor.hh,v 1.3 2013-11-14 00:46:45 jeremy Exp $ - -#ifndef LCDD_DETECTORS_OPTICALCALORIMETERHITPROCESSOR_HH_ -#define LCDD_DETECTORS_OPTICALCALORIMETERHITPROCESSOR_HH_ 1 - -// LCDD -#include "lcdd/detectors/LegacyCalorimeterHitProcessor.hh" -#include "lcdd/detectors/Cerenkov.hh" -#include "lcdd/detectors/HitProcessorFactory.hh" - -/** - * @brief HitProcessor to create CalorimeterHit objects in an optical calorimeter. - */ -class OpticalCalorimeterHitProcessor: public LegacyCalorimeterHitProcessor { -public: - - /** - * An enum for the two hit collections (cerenkov and edep). - */ - enum HCType { - eEdep = 0, eCerenkov = 1 - }; - -public: - - /** - * Class constructor. - * @param[in] calorimeter The calorimeter SD. - */ - OpticalCalorimeterHitProcessor(CalorimeterSD* calorimeter); - - /** - * Class destructor. - */ - virtual ~OpticalCalorimeterHitProcessor(); - - /** - * Process steps to produce hits. - * @param[in] step The G4Step object. - */ - bool processHits(G4Step* step); - -private: - - /** - * Get the global hit position from a pre step point. - * @param[in] aPreStepPoint The pre step point. - */ - G4ThreeVector getGlobalHitPosition(const G4StepPoint* aPreStepPoint); - -private: - - Cerenkov* _cerenGenerator; -}; - -/** - * The factory for creating new OpticalCalorimeterHitProcessor objects. - */ -class OpticalCalorimeterHitProcessorFactory: public HitProcessorFactory { - -public: - - HitProcessor* createHitProcessor(SensitiveDetector* sd) { - return new OpticalCalorimeterHitProcessor(dynamic_cast<CalorimeterSD*>(sd)); - } - - const std::string& handlesType() { - static std::string typeName = "OpticalCalorimeterHitProcessor"; - return typeName; - } -}; - -#endif
--- projects/lcdd/branches/v04-01-00-pre/include/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.hh 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/include/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.hh 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,51 +0,0 @@
-#ifndef LCDD_DETECTORS_UNSEGMENTEDCALORIMETERHITPROCESSOR_HH_ -#define LCDD_DETECTORS_UNSEGMENTEDCALORIMETERHITPROCESSOR_HH_ 1 - -// LCDD -#include "lcdd/detectors/CalorimeterHitProcessor.hh" -#include "lcdd/detectors/HitProcessorFactory.hh" - -/** - * @class UnsegmentedCalorimeterHitProcessor - * HitProcessor that produces CalorimeterHit objects with no virtual geometry segmentation. - */ -class UnsegmentedCalorimeterHitProcessor: public CalorimeterHitProcessor { - -public: - - /** - * Class constructor. - * @param[in] calorimeter The calorimeter SD. - */ - UnsegmentedCalorimeterHitProcessor(CalorimeterSD* calorimeter); - - /** - * Class destructor. - */ - virtual ~UnsegmentedCalorimeterHitProcessor(); - - /** - * Process steps to produce hits. - * @param[in] step The G4Step object. - */ - bool processHits(G4Step* step); -}; - -/** - * The factory for creating new UnsegmentedCalorimeterHitProcessor objects. - */ -class UnsegmentedCalorimeterHitProcessorFactory: public HitProcessorFactory { - -public: - - HitProcessor* createHitProcessor(SensitiveDetector* sd) { - return new UnsegmentedCalorimeterHitProcessor(dynamic_cast<CalorimeterSD*>(sd)); - } - - const std::string& handlesType() { - static std::string typeName = "UnsegmentedCalorimeterHitProcessor"; - return typeName; - } -}; - -#endif
--- projects/lcdd/branches/v04-01-00-pre/include/lcdd/schema/NonprojectiveCylinderSegmentationType.hh 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/include/lcdd/schema/NonprojectiveCylinderSegmentationType.hh 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,79 +0,0 @@
-#ifndef LCDD_SCHEMA_NONPROJECTIVECYLINDERSEGMENTATIONTYPE_HH_ -#define LCDD_SCHEMA_NONPROJECTIVECYLINDERSEGMENTATIONTYPE_HH_ 1 - -// LCDD -#include "SegmentationType.hh" - -// STL -#include <string> - -/** - * @brief The NonprojectiveCylinderSegmentationType from the schema. - */ -class NonprojectiveCylinderSegmentationType: public SegmentationType { -public: - - NonprojectiveCylinderSegmentationType() { - } - - virtual ~NonprojectiveCylinderSegmentationType() { - } - -public: - - /** - * Set the grid size z. - * @param gsz The grid size z. - */ - void set_gridSizeZ(const std::string& gsz) { - _gridSizeZ = gsz; - } - - /** - * Set the grid size phi. - * @param gsp The grid size phi. - */ - void set_gridSizePhi(const std::string& gsp) { - _gridSizePhi = gsp; - } - - /** - * Set the length unit. - * @param lunit The length unit. - */ - void set_lunit(const std::string& lunit) { - _lunit = lunit; - } - - /** - * Get the grid size z. - * @return The grid size z. - */ - const std::string& get_gridSizeZ() { - return _gridSizeZ; - } - - /** - * Get the grid size phi. - * @return The grid size phi. - */ - const std::string& get_gridSizePhi() { - return _gridSizePhi; - } - - /** - * Get the length unit. - * @return The length unit. - */ - const std::string& get_lunit() { - return _lunit; - } - -protected: - - std::string _gridSizeZ; - std::string _gridSizePhi; - std::string _lunit; -}; - -#endif
--- projects/lcdd/branches/v04-01-00-pre/include/lcdd/schema/nonprojective_cylinder.hh 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/include/lcdd/schema/nonprojective_cylinder.hh 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,38 +0,0 @@
-#ifndef LCDD_SCHEMA_NONPROJECTIVE_CYLINDER_HH_ -#define LCDD_SCHEMA_NONPROJECTIVE_CYLINDER_HH_ 1 - -// LCDD -#include "NonprojectiveCylinderSegmentationType.hh" - -// GDML -#include "Saxana/SAXObject.h" - -/** - * @brief The nonprojective_cylinder element from schema. - */ -class nonprojective_cylinder: public SAXObject, public NonprojectiveCylinderSegmentationType { - -public: - - /** - * Class constructor. - */ - nonprojective_cylinder() { - } - - /** - * Class destructor. - */ - virtual ~nonprojective_cylinder() { - } - - /** - * Get the type of this SAXObject. - * @return The type of this SAXObject. - */ - virtual SAXObject::Type type() { - return SAXObject::element; - } -}; - -#endif
--- projects/lcdd/branches/v04-01-00-pre/include/lcdd/segmentation/NonprojectiveCylinderSegmentation.hh 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/include/lcdd/segmentation/NonprojectiveCylinderSegmentation.hh 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,118 +0,0 @@
-#ifndef LCDD_SEGMENTATION_G4NONPROJECTIVECYLINDERSEGMENTATION_ -#define LCDD_SEGMENTATION_G4NONPROJECTIVECYLINDERSEGMENTATION_ 1 - -// LCDD -#include "lcdd/segmentation/Segmentation.hh" - -/** - * @brief A Segmentation class that implements a nonprojective cylinder. - * @todo This class needs much better documentation. Much of the computational code is a black box. - */ -class NonprojectiveCylinderSegmentation: public Segmentation { - -public: - - /** - * Class constructor. - * @param[in] gridSizePhi The grid size in phi (radians). - * @param[in] gridSizeZ The grid size in Z (mm). - */ - NonprojectiveCylinderSegmentation(double gridSizePhi, double gridSizeZ); - - /** - * Class destructor. - */ - virtual ~NonprojectiveCylinderSegmentation(); - -public: - - /** - * Compute the global hit position from a step. - * @param[in] aStep The G4Step object. - * @return The global hit position for the step. - */ - G4ThreeVector getGlobalHitPosition(const G4Step* aStep); - - /** - * Compute the global hit position a step point. - * @param[in] aPreStepPoint The G4StepPoint object. - * @return The global hit position for the step point. - */ - //G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint); - /** - * Compute bin values from a step. - * @param[in] aStep The G4Step object. - */ - void setBins(const G4Step* aStep); - - /** - * Compute bin values from a step point. - * @param[in] aPreStepStep The G4StepPoint object. - */ - //void setBins(const G4StepPoint* aPreStepPoint); - G4ThreeVector getLocalHitPos(const G4Step* aStep); - - /** - * @todo This method should not exist. - */ - G4ThreeVector getLocalHitPos(const G4StepPoint* aPreStepPoint); - - /** - * Check if a G4VSolid is valid for this segmentation. - * @return True if solid is valid; false if not. - */ - bool isValidSolid(G4VSolid*); - -protected: - - /** - * Set the valid bin names for this Segmentation. - */ - void setBinNames(); - -private: - - /** - * Computes the delta phi from a step. - * @param[in] aStep A G4Step object. - * @return The delta phi. - */ - double computeDeltaPhi(const G4Step* aStep); - - /** - * Compute the phi bin from a step. - * @param[in] aStep A G4Step object. - * @return The phi bin. - */ - int computeBinPhi(const G4Step* aStep); - - /** - * Compute the Z bin from a step. - * @param[in] aStep A G4Step object. - * @return The Z bin. - * @todo Remove this method. - */ - int computeBinZ(const G4ThreeVector& localStepPos); - - /** - * Compute the phi bin from a step point. - * @param[in] aPreStepPoint The G4StepPoint object. - * @return The phi bin. - * @todo Remove this method. - */ - int computeBinPhi(const G4StepPoint* aPreStepPoint); - - /** - * Compute the delta phi from a step point. - * @param[in] aPreStepPoint The G4StepPoint object. - * @return The delta phi. - */ - double computeDeltaPhi(const G4StepPoint* aPreStepPoint); - -private: - - double _gridSizePhi; - double _gridSizeZ; -}; - -#endif
--- projects/lcdd/branches/v04-01-00-pre/schemas/lcdd/1.0/lcdd_sensitive_detectors.xsd 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/schemas/lcdd/1.0/lcdd_sensitive_detectors.xsd 2014-08-05 18:53:21 UTC (rev 3223) @@ -157,21 +157,6 @@
</xs:complexContent> </xs:complexType>
- <xs:complexType name="NonprojectiveCylinderSegmentationType"> - <xs:annotation> - <xs:documentation> - NP segmentation type for cylinders. - </xs:documentation> - </xs:annotation> - <xs:complexContent> - <xs:extension base="SegmentationType"> - <xs:attribute name="grid_size_z" type="xs:double" use="required"/> - <xs:attribute name="grid_size_phi" type="xs:double" use="required"/> - <xs:attribute default="mm" name="lunit" type="xs:string"/> - </xs:extension> - </xs:complexContent> - </xs:complexType> -
<xs:complexType name="CellReadout2DSegmentationType"> <xs:annotation> <xs:documentation>
@@ -226,14 +211,6 @@
</xs:annotation> </xs:element>
- <xs:element name="nonprojective_cylinder" substitutionGroup="segmentation" type="NonprojectiveCylinderSegmentationType"> - <xs:annotation> - <xs:documentation> - NP cylinder segmentation element for cylinders. - </xs:documentation> - </xs:annotation> - </xs:element> -
<xs:complexType name="ProjectiveCylinderSegmentationType"> <xs:annotation> <xs:documentation>
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/Cerenkov.cc 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/Cerenkov.cc 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,153 +0,0 @@
-/////////////////////////////////////////////////////////////////////// -// Class to calculate Number of photons created by Cerenkov Radiation -//////////////////////////////////////////////////////////////////////// -// Hans Wenzel -// -// The algorithm is stripped from the geant 4 class -// G4Cerenkov.cc -// but since we are only interested in the number of photons created don't need to -// actually create optical phtons and put them on the stack. -//-------------------------------------------------------------------------------------- -#include "lcdd/detectors/Cerenkov.hh" - -// Geant4 -#include "G4Step.hh" -#include "G4ThreeVector.hh" -#include "G4SystemOfUnits.hh" - -#include <iomanip> - -Cerenkov::Cerenkov() { - Initialize(); -} - -Cerenkov::~Cerenkov() { - -} - -void Cerenkov::Initialize() { - // - // now get the Cerenkov Angle Integrals for all materials that have the refraction index defined - // - const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); - G4int numOfMaterials = G4Material::GetNumberOfMaterials(); - for (G4int i = 0; i < numOfMaterials; i++) { - // Retrieve vector of refraction indices for the material - // from the material's optical properties table - G4Material* aMaterial = (*theMaterialTable)[i]; - G4MaterialPropertiesTable* aMaterialPropertiesTable = aMaterial->GetMaterialPropertiesTable(); - G4PhysicsOrderedFreeVector* CerAngleIntegrals = new G4PhysicsOrderedFreeVector(); - if (aMaterialPropertiesTable) { - G4MaterialPropertyVector* theRefractionIndexVector = aMaterialPropertiesTable->GetProperty("RINDEX"); - if (theRefractionIndexVector) { - // Retrieve the first refraction index in vector - // of (photon energy, refraction index) pairs - G4double currentRI = (*theRefractionIndexVector)[0]; - if (currentRI > 1.0) { - // Create first (photon energy, Cerenkov Integral) pair - G4double currentPM = theRefractionIndexVector->Energy(0); - G4double currentCAI = 0.0; - CerAngleIntegrals->InsertValues(currentPM, currentCAI); - // Set previous values to current ones prior to loop - G4double prevPM = currentPM; - G4double prevCAI = currentCAI; - G4double prevRI = currentRI; - // loop over all (photon energy, refraction index) - // pairs stored for this material - for (size_t ii = 1; ii < theRefractionIndexVector->GetVectorLength(); ii++) { - currentRI = (*theRefractionIndexVector)[ii]; - currentPM = theRefractionIndexVector->Energy(ii); - currentCAI = 0.5 * (1.0 / (prevRI * prevRI) + 1.0 / (currentRI * currentRI)); - currentCAI = prevCAI + (currentPM - prevPM) * currentCAI; - CerAngleIntegrals->InsertValues(currentPM, currentCAI); - prevPM = currentPM; - prevCAI = currentCAI; - prevRI = currentRI; - } - } - G4cout << "Material: " << aMaterial->GetName() << G4endl; - G4cout << "Refraction Index: " << G4endl; - G4cout << "=================" << G4endl; - theRefractionIndexVector->DumpValues(); - G4cout << "Cerenkov angle Integrals: " << G4endl; - G4cout << "=========================" << G4endl; - CerAngleIntegrals->DumpValues(); - _CAI.push_back(aMaterial->GetName()); - _cerenkovAngleIntegrals.push_back(CerAngleIntegrals); - _refractionIndeces.push_back(theRefractionIndexVector); - } - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// This routine computes the number of Cerenkov photons produced per -// GEANT-unit (millimeter) in the current medium. -// ^^^^^^^^^^ - -G4double Cerenkov::GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4String Material) const { - G4bool Ceren = false; - G4int MaterialIndex = -1; - // - // check if optical properties are defined for this material: - // - for (unsigned int ii = 0; ii < _CAI.size(); ii++) { - if (_CAI[ii] == Material) { - MaterialIndex = ii; - Ceren = true; - break; - } - } - if (!Ceren) - return 0.0; - const G4double Rfact = 369.81 / (eV * cm); - if (beta <= 0.0) - return 0.0; - if (abs(charge) == 0.0) - return 0.0; - - G4double BetaInverse = 1. / beta; - // Min and Max photon energies - G4double Pmin = _refractionIndeces[MaterialIndex]->GetMinLowEdgeEnergy(); - G4double Pmax = _refractionIndeces[MaterialIndex]->GetMaxLowEdgeEnergy(); - - // Min and Max Refraction Indices - G4double nMin = _refractionIndeces[MaterialIndex]->GetMinValue(); - G4double nMax = _refractionIndeces[MaterialIndex]->GetMaxValue(); - - // Max Cerenkov Angle Integral - G4double CAImax = _cerenkovAngleIntegrals[MaterialIndex]->GetMaxValue(); - G4double dp, ge; - - // If n(Pmax) < 1/Beta -- no photons generated - - if (nMax < BetaInverse) { - dp = 0; - ge = 0; - } // otherwise if n(Pmin) >= 1/Beta -- photons generated - - else if (nMin > BetaInverse) { - dp = Pmax - Pmin; - ge = CAImax; - } // If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then - // we need to find a P such that the value of n(P) == 1/Beta. - // Interpolation is performed by the GetEnergy() and - // Value() methods of the G4MaterialPropertiesTable and - // the GetValue() method of G4PhysicsVector. - - else { - Pmin = _refractionIndeces[MaterialIndex]->GetEnergy(BetaInverse); - dp = Pmax - Pmin; - - // need boolean for current implementation of G4PhysicsVector - // ==> being phased out - G4bool isOutRange; - G4double CAImin = _cerenkovAngleIntegrals[MaterialIndex]->GetValue(Pmin, isOutRange); - ge = CAImax - CAImin; - } - - // Calculate number of photons - G4double NumPhotons = Rfact * charge / eplus * charge / eplus * (dp - ge * BetaInverse * BetaInverse); - return NumPhotons; -} -
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/HitProcessorManager.cc 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/HitProcessorManager.cc 2014-08-05 18:53:21 UTC (rev 3223) @@ -2,8 +2,6 @@
// LCDD #include "lcdd/detectors/LegacyCalorimeterHitProcessor.hh"
-#include "lcdd/detectors/UnsegmentedCalorimeterHitProcessor.hh" -#include "lcdd/detectors/OpticalCalorimeterHitProcessor.hh"
#include "lcdd/detectors/BasicTrackerHitProcessor.hh" #include "lcdd/detectors/ScoringTrackerHitProcessor.hh" #include "lcdd/detectors/StepCombiningTrackerHitProcessor.hh"
@@ -26,8 +24,6 @@
void HitProcessorManager::registerDefaultFactories() { registerFactory(new LegacyCalorimeterHitProcessorFactory());
- registerFactory(new UnsegmentedCalorimeterHitProcessorFactory()); - registerFactory(new OpticalCalorimeterHitProcessorFactory());
registerFactory(new ScoringTrackerHitProcessorFactory()); registerFactory(new BasicTrackerHitProcessorFactory()); registerFactory(new StepCombiningTrackerHitProcessorFactory());
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/OpticalCalorimeterHitProcessor.cc 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/OpticalCalorimeterHitProcessor.cc 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,95 +0,0 @@
-#include "lcdd/detectors/OpticalCalorimeterHitProcessor.hh" - -// LCDD -#include "lcdd/detectors/ReadoutUtil.hh" - -// Geant4 -#include "G4OpticalPhoton.hh" -#include "G4TransportationManager.hh" -#include "G4VProcess.hh" -#include "G4Poisson.hh" - -OpticalCalorimeterHitProcessor::OpticalCalorimeterHitProcessor(CalorimeterSD* calorimeter) : - LegacyCalorimeterHitProcessor(calorimeter), _cerenGenerator(0) { -} - -OpticalCalorimeterHitProcessor::~OpticalCalorimeterHitProcessor() { - if (_cerenGenerator != 0) { - delete _cerenGenerator; - } -} - -bool OpticalCalorimeterHitProcessor::processHits(G4Step* step) { - // FIXME: This initialization should not happen here. - // Put into PhysicsManager as statically accessible. - if (_cerenGenerator == 0) { - _cerenGenerator = new Cerenkov(); - } - - G4int NCerenPhotons = 0; - G4Track* theTrack = step->GetTrack(); - const G4double charge = theTrack->GetDefinition()->GetPDGCharge(); - G4StepPoint* pPreStepPoint = step->GetPreStepPoint(); - G4StepPoint* pPostStepPoint = step->GetPostStepPoint(); - G4double beta = 0.5 * (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta()); - const G4VTouchable* touch = step->GetPreStepPoint()->GetTouchable(); - G4String thematerial = touch->GetVolume()->GetLogicalVolume()->GetMaterial()->GetName(); - G4double MeanNumberOfPhotons = _cerenGenerator->GetAverageNumberOfPhotons(charge, beta, thematerial); - if (MeanNumberOfPhotons > 0.0) { - G4double step_length = step->GetStepLength(); - MeanNumberOfPhotons = MeanNumberOfPhotons * step_length; - NCerenPhotons = (G4int) G4Poisson(MeanNumberOfPhotons); - } else { - NCerenPhotons = 0; - } - - if (NCerenPhotons <= 0) { - return LegacyCalorimeterHitProcessor::processHits(step); - } else { - G4ThreeVector myPoint = step->GetPreStepPoint()->GetPosition(); - G4StepPoint* apreStepPoint = step->GetPreStepPoint(); - G4double theEdep = double(NCerenPhotons); - // get global cell pos from seg - G4ThreeVector globalCellPos = getGlobalHitPosition(apreStepPoint); - // set the seg bins - _calorimeter->getSegmentation()->setBins(step); - - // Create an identifier. - Id64bit id64 = _calorimeter->makeIdentifier(step); - - // Look for existing hit. - CalorimeterHit* hit = _calorimeter->findHit(id64); - - // Was hit found? - if (hit == 0) { - - // Hit was not found, so new one is created. - hit = new CalorimeterHit(id64, theEdep, globalCellPos); - - // Add hit to calorimeter. - _calorimeter->addHit(hit, eCerenkov); - } else { - // Add energy deposition to existing hit. - hit->addEdep(theEdep); - } - // add McpHitContrib to this hit, setting info from step info - hit->addHitContribution(HitContribution(step)); - return true; - } // end Cerenkov photon treatment -} - -G4ThreeVector OpticalCalorimeterHitProcessor::getGlobalHitPosition(const G4StepPoint* aPreStepPoint) { - G4ThreeVector globalStepPos = aPreStepPoint->GetPosition(); - - // Figure out local step pos using touchable and global midpoint. - G4ThreeVector localStepPos = ReadoutUtil::transformGlobalToLocal(aPreStepPoint, globalStepPos); - - // Compute local cell pos. - G4ThreeVector localCellPos = _calorimeter->getSegmentation()->getLocalHitPosition(localStepPos); - - // Compute global cell pos. - G4ThreeVector globalCellPos = ReadoutUtil::transformLocalToGlobal(aPreStepPoint, localCellPos); - - return globalCellPos; -} -
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.cc 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.cc 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,50 +0,0 @@
-#include "lcdd/detectors/UnsegmentedCalorimeterHitProcessor.hh" - -// Geant4 -#include "G4Geantino.hh" -#include "G4ChargedGeantino.hh" - -UnsegmentedCalorimeterHitProcessor::UnsegmentedCalorimeterHitProcessor(CalorimeterSD* calorimeter) : - CalorimeterHitProcessor(calorimeter) { -} - -UnsegmentedCalorimeterHitProcessor::~UnsegmentedCalorimeterHitProcessor() { -} - -bool UnsegmentedCalorimeterHitProcessor::processHits(G4Step* step) { - // Get the energy deposition. - G4double edep = step->GetTotalEnergyDeposit(); - - // Check for Geantino particle type. - G4ParticleDefinition* def = step->GetTrack()->GetDefinition(); - bool isGeantino = false; - if (def == G4Geantino::Definition() || def == G4ChargedGeantino::Definition()) { - isGeantino = true; - } - - // This needs to be a <= comparison for cutting on 0, - // but it allows geantinos, which always have 0 edep. - if (edep <= _calorimeter->getEnergyCut() && isGeantino == false) { - return false; - } - - // Get the step mid position. - G4ThreeVector position = (0.5 * (step->GetPreStepPoint()->GetPosition() + step->GetPostStepPoint()->GetPosition())); - - // Create a 64-bit ID. - Id64bit id = _calorimeter->makeIdentifier(step); - - // Create a new hit. - CalorimeterHit* newHit = new CalorimeterHit(id, edep, position); - - // Add the hit to the SD. - _calorimeter->addHit(newHit); - - // Add an MCParticle contribution for this hit. - newHit->addHitContribution(HitContribution(step)); - - // Return true because added hit. - return true; - -} -
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/processes/nonprojective_cylinderProcess.cc 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/processes/nonprojective_cylinderProcess.cc 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,69 +0,0 @@
-// GDML -#include "Saxana/ProcessingConfigurator.h" -#include "Saxana/ProcessingContext.h" -#include "Saxana/SAXProcessor.h" -#include "Saxana/StateStack.h" -#include "Saxana/SAXProcessingState.h" -#include "Saxana/SAXStateProcess.h" -#include "Saxana/SAXComponentFactory.h" - -// LCDD -#include "lcdd/schema/nonprojective_cylinder.hh" - -// STL -#include <iostream> - -/** - @class nonprojective_cylinderProcess - @brief SAX process for nonprojective_cylinder element. - */ -class nonprojective_cylinderProcess: public SAXStateProcess { - -public: - - nonprojective_cylinderProcess(const ProcessingContext* context = 0) : - SAXStateProcess(context), m_obj(0) { - } - - virtual ~nonprojective_cylinderProcess() { - } - - virtual const SAXComponentObject* Build() const { - return this; - } - - virtual void StartElement(const std::string&, const ASCIIAttributeList& attrs) { - //std::cout << "nonprojective_cylinderProcess::StartElement: " << name << std::endl; - - SAXObject** obj = Context()->GetTopObject(); - - nonprojective_cylinder* np = new nonprojective_cylinder; - - np->set_gridSizeZ(attrs.getValue("grid_size_z")); - np->set_gridSizePhi(attrs.getValue("grid_size_phi")); - np->set_lunit(attrs.getValue("lunit")); - - m_obj = np; - *obj = np; - } - - virtual void EndElement(const std::string&) { - } - - virtual void Characters(const std::string&) { - } - - virtual void StackPopNotify(const std::string&) { - } - - virtual const std::string& State() const { - static std::string tag = "nonprojective_cylinder"; - return tag; - } - -private: - - SAXObject* m_obj; -}; - -DECLARE_PROCESS_FACTORY(nonprojective_cylinderProcess)
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/segmentation/NonprojectiveCylinderSegmentation.cc 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/segmentation/NonprojectiveCylinderSegmentation.cc 2014-08-05 18:53:21 UTC (rev 3223) @@ -1,229 +0,0 @@
-#include "lcdd/segmentation/NonprojectiveCylinderSegmentation.hh" - -// LCDD -#include "lcdd/detectors/ReadoutUtil.hh" - -// Geant4 -#include "G4Tubs.hh" -#include "G4SystemOfUnits.hh" - -// STL -#include <cmath> - -NonprojectiveCylinderSegmentation::NonprojectiveCylinderSegmentation(double gridSizePhi, double gridSizeZ) : - Segmentation(Segmentation::eNonprojective), _gridSizePhi(gridSizePhi), _gridSizeZ(gridSizeZ) - -{ - setBinNames(); -} - -NonprojectiveCylinderSegmentation::~NonprojectiveCylinderSegmentation() { -} - -void NonprojectiveCylinderSegmentation::setBinNames() { - addBinName("phi"); - addBinName("z"); -} - -G4ThreeVector NonprojectiveCylinderSegmentation::getGlobalHitPosition(const G4Step* aStep) { - // local cell pos - G4ThreeVector localCellPos = getLocalHitPos(aStep); - - // global cell pos - G4ThreeVector globalCellPos = ReadoutUtil::transformLocalToGlobal(aStep, localCellPos); - - return localCellPos; -} - -/* - G4ThreeVector NonprojectiveCylinderSegmentation::getGlobalHitPos(const G4StepPoint* aPreStepPoint) - { - // local cell pos - G4ThreeVector localCellPos = getLocalHitPos(aPreStepPoint); - - // global cell pos - G4ThreeVector globalCellPos = ReadoutUtil::transformLocalToGlobal(aPreStepPoint, localCellPos); - - // DEBUG: print local, global cell pos - //G4cout << "localCellPos " << localCellPos << G4endl; - //G4cout << "globalCellPos " << globalCellPos << G4endl; - // - - return localCellPos; - } - */ - -G4ThreeVector NonprojectiveCylinderSegmentation::getLocalHitPos(const G4Step* aStep) { - G4ThreeVector globalMidPos = ReadoutUtil::computeMidPos(aStep); - - // retrieve G4Tubs - const G4Tubs* tubs = ReadoutUtil::getTubs(aStep); - - assert(tubs); - - // rcyl of cell = mid rad of current tubs - double rcyl = ReadoutUtil::computeTubsMidRadius(tubs); - - // compute single delta phi in degrees - double deltaPhi = computeDeltaPhi(aStep); - - // phi index - int iphi = computeBinPhi(aStep); - - // z index in local - int iz = computeBinZ(ReadoutUtil::transformGlobalToLocal(aStep, globalMidPos)); - - // compute cell Z, phi - double cellPhi = computeDim(iphi, deltaPhi); - double cellZ = computeDim(iz, _gridSizeZ); - - // compute X, Y - double cellX = rcyl * cos(cellPhi); - double cellY = rcyl * sin(cellPhi); - - G4ThreeVector cellCenter(cellX, cellY, cellZ); - - return cellCenter; -} - -G4ThreeVector NonprojectiveCylinderSegmentation::getLocalHitPos(const G4StepPoint* aPreStepPoint) { - G4ThreeVector globalPos = aPreStepPoint->GetPosition(); - - // retrieve G4Tubs - const G4Tubs* tubs = ReadoutUtil::getTubs(aPreStepPoint); - - assert(tubs); - - // rcyl of cell = mid rad of current tubs - double rcyl = ReadoutUtil::computeTubsMidRadius(tubs); - - // compute single delta phi in degrees - double deltaPhi = computeDeltaPhi(aPreStepPoint); - - // phi index - int iphi = computeBinPhi(aPreStepPoint); - - // z index in local - int iz = computeBinZ(ReadoutUtil::transformGlobalToLocal(aPreStepPoint, globalPos)); - - // compute cell Z, phi - double cellPhi = computeDim(iphi, deltaPhi); - double cellZ = computeDim(iz, _gridSizeZ); - - // compute X, Y - double cellX = rcyl * cos(cellPhi); - double cellY = rcyl * sin(cellPhi); - - G4ThreeVector cellCenter(cellX, cellY, cellZ); - - return cellCenter; -} - -double NonprojectiveCylinderSegmentation::computeDeltaPhi(const G4Step* aStep) { - // mid radius of current tubs - double mid_rad_layer = ReadoutUtil::computeTubsMidRadius(aStep); - - // circumference of current tubs - double circ = 2.0 * ReadoutUtil::PI * mid_rad_layer; - - // number of cells along phi in curr layer - int nphi = (int) floor(circ / _gridSizePhi); - - // single phi division in degrees - double deltaPhi = (360.0 * deg) / nphi; - - return deltaPhi; -} -double NonprojectiveCylinderSegmentation::computeDeltaPhi(const G4StepPoint* aPreStepPoint) { - // mid radius of current tubs - double mid_rad_layer = ReadoutUtil::computeTubsMidRadius(aPreStepPoint); - - // circumference of current tubs - double circ = 2.0 * ReadoutUtil::PI * mid_rad_layer; - - // number of cells along phi in curr layer - int nphi = (int) floor(circ / _gridSizePhi); - - // single phi division in degrees - double deltaPhi = (360.0 * deg) / nphi; - - return deltaPhi; -} -void NonprojectiveCylinderSegmentation::setBins(const G4Step* aStep) { - //G4cout << "G4NonprojectiveCylinderSegmentation::setBins()" << G4endl; - - G4ThreeVector globalMidPos = ReadoutUtil::computeMidPos(aStep); - - int bphi = computeBinPhi(aStep); - int bz = computeBinZ(globalMidPos); - - setBin(0, bphi); - setBin(1, bz); -} -//void NonprojectiveCylinderSegmentation::setBins(const G4StepPoint* aPreStepPoint) -//{ -// //G4cout << "G4NonprojectiveCylinderSegmentation::setBins()" << G4endl; -// -// G4ThreeVector globalPos = aPreStepPoint->GetPosition(); -// -// int bphi = computeBinPhi(aPreStepPoint); -// int bz = computeBinZ(globalPos); -// -// setBin(0, bphi); -// setBin(1, bz); -//} -int NonprojectiveCylinderSegmentation::computeBinPhi(const G4Step* aStep) { - G4ThreeVector globalMidPos = ReadoutUtil::computeMidPos(aStep); - - const G4Tubs* tubs = ReadoutUtil::getTubs(aStep); - assert(tubs); - - // compute single delta phi in degrees - double deltaPhi = computeDeltaPhi(aStep); - - // step phi - double stepPhi = globalMidPos.phi(); - - if (stepPhi < 0) { - stepPhi += 2.0 * ReadoutUtil::PI; - } - - // phi index - return computeBin(stepPhi, deltaPhi / radian); -} - -int NonprojectiveCylinderSegmentation::computeBinPhi(const G4StepPoint* aPreStepPoint) { - G4ThreeVector globalPos = aPreStepPoint->GetPosition(); - - const G4Tubs* tubs = ReadoutUtil::getTubs(aPreStepPoint); - assert(tubs); - - // compute single delta phi in degrees - double deltaPhi = computeDeltaPhi(aPreStepPoint); - - // step phi - double stepPhi = globalPos.phi(); - - if (stepPhi < 0) { - stepPhi += 2.0 * ReadoutUtil::PI; - } - - // phi index - return computeBin(stepPhi, deltaPhi / radian); -} - -int NonprojectiveCylinderSegmentation::computeBinZ(const G4ThreeVector& localStepPos) { - return computeBin(localStepPos.z(), _gridSizeZ); -} - -bool NonprojectiveCylinderSegmentation::isValidSolid(G4VSolid* s) { - bool valid = Segmentation::isValidSolid(s); - - if (valid) { - if (s->GetEntityType() != "G4Tubs") { - valid = false; - } - } - - return valid; -}
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/segmentation/SegmentationFactory.cc 2014-08-05 01:34:19 UTC (rev 3222) +++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/segmentation/SegmentationFactory.cc 2014-08-05 18:53:21 UTC (rev 3223) @@ -3,7 +3,6 @@
// LCDD #include "lcdd/schema/grid_xyz.hh" #include "lcdd/schema/global_grid_xy.hh"
-#include "lcdd/schema/nonprojective_cylinder.hh"
#include "lcdd/schema/projective_cylinder.hh" #include "lcdd/schema/projective_zplane.hh" #include "lcdd/schema/cell_readout_2d.hh"
@@ -12,7 +11,6 @@
#include "lcdd/segmentation/GlobalGridXYSegmentation.hh" #include "lcdd/segmentation/ProjectiveCylinderSegmentation.hh" #include "lcdd/segmentation/ProjectiveZPlaneSegmentation.hh"
-#include "lcdd/segmentation/NonprojectiveCylinderSegmentation.hh"
#include "lcdd/segmentation/CellReadout2DSegmentation.hh" // GDML
@@ -90,32 +88,8 @@
} else { std::cerr << "Failed cast to global_grid_xy!" << std::endl; }
- } else if (tag == "nonprojective_cylinder") { - // handle NP cylinder - - //std::cout << "add nonprojective_cylinder here" << std::endl; - - nonprojective_cylinder* np = dynamic_cast<nonprojective_cylinder*>(obj); - if (np) { - - double gsp = 0; - double gsz = 0; - - std::string lunit = np->get_lunit(); - - std::string sval = np->get_gridSizePhi(); - sval += "*" + lunit; - gsp = calc->Eval(sval); - - sval = np->get_gridSizeZ(); - sval += "*" + lunit; - gsz = calc->Eval(sval); - - seg = new NonprojectiveCylinderSegmentation(gsp, gsz); - } else { - std::cerr << "Failed cast to nonprojective_cylinder!" << std::endl; - }
} else if (tag == "projective_zplane") {
+
// handle projective_zplane //std::cout << "add projective_zplane here" << std::endl;
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1