ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterLinkTemplate.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef CALOEVENT_CALOCLUSTERLINKTEMPLATE_H
6#define CALOEVENT_CALOCLUSTERLINKTEMPLATE_H
7
8#include "AthLinks/ElementLink.h"
9
10#include <algorithm>
11#include <iostream>
12//#include <typeinfo>
13
14
18
19template<class CONT,
20 class DOBJ=typename CONT::base_value_type,
21 class ELEM=ElementLink<CONT> >
23{
24 typedef ELEM link_type;
25
26 static bool setLink(CONT* pCont, DOBJ* pDat, ELEM& rElm)
27 {
28 // std::cout << "[LinkHandler] invoked for container type \042"
29 // << std::type_id(pCont).name() << "\042 and data object type \042"
30 // << std::type_id(pDat).name() << std::endl;
31 bool checkOut(pCont != 0);
32 // check input
33 if ( checkOut )
34 {
35 // data object has valid pointer, set only storable
36 if ( pDat != 0 )
37 {
38 pCont->push_back(pDat);
39 checkOut = rElm.setStorableObject(*pCont);
40
41 }
42 // no data object set, create complete EL
43 else
44 {
45 DOBJ* pNewDat = new DOBJ();
46 pCont->push_back(pNewDat);
47 checkOut = rElm.toContainedElement(*pCont,pNewDat);
48 }
49 }
50 return checkOut;
51
52 }
53};
54#endif
template class for CaloClusterLink
static bool setLink(CONT *pCont, DOBJ *pDat, ELEM &rElm)
ElementLink< CaloShowerContainer > link_type