Merge in v04-01-00-pre dev branche to HEAD.
--- projects/lcdd/trunk/examples/processors/OpticalCalorimeterHitProcessor.lcdd 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/examples/processors/OpticalCalorimeterHitProcessor.lcdd 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?> -<lcdd xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcdd/2.0/lcdd.xsd"> - <header> - <detector name="OpticalCalorimeterProcessorTest"/> - <author name="Jeremy McCormick"/> - </header> - <iddict> - <idspec name="CalHits" length="64"> - <idfield signed="false" label="layer" length="7" start="0"/> - <idfield signed="false" label="system" length="3" start="7"/> - <idfield signed="true" label="x" length="16" start="32"/> - <idfield signed="true" label="y" length="16" start="48"/> - </idspec> - </iddict> - <sensitive_detectors> - <calorimeter name="TestBeamCalorimeterTest" ecut="0.0" eunit="MeV" verbose="0"> - <idspecref ref="CalHits"/> - <hit_processor type="OpticalCalorimeterHitProcessor"/> - <hits_collection name="MyHitsCollection"/> - <hits_collection name="MyHitsCollection2"/> - <grid_xyz grid_size_x="10.0" grid_size_y="10.0" grid_size_z="0.0"/> - </calorimeter> - </sensitive_detectors> - <limits/> - <regions> - <region name="TrackingRegion" store_secondaries="true" cut="10.0" lunit="mm" threshold="1.0" eunit="MeV"/> - </regions> - <display/> - <gdml> - <define> - <rotation name="identity_rot" x="0.0" y="0.0" z="0.0" unit="radian"/> - <rotation name="reflect_rot" x="3.141592653589793" y="0.0" z="0.0" unit="radian"/> - <position name="identity_pos" x="0.0" y="0.0" z="0.0" unit="mm"/> - <constant name="world_x" value="50000.0"/> - <constant name="tracking_region_zmax" value="2000.0"/> - <constant name="world_z" value="50000.0"/> - <constant name="world_side" value="50000.0"/> - <constant name="world_y" value="50000.0"/> - <constant name="cm" value="10.0"/> - <constant name="tracking_region_radius" value="10000.0"/> - <position name="TestBeamCalorimeterTest_position" x="0.0" y="0.0" z="0.0" unit="mm"/> - <position name="TestBeamCalorimeterTest_layerType0_slice0_position" x="0.0" y="0.0" z="0.0" unit="mm"/> - <position name="TestBeamCalorimeterTest_layer0_position" x="0.0" y="0.0" z="0.0" unit="mm"/> - <matrix name="Rindex" coldim="2" values="1.45864E-6 2.20849 1.46036E-6 2.20857 1.46208E-6 2.20865 1.4638E-6 2.20874 1.46553E-6 2.20882 1.46727E-6 2.2089 1.46901E-6 2.20899 1.47075E-6 2.20907 1.4725E-6 2.20916 1.47425E-6 2.20924 1.476E-6 2.20933 1.47776E-6 2.20941 1.47952E-6 2.2095 1.48129E-6 2.20958 1.48306E-6 2.20967 1.48484E-6 2.20976 1.48662E-6 2.20984 1.48841E-6 2.20993 1.49019E-6 2.21002 1.49199E-6 2.21011 1.49379E-6 2.2102 1.49559E-6 2.21028 1.49739E-6 2.21037 1.4992E-6 2.21046 1.50102E-6 2.21055 1.50284E-6 2.21064 1.50466E-6 2.21073 1.50649E-6 2.21083 1.50832E-6 2.21092 1.51016E-6 2.21101 1.512E-6 2.2111 1.51385E-6 2.21119 1.5157E-6 2.21129 1.51755E-6 2.21138 1.51941E-6 2.21148
! ;1.52128E-6 2.21157 1.52315E-6 2.21166 1.52502E-6 2.21176 1.5269E-6 2.21186 1.52878E-6 2.21195 1.53067E-6 2.21205 1.53256E-6 2.2121[...] - </define> - <materials> - <element Z="82" formula="Pb" name="Pb"> - <atom type="A" unit="g/mol" value="207.217"/> - </element> - <element Z="74" formula="W" name="W"> - <atom type="A" unit="g/mol" value="183.842"/> - </element> - <element Z="8" formula="O" name="O"> - <atom type="A" unit="g/mol" value="15.9994"/> - </element> - <element Z="83" formula="Bi" name="Bi"> - <atom type="A" unit="g/mol" value="208.98"/> - </element> - <element Z="32" formula="Ge" name="Ge"> - <atom type="A" unit="g/mol" value="72.6128"/> - </element> - <element Z="28" formula="Ni" name="Ni"> - <atom type="A" unit="g/mol" value="58.6933"/> - </element> - <element Z="26" formula="Fe" name="Fe"> - <atom type="A" unit="g/mol" value="55.8451"/> - </element> - <element Z="6" formula="C" name="C"> - <atom type="A" unit="g/mol" value="12.0107"/> - </element> - <element Z="1" formula="H" name="H"> - <atom type="A" unit="g/mol" value="1.00794"/> - </element> - <element Z="5" formula="B" name="B"> - <atom type="A" unit="g/mol" value="10.811"/> - </element> - <element name="N" formula="N" Z="7.0"> - <atom type="A" unit="g/mol" value="14.00674"/> - </element> - <element name="Ar" formula="Ar" Z="18.0"> - <atom type="A" unit="g/mol" value="39.948"/> - </element> - <material name="PbWO4"> - <property name="RINDEX" ref="Rindex"/> - <D value="8.28" unit="g/cm3" type="density"/> - <composite n="1" ref="Pb"/> - <composite n="1" ref="W"/> - <composite n="4" ref="O"/> - </material> - <material name="Air"> - <D type="density" unit="g/cm3" value="0.0012"/> - <fraction n="0.754" ref="N"/> - <fraction n="0.234" ref="O"/> - <fraction n="0.012" ref="Ar"/> - </material> - </materials> - <solids> - <box name="world_box" x="world_x" y="world_y" z="world_z"/> - <tube name="tracking_cylinder" deltaphi="6.283185307179586" rmin="0.0" rmax="tracking_region_radius" z="2*tracking_region_zmax"/> - <box name="TestBeamCalorimeterTest_box" x="5000.0" y="5000.0" z="5000.0"/> - <box name="TestBeamCalorimeterTest_layerType0_box" x="5000.0" y="5000.0" z="5000.0"/> - <box name="TestBeamCalorimeterTest_layerType0_slice0_box" x="5000.0" y="5000.0" z="5000.0"/> - </solids> - <structure> - <!-- - <volume name="TestBeamCalorimeterTest_layerType0_slice0"> - <materialref ref="PbWO4"/> - <solidref ref="TestBeamCalorimeterTest_layerType0_slice0_box"/> - </volume> - --> - <volume name="TestBeamCalorimeterTest_layerType0"> - <materialref ref="PbWO4"/> - <solidref ref="TestBeamCalorimeterTest_layerType0_box"/> - <!-- - <physvol> - <volumeref ref="TestBeamCalorimeterTest_layerType0_slice0"/> - <positionref ref="TestBeamCalorimeterTest_layerType0_slice0_position"/> - <rotationref ref="identity_rot"/> - <physvolid field_name="slice" value="0"/> - </physvol> - --> - </volume> - <volume name="TestBeamCalorimeterTest_envelope"> - <materialref ref="Air"/> - <solidref ref="TestBeamCalorimeterTest_box"/> - <physvol> - <volumeref ref="TestBeamCalorimeterTest_layerType0"/> - <positionref ref="TestBeamCalorimeterTest_layer0_position"/> - <rotationref ref="identity_rot"/> - <physvolid field_name="layer" value="0"/> - </physvol> - </volume> - <!-- - <volume name="tracking_volume"> - <materialref ref="Air"/> - <solidref ref="tracking_cylinder"/> - <physvol> - <volumeref ref="TestBeamCalorimeterTest_envelope"/> - <positionref ref="TestBeamCalorimeterTest_position"/> - <rotationref ref="identity_rot"/> - <physvolid field_name="system" value="0"/> - </physvol> - <regionref ref="TrackingRegion"/> - </volume> - --> - <volume name="world_volume"> - <materialref ref="Air"/> - <solidref ref="world_box"/> - <!-- - <physvol> - <volumeref ref="tracking_volume"/> - <positionref ref="identity_pos"/> - <rotationref ref="identity_rot"/> - </physvol> - --> - <physvol> - <volumeref ref="TestBeamCalorimeterTest_envelope"/> - <positionref ref="TestBeamCalorimeterTest_position"/> - <rotationref ref="identity_rot"/> - <physvolid field_name="system" value="0"/> - </physvol> - </volume> - </structure> - <setup name="Default" version="1.0"> - <world ref="world_volume"/> - </setup> - </gdml> - <fields/> -</lcdd>[Note: Some over-long lines of diff output only partialy shown]
--- projects/lcdd/trunk/examples/processors/UnsegmentedCalorimeterHitProcessorTest.lcdd 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/examples/processors/UnsegmentedCalorimeterHitProcessorTest.lcdd 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,132 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?> -<lcdd xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcdd/2.0/lcdd.xsd"> - <header> - <detector name="UnsegmentedCalorimeterProcessorTest" /> - <author name="Jeremy McCormick" /> - <comment>Test of UnsegmentedCalorimeterHitProcessor hit processor</comment> - </header> - <iddict> - <idspec name="CalHits" length="64"> - <idfield signed="false" label="layer" length="7" start="0" /> - <idfield signed="false" label="system" length="3" start="7" /> - <idfield signed="true" label="x" length="16" start="32" /> - <idfield signed="true" label="y" length="16" start="48" /> - </idspec> - </iddict> - <sensitive_detectors> - <calorimeter name="TestBeamCalorimeterTest" ecut="0.0" eunit="MeV" verbose="0"> - <idspecref ref="CalHits" /> - <hit_processor type="UnsegmentedCalorimeterHitProcessor" /> - <hits_collection name="MyHitsCollection" /> - <grid_xyz grid_size_x="10.0" grid_size_y="10.0" grid_size_z="0.0" /> - </calorimeter> - </sensitive_detectors> - <limits /> - <regions> - <region name="TrackingRegion" store_secondaries="true" cut="10.0" lunit="mm" threshold="1.0" eunit="MeV" /> - </regions> - <display /> - <gdml> - <define> - <rotation name="identity_rot" x="0.0" y="0.0" z="0.0" unit="radian" /> - <rotation name="reflect_rot" x="3.141592653589793" y="0.0" z="0.0" unit="radian" /> - <position name="identity_pos" x="0.0" y="0.0" z="0.0" unit="mm" /> - <constant name="world_x" value="50000.0" /> - <constant name="tracking_region_zmax" value="2000.0" /> - <constant name="world_z" value="50000.0" /> - <constant name="world_side" value="50000.0" /> - <constant name="world_y" value="50000.0" /> - <constant name="cm" value="10.0" /> - <constant name="tracking_region_radius" value="10000.0" /> - <position name="TestBeamCalorimeterTest_position" x="0.0" y="0.0" z="0.0" unit="mm" /> - <position name="TestBeamCalorimeterTest_layerType0_slice0_position" x="0.0" y="0.0" z="0.0" unit="mm" /> - <position name="TestBeamCalorimeterTest_layer0_position" x="0.0" y="0.0" z="0.0" unit="mm" /> - </define> - <materials> - <element name="N" formula="N" Z="7.0"> - <atom type="A" unit="g/mol" value="14.00674" /> - </element> - <element name="O" formula="O" Z="8.0"> - <atom type="A" unit="g/mol" value="15.9994" /> - </element> - <element name="Ar" formula="Ar" Z="18.0"> - <atom type="A" unit="g/mol" value="39.948" /> - </element> - <material name="Air"> - <D type="density" unit="g/cm3" value="0.0012" /> - <fraction n="0.754" ref="N" /> - <fraction n="0.234" ref="O" /> - <fraction n="0.012" ref="Ar" /> - </material> - <element name="Fe" formula="Fe" Z="26.0"> - <atom type="A" unit="g/mol" value="55.845" /> - </element> - <element name="C" formula="C" Z="6.0"> - <atom type="A" unit="g/mol" value="12.0107" /> - </element> - <material name="Steel235"> - <D value="7.85" unit="g/cm3" /> - <fraction n="0.998" ref="Fe" /> - <fraction n=".002" ref="C" /> - </material> - </materials> - <solids> - <box name="world_box" x="world_x" y="world_y" z="world_z" /> - <tube name="tracking_cylinder" deltaphi="6.283185307179586" rmin="0.0" rmax="tracking_region_radius" z="2*tracking_region_zmax" /> - <box name="TestBeamCalorimeterTest_box" x="5000.0" y="5000.0" z="5000.0" /> - <box name="TestBeamCalorimeterTest_layerType0_box" x="5000.0" y="5000.0" z="5000.0" /> - <box name="TestBeamCalorimeterTest_layerType0_slice0_box" x="5000.0" y="5000.0" z="5000.0" /> - </solids> - <structure> - <volume name="TestBeamCalorimeterTest_layerType0_slice0"> - <materialref ref="Steel235" /> - <solidref ref="TestBeamCalorimeterTest_layerType0_slice0_box" /> - </volume> - <volume name="TestBeamCalorimeterTest_layerType0"> - <materialref ref="Air" /> - <solidref ref="TestBeamCalorimeterTest_layerType0_box" /> - <physvol> - <volumeref ref="TestBeamCalorimeterTest_layerType0_slice0" /> - <positionref ref="TestBeamCalorimeterTest_layerType0_slice0_position" /> - <rotationref ref="identity_rot" /> - <physvolid field_name="slice" value="0" /> - </physvol> - </volume> - <volume name="TestBeamCalorimeterTest_envelope"> - <materialref ref="Air" /> - <solidref ref="TestBeamCalorimeterTest_box" /> - <physvol> - <volumeref ref="TestBeamCalorimeterTest_layerType0" /> - <positionref ref="TestBeamCalorimeterTest_layer0_position" /> - <rotationref ref="identity_rot" /> - <physvolid field_name="layer" value="0" /> - </physvol> - </volume> - <volume name="tracking_volume"> - <materialref ref="Air" /> - <solidref ref="tracking_cylinder" /> - <physvol> - <volumeref ref="TestBeamCalorimeterTest_envelope" /> - <positionref ref="TestBeamCalorimeterTest_position" /> - <rotationref ref="identity_rot" /> - <physvolid field_name="system" value="0" /> - </physvol> - <regionref ref="TrackingRegion" /> - </volume> - <volume name="world_volume"> - <materialref ref="Air" /> - <solidref ref="world_box" /> - <physvol> - <volumeref ref="tracking_volume" /> - <positionref ref="identity_pos" /> - <rotationref ref="identity_rot" /> - </physvol> - </volume> - </structure> - <setup name="Default" version="1.0"> - <world ref="world_volume" /> - </setup> - </gdml> - <fields /> -</lcdd> -
--- projects/lcdd/trunk/include/lcdd/core/LCDDDetectorConstruction.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/core/LCDDDetectorConstruction.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,3 +1,10 @@
+/** + * @mainpage Linear Collider Detector Description (LCDD) Documentation + * + * @par + * LCDD is a framework for description of %detector geometries and associated information + * at runtime using a XML language and parser. + */
#ifndef LCDD_CORE_LCDDDETECTORCONSTRUCTION_HH_ #define LCDD_CORE_LCDDDETECTORCONSTRUCTION_HH_ 1
--- projects/lcdd/trunk/include/lcdd/core/LCDDParser.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/core/LCDDParser.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -8,7 +8,6 @@
class G4VPhysicalVolume; /**
- * @class LCDDParser
* @brief * The parser for reading LCDD XML files into Geant4. * @note
--- projects/lcdd/trunk/include/lcdd/core/LCDDProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/core/LCDDProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -8,8 +8,8 @@
// LCDD #include "lcdd/detectors/SensitiveDetector.hh"
-#include "lcdd/geant4/PhysicsLimitSet.hh" -#include "lcdd/geant4/LCDDHeaderRecord.hh"
+#include "lcdd/core/PhysicsLimitSet.hh" +#include "lcdd/core/LCDDHeaderRecord.hh"
// STL #include <string>
--- projects/lcdd/trunk/include/lcdd/detectors/BasicTrackerHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/BasicTrackerHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -15,7 +15,7 @@
/** * Class constructor. */
- BasicTrackerHitProcessor(TrackerSD* tracker);
+ BasicTrackerHitProcessor();
/** * Class destructor.
@@ -31,14 +31,15 @@
}; /**
+ * @brief
* The factory for creating new BasicTrackerHitProcessor objects. */ class BasicTrackerHitProcessorFactory: public HitProcessorFactory { public:
- HitProcessor* createHitProcessor(SensitiveDetector* sd) { - return new BasicTrackerHitProcessor(dynamic_cast<TrackerSD*>(sd));
+ HitProcessor* createHitProcessor() { + return new BasicTrackerHitProcessor();
} const std::string& handlesType() {
--- projects/lcdd/trunk/include/lcdd/detectors/CalorimeterHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/CalorimeterHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -18,7 +18,8 @@
/** * Class destructor. */
- virtual ~CalorimeterHitProcessor();
+ virtual ~CalorimeterHitProcessor() {
+ }
protected:
@@ -26,7 +27,9 @@
* Class constructor. * @param[in] ro The CellReadout used by the processor. */
- CalorimeterHitProcessor(CalorimeterSD* calorimeter);
+ CalorimeterHitProcessor() + : _calorimeter(NULL) { + }
public:
@@ -35,10 +38,28 @@
* @param[in] step The G4Step object of the energy deposition. * @todo This should really be pure virtual, but I can't get it to link correctly. */
- virtual bool processHits(G4Step* step);
+ virtual bool processHits(G4Step* step) = 0;
+ /** + * Get the Calorimeter associated with this HitProcessor. + */ + CalorimeterSD* getCalorimeter() { + return dynamic_cast<CalorimeterSD*>(getSensitiveDetector()); + } + + /** + * Override super class method to set reference to CalorimeterSD. + * @param[in] detector The SensitiveDetector associated to this HitProcessor. + */ + void setSensitiveDetector(SensitiveDetector* detector) { + HitProcessor::setSensitiveDetector(detector); + _calorimeter = dynamic_cast<CalorimeterSD*>(getSensitiveDetector()); + } +
protected:
+
CalorimeterSD* _calorimeter;
+
}; #endif
--- projects/lcdd/trunk/include/lcdd/detectors/Cerenkov.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/Cerenkov.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/include/lcdd/detectors/CurrentTrackState.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/CurrentTrackState.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -4,6 +4,10 @@
// Geant4 #include "globals.hh"
+/** + * @brief + * A global static track ID to be set externally from LCDD + */
class CurrentTrackState { private:
--- projects/lcdd/trunk/include/lcdd/detectors/HitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/HitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -4,8 +4,14 @@
// Geant4 #include "G4Step.hh"
+#include "lcdd/detectors/SensitiveDetector.hh" + +#include <string> + +class SensitiveDetector; +
/**
- * @brief Pure virtual class defining an interface for processing hits from within sensitive detectors.
+ * @brief Virtual class defining an interface for processing hits from within sensitive detectors.
*/ class HitProcessor {
@@ -14,14 +20,19 @@
/** * Class constructor. */
- HitProcessor();
+ HitProcessor() + : _detector(NULL), + _collectionName(""), + _collectionIndex(0) { + }
public: /** * Class destructor. */
- virtual ~HitProcessor();
+ virtual ~HitProcessor() {
+ }
/** * Process steps to produce hits.
@@ -29,6 +40,44 @@
* @return True if hits were created or modified; false if not. */ virtual bool processHits(G4Step* step) = 0;
+ + /** + * Get the SensitiveDetector associated with this HitProcessor. + * @return The SensitiveDetector of this HitProcessor. + */ + SensitiveDetector* getSensitiveDetector() const { + return _detector; + } + + /** + * Set the SensitiveDetector associated with this HitProcessor. + * @param[in] detector The SensitiveDetector of this HitProcessor. + */ + virtual void setSensitiveDetector(SensitiveDetector* detector) { + _detector = detector; + if (_collectionName != "") { + for (int i=0, n=detector->GetNumberOfCollections(); i<n; i++) { + std::string aCollectionName = detector->GetCollectionName(i); + if (aCollectionName == _collectionName) { + _collectionIndex = i; + } + } + } + } + + void setCollectionName(const std::string& collectionName) { + _collectionName = collectionName; + } + + int getCollectionIndex() { + return _collectionIndex; + } + +protected: + + SensitiveDetector* _detector; + std::string _collectionName; + int _collectionIndex;
}; #endif
--- projects/lcdd/trunk/include/lcdd/detectors/HitProcessorFactory.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/HitProcessorFactory.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -5,6 +5,10 @@
#include "lcdd/detectors/HitProcessor.hh" #include "lcdd/detectors/SensitiveDetector.hh"
+/** + * @brief + * A factory class for creating HitProcessor objects from a type string + */
class HitProcessorFactory { public:
@@ -25,7 +29,7 @@
* @param[in] sd The SensitiveDetector to which the HitProcessor will be added. * @return The specific implementation of HitProcessor produced by this factory. */
- virtual HitProcessor* createHitProcessor(SensitiveDetector* sd) = 0;
+ virtual HitProcessor* createHitProcessor() = 0;
/** * Get the type of HitProcessor created by this factory e.g. name of the class.
--- projects/lcdd/trunk/include/lcdd/detectors/HitProcessorManager.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/HitProcessorManager.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -4,6 +4,10 @@
// LCDD #include "lcdd/detectors/HitProcessorFactory.hh"
+/** + * @brief + * The global registry of all HitProcessor objects + */
class HitProcessorManager { private:
--- projects/lcdd/trunk/include/lcdd/detectors/LegacyCalorimeterHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/LegacyCalorimeterHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,51 +0,0 @@
-#ifndef LCDD_DETECTORS_LEGACYCALORIMETERHITPROCESSOR_HH_ -#define LCDD_DETECTORS_LEGACYCALORIMETERHITPROCESSOR_HH_ 1 - -// LCDD -#include "lcdd/detectors/CalorimeterHitProcessor.hh" -#include "lcdd/detectors/CalorimeterSD.hh" -#include "lcdd/detectors/HitProcessorFactory.hh" - -/** - * @brief Implementation of hit processing behavior for CalorimeterSD objects with Segmentation. - * @todo Change name to SegmentedCalorimeterHitProcessor. - */ -class LegacyCalorimeterHitProcessor: public CalorimeterHitProcessor { - -public: - - /** - * Class constructor. - */ - LegacyCalorimeterHitProcessor(CalorimeterSD* calorimeter); - - /** - * Class destructor. - */ - virtual ~LegacyCalorimeterHitProcessor(); - - /** - * Process steps to produce hits. - * @param[in] step A G4Step object. - */ - bool processHits(G4Step* step); -}; - -/** - * The factory for creating new LegacyCalorimeterHitProcessor objects. - */ -class LegacyCalorimeterHitProcessorFactory: public HitProcessorFactory { - -public: - - HitProcessor* createHitProcessor(SensitiveDetector* sd) { - return new LegacyCalorimeterHitProcessor(dynamic_cast<CalorimeterSD*>(sd)); - } - - const std::string& handlesType() { - static std::string typeName = "LegacyCalorimeterHitProcessor"; - return typeName; - } -}; - -#endif
--- projects/lcdd/trunk/include/lcdd/detectors/OpticalCalorimeterHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/OpticalCalorimeterHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/include/lcdd/detectors/ScoringTrackerHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/ScoringTrackerHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -6,7 +6,8 @@
#include "lcdd/detectors/HitProcessorFactory.hh" /**
- * HitProcessor to implement scoring behavior, that only records a hit per track.
+ * @brief + * HitProcessor to implement scoring behavior, that only records a hit per track
*/ class ScoringTrackerHitProcessor: public TrackerHitProcessor {
@@ -16,7 +17,7 @@
* Class constructor. * @param[in] tracker The tracker SD. */
- ScoringTrackerHitProcessor(TrackerSD* tracker);
+ ScoringTrackerHitProcessor();
/** * Class destructor.
@@ -35,14 +36,15 @@
}; /**
- * The factory for creating new BasicTrackerHitProcessor objects.
+ * @brief + * The factory for creating new ScoringTrackerHitProcessor objects
*/ class ScoringTrackerHitProcessorFactory: public HitProcessorFactory { public:
- HitProcessor* createHitProcessor(SensitiveDetector* sd) { - return new ScoringTrackerHitProcessor(dynamic_cast<TrackerSD*>(sd));
+ HitProcessor* createHitProcessor() { + return new ScoringTrackerHitProcessor();
} const std::string& handlesType() {
--- projects/lcdd/trunk/include/lcdd/detectors/SensitiveDetector.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/SensitiveDetector.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -7,13 +7,14 @@
// LCDD #include "lcdd/detectors/StepReadout.hh"
-#include "lcdd/detectors/HitProcessor.hh"
#include "lcdd/id/IdSpec.hh" #include "lcdd/id/Id64bit.hh" class G4UImessenger; class G4VHitsCollection;
+class HitProcessor; +
/** * @brief A basic implementation of G4VSensitiveDetector. * @note Primary attributes include verbosity, energy cut,
@@ -26,7 +27,9 @@
* EType indicates the basic type of detector, e.g. tracker or calorimeter. */ enum EType {
- eNone = 0, eTracker = 1, eCalorimeter = 2
+ eNone = 0, + eTracker = 1, + eCalorimeter = 2
}; static const std::string& TRACKER;
--- projects/lcdd/trunk/include/lcdd/detectors/StepCombiningTrackerHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/StepCombiningTrackerHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,92 +0,0 @@
-#ifndef LCDD_DETECTORS_STEPCOMBININGTRACKERHITPROCESSOR_HH_ -#define LCDD_DETECTORS_STEPCOMBININGTRACKERHITPROCESSOR_HH_ 1 - -// LCDD -#include "lcdd/detectors/TrackerHitProcessor.hh" -#include "lcdd/detectors/HitProcessorFactory.hh" - -// Geant4 -#include "G4Track.hh" - -/** - * TrackerHitProcessor that combines information from multiple steps - * into a single TrackerHit. - */ -class StepCombiningTrackerHitProcessor: public TrackerHitProcessor { -public: - - /** - * Class constructor. - * @param[in] tracker Pointer to TrackerSD. - */ - StepCombiningTrackerHitProcessor(TrackerSD* tracker); - - /** - * Class destructor. - */ - virtual ~StepCombiningTrackerHitProcessor(); - - /** - * Process steps to produce hits. - * @param[in] step A G4Step object. - * @return True if hit was created or modified; false if not. - */ - bool processHits(G4Step* step); - -private: - - /** - * Start a new hit. - * @param[in] step The G4Step for the new hit. - * @param[in] stepPoint The G4StepPoint for the new hit. - */ - void startHit(G4Step* step, G4StepPoint* aStepPoint); - - /** - * Update an existing hit with current step data. - * @param[in] step A G4Step object. - */ - void updateHit(G4Step* step); - - /** - * Insert a new hit after all data is added. - */ - bool insertHit(G4Step* step); - - /** - * Clear the current hit. - */ - void clear(); - -private: - - int _currentTrackID; - G4VPhysicalVolume* _currentPV; - G4ThreeVector _entryPoint; - G4ThreeVector _exitPoint; - G4ThreeVector _entryMomentum; - G4ThreeVector _exitMomentum; - G4double _edepTotal; - G4double _minTime; - bool _startedHit; - G4Track* _currentTrack; -}; - -/** - * The factory for creating new BasicTrackerHitProcessor objects. - */ -class StepCombiningTrackerHitProcessorFactory: public HitProcessorFactory { - -public: - - HitProcessor* createHitProcessor(SensitiveDetector* sd) { - return new StepCombiningTrackerHitProcessor(dynamic_cast<TrackerSD*>(sd)); - } - - const std::string& handlesType() { - static std::string typeName = "StepCombiningTrackerHitProcessor"; - return typeName; - } -}; - -#endif
--- projects/lcdd/trunk/include/lcdd/detectors/TrackerHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/TrackerHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,6 +1,7 @@
#ifndef LCDD_DETECTORS_TRACKERHITPROCESSOR_HH_ #define LCDD_DETECTORS_TRACKERHITPROCESSOR_HH_ 1
+#include "lcdd/detectors/HitProcessor.hh"
#include "lcdd/detectors/TrackerSD.hh" /**
@@ -13,12 +14,14 @@
* Class constructor. * @param[in] tracker Pointer to TrackerSD. */
- TrackerHitProcessor(TrackerSD* tracker);
+ TrackerHitProcessor() { + }
/** * Class destructor. */
- virtual ~TrackerHitProcessor();
+ virtual ~TrackerHitProcessor() {
+ }
/** * Process hits to produce steps.
@@ -27,9 +30,12 @@
*/ virtual bool processHits(G4Step* step) = 0;
-protected: - - TrackerSD* _tracker;
+ /** + * Get the Calorimeter associated with this HitProcessor. + */ + inline TrackerSD* getTracker() { + return dynamic_cast<TrackerSD*>(getSensitiveDetector()); + }
}; #endif
--- projects/lcdd/trunk/include/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/include/lcdd/id/IdManager.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/id/IdManager.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -4,8 +4,8 @@
// LCDD #include "lcdd/id/IdSpec.hh" #include "lcdd/id/IdVec.hh"
-#include "lcdd/geant4/PhysVolId.hh" -#include "lcdd/geant4/PhysVolIdMap.hh"
+#include "lcdd/id/PhysVolId.hh" +#include "lcdd/id/PhysVolIdMap.hh"
// Geant4 #include "G4VPhysicalVolume.hh"
--- projects/lcdd/trunk/include/lcdd/processes/calorimeterProcess.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/processes/calorimeterProcess.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,62 +0,0 @@
-#ifndef LCDD_PROCESSES_CALORIMETERPROCESS_HH_ -#define LCDD_PROCESSES_CALORIMETERPROCESS_HH_ 1 - -// 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/calorimeter.hh" -#include "lcdd/processes/SensitiveDetectorTypeProcess.hh" - -// STL -#include <iostream> - -/** - * @brief The SAX process for calorimeter elements. - * @note Calls SAX processor for SensitiveDetectorTypeProcess parent class. - */ -class calorimeterProcess: public SensitiveDetectorTypeProcess { -public: - - /** - * Class constructor. - */ - calorimeterProcess(const ProcessingContext* context = 0); - - /** - * Class destructor. - */ - virtual ~calorimeterProcess(); - - /** - * Start element processing. - */ - virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs); - - /** - * End element processing. - */ - virtual void EndElement(const std::string&); - - /** - * - */ - virtual void Characters(const std::string&); - - /** - * - */ - virtual void StackPopNotify(const std::string& name); - - /** - */ - virtual const std::string& State() const; -}; - -#endif
--- projects/lcdd/trunk/include/lcdd/processes/hit_processorProcess.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/processes/hit_processorProcess.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,43 +0,0 @@
-#ifndef LCDD_PROCESSES_HIT_PROCESSORPROCESS_HH_ -#define LCDD_PROCESSES_HIT_PROCESSORPROCESS_HH_ 1 - -// GDML -#include "Saxana/SAXStateProcess.h" -#include "Saxana/SAXObject.h" - -class hit_processorProcess: public SAXStateProcess { - -public: - - hit_processorProcess(); - - hit_processorProcess(ProcessingContext* context); - - virtual ~hit_processorProcess(); - - /** - * Start element processing. - */ - virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs); - - /** - * End element processing. - */ - virtual void EndElement(const std::string&); - - /** - * Process element character content. - */ - virtual void Characters(const std::string&); - - virtual void StackPopNotify(const std::string& name); - - virtual const std::string& State() const; - -private: - - SAXObject* _obj; - -}; - -#endif
--- projects/lcdd/trunk/include/lcdd/processes/hits_collectionProcess.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/processes/hits_collectionProcess.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,43 +0,0 @@
-#ifndef LCDD_PROCESSES_HITS_COLLECTIONPROCESS_HH_ -#define LCDD_PROCESSES_HITS_COLLECTIONPROCESS_HH_ 1 - -// GDML -#include "Saxana/SAXStateProcess.h" -#include "Saxana/SAXObject.h" - -class hits_collectionProcess: public SAXStateProcess { - -public: - - hits_collectionProcess(); - - hits_collectionProcess(ProcessingContext* context); - - virtual ~hits_collectionProcess(); - - /** - * Start element processing. - */ - virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs); - - /** - * End element processing. - */ - virtual void EndElement(const std::string&); - - /** - * Process element character content. - */ - virtual void Characters(const std::string&); - - virtual void StackPopNotify(const std::string& name); - - virtual const std::string& State() const; - -private: - - SAXObject* _obj; - -}; - -#endif
--- projects/lcdd/trunk/include/lcdd/schema/HitProcessorType.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/schema/HitProcessorType.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -45,6 +45,22 @@
} /**
+ * Set the hits collection name of the HitProcessor. + * @param s The type of the HitProcessor. + */ + void set_collection_name(const std::string& s) { + _collection_name = s; + } + + /** + * Get the hits collection name of the HitProcessor. + * @return The type of the HitProcessor. + */ + const std::string& get_collection_name() const { + return _collection_name; + } + + /**
* Add child content. * @param tag The tag of the child. * @param so The SAXObject of the child.
@@ -56,6 +72,7 @@
private: std::string _type;
+ std::string _collection_name;
ContentSequence _sequence; };
--- projects/lcdd/trunk/include/lcdd/schema/HitsCollectionType.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/schema/HitsCollectionType.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,50 +0,0 @@
-#ifndef LCDD_SCHEMA_HITSCOLLECTIONTYPE_HH_ -#define LCDD_SCHEMA_HITSCOLLECTIONTYPE_HH_ 1 - -// STL -#include <string> - -// GDML -#include "Schema/ContentGroup.h" - -/** - * @brief - * The HitsCollectionType from the XML schema. - */ -class HitsCollectionType { - -public: - - /** - * Class constructor. - */ - HitsCollectionType() { - } - - /** - * Class destructor. - */ - virtual ~HitsCollectionType() { - } - - /** - * Set the name of the HitsCollection. - * @param s The name of the HitsCollection. - */ - void set_name(const std::string& s) { - _name = s; - } - - /** - * Get the name of the HitsCollection. - * @return The name of the HitsCollection. - */ - const std::string& get_name() const { - return _name; - } - -private: - std::string _name; -}; - -#endif
--- projects/lcdd/trunk/include/lcdd/schema/NonprojectiveCylinderSegmentationType.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/schema/NonprojectiveCylinderSegmentationType.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/include/lcdd/schema/hit_processor.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/schema/hit_processor.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -7,6 +7,10 @@
// GDML #include "Saxana/SAXObject.h"
+/** + * @brief + * The hit_processor element from the schema + */
class hit_processor: public SAXObject, public HitProcessorType { public:
--- projects/lcdd/trunk/include/lcdd/schema/hits_collection.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/schema/hits_collection.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,40 +0,0 @@
-#ifndef LCDD_SCHEMA_HITS_COLLECTION_HH_ -#define LCDD_SCHEMA_HITS_COLLECTION_HH_ 1 - -// LCDD -#include "lcdd/schema/HitsCollectionType.hh" - -// GDML -#include "Saxana/SAXObject.h" - -/** - * @brief - * The hits_collection element from the XML schema. - */ -class hits_collection: public SAXObject, public HitsCollectionType { - -public: - - /** - * Class constructor. - */ - hits_collection() { - } - - /** - * Class destructor. - */ - virtual ~hits_collection() { - } - - /** - * Get the type of this SAXObject. - * @return The type of this SAXObject. - */ - virtual SAXObject::Type type() { - return SAXObject::element; - } - -}; - -#endif
--- projects/lcdd/trunk/include/lcdd/schema/nonprojective_cylinder.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/schema/nonprojective_cylinder.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/include/lcdd/segmentation/CellReadout.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/segmentation/CellReadout.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -7,20 +7,26 @@
#include <string> /**
- * @brief Pure virtual base class for calorimeter cell readouts to implement. - * @todo Move to DDSegmentation package.
+ * @brief + * Pure virtual base class for calorimeter cell readouts to implement.
*/ class CellReadout { public:
- /** 2D XY position. */
+ /** + * @brief + * 2D XY position + */
struct Position2D { double x; double y; };
- /** Cell ID represented as a pair of int values. */
+ /** + * @brief + * Cell ID represented as a pair of int values + */
struct CellId { int ix; int iy;
--- projects/lcdd/trunk/include/lcdd/segmentation/NonprojectiveCylinderSegmentation.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/segmentation/NonprojectiveCylinderSegmentation.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/include/lcdd/subscribers/volumeExtendedSubscriber.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/subscribers/volumeExtendedSubscriber.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -12,7 +12,7 @@
#include "lcdd/core/LCDDProcessor.hh" #include "lcdd/id/IdManager.hh" #include "lcdd/detectors/SensitiveDetector.hh"
-#include "lcdd/geant4/PhysicsLimitSet.hh"
+#include "lcdd/core/PhysicsLimitSet.hh"
#include "lcdd/schema/sensitive_detector.hh" #include "lcdd/schema/RegionType.hh" #include "lcdd/schema/physvolidElem.hh"
--- projects/lcdd/trunk/include/lcdd/util/StoreInspector.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/util/StoreInspector.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -5,8 +5,8 @@
#include "lcdd/core/LCDDProcessor.hh" #include "lcdd/id/IdManager.hh" #include "lcdd/detectors/SensitiveDetector.hh"
-#include "lcdd/geant4/PhysicsLimitSet.hh" -#include "lcdd/geant4/UserRegionInformation.hh"
+#include "lcdd/core/PhysicsLimitSet.hh" +#include "lcdd/core/UserRegionInformation.hh"
// Geant4 #include "G4UIcmdWithAString.hh"
@@ -37,10 +37,9 @@
#include <cassert> #include <cmath>
-using std::endl; -
/**
- * @brief Templated class for printing the contents of a Geant4 or LCDD object store using a G4UIcommand.
+ * @brief + * Templated class for printing the contents of a Geant4 or LCDD object store using a G4UIcommand.
* @note * The store must have an STL vector or map as its backing data structure. */
@@ -153,12 +152,12 @@
* @return The same output stream. */ std::ostream& printStore(std::ostream& os) {
- os << "********* " + _name + " store ********" << endl << endl;
+ os << "********* " + _name + " store ********" << std::endl << std::endl;
for (const_iterator it = _container->begin(); it != _container->end(); it++) { printObject(os, getObjectName(it), getObject(it));
- os << "-------------------------------------" << endl;
+ os << "-------------------------------------" << std::endl;
}
- os << "*************************************" << endl << endl;
+ os << "*************************************" << std::endl << std::endl;
return os; }
@@ -169,8 +168,8 @@
* @param[in] object The object to print. */ std::ostream& printObject(std::ostream& os, const std::string& name, Object* obj) {
- os << _name << " - " << name << endl; - os << (*obj) << endl;
+ os << _name << " - " << name << std::endl; + os << (*obj) << std::endl;
return os; }
@@ -200,7 +199,7 @@
if (obj != 0) { printObject(std::cout, name, obj); } else {
- std::cerr << "ERROR: Object named " + name + " was not found in the " + _name + " store!" << endl;
+ std::cerr << "ERROR: Object named " + name + " was not found in the " + _name + " store!" << std::endl;
} } else { printStore(std::cout);
@@ -236,11 +235,11 @@
* @return The same output stream. */ std::ostream& operator<<(std::ostream& os, PhysicsLimitSet& limset) {
- os << endl;
+ os << std::endl;
for (PhysicsLimitSet::LimitSetMap::const_iterator it = limset.getLimitSetMap().begin(); it != limset.getLimitSetMap().end(); it++) { const PhysicsLimitSet::LimitNameType& name = it->first;
- os << name << endl;
+ os << name << std::endl;
std::string unit = ""; if (name == "ekin_min") {
@@ -259,10 +258,10 @@
const PhysicsLimitSet::LimitMap& limmap = it->second; for (PhysicsLimitSet::LimitMap::const_iterator iit = limmap.begin(); iit != limmap.end(); iit++) {
- os << '\t' << iit->first << '\t' << G4BestUnit(iit->second, unit) << endl;
+ os << '\t' << iit->first << '\t' << G4BestUnit(iit->second, unit) << std::endl;
} } else {
- os << "Unknown limit type " << name << endl;
+ os << "Unknown limit type " << name << std::endl;
} } return os;
@@ -275,10 +274,10 @@
* @return The same output stream. */ std::ostream& operator<<(std::ostream &os, G4LogicalVolume &lv) {
- os << "solid: " << lv.GetSolid()->GetName() << endl; - os << "material: " << lv.GetMaterial()->GetName() << endl; - os << "mass: " << G4BestUnit(lv.GetMass(), "Mass") << endl; - os << "daughters: " << lv.GetNoDaughters() << endl;
+ os << "solid: " << lv.GetSolid()->GetName() << std::endl; + os << "material: " << lv.GetMaterial()->GetName() << std::endl; + os << "mass: " << G4BestUnit(lv.GetMass(), "Mass") << std::endl; + os << "daughters: " << lv.GetNoDaughters() << std::endl;
G4UserLimits* lim = lv.GetUserLimits(); os << "limits: ";
@@ -287,7 +286,7 @@
} else { os << "NONE"; }
- os << endl;
+ os << std::endl;
G4VSensitiveDetector* sd = lv.GetSensitiveDetector(); os << "SD: ";
@@ -296,7 +295,7 @@
} else { os << "NONE"; }
- os << endl;
+ os << std::endl;
G4Region* reg = lv.GetRegion(); os << "region: ";
@@ -305,7 +304,7 @@
} else { os << "NONE"; }
- os << endl;
+ os << std::endl;
const G4VisAttributes* vis = lv.GetVisAttributes(); os << "visattributes: ";
@@ -314,7 +313,7 @@
} else { os << "NONE"; }
- os << endl;
+ os << std::endl;
return os; }
@@ -326,17 +325,17 @@
* @return The same output stream. */ std::ostream& operator<<(std::ostream &os, G4VPhysicalVolume &pv) {
- os << "lvolume: " << pv.GetLogicalVolume()->GetName() << endl; - os << "pos: " << pv.GetTranslation() << endl;
+ os << "lvolume: " << pv.GetLogicalVolume()->GetName() << std::endl; + os << "pos: " << pv.GetTranslation() << std::endl;
const G4RotationMatrix* rot = pv.GetRotation(); os << "rot: "; if (0 != rot) { rot->print(os); } else {
- os << "NONE" << endl;
+ os << "NONE" << std::endl;
}
- os << "copyNo: " << pv.GetCopyNo() << endl; - os << "# copies: " << pv.GetMultiplicity() << endl;
+ os << "copyNo: " << pv.GetCopyNo() << std::endl; + os << "# copies: " << pv.GetMultiplicity() << std::endl;
return os; } /**
@@ -346,12 +345,12 @@
* @return The same output stream. */ std::ostream& operator<<(std::ostream& os, IdSpec& id) {
- os << "# fields: " << id.getNumFields() << endl; - os << endl; - os << "label\tstart\tlength\tsigned" << endl;
+ os << "# fields: " << id.getNumFields() << std::endl; + os << std::endl; + os << "label\tstart\tlength\tsigned" << std::endl;
for (IdSpec::IdFields::const_iterator it = id.IdFieldsBegin(); it != id.IdFieldsEnd(); it++) { IdField* field = *it;
- os << field->getLabel() << '\t' << field->getStart() << '\t' << field->getLength() << '\t' << field->getSigned() << endl;
+ os << field->getLabel() << '\t' << field->getStart() << '\t' << field->getLength() << '\t' << field->getSigned() << std::endl;
} return os; }
@@ -363,14 +362,14 @@
* @return The same output stream. */ std::ostream& operator<<(std::ostream& os, SensitiveDetector& sd) {
- os << "fullPath: " << sd.GetFullPathName() << endl; - os << "HC: " << sd.getHCName() << endl; - os << "HCID: " << sd.getHCID() << endl; - os << "verbose: " << sd.getVerbose() << endl; - os << "ecut: " << sd.getEnergyCut() << endl; - os << "hasIdSpec: " << sd.hasIdSpec() << endl; - os << "isEndcap: " << sd.getEndcapFlag() << endl; - os << "isActive: " << sd.isActive() << endl;
+ os << "fullPath: " << sd.GetFullPathName() << std::endl; + os << "HC: " << sd.getHCName() << std::endl; + os << "HCID: " << sd.getHCID() << std::endl; + os << "verbose: " << sd.getVerbose() << std::endl; + os << "ecut: " << sd.getEnergyCut() << std::endl; + os << "hasIdSpec: " << sd.hasIdSpec() << std::endl; + os << "isEndcap: " << sd.getEndcapFlag() << std::endl; + os << "isActive: " << sd.isActive() << std::endl;
return os; }
@@ -381,13 +380,13 @@
* @return The same output stream. */ std::ostream& operator<<(std::ostream &os, G4Region ®) {
- os << "prod cut: " << reg.GetProductionCuts()->GetProductionCut(0) << endl;
+ os << "prod cut: " << reg.GetProductionCuts()->GetProductionCut(0) << std::endl;
UserRegionInformation* regInfo = static_cast<UserRegionInformation*>(reg.GetUserInformation()); if (0 != regInfo) {
- os << "store secondaries: " << regInfo->getStoreSecondaries() << endl; - os << "energy threshold: " << regInfo->getThreshold() << endl;
+ os << "store secondaries: " << regInfo->getStoreSecondaries() << std::endl; + os << "energy threshold: " << regInfo->getThreshold() << std::endl;
} else {
- os << "NO G4UserRegionInformation" << endl;
+ os << "NO G4UserRegionInformation" << std::endl;
} return os; }
@@ -411,10 +410,10 @@
*/ std::ostream& operator<<(std::ostream& os, G4VisAttributes &vis) { const G4Color& color = vis.GetColor();
- os << "RGB: " << color.GetRed() << " " << color.GetGreen() << " " << color.GetBlue() << endl; - os << "Alpha: " << color.GetAlpha() << endl; - os << "visible: " << vis.IsVisible() << endl; - os << "show daughters: " << !vis.IsDaughtersInvisible() << endl;
+ os << "RGB: " << color.GetRed() << " " << color.GetGreen() << " " << color.GetBlue() << std::endl; + os << "Alpha: " << color.GetAlpha() << std::endl; + os << "visible: " << vis.IsVisible() << std::endl; + os << "show daughters: " << !vis.IsDaughtersInvisible() << std::endl;
os << "forced drawing style: "; if (vis.IsForceDrawingStyle()) {
@@ -427,7 +426,7 @@
} else { os << "NONE"; }
- os << endl;
+ os << std::endl;
return os; }
--- projects/lcdd/trunk/include/lcdd/util/TimerUtil.hh 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/include/lcdd/util/TimerUtil.hh 2014-08-07 20:26:41 UTC (rev 3239) @@ -25,6 +25,10 @@
#include <map> #include <iostream>
+/** + * @brief + * A collection of static utilities for timing methods + */
class TimerUtil { static std::map<std::string, long> _timerMap;
--- projects/lcdd/trunk/schemas/lcdd/1.0/lcdd_sensitive_detectors.xsd 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/schemas/lcdd/1.0/lcdd_sensitive_detectors.xsd 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,35 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE xs:schema >
-
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0/"> -
+ xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0/">
<xs:complexType name="HitProcessorType"> <xs:attribute name="type" type="xs:string" use="required"/>
- </xs:complexType> - - <xs:complexType name="HitsCollectionType"> - <xs:attribute name="name" type="xs:string" use="required"/> - </xs:complexType> - - <xs:complexType name="SensitiveDetectorType"> -
+ <xs:attribute name="collection_name" type="xs:string" use="optional"/> + </xs:complexType> + <xs:complexType name="SensitiveDetectorType">
<xs:annotation> <xs:documentation> Sensitive detector type with a name, ID, and hits collection </xs:documentation>
- </xs:annotation> -
+ </xs:annotation>
<xs:sequence> <xs:element minOccurs="0" maxOccurs="1" name="idspecref" type="ReferenceType" /> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="hit_processor" type="HitProcessorType" />
- <xs:element name="hits_collection" type="HitsCollectionType" />
</xs:choice> </xs:sequence>
-
<xs:attribute name="name" type="xs:ID" use="required" /> <xs:attribute name="hits_collection" type="xs:string" /> <xs:attribute name="endcap_flag" type="xs:boolean" default="false" />
@@ -42,10 +32,8 @@
<xs:maxInclusive value="2"/> </xs:restriction> </xs:simpleType>
- </xs:attribute> -
+ </xs:attribute>
</xs:complexType>
-
<xs:element abstract="true" name="sd" type="SensitiveDetectorType"> <xs:annotation> <xs:documentation>
@@ -53,7 +41,6 @@
</xs:documentation> </xs:annotation> </xs:element>
-
<xs:complexType name="SensitiveDetectorsType"> <xs:annotation> <xs:documentation>
@@ -64,19 +51,17 @@
<xs:element minOccurs="0" maxOccurs="unbounded" ref="sd" /> </xs:sequence> </xs:complexType>
-
<xs:element name="sensitive_detectors" type="SensitiveDetectorsType"> <xs:annotation> <xs:documentation>
- Sensitive detector container element
+ SD container element
</xs:documentation> </xs:annotation> </xs:element>
-
<xs:complexType name="CalorimeterType"> <xs:annotation> <xs:documentation>
- Calorimeter sensitive detector type
+ Calorimeter SD type
</xs:documentation> </xs:annotation> <xs:complexContent>
@@ -94,20 +79,18 @@
</xs:attribute> </xs:extension> </xs:complexContent>
- </xs:complexType> -
+ </xs:complexType>
<xs:element name="calorimeter" substitutionGroup="sd" type="CalorimeterType"> <xs:annotation> <xs:documentation>
- Calorimeter sensitive detector element
+ Calorimeter SD element
</xs:documentation> </xs:annotation> </xs:element>
-
<xs:complexType name="TrackerType"> <xs:annotation> <xs:documentation>
- Tracker sensitive detector type
+ Tracker SD type
</xs:documentation> </xs:annotation> <xs:complexContent>
@@ -116,15 +99,13 @@
</xs:extension> </xs:complexContent> </xs:complexType>
-
<xs:element name="tracker" substitutionGroup="sd" type="TrackerType"> <xs:annotation> <xs:documentation>
- Tracker element
+ Tracker SD element
</xs:documentation> </xs:annotation> </xs:element>
-
<xs:complexType name="SegmentationType"> <xs:annotation> <xs:documentation>
@@ -132,19 +113,17 @@
</xs:documentation> </xs:annotation> </xs:complexType>
-
<xs:element abstract="true" name="segmentation" type="SegmentationType"> <xs:annotation> <xs:documentation>
- Abstract segmentation
+ Abstract segmentation type
</xs:documentation> </xs:annotation> </xs:element>
-
<xs:complexType name="NonprojectiveSegmentationType"> <xs:annotation> <xs:documentation>
- NP segmentation type.
+ Nonprojective segmentation type
</xs:documentation> </xs:annotation> <xs:complexContent>
@@ -156,22 +135,6 @@
</xs:extension> </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>
@@ -185,28 +148,25 @@
<xs:attribute default="mm" name="lunit" type="xs:string"/> </xs:extension> </xs:complexContent>
- </xs:complexType> -
+ </xs:complexType>
<xs:element name="cell_readout_2d" substitutionGroup="segmentation" type="CellReadout2DSegmentationType"> <xs:annotation> <xs:documentation>
- The element definition for the CellReadout2DSegmentationType.
+ Cell Readout 2D type
</xs:documentation> </xs:annotation>
- </xs:element> -
+ </xs:element>
<xs:element name="grid_xyz" substitutionGroup="segmentation" type="NonprojectiveSegmentationType"> <xs:annotation> <xs:documentation>
- NP segmentation element for polygons such as boxes and trapezoids.
+ Grid XYZ type
</xs:documentation> </xs:annotation> </xs:element>
-
<xs:complexType name="GlobalGridXYSegmentationType"> <xs:annotation> <xs:documentation>
- Type for global grid in XY.
+ Global grid XY type
</xs:documentation> </xs:annotation> <xs:complexContent>
@@ -217,27 +177,17 @@
</xs:extension> </xs:complexContent> </xs:complexType>
-
<xs:element name="global_grid_xy" substitutionGroup="segmentation" type="GlobalGridXYSegmentationType"> <xs:annotation> <xs:documentation>
- Element for global grid in XY.
+ Global grid XY element
</xs:documentation> </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>
- Prj segmentation type
+ Projective segmentation type
</xs:documentation> </xs:annotation> <xs:complexContent>
@@ -247,19 +197,17 @@
</xs:extension> </xs:complexContent> </xs:complexType>
-
<xs:element name="projective_cylinder" substitutionGroup="segmentation" type="ProjectiveCylinderSegmentationType"> <xs:annotation> <xs:documentation>
- Prj segmentation element
+ Projective segmentation element
</xs:documentation> </xs:annotation> </xs:element>
-
<xs:complexType name="ProjectiveZPlaneSegmentationType"> <xs:annotation> <xs:documentation>
- Prj ZPlane segmentation type
+ Projective ZPlane segmentation type
</xs:documentation> </xs:annotation> <xs:complexContent>
@@ -269,13 +217,11 @@
</xs:extension> </xs:complexContent> </xs:complexType>
-
<xs:element name="projective_zplane" substitutionGroup="segmentation" type="ProjectiveZPlaneSegmentationType"> <xs:annotation> <xs:documentation>
- Prj ZPlane segmentation element
+ Projective ZPlane segmentation element
</xs:documentation> </xs:annotation> </xs:element>
- -</xs:schema>
+</xs:schema>
\ No newline at end of file
--- projects/lcdd/trunk/src/lcdd/core/GeometryManager.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/core/GeometryManager.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,7 +1,7 @@
#include "lcdd/core/GeometryManager.hh" // LCDD
-#include "lcdd/geant4/UserRegionInformation.hh"
+#include "lcdd/core/UserRegionInformation.hh"
//#include "lcdd/core/G4StoreManager.hh" // GDML
--- projects/lcdd/trunk/src/lcdd/core/LCDDDetectorConstruction.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/core/LCDDDetectorConstruction.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,10 +1,3 @@
-/** - * @mainpage Linear Collider Detector Description (LCDD) Documentation - * - * @par - * LCDD is a framework for description of detector geometries and associated information - * at runtime using a XML language and parser. - */
#include "lcdd/core/LCDDDetectorConstruction.hh" // LCDD
@@ -51,8 +44,6 @@
G4Timer geoTimer; geoTimer.Start();
- G4cout << "Started geometry construction timer." << G4endl; -
// get geometry from the global parser instance, which will die on failure G4VPhysicalVolume* pv = LCDDParser::instance()->construct();
--- projects/lcdd/trunk/src/lcdd/core/LCDDLibLoad.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/core/LCDDLibLoad.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -27,13 +27,11 @@
// hit_processor LOAD_COMPONENT (hit_processorProcess);
- LOAD_COMPONENT (hits_collectionProcess);
// segmentations LOAD_COMPONENT (grid_xyzProcess); LOAD_COMPONENT (projective_cylinderProcess); LOAD_COMPONENT (projective_zplaneProcess);
- LOAD_COMPONENT (nonprojective_cylinderProcess);
LOAD_COMPONENT (global_grid_xyProcess); LOAD_COMPONENT (cell_readout_2dProcess);
@@ -75,9 +73,6 @@
// subscribers LOAD_COMPONENT (headerSubscriber);
- // volume extended - //LOAD_COMPONENT(volumeExtendedSubscriber); -
// SDs LOAD_COMPONENT (calorimeterSubscriber); LOAD_COMPONENT (trackerSubscriber);
--- projects/lcdd/trunk/src/lcdd/detectors/BasicTrackerHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/BasicTrackerHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -2,21 +2,23 @@
// LCDD #include "lcdd/detectors/CurrentTrackState.hh"
-#include "lcdd/geant4/VUserTrackInformation.hh"
+#include "lcdd/core/VUserTrackInformation.hh"
// Geant4 #include "G4Geantino.hh" #include "G4ChargedGeantino.hh" #include "globals.hh"
-BasicTrackerHitProcessor::BasicTrackerHitProcessor(TrackerSD* tracker) : - TrackerHitProcessor(tracker) {
+BasicTrackerHitProcessor::BasicTrackerHitProcessor() {
} BasicTrackerHitProcessor::~BasicTrackerHitProcessor() { } bool BasicTrackerHitProcessor::processHits(G4Step* step) {
+ + TrackerSD* tracker = getTracker(); +
// Get the total energy deposition. G4double edep = step->GetTotalEnergyDeposit();
@@ -28,7 +30,7 @@
} // Check edep < cut and not Geantino.
- if (edep <= _tracker->getEnergyCut() && isGeantino == false) {
+ if (edep <= tracker->getEnergyCut() && isGeantino == false) {
return false; }
@@ -76,7 +78,7 @@
TrackerHit* hit = new TrackerHit(); // Create the hit's identifier.
- Id64bit id64 = _tracker->makeIdentifier(step);
+ Id64bit id64 = tracker->makeIdentifier(step);
// Set the hit information from above. hit->setTrackID(trackID);
@@ -88,7 +90,7 @@
hit->setLength(length); // Add the hit to the TrackerSD.
- _tracker->addHit(hit);
+ tracker->addHit(hit, _collectionIndex);
// Get the TrackInformation and flag track as having a tracker hit. VUserTrackInformation* trackInformation = dynamic_cast<VUserTrackInformation*>(step->GetTrack()->GetUserInformation());
--- projects/lcdd/trunk/src/lcdd/detectors/CalorimeterHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/CalorimeterHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,15 +0,0 @@
-#include "lcdd/detectors/CalorimeterHitProcessor.hh" - -// LCDD -#include "lcdd/detectors/CalorimeterSD.hh" - -CalorimeterHitProcessor::CalorimeterHitProcessor(CalorimeterSD* calorimeter) : - _calorimeter(calorimeter) { -} - -CalorimeterHitProcessor::~CalorimeterHitProcessor() { -} - -bool CalorimeterHitProcessor::processHits(G4Step* step) { - return false; -}
--- projects/lcdd/trunk/src/lcdd/detectors/CalorimeterSD.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/CalorimeterSD.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -70,19 +70,6 @@
return SensitiveDetector::ProcessHits(aStep, 0); }
-/* -std::ostream& CalorimeterSD::printHits(std::ostream& os) { - for (int i = 0; i < getNumberOfHitsCollections(); i++) { - os << getHitsCollection(i)->GetName() << std::endl; - for (CalorimeterHitList::const_iterator iter = _hitsVector[i].begin(); iter != _hitsVector[i].end(); iter++) { - os << " " << **iter; - } - } - os << std::endl; - return os; -} -*/ -
void CalorimeterSD::EndOfEvent(G4HCofThisEvent *) { // Delete hit maps.
--- projects/lcdd/trunk/src/lcdd/detectors/Cerenkov.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/Cerenkov.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/src/lcdd/detectors/HitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/HitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,7 +0,0 @@
-#include "lcdd/detectors/HitProcessor.hh" - -HitProcessor::HitProcessor() { -} - -HitProcessor::~HitProcessor() { -}
--- projects/lcdd/trunk/src/lcdd/detectors/HitProcessorManager.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/HitProcessorManager.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,12 +1,9 @@
#include "lcdd/detectors/HitProcessorManager.hh" // LCDD
-#include "lcdd/detectors/LegacyCalorimeterHitProcessor.hh" -#include "lcdd/detectors/UnsegmentedCalorimeterHitProcessor.hh" -#include "lcdd/detectors/OpticalCalorimeterHitProcessor.hh"
+#include "lcdd/detectors/BasicCalorimeterHitProcessor.hh"
#include "lcdd/detectors/BasicTrackerHitProcessor.hh" #include "lcdd/detectors/ScoringTrackerHitProcessor.hh"
-#include "lcdd/detectors/StepCombiningTrackerHitProcessor.hh"
HitProcessorManager* HitProcessorManager::_manager = 0;
@@ -25,12 +22,9 @@
} void HitProcessorManager::registerDefaultFactories() {
- registerFactory(new LegacyCalorimeterHitProcessorFactory()); - registerFactory(new UnsegmentedCalorimeterHitProcessorFactory()); - registerFactory(new OpticalCalorimeterHitProcessorFactory());
+ registerFactory(new BasicCalorimeterHitProcessorFactory());
registerFactory(new ScoringTrackerHitProcessorFactory()); registerFactory(new BasicTrackerHitProcessorFactory());
- registerFactory(new StepCombiningTrackerHitProcessorFactory());
} void HitProcessorManager::registerFactory(HitProcessorFactory* factory) {
--- projects/lcdd/trunk/src/lcdd/detectors/LegacyCalorimeterHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/LegacyCalorimeterHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,72 +0,0 @@
-#include "lcdd/detectors/LegacyCalorimeterHitProcessor.hh" - -// LCDD -#include "lcdd/detectors/CurrentTrackState.hh" -#include "lcdd/util/TimerUtil.hh" - -// Geant4 -#include "G4Geantino.hh" -#include "G4ChargedGeantino.hh" - -LegacyCalorimeterHitProcessor::LegacyCalorimeterHitProcessor(CalorimeterSD* calorimeter) : - CalorimeterHitProcessor(calorimeter) { -} - -LegacyCalorimeterHitProcessor::~LegacyCalorimeterHitProcessor() { -} - -bool LegacyCalorimeterHitProcessor::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; - } - - // Cut on energy deposition <= cut but allow Geantinos. - if (edep <= _calorimeter->getEnergyCut() && isGeantino == false) { - return false; - } - - // Get the Segmentation from the CalorimeterSD. - Segmentation* segmentation = _calorimeter->getSegmentation(); - - // Get the global cell position from the Segmentation. - G4ThreeVector globalCellPosition = segmentation->getGlobalHitPosition(step); - - // Set the segmentation bin values from the step. - //segmentation->resetBins(); - segmentation->setBins(step); - - // Create a 64-bit ID from the step information. - Id64bit id = _calorimeter->makeIdentifier(step); - - // Check for an existing hit with this identifier. - CalorimeterHit* hit = _calorimeter->findHit(id); - - // Was there a hit found with this identifier? - if (hit == NULL) { - - // No hit was found, so a new one is created. - hit = new CalorimeterHit(id, edep, globalCellPosition); - - // Add the new hit to the calorimeter. - _calorimeter->addHit(hit); - - } else { - - // Add energy deposition to an existing hit. - hit->addEdep(edep); - } - - // Add hit contribution to the hit. - // FIXME: This should pass a pointer to a new object. It is copied, which is inefficient. - hit->addHitContribution(HitContribution(CurrentTrackState::getCurrentTrackID(), step)); - - // Return true, indicating that a hit was added or modified. - return true; -}
--- projects/lcdd/trunk/src/lcdd/detectors/OpticalCalorimeterHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/OpticalCalorimeterHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/src/lcdd/detectors/ReadoutUtil.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/ReadoutUtil.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -32,11 +32,6 @@
return aStepPoint->GetTouchableHandle()->GetVolume()->GetLogicalVolume()->GetSolid(); }
-//G4TouchableHandle ReadoutUtil::getTouchableFromStep(const G4Step* aStep) -//{ -// return aStep->GetPreStepPoint()->GetTouchableHandle(); -//} -
G4ThreeVector ReadoutUtil::getVolumeGlobalPosition(const G4StepPoint* aStepPoint, const G4ThreeVector& pnt) { return aStepPoint->GetTouchableHandle()->GetHistory()->GetTopTransform().Inverse().TransformPoint(pnt); }
--- projects/lcdd/trunk/src/lcdd/detectors/ScoringTrackerHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/ScoringTrackerHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,10 +1,13 @@
#include "lcdd/detectors/ScoringTrackerHitProcessor.hh"
+// LCDD +#include "lcdd/core/VUserTrackInformation.hh" +
// Geant4 #include "G4ThreeVector.hh"
-ScoringTrackerHitProcessor::ScoringTrackerHitProcessor(TrackerSD* tracker) : - TrackerHitProcessor(tracker), _currentTrackId(-1) {
+ScoringTrackerHitProcessor::ScoringTrackerHitProcessor() : + _currentTrackId(-1) {
} ScoringTrackerHitProcessor::~ScoringTrackerHitProcessor() {
@@ -26,12 +29,6 @@
// edep G4double edep = step->GetTotalEnergyDeposit();
- // get track information - //TrackInformation* trkInfo = TrackInformation::getTrackInformation(step); - - // set hit flag in trk info - //trkInfo->setHasTrackerHit(true); -
// Get track ID. G4int trackID = step->GetTrack()->GetTrackID();
@@ -42,7 +39,7 @@
TrackerHit* newHit = new TrackerHit(); // create id vector
- Id64bit id64 = _tracker->makeIdentifier(step);
+ Id64bit id64 = getTracker()->makeIdentifier(step);
// Get the start position from the pre-step point. G4ThreeVector startPosition = step->GetPreStepPoint()->GetPosition();
@@ -50,20 +47,30 @@
// Get the end position from the post-step point. G4ThreeVector endPosition = step->GetPostStepPoint()->GetPosition();
+ // Compute the midpoint. + G4ThreeVector midPoint = (0.5 * (step->GetPreStepPoint()->GetPosition() + step->GetPostStepPoint()->GetPosition())); +
// Compute the step's path length. G4double length = sqrt(pow(startPosition.x() - endPosition.x(), 2) + pow(startPosition.y() - endPosition.y(), 2) + pow(startPosition.z() - endPosition.z(), 2)); // Set the hit information. newHit->setTrackID(trackID); newHit->setEdep(edep);
- newHit->setPosition(startPosition);
+ newHit->setPosition(midPoint);
newHit->setMomentum(step->GetPreStepPoint()->GetMomentum()); newHit->setTdep(tdep); newHit->setId(id64.getId0()); newHit->setLength(length);
- // Add hit to SD. - _tracker->addHit(newHit, false);
+ // Get the TrackInformation and flag track as having a tracker hit. + VUserTrackInformation* trackInformation = dynamic_cast<VUserTrackInformation*>(step->GetTrack()->GetUserInformation()); + if (trackInformation) + trackInformation->setHasTrackerHit(); + else + G4Exception("ScoringTrackerHitProcessor::processHits", "", FatalException, "Missing required VUserTrackInformation."); + + // Add hit to detector. + getTracker()->addHit(newHit, getCollectionIndex());
} return true; }
--- projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetector.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetector.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -3,6 +3,7 @@
// LCDD #include "lcdd/id/IdManager.hh" #include "lcdd/id/IdFactory.hh"
+#include "lcdd/detectors/HitProcessor.hh"
#include "lcdd/detectors/SensitiveDetectorMessenger.hh" // Geant4
@@ -24,11 +25,17 @@
const std::string& SensitiveDetector::CALORIMETER = "calorimeter"; const std::string& SensitiveDetector::UNKNOWN = "unknown";
-SensitiveDetector::SensitiveDetector(G4String sdName, G4String hcName, EType sdType) : - G4VSensitiveDetector(sdName), _idspec(0), _type(sdType) { - // insert hits collection name into SD's name vector - collectionName.insert(hcName);
+SensitiveDetector::SensitiveDetector(G4String name, G4String theCollectionName, EType detectorType) : + G4VSensitiveDetector(name), + _idspec(NULL), + _type(detectorType), + _verbose(false), + _endcap(false), + _ecut(0) {
+ // Insert the collection names into the SD's name vector. + collectionName.insert(theCollectionName); +
// register detector with G4SDManager G4SDManager::GetSDMpointer()->AddNewDetector(this);
@@ -36,17 +43,20 @@
_messenger = new SensitiveDetectorMessenger(this); // Only one HC
- _hcids.clear(); // Is this needed???
+ _hcids.clear(); // FIXME: Is this needed here???
_hcids.push_back(-1); }
-SensitiveDetector::SensitiveDetector(G4String sdName, const vector<G4String>& hcNames, EType sdType) : - G4VSensitiveDetector(sdName), _idspec(0), _type(sdType) { - _hcids.clear(); // Is this needed???
+SensitiveDetector::SensitiveDetector(G4String sensitiveDetectorName, const vector<G4String>& theCollectionNames, EType detectorType) : + G4VSensitiveDetector(sensitiveDetectorName), + _idspec(0), + _type(detectorType) {
- for (int i = 0; i < (int) hcNames.size(); i++) {
+ _hcids.clear(); // FIXME: Is this needed??? + + for (int i = 0; i < (int) theCollectionNames.size(); i++) {
// insert hits collection name into SD's name vector
- collectionName.insert(hcNames[i]);
+ collectionName.insert(theCollectionNames[i]);
_hcids.push_back(-1); }
@@ -251,6 +261,7 @@
} void SensitiveDetector::addHitProcessor(HitProcessor* processor) {
+ processor->setSensitiveDetector(this);
_hitProcessors.push_back(processor); }
@@ -260,6 +271,6 @@
void SensitiveDetector::addHitProcessors(std::vector<HitProcessor*> processors) { for (HitProcessors::iterator it = processors.begin(); it != processors.end(); it++) {
- _hitProcessors.push_back(*it);
+ addHitProcessor((*it));
} }
--- projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetectorFactory.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetectorFactory.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -5,18 +5,19 @@
#include "lcdd/util/StringUtil.hh" #include "lcdd/detectors/PositionComparator.hh" #include "lcdd/detectors/HitProcessorManager.hh"
-#include "lcdd/detectors/LegacyCalorimeterHitProcessor.hh"
+#include "lcdd/detectors/BasicCalorimeterHitProcessor.hh"
#include "lcdd/detectors/BasicTrackerHitProcessor.hh" #include "lcdd/detectors/ScoringTrackerHitProcessor.hh" #include "lcdd/schema/hit_processor.hh"
-#include "lcdd/schema/hits_collection.hh"
+#include <algorithm> +
SensitiveDetector* SensitiveDetectorFactory::createSensitiveDetector(const SAXObject* object) {
+
const SensitiveDetectorType* sensitiveDetectorType = dynamic_cast<const SensitiveDetectorType*>(object); SensitiveDetector* sensitiveDetector = 0; IdSpec* idspec = 0; std::vector<HitProcessor*> hitProcessors;
- std::vector<std::string> hitProcessorNames;
std::vector<G4String> hitsCollections; // The SAXObject must extend SensitiveDetectorType.
@@ -25,6 +26,12 @@
// Get the SensitiveDetector's basic type string. std::string sensitiveDetectorTypeName = sensitiveDetectorType->get_type();
+ // If there is a collection name on the SD itself, add it to the list. + std::string hitsCollectionName = sensitiveDetectorType->get_hitsCollectionName(); + if (hitsCollectionName != "") { + hitsCollections.push_back(sensitiveDetectorType->get_hitsCollectionName()); + } +
// Process element content for objects that need to be created before the SD. ContentSequence* seq = const_cast<ContentSequence*>(sensitiveDetectorType->get_content()); size_t count = seq->size();
@@ -48,50 +55,60 @@
G4Exception("", "", FatalException, "IdSpec does not exist."); }
- // Process hit_processor child tag.
+ // Process hit_processor child tag.
} else if (childTag == "hit_processor") { // Cast object to appropriate element type.
- const hit_processor* hitProcessor = dynamic_cast<const hit_processor*>(seq->content(i).object);
+ const hit_processor* element = dynamic_cast<const hit_processor*>(seq->content(i).object);
- // Push type name of HitProcessor onto list to be created later once SD is available. - hitProcessorNames.push_back(hitProcessor->get_type());
+ // Create the HitProcessor. + HitProcessorFactory* hitProcessorFactory = HitProcessorManager::instance()->getFactory(element->get_type()); + if (hitProcessorFactory == NULL) + G4Exception("", "", FatalException, "HitProcessorFactory was not found."); + HitProcessor* hitProcessor = hitProcessorFactory->createHitProcessor();
- // Process hits_collection child tag. - } else if (childTag == "hits_collection") {
+ // Set the hits collection name (optional). + G4String hitsCollection = element->get_collection_name(); + if (hitsCollection != "") { + G4cout << "set collection name on HitProcessor: " << hitsCollection << G4endl; + hitProcessor->setCollectionName(hitsCollection); + }
- // Cast object to appropriate element type. - const hits_collection* hitsCollection = dynamic_cast<const hits_collection*>(seq->content(i).object);
+ // Add hits collection name to the list unless it is already defined by the SD. + if (hitsCollection != "") { + if (std::find(hitsCollections.begin(), hitsCollections.end(), hitsCollection) == hitsCollections.end()) { + hitsCollections.push_back(hitsCollection); + } + }
- // Get the name of the hits collection. - const std::string& name = hitsCollection->get_name(); - - // Add hits collection to the list. - hitsCollections.push_back(name);
+ // Add the HitsProcessor to the list for the SD. + hitProcessors.push_back(hitProcessor);
} }
- // This is for backward compatibility when hits collection is specified as an attribute value - // on the detector's XML element. - std::string hitsCollectionName = sensitiveDetectorType->get_hitsCollectionName(); - if (hitsCollectionName != "") { - hitsCollections.push_back(sensitiveDetectorType->get_hitsCollectionName());
+ // Add default HitProcessor if none was provided explicitly in the SD's XML element. + if (hitProcessors.size() == 0) { + if (sensitiveDetectorTypeName == "tracker") { + hitProcessors.push_back(HitProcessorManager::instance()->getFactory("BasicTrackerHitProcessor")->createHitProcessor()); + } else if (sensitiveDetectorTypeName == "calorimeter") { + hitProcessors.push_back(HitProcessorManager::instance()->getFactory("BasicCalorimeterHitProcessor")->createHitProcessor()); + }
}
- // If no hits collections were added then make a default HitsCollection with the name of the SD.
+ // If no hits collection names were provided explicitly, then make a default one from the name of the SD.
if (hitsCollections.size() == 0) { hitsCollections.push_back(sensitiveDetectorType->get_name()); } // Create the SD object based on its type of calorimeter or tracker. if (sensitiveDetectorTypeName == "calorimeter") {
- // Create calorimeter SD.
+ // Create the CalorimeterSD with its hits collection names.
sensitiveDetector = createCalorimeter(object, hitsCollections); } else if (sensitiveDetectorTypeName == "tracker") {
- // Create tracker SD.
+ // Create the TrackerSD with its hits collection names.
sensitiveDetector = createTracker(object, hitsCollections); } else {
- // Type is not recognized. This shouldn't happen!
+ // The type is not recognized. This shouldn't ever happen!
G4cerr << "Invalid sensitive detector type: " << sensitiveDetectorTypeName << G4endl; G4Exception("", "", FatalException, "Unknown sensitive detector type."); }
@@ -104,50 +121,15 @@
// Set the IdSpec. sensitiveDetector->setIdSpec(idspec);
- // Create HitProcessors from list of type names. - for (std::vector<std::string>::iterator it = hitProcessorNames.begin(); it != hitProcessorNames.end(); it++) { - std::string type = (*it); - HitProcessorFactory* hitProcessorFactory = HitProcessorManager::instance()->getFactory(type); - if (hitProcessorFactory == 0) { - std::cerr << "HitProcessorFactory was not found for type: " << type << std::endl; - G4Exception("", "", FatalException, "HitProcessor not found"); - } - HitProcessor* processor = hitProcessorFactory->createHitProcessor(sensitiveDetector);
+ // Add the list of HitProcessors. This will automatically cause the HitProcessor setup code + // to be called to configure it for this SD. + sensitiveDetector->addHitProcessors(hitProcessors);
- //std::cout << "create hits processor: " << type << std::endl; - - // Add the HitProcessor to the list. - hitProcessors.push_back(processor); - } - - // Add the HitProcessors from the list. - if (hitProcessors.size() > 0) { - // Add HitProcessors created from XML if they were listed explicitly as child elements. - sensitiveDetector->addHitProcessors(hitProcessors); - } else { - // Need to add default HitProcessors because none were specified in the detector's XML. - if (sensitiveDetectorTypeName == "tracker") { - // Add the default TrackerHitProcessor. - sensitiveDetector->addHitProcessor( - HitProcessorManager::instance()->getFactory("BasicTrackerHitProcessor")->createHitProcessor(sensitiveDetector)); - } else if (sensitiveDetectorTypeName == "calorimeter") { - // Add the default CalorimeterHitProcessor. - sensitiveDetector->addHitProcessor( - HitProcessorManager::instance()->getFactory("LegacyCalorimeterHitProcessor")->createHitProcessor(sensitiveDetector)); - } - } -
// Register the SensitiveDetector with the LCDDProcessor. std::string sensitiveDetectorName = sensitiveDetector->GetName();
- //std::cout << "adding sensitive detector: " << sensitiveDetectorName << std::endl; - //std::cout << " HCs: "; - //for (std::vector<G4String>::iterator it = hitsCollections.begin(); it != hitsCollections.end(); it++) { - // std::cout << (*it) << " "; - //} - //std::cout << std::endl;
LCDDProcessor::instance()->addSensitiveDetector(sensitiveDetectorName, sensitiveDetector); } else {
- // This should never really happen.
+ // This should never really happen!
G4Exception("", "", FatalException, "Failed cast to SensitiveDetectorType."); }
@@ -173,9 +155,6 @@
} }
- // Get the calorimeter XML object. - const calorimeter* cal = dynamic_cast<const calorimeter*>(object); -
// Create the calorimeter SD. return new CalorimeterSD(sensitiveDetectorType->get_name(), hitsCollections, segmentation); }
@@ -209,6 +188,5 @@
// FIXME This should automatically know all segmentation types somehow. // Can this be read from the schema? // http://xerces-c.sourcearchive.com/documentation/3.1.1-1/SchemaGrammar_8hpp_source.html
- return (s == "projective_cylinder" || s == "grid_xyz" || s == "global_grid_xy" || s == "nonprojective_cylinder" || s == "projective_zplane" - || s == "cell_readout_2d");
+ return (s == "projective_cylinder" || s == "grid_xyz" || s == "global_grid_xy" || s == "projective_zplane" || s == "cell_readout_2d");
}
--- projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetectorMessenger.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetectorMessenger.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -15,7 +15,6 @@
if (_detectorsDir == 0) { makeDetectorsDir(); }
-
defineCommands(_detector); }
@@ -35,11 +34,10 @@
} else if (cmd == _ecutCmd) { _detector->setEcut(_ecutCmd->GetNewDoubleValue(newVals)); }
-
} void SensitiveDetectorMessenger::makeDetectorsDir() {
- _detectorsDir = new G4UIdirectory("/detectors/");
+ _detectorsDir = new G4UIdirectory("/lcdd/detectors/");
_detectorsDir->SetGuidance("Commands for sensitive detectors. [LCDD]"); }
--- projects/lcdd/trunk/src/lcdd/detectors/StepCombiningTrackerHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/StepCombiningTrackerHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,160 +0,0 @@
-#include "lcdd/detectors/StepCombiningTrackerHitProcessor.hh" - -// Geant -#include "G4Geantino.hh" -#include "G4ChargedGeantino.hh" - -StepCombiningTrackerHitProcessor::StepCombiningTrackerHitProcessor(TrackerSD* tracker) : - TrackerHitProcessor(tracker), _currentTrackID(-1), _currentPV(0), _edepTotal(0.), _minTime(0.), _startedHit(false), _currentTrack(0) { -} - -StepCombiningTrackerHitProcessor::~StepCombiningTrackerHitProcessor() { -} - -G4bool StepCombiningTrackerHitProcessor::processHits(G4Step* step) { - // The return value indicating whether a hit was inserted. - bool r = false; - - // Started a hit already? - if (!_startedHit) { - - // Start a new hit on the pre-step. - startHit(step, step->GetPreStepPoint()); - } - - // Check if the cached trackID is valid. - if (_currentTrackID != -1) { - - // Is this step's trackID different from the cached trackID? - if (step->GetTrack()->GetTrackID() != _currentTrackID) { - - // Insert the hit on the old track. - r = insertHit(step); - - // Start a new hit on the pre-step. - startHit(step, step->GetPreStepPoint()); - } - } - - // Update the hit. - updateHit(step); - - // Check whether a new volume is being entered on this step. - G4VPhysicalVolume* preVolume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume(); - G4VPhysicalVolume* postVolume = step->GetPostStepPoint()->GetTouchableHandle()->GetVolume(); - if (preVolume != postVolume) { - - // Insert the current hit. - r = insertHit(step); - - // Check if pre and post steps have the same detector. - G4VSensitiveDetector* preSD = preVolume->GetLogicalVolume()->GetSensitiveDetector(); - G4VSensitiveDetector* postSD = postVolume->GetLogicalVolume()->GetSensitiveDetector(); - if (preSD == postSD) { - // Start a new hit for the adjacent volume. - startHit(step, step->GetPostStepPoint()); - } - } else if (_currentTrack->GetTrackStatus() == fStopAndKill) { - // Special case where the track status is StopAndKill. - // We won't see this track again, so need to insert the hit on this step. - r = insertHit(step); - } - - return r; -} - -void StepCombiningTrackerHitProcessor::updateHit(G4Step* step) { - // Update can only happen if a hit has been started. - if (_startedHit) { - - // incr edep - _edepTotal += step->GetTotalEnergyDeposit(); - - // first time only - if (_minTime == 0) { - _minTime = step->GetTrack()->GetGlobalTime(); - } - - // exit point and momentum - _exitPoint = step->GetPostStepPoint()->GetPosition(); - _exitMomentum = step->GetPostStepPoint()->GetMomentum(); - } -} - -void StepCombiningTrackerHitProcessor::clear() { - _minTime = 0; - _edepTotal = 0; - _currentPV = 0; - _currentTrackID = -1; - _startedHit = false; -} - -bool StepCombiningTrackerHitProcessor::insertHit(G4Step* step) { - // Another hit was not started. - if (!_startedHit) { - G4cerr << "StepCombiningTrackerHitProcessor::insertHit - Never started a hit!" << G4endl; - return false; - } - - // Check for Geantino particle type. - G4ParticleDefinition* def = step->GetTrack()->GetDefinition(); - bool isGeantino = false; - if (def == G4Geantino::Definition() || def == G4ChargedGeantino::Definition()) { - isGeantino = true; - } - - // Total energy is below cut. - if (_edepTotal <= _tracker->getEnergyCut() && isGeantino == false) { - clear(); - return false; - } - - // Compute the mid point. - G4ThreeVector midpoint = (0.5 * (_entryPoint + _exitPoint)); - - // Compute the mean momentum. - G4ThreeVector meanMomentum = (0.5 * (_entryMomentum + _exitMomentum)); - - // Compute distance from entry to exit points. - G4double pathlength = sqrt( - pow(_entryPoint.x() - _exitPoint.x(), 2) + - pow(_entryPoint.y() - _exitPoint.y(), 2) + - pow(_entryPoint.z() - _exitPoint.z(), 2)); - - // Set the hit data from the cache. - TrackerHit* hit = new TrackerHit(); - hit->setTdep(_minTime); - hit->setEdep(_edepTotal); - hit->setPosition(midpoint); - hit->setMomentum(meanMomentum); - hit->setTrackID(_currentTrackID); - hit->setLength(pathlength); - - // Set the hit's identifier. - Id64bit id64 = _tracker->makeIdentifier(step); - hit->setId(id64.getId0()); - - // Add the hit to the TrackerSD. - _tracker->addHit(hit); - - // Set tracker hit flag on track information. - //TrackInformation* trackInfo = TrackInformation::getTrackInformation(_currentTrack); - //if (trackInfo != 0) { - // trackInfo->setHasTrackerHit(true); - //} - - // Clear the cached hit data. - clear(); - - return true; -} - -void StepCombiningTrackerHitProcessor::startHit(G4Step* step, G4StepPoint* stepPoint) { - _currentTrack = step->GetTrack(); - _currentPV = stepPoint->GetPhysicalVolume(); - _entryPoint = _exitPoint = stepPoint->GetPosition(); - _entryMomentum = _exitMomentum = stepPoint->GetMomentum(); - _currentTrackID = step->GetTrack()->GetTrackID(); - _startedHit = true; -} -
--- projects/lcdd/trunk/src/lcdd/detectors/StepReadout.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/StepReadout.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -133,10 +133,6 @@
return track()->GetMomentum(); }
-//TrackInformation* StepReadout::trackInformation() const { -// return TrackInformation::getTrackInformation(track()); -//} -
G4ThreeVector StepReadout::prePosition() const { return pre()->GetPosition(); }
--- projects/lcdd/trunk/src/lcdd/detectors/TrackerHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/TrackerHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,8 +0,0 @@
-#include "lcdd/detectors/TrackerHitProcessor.hh" - -TrackerHitProcessor::TrackerHitProcessor(TrackerSD* tracker) : - _tracker(tracker) { -} - -TrackerHitProcessor::~TrackerHitProcessor() { -}
--- projects/lcdd/trunk/src/lcdd/detectors/TrackerSD.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/TrackerSD.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -4,10 +4,7 @@
#include <iostream> TrackerSD::TrackerSD(G4String sdName, std::vector<G4String> hitsCollectionNames) :
- SensitiveDetector(sdName, hitsCollectionNames, SensitiveDetector::eTracker) -//, _HC(0) -{ - //_hits.clear();
+ SensitiveDetector(sdName, hitsCollectionNames, SensitiveDetector::eTracker) {
// The actual pointers to the collections are overridden later in Initialize. for (int i = 0; i < (int) hitsCollectionNames.size(); i++) { _hitsCollections.push_back(0);
@@ -21,8 +18,6 @@
// Loop over number of hits collections defined by this detector. for (int i = 0; i < getNumberOfHitsCollections(); i++) {
- //std::cout << "TrackerSD::Initialize - initializing hits collection <" << collectionName[i] << ">" << std::endl; -
// Overwrite pointer to the dummy collection that was added in the constructor. _hitsCollections[i] = new TrackerHitsCollection(GetName(), collectionName[i]);
--- projects/lcdd/trunk/src/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/detectors/UnsegmentedCalorimeterHitProcessor.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/src/lcdd/hits/CalorimeterHit.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/hits/CalorimeterHit.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -111,13 +111,6 @@
return _particleList; }
-//void CalorimeterHit::setId64bit(Id64bit::ElementType id0, Id64bit::ElementType id1) -//{ -// _id.setId0(id0); -// _id.setId1(id1); -// _id.encode(); -//} -
const Id64bit& CalorimeterHit::getId64bit() const { return _id; }
--- projects/lcdd/trunk/src/lcdd/hits/HitContribution.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/hits/HitContribution.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -26,12 +26,7 @@
_trackID = trackID;
- // Set edep according to type of track. - //if (track->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition()) { - // _edep = track->GetTotalEnergy(); - //} else {
_edep = aStep->GetTotalEnergyDeposit();
- //}
// PDG ID. _PdgId = track->GetDefinition()->GetPDGEncoding();
@@ -50,13 +45,6 @@
// Get the track. const G4Track* track = aStep->GetTrack();
- // Get the track information. - //TrackInformation* trackInfo = static_cast<TrackInformation*>(track->GetUserInformation()); - - // Get the track ID. - //if (trackInfo) { - // _trackID = trackInfo->getOriginalTrackID(); - //}
_trackID = track->GetTrackID(); // Set edep according to type of track.
--- projects/lcdd/trunk/src/lcdd/processes/calorimeterProcess.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/processes/calorimeterProcess.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,39 +1,61 @@
+// 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/processes/calorimeterProcess.hh"
+#include "lcdd/schema/calorimeter.hh" +#include "lcdd/processes/SensitiveDetectorTypeProcess.hh"
-calorimeterProcess::calorimeterProcess(const ProcessingContext* context) :
+// STL +#include <iostream> + +/** + * @brief + * The SAX process for calorimeter elements + */ +class calorimeterProcess: public SensitiveDetectorTypeProcess { + +public: + + calorimeterProcess(const ProcessingContext* context = 0) :
SensitiveDetectorTypeProcess(context) {
-}
+ }
-calorimeterProcess::~calorimeterProcess() { -}
+ virtual ~calorimeterProcess() { + }
-void calorimeterProcess::StartElement(const std::string& name, const ASCIIAttributeList& attrs) { - SAXObject** obj = Context()->GetTopObject(); - calorimeter* cal = new calorimeter;
+ void StartElement(const std::string& name, const ASCIIAttributeList& attrs) { + SAXObject** obj = Context()->GetTopObject(); + calorimeter* cal = new calorimeter;
- cal->set_compare(attrs.getValue("hit_aggregation"));
+ cal->set_compare(attrs.getValue("hit_aggregation"));
- _obj = cal; - *obj = cal;
+ _obj = cal; + *obj = cal;
- // parent type to set name and hitsCollectionName - SensitiveDetectorTypeProcess::StartElement(name, attrs); -}
+ // parent type to set name and hitsCollectionName + SensitiveDetectorTypeProcess::StartElement(name, attrs); + }
-void calorimeterProcess::EndElement(const std::string&) { -}
+ void EndElement(const std::string&) { + }
-void calorimeterProcess::Characters(const std::string&) { -}
+ void Characters(const std::string&) { + }
-void calorimeterProcess::StackPopNotify(const std::string& name) { - SensitiveDetectorTypeProcess::StackPopNotify(name); -}
+ void StackPopNotify(const std::string& name) { + SensitiveDetectorTypeProcess::StackPopNotify(name); + }
-const std::string& calorimeterProcess::State() const { - static std::string tag = "calorimeter"; - return tag; -}
+ const std::string& State() const { + static std::string tag = "calorimeter"; + return tag; + } +};
DECLARE_PROCESS_FACTORY(calorimeterProcess)
--- projects/lcdd/trunk/src/lcdd/processes/hit_processorProcess.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/processes/hit_processorProcess.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,51 +1,62 @@
// LCDD
-#include "lcdd/processes/hit_processorProcess.hh"
#include "lcdd/schema/hit_processor.hh" // GDML #include "Saxana/ProcessingContext.h" #include "Saxana/SAXComponentFactory.h"
+#include "Saxana/SAXStateProcess.h" +#include "Saxana/SAXObject.h"
-hit_processorProcess::hit_processorProcess() :
+/** + * The SAX process for hit_processor elements. + */ +class hit_processorProcess: public SAXStateProcess { + + public: + + hit_processorProcess() :
SAXStateProcess(0), _obj(0) {
-}
+ }
-hit_processorProcess::hit_processorProcess(ProcessingContext* context) :
+ hit_processorProcess(ProcessingContext* context) :
SAXStateProcess(context), _obj(0) {
+ }
-}
+ virtual ~hit_processorProcess() { + }
-hit_processorProcess::~hit_processorProcess() {
+ void StartElement(const std::string& name, const ASCIIAttributeList& attrs) { + SAXObject** obj = Context()->GetTopObject(); + hit_processor* hitProcessor = new hit_processor;
-}
+ hitProcessor->set_type(attrs.getValue("type")); + hitProcessor->set_collection_name(attrs.getValue("collection_name"));
-void hit_processorProcess::StartElement(const std::string& name, const ASCIIAttributeList& attrs) { - SAXObject** obj = Context()->GetTopObject(); - hit_processor* hitProcessor = new hit_processor;
+ _obj = hitProcessor; + *obj = hitProcessor; + }
- hitProcessor->set_type(attrs.getValue("type"));
+ void EndElement(const std::string&) { + }
- _obj = hitProcessor; - *obj = hitProcessor; -}
+ void Characters(const std::string&) { + }
-void hit_processorProcess::EndElement(const std::string&) { -}
+ // TODO: Add this back if there are child elements added to HitsProcessor XML type. + void StackPopNotify(const std::string& name) { + // SAXObject** so = Context()->GetTopObject(); + // HitProcessorType* hitProcessorType = dynamic_cast<HitProcessorType*>(_obj); + // Push child elements into type object. + // hitProcessorType->add_content(name, *so); + }
-void hit_processorProcess::Characters(const std::string&) { -}
+ const std::string& State() const { + static std::string tag = "hit_processor"; + return tag; + }
-void hit_processorProcess::StackPopNotify(const std::string& name) { - SAXObject** so = Context()->GetTopObject(); - HitProcessorType* hitProcessorType = dynamic_cast<HitProcessorType*>(_obj);
+ private: + SAXObject* _obj; +};
- // Push child elements into type object. - hitProcessorType->add_content(name, *so); -} - -const std::string& hit_processorProcess::State() const { - static std::string tag = "hit_processor"; - return tag; -} -
DECLARE_PROCESS_FACTORY(hit_processorProcess)
--- projects/lcdd/trunk/src/lcdd/processes/hits_collectionProcess.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/processes/hits_collectionProcess.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,44 +0,0 @@
-// LCDD -#include "lcdd/processes/hits_collectionProcess.hh" -#include "lcdd/schema/hits_collection.hh" - -// GDML -#include "Saxana/ProcessingContext.h" -#include "Saxana/SAXComponentFactory.h" - -hits_collectionProcess::hits_collectionProcess() : - SAXStateProcess(0), _obj(0) { -} - -hits_collectionProcess::hits_collectionProcess(ProcessingContext* context) : - SAXStateProcess(context), _obj(0) { -} - -hits_collectionProcess::~hits_collectionProcess() { -} - -void hits_collectionProcess::StartElement(const std::string& name, const ASCIIAttributeList& attrs) { - SAXObject** obj = Context()->GetTopObject(); - hits_collection* hitsCollection = new hits_collection; - - hitsCollection->set_name(attrs.getValue("name")); - - _obj = hitsCollection; - *obj = hitsCollection; -} - -void hits_collectionProcess::EndElement(const std::string&) { -} - -void hits_collectionProcess::Characters(const std::string&) { -} - -void hits_collectionProcess::StackPopNotify(const std::string& name) { -} - -const std::string& hits_collectionProcess::State() const { - static std::string tag = "hits_collection"; - return tag; -} - -DECLARE_PROCESS_FACTORY(hits_collectionProcess)
--- projects/lcdd/trunk/src/lcdd/processes/nonprojective_cylinderProcess.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/processes/nonprojective_cylinderProcess.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/src/lcdd/segmentation/NonprojectiveCylinderSegmentation.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/segmentation/NonprojectiveCylinderSegmentation.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -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/trunk/src/lcdd/segmentation/ProjectiveCylinderSegmentation.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/segmentation/ProjectiveCylinderSegmentation.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -21,13 +21,6 @@
return ReadoutUtil::computeTubsMidRadius(ReadoutUtil::getTubs(aStep)); }
-/* - double ProjectiveCylinderSegmentation::getRadius(const G4StepPoint* aPreStepPoint) - { - return ReadoutUtil::computeTubsMidRadius(ReadoutUtil::getTubs(aPreStepPoint)); - } - */ -
double ProjectiveCylinderSegmentation::getZ(const G4Step* aStep) { double rcyl = getRadius(aStep);
@@ -40,21 +33,7 @@
return zcell; }
-/* - double ProjectiveCylinderSegmentation::getZ(const G4StepPoint* aPreStepPoint) - { - double rcyl = getRadius(aPreStepPoint);
- double ctheta = getThetaDim(aPreStepPoint); - - // ctheta in 0 to pi ... - // ctheta < pi/2 should be negative - - double zcell = rcyl / tan(ctheta); - - return zcell; - } - */
bool ProjectiveCylinderSegmentation::isValidSolid(G4VSolid* s) { bool valid = Segmentation::isValidSolid(s);
--- projects/lcdd/trunk/src/lcdd/segmentation/ProjectiveSegmentation.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/segmentation/ProjectiveSegmentation.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -49,51 +49,8 @@
return pos; }
-/* - G4ThreeVector ProjectiveSegmentation::getGlobalHitPos(const G4StepPoint* aPreStepPoint) - { - // DEBUG - //G4cout << "G4ProjectiveSegmentation::getGlobalHitPos()" << G4endl; - //
- // divide entire theta, phi range into bins; bins always positive - // theta, phi coord of step midpoint - // compute bin numbers - // get dim from bins
- // get radius, z components (probably from subclass function) - double rcyl = getRadius(aPreStepPoint); - double zcell = getZ(aPreStepPoint); - - // get phi component - double cphi = getPhiDim(aPreStepPoint); - - // compute x, y cells - double xcell = rcyl * cos(cphi); - double ycell = rcyl * sin(cphi); - - G4ThreeVector pos(xcell, ycell, zcell); - - //G4ThreeVector midPos = ReadoutUtil::computeMidPos( aStep ); - - // DEBUG: print all - //G4cout << "sphi <" << midPos.phi() << ">" << G4endl; - //G4cout << "cphi <" << cphi << ">" << G4endl; - //G4cout << "sphi - cphi = " << midPos.phi() - cphi << G4endl; - - //G4cout << "stheta <" << midPos.theta() << ">" << G4endl; - //G4cout << "ctheta <" << getThetaDim( aStep ) << ">" << G4endl; - //G4cout << "stheta - ctheta = " << midPos.theta() - getThetaDim( aStep ) << G4endl; - - //G4cout << "rcyl <" << rcyl << ">" << G4endl; - //G4cout << "zcell <" << zcell << ">" << G4endl; - //G4cout << "globalCellPos <" << pos << ">" << G4endl; - // - - return pos; - } - */ -
void ProjectiveSegmentation::setBins(const G4Step* aStep) { G4ThreeVector globalMidPos = ReadoutUtil::computeMidPos(aStep);
@@ -101,16 +58,6 @@
setBin(1, getPhiBin(globalMidPos)); }
-/* - void ProjectiveSegmentation::setBins(const G4StepPoint* aPreStepPoint) - { - G4ThreeVector globalPos = aPreStepPoint->GetPosition(); - - setBin(0, getThetaBin(globalPos)); - setBin(1, getPhiBin(globalPos)); - } - */ -
G4int ProjectiveSegmentation::getNtheta() const { return _ntheta; }
@@ -154,24 +101,12 @@
return ReadoutUtil::computeMidPos(aStep).mag(); }
-//double ProjectiveSegmentation::getRadius(const G4StepPoint* aPreStepPoint) -//{ -//G4cout << "G4ProjectiveSegmentation::getRadius()" << G4endl; -// return aPreStepPoint->GetPosition().mag(); -//} -
// default impl. returns z of pos double ProjectiveSegmentation::getZ(const G4Step* aStep) { //G4cout << "G4ProjectiveSegmentation::getZ()" << G4endl; return ReadoutUtil::computeMidPos(aStep).z(); }
-//double ProjectiveSegmentation::getZ(const G4StepPoint* aPreStepPoint) -//{ -//G4cout << "G4ProjectiveSegmentation::getZ()" << G4endl; -// return aPreStepPoint->GetPosition().z(); -//} -
double ProjectiveSegmentation::getThetaDim(const int &thetaBin) const { return Segmentation::computeDim(thetaBin, _divTheta); }
@@ -187,14 +122,6 @@
return ctheta; }
-//double ProjectiveSegmentation::getThetaDim(const G4StepPoint* aPreStepPoint) -//{ -//G4cout << "G4ProjectiveSegmentation::getThetaDim(G4Step*)" << G4endl; -// G4ThreeVector globalStepPos = aPreStepPoint->GetPosition(); -// double ctheta = getThetaDim(getThetaBin(globalStepPos)); -// return ctheta; -//} -
double ProjectiveSegmentation::getPhiDim(const G4Step* aStep) { //G4cout << "G4ProjectiveSegmentation::getPhiDim(G4Step*)" << G4endl;
@@ -202,12 +129,3 @@
double cphi = getPhiDim(getPhiBin(globalStepPos)); return cphi; }
-//double ProjectiveSegmentation::getPhiDim(const G4StepPoint* aPreStepPoint) -//{ -//G4cout << "G4ProjectiveSegmentation::getPhiDim(G4Step*)" << G4endl; - -// G4ThreeVector globalStepPos = aPreStepPoint->GetPosition(); -// double cphi = getPhiDim(getPhiBin(globalStepPos)); -// return cphi; -//} -
--- projects/lcdd/trunk/src/lcdd/segmentation/ProjectiveZPlaneSegmentation.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/segmentation/ProjectiveZPlaneSegmentation.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -16,25 +16,8 @@
double rcyl = zcell * tan(ctheta); return rcyl; }
-/* - double ProjectiveZPlaneSegmentation::getRadius(const G4StepPoint* aPreStepPoint) - { - double zcell = getZ(aPreStepPoint); - double ctheta = ProjectiveSegmentation::getThetaDim(aPreStepPoint); - double rcyl = zcell * tan(ctheta); - return rcyl; - } - */
double ProjectiveZPlaneSegmentation::getZ(const G4Step* aStep) { G4ThreeVector gpos = ReadoutUtil::getVolumeGlobalPosition(aStep->GetPreStepPoint(), G4ThreeVector()); return gpos.z(); }
- -/* - double ProjectiveZPlaneSegmentation::getZ(const G4StepPoint* aPreStepPoint) - { - G4ThreeVector gpos = ReadoutUtil::getVolumeGlobalPosition(aPreStepPoint, G4ThreeVector()); - return gpos.z(); - } - */
--- projects/lcdd/trunk/src/lcdd/segmentation/SegmentationFactory.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/segmentation/SegmentationFactory.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -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
@@ -63,8 +61,6 @@
sval += "*" + lunit; gsz = calc->Eval(sval);
- //std::cout << "grid x, y, z: " << gsx << ", " << gsy << ", " << gsz << std::endl; -
seg = new GridXYZSegmentation(gsx, gsy, gsz); } else { std::cerr << "Failed cast to grid_xyz!" << std::endl;
@@ -90,36 +86,10 @@
} 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; -
projective_zplane* prj = dynamic_cast<projective_zplane*>(obj); if (prj) {
@@ -130,18 +100,12 @@
sval = prj->get_nphi(); nphi = (int) calc->Eval(sval);
- //std::cout << "ntheta, nphi : " - // << ntheta << ", " - // << nphi << std::endl; -
seg = new ProjectiveZPlaneSegmentation(ntheta, nphi); } else { std::cerr << "Failed cast to projective_zplane!" << std::endl; } // prj no exist } else if (tag == "cell_readout_2d") {
- //std::cout << "building cell_readout_2d" << std::endl; -
cell_readout_2d* elem = dynamic_cast<cell_readout_2d*>(obj); if (0 != elem) { double cellSizeX, cellSizeY;
@@ -156,8 +120,6 @@
val += "*" + lengthUnit; cellSizeY = calc->Eval(val);
- //std::cout << "G4SegmentationFactory creating CellReadout2DSegmentation(x,y): " << cellSizeX << " " << cellSizeY << std::endl; -
seg = new CellReadout2DSegmentation(cellSizeX, cellSizeY); } } else {
--- projects/lcdd/trunk/src/lcdd/subscribers/headerSubscriber.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/subscribers/headerSubscriber.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -5,7 +5,7 @@
// LCDD #include "lcdd/core/LCDDProcessor.hh"
-#include "lcdd/geant4/LCDDHeaderRecord.hh"
+#include "lcdd/core/LCDDHeaderRecord.hh"
#include "lcdd/schema/header.hh" #include "lcdd/schema/detector.hh" #include "lcdd/schema/generator.hh"
--- projects/lcdd/trunk/src/lcdd/subscribers/limitsetSubscriber.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/subscribers/limitsetSubscriber.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -7,7 +7,7 @@
#include "lcdd/schema/limit.hh" #include "lcdd/schema/limitset.hh" #include "lcdd/core/LCDDProcessor.hh"
-#include "lcdd/geant4/PhysicsLimitSet.hh"
+#include "lcdd/core/PhysicsLimitSet.hh"
#include "lcdd/util/StringUtil.hh" // STL
@@ -33,14 +33,12 @@
} virtual void Activate(const SAXObject* object) {
- //std::cout << "limitsetSubscriber::Activate()" << std::endl;
if (object != 0) { GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator(); const limitset* lsobj = dynamic_cast<const limitset*>(object); if (lsobj != 0) {
- //std::cout << "got limitset: " << lsobj->get_name() << std::endl;
PhysicsLimitSet* ls = new PhysicsLimitSet(lsobj->get_name());
--- projects/lcdd/trunk/src/lcdd/subscribers/regionSubscriber.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/subscribers/regionSubscriber.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -6,7 +6,7 @@
// LCDD #include "lcdd/schema/region.hh" #include "lcdd/core/LCDDProcessor.hh"
-#include "lcdd/geant4/UserRegionInformation.hh"
+#include "lcdd/core/UserRegionInformation.hh"
#include "lcdd/schema/LimitSetType.hh" #include "lcdd/util/StringUtil.hh"
--- projects/lcdd/trunk/src/lcdd/subscribers/solenoidSubscriber.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/subscribers/solenoidSubscriber.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -27,14 +27,11 @@
} virtual void Activate(const SAXObject* object) {
- //std::cout << "solenoidSubscriber" << std::endl; -
GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator(); if (object != 0) { const solenoid* obj = dynamic_cast<const solenoid*>(object); if (obj) {
- //std::cout << "GOT SOLENOID: " << obj->get_name() << std::endl;
double outer_field, inner_field; double zmin, zmax;
--- projects/lcdd/trunk/src/lcdd/subscribers/visSubscriber.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/subscribers/visSubscriber.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -29,8 +29,6 @@
} virtual void Activate(const SAXObject* object) {
- //std::cout << "visSubscriber::Activate()" << std::endl; -
if (object != 0) { const vis* vobj = dynamic_cast<const vis*>(object);
@@ -62,7 +60,7 @@
SAXObject* child_obj = seq->content(i).object; if (child_tag == "color") {
- //std::cout << "handling color" << std::endl;
+
color* c = dynamic_cast<color*>(child_obj); double r = StringUtil::toDouble(c->get_R());
@@ -70,8 +68,6 @@
double b = StringUtil::toDouble(c->get_B()); double alpha = StringUtil::toDouble(c->get_alpha());
- //std::cout << "r g b alpha: " << r << " " << g << " " << b << " " << alpha << std::endl; -
g4vis->SetColor(r, g, b, alpha); // should be only one
--- projects/lcdd/trunk/src/lcdd/subscribers/volumeExtendedSubscriber.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/subscribers/volumeExtendedSubscriber.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -41,7 +41,9 @@
// handle sdref tag if (seq->content(i).tag == "sdref") {
- SensitiveDetectorType::sdref* sd = dynamic_cast<SensitiveDetectorType::sdref*>(seq->content(i).object);
+ SensitiveDetectorType::sdref* sd = + dynamic_cast<SensitiveDetectorType::sdref*>(seq->content( + i).object);
g4sd = proc->getSensitiveDetector(sd->get_ref());
@@ -49,119 +51,117 @@
if (!g4sd->isValidVolume(lv)) { //G4Exception("FATAL ERROR: The G4LogicalVolume <" + lv->GetName() + "> is not valid for the SD <" + g4sd->GetName() + ">.");
- G4Exception("", "", FatalException, "LogVol not valid for the SD");
+ G4Exception("", "", FatalException, + "LogVol not valid for the SD");
} lv->SetSensitiveDetector(g4sd); } else {
- G4cerr << "SD not found: " << sd->get_ref() << "." << G4endl; - G4Exception( "volumeExtendedSubscriber::Activate()", "", FatalException, "Invalid sdref.");
+ G4cerr << "SD not found: " << sd->get_ref() << "." + << G4endl; + G4Exception( "volumeExtendedSubscriber::Activate()", "", FatalException, "Invalid sdref.");
} } else if ( seq->content(i).tag == "regionref" ) { // handle regionref
- // get regionref object - RegionType::regionref* regref = dynamic_cast<RegionType::regionref*> ( seq->content(i).object );
+ // get regionref object + RegionType::regionref* regref = dynamic_cast<RegionType::regionref*> ( seq->content(i).object );
- // get region from store - G4Region* reg = dynamic_cast<G4Region*> ( proc->getRegion( regref->get_ref() ) );
+ // get region from store + G4Region* reg = dynamic_cast<G4Region*> ( proc->getRegion( regref->get_ref() ) );
- // add LV to region - if ( reg ) { - reg->AddRootLogicalVolume( lv ); - } else { - G4cerr << "Failed to fetch and/or cast to region: " << regref->get_ref() << G4endl; - G4Exception("volumeExtendedSubscriber::Activate()", "", FatalException, "Invalid regionref."); - } - } else if ( seq->content(i).tag == "limitsetref" ) { - // handle limitsetref
+ // add LV to region + if ( reg ) { + reg->AddRootLogicalVolume( lv ); + } else { + G4cerr << "Failed to fetch and/or cast to region: " << regref->get_ref() << G4endl; + G4Exception("volumeExtendedSubscriber::Activate()", "", FatalException, "Invalid regionref."); + } + } else if ( seq->content(i).tag == "limitsetref" ) { + // handle limitsetref
- LimitSetType::limitsetref* limitsetref = dynamic_cast<LimitSetType::limitsetref*> ( seq->content(i).object );
+ LimitSetType::limitsetref* limitsetref = dynamic_cast<LimitSetType::limitsetref*> ( seq->content(i).object );
- G4UserLimits* ulim = dynamic_cast<PhysicsLimitSet*> ( proc->getLimitSet( limitsetref->get_ref() ) );
+ G4UserLimits* ulim = dynamic_cast<PhysicsLimitSet*> ( proc->getLimitSet( limitsetref->get_ref() ) );
- if ( ulim ) { - lv->SetUserLimits( ulim ); - std::cout << "Set user limits <" << limitsetref->get_ref() << "> on logical volume <" << lv->GetName() << ">" << std::endl; - } else { - std::cerr << "FATAL ERROR: limit element not found - " << limitsetref->get_ref() << std::endl; - G4Exception("", "", FatalException, "limitsetref not found."); - } - } else if ( seq->content(i).tag == "visref" ) { - // handle visref
+ if ( ulim ) { + lv->SetUserLimits( ulim ); + std::cout << "Set user limits <" << limitsetref->get_ref() << "> on logical volume <" << lv->GetName() << ">" << std::endl; + } else { + std::cerr << "FATAL ERROR: limit element not found - " << limitsetref->get_ref() << std::endl; + G4Exception("", "", FatalException, "limitsetref not found."); + } + } else if ( seq->content(i).tag == "visref" ) { + // handle visref
- //std::cout << "handling visref" << std::endl;
+ //std::cout << "handling visref" << std::endl;
- VisType::visref* visref = dynamic_cast<VisType::visref*> ( seq->content(i).object );
+ VisType::visref* visref = dynamic_cast<VisType::visref*> ( seq->content(i).object );
- G4VisAttributes* vis = dynamic_cast<G4VisAttributes*> ( proc->getVisAttributes( visref->get_ref() ) );
+ G4VisAttributes* vis = dynamic_cast<G4VisAttributes*> ( proc->getVisAttributes( visref->get_ref() ) );
- if ( vis ) { - //std::cout << "assigning vis: " << visref->get_ref() << std::endl; - lv->SetVisAttributes( vis ); - } else { - std::cerr << "FATAL ERROR: vis element not found - " << visref->get_ref() << std::endl; - G4Exception("", "", FatalException, "vis element not found."); - } - }
+ if ( vis ) { + //std::cout << "assigning vis: " << visref->get_ref() << std::endl; + lv->SetVisAttributes( vis ); + } else { + std::cerr << "FATAL ERROR: vis element not found - " << visref->get_ref() << std::endl; + G4Exception("", "", FatalException, "vis element not found."); + } + } + if ( seq->content(i).tag == "physvol" ) { + // handle physvols to look for physvolids
- if ( seq->content(i).tag == "physvol" ) { - // handle physvols to look for physvolids
+ ++nchildren;
- ++nchildren;
+ // get physvol content sequence + physvol* pv = dynamic_cast<physvol*>( seq->content(i).object ); + const ContentSequence* pv_seq = pv->get_content(); + size_t ccount = pv_seq->size();
- // get physvol content sequence - physvol* pv = dynamic_cast<physvol*>( seq->content(i).object ); - const ContentSequence* pv_seq = pv->get_content(); - size_t ccount = pv_seq->size();
+ // iterate over physvol content + for ( size_t pvidx = 0; pvidx < ccount; pvidx++ ) {
- // iterate over physvol content - for ( size_t pvidx = 0; pvidx < ccount; pvidx++ ) {
+ // found "choice" tag? + if( pv_seq->content(pvidx).tag == "choice" ) {
- // found "choice" tag? - if( pv_seq->content(pvidx).tag == "choice" ) {
+ const ContentChoice* pv_choice = dynamic_cast<const ContentChoice*>( pv_seq->content(pvidx).object );
- const ContentChoice* pv_choice = dynamic_cast<const ContentChoice*>( pv_seq->content(pvidx).object );
+ // found a physvolid? + if ( pv_choice->content().tag == "physvolid" ) {
- // found a physvolid? - if ( pv_choice->content().tag == "physvolid" ) {
+ // add the physvolid...
- // add the physvolid...
+ physvolidElem* pvid_elem = + dynamic_cast<physvolidElem*>( pv_choice->content().object );
- physvolidElem* pvid_elem = - dynamic_cast<physvolidElem*>( pv_choice->content().object );
+ if ( pvid_elem == 0 ) { + G4Exception("", "", FatalException, "Failed cast to physvolidElem."); + }
- if ( pvid_elem == 0 ) { - G4Exception("", "", FatalException, "Failed cast to physvolidElem."); - }
+ GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
- GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
+ std::string strID = pvid_elem->get_value(); + std::string fld = pvid_elem->get_field_name();
- std::string strID = pvid_elem->get_value(); - std::string fld = pvid_elem->get_field_name();
+ int intID = (int)calc->Eval( strID );
- int intID = (int)calc->Eval( strID );
+ PhysVolId pvid(intID, fld);
- PhysVolId pvid(intID, fld); - - // assign physvolid to lv's child by the in-order idx - IdManager::instance()->addPhysVolId( - lv,// LV mom - nchildren - 1,// child idx in mom - pvid );// PhysVolId - } - - } - }
+ // assign physvolid to lv's child by the in-order idx + IdManager::instance()->addPhysVolId( + lv,// LV mom + nchildren - 1,// child idx in mom + pvid );// PhysVolId
} }
- } else { - G4Exception("", "", FatalException, "Failed cast to G4LogicalVolume.");
}
- } else { - G4Exception("", "", FatalException, "Failed cast to volume.");
} }
+ } else { + G4Exception("", "", FatalException, "Failed cast to G4LogicalVolume.");
}
- -//DECLARE_SUBSCRIBER_FACTORY(volumeExtendedSubscriber)
+ } else { + G4Exception("", "", FatalException, "Failed cast to volume."); + } + } +}
--- projects/lcdd/trunk/src/lcdd/util/Verbose.cc 2014-08-07 20:09:56 UTC (rev 3238) +++ projects/lcdd/trunk/src/lcdd/util/Verbose.cc 2014-08-07 20:26:41 UTC (rev 3239) @@ -1,6 +1,3 @@
-// $Header: /nfs/slac/g/lcd/cvs/lcdroot/lcdd/src/lcdd/util/Verbose.cc,v 1.4 2013-11-13 23:02:59 jeremy Exp $ - -// LCDD
#include "lcdd/util/Verbose.hh" const Verbose::LevelType Verbose::_defaultLevel = 0;
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