]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/MUON/AliHLTMUONEvent.cxx
Disable retireval of DCS data points from AliShuttle for SDD
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONEvent.cxx
index 106fbb66e31a081e677f252c30d56fa1e7030351..f34695854974ff63b07e46168364c8c042fa94ab 100644 (file)
@@ -14,7 +14,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id: $ */
+// $Id: $
 
 ///
 /// @file   AliHLTMUONEvent.cxx
 /// for a single event together.
 
 #include "AliHLTMUONEvent.h"
+#include "AliHLTMUONRecHit.h"
+#include "AliHLTMUONTriggerRecord.h"
+#include "AliHLTMUONMansoTrack.h"
+#include "AliHLTMUONTrack.h"
 #include "AliHLTMUONDecision.h"
 #include "AliLog.h"
 #include <iostream>
+#include <map>
 
 ClassImp(AliHLTMUONEvent);
 
@@ -40,14 +45,8 @@ AliHLTMUONEvent::AliHLTMUONEvent(const AliHLTMUONEvent& event) :
 {
        /// Copy constructor performs a deep copy of the object.
        
-       fEventId = event.fEventId;
        fArray.SetOwner(kTRUE);
-       TIter next(&event.fArray);
-       TObject* obj = NULL;
-       while ( (obj = next()) != NULL )
-       {
-               fArray.Add(obj->Clone());
-       }
+       DeepCopy(event);
 }
 
 
@@ -56,15 +55,9 @@ AliHLTMUONEvent& AliHLTMUONEvent::operator = (const AliHLTMUONEvent& event)
        /// The assignment operator performs a deep copy of the object.
        
        if (this == &event) return *this;
-       TObject::operator = (event);
-       fEventId = event.fEventId;
        fArray.Clear();
-       TIter next(&event.fArray);
-       TObject* obj = NULL;
-       while ( (obj = next()) != NULL )
-       {
-               fArray.Add(obj->Clone());
-       }
+       TObject::operator = (event);
+       DeepCopy(event);
        return *this;
 }
 
@@ -127,13 +120,136 @@ void AliHLTMUONEvent::Copy(TObject& object) const
        
        TObject::Copy(object);
        AliHLTMUONEvent& event = static_cast<AliHLTMUONEvent&>(object);
