1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
5 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
6 * for The ALICE Off-line Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /** @file AliHLTEMCALCalibrationComponent.cxx
18 @author Mateusz Ploskon
20 @brief A EMCALCalibration processing component for the HLT. */
26 #include "AliHLTEMCALCalibrationComponent.h"
27 #include "AliHLTEMCALDefinitions.h"
29 #include "AliCDBManager.h"
30 #include "AliRawReaderMemory.h"
38 // this is a global object used for automatic component registration, do not use this
39 AliHLTEMCALCalibrationComponent gAliHLTEMCALCalibrationComponent;
41 ClassImp(AliHLTEMCALCalibrationComponent);
43 AliHLTEMCALCalibrationComponent::AliHLTEMCALCalibrationComponent()
44 : AliHLTCalibrationProcessor()
45 , fOutputPercentage(100) // By default we copy to the output exactly what we got as input
46 , fStrorageDBpath("local://$ALICE_ROOT/OCDB")
49 // Default constructor
52 AliHLTEMCALCalibrationComponent::~AliHLTEMCALCalibrationComponent()
58 const char* AliHLTEMCALCalibrationComponent::GetComponentID()
60 // Return the component ID const char *
61 return "EMCALCalibration"; // The ID of this component
64 void AliHLTEMCALCalibrationComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
66 // Get the list of input data
67 list.clear(); // We do not have any requirements for our input data type(s).
68 //list.push_back( AliHLTEMCALDefinitions::fgkDDLRawDataType );
69 list.push_back( AliHLTEMCALDefinitions::fgkClusterDataType );
70 //list.push_back( AliHLTEMCALDefinitions::fgkEMCALESDDataType );
73 AliHLTComponent_DataType AliHLTEMCALCalibrationComponent::GetOutputDataType()
75 // Get the output data type
76 return AliHLTEMCALDefinitions::fgkCalibrationDataType;
79 void AliHLTEMCALCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
81 // Get the output data size
83 inputMultiplier = ((double)fOutputPercentage)/100.0;
86 AliHLTComponent* AliHLTEMCALCalibrationComponent::Spawn()
88 // Spawn function, return new instance of this class
89 return new AliHLTEMCALCalibrationComponent;
92 Int_t AliHLTEMCALCalibrationComponent::ScanArgument( int argc, const char** argv )
94 // perform initialization. We check whether our relative output size is specified in the arguments.
95 fOutputPercentage = 100;
100 Logging( kHLTLogDebug, "HLT::EMCALCalibration::ScanArgument", "Arguments", "argv[%d] == %s", i, argv[i] );
101 if ( !strcmp( argv[i], "output_percentage" ) )
105 Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Missing Argument", "Missing output_percentage parameter");
108 Logging( kHLTLogDebug, "HLT::EMCALCalibration::ScanArgument", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
109 fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
112 Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
115 Logging( kHLTLogInfo, "HLT::EMCALCalibration::ScanArgument", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
120 if ( strcmp( argv[i], "-cdb" ) == 0)
124 Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Missing Argument", "Missing -cdb argument");
127 fStrorageDBpath = argv[i+1];
128 Logging( kHLTLogInfo, "HLT::EMCALCalibration::ScanArgument", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );
133 Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Unknown Option", "Unknown option '%s'", argv[i] );
139 Int_t AliHLTEMCALCalibrationComponent::InitCalibration()
141 //init the calibration
142 fCDB = AliCDBManager::Instance();
145 Logging(kHLTLogError, "HLT::EMCALCalibration::InitCalibration", "Could not get CDB instance", "fCDB 0x%x", fCDB);
149 fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
150 fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
151 Logging(kHLTLogDebug, "HLT::EMCALCalibration::InitCalibration", "CDB instance", "fCDB 0x%x", fCDB);
156 Int_t AliHLTEMCALCalibrationComponent::DeinitCalibration()
158 // Deinitialization of the component
161 Logging( kHLTLogDebug, "HLT::EMCALCalibration::DeinitCalibration", "destroy", "fCDB");
168 Int_t AliHLTEMCALCalibrationComponent::ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
171 // Logging( kHLTLogInfo, "HLT::EMCALCalibration::ProcessCalibration", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
172 Logging( kHLTLogDebug, "HLT::EMCALCalibration::ProcessCalibration", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
174 // unsigned long totalSize = 0;
176 // implement a usage of the following
177 // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
178 // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
179 // void *triggerData = trigData.fData;
180 Logging( kHLTLogDebug, "HLT::EMCALCalibration::ProcessCalibration", "Trigger data received",
181 "Struct size %d Data size %d Data location 0x%x",
182 trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
184 // Loop over all input blocks in the event
186 TObject *tobjin = (TObject *)GetFirstInputObject(AliHLTEMCALDefinitions::fgkClusterDataType , "TTree", ibForce);
187 Logging( kHLTLogInfo, "HLT::EMCALCalibration::ProcessCalibration", "1stBLOCK", "Pointer = 0x%x", tobjin);
190 tobjin = (TObject *)GetNextInputObject( ibForce );
191 Logging( kHLTLogInfo, "HLT::EMCALCalibration::ProcessCalibration", "nextBLOCK", "Pointer = 0x%x", tobjin);
197 Int_t AliHLTEMCALCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
199 //Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
200 // what we will actually push depends on the calibration procedure
201 //ireturn = PushToFXS(object, "EMCAL ", "EMCALCalib", "1024 ");
202 Logging( kHLTLogDebug, "HLT::EMCALCalibration::ProcessCalibration", "Shipping data",