9 modified files
lcio/doc
diff -u -r1.59 -r1.59.2.1
--- lcio.xml 8 Mar 2006 09:57:26 -0000 1.59
+++ lcio.xml 25 Apr 2006 15:29:35 -0000 1.59.2.1
@@ -109,7 +109,9 @@
</block>
<block name="SimCalorimeterHit" major="1" minor="7">
<data type="int" name="flags">Bit 31 long = 1, short = 0; Bit 30 Barrel = 0, Endcap = 1;
- Bit 29 cellid1 = 1, no cellid1 = 0; Bit 28 PDG = 1, no PDG =0, Bits 0-15 user/detector specific</data>
+ Bit 29 cellid1 = 1, no cellid1 = 0; Bit 28 PDG = 1, no PDG =0,; Bit 27 MAPS = 1,
+ Bits 0-15 user/detector specific
+ </data>
<include subroutine="namedParameters"/>
<data type="int" name="nHits"></data>
<repeat count="nHits">
@@ -128,6 +130,10 @@
<data type="float" name="time"></data>
<if condition="(flags&(1<<28)) != 0">
<data type="int" name="PDG"></data>
+ <if condition="(flags&(1<<27)) != 0">
+ <data type="double[3]" name="positionCont"></data>
+ <data type="float[3]" name="momentumCont"></data>
+ </if>
</if>
</repeat>
<if condition="1000*major+minor>1000">
lcio/src/aid/EVENT
diff -u -r1.53 -r1.53.2.1
--- LCIO.aid 24 Mar 2006 06:33:43 -0000 1.53
+++ LCIO.aid 25 Apr 2006 15:29:36 -0000 1.53.2.1
@@ -16,7 +16,7 @@
/** Global constants used in LCIO.
*
* @author gaede
- * @version $Id: LCIO.aid,v 1.53 2006/03/24 06:33:43 jeremy Exp $
+ * @version $Id: LCIO.aid,v 1.53.2.1 2006/04/25 15:29:36 gaede Exp $
* @see LCObject
* @see LCIO
*/
@@ -39,6 +39,7 @@
static const int CHBIT_BARREL = 30 ; // barrel(1) - endcap(0)
static const int CHBIT_ID1 = 29 ; // cellid1 stored
static const int CHBIT_PDG = 28 ; // PDG(1) - no PDG(0) (detailed shower contributions)
+ static const int CHBIT_MAPS = 27 ; // MAPS(1) mode - p and x vectors of shower particle stored
// (raw) calorimeter hit
static const int RCHBIT_LONG = 31 ; // long(1) - short(0) , incl./excl. position
@@ -123,6 +124,7 @@
public static const int CHBIT_BARREL = 30 ; // barrel(1) - endcap(0)
public static const int CHBIT_ID1 = 29 ; // cellid1 stored
public static const int CHBIT_PDG = 28 ; // PDG(1) - no PDG(0) (detailed shower contributions)
+ public static const int CHBIT_MAPS = 27 ; // MAPS(1) mode - p and x vectors of shower particle stored
// (raw) calorimeter hit
public static const int RCHBIT_LONG = 31 ; // long(1) - short(0) , incl./excl. position
lcio/src/aid/EVENT
diff -u -r1.8 -r1.8.2.1
--- SimCalorimeterHit.aid 24 Mar 2006 13:25:52 -0000 1.8
+++ SimCalorimeterHit.aid 25 Apr 2006 15:29:36 -0000 1.8.2.1
@@ -3,7 +3,7 @@
/** The generic simulated calorimeter hit.
*
* @author gaede
- * @version $Id: SimCalorimeterHit.aid,v 1.8 2006/03/24 13:25:52 gaede Exp $
+ * @version $Id: SimCalorimeterHit.aid,v 1.8.2.1 2006/04/25 15:29:36 gaede Exp $
*/
public interface SimCalorimeterHit extends LCObject {
@@ -71,6 +71,20 @@
*/
public int getPDGCont(int i) const ;
+
+ /** Returns the (mean) position of where the shower particle crossed the cell. Only
+ * in MAPS mode ( Check the flag word bit LCIO.CHBIT_MAPS of the collection).
+ * Note this only makes sense in detailed shower mode, i.e. LCIO.CHBIT_PDG==1.
+ */
+ public const double3V getPositionCont(int i) const ;
+
+ /** Returns the 3-momentum of the shower particle at the (mean) position of where it crossed the cell.
+ * Only in MAPS mode ( Check the flag word bit LCIO.CHBIT_MAPS of the collection).
+ * Note this only makes sense in detailed shower mode, i.e. LCIO.CHBIT_PDG==1.
+ */
+ public const float3V getMomentumCont(int i) const ;
+
+
/** Returns the MCParticle that caused the shower responsible for this contribution to the hit.
* This is the particle that flew into the calorimeter and not the shower particle that made the
* energy deposition.
lcio/src/cpp/include/IMPL
diff -u -r1.15 -r1.15.4.1
--- SimCalorimeterHitImpl.h 15 Apr 2005 08:37:38 -0000 1.15
+++ SimCalorimeterHitImpl.h 25 Apr 2006 15:29:36 -0000 1.15.4.1
@@ -15,6 +15,8 @@
float Energy ;
float Time ;
int PDG ;
+ double Position[3] ;
+ float Momentum[3] ;
} MCParticleCont ;
typedef std::vector< MCParticleCont* > MCParticleContVec ;
@@ -105,6 +107,17 @@
*/
virtual int getPDGCont(int i) const ;
+
+ /** Returns the (mean) position of where the shower particle crossed the cell. Only
+ * in MAPS mode ( LCIO.CHBIT_MAPS==1 && LCIO.CHBIT_PDG==1 ).
+ */
+ virtual const double* getPositionCont(int i) const ;
+
+ /** Returns the 3-momentum of the shower particle at the (mean) position of where it crossed the cell.
+ * Only in MAPS mode ( LCIO.CHBIT_MAPS==1 && LCIO.CHBIT_PDG==1 ).
+ */
+ virtual const float* getMomentumCont(int i) const ;
+
/** Returns the MCParticle that caused the shower responsible for this contribution to the hit.
* This is the particle that flew into the calorimeter and not the shower particle that made the
* energy deposition.
@@ -147,6 +160,17 @@
float en,
float t,
int pdg=0 ) ;
+
+ /** Special method for MAPS mode where also position and momentum of every shower particle are stored -
+ * you need to set the flag word bits LCIO::CHBIT_PDG and LCIO::CHBIT_MAPS to actually
+ * store the additional information and call this method with p!=0, pdg!=0.
+ */
+ void addMapsContribution( EVENT::MCParticle *p,
+ float en,
+ float t,
+ double x, double y, double z,
+ float px, float py, float pz,
+ int pdg ) ;
protected:
lcio/src/cpp/src/EXAMPLE
diff -u -r1.51 -r1.51.2.1
--- simjob.cc 25 Apr 2006 08:47:19 -0000 1.51
+++ simjob.cc 25 Apr 2006 15:29:36 -0000 1.51.2.1
@@ -196,6 +196,7 @@
LCFlagImpl chFlag(0) ;
chFlag.setBit( LCIO::CHBIT_LONG ) ;
chFlag.setBit( LCIO::CHBIT_PDG ) ;
+ chFlag.setBit( LCIO::CHBIT_MAPS ) ;
calVec->setFlag( chFlag.getFlag() ) ;
std::string cellIDEncoding( "M:3,S-1:3,I:9,J:9,K-1:6") ;// old Mokka convention
@@ -234,9 +235,13 @@
// in order to access a MCParticle, we need a dynamic cast as the
// LCCollection returns an LCIOObject - this is like vectors in Java
- hit->addMCParticleContribution( dynamic_cast<MCParticle*>(mcVec->getElementAt( mcIndx )) ,
- 0.314159, 0.1155 ) ; // no pdg
+// hit->addMCParticleContribution( dynamic_cast<MCParticle*>(mcVec->getElementAt( mcIndx )) ,
+// 0.314159, 0.1155 ) ; // no pdg
+ hit->addMapsContribution( dynamic_cast<MCParticle*>(mcVec->getElementAt( mcIndx )) ,
+ 0.314159, 0.1155 ,
+ 1., 2., 3., .1, .2, .3 , // x,y,z,px,py,pz
+ 13 ) ;
}
// -------- data can be modified as long as is not not made persistent --------
@@ -247,9 +252,12 @@
// = dynamic_cast<SimCalorimeterHitImpl*>( (*calVec)[j] ) ; // << not needed
- existingHit->addMCParticleContribution( dynamic_cast<MCParticle*>
- (mcVec->getElementAt(0)),
- 0.1, 0. ) ;
+// existingHit->addMCParticleContribution( dynamic_cast<MCParticle*>
+// (mcVec->getElementAt(0)),
+// 0.1, 0. ) ;
+ existingHit->addMapsContribution( dynamic_cast<MCParticle*> (mcVec->getElementAt(0)),
+ 1., 2., 3., .1, .2, .3 , // x,y,z,px,py,pz
+ 0.1, 0. , -13 ) ;
}
// and finally some tracker hits
lcio/src/cpp/src/IMPL
diff -u -r1.15 -r1.15.4.1
--- SimCalorimeterHitImpl.cc 15 Apr 2005 08:37:47 -0000 1.15
+++ SimCalorimeterHitImpl.cc 25 Apr 2006 15:29:37 -0000 1.15.4.1
@@ -110,6 +110,15 @@
return _vec[i]->PDG ;
}
+ const double* SimCalorimeterHitImpl::getPositionCont(int i) const {
+ return _vec[i]->Position ;
+ }
+
+ const float* SimCalorimeterHitImpl::getMomentumCont(int i) const {
+ return _vec[i]->Momentum ;
+ }
+
+
void SimCalorimeterHitImpl::setCellID0(int id0){
checkAccess("SimCalorimeterHitImpl::setCellID0") ;
_cellID0 = id0 ;
@@ -133,23 +142,38 @@
}
void SimCalorimeterHitImpl::addMCParticleContribution( EVENT::MCParticle *p,
- float en,
- float t,
- int pdg ){
-
+ float en,
+ float t,
+ int pdg ){
checkAccess("SimCalorimeterHitImpl::addMCParticleContribution") ;
+
+ addMapsContribution( p, en, t, 0., 0., 0.,0., 0., 0., pdg ) ;
+
+ }
+
+
+ void SimCalorimeterHitImpl::addMapsContribution( EVENT::MCParticle *p,
+ float en,
+ float t,
+ double x, double y, double z,
+ float px, float py, float pz,
+ int pdg ) {
+
+
+ checkAccess("SimCalorimeterHitImpl::addMapsContribution") ;
+
if( p==0){
// just add the energy - no MC contribution !!
_energy += en ;
return ;
}
else if( pdg == 0 ) { // not in extended mode - only one contribution per primary particle
-
-
-
+
+
+
for( std::vector<MCParticleCont*>::iterator iter=_vec.begin() ;
iter != _vec.end() ; iter++ ){
-
+
if( (*iter)->Particle == p ) { // && (*iter)->PDG == pdg ){
(*iter)->Energy += en ;
@@ -168,6 +192,12 @@
con->Energy = en ;
con->Time = t ;
con->PDG = pdg ;
+ con->Position[0] = x ;
+ con->Position[1] = y ;
+ con->Position[2] = z ;
+ con->Momentum[0] = px ;
+ con->Momentum[1] = py ;
+ con->Momentum[2] = pz ;
_vec.push_back( con ) ;
}
lcio/src/cpp/src/SIO
diff -u -r1.10 -r1.10.4.1
--- SIOSimCalHitHandler.cc 15 Apr 2005 08:37:50 -0000 1.10
+++ SIOSimCalHitHandler.cc 25 Apr 2006 15:29:37 -0000 1.10.4.1
@@ -27,10 +27,12 @@
SimCalorimeterHitIOImpl* hit = new SimCalorimeterHitIOImpl ;
*objP = hit ;
+ LCFlagImpl flag(_flag) ;
+
SIO_DATA( stream , &(hit->_cellID0) , 1 ) ;
// in v00-08 cellid1 has been stored by default
- if( LCFlagImpl(_flag).bitSet( LCIO::CHBIT_ID1 ) ||
+ if( flag.bitSet( LCIO::CHBIT_ID1 ) ||
( SIO_VERSION_MAJOR(_vers)==0 && SIO_VERSION_MINOR(_vers)==8) ){
@@ -39,7 +41,7 @@
}
SIO_DATA( stream , &(hit->_energy) , 1 ) ;
- if( LCFlagImpl(_flag).bitSet( LCIO::CHBIT_LONG ) ){
+ if( flag.bitSet( LCIO::CHBIT_LONG ) ){
SIO_DATA( stream , hit->_position , 3 ) ;
}
@@ -53,8 +55,17 @@
SIO_PNTR( stream , &(mcCon->Particle) ) ;
SIO_DATA( stream , &(mcCon->Energy) , 1 ) ;
SIO_DATA( stream , &(mcCon->Time) , 1 ) ;
- if( LCFlagImpl(_flag).bitSet( LCIO::CHBIT_PDG ) )
+
+ if( flag.bitSet( LCIO::CHBIT_PDG ) ){
+
SIO_DATA( stream , &(mcCon->PDG) , 1 ) ;
+
+ if( flag.bitSet( LCIO::CHBIT_MAPS ) ){
+
+ SIO_DATA( stream , mcCon->Position , 3 ) ;
+ SIO_DATA( stream , mcCon->Momentum , 3 ) ;
+ }
+ }
hit->_vec.push_back( mcCon );
}
@@ -77,15 +88,19 @@
const SimCalorimeterHit* hit = dynamic_cast<const SimCalorimeterHit*>(obj) ;
+ LCFlagImpl flag(_flag) ;
+
LCSIO_WRITE( stream, hit->getCellID0() ) ;
- if( LCFlagImpl(_flag).bitSet( LCIO::CHBIT_ID1 ) ){
+
+ if( flag.bitSet( LCIO::CHBIT_ID1 ) ){
LCSIO_WRITE( stream, hit->getCellID1() ) ;
}
+
LCSIO_WRITE( stream, hit->getEnergy() ) ;
// as SIO doesn't provide a write function with const arguments
// we have to cast away the constness
- if( LCFlagImpl(_flag).bitSet( LCIO::CHBIT_LONG ) ){
+ if( flag.bitSet( LCIO::CHBIT_LONG ) ){
float* pos = const_cast<float*> ( hit->getPosition() ) ;
SIO_DATA( stream, pos , 3 ) ;
}
@@ -100,9 +115,17 @@
LCSIO_WRITE( stream, hit->getEnergyCont(i) ) ;
LCSIO_WRITE( stream, hit->getTimeCont(i) ) ;
- if( LCFlagImpl(_flag).bitSet( LCIO::CHBIT_PDG ) )
+ if( flag.bitSet( LCIO::CHBIT_PDG ) )
LCSIO_WRITE( stream, hit->getPDGCont(i) ) ;
-
+
+ if( flag.bitSet( LCIO::CHBIT_MAPS ) ){
+
+ double* poscont = const_cast<double*> ( hit->getPositionCont(i) ) ;
+ SIO_DATA( stream , poscont , 3 ) ;
+ float* momcont = const_cast<float*> ( hit->getMomentumCont(i) ) ;
+ SIO_DATA( stream , momcont , 3 ) ;
+ }
+
}
// add a pointer tag for reference to sim. calorimeter hits - added in v1.1
lcio/src/cpp/src/UTIL
diff -u -r1.49 -r1.49.2.1
--- LCTOOLS.cc 25 Apr 2006 08:47:20 -0000 1.49
+++ LCTOOLS.cc 25 Apr 2006 15:29:37 -0000 1.49.2.1
@@ -993,6 +993,7 @@
cout << " LCIO::CHBIT_BARREL : " << flag.bitSet( LCIO::CHBIT_BARREL ) << endl ;
cout << " LCIO::CHBIT_ID1 : " << flag.bitSet( LCIO::CHBIT_ID1 ) << endl ;
cout << " LCIO::CHBIT_PDG : " << flag.bitSet( LCIO::CHBIT_PDG ) << endl ;
+ cout << " LCIO::CHBIT_MAPS : " << flag.bitSet( LCIO::CHBIT_MAPS ) << endl ;
int nHits = col->getNumberOfElements() ;
int nPrint = nHits > MAX_HITS ? MAX_HITS : nHits ;
@@ -1050,9 +1051,24 @@
<< hit->getEnergyCont( k) << " | "
<< hit->getTimeCont( k) << " | " ;
- if( flag.bitSet( LCIO::CHBIT_PDG ) )
- cout << hit->getPDGCont( k) << " | " << endl ;
- else
+ if( flag.bitSet( LCIO::CHBIT_PDG ) ){
+
+ cout << hit->getPDGCont( k) << " | " ;
+
+ if( flag.bitSet( LCIO::CHBIT_MAPS ) ){
+
+ cout << " [x:"
+ << hit->getPositionCont(k)[0] << ", "
+ << hit->getPositionCont(k)[1] << ", "
+ << hit->getPositionCont(k)[2] << "][p: "
+ << hit->getMomentumCont(k)[0] << ", "
+ << hit->getMomentumCont(k)[1] << ", "
+ << hit->getMomentumCont(k)[2] << "] " ;
+ }
+
+ cout << endl ;
+
+ } else
cout << " no PDG" << endl ;
}
lcio/src/java/hep/lcio/implementation/event
diff -u -r1.9 -r1.9.4.1
--- ISimCalorimeterHit.java 24 Sep 2004 10:39:29 -0000 1.9
+++ ISimCalorimeterHit.java 25 Apr 2006 15:29:38 -0000 1.9.4.1
@@ -7,7 +7,7 @@
/**
* A default implementation of SimCalorimeterHit
* @author Tony Johnson
- * @version $Id: ISimCalorimeterHit.java,v 1.9 2004/09/24 10:39:29 tonyj Exp $
+ * @version $Id: ISimCalorimeterHit.java,v 1.9.4.1 2006/04/25 15:29:38 gaede Exp $
*/
public class ISimCalorimeterHit extends ILCObject implements SimCalorimeterHit
{
@@ -68,7 +68,15 @@
{
return pdg[i];
}
-
+
+ public double[] getPositionCont(int i){
+ return null; //FIXME:
+ }
+ public float[] getMomentumCont(int i){
+ return null; //FIXME:
+ }
+
+
public MCParticle getParticleCont(int i)
{
return (MCParticle) particle[i];
CVSspam 0.2.8