]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
esd friends are added to HLT esd convertor
authorsgorbuno <Sergey.Gorbunov@cern.ch>
Thu, 24 Jul 2014 12:58:53 +0000 (14:58 +0200)
committersgorbuno <Sergey.Gorbunov@cern.ch>
Thu, 24 Jul 2014 12:58:53 +0000 (14:58 +0200)
HLT/global/AliHLTGlobalAgent.cxx
HLT/global/AliHLTGlobalEsdConverterComponent.cxx
HLT/global/AliHLTGlobalEsdConverterComponent.h
STEER/STEERBase/AliVVfriendTrack.h

index 92ad127efb8e4f2b5cff78cba7f0cd19a1493d4a..5892289161f92b86106918c52281220d69e6655f 100644 (file)
@@ -157,11 +157,12 @@ int AliHLTGlobalAgent::CreateConfigurations(AliHLTConfigurationHandler* pHandler
   }
 
   if (esdInputs.Length()>0) {
+    esdInputs+=" TPC-ClusterTransformation";
     HLTInfo("Configuring inputs to global HLT ESD: %s", esdInputs.Data());
   } else {
     HLTWarning("No inputs to global HLT ESD found");
   }
-
+  
   pHandler->CreateConfiguration("GLOBAL-flat-esd-converter", "GlobalFlatEsdConverter", esdInputs.Data(), "");
   pHandler->CreateConfiguration("GLOBAL-esd-converter", "GlobalEsdConverter", esdInputs.Data(), "");
   pHandler->CreateConfiguration("GLOBAL-flat-esd-test", "GlobalFlatEsdTest", "GLOBAL-esd-converter GLOBAL-flat-esd-converter", "");
index 1771c5f7e26d0941fd769f099d0253a590f362ee..2fcd7e3902e1b8efe3406fae2ad9c0892fb99a72 100644 (file)
 #include "AliHLTExternalTrackParam.h"
 #include "AliHLTTrackMCLabel.h"
 #include "AliHLTCTPData.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliTPCclusterMI.h"
+#include "AliTPCseed.h"
+#include "AliESDfriend.h"
+#include "AliESDfriendTrack.h"
+#include "AliHLTTPCTransform.h"
 #include "AliHLTErrorGuard.h"
 #include "AliESDEvent.h"
 #include "AliESDtrack.h"
@@ -65,6 +73,7 @@ AliHLTGlobalEsdConverterComponent::AliHLTGlobalEsdConverterComponent()
   , fVerbosity(0)
   , fESD(NULL)
   , fSolenoidBz(-5.00668)
+  , fMakeFriends(1)
   , fBenchmark("EsdConverter")
 {
   // see header file for class documentation
@@ -72,8 +81,10 @@ AliHLTGlobalEsdConverterComponent::AliHLTGlobalEsdConverterComponent()
   // refer to README to build package
   // or
   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
-  
+  for( int i=0; i<fkNPartition; i++ ){
+       fPartitionClusters[i]  = 0;    
+       fNPartitionClusters[i] = 0;    
+  }  
 }
 
 AliHLTGlobalEsdConverterComponent::~AliHLTGlobalEsdConverterComponent()
@@ -81,6 +92,9 @@ AliHLTGlobalEsdConverterComponent::~AliHLTGlobalEsdConverterComponent()
   // see header file for class documentation
   if (fESD) delete fESD;
   fESD=NULL;
+  for( int i=0; i<fkNPartition; i++ ){
+       delete[] fPartitionClusters[i];
+  }
 }
 
 int AliHLTGlobalEsdConverterComponent::Configure(const char* arguments)
@@ -163,6 +177,7 @@ void AliHLTGlobalEsdConverterComponent::GetInputDataTypes(AliHLTComponentDataTyp
   list.push_back(kAliHLTDataTypeKFVertex); // KFVertex object from vertexer
   list.push_back(kAliHLTDataTypePrimaryFinder); // array of track ids for prim vertex
   list.push_back(kAliHLTDataTypeESDContent);
+  list.push_back( AliHLTTPCDefinitions::fgkClustersDataType   );
 }
 
 AliHLTComponentDataType AliHLTGlobalEsdConverterComponent::GetOutputDataType()
@@ -313,8 +328,14 @@ AliSysInfo::AddStamp("DoEvent.Start", evtData.fStructSize);
   fBenchmark.StartNewEvent();
   fBenchmark.Start(0);
 
-  AliESDEvent* pESD = fESD;
+  for(Int_t i=0; i<fkNPartition; i++){
+    delete[] fPartitionClusters[i];    
+    fPartitionClusters[i]  = 0;
+    fNPartitionClusters[i] = 0;    
+  }
 
