1#ifndef CgemMcHitCnv_CXX
2#define CgemMcHitCnv_CXX 1
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
8#include "TClonesArray.h"
29 MsgStream log(
msgSvc(),
"CgemMcHitCnv");
41 MsgStream log(
msgSvc(),
"CgemMcHitCnv");
42 log << MSG::DEBUG <<
"CgemMcHitCnv::TObjectToDataObject" << endreq;
43 StatusCode sc=StatusCode::SUCCESS;
47 refpObject=cgemMcTdsCol;
51 if (!m_cgemMcHitCol)
return sc;
52 TIter cgemMcIter(m_cgemMcHitCol);
54 while ((cgemMcRoot = (
TCgemMc*)cgemMcIter.Next()))
56 unsigned int ID_track = cgemMcRoot->
GetTrackID ();
57 unsigned int ID_layer = cgemMcRoot->
GetLayerID ();
59 unsigned int pdg_code = cgemMcRoot->
GetPDGCode ();
60 unsigned int ID_parent = cgemMcRoot->
GetParentID ();
113 for(
int j = 0; j < ID_Identifier.GetSize(); j++){
114 tmp[j] = ID_Identifier.GetAt(j);
124 cgemMcTdsCol->push_back(cgemMcTds);
127 delete m_cgemMcHitCol;
129 return StatusCode::SUCCESS;
135 MsgStream log(
msgSvc(),
"CgemMcHitCnv");
136 log << MSG::DEBUG <<
"CgemMcHitCnv::DataObjectToTObject" << endreq;
137 StatusCode sc=StatusCode::SUCCESS;
140 if (!cgemMcHitCnvTds) {
141 log << MSG::ERROR <<
"Could not downcast to CgemMcHitCol" << endreq;
142 return StatusCode::FAILURE;
148 log << MSG::ERROR <<
"Could not get McEvent in TDS " << endreq;
149 return StatusCode::FAILURE;
153 log << MSG::ERROR <<
"CgemMcHitCnv:Could not downcast to TDS McEvent" << endreq;
155 IOpaqueAddress *addr;
161 if (!m_cgemMcHitCol)
return sc;
163 CgemMcHitCol::const_iterator cgemMcTds;
165 for (cgemMcTds = cgemMcHitCnvTds->begin(); cgemMcTds != cgemMcHitCnvTds->end(); cgemMcTds++)
167 unsigned int ID_track = (*cgemMcTds)->GetTrackID ();
168 unsigned int ID_layer = (*cgemMcTds)->GetLayerID ();
170 unsigned int pdg_code = (*cgemMcTds)->GetPDGCode ();
171 unsigned int ID_parent = (*cgemMcTds)->GetParentID ();
173 double E_deposit = (*cgemMcTds)->GetTotalEnergyDeposit ();
174 double XYZ_pre_x = (*cgemMcTds)->GetPositionXOfPrePoint ();
175 double XYZ_pre_y = (*cgemMcTds)->GetPositionYOfPrePoint ();
176 double XYZ_pre_z = (*cgemMcTds)->GetPositionZOfPrePoint ();
177 double XYZ_post_x = (*cgemMcTds)->GetPositionXOfPostPoint ();
178 double XYZ_post_y = (*cgemMcTds)->GetPositionYOfPostPoint ();
179 double XYZ_post_z = (*cgemMcTds)->GetPositionZOfPostPoint ();
180 double P_pre_x = (*cgemMcTds)->GetMomentumXOfPrePoint ();
181 double P_pre_y = (*cgemMcTds)->GetMomentumYOfPrePoint ();
182 double P_pre_z = (*cgemMcTds)->GetMomentumZOfPrePoint ();
183 double P_post_x = (*cgemMcTds)->GetMomentumXOfPostPoint ();
184 double P_post_y = (*cgemMcTds)->GetMomentumYOfPostPoint ();
185 double P_post_z = (*cgemMcTds)->GetMomentumZOfPostPoint ();
187 TArrayI ID_Identifier = (*cgemMcTds)->GetIdentifier ();
189 string creatorProcess = (*cgemMcTds)->GetCreatorProcess();
190 unsigned int isSecondary= (*cgemMcTds)->GetIsSecondary();
191 double trkLen_pre = (*cgemMcTds)->GetFlightLengthPrePoint();
192 double trkLen_post= (*cgemMcTds)->GetFlightLengthPostPoint();
193 const vector<int>& DigiIdxVec = (*cgemMcTds)->GetDigiIdxVec();
194 const vector<int>& XclusterIdxVec= (*cgemMcTds)->GetXclusterIdxVec();
195 const vector<int>& VclusterIdxVec= (*cgemMcTds)->GetVclusterIdxVec();
221 for(
int j = 0; j < ID_Identifier.GetSize(); j++){
222 tmp[j] = ID_Identifier.GetAt(j);
236 return StatusCode::SUCCESS;
CgemMcHitCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void SetMomentumXOfPostPoint(double f_P_post_x)
void SetMomentumZOfPostPoint(double f_P_post_z)
void AddIdentifier(Int_t f_ID_Identifier[2000], Int_t N_dim)
void SetFlightLengthPrePoint(double f_len)
void SetPositionXOfPrePoint(double f_XYZ_pre_x)
void SetPositionZOfPrePoint(double f_XYZ_pre_z)
void SetXclusterIdxVec(const vector< int > &vec)
void SetIsSecondary(int isSec)
void SetDigiIdxVec(const vector< int > &vec)
void SetMomentumYOfPostPoint(double f_P_post_y)
void SetFlightLengthPostPoint(double f_len)
void SetMomentumZOfPrePoint(double f_P_pre_z)
void SetParentID(int f_ID_parent)
void SetTrackID(int f_ID_track)
void SetMomentumXOfPrePoint(double f_P_pre_x)
void SetPositionXOfPostPoint(double f_XYZ_post_x)
void SetPositionYOfPrePoint(double f_XYZ_pre_y)
void SetVclusterIdxVec(const vector< int > &vec)
void SetCreatorProcess(string creatorProcess)
void SetTotalEnergyDeposit(double f_E_deposit)
void SetPositionYOfPostPoint(double f_XYZ_post_y)
void SetLayerID(int f_ID_layer)
void SetPositionZOfPostPoint(double f_XYZ_post_z)
void SetMomentumYOfPrePoint(double f_P_pre_y)
static TMcEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition of a Root address, derived from IOpaqueAddress.
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
IDataProviderSvc * m_eds
pointer to eventdataservice
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void SetIsSecondary(UInt_t isSec)
Double_t GetPositionXOfPrePoint() const
Double_t GetMomentumYOfPostPoint() const
void AddIdentifier(Int_t f_ID_Identifier[2000], Int_t N_dim)
void SetMomentumZOfPrePoint(Double_t f_P_pre_z)
Double_t GetMomentumYOfPrePoint() const
Double_t GetPositionYOfPrePoint() const
UInt_t GetPDGCode() const
Double_t GetPositionZOfPostPoint() const
void SetMomentumYOfPostPoint(Double_t f_P_post_y)
void SetPositionZOfPostPoint(Double_t f_XYZ_post_z)
Double_t GetPositionZOfPrePoint() const
Double_t GetFlightLengthPrePoint() const
void SetMomentumXOfPrePoint(Double_t f_P_pre_x)
void SetCreatorProcess(std::string creatorProcess)
void SetVclusterIdxVec(const std::vector< int > &vec)
void SetParentID(UInt_t f_ID_parent)
void SetPositionXOfPrePoint(Double_t f_XYZ_pre_x)
Double_t GetMomentumZOfPostPoint() const
void SetTrackID(UInt_t f_ID_track)
UInt_t GetTrackID() const
void SetPositionZOfPrePoint(Double_t f_XYZ_pre_z)
void SetMomentumYOfPrePoint(Double_t f_P_pre_y)
void SetLayerID(UInt_t f_ID_layer)
const std::vector< int > & GetXclusterIdxVec() const
UInt_t GetIsSecondary() const
void SetPDGCode(UInt_t f_pdg_code)
void SetPositionYOfPrePoint(Double_t f_XYZ_pre_y)
Double_t GetMomentumXOfPostPoint() const
UInt_t GetLayerID() const
const std::vector< int > & GetDigiIdxVec() const
Double_t GetMomentumZOfPrePoint() const
Double_t GetPositionYOfPostPoint() const
void SetPositionYOfPostPoint(Double_t f_XYZ_post_y)
Double_t GetPositionXOfPostPoint() const
Double_t GetTotalEnergyDeposit() const
void SetPositionXOfPostPoint(Double_t f_XYZ_post_x)
UInt_t GetParentID() const
Double_t GetFlightLengthPostPoint() const
void SetMomentumXOfPostPoint(Double_t f_P_post_x)
void SetXclusterIdxVec(const std::vector< int > &vec)
void SetMomentumZOfPostPoint(Double_t f_P_post_z)
void SetFlightLengthPrePoint(Double_t f_len)
void SetDigiIdxVec(const std::vector< int > &vec)
Double_t GetMomentumXOfPrePoint() const
TArrayI GetIdentifier() const
void SetFlightLengthPostPoint(Double_t f_len)
const std::vector< int > & GetVclusterIdxVec() const
void SetTotalEnergyDeposit(Double_t f_E_deposit)
TString GetCreatorProcess() const
const TObjArray * getCgemMcHitCol() const
void addCgemMc(TCgemMc *mcHit)
Cgem.
static std::map< const TObject *, const CgemMcHit * > m_rootCgemMcHitMap
_EXTERN_ std::string Event
ObjectVector< CgemMcHit > CgemMcHitCol