Skip to content

Commit

Permalink
Merge pull request HEP-FCC#1 from zaborowska/master
Browse files Browse the repository at this point in the history
Thanks Anna!
  • Loading branch information
cbernet committed Jan 13, 2016
2 parents 6d50de8 + 49632e3 commit 1594632
Show file tree
Hide file tree
Showing 12 changed files with 257 additions and 257 deletions.
4 changes: 2 additions & 2 deletions datamodel/datamodel/GenVertex.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef GenVertex_H
#define GenVertex_H

// Not sure how it's defined.
// Time coordinate in cm
// author: C. Bernet, B. Hegner

#include "datamodel/Point.h"
Expand All @@ -10,7 +10,7 @@
class GenVertex {
public:
Point Position; //Vertex position in cm
float Ctau; //Not sure how it's defined.
float Ctau; //Time coordinate in cm

};

Expand Down
2 changes: 1 addition & 1 deletion datamodel/datamodel/GenVertexHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <vector>

// Not sure how it's defined.
// Time coordinate in cm
// author: C. Bernet, B. Hegner

//forward declaration of GenVertex container
Expand Down
24 changes: 12 additions & 12 deletions datamodel/datamodel/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@
#pragma link C++ class std::vector<TrackCluster>+;
#pragma link C++ class TrackClusterHandle+;
#pragma link C++ class TrackClusterCollection+;
#pragma link C++ class ParticleMCAssociation+;
#pragma link C++ class std::vector<ParticleMCAssociation>+;
#pragma link C++ class ParticleMCAssociationHandle+;
#pragma link C++ class ParticleMCAssociationCollection+;
#pragma link C++ class JetParticleAssociation+;
#pragma link C++ class std::vector<JetParticleAssociation>+;
#pragma link C++ class JetParticleAssociationHandle+;
#pragma link C++ class JetParticleAssociationCollection+;
#pragma link C++ class Jet+;
#pragma link C++ class std::vector<Jet>+;
#pragma link C++ class JetHandle+;
#pragma link C++ class JetCollection+;
#pragma link C++ class MissingEnergy+;
#pragma link C++ class std::vector<MissingEnergy>+;
#pragma link C++ class MissingEnergyHandle+;
Expand Down Expand Up @@ -72,6 +68,10 @@
#pragma link C++ class std::vector<TrackClusterHitsAssociation>+;
#pragma link C++ class TrackClusterHitsAssociationHandle+;
#pragma link C++ class TrackClusterHitsAssociationCollection+;
#pragma link C++ class ParticleMCParticleAssociation+;
#pragma link C++ class std::vector<ParticleMCParticleAssociation>+;
#pragma link C++ class ParticleMCParticleAssociationHandle+;
#pragma link C++ class ParticleMCParticleAssociationCollection+;
#pragma link C++ class VertexTrackAssociation+;
#pragma link C++ class std::vector<VertexTrackAssociation>+;
#pragma link C++ class VertexTrackAssociationHandle+;
Expand All @@ -88,10 +88,10 @@
#pragma link C++ class std::vector<GenJetParticleAssociation>+;
#pragma link C++ class GenJetParticleAssociationHandle+;
#pragma link C++ class GenJetParticleAssociationCollection+;
#pragma link C++ class Jet+;
#pragma link C++ class std::vector<Jet>+;
#pragma link C++ class JetHandle+;
#pragma link C++ class JetCollection+;
#pragma link C++ class JetParticleAssociation+;
#pragma link C++ class std::vector<JetParticleAssociation>+;
#pragma link C++ class JetParticleAssociationHandle+;
#pragma link C++ class JetParticleAssociationCollection+;
#pragma link C++ class MET+;
#pragma link C++ class std::vector<MET>+;
#pragma link C++ class METHandle+;
Expand Down
105 changes: 0 additions & 105 deletions datamodel/datamodel/ParticleMCAssociationCollection.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef ParticleMCAssociation_H
#define ParticleMCAssociation_H
#ifndef ParticleMCParticleAssociation_H
#define ParticleMCParticleAssociation_H

// Reference to the Monte-Carlo particle
// author: C. Bernet, B. Hegner
Expand All @@ -8,7 +8,7 @@
#include "datamodel/MCParticleHandle.h"