+  AliESDEvent* pESD = fESD;
+  
   pESD->Reset(); 
   pESD->SetMagneticField(fSolenoidBz);
   pESD->SetRunNumber(GetRunNo());
@@ -393,7 +414,12 @@ AliSysInfo::AddStamp("DoEvent.Start", evtData.fStructSize);
        AliSysInfo::AddStamp("DoEvent.Stop", (int)(statistics[1]), (int)(statistics[2]),pESD->GetNumberOfV0s(),pESD->GetNumberOfTracks() );
   }
   
-  
+  for(Int_t i=0; i<fkNPartition; i++){
+      delete[] fPartitionClusters[i];    
+      fPartitionClusters[i]  = 0;
+      fNPartitionClusters[i] = 0;    
+  }
   return iResult;
 }
 
@@ -417,6 +443,8 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
     HLTWarning("handling of multiple ESD input objects not implemented, skipping input");
   }
 
+  AliESDfriend *esdFriend = new AliESDfriend;
+
   // Barrel tracking
   // tracks are based on the TPC tracks, and only updated from the ITS information
   // Sequence:
@@ -440,6 +468,62 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   // 5) Add Trigger Detectors 
   //    VZERO, ZDC
 
+  // read the clusters
+  // ---------- Access to clusters --------------------//
+
+  for(Int_t i=0; i<fkNPartition; i++){
+    delete[] fPartitionClusters[i];    
+    fPartitionClusters[i]  = 0;
+    fNPartitionClusters[i] = 0;    
+  }
+
+  if( fMakeFriends ){
+
+    int nInputClusters = 0;
+    
+    for(const AliHLTComponentBlockData *iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); iter != NULL; iter = GetNextInputBlock()){
+      
+      if(iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType) continue;    
+      Int_t slice     = AliHLTTPCDefinitions::GetMinSliceNr(iter->fSpecification);
+      Int_t partition = AliHLTTPCDefinitions::GetMinPatchNr(iter->fSpecification);    
+      Int_t slicepartition = slice*6+partition;      
+      if(slicepartition<0 || slicepartition > fkNPartition){
+       HLTWarning("Wrong header of TPC cluster data, slice %d, partition %d", slice, partition );
+       continue;
+      }
+      
+      AliHLTTPCClusterData *inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
+      nInputClusters += inPtrSP->fSpacePointCnt;
+      
+      delete[] fPartitionClusters[slicepartition];
+      fPartitionClusters[slicepartition]  = new AliTPCclusterMI[inPtrSP->fSpacePointCnt];
+      fNPartitionClusters[slicepartition] = inPtrSP->fSpacePointCnt;
+    
+      // create  offline clusters out of the HLT clusters
+
+      for ( unsigned int i = 0; i < inPtrSP->fSpacePointCnt; i++ ) {
+       AliHLTTPCSpacePointData *chlt = &( inPtrSP->fSpacePoints[i] );
+       AliTPCclusterMI *c = fPartitionClusters[slicepartition]+i;
+       c->SetX(chlt->fX);
+       c->SetY(chlt->fY);
+       c->SetZ(chlt->fZ);
+       c->SetSigmaY2(chlt->fSigmaY2);
+       c->SetSigmaYZ( 0 );
+       c->SetSigmaZ2(chlt->fSigmaZ2);
+       c->SetQ( chlt->fCharge );
+       c->SetMax( chlt->fQMax );
+       Int_t sector, row;
+       Float_t padtime[3] = {0,chlt->fY,chlt->fZ};
+       AliHLTTPCTransform::Slice2Sector(slice,chlt->fPadRow, sector, row);
+       AliHLTTPCTransform::Local2Raw( padtime, sector, row);
+       c->SetDetector( sector );
+       c->SetRow( row );
+       c->SetPad( (Int_t) padtime[1] );
+       c->SetTimeBin( (Int_t) padtime[2] );
+      }
+    } // end of loop over blocks of clusters    
+  }
+
   // 1) first read MC information (if present)
   std::map<int,int> mcLabelsTPC;
   std::map<int,int> mcLabelsITS;
@@ -574,7 +658,70 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
        iotrack.SetLabel(mcLabel);
        pESD->AddTrack(&iotrack);
        if (fVerbosity>0) element->Print();