-       event.fEventId = fEventId;
-       event.fArray.Clear();
-       TIter next(&fArray);
+       event.DeepCopy(*this);
+}
+
+
+void AliHLTMUONEvent::DeepCopy(const AliHLTMUONEvent& event)
+{
+       /// Performs a deep copy of the event.
+       
+       fEventId = event.fEventId;
+       TObjArray tocopy = event.fArray;
+       std::map<const TObject*, TObject*> objmap;
+       
+       // We need to copy all the objects from the old event while maintaining the
+       // pointer cross references contained in the track and decision objects:
+       // Start by looping over all objects and first copy the trigger records and hits.
+       TIter next(&tocopy);
        TObject* obj = NULL;
        while ( (obj = next()) != NULL )
        {
-               event.fArray.Add(obj->Clone());
+               if (obj->IsA() == AliHLTMUONTriggerRecord::Class() or
+                   obj->IsA() == AliHLTMUONRecHit::Class()
+                  )
+               {
+                       TObject* newobj = obj->Clone();
+                       objmap[obj] = newobj;
+                       fArray.Add(newobj);
+                       tocopy.Remove(obj);
+               }
+       }
+       
+       // Now loop over all objects that still need to be copied and copy the tracks.
+       next.Reset();
+       while ( (obj = next()) != NULL )
+       {
+               if (obj->IsA() == AliHLTMUONMansoTrack::Class())
+               {
+                       AliHLTMUONMansoTrack* track = static_cast<AliHLTMUONMansoTrack*>(obj);
+                       AliHLTMUONMansoTrack* newtrack = new AliHLTMUONMansoTrack(
+                               track->Id(), track->Sign(),
+                               track->Px(), track->Py(), track->Pz(),
+                               track->Chi2(),
+                               static_cast<const AliHLTMUONTriggerRecord*>( objmap[track->TriggerRecord()] ),
+                               static_cast<const AliHLTMUONRecHit*>( objmap[track->Hit(7)] ),
+                               static_cast<const AliHLTMUONRecHit*>( objmap[track->Hit(8)] ),
+                               static_cast<const AliHLTMUONRecHit*>( objmap[track->Hit(9)] ),
+                               static_cast<const AliHLTMUONRecHit*>( objmap[track->Hit(10)] ),
+                               track->Zmiddle(), track->QBL()
+                       );
+                       for (int i = 7; i <= 10; ++i)
+                       {
+                               const TVector3& b = track->RoICentre(i);
+                               newtrack->SetRoI(i, b.X(), b.Y(), b.Z(), track->RoIRadius(i));
+                       }
+                       objmap[obj] = newtrack;
+                       fArray.Add(newtrack);
+                       tocopy.Remove(obj);
+               }
+               else if (obj->IsA() == AliHLTMUONTrack::Class())
+               {
+                       AliHLTMUONTrack* track = static_cast<AliHLTMUONTrack*>(obj);
+                       
+                       const AliHLTMUONRecHit* newhits[16];
+                       for (int i = 0; i < 16; ++i)
+                       {
+                               newhits[i] = static_cast<const AliHLTMUONRecHit*>( objmap[track->Hit(i)] );
+                       }
+                       AliHLTMUONTrack* newtrack = new AliHLTMUONTrack(
+                               track->Id(), track->Sign(),
+                               track->Px(), track->Py(), track->Pz(),
+                               track->InverseBendingMomentum(),
+                               track->ThetaX(), track->ThetaY(),
+                               track->X(), track->Y(), track->Z(),
+                               track->Chi2(),
+                               static_cast<const AliHLTMUONTriggerRecord*>( objmap[track->TriggerRecord()] ),
+                               newhits
+                       );
+                       objmap[obj] = newtrack;
+                       fArray.Add(newtrack);
+                       tocopy.Remove(obj);
+               }
+       }
+       
+       // Finally copy over the decision objects.
+       next.Reset();
+       while ( (obj = next()) != NULL )
+       {
+               if (obj->IsA() == AliHLTMUONDecision::Class())
+               {
+                       AliHLTMUONDecision* dec = static_cast<AliHLTMUONDecision*>(obj);
+                       AliHLTMUONDecision* newdec = new AliHLTMUONDecision(
+                               dec->NumberOfLowPtTriggers(),
+                               dec->NumberOfHighPtTriggers(),
+                               dec->NumberOfUnlikePairs(),
+                               dec->NumberOfUnlikeLowPtPairs(),
+                               dec->NumberOfUnlikeHighPtPairs(),
+                               dec->NumberOfLikePairs(),
+                               dec->NumberOfLikeLowPtPairs(),
+                               dec->NumberOfLikeHighPtPairs(),
+                               dec->NumberOfMassTriggers(),
+                               dec->NumberOfLowMassTriggers(),
+                               dec->NumberOfHighMassTriggers()
+                       );
+                       for (Int_t i = 0; i < dec->NumberOfTracks(); ++i)
+                       {
+                               const AliHLTMUONDecision::AliTrackDecision* d = dec->SingleTrackDecision(i);
+                               newdec->AddDecision(
+                                       d->Pt(), d->PassedLowPtCut(), d->PassedHighPtCut(),
+                                       objmap[d->Track()]
+                               );
+                       }
+                       for (Int_t i = 0; i < dec->NumberOfPairs(); ++i)
+                       {
+                               const AliHLTMUONDecision::AliPairDecision* d = dec->TrackPairDecision(i);
+                               newdec->AddDecision(
+                                       d->Mass(), d->PassedLowMassCut(),
+                                       d->PassedHighMassCut(), d->UnlikeSign(),
+                                       d->NumberPassedLowPtCut(), d->NumberPassedHighPtCut(),
+                                       objmap[d->TrackA()], objmap[d->TrackB()]
+                               );
+                       }
+                       objmap[obj] = newdec;
+                       fArray.Add(newdec);
+                       tocopy.Remove(obj);
+               }
+       }
+       
+       // Copy all the remaining objects that we do not handle in a special way.
+       next.Reset();
+       while ( (obj = next()) != NULL )
+       {
+               fArray.Add(obj->Clone());
        }
 }
-