]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
several bugfixes in order to get the HLTGlobalTrigger decision safely into the ESD
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Jul 2009 11:58:50 +0000 (11:58 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Jul 2009 11:58:50 +0000 (11:58 +0000)
- 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

HLT/BASE/AliHLTGlobalTriggerDecision.cxx
HLT/BASE/AliHLTGlobalTriggerDecision.h
HLT/rec/AliHLTEsdManagerImplementation.cxx
HLT/trigger/AliHLTTriggerAgent.cxx

index 433d12628b275b5f80e398bf27dfce76dcd98c02..5215a94ce89967e432d514ca888ec22a27c4c497 100644 (file)
@@ -29,7 +29,7 @@ ClassImp(AliHLTGlobalTriggerDecision)
 
 
 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision() :
-  AliHLTTriggerDecision(),
+AliHLTTriggerDecision(0, "HLTGlobalTrigger"),
   fContributingTriggers(AliHLTTriggerDecision::Class()),
   fInputObjects(),
   fCounters()
@@ -142,7 +142,6 @@ void AliHLTGlobalTriggerDecision::Copy(TObject &object) const
     // copy members if target is a AliHLTGlobalTriggerDecision
     *pDecision=*this;
   }
-
   // copy the base class
   AliHLTTriggerDecision::Copy(object);
 }
@@ -153,3 +152,46 @@ TObject *AliHLTGlobalTriggerDecision::Clone(const char */*newname*/) const
 
   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;
+}
index 97ecbc88eeace44601781779b9a15437ce372e2c..58eb98690e58c6db0eb8d28c533164ff305579e6 100644 (file)
@@ -39,7 +39,17 @@ class AliHLTGlobalTriggerDecision : public AliHLTTriggerDecision
    * 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"
index a66ed4b9285a589dacd10830b3ff9883c089fad8..ee2c7fb4098a4bc7a636b270e41124ccc5a9dbb7 100644 (file)
@@ -646,20 +646,18 @@ int AliHLTEsdManagerImplementation::Merge(AliESDEvent* pTgt, AliESDEvent* pSrc)
 
   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
@@ -667,7 +665,7 @@ int AliHLTEsdManagerImplementation::Merge(AliESDEvent* pTgt, AliESDEvent* pSrc)
     } 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")){
index c9f9102969a5e6a62d3b45067264ebda6b322ead..4a168f96596577af26508425c4c1963570c5a600 100644 (file)
@@ -238,9 +238,10 @@ int AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::ProcessData(AliHLTOUT* pDa
   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;
@@ -248,7 +249,14 @@ int AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::ProcessData(AliHLTOUT* pDa
        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()) {