class ParticleMCAssociation {
class ParticleMCParticleAssociation {
public:
ParticleHandle Rec; //Reference to the reconstructed particle
MCParticleHandle Sim; //Reference to the Monte-Carlo particle
Expand Down
105 changes: 105 additions & 0 deletions datamodel/datamodel/ParticleMCParticleAssociationCollection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//AUTOMATICALLY GENERATED - DO NOT EDIT

#ifndef ParticleMCParticleAssociationCollection_H
#define ParticleMCParticleAssociationCollection_H

#include <string>
#include <vector>
#include <deque>

// albers specific includes
#include "albers/Registry.h"
#include "albers/CollectionBase.h"

// datamodel specific includes
#include "datamodel/ParticleMCParticleAssociation.h"
#include "datamodel/ParticleMCParticleAssociationHandle.h"

typedef std::vector<ParticleMCParticleAssociation> ParticleMCParticleAssociationVector;
typedef std::vector<ParticleMCParticleAssociationHandle> ParticleMCParticleAssociationHandleContainer;

class ParticleMCParticleAssociationCollectionIterator {

public:
ParticleMCParticleAssociationCollectionIterator(int index, const ParticleMCParticleAssociationCollection* collection) : m_index(index), m_collection(collection) {}

bool operator!=(const ParticleMCParticleAssociationCollectionIterator& x) const {
return m_index != x.m_index; //TODO: may not be complete
}

const ParticleMCParticleAssociationHandle operator*() const;

const ParticleMCParticleAssociationCollectionIterator& operator++() const {
++m_index;
return *this;
}

private:
mutable int m_index;
const ParticleMCParticleAssociationCollection* m_collection;
};

/**
A Collection is identified by an ID.
*/

class ParticleMCParticleAssociationCollection : public albers::CollectionBase {

public:
typedef const ParticleMCParticleAssociationCollectionIterator const_iterator;

ParticleMCParticleAssociationCollection();
// ParticleMCParticleAssociationCollection(ParticleMCParticleAssociationVector* data, int collectionID);
~ParticleMCParticleAssociationCollection(){};

void clear();

/// Append a new object to the collection, and return a Handle to this object.
ParticleMCParticleAssociationHandle create();

/// Insert an existing handle into the collection.
/// In this operation, the data pointed by the handle is copied.
ParticleMCParticleAssociationHandle insert(const ParticleMCParticleAssociationHandle& origin);

/// Returns a Handle to the object at position index in the collection
const ParticleMCParticleAssociationHandle& get(int index) const;

/// Currently does nothing
void prepareForWrite(const albers::Registry* registry);
void prepareAfterRead(albers::Registry* registry);
void setPODsAddress(const void* address);

void setID(unsigned ID){m_collectionID = ID;};

// support for the iterator protocol
const const_iterator begin() const {
return const_iterator(0, this);
}
const const_iterator end() const {
return const_iterator(m_handles.size(), this);
}

// std::vector<std::pair<std::string,albers::CollectionBase*>>& referenceCollections();

/// returns the address of the pointer to the data buffer
void* _getRawBuffer() { return (void*)&m_data;};

/// returns the pointer to the data buffer
std::vector<ParticleMCParticleAssociation>* _getBuffer() { return m_data;};

/// returns the collection of Handles
const ParticleMCParticleAssociationHandleContainer& getHandles() { return m_handles; }

/// print some information
void print() const;


private:
unsigned m_collectionID;
ParticleMCParticleAssociationVector* m_data;
ParticleMCParticleAssociationHandleContainer m_handles;
// members to handle 1-to-N-relations

};

#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef ParticleMCAssociationHANDLE_H
#define ParticleMCAssociationHANDLE_H
#include "datamodel/ParticleMCAssociation.h"
#ifndef ParticleMCParticleAssociationHANDLE_H
#define ParticleMCParticleAssociationHANDLE_H
#include "datamodel/ParticleMCParticleAssociation.h"
#include "datamodel/ParticleHandle.h"
#include "datamodel/MCParticleHandle.h"

Expand All @@ -9,45 +9,45 @@
// Reference to the Monte-Carlo particle
// author: C. Bernet, B. Hegner

//forward declaration of ParticleMCAssociation container
class ParticleMCAssociationCollection;
//forward declaration of ParticleMCParticleAssociation container
class ParticleMCParticleAssociationCollection;

namespace albers {
class Registry;
}

class ParticleMCAssociationHandle {
class ParticleMCParticleAssociationHandle {

friend class ParticleMCAssociationCollection;
friend class ParticleMCParticleAssociationCollection;

public:

ParticleMCAssociationHandle() :
ParticleMCParticleAssociationHandle() :
m_index(-1),
m_containerID(0),
m_container(0),
m_registry(0)
{}

ParticleMCAssociationHandle(const ParticleMCAssociationHandle& other) :
ParticleMCParticleAssociationHandle(const ParticleMCParticleAssociationHandle& other) :
m_index(other.m_index),
m_containerID(other.m_containerID),
m_container(other.m_container),
m_registry(other.m_registry)
{}

//TODO: Proper syntax to use, but ROOT doesn't handle it: ParticleMCAssociationHandle() = default;
//TODO: Proper syntax to use, but ROOT doesn't handle it: ParticleMCParticleAssociationHandle() = default;



// precheck whether the pointee actually exists
bool isAvailable() const;

// returns a const (read-only) reference to the object pointed by the Handle.
const ParticleMCAssociation& read() const {return m_container->at(m_index);}
const ParticleMCParticleAssociation& read() const {return m_container->at(m_index);}

// returns a non-const (writeable) reference to the object pointed by the Handle
ParticleMCAssociation& mod() {return m_container->at(m_index);}
ParticleMCParticleAssociation& mod() {return m_container->at(m_index);}

void prepareForWrite(const albers::Registry*); // use m_container to set m_containerID properly

Expand All @@ -58,19 +58,19 @@ class ParticleMCAssociationHandle {
int containerID() const {return m_containerID;}

/// equality operator (true if both the index and the container ID are equal)
bool operator==(const ParticleMCAssociationHandle& other) const {
bool operator==(const ParticleMCParticleAssociationHandle& other) const {
return (m_index==other.m_index) && (other.m_containerID==other.m_containerID);
}

/// less comparison operator, so that Handles can be e.g. stored in sets.
friend bool operator< (const ParticleMCAssociationHandle& p1,
const ParticleMCAssociationHandle& p2 );
friend bool operator< (const ParticleMCParticleAssociationHandle& p1,
const ParticleMCParticleAssociationHandle& p2 );

private:
ParticleMCAssociationHandle(int index, unsigned containerID, std::vector<ParticleMCAssociation>* container);
ParticleMCParticleAssociationHandle(int index, unsigned containerID, std::vector<ParticleMCParticleAssociation>* container);
int m_index;
unsigned m_containerID;
mutable std::vector<ParticleMCAssociation>* m_container; //! transient
mutable std::vector<ParticleMCParticleAssociation>* m_container; //! transient
albers::Registry* m_registry; //! transient
// bool _retrieveData();
// members to support 1-to-N relations
Expand Down
Loading

0 comments on commit 1594632

Please sign in to comment.