+      
+       if( fMakeFriends ){ // create friend track
+
+         AliHLTGlobalBarrelTrack gb(*element);
+         AliTPCseed tTPC;
+         tTPC.Set( gb.GetX(), gb.GetAlpha(), gb.GetParameter(), gb.GetCovariance() );    
+         tTPC.SetLabel(mcLabel);
+         
+         // set the clusters 
+         UInt_t nClusters = element->GetNumberOfPoints();
+         const UInt_t*clusterIDs = element->GetPoints();
+
+         tTPC.SetNumberOfClusters(nClusters);
+
+         for(UInt_t ic=0; ic<nClusters; ic++){  
+
+           UInt_t id      = clusterIDs[ic];         
+           int iSlice = AliHLTTPCSpacePointData::GetSlice(id);
+           int iPartition = AliHLTTPCSpacePointData::GetPatch(id);
+           int iCluster = AliHLTTPCSpacePointData::GetNumber(id);
+           
+           if(iSlice<0 || iSlice>36 || iPartition<0 || iPartition>5){
+             HLTError("Corrupted TPC cluster Id: slice %d, partition %d, cluster %d", iSlice, iPartition, iCluster);
+             continue;
+           }
+           
+           AliTPCclusterMI *patchClusters = fPartitionClusters[iSlice*6 + iPartition];
+           if(!patchClusters){
+             HLTError("Clusters are missed for slice %d, partition %d", iSlice, iPartition );
+             continue;
+           }
+           
+           if(iCluster >= fNPartitionClusters[iSlice*6 + iPartition]){
+             HLTError("TPC slice %d, partition %d: ClusterID==%d >= N Cluaters==%d ", iSlice, iPartition,iCluster, fNPartitionClusters[iSlice*6 + iPartition] );
+             continue;
+           }
+       
+           AliTPCclusterMI *c = &(patchClusters[iCluster]);            
+           int sec = c->GetDetector();
+           int row = c->GetRow();
+           if(sec >= 36) row = row + AliHLTTPCTransform::GetNRowLow();
+         
+           tTPC.SetClusterPointer(row, c);     
+       
+           AliTPCTrackerPoint &point = *( tTPC.GetTrackPoint( row ) );
+           //tTPC.Propagate( TMath::DegToRad()*(sec%18*20.+10.), c->GetX(), fSolenoidBz );
+           Double_t angle2 = tTPC.GetSnp()*tTPC.GetSnp();
+           angle2 = (angle2<1) ?TMath::Sqrt(angle2/(1-angle2)) :10.; 
+           point.SetAngleY( angle2 );
+           point.SetAngleZ( tTPC.GetTgl() );
+         } // end of associated cluster loop
+         
+         // Cook dEdx
+         
+         AliTPCseed *seed = &(tTPC);      
+         //fSeedArray->AddAt( seed, TMath::Abs(seed->GetLabel()) );
+         //fdEdx->Fill( seed->P()*seed->Charge(), seed->CookdEdx(0.02, 0.6) );
+
+         AliESDfriendTrack friendTrack;
+         friendTrack.AddCalibObject(&tTPC);
+         esdFriend->AddTrack(&friendTrack);
+       }
       }
+
       HLTInfo("converted %d track(s) to AliESDtrack and added to ESD", tracks.size());
       iAddedDataBlocks++;
     } else if (iResult<0) {
@@ -894,7 +1041,13 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
       }
     }
   }
-  
+
+  if( fMakeFriends ){ // create friend track
+    pESD->SetESDfriend( esdFriend );
+  }
+
+  delete esdFriend;
+
   if (iAddedDataBlocks>0 && pTree) {
     pTree->Fill();
   }
index 4f082076aa1a65888ff035f983de58c169427564..524d56abe3f129c5a97592c3a5d453f6280511ae 100644 (file)
@@ -21,6 +21,7 @@
 class AliESDEvent;
 class TTree;
 struct AliHLTTracksData;
+class AliTPCclusterMI;
 
 /**
  * @class AliHLTGlobalEsdConverterComponent
@@ -103,11 +104,18 @@ class AliHLTGlobalEsdConverterComponent : public AliHLTProcessor
 
 protected:
 
+  static const Int_t fkNPartition = 36*6;           // number of patches in TPC
+
   /// the ESD
   AliESDEvent* fESD; //! transient value
 
   /// solenoid b field
   Double_t fSolenoidBz; //! transient
+
+  Bool_t fMakeFriends; // flag to create friends
+  AliTPCclusterMI   *fPartitionClusters[fkNPartition];  //! arrays of cluster data for each TPC partition
+  Int_t              fNPartitionClusters[fkNPartition]; //! number of clusters for each TPC partition
   AliHLTComponentBenchmark fBenchmark; // benchmark
 
   ClassDef(AliHLTGlobalEsdConverterComponent, 0)
index 48d5107c9b96d8d7f49bb51d495ca99241013b0d..15f6c834ae963576b8795d13fd5a87f26b39630e 100644 (file)
@@ -14,8 +14,6 @@ class AliVVfriendTrack {
 public:
 
   AliVVfriendTrack(){}
-  AliVVfriendTrack(const AliVVfriendTrack &){}
-  AliVVfriendTrack& operator=(const AliVVfriendTrack& ){}
   // constructor for reinitialisation of vtable
   AliVVfriendTrack( AliVVConstructorReinitialisationFlag ){}