/** Get the best match */
Int_t GetTrackMatched() const
{
- if( fTracksMatched >0) return fTracksMatched[0];
+ if( fTracksMatched[0] >0) return fTracksMatched[0];
else return -1;
} //Most likely the track associated to the cluster
/** Get the number of tracks matched */
- Int_t GetNTracksMatched() const { return fNTracksMatched; }
-
+ Int_t GetNTracksMatched() const
+ {
+ for(int i = 0; i < 10; i++)
+ {
+ if (fTracksMatched[i] < 0)
+ {
+ return i;
+ }
+ }
+ return 10;
+ }
+
/** Number of cells in the cluster */
UInt_t fNCells; //COMMENT
Float_t fDistanceToBadChannel; //COMMENT
/** Number of matched tracks */
- Int_t fNTracksMatched; //COMMENT
+ Int_t fNTracksMatched; //COMMENT Obsolete?
/** the matced tracks */
Int_t fTracksMatched[10]; //COMMENT TODO: remove hardcoded 10
-
+
/** The absolute IDs of the cells*/
UShort_t fCellsAbsId; //COMMENT
Float_t fCellsAmpFraction; //COMMENT
-
};
esdCluster.SetEmcCpvDistance(caloClusterStructPtr->fEmcCpvDistance);
esdCluster.SetDistanceToBadChannel(caloClusterStructPtr->fDistToBadChannel);
esdCluster.SetNCells(caloClusterStructPtr->fNCells);
- //esdCluster.SetNCells(2);
-
+ TArrayI tracksMatched(caloClusterStructPtr->GetNTracksMatched(), caloClusterStructPtr->fTracksMatched);
+ esdCluster.AddTracksMatched(tracksMatched);
UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
Double_t GetLastPointY() const {return fLastY;}
/// return Track ID
Int_t TrackID() const {return fTrackID;}
+ /// return Track ID, inherited for AliExternalTrackParam
+ Int_t GetID() const {return fTrackID;}
/// Get the number of associated points
UInt_t GetNumberOfPoints() const;
caloClusterPtr->fClusterType = fClusterType;
// Int_t tmpSize = 0;//totSize + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
+ //TODO remove hardcoded 10;
+ memset(caloClusterPtr->fTracksMatched, 0xff, sizeof(Int_t)*10);
+
Int_t tmpSize = totSize + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
if((availableSize - totSize) < tmpSize)
fNDigits(0)\r
{\r
//See header file for documentation\r
- fEmcClusteringThreshold = 0.2;\r
- fEmcMinEnergyThreshold = 0.03;\r
+ //fEmcClusteringThreshold = 0.2;\r
+ //fEmcMinEnergyThreshold = 0.03;\r
+\r
+ fEmcClusteringThreshold = 0.1;\r
+ fEmcMinEnergyThreshold = 0.01;\r
fEmcTimeGate = 1.e-6 ;\r
\r
fMaxDigitIndexDiff = 2*fCaloConstants->GetNZROWSMOD();\r
}\r
return 0;\r
\r
-}
\ No newline at end of file
+}\r
HLTDebug("%d HLT clusters from spec: 0x%X", caloClusterHeaderPtr->fNClusters, pBlock->fSpecification);
- AliHLTCaloClusterReader reader;
- reader.SetMemory(caloClusterHeaderPtr);
+ //AliHLTCaloClusterReader reader;
+ //reader.SetMemory(caloClusterHeaderPtr);
AliHLTESDCaloClusterMaker clusterMaker;
int nClusters = clusterMaker.FillESD(pESD, caloClusterHeaderPtr);
-
+
HLTInfo("converted %d cluster(s) to AliESDCaloCluster and added to ESD", nClusters);
iAddedDataBlocks++;
}
//$Id$
-
/**************************************************************************
* This file is property of and copyright by the ALICE HLT Project *
* ALICE Experiment at CERN, All rights reserved. *
* *
- * Primary Authors: Svein Lindal (slindal@fys.uio.no) *
+ * Primary Authors: Svein Lindal (slindal@fys.uio.no) *
* for The ALICE HLT Project. *
* *
* Permission to use, copy, modify and distribute this software and its *
*/
#include "AliHLTGlobalTrackMatcher.h"
-#include "AliESDCaloCluster.h"
+//#include "AliESDCaloCluster.h"
+
+
#if __GNUC__>= 3
using namespace std;
fPhosMaxX(0),
fEmcalMaxZ(0),
fEmcalMaxX(0),
- fPhosRadius(460),
- fEmcalRadius(448),
fMatchDistance(0),
- fPhosClustersArray(NULL),
- fEmcalClustersArray(NULL)
+ fPhosRadius(460),
+ fEmcalRadius(448)
{
//Default constructor
-
DoInit();
}
}
void AliHLTGlobalTrackMatcher::DoInit( ) {
+ //See header file for documentation
+ //BALLE TODO: Change hardcoded values to something that is initialised through command line or something!!!
fMatchDistance = 40*40;
fEmcalMaxZ = 350 + TMath::Sqrt(fMatchDistance) + 30;
fEmcalMaxX = 3000;
- fPhosClustersArray = new TRefArray();
- fEmcalClustersArray = new TRefArray();
}
-Bool_t AliHLTGlobalTrackMatcher::Match( AliESDEvent* event ){
+Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, TArrayI* matchedTracksArray, Bool_t bestMatch, Int_t nMatches){
+ //See header file for documentation
+
+ matchedTracksArray->Set(matchedTracksArray->GetSize() + 1);
+ if ( bestMatch ) {
+ matchedTracksArray->AddAt(matchedTracksArray->At(0), matchedTracksArray->GetSize() - 1);
+ matchedTracksArray->AddAt(tId, 0);
+ } else {
+ matchedTracksArray->AddAt(tId, matchedTracksArray->GetSize() - 1);
+ }
- Int_t nTracks = event->GetNumberOfTracks();
+ return nMatches;
+}
- //Fill arrays with clusters
- Int_t nPhosClusters = event->GetPHOSClusters(fPhosClustersArray);
- Int_t nEmcalClusters = event->GetEMCALClusters(fEmcalClustersArray);
+Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, Int_t* matchArray, bool bestMatch, Int_t nMatches ){
- if ( ( nTracks <= 0 ) || ( (nEmcalClusters <= 0) && (nPhosClusters <= 0)) ) {
- //printf(Form("No tracks or clusters in event"));
- return 0;
- }
+ HLTInfo("Adding track %d to cluster with %d previous matches", tId, nMatches);
-
- Float_t bestMatchPhos[nPhosClusters];
- for(int ic = 0; ic < nPhosClusters; ic++) {
- bestMatchPhos[ic] = 999999;
+ //BALLE TODO: remove hardcoded 9
+ if (nMatches > 9) { //BALLE this on tooo
+ HLTError("The number of matching tracks (%d) exceeds the array size of %d", nMatches, 9);
+ return 0;
}
- Float_t bestMatchEmcal[nEmcalClusters];
- for(int ic = 0; ic < nEmcalClusters; ic++) {
- bestMatchEmcal[ic] = 999999;
+ if(bestMatch) {
+ cout <<"bestmatch"<<endl;
+ matchArray[nMatches] = matchArray[0];
+ matchArray[0] = tId;
+ } else {
+ matchArray[nMatches] = tId;
}
-
-
- Double_t trackPosition[3];
- //Loop over tracks
- for (int it = 0; it < nTracks; it++ ) {
+ return nMatches;
- AliESDtrack * track = event->GetTrack(it);
+};
- Double_t bz = event->GetMagneticField();
-
- //Does track pass close to either calorimeter volume
- if ( IsTrackCloseToDetector(track, bz, trackPosition, fPhosMaxX, kFALSE, fPhosMaxZ ) ) {
- MatchTrackToClusters( track, fPhosClustersArray, nPhosClusters, bestMatchPhos, bz);
-
- } else if ( IsTrackCloseToDetector(track, bz, trackPosition, fEmcalMaxX, kTRUE, fEmcalMaxZ ) ) {
- MatchTrackToClusters( track, fEmcalClustersArray, nEmcalClusters, bestMatchEmcal, bz);
- }
- } // track loop
-
-
- return 0;
-}
-
-
-
-void AliHLTGlobalTrackMatcher::MatchTrackToClusters( AliESDtrack * track, TRefArray * clustersArray, Int_t nClusters, Float_t * bestMatch, Double_t bz) {
-
- //loop over clusters to find matches with track
-
- Float_t clusterPosition[3];
- Double_t trackPosition[3];
-
- for(int ic = 0; ic < nClusters; ic++) {
-
- AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(clustersArray->At(ic));
-
- //Get Cluster Global Coordinates
- cluster->GetPosition(clusterPosition);
-
- //Get track postion at radius of cluster
- Double_t rCluster = TMath::Sqrt(clusterPosition[0]*clusterPosition[0] + clusterPosition[1]*clusterPosition[1]);
- if (! (track->GetXYZAt(rCluster, bz, trackPosition)) ) {
- cout << "XXXXXXXXXXXXX BALLE Track reached detector but not cluster, needs to be handled no? !!!!!!" << endl;
- }
-
- Float_t match = 0;
- Float_t dxyz = 0;
- for(int i = 0; i < 3; i++) {
- dxyz = trackPosition[i] - clusterPosition[i];
- match += dxyz*dxyz;
- }
-
-
- if( match > fMatchDistance ) {
- continue;
- }
-
-
- //Track is close to cluster, add to cluster's array of matching tracks
- TArrayI *matchedTracksArray = cluster->GetTracksMatched();
- matchedTracksArray->Set(matchedTracksArray->GetSize() + 1);
- if ( match < bestMatch[ic] ) {
- bestMatch[ic] = match;
- matchedTracksArray->AddAt(matchedTracksArray->At(0), matchedTracksArray->GetSize() - 1);
- matchedTracksArray->AddAt(track->GetID(), 0);
- } else {
- matchedTracksArray->AddAt(track->GetID(), matchedTracksArray->GetSize() - 1);
- }
- } //cluster loop
-}
-
-
-Bool_t AliHLTGlobalTrackMatcher::IsTrackCloseToDetector(AliESDtrack * track, Double_t bz, Double_t * trackPosition, Double_t fMaxX, Bool_t ySign, Double_t fMaxZ) {
+Bool_t AliHLTGlobalTrackMatcher::IsTrackCloseToDetector(AliExternalTrackParam * track, Double_t bz, Double_t fMaxX, Bool_t ySign, Double_t fMaxZ, Double_t dRadius) {
//See header file for documentation
-
//Get track instersection with cylinder defined by detector radius
- if (! (track->GetXYZAt(fPhosRadius, bz, trackPosition)) )
+ Double_t trackPosition[3];
+ if (! (track->GetXYZAt(dRadius, bz, trackPosition)) ) {
return kFALSE;
-
- //Positive y for EMCAL, negative for PHOS
+ }
+
+ //Positive y for EMCAL, negative for PHOS
if(ySign) {
if (trackPosition[1] < 0 )
return kFALSE;
if (TMath::Abs(trackPosition[0]) > fMaxX )
return kFALSE;
-
-
return kTRUE;
}
-
-
-// Bool_t AliHLTGlobalTrackMatcher::IsTrackCloseToEmcal(AliESDtrack * track, Double_t bz, Double_t * trackPosition) {
-
-// //Get track instersection with cylinder defined by detector radius
-// if (! (track->GetXYZAt(fEmcalRadius, bz, trackPosition)) )
-// return kFALSE;
-
-
-// //See header file for documentation
-
-
-
-// return kTRUE;
-
-// if (trackPosition[1] < 0 )
-// return kFALSE;
-
-
-// if ( TMath::Abs(trackPosition[2]) > fEmcalMaxZ )
-// return kFALSE;
-
-// if ( TMath::Abs(trackPosition[0]) > fEmcalMaxX )
-// return kFALSE;
-
-
-// //
-// return kTRUE;
-// }
-
#include "AliHLTLogging.h"
#include "AliESDtrack.h"
-#include "TRefArray.h"
-#include "AliESDEvent.h"
+#include "TObjArray.h"
+#include "TArrayI.h"
-class AliHLTGlobalTrackMatcher {
+class AliHLTGlobalTrackMatcher : public AliHLTLogging{
public:
AliHLTGlobalTrackMatcher();
/** destructor */
virtual ~AliHLTGlobalTrackMatcher();
-
- // Main function, loops over tracks, clusters
- // Finds best match for cluster
- Bool_t Match( AliESDEvent* event );
-
-
+ //Main function, loops over tracks and calls appropriate functions to establish matches
+ template <class T>
+ Int_t Match( TObjArray * trackArray, vector<T*> &clustersVector, Double_t bz );
+
private:
-
+
void DoInit();
- //Projects track to detector volume and decides if it passes in the vinity or not
- Bool_t IsTrackCloseToDetector(AliESDtrack * track, Double_t bz, Double_t * trackPosition, Double_t fMaxX, Bool_t ySign, Double_t fMaxZ);
+ //Loops over clusters and decides if track is a good match to any of these
+ template <class T>
+ Int_t MatchTrackToClusters( AliExternalTrackParam * track, vector<T*> &clustersVector, Int_t nClusters, Float_t * bestMatch, Double_t bz);
- //Fills fClustersArray with refs to the clusters, returns number of clusters
- void MatchTrackToClusters( AliESDtrack * track, TRefArray * clustersArray, Int_t nClusters, Float_t * bestMatch, Double_t bz );
-
- // Geometrical paramaters of detector volume
+ //Add track Id to cluster's list of matching tracks
+ Int_t AddTrackToCluster(Int_t tId, Int_t* clustersArray, Bool_t bestMatch, Int_t nMatches);
+ Int_t AddTrackToCluster(Int_t tId, TArrayI* clustersArray, Bool_t bestMatch, Int_t nMatches);
+
+ //Projects track to detector volume and decides if it's anywhere near calorimeter volume
+ Bool_t IsTrackCloseToDetector(AliExternalTrackParam * track, Double_t bz, Double_t fMaxX, Bool_t ySign, Double_t fMaxZ, Double_t dRadius);
+
+ // Geometrical cut off values used to decide whether track is anywhere near calorimeter volumes
Float_t fPhosMaxZ; // max Z track (cm)
Float_t fPhosMaxX; // max X track (cm)
- Float_t fEmcalMaxZ;
- Float_t fEmcalMaxX;
+ Float_t fEmcalMaxZ; // max Z track (cm)
+ Float_t fEmcalMaxX; // max X track (cm)
- Float_t fMatchDistance;
+ Float_t fMatchDistance; // Square of maximum distance where track is considered a match to cluster (cm^2)
- const Double_t fPhosRadius;
- const Double_t fEmcalRadius; // Radial position of detector volume
- //TRefArrays that will be filled with referenced to the PHOS and EMCAL Clusters
- TRefArray * fPhosClustersArray;
- TRefArray * fEmcalClustersArray;
+ const Double_t fPhosRadius; // Radial position of PHOS
+ const Double_t fEmcalRadius; // Radial position of EMCAL
AliHLTGlobalTrackMatcher(const AliHLTGlobalTrackMatcher & );
AliHLTGlobalTrackMatcher & operator = (const AliHLTGlobalTrackMatcher &);
- ClassDef(AliHLTGlobalTrackMatcher,1) //Merging base class
+ ClassDef(AliHLTGlobalTrackMatcher,1)
};
+
+template <class T>
+Int_t AliHLTGlobalTrackMatcher::Match( TObjArray * trackArray, vector<T*> &clustersVector, Double_t bz ) {
+ //See above for documentation
+
+ Int_t nTracks = trackArray->GetEntriesFast();
+ Int_t nPhosClusters = clustersVector.size();
+
+ //TODO emcal not yet implemented
+ Int_t nEmcalClusters = 0; //BALLE event->GetEMCALClusters(fEmcalClustersArray);
+
+ if ( nTracks <= 0 ) {
+ HLTWarning("No tracks in event");
+ return 0;
+ } else if ( (nEmcalClusters <= 0) && (nPhosClusters <= 0)) {
+ HLTWarning("No calorimeter clusters in Event");
+ return 0;
+ }
+
+ Float_t bestMatchPhos[nPhosClusters];
+ for(int ic = 0; ic < nPhosClusters; ic++) {
+ bestMatchPhos[ic] = 999999;
+ }
+
+ //BALLE TODO EMCAL implement
+ // Float_t bestMatchEmcal[nEmcalClusters];
+ // for(int ic = 0; ic < nEmcalClusters; ic++) {
+ // bestMatchEmcal[ic] = 999999;
+ // }
+
+
+ //Loop over tracks
+ for (int it = 0; it < nTracks; it++ ) {
+ AliExternalTrackParam * track = static_cast<AliExternalTrackParam*>(trackArray->At(it));
+
+ if ( IsTrackCloseToDetector(track, bz, fPhosMaxX, kFALSE, fPhosMaxZ, fPhosRadius ) ) {
+ MatchTrackToClusters( track, clustersVector, nPhosClusters, bestMatchPhos, bz);
+
+ //BALLE TODO EMCAL !!!!
+ // } else if ( IsTrackCloseToDetector(track, bz, fEmcalMaxX, kTRUE, fEmcalMaxZ, fEmcalRadius ) ) {
+ // MatchTrackToClusters( track, fEmcalClustersArray, nEmcalClusters, bestMatchEmcal, bz);
+ }
+
+
+ } // track loop
+
+
+ return 0;
+}
+
+
+
+template <class T>
+Int_t AliHLTGlobalTrackMatcher::MatchTrackToClusters( AliExternalTrackParam * track, vector<T*> &clustersVector, Int_t nClusters, Float_t * bestMatch, Double_t bz) {
+
+ //See header file for documentation
+ Int_t iResult = 0;
+
+ Float_t clusterPosition[3];
+ Double_t trackPosition[3];
+
+
+ for(int ic = 0; ic < nClusters; ic++) {
+
+ T * cluster = clustersVector.at(ic);
+
+ //Get cluster global coordinates
+ cluster->GetPosition(clusterPosition);
+
+ //Get track postion at radius of cluster
+ Double_t rCluster = TMath::Sqrt(clusterPosition[0]*clusterPosition[0] + clusterPosition[1]*clusterPosition[1]);
+ if (! (track->GetXYZAt(rCluster, bz, trackPosition)) ) {
+ HLTWarning("Track reached detector but not cluster!!!!!!");
+ continue;
+ }
+
+ //Calculate track - cluster residual
+
+
+ //Get residual in z= 0 plane (squared)
+ Double_t dxy = 0;
+ for(int i = 0; i < 2; i++) {
+ Double_t dd = trackPosition[i] - clusterPosition[i];
+ dxy += dd*dd;
+ }
+
+ //Get z residual (squared)
+ Double_t dd = trackPosition[2] - clusterPosition[2];
+ Double_t dz = dd*dd;
+
+ Double_t match = dz + dxy;
+
+ if( match > fMatchDistance ) {
+ continue;
+ }
+
+ if (match < bestMatch[ic]) {
+ bestMatch[ic] = match;
+ cluster->SetEmcCpvDistance(TMath::Sqrt(match));
+ //cluster->SEt
+ }
+
+ //Add track to cluster's array of matching tracks
+ Int_t nTracksMatched = cluster->GetNTracksMatched();
+ iResult = AddTrackToCluster(track->GetID(), cluster->GetTracksMatched(), match < bestMatch[ic], nTracksMatched);
+ HLTInfo("Added track %d to cluster %d, it now has %d matching tracks", track->GetID(), cluster->GetID(), cluster->GetNTracksMatched());
+ }
+
+ return iResult;
+}
+
#endif
--- /dev/null
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Svein Lindal <svein.lindal@gmail.com> *
+//* for The ALICE HLT Project. *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/** @file AliHLTGlobalTrackMatcherComponent.cxx
+ @author Svein Lindal
+ @brief Component to match TPC tracks to Calo Clusters
+*/
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTProcessor.h"
+#include "AliHLTGlobalTrackMatcherComponent.h"
+#include "AliHLTGlobalTrackMatcher.h"
+#include "TObjArray.h"
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
+#include "AliHLTGlobalBarrelTrack.h"
+#include "AliHLTCaloClusterDataStruct.h"
+#include "AliHLTCaloClusterReader.h"
+
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+AliHLTGlobalTrackMatcherComponent gAliHLTGlobalTrackMatcherComponent;
+
+ClassImp(AliHLTGlobalTrackMatcherComponent);
+
+AliHLTGlobalTrackMatcherComponent::AliHLTGlobalTrackMatcherComponent() :
+ fTrackMatcher(NULL),
+ fNEvents(0),
+ fBz(-9999999),
+ fClusterReader(NULL)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+AliHLTGlobalTrackMatcherComponent::~AliHLTGlobalTrackMatcherComponent()
+{
+ // see header file for class documentation
+ if(fTrackMatcher)
+ delete fTrackMatcher;
+ fTrackMatcher = NULL;
+
+ if(fClusterReader)
+ delete fClusterReader;
+ fClusterReader = NULL;
+
+}
+
+
+// Public functions to implement AliHLTComponent's interface.
+// These functions are required for the registration process
+const char* AliHLTGlobalTrackMatcherComponent::GetComponentID()
+{
+ // see header file for class documentation
+ return "TrackMatcher";
+}
+
+void AliHLTGlobalTrackMatcherComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
+{
+ // see header file for class documentation
+ list.clear();
+ list.push_back( kAliHLTDataTypeTrack );
+ list.push_back( kAliHLTDataTypeCaloCluster );
+}
+
+AliHLTComponentDataType AliHLTGlobalTrackMatcherComponent::GetOutputDataType()
+{
+ // see header file for class documentation
+ return kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny;
+}
+
+void AliHLTGlobalTrackMatcherComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ // see header file for class documentation
+ // XXX TODO: Find more realistic values.
+ constBase = 80000;
+ inputMultiplier = 0;
+}
+
+AliHLTComponent* AliHLTGlobalTrackMatcherComponent::Spawn()
+{
+ // see header file for class documentation
+ return new AliHLTGlobalTrackMatcherComponent;
+}
+
+int AliHLTGlobalTrackMatcherComponent::DoInit( int argc, const char** argv )
+{
+
+ //BALLE TODO, use command line values to initialise matching vaules
+ // init
+ Int_t iResult = argc;
+
+ if(argc > 0){
+ HLTWarning("Ignoring all configuration args, starting with: argv %s", argv[0]);
+ }
+
+ fClusterReader = new AliHLTCaloClusterReader();
+
+ fBz = GetBz();
+ if(fBz == -999999) {
+ HLTError("Magnetic field not properly set, current value: %d", fBz);
+ }
+
+ fTrackMatcher = new AliHLTGlobalTrackMatcher();
+
+ fNEvents = 0;
+
+ return iResult;
+}
+
+int AliHLTGlobalTrackMatcherComponent::DoDeinit()
+{
+ // see header file for class documentation
+ Int_t iResult = 1;
+
+ if(fTrackMatcher)
+ delete fTrackMatcher;
+ fTrackMatcher = NULL;
+
+ if(fClusterReader)
+ delete fClusterReader;
+ fClusterReader = NULL;
+
+
+ fNEvents = 0;
+
+ return iResult;
+}
+
+int AliHLTGlobalTrackMatcherComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
+{
+
+ //See header file for documentation
+ Int_t iResult = 0;
+
+ if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
+ return 0;
+
+
+ fNEvents++;
+
+ //BALLE TODO check that the tracks in the TObjArray are fine over several blocks
+ TObjArray * trackArray = new TObjArray();
+ trackArray->SetOwner(kFALSE);
+ vector<AliHLTGlobalBarrelTrack> tracks;
+
+ for (const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+
+ if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>=0) {
+
+ for(UInt_t it = 0; it < tracks.size(); it++) {
+ AliHLTGlobalBarrelTrack track = tracks.at(it);
+ HLTInfo("track ID %d", track.TrackID());
+ trackArray->AddLast(dynamic_cast<TObject*>(&(tracks.at(it))));
+ }
+ } else {
+ HLTWarning("Converting tracks to vector failed");
+ }
+
+ //Push the TPC block on, without any changes
+ PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
+
+ }
+
+ //Vector to contain the phos clusters
+ vector<AliHLTCaloClusterDataStruct *> phosClustersVector;
+ AliHLTCaloClusterDataStruct * caloClusterStructPtr;
+
+ for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+ AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
+ fClusterReader->SetMemory(caloClusterHeaderPtr);
+
+ //BALLE, TODO, make it able to do EMCAL as well!!!
+ phosClustersVector.resize((Int_t) (caloClusterHeaderPtr->fNClusters));
+
+ Int_t nClusters = 0;
+ while((caloClusterStructPtr = fClusterReader->NextCluster()) != 0) {
+ //BALLE stil just phos
+ phosClustersVector[nClusters++] = caloClusterStructPtr;
+ }
+
+ iResult = fTrackMatcher->Match(trackArray, phosClustersVector, fBz);
+ if(iResult <0) {
+ HLTWarning("Error in track matcher");
+ }
+
+ PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
+ }
+
+ //BALLE TODO phos only !!!!
+
+ delete trackArray;
+ return iResult;
+
+}
+
+// int AliHLTGlobalTrackMatcherComponent::Configure(const char* arguments)
+// {
+// Int_t iResult = 1;
+// return iResult;
+// }
+
+// int AliHLTGlobalTrackMatcherComponent::Reconfigure(const char* cdbEntry, const char* chainId)
+// {
+// Int_t iResult = 1;
+// return iResult;
+// }
--- /dev/null
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/** @file AliHLTGlobalTrackMatcherComponent.h
+ @author Sergey Gorbunov
+ @brief Component for monitor V0 physics
+*/
+
+
+
+#ifndef ALIHLTGLOBALTRACKMATCHERCOMPONENT_H
+#define ALIHLTGLOBALTRACKMATCHERCOMPONENT_H
+
+
+class AliHLTProcessor;
+class AliHLTGlobalTrackMatcher;
+class AliHLTCaloClusterReader;
+
+/**
+ * @class AliHLTTPCV0HistoComponent
+ * Component for monitor V0 physics
+ */
+class AliHLTGlobalTrackMatcherComponent : public AliHLTProcessor
+{
+public:
+ /** default constructor */
+ AliHLTGlobalTrackMatcherComponent();
+ /** destructor */
+ virtual ~AliHLTGlobalTrackMatcherComponent();
+
+ // Public functions to implement AliHLTComponent's interface.
+ // These functions are required for the registration process
+
+ /** interface function, see AliHLTComponent for description */
+ const char* GetComponentID();
+ /** interface function, see AliHLTComponent for description */
+ void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+ /** interface function, see AliHLTComponent for description */
+ AliHLTComponentDataType GetOutputDataType();
+ /** interface function, see AliHLTComponent for description */
+ virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ /** interface function, see AliHLTComponent for description */
+ AliHLTComponent* Spawn();
+
+protected:
+
+ // Protected functions to implement AliHLTComponent's interface.
+ // These functions provide initialization as well as the actual processing
+ // capabilities of the component.
+
+ /** interface function, see AliHLTComponent for description */
+ int DoInit( int argc, const char** argv );
+ /** interface function, see AliHLTComponent for description */
+ int DoDeinit();
+ /** interface function, see AliHLTComponent for description */
+ int DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData );
+
+ //int Reconfigure(const char* cdbEntry, const char* chainId);
+
+ using AliHLTProcessor::DoEvent;
+
+private:
+ /** copy constructor prohibited */
+ AliHLTGlobalTrackMatcherComponent(const AliHLTGlobalTrackMatcherComponent&);
+ /** assignment operator prohibited */
+ AliHLTGlobalTrackMatcherComponent& operator=(const AliHLTGlobalTrackMatcherComponent&);
+ /**
+ * Configure the component.
+ * Parse a string for the configuration arguments and set the component
+ * properties.
+ */
+ // int Configure(const char* arguments);
+
+
+ AliHLTGlobalTrackMatcher * fTrackMatcher; //Instance of the track matcher class
+
+ Int_t fNEvents; //Number of events processed
+
+ Double_t fBz; //Magnetic field of event
+
+ AliHLTCaloClusterReader * fClusterReader; //Instance of helper class to read calorimeter structs
+
+
+ ClassDef(AliHLTGlobalTrackMatcherComponent, 0);
+
+};
+#endif
//see header file for documentation
list.clear();
list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOut );
+ list.push_back( kAliHLTDataTypeCaloCluster | kAliHLTDataOriginEMCAL );
+ list.push_back(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginPHOS );
+
// list.push_back(AliHLTPHOSDefinitions::fgkClusterDataType);
-// list.push_back(AliHLTPHOSDefinitions::fgkESDCaloClusterDataType);
-// list.push_back(AliHLTPHOSDefinitions::fgkESDCaloCellsDataType);
+ // list.push_back(AliHLTPHOSDefinitions::fgkESDCaloClusterDataType);
+ // list.push_back(AliHLTPHOSDefinitions::fgkESDCaloCellsDataType);
}
AliHLTComponentDataType AliHLTCaloHistoComponent::GetOutputDataType()
{
//see header file for documentation
- return (kAliHLTDataTypeHistogram | kAliHLTDataOriginOut);
+ return kAliHLTDataTypeHistogram | kAliHLTDataOriginAny ;
}
// fUID = ( gSystem->GetPid() + t.GetNanoSec())*10 + evtData.fEventID;
// }
-
for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
event->GetStdContent();
//EMCAL
if(fDoEmcal){
-
+
Int_t nec = event->GetEMCALClusters(fEmcalClustersArray);
if(fDoMatchedTracks)
if(fDoInvariantMass)
fEmcalInvariantMassHistProducer->FillHistograms(nec, fEmcalClustersArray);
-
+
if(fDoClusterEnergy)
fEmcalClusterEnergyHistProducer->FillHistograms(nec, fEmcalClustersArray);
-
+
if(fDoCellEnergy)
fEmcalCellEnergyHistProducer->FillHistograms(nec, fEmcalClustersArray);;
-
+
}
-
-
+
+
//PHOS
if(fDoPhos){
if(fDoInvariantMass)
fPhosInvariantMassHistProducer->FillHistograms(npc, fPhosClustersArray);
-
+
if(fDoClusterEnergy)
fPhosClusterEnergyHistProducer->FillHistograms(npc, fPhosClustersArray);
-
+
if(fDoCellEnergy)
fPhosCellEnergyHistProducer->FillHistograms(npc, fPhosClustersArray);
-
- }
+ }
+
}
-
+
//Push histos
if(fDoMatchedTracks)
PushBack(fPhosMatchedTracksHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
-
+
if(fDoClusterEnergy)
PushBack(fPhosClusterEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
-
+
if(fDoCellEnergy)
PushBack(fPhosCellEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
AliHLTGlobalAgent.h \
AliHLTGlobalVertexerComponent.h \
AliHLTGlobalTrackMatcher.h \
+ AliHLTGlobalTrackMatcherComponent.h \
AliHLTGlobalVertexerHistoComponent.h \
AliHLTGlobalHistoCollector.h \
physics/AliHLTV0HistoComponent.h \
physics/AliHLTCaloHistoClusterEnergy.h \
physics/AliHLTCaloHistoCellEnergy.h
-# physics/AliHLTPHOSHistogramProducerComponent.h \
-#physics/AliHLTPHOSHistogramProducerComponent.h
-#
+#
MODULE_SRCS= $(CLASS_HDRS:.h=.cxx)
MODULE_HDRS:= $(CLASS_HDRS)