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 AliHLTTRDCalibrationComponent.cxx
20 @author Timm Steinbeck, Matthias Richter
22 @brief A TRDCalibration processing component for the HLT. */
32 #include "AliHLTTRDCalibrationComponent.h"
33 #include "AliHLTTRDDefinitions.h"
35 #include "AliCDBManager.h"
36 #include "AliTRDclusterizerHLT.h"
37 #include "AliRawReaderMemory.h"
43 // this is a global object used for automatic component registration, do not use this
44 AliHLTTRDCalibrationComponent gAliHLTTRDCalibrationComponent;
46 ClassImp(AliHLTTRDCalibrationComponent);
48 AliHLTTRDCalibrationComponent::AliHLTTRDCalibrationComponent()
49 : AliHLTCalibrationProcessor()
50 , fOutputPercentage(100) // By default we copy to the output exactly what we got as input
51 , fStrorageDBpath("local://$ALICE_ROOT")
54 // Default constructor
57 AliHLTTRDCalibrationComponent::~AliHLTTRDCalibrationComponent()
63 const char* AliHLTTRDCalibrationComponent::GetComponentID()
65 // Return the component ID const char *
66 return "TRDCalibration"; // The ID of this component
69 void AliHLTTRDCalibrationComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
71 // Get the list of input data
72 list.clear(); // We do not have any requirements for our input data type(s).
73 list.push_back( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
76 AliHLTComponent_DataType AliHLTTRDCalibrationComponent::GetOutputDataType()
78 // Get the output data type
79 return AliHLTTRDDefinitions::fgkCalibrationDataType;
82 void AliHLTTRDCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
84 // Get the output data size
86 inputMultiplier = ((double)fOutputPercentage)/100.0;
89 AliHLTComponent* AliHLTTRDCalibrationComponent::Spawn()
91 // Spawn function, return new instance of this class
92 return new AliHLTTRDCalibrationComponent;
95 Int_t AliHLTTRDCalibrationComponent::ScanArgument( int argc, const char** argv )
97 // perform initialization. We check whether our relative output size is specified in the arguments.
98 fOutputPercentage = 100;
103 Logging( kHLTLogDebug, "HLT::TRDCalibration::ScanArgument", "Arguments", "argv[%d] == %s", i, argv[i] );
104 if ( !strcmp( argv[i], "output_percentage" ) )
108 Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Missing Argument", "Missing output_percentage parameter");
111 Logging( kHLTLogDebug, "HLT::TRDCalibration::ScanArgument", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
112 fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
115 Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
118 Logging( kHLTLogInfo, "HLT::TRDCalibration::ScanArgument", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
123 if ( strcmp( argv[i], "-cdb" ) == 0)
127 Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Missing Argument", "Missing -cdb argument");
130 fStrorageDBpath = argv[i+1];
131 Logging( kHLTLogInfo, "HLT::TRDCalibration::ScanArgument", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );
136 Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Unknown Option", "Unknown option '%s'", argv[i] );
142 Int_t AliHLTTRDCalibrationComponent::InitCalibration()
144 //init the calibration
145 fCDB = AliCDBManager::Instance();
148 Logging(kHLTLogError, "HLT::TRDCalibration::InitCalibration", "Could not get CDB instance", "fCDB 0x%x", fCDB);
152 fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
153 fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
154 Logging(kHLTLogDebug, "HLT::TRDCalibration::InitCalibration", "CDB instance", "fCDB 0x%x", fCDB);
159 Int_t AliHLTTRDCalibrationComponent::DeinitCalibration()
161 // Deinitialization of the component
164 Logging( kHLTLogDebug, "HLT::TRDCalibration::DeinitCalibration", "destroy", "fCDB");
171 Int_t AliHLTTRDCalibrationComponent::ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
174 // Logging( kHLTLogInfo, "HLT::TRDCalibration::ProcessCalibration", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
175 Logging( kHLTLogDebug, "HLT::TRDCalibration::ProcessCalibration", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
177 unsigned long totalSize = 0;
179 //implement a usage of the following
180 // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
181 // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
182 // void *triggerData = trigData.fData;
183 Logging( kHLTLogDebug, "HLT::TRDCalibration::ProcessCalibration", "Trigger data received",
184 "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
186 // Loop over all input blocks in the event
188 TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkTRDSATracksDataType, "AliTRDtrack", ibForce);
189 Logging( kHLTLogInfo, "HLT::TRDCalibration::ProcessCalibration", "1stBLOCK", "Pointer = 0x%x", tobjin);
192 tobjin = (TObject *)GetNextInputObject( ibForce );
193 Logging( kHLTLogInfo, "HLT::TRDCalibration::ProcessCalibration", "nextBLOCK", "Pointer = 0x%x", tobjin);
199 Int_t AliHLTTRDCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
201 //Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
202 //ireturn = PushToFXS(object, "TRD ", "TRDCalib", "1024 ");
203 Logging( kHLTLogDebug, "HLT::TRDCalibration::ProcessCalibration", "Shipping data",