Skip to content
Snippets Groups Projects
Commit ecc6293a authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

checkreq fix (LArSimEvent-01-04-04)

parent a8d4103b
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/* author : Johann Collot */
/* date of creation : 07/01/2001 */
/* date of last modification : 13/09/2002 CLID removed */
// 03-Dec-2003 Bill Seligman: Substantially revised. This class no
// longer inherits from any base class.
// 09-Dec-2006 RD Schaffer: moved energy to double for accumulation
// precision - float in persistent version
#ifndef LArSimEvent_LArHit_h
#define LArSimEvent_LArHit_h
#include "Identifier/Identifier.h"
#include "CLHEP/Units/SystemOfUnits.h"
class LArHit
/** @brief Class to store hit energy and time in LAr cell from G4 simulation */
{
public:
/** LArHit Constructor.
@param[in] l_cell Identifier of the cell in which the hit occured.
@param[in] l_energy Energy (in MeV) deposited in the cell.
@param[in] l_time Time (in ns) of the hit. <br>
energy and time should be double in transient memory to have proper rounding accuracy in accumulating sum(E) and sum(E.t) from G4 steps
*/
LArHit(Identifier l_cell, double l_energy, double l_time);
/** Default constructor for persistency.
Should never be used
*/
LArHit();
/** Destructor. */
~LArHit();
/** @return cell identifier of this hit */
Identifier cellID() const;
/** @return energy in MeV of this hit */
double energy() const;
/** @return time in ns of this hit <br>
Time is defined as the g4 time minus the time of flight at speed of light from the center of Atlas
*/
double time() const;
/** Operator Less than this for hit ordering */
bool Less(LArHit* const& h) const;
/** Operator Equals this */
bool Equals(LArHit* const& h) const;
/** Add another hit ot this hit
@param[in] h hit to add */
void Add(LArHit* const& h);
/** The method to be called at the end of event by SD.
Finalize time computation time = Sum(E.t)/Sum(E) */
void finalize();
private:
/** identifier of the cell in which this hit occured. */
Identifier m_ID;
/** energy (in MeV) deposited in this hit */
double m_energy;
/** time (in ns) */
double m_time;
};
/// inlines
inline
LArHit::LArHit(Identifier l_cell, double l_energy, double l_time)
:
m_ID(l_cell),
m_energy(l_energy),
m_time( (l_time*l_energy) )
{}
inline
LArHit::LArHit()
:
m_ID(Identifier()),
m_energy(0.),
m_time(0.)
{}
inline
LArHit::~LArHit()
{ }
inline
Identifier
LArHit::cellID() const
{ return m_ID; }
inline
double
LArHit::energy() const
{ return (double) m_energy; }
inline
double
LArHit::time() const
{ return m_time; }
inline
bool
LArHit::Less(LArHit* const& h) const
{ return m_ID < h->m_ID; }
inline
bool
LArHit::Equals(LArHit* const& h) const
{ return m_ID == h->m_ID; }
inline
void
LArHit::Add(LArHit* const& h)
{
m_energy += h->m_energy;
m_time += h->m_time;
}
// The method to be called at the end of event by SD
// For backwards compatibility
inline
void
LArHit::finalize()
{
m_time = m_energy==0 ? 0. : (double)(m_time/m_energy)/CLHEP::ns;
m_energy = m_energy/CLHEP::MeV;
}
#endif // LArSimEvent_LArHit_h
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// LArHitContainer
// This class exists to provides two features that an
// AthenaHitsVector<LArHit> does not provide on its own:
// - a CLID for StoreGate
// - a std::string method that can be used to examine the contents of
// the container.
#ifndef LArSimEvent_LArHitContainer_h
#define LArSimEvent_LArHitContainer_h
#include "HitManagement/AthenaHitsVector.h"
#include "LArSimEvent/LArHit.h"
#include "CLIDSvc/CLASS_DEF.h"
class LArHitContainer:public AthenaHitsVector<LArHit>
/** @brief Hit collection */
{
public:
LArHitContainer (std::string collectionName="DefaultCollectionName" );
virtual ~LArHitContainer() ;
/**
* Returns a string containing the description of this <br>
* LArHitContainer with a dump of all the hits
* that it contains<br>
* <p>
*
* Can be used in printouts <br>
*/
virtual operator std::string () const ;
};
CLASS_DEF (LArHitContainer, 2701 , 1 )
class StoredLArHitContainers
/** @brief store pointers to the different hit collections */
{
public:
StoredLArHitContainers():
embHitCollection(0),
emecHitCollection(0),
fcalHitCollection(0),
hecHitCollection(0),
miniFcalHitCollection(0)
{}
/** pointer to EM barrel hit collection */
LArHitContainer* embHitCollection;
/** pointer to EMEC hit collection */
LArHitContainer* emecHitCollection;
/** pointer to FCAL hit collection */
LArHitContainer* fcalHitCollection;
/** pointer to HEC hit collection */
LArHitContainer* hecHitCollection;
/** pointer to Mini FCAL hit collection */
LArHitContainer* miniFcalHitCollection;
};
CLASS_DEF( StoredLArHitContainers , 1265102271 , 1 )
#endif // LArSimEvent_LArHitContainer_h
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// 12-march-2006 G.Unal: alternative LArHit object with float energy and time
// to be used in digitization /pileup to optimize memory usage
#ifndef LArSimEvent_LArHitFloat_h
#define LArSimEvent_LArHitFloat_h
#include "Identifier/Identifier.h"
#include "CLHEP/Units/SystemOfUnits.h"
class LArHitFloat
/** @brief Class to store hit energy and time in LAr cell from G4 simulation */
{
public:
/** LArHitFloat Constructor.
@param[in] l_cell Identifier of the cell in which the hit occured.
@param[in] l_energy Energy (in MeV) deposited in the cell.
@param[in] l_time Time (in ns) of the hit. <br>
energy and time should be double in transient memory to have proper rounding accuracy in accumulating sum(E) and sum(E.t) from G4 steps
*/
LArHitFloat(Identifier l_cell, float l_energy, float l_time);
/** Default constructor for persistency.
Should never be used
*/
LArHitFloat();
/** Destructor. */
~LArHitFloat();
/** @return cell identifier of this hit */
Identifier cellID() const;
/** @return energy in MeV of this hit */
float energy() const;
/** @return time in ns of this hit <br>
Time is defined as the g4 time minus the time of flight at speed of light from the center of Atlas
*/
float time() const;
private:
/** identifier of the cell in which this hit occured. */
Identifier m_ID;
/** energy (in MeV) deposited in this hit */
float m_energy;
/** time (in ns) */
float m_time;
};
/// inlines
inline
LArHitFloat::LArHitFloat(Identifier l_cell, float l_energy, float l_time)
:
m_ID(l_cell),
m_energy(l_energy),
m_time(l_time )
{}
inline
LArHitFloat::LArHitFloat()
:
m_ID(Identifier()),
m_energy(0.),
m_time(0.)
{}
inline
LArHitFloat::~LArHitFloat()
{ }
inline
Identifier
LArHitFloat::cellID() const
{ return m_ID; }
inline
float
LArHitFloat::energy() const
{ return m_energy; }
inline
float
LArHitFloat::time() const
{ return m_time; }
#endif // LArSimEvent_LArHitFloat_h
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef LArSimEvent_LArHitFloatContainer_h
#define LArSimEvent_LArHitFloatContainer_h
#include "LArSimEvent/LArHitFloat.h"
#include "CLIDSvc/CLASS_DEF.h"
#include <vector>
/**
@class LArHitFloatContainer
@brief Container for LArHitFloat
*/
class LArHitFloatContainer: public std::vector<LArHitFloat>
{
public:
/** constructor */
LArHitFloatContainer() {};
/** desctructor */
virtual ~LArHitFloatContainer() {};
inline void add (const LArHitFloat& hit)
{this->push_back(hit);}
};
CLASS_DEF(LArHitFloatContainer,1247689295,0)
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef LARSIMEVENT_LARSIMEVENT_H
#define LARSIMEVENT_LARSIMEVENT_H
#include "LArSimEvent/LArHit.h"
#include "LArSimEvent/LArHitContainer.h"
#include "StoreGate/StoreGateSvc.h"
namespace LArSimEvent
{
struct tmp
{
PyGate<LArHitContainer> m_ip;
LArHitContainer::const_iterator m_it_ip;
};
}
#endif
<lcgdict>
<class name="PyGate<LArHitContainer>" />
<class pattern="*iterator<LArHit*>" />
<class name="LArHit" />
<class name="std::vector<LArHit*>" />
<class name="AthenaHitsVector<LArHit>" />
<class name="LArHitContainer" id="32703AED-CAA5-45ED-B804-8556900CA6B5" />
</lcgdict>
package LArSimEvent
# Liquid Argon Hit classes
author Johann Collot <collot@in2p3.fr>
use AtlasPolicy AtlasPolicy-*
use CLIDSvc CLIDSvc-* Control
use AtlasCLHEP AtlasCLHEP-* External
use Identifier Identifier-* DetectorDescription
use HitManagement HitManagement-* Simulation
private
use StoreGate StoreGate-* Control
end_private
library LArSimEvent *.cxx
apply_pattern installed_library
# generate dictionary
private
use AtlasReflex AtlasReflex-* External -no_auto_imports
apply_pattern lcgdict dict=LArSimEvent selectionfile=selection.xml headerfiles=" ../LArSimEvent/LArSimEventDict.h"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage LArSimEvent Package
This package provides the simulation data model for LAr Calorimeter.
@author Bill Seligman
@author many many others
@section LArSimEventHit Hit related classes
LArHit describes the output of the G4 simulation. Each LArHit contains the energy deposit in the visible calorimeter per cell. All LArHits are saved in a LArHitsContainer.
@section LArSimEventOther Other Simulation Data Model classes
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "LArSimEvent/LArHitContainer.h"
#include <typeinfo>
#include <stdio.h>
#include <iostream>
LArHitContainer::LArHitContainer(std::string collectionName)
: AthenaHitsVector<LArHit>(collectionName)
{
}
LArHitContainer::~LArHitContainer()
{
}
LArHitContainer::operator std::string () const {
char * stCounter = new char[48] ;
char * nameOfContainer = new char[48] ;
const char * stname = typeid( *this ).name() ;
int lname ;
sscanf( stname , "%d%s" , &lname , nameOfContainer ) ;
std::string newline( "\n" ) ;
std::string hitContainerString = nameOfContainer ;
hitContainerString += ": content " ;
hitContainerString += newline ;
LArHitContainer::const_iterator it ;
int counter = 0 ;
LArHit * hit ;
for(it = this->begin() ; it != this->end() ; it++ ){ // Loop over Hits
hit = *it ;
sprintf( stCounter , "%d" , counter ) ;
hitContainerString += "LArHit[" ;
hitContainerString += stCounter ;
hitContainerString += "] " ;
sprintf( stCounter , " ID = %x ; " ,hit->cellID().get_identifier32().get_compact() ) ;
hitContainerString += stCounter ;
sprintf( stCounter , " E= %f MeV ; " , hit->energy() ) ;
hitContainerString += stCounter ;
sprintf( stCounter , " t= %f ns ; " , hit->time() ) ;
hitContainerString += stCounter ;
// hitContainerString += (std::string) (*hit) ;
hitContainerString += newline ;
counter ++ ;
}
sprintf( stCounter , "%d" , counter ) ;
hitContainerString += newline ;
hitContainerString += "Number of Hits in this container : " ;
hitContainerString += stCounter ;
delete[] stCounter ;
delete[] nameOfContainer ;
return hitContainerString ;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "LArSimEvent/LArHitFloatContainer.h"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment