-// $Id: AliHLTTRDTrackerV1Component.cxx 23618 2008-01-29 13:07:38Z hristov $
-
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
- * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
- * for The ALICE Off-line 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. *
- **************************************************************************/
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: *
+//* 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 AliHLTTRDTrackerV1Component.cxx
- @author Timm Steinbeck, Matthias Richter
+ @author Theodor Rascanu
@date
- @brief A TRDTrackerV1 processing component for the HLT. */
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
+ @brief A TRDTrackerV1 processing component for the HLT.
+*/
#include "AliHLTTRDTrackerV1Component.h"
#include "AliHLTTRDDefinitions.h"
+#include "AliHLTTRDTrack.h"
+#include "AliHLTTRDUtils.h"
+#include "AliHLTTRDCluster.h"
#include "TFile.h"
#include "TChain.h"
+#include "AliGeomManager.h"
#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
#include "AliESDEvent.h"
-#include "AliMagFMaps.h"
#include "AliESDfriend.h"
+#include "AliTRDcalibDB.h"
#include "AliTRDReconstructor.h"
#include "AliTRDtrackerV1.h"
-#include "AliTRDcluster.h"
#include "AliTRDrecoParam.h"
#include <cstdlib>
#include <cerrno>
#include <string>
-// this is a global object used for automatic component registration, do not use this
-AliHLTTRDTrackerV1Component gAliHLTTRDTrackerV1Component;
-
-ClassImp(AliHLTTRDTrackerV1Component);
-
-AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component()
- : AliHLTProcessor()
- , fOutputPercentage(100) // By default we copy to the output exactly what we got as input
- , fStrorageDBpath("local://$ALICE_ROOT")
- , fCDB(NULL)
- , fField(NULL)
- , fGeometryFileName("")
- , fGeometryFile(NULL)
- , fGeoManager(NULL)
- , fTracker(NULL)
- , fRecoParam(NULL)
+using namespace std;
+
+ClassImp(AliHLTTRDTrackerV1Component)
+
+void AliHLTTRDTrackerV1Component::AliHLTTRDESDEvent::CreateStdContent()
+{
+ TClonesArray* tracksArray = new TClonesArray("AliESDtrack",0);
+ tracksArray->SetName(AliESDEvent::fgkESDListName[AliESDEvent::kTracks]);
+ AddObject(tracksArray);
+ GetStdContent();
+}
+
+void AliHLTTRDTrackerV1Component::AliHLTTRDESDEvent::Streamer(TBuffer &/*R__b*/)
+{
+ AliFatal("class is for internal us only and not for streaming");
+}
+
+AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component():
+ AliHLTProcessor(),
+ fOutputPercentage(100), // By default we copy to the output exactly what we got as input
+ fTracker(NULL),
+ fRecoParam(NULL),
+ fReconstructor(NULL),
+ fESD(NULL),
+ fClusterArray(NULL),
+ fRecoParamType(-1),
+ fNtimeBins(-1),
+ fPIDmethod(1),
+ fgeometryFileName(""),
+ fHLTflag(kTRUE),
+ fOutputV1Tracks(kTRUE),
+ fHighLevelOutput(kFALSE),
+ fEmulateHLTTracks(kFALSE),
+ fImproveTracklets(kFALSE)
{
// Default constructor
- fGeometryFileName = getenv("ALICE_ROOT");
- fGeometryFileName += "/HLT/TRD/geometry.root";
}
AliHLTTRDTrackerV1Component::~AliHLTTRDTrackerV1Component()
{
// Get the list of input data
list.clear(); // We do not have any requirements for our input data type(s).
- list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
+ list.push_back(AliHLTTRDDefinitions::fgkClusterDataType);
}
-AliHLTComponent_DataType AliHLTTRDTrackerV1Component::GetOutputDataType()
+AliHLTComponentDataType AliHLTTRDTrackerV1Component::GetOutputDataType()
{
// Get the output data type
- return AliHLTTRDDefinitions::fgkClusterDataType;
+ return kAliHLTMultipleDataType;
+}
+
+int AliHLTTRDTrackerV1Component::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+{
+ // Get the output data types
+ tgtList.clear();
+ tgtList.push_back(kAliHLTDataTypeTrack | kAliHLTDataOriginTRD);
+ tgtList.push_back(AliHLTTRDDefinitions::fgkTracksDataType);
+ return tgtList.size();
}
void AliHLTTRDTrackerV1Component::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
{
// Get the output data size
constBase = 0;
- inputMultiplier = ((double)fOutputPercentage)/100.0;
+ inputMultiplier = fOutputV1Tracks ? 2*((double)fOutputPercentage)/100.0 : 0.5*((double)fOutputPercentage)/100.0;
+ if(sizeof(AliHLTTRDClustersArray::cluster_type) == sizeof(AliHLTTRDCluster)) inputMultiplier *= 28.0/8;
}
// Spawn function, return new instance of this class
AliHLTComponent* AliHLTTRDTrackerV1Component::Spawn()
{
- // Spawn function, return new instance of this class
return new AliHLTTRDTrackerV1Component;
};
+
int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv )
{
// perform initialization. We check whether our relative output size is specified in the arguments.
- fOutputPercentage = 100;
- int i = 0;
- char* cpErr;
+ int iResult=0;
- Int_t iRecoParamType = -1; // default will be the low flux
- Int_t iNtimeBins = -1; // number of time bins for the tracker to use
- Int_t iMagneticField = -1; // magnetic field: 0==OFF and 1==ON
+ fReconstructor = new AliTRDReconstructor();
+ HLTDebug("TRDReconstructor at 0x%x", fReconstructor);
+ fESD = new AliHLTTRDESDEvent();
+ fESD->CreateStdContent();
- while ( i < argc )
- {
- Logging( kHLTLogDebug, "HLT::TRDTrackerV1::DoInit", "Arguments", "argv[%d] == %s", i, argv[i] );
- if ( !strcmp( argv[i], "output_percentage" ) )
- {
- if ( i+1>=argc )
- {
- Logging(kHLTLogError, "HLT::TRDTrackerV1::DoInit", "Missing Argument", "Missing output_percentage parameter");
- return ENOTSUP;
- }
- Logging( kHLTLogDebug, "HLT::TRDTrackerV1::DoInit", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
- fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
- if ( *cpErr )
- {
- Logging(kHLTLogError, "HLT::TRDTrackerV1::DoInit", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
- return EINVAL;
- }
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoInit", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
- i += 2;
- continue;
- }
+ TString configuration="";
+ TString argument="";
+ for (int i=0; i<argc && iResult>=0; i++) {
+ argument=argv[i];
+ if (!configuration.IsNull()) configuration+=" ";
+ configuration+=argument;
+ }
- if ( !strcmp( argv[i], "-NTimeBins" ) )
- {
- if ( i+1>=argc )
- {
- HLTError("Missing -NTimeBins parameter");
- return ENOTSUP;
- }
- HLTDebug("Arguments", "argv[%d+1] == %s", i, argv[i+1] );
- iNtimeBins = strtoul( argv[i+1], &cpErr, 0 );
- if ( *cpErr )
- {
- HLTError("Wrong Argument. Cannot convert -NTimeBins parameter '%s'", argv[i+1] );
- return EINVAL;
- }
- i += 2;
- continue;
- }
+ if (!configuration.IsNull()) {
+ iResult=Configure(configuration.Data());
+ } else {
+ iResult=Reconfigure(NULL, NULL);
+ }
- if ( strcmp( argv[i], "-cdb" ) == 0)
- {
- if ( i+1 >= argc )
- {
- Logging(kHLTLogError, "HLT::TRDTrackerV1::DoInit", "Missing Argument", "Missing -cdb argument");
- return ENOTSUP;
- }
- fStrorageDBpath = argv[i+1];
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoInit", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );
- i += 2;
- continue;
- }
+ if(iResult<0) return iResult;
- if ( strcmp( argv[i], "-geometry" ) == 0)
- {
- if ( i+1 >= argc )
- {
- Logging(kHLTLogError, "HLT::TRDTrackerV1::DoInit", "Missing Argument", "Missing -geometry argument");
- return ENOTSUP;
- }
- fGeometryFileName = argv[i+1];
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoInit", "GeomFile storage set", "GeomFile storage is %s",
- fGeometryFileName.c_str() );
- i += 2;
- continue;
- }
+ fTracker = new AliTRDtrackerV1();
+ HLTDebug("TRDTracker at 0x%x", fTracker);
+ fTracker->SetReconstructor(fReconstructor);
- // the flux parametrizations
- if ( strcmp( argv[i], "-lowflux" ) == 0)
- {
- iRecoParamType = 0;
- HLTDebug("Low flux reco selected.");
- i++;
- continue;
- }
-
- if ( strcmp( argv[i], "-highflux" ) == 0)
- {
- iRecoParamType = 1;
- HLTDebug("Low flux reco selected.");
- i++;
- continue;
- }
-
- if ( strcmp( argv[i], "-magnetic_field_ON" ) == 0)
- {
- iMagneticField = 1;
- i++;
- continue;
- }
+ fClusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
- if ( strcmp( argv[i], "-magnetic_field_OFF" ) == 0)
- {
- iMagneticField = 0;
- i++;
- continue;
- }
+ return iResult;
+}
- Logging(kHLTLogError, "HLT::TRDTrackerV1::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
- return EINVAL;
- }
+int AliHLTTRDTrackerV1Component::DoDeinit()
+{
+ // Deinitialization of the component
- // THE "REAL" INIT COMES HERE
- // offline condition data base
- fCDB = AliCDBManager::Instance();
- if (!fCDB)
- {
- Logging(kHLTLogError, "HLT::TRDCalibration::DoInit", "Could not get CDB instance", "fCDB 0x%x", fCDB);
- return -1;
- }
- else
- {
- fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
- fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
- Logging(kHLTLogDebug, "HLT::TRDCalibration::DoInit", "CDB instance", "fCDB 0x%x", fCDB);
- }
+ fTracker->SetClustersOwner(kFALSE);
+ delete fTracker;
+ fTracker = NULL;
- // check if the N of time bins make sense
- if (iNtimeBins <= 0)
- {
- HLTError("Sorry. Tracker needs number of time bins. At the moment you have to provide it with -NTimeBins <value>. The simulation always had 24 and the real data 30. Take your pick. Make sure the information is correct. Ask offline to implement how to propagate this information into clusters/cluster tree.");
- return -1;
- }
+ fClusterArray->Delete();
+ delete fClusterArray;
+ fClusterArray = NULL;
+
+ // We need to set clusters in Reconstructor to null to prevent from
+ // double deleting, since we delete TClonesArray by ourself.
+ //fReconstructor->SetClusters(0x0);
+ delete fReconstructor;
+ fReconstructor = NULL;
+ delete fESD;
+ fESD = NULL;
+
+ AliTRDcalibDB::Terminate();
- if (iNtimeBins < 24 || iNtimeBins > 30)
- {
- HLTWarning("The number of time bins seems to be strange = %d. But okay. Let's try it...", iNtimeBins);
- }
+ return 0;
+}
- HLTDebug("The number of time bins = %d.", iNtimeBins);
- AliTRDtrackerV1::SetNTimeBins(iNtimeBins);
+int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponent_TriggerData& /*trigData*/,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ vector<AliHLTComponent_BlockData>& outputBlocks )
+{
+ // Process an event
- // !!!! THIS IS IMPORTANT
- // init alifield map - temporarly via parameter - should come from a DB or DCS ?
- // !!!!
- if (iMagneticField < 0)
- {
- iMagneticField = 0;
- HLTWarning("No magnetic field switch stated. Use -magnetic_field_ON or -magnetic_field_OFF flag. Defaulting to OFF = NO MAGNETIC FIELD");
- }
+ HLTDebug("NofBlocks %i", evtData.fBlockCnt );
- if (iMagneticField == 0)
- {
- // magnetic field OFF
- fField = new AliMagFMaps("Maps","Maps", 2, 0., 10., 1);
- HLTDebug("Magnetic field is OFF.");
- }
+ AliHLTUInt32_t totalSize = 0, offset = 0;
- if (iMagneticField == 1)
+ AliHLTComponentDataType expectedDataType = AliHLTTRDDefinitions::fgkClusterDataType;
+ for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
{
- // magnetic field ON
- fField = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
- HLTDebug("Magnetic field is ON.");
- }
+ const AliHLTComponentBlockData &block = blocks[iBlock];
+ AliHLTComponentDataType inputDataType = block.fDataType;
- if (fField == 0)
- {
- HLTError("Unable to init the field. Trouble at this point.");
- return -1;
- }
+ if(inputDataType != expectedDataType)
+ {
+ HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - Skipping",
+ iBlock, evtData.fBlockCnt-1,
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text(inputDataType).c_str());
+ continue;
+ }
+ else {
+ HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s; Block Size: %i",
+ iBlock, evtData.fBlockCnt-1,
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text(inputDataType).c_str(),
+ block.fSize);
+ }
+
+#ifndef NDEBUG
+ unsigned long constBase;
+ double inputMultiplier;
+ GetOutputDataSize(constBase,inputMultiplier);
+ if(size<(constBase+block.fSize*inputMultiplier)){
+ HLTWarning("Memory Block given might be too small: %i < %f; Event %Lu", size, constBase+block.fSize*inputMultiplier, evtData.fEventID);
+ }
+#endif
- // kTRUE sets the map uniform
- AliTracker::SetFieldMap(fField,kTRUE);
+ fESD->Reset();
+ //fESD->SetMagneticField(GetBz());
- // reconstruction parameters
- if (iRecoParamType < 0 || iRecoParamType > 1)
- {
- HLTWarning("No reco param selected. Use -lowflux or -highflux flag. Defaulting to low flux.");
- iRecoParamType = 0;
- }
+ AliHLTTRDUtils::ReadClusters(fClusterArray, block.fPtr, block.fSize, &fNtimeBins);
+ HLTDebug("Reading number of time bins from input block. Setting number of timebins to %d", fNtimeBins);
+ AliTRDtrackerV1::SetNTimeBins(fNtimeBins);
- if (iRecoParamType == 0)
- {
- fRecoParam = AliTRDrecoParam::GetLowFluxParam();
- HLTDebug("Low flux params init.");
- }
+ HLTDebug("TClonesArray of clusters: nbEntries = %i", fClusterArray->GetEntriesFast());
+ fTracker->LoadClusters(fClusterArray);
- if (iRecoParamType == 1)
- {
- fRecoParam = AliTRDrecoParam::GetHighFluxParam();
- HLTDebug("High flux params init.");
- }
+ fTracker->Clusters2Tracks(fESD);
- if (fRecoParam == 0)
- {
- HLTError("No reco params initialized. Sniffing big trouble!");
- return -1;
- }
+ Int_t nTracks = fESD->GetNumberOfTracks();
+ HLTInfo("Number of tracks == %d ==", nTracks);
- // this is important in case we want to ::PropagateBack - see the TrackerV1.cxx
- fRecoParam->SetSeedingOn(kTRUE);
- // no debug stream -> no debug files! on HLT
- fRecoParam->SetStreamLevel(0);
-
- AliTRDReconstructor::SetRecoParam(fRecoParam);
-
- // geometry:
- // for some unknown at this point reason (30th of April 2008)
- // the TrackerV1 initializes new TRDgeometry in the constructor
- // we avoid it here
- fGeometryFile = 0;
- // fGeometryFile = TFile::Open(fGeometryFileName.c_str());
- // if (fGeometryFile)
- // {
- // fGeoManager = (TGeoManager *)fGeometryFile->Get("Geometry");
- // // for the old tracker we would do this:
- // fTracker = new AliTRDtracker(fGeometryFile);
- // }
- // else
- // {
- // Logging(kHLTLogError, "HLT::TRDTrackerV1::DoInit", "fGeometryFile", "Unable to open file. FATAL!");
- // return -1;
- // }
-
- // create the tracker
- fTracker = new AliTRDtrackerV1();
- HLTDebug("TRDTracker at 0x%x", fTracker);
+ TClonesArray* trdTracks;
+ trdTracks = fTracker->GetListOfTracks();
+
+ if(fHighLevelOutput){
+ if(fEmulateHLTTracks && trdTracks){
+ // TClonesArray* oldArr = trdTracks;
+ trdTracks = new TClonesArray(*trdTracks);
+ AliHLTTRDUtils::EmulateHLTTracks(trdTracks);
+ // if(oldArr->At(0)){
+ // HLTInfo("Old Track:");
+ // ((AliTRDtrackV1*)oldArr->At(0))->Print("a");
+ // HLTInfo("\nNew Track:");
+ // ((AliTRDtrackV1*)trdTracks->At(0))->Print("a");
+ // }
+ }
- if (fTracker == 0)
- {
- HLTError("Unable to create the tracker!");
- // do we want a smarter return value here? probably yes
- // answering your own questions is stupid but maybe helpful... ;)
- return -1;
- }
+ TObjString strg;
+ strg.String() += fNtimeBins;
+ if(trdTracks)
+ PushBack(trdTracks, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, block.fSpecification);
+ else{
+ TClonesArray temp("AliTRDtrackV1");
+ PushBack(&temp, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, block.fSpecification);
+ }
+ PushBack(&strg, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, block.fSpecification);
+ if(fEmulateHLTTracks && trdTracks){
+ trdTracks->Delete();
+ delete trdTracks;
+ }
+ }
+ else if(nTracks>0){
+ HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", fESD, nTracks);
+ AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, outputPtr+offset);
+ totalSize += addedSize;
+
+ // Fill block
+ AliHLTComponentBlockData bd;
+ FillBlockData( bd );
+ //bd.fPtr = outputPtr;
+ bd.fOffset = offset;
+ bd.fSize = addedSize;
+ bd.fSpecification = block.fSpecification;
+ bd.fDataType = kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
+ outputBlocks.push_back( bd );
+ HLTDebug("BD ptr 0x%x, offset %i, size %i, datav1Type %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), bd.fSpecification);
+ offset = totalSize;
+
+ if (fOutputV1Tracks && trdTracks){
+ HLTDebug("We have an output array: pointer to trdTracks = 0x%x, nbEntries = %i", trdTracks, trdTracks->GetEntriesFast());
+
+ addedSize = AliHLTTRDUtils::AddTracksToOutput(trdTracks, outputPtr+offset, fNtimeBins);
+ totalSize += addedSize;
+
+ // Fill block
+ FillBlockData( bd );
+ //bd.fPtr = outputPtr;
+ bd.fOffset = offset;
+ bd.fSize = addedSize;
+ bd.fSpecification = block.fSpecification;
+ bd.fDataType = AliHLTTRDDefinitions::fgkTracksDataType;
+ outputBlocks.push_back( bd );
+ HLTDebug("BD ptr 0x%x, offset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), bd.fSpecification);
+ offset = totalSize;
+ }
+ }
+
+ HLTDebug("totalSize: %i", totalSize);
+
+// if ( totalSize > allocSize )
+// {
+// HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
+// totalSize, size );
+// return EMSGSIZE;
+// }
+
+ //here we are deleting clusters (but not the TClonesArray itself)
+ fTracker->UnloadClusters();
+ //AliTRDReconstructor::SetClusters(0x0);
+ fClusterArray->Delete();
+
+ }
+
+ size = totalSize;
+ HLTDebug("Event is done. size written to the output is %i", size);
return 0;
}
-int AliHLTTRDTrackerV1Component::DoDeinit()
-{
- // Deinitialization of the component
-
- delete fField;
- fField = 0;
-
- delete fTracker;
- fTracker = 0;
+int AliHLTTRDTrackerV1Component::Configure(const char* arguments){
+ int iResult=0;
+ if (!arguments) return iResult;
- if (fGeometryFile)
- {
- fGeometryFile->Close();
- delete fGeometryFile;
- fGeometryFile = 0;
+ TString allArgs=arguments;
+ TString argument;
+ int bMissingParam=0;
+
+ TObjArray* pTokens=allArgs.Tokenize(" ");
+ if (pTokens) {
+ for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+ argument=((TObjString*)pTokens->At(i))->GetString();
+ if (argument.IsNull()) continue;
+
+ if (argument.CompareTo("output_percentage")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ HLTInfo("Setting output percentage to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+ fOutputPercentage=((TObjString*)pTokens->At(i))->GetString().Atoi();
+ continue;
+ }
+ else if (argument.CompareTo("-solenoidBz")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
+ continue;
+ }
+ else if (argument.CompareTo("-geometry")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ HLTInfo("Setting geometry to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+ fgeometryFileName=((TObjString*)pTokens->At(i))->GetString();
+ continue;
+ }
+ else if (argument.CompareTo("-lowflux")==0) {
+ fRecoParamType = 0;
+ HLTInfo("Low flux reconstruction selected");
+ continue;
+ }
+ else if (argument.CompareTo("-highflux")==0) {
+ fRecoParamType = 1;
+ HLTInfo("High flux reconstruction selected");
+ continue;
+ }
+ else if (argument.CompareTo("-cosmics")==0) {
+ fRecoParamType = 2;
+ HLTInfo("Cosmics reconstruction selected");
+ continue;
+ }
+ else if (argument.CompareTo("-HLTflag")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+ if (toCompareTo.CompareTo("yes")==0){
+ HLTInfo("Setting HLTflag to: %s", toCompareTo.Data());
+ fHLTflag=kTRUE;
+ }
+ else if (toCompareTo.CompareTo("no")==0){
+ HLTInfo("Setting HLTflag to: %s", toCompareTo.Data());
+ fHLTflag=kFALSE;
+ }
+ else {
+ HLTError("unknown argument for HLTflag: %s", toCompareTo.Data());
+ iResult=-EINVAL;
+ break;
+ }
+ continue;
+ }
+ else if (argument.CompareTo("-outputV1Tracks")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+ if (toCompareTo.CompareTo("yes")==0){
+ HLTInfo("Setting OutputV1Tracks to: %s", toCompareTo.Data());
+ fOutputV1Tracks=kTRUE;
+ }
+ else if (toCompareTo.CompareTo("no")==0){
+ HLTInfo("Setting OutputV1Tracks to: %s", toCompareTo.Data());
+ fOutputV1Tracks=kFALSE;
+ }
+ else {
+ HLTError("unknown argument for OutputV1Tracks: %s", toCompareTo.Data());
+ iResult=-EINVAL;
+ break;
+ }
+ continue;
+ }
+ else if (argument.CompareTo("-highLevelOutput")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+ if (toCompareTo.CompareTo("yes")==0){
+ HLTWarning("Setting highLevelOutput to: %s", toCompareTo.Data());
+ fHighLevelOutput=kTRUE;
+ }
+ else if (toCompareTo.CompareTo("no")==0){
+ HLTInfo("Setting highLevelOutput to: %s", toCompareTo.Data());
+ fHighLevelOutput=kFALSE;
+ }
+ else {
+ HLTError("unknown argument for highLevelOutput: %s", toCompareTo.Data());
+ iResult=-EINVAL;
+ break;
+ }
+ continue;
+ }
+ else if (argument.CompareTo("-emulateHLToutput")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+ if (toCompareTo.CompareTo("yes")==0){
+ HLTWarning("Setting emulateHLToutput to: %s", toCompareTo.Data());
+ fEmulateHLTTracks=kTRUE;
+ }
+ else if (toCompareTo.CompareTo("no")==0){
+ HLTInfo("Setting emulateHLToutput to: %s", toCompareTo.Data());
+ fEmulateHLTTracks=kFALSE;
+ }
+ else {
+ HLTError("unknown argument for emulateHLToutput: %s", toCompareTo.Data());
+ iResult=-EINVAL;
+ break;
+ }
+ continue;
+ }
+ else if (argument.CompareTo("-PIDmethod")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+ if (toCompareTo.CompareTo("LH")==0){
+ HLTInfo("Setting PID method to: %s", toCompareTo.Data());
+ fPIDmethod=0;
+ }
+ else if (toCompareTo.CompareTo("NN")==0){
+ HLTInfo("Setting PID method to: %s", toCompareTo.Data());
+ fPIDmethod=1;
+ }
+ else if (toCompareTo.CompareTo("TM")==0){
+ HLTInfo("Setting PID method to: %s", toCompareTo.Data());
+ fPIDmethod=2;
+ }
+ else {
+ HLTError("unknown argument for PID method: %s", toCompareTo.Data());
+ iResult=-EINVAL;
+ break;
+ }
+ continue;
+ }
+
+ else {
+ HLTError("unknown argument: %s", argument.Data());
+ iResult=-EINVAL;
+ break;
+ }
}
-
- return 0;
+ delete pTokens;
+ }
+ if (bMissingParam) {
+ HLTError("missing parameter for argument %s", argument.Data());
+ iResult=-EINVAL;
+ }
+ if(iResult>=0){
+ iResult=SetParams();
+ }
+ return iResult;
}
-int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData & evtData,
- AliHLTComponentTriggerData & trigData )
+int AliHLTTRDTrackerV1Component::SetParams()
{
- // Process an event
-
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoEvent", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoEvent", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
-
- AliHLTUInt32_t dBlockSpecification = 0;
-
- //implement a usage of the following
- // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
- // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
- // void *triggerData = trigData.fData;
- Logging( kHLTLogDebug, "HLT::TRDTrackerV1::DoEvent", "Trigger data received",
- "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
-
- AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkClusterDataType );
- if (dblock != 0)
- {
- dBlockSpecification = dblock->fSpecification;
+ Int_t iResult=0;
+ if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
+ HLTError("DefaultStorage is not set in CDBManager");
+ return -EINVAL;
+ }
+ if(AliCDBManager::Instance()->GetRun()<0){
+ HLTError("Run Number is not set in CDBManager");
+ return -EINVAL;
+ }
+ HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun());
+
+ if(!AliGeomManager::GetGeometry()){
+ if(fgeometryFileName.CompareTo("")==0 || !TFile::Open(fgeometryFileName.Data())){
+ HLTInfo("Loading standard geometry file");
+ AliGeomManager::LoadGeometry();
+ }else{
+ HLTWarning("Loading NON-standard geometry file");
+ AliGeomManager::LoadGeometry(fgeometryFileName.Data());
}
- else
- {
- Logging( kHLTLogWarning, "HLT::TRDTrackerV1::DoEvent", "DATAIN", "First Input Block not found! 0x%x", dblock);
- return -1;
+ if(!AliGeomManager::GetGeometry()){
+ HLTError("Could not load geometry");
+ return -EINVAL;
}
-
- int ibForce = 0;
+ HLTInfo("Applying Alignment from CDB object");
+ AliGeomManager::ApplyAlignObjsFromCDB("TRD");
+ }
+ else{
+ HLTInfo("Geometry Already Loaded!");
+ }
- TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkClusterDataType, "TTree", ibForce);
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoEvent", "1stBLOCK", "Pointer = 0x%x", tobjin);
-
- TTree *clusterTree = (TTree*)tobjin;
- if (!clusterTree)
- {
- Logging( kHLTLogWarning, "HLT::TRDTrackerV1::DoEvent", "DATAIN", "First Input Block not a tree! 0x%x", tobjin);
- return -1;
- }
-
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoEvent", "1stBLOCK", "Pointer = 0x%x Name = %s", clusterTree, clusterTree->GetName());
-
- while (tobjin != 0)
- {
- if (clusterTree)
+ if(fReconstructor->GetRecoParam()){
+ fRecoParam = new AliTRDrecoParam(*fReconstructor->GetRecoParam());
+ HLTInfo("RecoParam already set!");
+ }else{
+ if(fRecoParamType == 0){
+#ifndef HAVE_NOT_ALITRD_RECOPARAM_r41621
+ if(fHLTflag){
+ HLTInfo("Low flux HLT params init.");
+ fRecoParam = AliTRDrecoParam::GetLowFluxHLTParam();
+ }else
+#endif
{
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoEvent", "CLUSTERS", "Pointer = 0x%x Name = %s", clusterTree, clusterTree->GetName());
- Int_t iNentries = clusterTree->GetEntries();
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoEvent", "COUNT", "N of tree entries = %d", iNentries);
- fTracker->LoadClusters(clusterTree);
+ HLTInfo("Low flux params init.");
+ fRecoParam = AliTRDrecoParam::GetLowFluxParam();
}
- else
+ }
+ if(fRecoParamType == 1){
+#ifndef HAVE_NOT_ALITRD_RECOPARAM_r41621
+ if(fHLTflag){
+ HLTInfo("High flux HLT params init.");
+ fRecoParam = AliTRDrecoParam::GetHighFluxHLTParam();
+ }else
+#endif
{
- Logging( kHLTLogError, "HLT::TRDTrackerV1::DoEvent", "CLUSTERS", "Tree Pointer = 0x%x", clusterTree);
+ HLTInfo("High flux params init.");
+ fRecoParam = AliTRDrecoParam::GetHighFluxParam();
}
+ }
+ if(fRecoParamType == 2){
+ HLTInfo("Cosmic Test params init.");
+ fRecoParam = AliTRDrecoParam::GetCosmicTestParam();
+ }
+ }
- tobjin = (TObject *)GetNextInputObject( ibForce );
- Logging( kHLTLogInfo, "HLT::TRDTrackerV1::DoEvent", "nextBLOCK", "Pointer = 0x%x", tobjin);
- clusterTree = (TTree*)tobjin;
+ if(!fRecoParam)
+ {
+ HLTError("No reco params initialized. Sniffing big trouble!");
+ return -EINVAL;
}
- // maybe it is not so smart to create it each event? clear is enough ?
- AliESDEvent *esd = new AliESDEvent();
- esd->CreateStdContent();
+ switch(fPIDmethod){
+ case 0: fRecoParam->SetPIDNeuralNetwork(kFALSE); break;
+ case 1: fRecoParam->SetPIDNeuralNetwork(kTRUE); break;
+ case 2: fRecoParam->SetPIDNeuralNetwork(kFALSE); break;
+ }
- fTracker->Clusters2Tracks(esd);
- // not necessary...
- //fTracker->PropagateBack(esd);
+ fRecoParam->SetImproveTracklets(fImproveTracklets);
- //here transport the esd tracks further
- Int_t nTracks = esd->GetNumberOfTracks();
- Int_t nTRDTracks = esd->GetNumberOfTrdTracks();
- HLTInfo("Number of tracks %d Number of TRD tracks %d", nTracks, nTRDTracks);
- //esd->Print();
- PushBack(esd, AliHLTTRDDefinitions::fgkTRDSAEsdDataType);
+ fRecoParam->SetStreamLevel(AliTRDrecoParam::kTracker, 0);
+ fReconstructor->SetRecoParam(fRecoParam);
- // extract the friend ?
- // AliESDfriend *esdFriend = new AliESDfriend();
- // esd->GetESDfriend(esdFriend);
- // PushBack(esdFriend, AliHLTTRDDefinitions::fgkTRDSAEsdDataType);
- // delete esdFriend;
+ TString recoOptions="sa,!cw";
+
+ if(fHLTflag)
+ recoOptions += ",hlt";
- //HLTInfo("now deleting");
- delete esd;
+ HLTDebug("Reconstructor options are: %s",recoOptions.Data());
+ fReconstructor->SetOption(recoOptions.Data());
- delete clusterTree;
- fTracker->UnloadClusters();
+ return iResult;
+}
+
+int AliHLTTRDTrackerV1Component::Reconfigure(const char* cdbEntry, const char* chainId)
+{
+ // see header file for class documentation
+
+ int iResult=0;
+ const char* path="HLT/ConfigTRD/TrackerV1Component";
+ const char* defaultNotify="";
+ if (cdbEntry) {
+ path=cdbEntry;
+ defaultNotify=" (default)";
+ }
+ if (path) {
+ HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+ AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+ if (pEntry) {
+ TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+ if (pString) {
+ HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
+ iResult=Configure(pString->GetString().Data());
+ } else {
+ HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+ }
+ } else {
+ HLTError("cannot fetch object \"%s\" from CDB", path);
+ }
+ }
+
+ return iResult;
- HLTDebug("Event done.");
- return 0;
}
-///////////////////////////////
-/*
- consider transporting TRD tracks only as they might have signigicantly smaller size... on the other hand you will need to prodece ESDs at some point...
-
-// this is for ESDtrack
-// for (Int_t it = 0; it < nTracks; it++)
-// {
-// AliESDtrack* track = esd->GetTrack(it);
-// HLTInfo("Track %d 0x%x Pt %1.2f", it, track, track->Pt());
-// //PushBack(track, AliHLTTRDDefinitions::fgkTRDSATracksDataType, ++dBlockSpecification);
-// PushBack(track, AliHLTTRDDefinitions::fgkTRDSATracksDataType);
-// }
-
-// one can do similar things with the TRDtrack
-esd->GetNumberOfTrdTracks();
-and then
-for (i;;)
-AliESDTrdTrack *trdtrack = esd->GetTrdTrack(i)
-*/
+int AliHLTTRDTrackerV1Component::ReadPreprocessorValues(const char* modules)
+{
+ // see header file for class documentation
+
+ int iResult = 0;
+ TString str(modules);
+ if(str.Contains("HLT") || str.Contains("TRD") || str.Contains("GRP")){
+
+ }
+ return iResult;
+}
+void AliHLTTRDTrackerV1Component::GetOCDBObjectDescription(TMap* const targetMap){
+ // Get a list of OCDB object description needed for the particular component
+ if (!targetMap) return;
+ targetMap->Add(new TObjString("HLT/ConfigTRD/TrackerV1Component"), new TObjString("component arguments"));
+ targetMap->Add(new TObjString("TRD/Calib/ChamberGainFactor"), new TObjString("gain factor of chambers"));
+ targetMap->Add(new TObjString("TRD/Calib/ChamberT0"), new TObjString("T0 of chambers"));
+ targetMap->Add(new TObjString("TRD/Calib/ChamberVdrift"), new TObjString("drift velocity of chambers"));
+ targetMap->Add(new TObjString("TRD/Calib/DetNoise"), new TObjString("noise of chambers"));
+ targetMap->Add(new TObjString("TRD/Calib/LocalGainFactor"), new TObjString("per pad gain factor"));
+ targetMap->Add(new TObjString("TRD/Calib/LocalT0"), new TObjString("per pad T0"));
+ targetMap->Add(new TObjString("TRD/Calib/LocalVdrift"), new TObjString("per pad drift velocity"));
+ targetMap->Add(new TObjString("TRD/Calib/PadNoise"), new TObjString("per pad noise"));
+ targetMap->Add(new TObjString("TRD/Calib/PadStatus"), new TObjString("pad status"));
+ targetMap->Add(new TObjString("TRD/Calib/PRFWidth"), new TObjString("pad response function"));
+ targetMap->Add(new TObjString("TRD/Calib/ChamberStatus"), new TObjString("status of chambers"));
+ targetMap->Add(new TObjString("TRD/Calib/PIDLQ"), new TObjString("likelyhood PID"));
+ targetMap->Add(new TObjString("TRD/Calib/PIDNN"), new TObjString("neuronal network PID"));
+ targetMap->Add(new TObjString("TRD/Calib/PIDThresholds"), new TObjString("threshold for PID"));
+}