3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * for The ALICE Off-line Project. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 /** @file AliHLTTRDTrackerComponent.cxx
20 @author Timm Steinbeck, Matthias Richter
22 @brief A TRDTracker processing component for the HLT. */
30 #include "AliHLTTRDTrackerComponent.h"
31 #include "AliHLTTRDDefinitions.h"
32 #include "AliCDBManager.h"
34 #include "AliTRDclusterizerV1HLT.h"
35 #include "AliTRDReconstructor.h"
37 #include "AliTRDtrackerHLT.h"
38 #include "AliTRDCalibraFillHisto.h"
39 #include "AliMagFMaps.h"
40 #include "AliTRDcluster.h"
41 #include "TObjArray.h"
47 // this is a global object used for automatic component registration, do not use this
48 AliHLTTRDTrackerComponent gAliHLTTRDTrackerComponent;
50 ClassImp(AliHLTTRDTrackerComponent);
52 AliHLTTRDTrackerComponent::AliHLTTRDTrackerComponent()
54 fOutputPercentage = 100; // By default we copy to the output exactly what we got as input
56 fStrorageDBpath = "local://$ALICE_ROOT";
57 fCDB = AliCDBManager::Instance();
58 //fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
61 fGeometryFileName = getenv("ALICE_ROOT");
62 fGeometryFileName += "/HLT/TRD/geometry.root";
65 AliHLTTRDTrackerComponent::~AliHLTTRDTrackerComponent()
69 const char* AliHLTTRDTrackerComponent::GetComponentID()
71 return "TRDTracker"; // The ID of this component
74 void AliHLTTRDTrackerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
76 list.clear(); // We do not have any requirements for our input data type(s).
77 list.push_back( AliHLTTRDDefinitions::gkClusterDataType );
80 AliHLTComponent_DataType AliHLTTRDTrackerComponent::GetOutputDataType()
82 return AliHLTTRDDefinitions::gkClusterDataType;
85 void AliHLTTRDTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
88 inputMultiplier = ((double)fOutputPercentage)/100.0;
91 // Spawn function, return new instance of this class
92 AliHLTComponent* AliHLTTRDTrackerComponent::Spawn()
94 return new AliHLTTRDTrackerComponent;
97 int AliHLTTRDTrackerComponent::DoInit( int argc, const char** argv )
99 // perform initialization. We check whether our relative output size is specified in the arguments.
100 fOutputPercentage = 100;
105 Logging( kHLTLogDebug, "HLT::TRDTracker::DoInit", "Arguments", "argv[%d] == %s", i, argv[i] );
106 if ( !strcmp( argv[i], "output_percentage" ) )
110 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Missing Argument", "Missing output_percentage parameter");
113 Logging( kHLTLogDebug, "HLT::TRDTracker::DoInit", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
114 fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
117 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
120 Logging( kHLTLogInfo, "HLT::TRDTracker::DoInit", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
125 if ( strcmp( argv[i], "-cdb" ) == 0)
129 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Missing Argument", "Missing -cdb argument");
132 fStrorageDBpath = argv[i+1];
133 Logging( kHLTLogInfo, "HLT::TRDTracker::DoInit", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );
134 fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
139 if ( strcmp( argv[i], "-geometry" ) == 0)
143 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Missing Argument", "Missing -geometry argument");
146 fGeometryFileName = argv[i+1];
147 Logging( kHLTLogInfo, "HLT::TRDTracker::DoInit", "GeomFile storage set", "GeomFile storage is %s",
148 fGeometryFileName.c_str() );
153 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
157 fClusterizer = new AliTRDclusterizerV1HLT("TRCclusterizer", "TRCclusterizer");
159 //init alifield map - temporarly fixed - should come from a DB
160 fField = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
162 AliTracker::SetFieldMap(fField,1);
164 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Field", "Unable to init the field");
166 fGeometryFile = TFile::Open(fGeometryFileName.c_str());
169 fGeoManager = (TGeoManager *)fGeometryFile->Get("Geometry");
170 fTracker = new AliTRDtrackerHLT(fGeometryFile);
174 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "fGeometryFile", "Unable to open file. FATAL!");
178 AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance();
181 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Calibration Histos", "::Instance failed");
186 calibra->SetMITracking(kTRUE);
187 calibra->Init2Dhistos();
193 int AliHLTTRDTrackerComponent::DoDeinit()
205 fGeometryFile->Close();
206 delete fGeometryFile;
209 AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance();
219 int AliHLTTRDTrackerComponent::DoEvent( const AliHLTComponentEventData & evtData,
220 AliHLTComponentTriggerData & trigData )
222 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
223 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
225 AliHLTUInt32_t fDblock_Specification = 0;
227 AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::gkClusterDataType );
230 fDblock_Specification = dblock->fSpecification;
234 Logging( kHLTLogWarning, "HLT::TRDTracker::DoEvent", "DATAIN", "First Input Block not found! 0x%x", dblock);
239 TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::gkClusterDataType, "TObjArray", ibForce);
240 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "1stBLOCK", "Pointer = 0x%x", tobjin);
242 // int iTotalClusterCounter = 0;
245 TObjArray *clusters = (TObjArray *)tobjin;
248 //put back to the clusterizers tree
249 Int_t iSuggestedDet = -1; // take the det number from the first cluster
250 Bool_t kInsert = kFALSE;
251 if (clusters->GetEntries() > 0)
253 AliTRDcluster *cl = (AliTRDcluster*)clusters->At(0);
254 iSuggestedDet = cl->GetDetector();
255 kInsert = fClusterizer->InsertClusters(clusters, iSuggestedDet);
256 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "TOTREE", "Result = %d", kInsert);
259 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "CLUSTERS", "Pointer = 0x%x", clusters);
260 // //dump the clusters to the log files
261 // for (Int_t ic = 0; ic < clusters->GetEntries(); ic++)
263 // AliTRDcluster *cl = (AliTRDcluster*)clusters->At(ic);
264 // Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "CLUSTER", "%d : %d : Q = %1.2f",
265 // iTotalClusterCounter, ic, cl->GetQ());
266 // iTotalClusterCounter++;
269 //Pass the data further...
270 //PushBack(clusters, AliHLTTRDDefinitions::gkClusterDataType, fDblock_Specification);
274 Logging( kHLTLogError, "HLT::TRDTracker::DoEvent", "CLUSTERS", "Pointer = 0x%x", clusters);
277 tobjin = (TObject *)GetNextInputObject( ibForce );
278 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "nextBLOCK", "Pointer = 0x%x", tobjin);
282 Int_t iNclusters = fClusterizer->GetNclusters();
283 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "COUNT", "N of Clusters = %d", iNclusters);
284 fTracker->LoadClusters(fClusterizer->GetClusterTree());
286 AliTRDReconstructor::SetSeedingOn(kTRUE);
288 AliESD *esd = new AliESD();
290 //fTracker->MakeSeedsMI(3, 5, esd);
291 fTracker->PropagateBack(esd);
293 //here transport the esd tracks further
294 //no receiver defined yet(!)