7 added + 4 modified, total 11 files
lcdd/include
diff -N G4OpticalCalorimeterSD.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ G4OpticalCalorimeterSD.hh 5 Jul 2007 22:27:35 -0000 1.1
@@ -0,0 +1,27 @@
+#ifndef LCDD_G4CALORIMETERSD_HH
+#define LCDD_G4CALORIMETERSD_HH
+
+// slic
+#include "G4CalorimeterSD.hh"
+
+/**
+ @class G4OpticalCalorimeterSD
+ @brief Simulator implementation of a calorimeter-type SD that is sensitive to optical photons, only.
+*/
+class G4OpticalCalorimeterSD : public G4CalorimeterSD
+{
+
+public:
+ G4OpticalCalorimeterSD(G4String sdName,
+ G4String hcName,
+ G4Segmentation* sdSeg,
+ HitComparator* compare = 0);
+
+ virtual ~G4OpticalCalorimeterSD();
+
+protected:
+ virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+
+};
+
+#endif
lcdd/include
diff -N OpticalCalorimeterType.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ OpticalCalorimeterType.hh 5 Jul 2007 22:27:35 -0000 1.1
@@ -0,0 +1,26 @@
+#ifndef LCDD_OPTICALCALORIMETERTYPE_HH
+#define LCDD_OPTICALCALORIMETERTYPE_HH 1
+
+#include "Schema/ContentGroup.h"
+
+#include "CalorimeterType.hh"
+
+#include <iostream>
+
+/**
+ * @class CalorimeterType
+ * @brief CalorimeterType from schema.
+*/
+class OpticalCalorimeterType : public CalorimeterType
+{
+
+public:
+
+ OpticalCalorimeterType()
+ {}
+
+ virtual ~OpticalCalorimeterType()
+ {}
+};
+
+#endif
lcdd/include
diff -N calorimeterProcess.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ calorimeterProcess.hh 5 Jul 2007 22:27:35 -0000 1.1
@@ -0,0 +1,42 @@
+#ifndef LCDD_CALORIMETERPROCESS_HH
+#define LCDD_CALORIMETERPROCESS_HH 1
+
+// $Header: /cvs/lcd/lcdd/include/calorimeterProcess.hh,v 1.1 2007/07/05 22:27:35 jeremy Exp $
+
+#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"
+
+#include "calorimeter.hh"
+#include "SensitiveDetectorTypeProcess.hh"
+
+#include <iostream>
+
+/**
+ @class calorimeterProcess
+ @brief SAX process for calorimeter element.
+ @note Calls SAX processor for SensitiveDetectorTypeProcess parent class.
+*/
+class calorimeterProcess : public SensitiveDetectorTypeProcess
+{
+public:
+ calorimeterProcess(const ProcessingContext* context = 0);
+
+ virtual ~calorimeterProcess();
+
+ virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs);
+
+ 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
lcdd/include
diff -N optical_calorimeter.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ optical_calorimeter.hh 5 Jul 2007 22:27:35 -0000 1.1
@@ -0,0 +1,29 @@
+// $Header: /cvs/lcd/lcdd/include/optical_calorimeter.hh,v 1.1 2007/07/05 22:27:35 jeremy Exp $
+#ifndef LCDD_OPTICAL_CALORIMETER_HH
+#define LCDD_OPTICAL_CALORIMETER_HH 1
+
+#include "Saxana/SAXObject.h"
+
+#include "OpticalCalorimeterType.hh"
+
+/**
+
+ @class optical_calorimeter
+ @brief optical_calorimeter element from schema.
+ */
+class optical_calorimeter : public SAXObject, public OpticalCalorimeterType
+{
+public:
+ optical_calorimeter()
+ {}
+
+ virtual ~optical_calorimeter()
+ {}
+
+ virtual SAXObject::Type type()
+ {
+ return SAXObject::element;
+ }
+};
+
+#endif
lcdd/schemas/lcdd/1.0
diff -u -r1.3 -r1.4
--- lcdd_sensitive_detectors.xsd 31 Mar 2006 01:08:21 -0000 1.3
+++ lcdd_sensitive_detectors.xsd 5 Jul 2007 22:27:35 -0000 1.4
@@ -84,6 +84,17 @@
</xs:complexContent>
</xs:complexType>
+ <xs:complexType name="OpticalCalorimeterType">
+ <xs:annotation>
+ <xs:documentation>
+ Optical calorimeter sensitive detector type
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="CalorimeterType"/>
+ </xs:complexContent>
+ </xs:complexType>
+
<xs:element name="calorimeter" substitutionGroup="sd" type="CalorimeterType">
<xs:annotation>
<xs:documentation>
@@ -92,6 +103,14 @@
</xs:annotation>
</xs:element>
+ <xs:element name="optical_calorimeter" substitutionGroup="sd" type="OpticalCalorimeterType">
+ <xs:annotation>
+ <xs:documentation>
+ Optical calorimeter sensitive detector element
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
<xs:complexType name="TrackerType">
<xs:annotation>
<xs:documentation>
lcdd/src
diff -N G4OpticalCalorimeter.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ G4OpticalCalorimeter.cc 5 Jul 2007 22:27:35 -0000 1.1
@@ -0,0 +1,110 @@
+// $Header: /cvs/lcd/lcdd/src/G4OpticalCalorimeter.cc,v 1.1 2007/07/05 22:27:35 jeremy Exp $
+
+#include "G4OpticalCalorimeterSD.hh"
+
+// geant4
+#include "G4OpticalPhoton.hh"
+#include "G4TransportationManager.hh"
+#include "G4VProcess.hh"
+
+// lcdd
+#include "G4Segmentation.hh"
+
+G4OpticalCalorimeterSD::G4OpticalCalorimeterSD(G4String sdName,
+ G4String hcName,
+ G4Segmentation* sdSeg,
+ HitComparator* compare)
+ : G4CalorimeterSD(sdName,
+ hcName,
+ sdSeg,
+ compare)
+{}
+
+G4OpticalCalorimeterSD::~G4OpticalCalorimeterSD()
+{}
+
+G4bool G4OpticalCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
+{
+ // set cached step
+ G4SensitiveDetector::ProcessHits(aStep, 0);
+
+ G4Track * aTrack = aStep->GetTrack();
+
+ // particle is optical photon:
+ if(aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition()) {
+
+ if(aTrack->GetParentID()==0) {
+ // particle is primary
+ aTrack->SetTrackStatus(fStopAndKill);
+ return false;
+ }
+
+ // particle is secondary
+ G4String processname = aTrack->GetCreatorProcess()->G4VProcess::GetProcessName();
+
+ if(processname != "Cerenkov") {
+ aTrack->SetTrackStatus(fStopAndKill);
+ return false;
+ }
+
+ G4ThreeVector myPoint = aStep->GetPreStepPoint()->GetPosition();
+ G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
+ G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint);
+
+ if ( getVerbose() > 2 ) {
+ G4cout << "Physical volume = " << myVolume->GetName() << G4endl;
+ G4cout << "Point of interaction = " << myPoint<< G4endl;
+ G4cout << "sdname " << GetName() << " hcname " <<collectionName[0]<< G4endl;
+ }
+
+ G4double theEdep = aTrack->GetTotalEnergy()/eV;// total photon energy
+
+ // get global cell pos from seg
+ G4ThreeVector globalCellPos = m_segmentation->getGlobalHitPos( aStep );
+
+ // reset the seg bins
+ m_segmentation->resetBins();
+
+ // set the seg bins
+ m_segmentation->setBins( aStep );
+
+ // create id and pack into 64
+ Id64bit id64 = makeId();
+
+ // find hit by simple lkp of new hit with above info
+ G4CalorimeterHit* thisHit = new G4CalorimeterHit(theEdep, globalCellPos);
+ thisHit->setId64bit( id64.getId0(), id64.getId1() );
+ G4CalorimeterHit* fndHit = 0;
+ // hit is not found?
+ if ( !( fndHit = findHit( thisHit ) ) ) {
+
+ // add it to lkp map
+ m_hits.push_back(thisHit);
+
+ // add to the HC
+ m_HC->insert(thisHit);
+ }
+ // found a hit
+ else {
+
+ // don't need to insert thisHit, so delete it
+ delete thisHit;
+ thisHit = 0;
+
+ // incr total edep of the hit
+ fndHit->incrEdep(theEdep);
+
+ // for setting contrib
+ thisHit = fndHit;
+ }
+
+ // add McpHitContrib to this hit, setting info from step info
+ thisHit->addMcpHitContrib( McpHitContrib( aStep ) );
+ aTrack->SetTrackStatus(fStopAndKill); // don't step photon any further
+
+ return true;
+ }
+ else {
+ return false;
+ }
+}
lcdd/src
diff -N optical_calorimeterProcess.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ optical_calorimeterProcess.cc 5 Jul 2007 22:27:36 -0000 1.1
@@ -0,0 +1,38 @@
+// $Header: /cvs/lcd/lcdd/src/optical_calorimeterProcess.cc,v 1.1 2007/07/05 22:27:36 jeremy Exp $
+
+#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"
+
+#include "optical_calorimeter.hh"
+#include "calorimeterProcess.hh"
+
+#include <iostream>
+
+/**
+ @class optical_calorimeterProcess
+ @brief SAX process for optical_calorimeter element.
+ @note Calls SAX processor for SensitiveDetectorTypeProcess parent class.
+*/
+class optical_calorimeterProcess : public calorimeterProcess
+{
+public:
+ optical_calorimeterProcess(const ProcessingContext* context = 0)
+ : calorimeterProcess(context)
+ {}
+
+ virtual ~optical_calorimeterProcess()
+ {}
+
+ virtual const std::string& State() const
+ {
+ static std::string tag = "optical_calorimeter";
+ return tag;
+ }
+};
+
+DECLARE_PROCESS_FACTORY(optical_calorimeterProcess)
lcdd/src
diff -N optical_calorimeterSubscriber.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ optical_calorimeterSubscriber.cc 5 Jul 2007 22:27:36 -0000 1.1
@@ -0,0 +1,52 @@
+// $Header: /cvs/lcd/lcdd/src/optical_calorimeterSubscriber.cc,v 1.1 2007/07/05 22:27:36 jeremy Exp $
+
+// GDML
+#include "Saxana/SAXSubscriber.h"
+#include "Saxana/SAXComponentFactory.h"
+
+#include "G4Processor/GDMLProcessor.h"
+
+// LCDD
+#include "calorimeter.hh"
+
+#include "LCDDProcessor.hh"
+#include "G4CalorimeterSD.hh"
+
+#include "G4SegmentationFactory.hh"
+#include "SensitiveDetectorFactory.hh"
+
+#include "IdManager.hh"
+#include "IdSpec.hh"
+
+#include <iostream>
+#include <sstream>
+
+/**
+ @class calorimeterSubscriber
+ @brief SAX subscriber for calorimeter element.
+ @note Delegates to SensitiveDetectorFactory to create G4CalorimeterSD object.
+*/
+class optical_calorimeterSubscriber : virtual public SAXSubscriber
+{
+public:
+ virtual const SAXComponentObject* Build() const
+ {
+ return this;
+ }
+
+public:
+ optical_calorimeterSubscriber()
+ {
+ Subscribe("optical_calorimeter");
+ }
+
+ virtual ~optical_calorimeterSubscriber()
+ {}
+
+ virtual void Activate(const SAXObject* object)
+ {
+ SensitiveDetectorFactory::createSensitiveDetector(object);
+ }
+};
+
+DECLARE_SUBSCRIBER_FACTORY(optical_calorimeterSubscriber)
lcdd/src
diff -u -r1.24 -r1.25
--- LCDDLibLoad.cc 19 Jun 2007 23:55:05 -0000 1.24
+++ LCDDLibLoad.cc 5 Jul 2007 22:27:35 -0000 1.25
@@ -19,6 +19,7 @@
// SDs
LOAD_COMPONENT(calorimeterProcess);
+ LOAD_COMPONENT(optical_calorimeterProcess);
LOAD_COMPONENT(trackerProcess);
LOAD_COMPONENT(scorerProcess);
LOAD_COMPONENT(sdrefProcess);
@@ -68,13 +69,14 @@
// SDs
LOAD_COMPONENT(calorimeterSubscriber);
+ LOAD_COMPONENT(optical_calorimeterSubscriber);
LOAD_COMPONENT(trackerSubscriber);
LOAD_COMPONENT(scorerSubscriber);
// Ids
LOAD_COMPONENT(idspecSubscriber);
- // field
+ // field
LOAD_COMPONENT(solenoidSubscriber);
LOAD_COMPONENT(rz_field_mapSubscriber);
LOAD_COMPONENT(dipoleSubscriber);
lcdd/src
diff -u -r1.13 -r1.14
--- SensitiveDetectorFactory.cc 7 Feb 2007 05:18:02 -0000 1.13
+++ SensitiveDetectorFactory.cc 5 Jul 2007 22:27:36 -0000 1.14
@@ -1,14 +1,14 @@
-// $Header: /cvs/lcd/lcdd/src/SensitiveDetectorFactory.cc,v 1.13 2007/02/07 05:18:02 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/SensitiveDetectorFactory.cc,v 1.14 2007/07/05 22:27:36 jeremy Exp $
#include "SensitiveDetectorFactory.hh"
-/* LCDD */
+// lcdd
#include "G4TrackerCombineSD.hh"
#include "G4ScorerSD.hh"
#include "G4TrackerSD.hh"
+#include "G4OpticalCalorimeterSD.hh"
#include "G4CalorimeterSD.hh"
#include "PositionComparator.hh"
#include "IdComparator.hh"
-
#include "StringUtil.hh"
G4SensitiveDetector* SensitiveDetectorFactory::createSensitiveDetector(const SAXObject* object)
@@ -18,10 +18,11 @@
const SensitiveDetectorType* sdt = dynamic_cast<const SensitiveDetectorType*> ( object );
if ( sdt ) {
+
std::string sd_type = sdt->get_type();
/* create calorimeter */
- if ( sd_type == "calorimeter" ) {
+ if ( sd_type == "calorimeter" || sd_type == "optical_calorimeter" ) {
sd = createCalorimeterSD( object );
}
/* create tracker */
@@ -39,14 +40,14 @@
}
// set ecut and verbose
- setBaseSensitiveDetectorAttributes(sd, sdt);
+ setBaseSensitiveDetectorAttributes(sd, sdt);
// find idspec
- IdSpec* idspec = findIdSpec( sdt );
+ IdSpec* idspec = findIdSpec(sdt);
// set idspec, if exists (null is ok)
if ( idspec != 0 ) {
- sd->setIdSpec( idspec );
+ sd->setIdSpec(idspec);
}
// register the SD
@@ -69,6 +70,8 @@
//const calorimeter* cal = dynamic_cast<const calorimeter*>( object );
const SensitiveDetectorType* sdt = dynamic_cast<const SensitiveDetectorType*>( object );
+ std::string sd_type = sdt->get_type();
+
// first create segmentation
ContentSequence* seq = const_cast<ContentSequence*> ( sdt->get_content() );
size_t count = seq->size();
@@ -83,8 +86,6 @@
// create segmentation using factory
if ( isSegmentationTag( child_tag ) ) {
- //std::cout << "handling segmentation - " << child_tag << std::endl;
-
seg = G4SegmentationFactory::createSegmentation( segitem.object, segitem.tag );
fnd_seg = true;
break;
@@ -96,6 +97,7 @@
}
const calorimeter* cal = dynamic_cast<const calorimeter*>( object );
+
const std::string& hitCompareStr = cal->get_compare();
// Comparison algorithm to be used for combining hits, to be determined
@@ -105,7 +107,6 @@
// Find the IdSpec.
IdSpec* idspec = findIdSpec( sdt );
- // The attribute value for hit_compare is not valid.
if ( hitCompareStr != "id" && hitCompareStr != "position" ) {
G4Exception("Invalid selection for hit comparison <" + hitCompareStr + ">, for calorimeter <" + sdt->get_name() + ">.");
}
@@ -113,7 +114,6 @@
// Compare on IDs.
if ( hitCompareStr == "id" ) {
if ( idspec ) {
- //std::cout << "id compare" << std::endl;
hitCompare = new IdComparator();
}
else {
@@ -123,16 +123,27 @@
// Compare on position.
if ( !hitCompare ) {
- //std::cout << "position compare" << std::endl;
hitCompare = new PositionComparator();
}
// create SD with seg and comparator
if ( seg ) {
- sd = new G4CalorimeterSD(sdt->get_name(),
- sdt->get_hitsCollectionName(),
- seg,
- hitCompare);
+
+ if ( sd_type == "calorimeter" ) {
+ sd = new G4CalorimeterSD(sdt->get_name(),
+ sdt->get_hitsCollectionName(),
+ seg,
+ hitCompare);
+ }
+ else if ( sd_type == "optical_calorimeter" ) {
+ sd = new G4OpticalCalorimeterSD(sdt->get_name(),
+ sdt->get_hitsCollectionName(),
+ seg,
+ hitCompare);
+ }
+ else {
+ G4Exception("SensitiveDetectorFactory - Unknown sensitive detector type: " + sd_type);
+ }
}
// shouldn't happen if fnd_seg fails...
else {
@@ -201,14 +212,12 @@
// find idspec
if ( child_tag == "idspecref" ) {
- //std::cout << "found idspecref" << std::endl;
-
IdSpecType::idspecref* id_ref =
dynamic_cast<IdSpecType::idspecref*> ( seq->content(i).object );
idspec = IdManager::instance()->getIdSpec( id_ref->get_ref() );
- if ( !idspec ) {
+ if (idspec == 0) {
G4Exception("The IdSpec <" + id_ref->get_ref() + "> referenced by detector <" + sdt->get_name() + "> does not exist!");
}
@@ -259,9 +268,7 @@
// is size <= 1 ?
if ( s.size() <= 1 ) {
bad = true;
-
- std::cerr << "HCName <" << s << "> is not enough characters." << std::endl;
-
+ //std::cerr << "HCName <" << s << "> is not enough characters." << std::endl;
}
else {
@@ -271,9 +278,7 @@
iter++ ) {
if (iter->second->getHCName() == s ) {
bad = true;
-
- std::cerr << "HCName <" << s << "> already assigned to SD <" << iter->second->GetName() << ">." << std::endl;
-
+ //std::cerr << "HCName <" << s << "> already assigned to SD <" << iter->second->GetName() << ">." << std::endl;
break;
}
}
lcdd/src
diff -u -r1.6 -r1.7
--- calorimeterProcess.cc 27 Sep 2005 00:12:25 -0000 1.6
+++ calorimeterProcess.cc 5 Jul 2007 22:27:36 -0000 1.7
@@ -1,69 +1,48 @@
-// $Header: /cvs/lcd/lcdd/src/calorimeterProcess.cc,v 1.6 2005/09/27 00:12:25 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/calorimeterProcess.cc,v 1.7 2007/07/05 22:27:36 jeremy Exp $
-#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"
-
-#include "calorimeter.hh"
-#include "SensitiveDetectorTypeProcess.hh"
-
-#include <iostream>
+#include "calorimeterProcess.hh"
/**
@class calorimeterProcess
@brief SAX process for calorimeter element.
@note Calls SAX processor for SensitiveDetectorTypeProcess parent class.
*/
-class calorimeterProcess : public SensitiveDetectorTypeProcess
+calorimeterProcess::calorimeterProcess(const ProcessingContext* context)
+ : SensitiveDetectorTypeProcess(context)
+{}
+
+calorimeterProcess::~calorimeterProcess()
+{}
+
+void calorimeterProcess::StartElement(const std::string& name, const ASCIIAttributeList& attrs)
+{
+ SAXObject** obj = Context()->GetTopObject();
+ calorimeter* cal = new calorimeter;
+
+ cal->set_compare( attrs.getValue( "hit_aggregation" ) );
+
+ m_obj = cal;
+ *obj = cal;
+
+ // parent type to set name and hitsCollectionName
+ SensitiveDetectorTypeProcess::StartElement(name, attrs);
+}
+
+void calorimeterProcess::EndElement(const std::string&)
+{}
+
+void calorimeterProcess::Characters(const std::string&)
+{}
+
+void calorimeterProcess::StackPopNotify(const std::string& name)
+{
+ SensitiveDetectorTypeProcess::StackPopNotify(name);
+}
+
+const std::string& calorimeterProcess::State() const
{
-public:
- calorimeterProcess(const ProcessingContext* context = 0)
- : SensitiveDetectorTypeProcess(context)
- {}
-
- virtual ~calorimeterProcess()
- {}
-
- virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs)
- {
- //std::cout << "calorimeterProcess::StartElement: " << name << std::endl;
-
- SAXObject** obj = Context()->GetTopObject();
- calorimeter* cal = new calorimeter;
-
- cal->set_compare( attrs.getValue( "hit_aggregation" ) );
-
- m_obj = cal;
- *obj = cal;
-
- // parent type to set name and hitsCollectionName
- SensitiveDetectorTypeProcess::StartElement(name, attrs);
- }
-
- virtual void EndElement(const std::string&)
- {
- //std::cout << "calorimeterProcess::EndElement: " << name << " " << std::endl;
-
- //SensitiveDetectorTypeProcess::EndElement( name );
- }
-
- virtual void Characters(const std::string&)
- {}
-
- virtual void StackPopNotify(const std::string& name)
- {
- SensitiveDetectorTypeProcess::StackPopNotify(name);
- }
-
- virtual const std::string& State() const
- {
- static std::string tag = "calorimeter";
- return tag;
- }
-};
+ static std::string tag = "calorimeter";
+ return tag;
+}
DECLARE_PROCESS_FACTORY(calorimeterProcess)
CVSspam 0.2.8