8 modified files
lcdd/include
diff -u -r1.4 -r1.5
--- CalorimeterType.hh 20 Apr 2005 19:04:39 -0000 1.4
+++ CalorimeterType.hh 27 Sep 2005 00:12:24 -0000 1.5
@@ -35,10 +35,22 @@
m_sequence.add_content( ci );
}
+ void set_compare( const std::string& compare )
+ {
+ m_compare = compare;
+ }
+
+ const std::string& get_compare() const
+ {
+ return m_compare;
+ }
+
private:
ContentSequence m_sequence;
+ std::string m_compare;
+
};
#endif
lcdd/include
diff -u -r1.11 -r1.12
--- G4CalorimeterHit.hh 12 Mar 2005 02:15:34 -0000 1.11
+++ G4CalorimeterHit.hh 27 Sep 2005 00:12:24 -0000 1.12
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/G4CalorimeterHit.hh,v 1.11 2005/03/12 02:15:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/G4CalorimeterHit.hh,v 1.12 2005/09/27 00:12:24 jeremy Exp $
#ifndef G4CalorimeterHit_hh
#define G4CalorimeterHit_hh 1
@@ -34,7 +34,7 @@
G4CalorimeterHit(const G4CalorimeterHit &right);
const G4CalorimeterHit& operator=(const G4CalorimeterHit &right);
bool operator==(const G4CalorimeterHit &right);
-
+
inline void *operator new(size_t);
inline void operator delete(void *aHit);
@@ -51,14 +51,14 @@
public:
- inline void setPos(const G4ThreeVector& posXYZ) { m_pos=posXYZ; }
- inline void setEdep(const G4double ed) { m_edep = ed; }
- inline void incrEdep(const G4double edincr) { m_edep += edincr; }
-
- inline G4ThreeVector getPos() { return m_pos; }
- inline G4double getEdep() { return m_edep; }
+ void setPos(const G4ThreeVector& posXYZ) { m_pos=posXYZ; }
+ void setEdep(const G4double ed) { m_edep = ed; }
+ void incrEdep(const G4double edincr) { m_edep += edincr; }
+
+ G4ThreeVector getPos() const { return m_pos; }
+ G4double getEdep() const { return m_edep; }
- inline void addMcpHitContrib( McpHitContrib contrib)
+ void addMcpHitContrib( McpHitContrib contrib)
{
m_particleList.push_back( contrib );
}
@@ -69,15 +69,15 @@
}
// set value of 64 bit id
- void setId64bit( Id64bit::ElementType id0,
- Id64bit::ElementType id1 )
+ void setId64bit( Id64bit::ElementType id0,
+ Id64bit::ElementType id1 )
{
m_id64.setId0( id0 );
m_id64.setId1( id1 );
}
// get 64 bit id
- const Id64bit& getId64bit()
+ const Id64bit& getId64bit() const
{
return m_id64;
}
@@ -86,12 +86,12 @@
{
m_endcap = ec;
}
-
+
bool getEndcapFlag()
{
return m_endcap;
- }
-
+ }
+
private:
// 64-bit id ( defaults to 0/0 )
@@ -105,7 +105,7 @@
// endcap flag
bool m_endcap;
-
+
// list of contributing Mcp info
McpHitContribList m_particleList;
};
lcdd/include
diff -u -r1.6 -r1.7
--- G4CalorimeterSD.hh 27 Jun 2005 20:40:33 -0000 1.6
+++ G4CalorimeterSD.hh 27 Sep 2005 00:12:24 -0000 1.7
@@ -6,6 +6,8 @@
#include <iostream>
+#include "HitComparator.hh"
+
class G4Segmentation;
/**
@@ -22,7 +24,8 @@
public:
G4CalorimeterSD(G4String sdName,
G4String hcName,
- G4Segmentation* sdSeg);
+ G4Segmentation* sdSeg,
+ HitComparator* compare = 0);
virtual ~G4CalorimeterSD();
@@ -50,6 +53,7 @@
G4Segmentation* m_segmentation;
G4CalorimeterHitsCollection* m_HC;
G4CalorimeterHitList m_hits;
+ HitComparator* m_hitCompare;
};
#endif
lcdd/include
diff -u -r1.2 -r1.3
--- Id64bit.hh 4 Mar 2005 22:51:01 -0000 1.2
+++ Id64bit.hh 27 Sep 2005 00:12:24 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/Id64bit.hh,v 1.2 2005/03/04 22:51:01 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/Id64bit.hh,v 1.3 2005/09/27 00:12:24 jeremy Exp $
#ifndef Id64bit_hh
#define Id64bit_hh 1
@@ -48,6 +48,12 @@
return m_ids[1];
}
+ bool operator==(const Id64bit& right) const
+ {
+ return ( m_ids[0] == right.m_ids[0] &&
+ m_ids[1] == right.m_ids[1] );
+ }
+
private:
ElementType m_ids[2];
};
lcdd/src
diff -u -r1.24 -r1.25
--- G4CalorimeterSD.cc 27 Jun 2005 20:40:34 -0000 1.24
+++ G4CalorimeterSD.cc 27 Sep 2005 00:12:25 -0000 1.25
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4CalorimeterSD.cc,v 1.24 2005/06/27 20:40:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4CalorimeterSD.cc,v 1.25 2005/09/27 00:12:25 jeremy Exp $
#include "G4CalorimeterSD.hh"
// LCDD
@@ -7,6 +7,7 @@
#include "McpHitContrib.hh"
#include "IdFactory.hh"
#include "IdManager.hh"
+#include "PositionComparator.hh"
// G4
#include "G4Track.hh"
@@ -19,13 +20,21 @@
G4CalorimeterSD::G4CalorimeterSD(G4String sdName,
G4String hcName,
- G4Segmentation* sdSeg)
+ G4Segmentation* sdSeg,
+ HitComparator* compare)
: G4SensitiveDetector(sdName,
hcName,
G4SensitiveDetector::eCalorimeter),
m_segmentation(sdSeg),
m_HC(0)
-{}
+{
+ if ( compare == 0 ) {
+ m_hitCompare = new PositionComparator();
+ }
+ else {
+ m_hitCompare = compare;
+ }
+}
G4CalorimeterSD::~G4CalorimeterSD()
{}
@@ -124,6 +133,7 @@
// 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?
@@ -140,9 +150,6 @@
// add to the HC
m_HC->insert(thisHit);
-
- // set hit cell id
- thisHit->setId64bit( id64.getId0(), id64.getId1() );
}
// found a hit
else {
@@ -176,7 +183,7 @@
for (G4CalorimeterHitList::const_iterator iter = m_hits.begin();
iter != m_hits.end();
iter++) {
- if ((**iter) == *aHit) {
+ if ( m_hitCompare->compare(**iter, *aHit) ) {
fndHit = *iter;
break;
}
lcdd/src
diff -u -r1.11 -r1.12
--- SensitiveDetectorFactory.cc 5 Jul 2005 20:35:54 -0000 1.11
+++ SensitiveDetectorFactory.cc 27 Sep 2005 00:12:25 -0000 1.12
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/SensitiveDetectorFactory.cc,v 1.11 2005/07/05 20:35:54 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/SensitiveDetectorFactory.cc,v 1.12 2005/09/27 00:12:25 jeremy Exp $
#include "SensitiveDetectorFactory.hh"
/* LCDD */
@@ -6,6 +6,8 @@
#include "G4ScorerSD.hh"
#include "G4TrackerSD.hh"
#include "G4CalorimeterSD.hh"
+#include "PositionComparator.hh"
+#include "IdComparator.hh"
#include "StringUtil.hh"
@@ -93,11 +95,26 @@
G4Exception("FATAL ERROR: segmentation tag is required to create a calorimeter.");
}
- // create SD with seg
+ const calorimeter* cal = dynamic_cast<const calorimeter*>( object );
+ const std::string& hitCompareStr = cal->get_compare();
+
+ HitComparator* hitCompare = 0;
+ if ( hitCompareStr == "id" ) {
+ hitCompare = new IdComparator();
+ }
+ else if ( hitCompareStr == "position" ) {
+ hitCompare = new PositionComparator();
+ }
+ else {
+ G4Exception("Invalid hit compare type " + hitCompareStr);
+ }
+
+ // create SD with seg and comparator
if ( seg ) {
sd = new G4CalorimeterSD(sdt->get_name(),
sdt->get_hitsCollectionName(),
- seg);
+ seg,
+ hitCompare);
}
// shouldn't happen if fnd_seg fails...
else {
lcdd/src
diff -u -r1.5 -r1.6
--- calorimeterProcess.cc 4 Mar 2005 22:51:13 -0000 1.5
+++ calorimeterProcess.cc 27 Sep 2005 00:12:25 -0000 1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/calorimeterProcess.cc,v 1.5 2005/03/04 22:51:13 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/calorimeterProcess.cc,v 1.6 2005/09/27 00:12:25 jeremy Exp $
#include "Saxana/ProcessingConfigurator.h"
#include "Saxana/ProcessingContext.h"
@@ -25,16 +25,18 @@
: SensitiveDetectorTypeProcess(context)
{}
- virtual ~calorimeterProcess()
+ virtual ~calorimeterProcess()
{}
- virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs)
+ 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;
-
+ SAXObject** obj = Context()->GetTopObject();
+ calorimeter* cal = new calorimeter;
+
+ cal->set_compare( attrs.getValue( "hit_aggregation" ) );
+
m_obj = cal;
*obj = cal;
lcdd/src
diff -u -r1.13 -r1.14
--- calorimeterSubscriber.cc 22 Apr 2005 18:39:07 -0000 1.13
+++ calorimeterSubscriber.cc 27 Sep 2005 00:12:25 -0000 1.14
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/calorimeterSubscriber.cc,v 1.13 2005/04/22 18:39:07 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/calorimeterSubscriber.cc,v 1.14 2005/09/27 00:12:25 jeremy Exp $
// GDML
#include "Saxana/SAXSubscriber.h"
@@ -41,14 +41,13 @@
Subscribe("calorimeter");
}
- virtual ~calorimeterSubscriber()
+ virtual ~calorimeterSubscriber()
{}
virtual void Activate(const SAXObject* object)
{
// use factory to create this SD
SensitiveDetectorFactory::createSensitiveDetector( object );
- //delete object;
}
};
CVSspam 0.2.8