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"
33 #include "AliCDBManager.h"
34 #include "AliTRDclusterizerV1HLT.h"
35 #include "AliTRDReconstructor.h"
37 #include "AliTRDtrackerHLT.h"
39 #include "AliTRDCalibraFillHisto.h"
41 #include "AliTRDcluster.h"
42 #include "TObjArray.h"
48 // this is a global object used for automatic component registration, do not use this
49 AliHLTTRDTrackerComponent gAliHLTTRDTrackerComponent;
51 ClassImp(AliHLTTRDTrackerComponent);
53 AliHLTTRDTrackerComponent::AliHLTTRDTrackerComponent()
55 fOutputPercentage = 100; // By default we copy to the output exactly what we got as input
57 fStrorageDBpath = "local://$ALICE_ROOT";
58 fCDB = AliCDBManager::Instance();
59 //fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
62 fGeometryFileName = getenv("ALICE_ROOT");
63 fGeometryFileName += "/HLT/TRD/geometry.root";
66 AliHLTTRDTrackerComponent::~AliHLTTRDTrackerComponent()
70 const char* AliHLTTRDTrackerComponent::GetComponentID()
72 return "TRDTracker"; // The ID of this component
75 void AliHLTTRDTrackerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
77 list.clear(); // We do not have any requirements for our input data type(s).
78 list.push_back( AliHLTTRDDefinitions::gkClusterDataType );
81 AliHLTComponent_DataType AliHLTTRDTrackerComponent::GetOutputDataType()
83 return AliHLTTRDDefinitions::gkClusterDataType;
86 void AliHLTTRDTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
89 inputMultiplier = ((double)fOutputPercentage)/100.0;
92 // Spawn function, return new instance of this class
93 AliHLTComponent* AliHLTTRDTrackerComponent::Spawn()
95 return new AliHLTTRDTrackerComponent;
98 int AliHLTTRDTrackerComponent::DoInit( int argc, const char** argv )
100 // perform initialization. We check whether our relative output size is specified in the arguments.
101 fOutputPercentage = 100;
106 Logging( kHLTLogDebug, "HLT::TRDTracker::DoInit", "Arguments", "argv[%d] == %s", i, argv[i] );
107 if ( !strcmp( argv[i], "output_percentage" ) )
111 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Missing Argument", "Missing output_percentage parameter");
114 Logging( kHLTLogDebug, "HLT::TRDTracker::DoInit", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
115 fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
118 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
121 Logging( kHLTLogInfo, "HLT::TRDTracker::DoInit", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
126 if ( strcmp( argv[i], "-cdb" ) == 0)
130 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Missing Argument", "Missing -cdb argument");
133 fStrorageDBpath = argv[i+1];
134 Logging( kHLTLogInfo, "HLT::TRDTracker::DoInit", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );
135 fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
140 if ( strcmp( argv[i], "-geometry" ) == 0)
144 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Missing Argument", "Missing -geometry argument");
147 fGeometryFileName = argv[i+1];
148 Logging( kHLTLogInfo, "HLT::TRDTracker::DoInit", "GeomFile storage set", "GeomFile storage is %s",
149 fGeometryFileName.c_str() );
154 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
158 fClusterizer = new AliTRDclusterizerV1HLT("TRCclusterizer", "TRCclusterizer");
160 fGeometryFile = TFile::Open(fGeometryFileName.c_str());
163 fGeoManager = (TGeoManager *)fGeometryFile->Get("Geometry");
164 fTracker = new AliTRDtrackerHLT(fGeometryFile);
168 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "fGeometryFile", "Unable to open file. FATAL!");
172 AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance();
175 Logging(kHLTLogError, "HLT::TRDTracker::DoInit", "Calibration Histos", "::Instance failed");
180 calibra->SetMITracking(kTRUE);
181 calibra->Init2Dhistos();
187 int AliHLTTRDTrackerComponent::DoDeinit()
197 fGeometryFile->Close();
198 delete fGeometryFile;
201 AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance();
211 int AliHLTTRDTrackerComponent::DoEvent( const AliHLTComponentEventData & evtData,
212 AliHLTComponentTriggerData & trigData )
214 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
215 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
217 AliHLTUInt32_t fDblock_Specification = 0;
219 AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::gkClusterDataType );
222 fDblock_Specification = dblock->fSpecification;
226 Logging( kHLTLogWarning, "HLT::TRDTracker::DoEvent", "DATAIN", "First Input Block not found! 0x%x", dblock);
231 TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::gkClusterDataType, "TObjArray", ibForce);
232 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "1stBLOCK", "Pointer = 0x%x", tobjin);
234 // int iTotalClusterCounter = 0;
237 TObjArray *clusters = (TObjArray *)tobjin;
240 //put back to the clusterizers tree
241 Int_t iSuggestedDet = -1; // take the det number from the first cluster
242 Bool_t kInsert = kFALSE;
243 if (clusters->GetEntries() > 0)
245 AliTRDcluster *cl = (AliTRDcluster*)clusters->At(0);
246 iSuggestedDet = cl->GetDetector();
247 kInsert = fClusterizer->InsertClusters(clusters, iSuggestedDet);
248 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "TOTREE", "Result = %d", kInsert);
251 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "CLUSTERS", "Pointer = 0x%x", clusters);
252 // //dump the clusters to the log files
253 // for (Int_t ic = 0; ic < clusters->GetEntries(); ic++)
255 // AliTRDcluster *cl = (AliTRDcluster*)clusters->At(ic);
256 // Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "CLUSTER", "%d : %d : Q = %1.2f",
257 // iTotalClusterCounter, ic, cl->GetQ());
258 // iTotalClusterCounter++;
261 //Pass the data further...
262 //PushBack(clusters, AliHLTTRDDefinitions::gkClusterDataType, fDblock_Specification);
266 Logging( kHLTLogError, "HLT::TRDTracker::DoEvent", "CLUSTERS", "Pointer = 0x%x", clusters);
269 tobjin = (TObject *)GetNextInputObject( ibForce );
270 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "nextBLOCK", "Pointer = 0x%x", tobjin);
274 Int_t iNclusters = fClusterizer->GetNclusters();
275 Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "COUNT", "N of Clusters = %d", iNclusters);
276 fTracker->LoadClusters(fClusterizer->GetClusterTree());
278 AliTRDReconstructor::SetSeedingOn(kTRUE);
280 AliESD *esd = new AliESD();
282 //fTracker->MakeSeedsMI(3, 5, esd);
283 fTracker->PropagateBack(esd);
285 //here transport the esd tracks further
286 //no receiver defined yet(!)