- implementing copy constructor and assignment operator for class AliHLTGlobalTriggerDecision
Even though the TClonesArray of participating trigger decisions is a member and not a
pointer, this is not correctly handled
- Setting the trigger name of the HLTGlobalTrigger correctly from the default constructor.
This makes sure the name is kept even though the AliESDEvent class uses placement new
to reset the individual objects.
- ESDManager: correctly find the target object in the target ESD to copy over the data
- ESDManager: propagation of ESD is now enabled again
- AliHLTTriggerAgent: the trigger object has been added for every event instead of copying
the content to the existig none
AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision() :
- AliHLTTriggerDecision(),
+AliHLTTriggerDecision(0, "HLTGlobalTrigger"),
fContributingTriggers(AliHLTTriggerDecision::Class()),
fInputObjects(),
fCounters()
// copy members if target is a AliHLTGlobalTriggerDecision
*pDecision=*this;
}
-
// copy the base class
AliHLTTriggerDecision::Copy(object);
}
return new AliHLTGlobalTriggerDecision(*this);
}
+
+AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(const AliHLTGlobalTriggerDecision& src) :
+ AliHLTTriggerDecision(src),
+ fContributingTriggers(AliHLTTriggerDecision::Class()),
+ fInputObjects(),
+ fCounters()
+{
+ // copy constructor
+ *this=src;
+}
+
+AliHLTGlobalTriggerDecision& AliHLTGlobalTriggerDecision::operator=(const AliHLTGlobalTriggerDecision& src)
+{
+ // assignment operator
+
+ fContributingTriggers.Delete();
+ for (int triggerInput=0; triggerInput<src.NumberOfTriggerInputs(); triggerInput++) {
+ const AliHLTTriggerDecision* pTriggerObject=src.TriggerInput(triggerInput);
+ if (pTriggerObject) {
+ // the AddTriggerInput function uses the copy constructor and
+ // makes a new object from the reference
+ AddTriggerInput(*pTriggerObject);
+ } else {
+ //Error("failed to get trigger input #%d", triggerInput);
+ }
+ }
+
+ fInputObjects.Delete();
+ for (int inputObject=0; inputObject<src.NumberOfTriggerInputs(); inputObject++) {
+ const TObject* pInputObject=src.InputObject(inputObject);
+ if (pInputObject) {
+ // the AddInputObject function uses Clone() and
+ // makes a new object from the reference
+ AddInputObject(pInputObject);
+ } else {
+ //Error("failed to get trigger input #%d", inputObject);
+ }
+ }
+
+ SetCounters(src.Counters());
+
+ return *this;
+}
* Default destructor.
*/
virtual ~AliHLTGlobalTriggerDecision();
-
+
+ /**
+ * Copy constructor
+ */
+ AliHLTGlobalTriggerDecision(const AliHLTGlobalTriggerDecision& src);
+
+ /**
+ * Assignment operator
+ */
+ AliHLTGlobalTriggerDecision& operator=(const AliHLTGlobalTriggerDecision& src);
+
/**
* Inherited from TObject, this prints the contents of the trigger decision.
* \param option Can be "short" which will print the short format or "counters"
TIter next(pSrc->GetList());
TObject* pSrcObject=NULL;
- TString name;
static int warningCount=0;
while ((pSrcObject=next())) {
if(!pSrcObject->InheritsFrom("TCollection")){
// simple objects
+ TString name=pSrcObject->GetName();
if(pSrcObject->InheritsFrom("AliHLTTriggerDecision")){
//pSrcObject->Print();
- // Matthias 2009-07-3: there is a problem with the additional object
- // in the ESD when the tree is filled
- TObject* pTgtObject=pTgt->GetList()->FindObject(name);
+ TObject* pTgtObject=pTgt->FindListObject(name);
if (pTgtObject) {
- //pSrcObject->Copy(*pTgtObject);
+ pSrcObject->Copy(*pTgtObject);
} else {
- //pTgt->AddObject(pSrcObject->Clone());
+ pTgt->AddObject(pSrcObject->Clone());
}
} else {
// TODO: implement the handling of other objects, some kind of mapping
} else if(pSrcObject->InheritsFrom("TClonesArray")){
TClonesArray* pTClA=dynamic_cast<TClonesArray*>(pSrcObject);
if (pTClA!=NULL && pTClA->GetEntriesFast()>0) {
- name=pTClA->GetName();
+ TString name=pTClA->GetName();
TObject* pTgtObject=pTgt->GetList()->FindObject(name);
TClonesArray* pTgtArray=NULL;
if (pTgtObject!=NULL && pTgtObject->InheritsFrom("TClonesArray")){
if (iResult>=0) {
TObject* pObject=pData->GetDataObject();
if (pObject) {
- AliHLTTriggerDecision* pDecission=dynamic_cast<AliHLTTriggerDecision*>(pObject);
- if (pDecission) {
+ AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(pObject);
+ if (pDecision) {
//pDecision->Print();
+ HLTDebug("extracted %s", pDecision->GetName());
if (!fESD) {
// create the ESD container, but without std content
fESD = new AliESDEvent;
if (!fpData) fpData=new TArrayC;
if (fESD && fpData) {
fESD->Reset();
- fESD->AddObject(pObject->Clone());
+ TObject* pESDObject=fESD->FindListObject("HLTGlobalTrigger");
+ if (pESDObject) {
+ // copy the content to the already existing object
+ pObject->Copy(*pESDObject);
+ } else {
+ // add a new object
+ fESD->AddObject(pObject->Clone());
+ }
AliHLTMessage* pMsg=AliHLTMessage::Stream(fESD);
if (pMsg) {
if (!pMsg->CompBuffer()) {