Bug fix for full tracker, filling in track parameters properly.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Jun 2010 09:28:36 +0000 (09:28 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Jun 2010 09:28:36 +0000 (09:28 +0000)
Also adding option to write ESDs in Rootifier component.
(Indra)

HLT/MUON/OfflineInterface/AliHLTMUONRootifierComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.cxx
HLT/MUON/macros/RunChain.C

index 31a17d5..7155bcf 100644 (file)
@@ -24,6 +24,9 @@
 ///
 /// Implements a component to convert dHLT raw data into TObjects.
 
+#include "AliHLTMessage.h"
+#include "TString.h"
+#include "AliESDEvent.h"
 #include "AliHLTMUONRootifierComponent.h"
 #include "AliHLTMUONEvent.h"
 #include "AliHLTMUONConstants.h"
@@ -207,7 +210,20 @@ int AliHLTMUONRootifierComponent::DoEvent(
                        i, DataType2Text(block->fDataType).c_str(), block->fPtr, block->fSize
                );
                
-               if (block->fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
+               if (block->fDataType == AliHLTMUONConstants::ESDDataType())
+               {
+                       AliHLTMessage *fMessage = new AliHLTMessage( block->fPtr, block->fSize );
+                       // -- Check if TMessage payload is TObject
+                       if ( fMessage->What() == kMESS_OBJECT )
+                       {
+                               TString fClassName = fMessage->GetClass()->GetName();
+                               AliESDEvent* esd = reinterpret_cast<AliESDEvent*>(fMessage->ReadObject( fMessage->GetClass() ));
+                               esd->GetStdContent();
+                               event.Add(esd);
+                       }
+                       fMessage->Reset();
+               }
+               else if (block->fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
                {
                        specification |= block->fSpecification;
                        AliHLTMUONRecHitsBlockReader inblock(block->fPtr, block->fSize);
index 2db9fc3..2c333d4 100644 (file)
@@ -716,7 +716,7 @@ Bool_t AliHLTMUONFullTracker::FillOutData(AliHLTMUONTrackStruct *track, AliHLTUI
         || not TMath::Finite(fHalfTrack[ibackTrackSeg].fPz)) continue;
       
 #ifdef PRINT_OUTPUT
-      HLTImportant("\nsize : %d, itrack  : %04d, sign : %2d, Pt : %8.3f, (Px,Py,Pz) : (%8.3f,%8.3f,%8.3f)\n",
+      HLTImportant("\nhalftrack : size : %d, itrack  : %04d, sign : %2d, Pt : %8.3f, (Px,Py,Pz) : (%8.3f,%8.3f,%8.3f)\n",
             size,ibackTrackSeg,Int_t(TMath::Sign(1.,fTrackParam[ibackTrackSeg].GetInverseBendingMomentum())),
             TMath::Sqrt(fHalfTrack[ibackTrackSeg].fPx*fHalfTrack[ibackTrackSeg].fPx +
                         fHalfTrack[ibackTrackSeg].fPy*fHalfTrack[ibackTrackSeg].fPy),
@@ -733,27 +733,47 @@ Bool_t AliHLTMUONFullTracker::FillOutData(AliHLTMUONTrackStruct *track, AliHLTUI
       track->fPz = fHalfTrack[ibackTrackSeg].fPz;
       
       track->fChi2 = 0;
+
+      track->fThetaY = TMath::ATan2(track->fPy, track->fPz);
+      track->fThetaX = TMath::ATan2(track->fPx, track->fPz);
       
-      
+      track->fZ = 0.0;
+      track->fY = 0.0;
+      track->fX = 0.0;
       
       for( Int_t ipoint=15;ipoint>=0;ipoint--){
        track->fHit[ipoint] = AliHLTMUONConstants::NilRecHitStruct();
        hitset[ipoint] = false;
+      }
+      
+      for( Int_t ipoint=9;ipoint>=6;ipoint--){
 
-       if(ipoint<=9 and ipoint>=6 and fBackTrackSeg[ibackTrackSeg].fIndex[ipoint-6]!=-1 ){
+       if(fBackTrackSeg[ibackTrackSeg].fIndex[ipoint-6]!=-1 ){
          
          track->fHit[ipoint] = *(fChPoint[ipoint][fBackTrackSeg[ibackTrackSeg].fIndex[ipoint-6]]);
          hitset[ipoint] = true;
 #ifdef PRINT_OUTPUT
          AliHLTUInt8_t chamber; AliHLTUInt16_t detElemID;
          AliHLTMUONUtils::UnpackRecHitFlags((track->fHit[ipoint]).fFlags,chamber,detElemID);
-         HLTImportant("(X,Y,Z) : (%lf,%lf,%lf)",(track->fHit[ipoint]).fX,(track->fHit[ipoint]).fY,(track->fHit[ipoint]).fZ);
+         HLTImportant("halftrack : (X,Y,Z) : (%lf,%lf,%lf)",(track->fHit[ipoint]).fX,(track->fHit[ipoint]).fY,(track->fHit[ipoint]).fZ);
 #endif
        }
       }
       AliHLTMUONParticleSign sign = AliHLTMUONParticleSign(fHalfTrack[ibackTrackSeg].fCharge);
-      track->fFlags = AliHLTMUONUtils::PackMansoTrackFlags(sign,hitset);
-      
+      track->fFlags = AliHLTMUONUtils::PackTrackFlags(sign,hitset);
+      TVector3 mom(track->fPx, track->fPy, track->fPz);
+      double signVal = 0;
+      switch (sign)
+       {
+       case kSignMinus:   signVal = +1.; break;
+       case kSignUnknown: signVal =  0.; break;
+       case kSignPlus:    signVal = -1.; break;
+       }
+      if (mom.Mag() != 0)
+       track->fInverseBendingMomentum = signVal/mom.Mag();
+      else
+       track->fInverseBendingMomentum = 0 ;
+       
       track++;
       fNofTracks++;
       
index b96ca6b..52407cb 100644 (file)
@@ -183,6 +183,7 @@ void RunChain(
        bool useRootWriter = false;
        bool makeTracksOnly = false;
        bool buildDecisionComp = false;
+       bool buildESDComp = false;
        
        // Parse the chainType, output, dataSource and logLevel option strings:
        TString outOpt = output;
@@ -216,6 +217,7 @@ void RunChain(
                buildDDLRecoComps = true;
                buildTrackerComp = true;
                buildDecisionComp = true;
+               buildESDComp = true;
                
                TString dataOpt = dataSource;
                if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
@@ -238,6 +240,7 @@ void RunChain(
                buildDDLRecoComps = true;
                buildFullTrackerComp = true;
                buildDecisionComp = true;
+               buildESDComp = true;
                
                TString dataOpt = dataSource;
                if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
@@ -259,6 +262,7 @@ void RunChain(
        {
                buildDDLRecoComps = true;
                buildDecisionComp = false;
+               buildESDComp = false;
                
                TString dataOpt = dataSource;
                if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
@@ -280,6 +284,7 @@ void RunChain(
        {
                buildTrackerComp = true;
                buildDecisionComp = true;
+               buildESDComp = true;
                
                TString dataOpt = dataSource;
                if (dataOpt.CompareTo("sim", TString::kIgnoreCase) == 0)
@@ -621,6 +626,12 @@ void RunChain(
                if (buildFullTrackerComp) decisionSource = "tracker-full";
                AliHLTConfiguration decision("decision", "MUONDecisionComponent", decisionSource, "");
        }
+       if (buildESDComp)
+       {
+               const char* ESDSource = "tracker recDDL21 recDDL22 ";
+               if (buildFullTrackerComp) ESDSource = "tracker-full recDDL21 recDDL22 ";
+               AliHLTConfiguration ESD("ESD", AliHLTMUONConstants::ESDMakerId(), ESDSource, " -make_minimal_esd");
+       }
 
        // Build the data sink to subscribe only to what has been created and
        // to the data source we actaully want.
@@ -641,6 +652,10 @@ void RunChain(
                // Add the trigger decision component if it was enabled.
                sources += " decision";
        }
+       if (buildESDComp)
+       {
+               sources += " ESD ";
+       }
        
        // Build the data checker component if so requested.
        if (checkData)