/**************************************************************************
- * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
* *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
+ * Primary Authors: *
+ * Indranil Das <indra.das@saha.ac.in> *
* *
* 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 *
+ * about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
//Author : Indranil Das, SINP, INDIA
// Sukalyan Chattopadhyay, SINP, INDIA
//
-//
//Email : indra.das@saha.ac.in
// sukalyan.chattopadhyay@saha.ac.in
//
const int AliHLTMUONHitReconstructor::fgkDDLHeaderSize = 8;
-const int AliHLTMUONHitReconstructor::fgkEvenLutSize = 3364287 + 1;
-const int AliHLTMUONHitReconstructor::fgkOddLutSize = 1645631 + 1;
+const int AliHLTMUONHitReconstructor::fgkEvenLutSize = 1645632 + 1;
+const int AliHLTMUONHitReconstructor::fgkOddLutSize = 3363840 + 1;
const int AliHLTMUONHitReconstructor::fgkLutLine[2] = {54208, 59648};
-const int AliHLTMUONHitReconstructor::fgkMinIdManuChannel[2] = {64, 917696};
-const int AliHLTMUONHitReconstructor::fgkMaxIdManuChannel[2] = {3364351,2563007};
+const int AliHLTMUONHitReconstructor::fgkMinIdManuChannel[2] = {917696, 64};
+const int AliHLTMUONHitReconstructor::fgkMaxIdManuChannel[2] = {2563327, 3363903};
const float AliHLTMUONHitReconstructor::fgkHalfPadSize[3] = {1.25, 2.50, 5.00};
-
-//ClassImp(AliHLTMUONHitReconstructor)
-
AliHLTMUONHitReconstructor::AliHLTMUONHitReconstructor():
fkBlockHeaderSize(8),
fkDspHeaderSize(8),
fAvgChargeY(NULL),
fNofFiredDetElem(0),
fDebugLevel(0),
- fBusToDetElem()
+ fBusToDetElem(),
+ fBusToDDL()
{
// ctor
fPadData = new DHLTPad[AliHLTMUONHitReconstructor::fgkOddLutSize];
}
-
fkBlockHeaderSize = 8;
fkDspHeaderSize = 8;
fkBuspatchHeaderSize = 4;
{
// dtor
- //printf("\nEnd of Run\n");
-
delete []fPadData;
delete []fLookUpTableData;
+}
+
+int AliHLTMUONHitReconstructor::GetLutLine(int iDDL) const
+{
+ return ( iDDL<16 ) ? fgkLutLine[0] : fgkLutLine[1] ;
}
-int AliHLTMUONHitReconstructor::GetLutLine(int iDDL) const { return ( iDDL<16 ) ? fgkLutLine[0] : fgkLutLine[1] ;}
bool AliHLTMUONHitReconstructor::LoadLookUpTable(DHLTLut* lookUpTableData, int lookUpTableId)
{
// function that loads LookUpTable (= position of each pad with electronic channel associated with it)
if(lookUpTableId<fgkDDLOffSet || lookUpTableId>= fgkDDLOffSet + fgkNofDDL){
- printf("DDL number is out of range (must be %d<=iDDL<%d)\n",fgkDDLOffSet,fgkDDLOffSet+fgkNofDDL);
+ HLTError("DDL number is out of range (must be %d<=iDDL<%d)\n",fgkDDLOffSet,fgkDDLOffSet+fgkNofDDL);
return false;
}
return true;
}
+
bool AliHLTMUONHitReconstructor::SetBusToDetMap(BusToDetElem busToDetElem)
{
}
+bool AliHLTMUONHitReconstructor::SetBusToDDLMap(BusToDDL busToDDL)
+{
+
+ // function that loads BusPatch To DDL Element (DDL) map
+
+ if(busToDDL.size()==0)
+ return false;
+ else
+ fBusToDDL = busToDDL;
+
+ return true;
+}
+
+
bool AliHLTMUONHitReconstructor::Run(int* rawData, int *rawDataSize, AliHLTMUONRecHitStruct recHit[], int *nofHit)
{
// main function called by HLTReconstructor to perform DHLT Hitreconstruction
fPadData[0].fPlane = -1 ;
fPadData[0].fPcbZone = -1 ;
fPadData[0].fCharge = 0 ;
-
+
+
if(!ReadDDL(rawData,rawDataSize)){
- printf("Failed to read the complete DDL file\n");
+ HLTError("Failed to read the complete DDL file");
return false;
}
if(!FindRecHits()){
- printf("Failed to generate RecHits\n");
+ HLTError("Failed to generate RecHits");
return false;
}
}
-
-bool AliHLTMUONHitReconstructor::ReadDDL(int* rawData, int *rawDataSize)
+bool AliHLTMUONHitReconstructor::ReadDDL(int *rawData, int *rawDataSize)
{
//function to read Raw Data files
int ddlRawDataSize;
ddlRawDataSize = *rawDataSize;
- int *buffer = new int[ddlRawDataSize];
- buffer = (int *)rawData;
+ int *buffer = rawData ;
+ //new int[ddlRawDataSize];
+ //buffer = (int *)rawData;
fIdOffSet= fgkMinIdManuChannel[(fDDLId%2)];
fDetManuChannelIdList = new int[ddlRawDataSize];
while(blockRawDataSize > 0){
totalDspSize = buffer[indexDsp + 1];
dspRawDataSize = buffer[indexDsp + 2];
+ //if(buffer[indexDsp+1] == 1)
dspRawDataSize --; // temporary solution to read buspatches
indexBuspatch = indexDsp + fkDspHeaderSize + 2; // this extra 2 word comes from the faulty defination of Dsp header size
while(dspRawDataSize > 0){
buspatchRawDataSize = buffer[indexBuspatch + 2];
buspatchId = buffer[indexBuspatch + 3];
if((detElemId = fBusToDetElem[buspatchId])==0){
- printf("No Detection element found for buspatch : %d\n",buspatchId);
+ HLTError("No Detection element found for buspatch : %d",buspatchId);
return false;
}
indexRawData = indexBuspatch + fkBuspatchHeaderSize;
}
fNofFiredDetElem++;
prevDetElemId = detElemId ;
- }
+ }
+
+ HLTDebug("buspatch : %d, detele : %d, id : %d, manu : %d, channel : %d, X : %f, Y: %f",
+ fPadData[idManuChannel].fBuspatchId,fPadData[idManuChannel].fDetElemId,
+ idManuChannel,((dataWord >> 12) & 0x7FF),((dataWord >> 23) & 0x3F),
+ fPadData[idManuChannel].fRealX,fPadData[idManuChannel].fRealY);
+
dataCount ++;
}
-
+
indexRawData++;
buspatchRawDataSize --;
}
index = totalBlockSize;
}// Block loop
- delete[] buffer;
+ //delete[] buffer;
fDigitPerDDL = dataCount;
fMaxFiredPerDetElem[fNofFiredDetElem-1] = dataCount;
-
-
+
return true;
-
}
+
bool AliHLTMUONHitReconstructor::FindRecHits()
{
// fuction that calls hit reconstruction detector element-wise
RecXRecY();
if(!MergeRecHits()){
- printf("Failed to merge hits\n");
+ HLTError("Failed to merge hits\n");
return false;
}
return true;
}
+
void AliHLTMUONHitReconstructor::FindCentralHits(int minPadId, int maxPadId)
{
// to find central hit associated with each cluster
}// fill for bending and nonbending hit
}// detElemId loop
-
-
}
+
void AliHLTMUONHitReconstructor::RecXRecY()
{
// find reconstructed X and Y for each plane separately
fAvgChargeX[nb] = fPadData[idCentral].fCharge;
}
-
}
+
bool AliHLTMUONHitReconstructor::MergeRecHits()
{
// Merge reconstructed hits first over same plane then bending plane with non-bending plane
}//j for loop
}//if fRecY[i] != 0.0
}// i for loop
-
-
// MERGE Non Bending Plane hits, which are place side by side
for(int i=0;i<fCentralCountNB-1;i++){
}//if fRecX[i] != 0.0
}// i for loop
-
-
// Merge bending Plane hits with Non Bending
-
-
for(int b=0;b<fCentralCountB;b++){
if(fRecY[b]!=0.0){
idCentralB = fCentralChargeB[b];
if(diffX < halfPadLengthX && diffY < halfPadLengthY ){//&& fPadData[idCentralB].fIY != 0){
+ //fRecPoints[(*fRecPointsCount)].fId = idCentralB;
fRecPoints[(*fRecPointsCount)].fX = fRecX[nb];
fRecPoints[(*fRecPointsCount)].fY = fRecY[b];
fRecPoints[(*fRecPointsCount)].fZ = fPadData[idCentralB].fRealZ;
-// fRecPoints[(*fRecPointsCount)].fDetElemId = (AliHLTUInt32_t)fPadData[idCentralB].fDetElemId;
+ //fRecPoints[(*fRecPointsCount)].fDetElemId = (AliHLTUInt32_t)fPadData[idCentralB].fDetElemId;
(*fRecPointsCount)++;
if((*fRecPointsCount) == fMaxRecPointsCount){
- printf("Nof RecHit (i.e. %d) exceeds the max nof RecHit limit %d\n",(*fRecPointsCount),fMaxRecPointsCount);
+ HLTError("Nof RecHit (i.e. %d) exceeds the max nof RecHit limit %d\n",(*fRecPointsCount),fMaxRecPointsCount);
return false;
}
}//if lies wihtin 5.0 mm
return true;
}
-
#ifndef ALIHLTMUONHITRECONSTRUCTOR_H
#define ALIHLTMUONHITRECONSTRUCTOR_H
-/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
+ * *
+ * Primary Authors: *
+ * Indranil Das <indra.das@saha.ac.in> *
+ * *
+ * 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$ */
//Author : Indranil Das, SINP, INDIA
// Sukalyan Chattopadhyay, SINP, INDIA
//
-//
//Email : indra.das@saha.ac.in
// sukalyan.chattopadhyay@saha.ac.in
///////////////////////////////////////////////
-
-
#include <iostream>
#include <cstdio>
#include <fstream>
#include <cmath>
#include <map>
+#include <TString.h>
+
#include <AliHLTLogging.h>
-using namespace std;
+#include "AliRawReader.h"
+#include "AliRawReaderFile.h"
+#include "AliRawReaderRoot.h"
+#include "AliRawReaderDate.h"
-typedef map<int,int> BusToDetElem ;
+#if __GNUC__ < 3
+#define std
+#endif
-struct AliHLTMUONRecHitStruct;
+
+typedef std::map<int,int> BusToDetElem;
+typedef std::map<int,int> BusToDDL;
+
+extern "C" struct AliHLTMUONRecHitStruct;
class AliHLTMUONHitReconstructor : public AliHLTLogging
int fCharge; // The charge measured on the pad.
};
-
AliHLTMUONHitReconstructor();
virtual ~AliHLTMUONHitReconstructor(void);
bool LoadLookUpTable(DHLTLut* lookUpTableData, int lookUpTableId);
bool SetBusToDetMap(BusToDetElem busToDetElem);
+ bool SetBusToDDLMap(BusToDDL busToDDL);
- //bool Init();
bool Run(int* rawData, int *rawDataSize, AliHLTMUONRecHitStruct recHit[], int *nofHit);
-
void SetDCCut(int dcCut) {fDCCut = dcCut;}
void SetDebugLevel(int debugLevel) {fDebugLevel = debugLevel;}
int GetDebugLevel() const {return fDebugLevel;}
static const int fgkDetectorId ; // DDL Offset
static const int fgkDDLOffSet ; // DDL Offset
static const int fgkNofDDL ; // Number of DDL
- static const int fgkDDLHeaderSize ; // DDL header size
+ static const int fgkDDLHeaderSize ; // DDL header size
+
protected:
AliHLTMUONHitReconstructor(const AliHLTMUONHitReconstructor& rhs); // copy constructor
AliHLTMUONHitReconstructor& operator=(const AliHLTMUONHitReconstructor& rhs); // assignment operator
-private:
+private:
- static const int fgkEvenLutSize ; // Size of the LookupTable with event DDLID
- static const int fgkOddLutSize ; // Size of the LookupTable with odd DDLID
- static const int fgkLutLine[2]; // nof Line in LookupTable
+ static const int fgkEvenLutSize ; // Size of the LookupTable with event DDLID
+ static const int fgkOddLutSize ; // Size of the LookupTable with odd DDLID
+ static const int fgkLutLine[2]; // nof Line in LookupTable
- static const int fgkMinIdManuChannel[2]; // Minimum value of idManuChannel in LookupTable
- static const int fgkMaxIdManuChannel[2]; // Maximum value of idManuChannel in LookupTable
- static const float fgkHalfPadSize[3]; // pad halflength for the pcb zones
+ static const int fgkMinIdManuChannel[2]; // Minimum value of idManuChannel in LookupTable
+ static const int fgkMaxIdManuChannel[2]; // Maximum value of idManuChannel in LookupTable
+ static const float fgkHalfPadSize[3]; // pad halflength for the pcb zones
-
- int fkBlockHeaderSize ; // Block header size
- int fkDspHeaderSize ; // DSP header size
- int fkBuspatchHeaderSize ; // buspatch header size
+ int fkBlockHeaderSize; // Block header size
+ int fkDspHeaderSize; // DSP header size
+ int fkBuspatchHeaderSize; // buspatch header size
- int fDCCut; // DC Cut value
+ int fDCCut; // DC Cut value
- DHLTPad* fPadData; // pointer to the array containing the information of each padhits
- DHLTLut* fLookUpTableData; // pointer to the array of Lookuptable data
+ DHLTPad* fPadData; // pointer to the array containing the information of each padhits
+ DHLTLut* fLookUpTableData; // pointer to the array of Lookuptable data
- AliHLTMUONRecHitStruct *fRecPoints; // Reconstructed hits
- int *fRecPointsCount; // nof reconstructed hit
+ AliHLTMUONRecHitStruct *fRecPoints; // Reconstructed hits
+ int *fRecPointsCount; // nof reconstructed hit
int fMaxRecPointsCount; // max nof reconstructed hit
- int fCentralCountB, fCentralCountNB; // centeral hits
+ int fCentralCountB, fCentralCountNB; // centeral hits
int fIdOffSet,fDDLId; // DDLId and DDL id offset
- int fDigitPerDDL; // Total nof Digits perDDL
+ int fDigitPerDDL; // Total nof Digits perDDL
int *fDetManuChannelIdList; // pointer to an array of idManuChannel
int *fCentralChargeB,*fCentralChargeNB; // pointer to an array of central hit
int fNofFiredDetElem,fMaxFiredPerDetElem[13]; // counter for detector elements that are fired
int fDebugLevel;
BusToDetElem fBusToDetElem; // Mapping between bus address and detector element ID.
+ BusToDetElem fBusToDDL; // Mapping between bus address and DDL.
+
bool ReadDDL(int* rawData, int *rawDataSize);
void FindCentralHits(int minPadId, int maxPadId);
void RecXRecY();
bool MergeRecHits();
- //ClassDef(AliHLTMUONHitReconstructor,0)
};
-
#endif // ALIHLTMUONHITRECONSTRUCTOR_H
/**************************************************************************
- * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
* *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
+ * Primary Authors: *
+ * Indranil Das <indra.das@saha.ac.in> *
* *
* 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 *
+ * about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
//
//*/
-#if __GNUC__>= 3
-using namespace std;
-#endif
-
+#include "AliHLTMUONRecHitsBlockStruct.h"
#include "AliHLTMUONHitReconstructorComponent.h"
#include "AliHLTMUONHitReconstructor.h"
-#include "AliHLTMUONRecHitsBlockStruct.h"
+#include "AliHLTMUONConstants.h"
#include "AliHLTLogging.h"
#include "AliHLTSystem.h"
#include "AliHLTDefinitions.h"
AliHLTMUONHitReconstructorComponent::AliHLTMUONHitReconstructorComponent()
- :
- fHitRec(NULL)
+ :
+ fHitRec(NULL),
+ fDDLDir(""),
+ fDDL(0),
+ fReaderType(false)
{
- // see header file for class documentation
}
+
AliHLTMUONHitReconstructorComponent::~AliHLTMUONHitReconstructorComponent()
{
- // see header file for class documentation
+}
+const char* AliHLTMUONHitReconstructorComponent::GetComponentID()
+{
+ return "MUONHitRec"; // The ID of this component
}
-int AliHLTMUONHitReconstructorComponent::DoInit( int argc, const char** argv ){
- // see header file for class documentation
- fHitRec = new AliHLTMUONHitReconstructor();
+void AliHLTMUONHitReconstructorComponent::GetInputDataTypes( std::vector<AliHLTComponentDataType>& list)
+{
+ list.clear();
+ list.push_back( AliHLTMUONConstants::TrackingDDLRawDataType() );
+}
- HLTInfo("dHLT hitrec");
- if (argc==0 && argv==NULL) {
- Logging( kHLTLogError, "AliHLTMUONHitReconstructorComponent::DoInit", "Arguments missing", " no arguments" );
- // this is just to get rid of the warning "unused parameter"
- }
- Int_t i = 0;
- char lutFileName[500],buspatchFileName[500];
- int iDDL = -1;
- while(i<argc){
- if ( !strcmp( argv[i], "lut" ) ) {
- if ( argc <= i+1 ) {
- Logging( kHLTLogError, "AliHLTMUONHitReconstructorComponent::DoInit", "Missing LookupTable filename", "LookupTable filename not specified" );
- return EINVAL; /* Invalid argument */
- }
-
- sprintf(lutFileName,"%s",argv[i+1]);
+AliHLTComponentDataType AliHLTMUONHitReconstructorComponent::GetOutputDataType()
+{
+ return AliHLTMUONConstants::RecHitsBlockDataType();
+}
- i += 2;
- continue;
- }// lut argument
- if ( !strcmp( argv[i], "ddl" ) ) {
- if ( argc <= i+1 ) {
- Logging( kHLTLogError, "AliHLTMUONHitReconstructorComponent::DoInit", "Missing DDL argument", "DDL number not specified" );
- HLTError("AliHLTMUONHitReconstructorComponent::DoInit : DDL number is not specified ");
- return EINVAL; /* Invalid argument */
- }
+void AliHLTMUONHitReconstructorComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ constBase = 0;
+ inputMultiplier = 1;
+}
- iDDL = atoi(argv[i+1]);
- i += 2;
- continue;
- }// ddl argument
+// Spawn function, return new instance of this class
+AliHLTComponent* AliHLTMUONHitReconstructorComponent::Spawn()
+{
+ return new AliHLTMUONHitReconstructorComponent;
+}
- if ( !strcmp( argv[i], "buspatchmap" ) ) {
- if ( argc <= i+1 ) {
- Logging( kHLTLogError, "AliHLTMUONHitReconstructorComponent::DoInit", "Missing buspatch filename", "buspatch filename not specified" );
- return EINVAL; /* Invalid argument */
- }
-
- sprintf(buspatchFileName,"%s",argv[i+1]);
- i += 2;
- continue;
- }// buspatch argument
+int AliHLTMUONHitReconstructorComponent::DoInit( int argc, const char** argv )
+{
+ // perform initialization. We check whether our relative output size is specified in the arguments.
+
+ HLTInfo("Initialising DHLT HitReconstruction Component");
+ fHitRec = new AliHLTMUONHitReconstructor();
+
+ // this is to get rid of the warning "unused parameter"
+ if (argc==0 && argv==NULL) {
+ HLTError("Arguments missing", " no arguments" );
+ }
- }// end of while loop
+ char lutFileName[500],buspatchFileName[500];
- int lutline = fHitRec->GetLutLine(iDDL);
+ int i = 0;
+ char* cpErr;
+ while ( i < argc )
+ {
+ HLTDebug("argv[%d] == %s", i, argv[i] );
+
+ if ( !strcmp( argv[i], "lut" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("LookupTable filename not specified" );
+ return EINVAL; /* Invalid argument */
+ }
+
+ sprintf(lutFileName,"%s",argv[i+1]);
+
+ i += 2;
+ continue;
+ }// lut argument
+
+
+ if ( !strcmp( argv[i], "ddl" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("DDL number not specified" );
+ return EINVAL; /* Invalid argument */
+ }
+
+ fDDL = strtoul( argv[i+1], &cpErr, 0 );
+ if ( *cpErr )
+ {
+ HLTError("Cannot convert '%s' to DDL Number ", argv[i+1] );
+ return EINVAL;
+ }
+
+ i += 2;
+ continue;
+ }// ddl argument
+
+
+ if ( !strcmp( argv[i], "rawdir" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("DDL directory not specified" );
+ return EINVAL; /* Invalid argument */
+ }
+
+ fDDLDir = argv[i+1] ;
+
+ i += 2;
+ continue;
+ }// ddl directory argument
+
+
+ if ( !strcmp( argv[i], "buspatchmap" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("Buspatch filename not specified" );
+ return EINVAL; /* Invalid argument */
+ }
+
+ sprintf(buspatchFileName,"%s",argv[i+1]);
+
+ i += 2;
+ continue;
+ }// buspatch argument
+
+ if ( !strcmp( argv[i], "rawreader" ) ) {
+ fReaderType = true; // true when using rawreader for standalone it is set to false.
+ i += 1;
+ continue;
+ }
+
+ HLTError("Unknown option '%s'", argv[i] );
+ return EINVAL;
+
+ }//while loop
+
+ int lutline = fHitRec->GetLutLine(fDDL);
AliHLTMUONHitReconstructor::DHLTLut* lookupTable = new AliHLTMUONHitReconstructor::DHLTLut[lutline];
- if(!ReadLookUpTable(lookupTable,lutFileName,iDDL)){
- Logging(kHLTLogInfo, "AliHLTMUONHitReconstructorComponent::DoInit", "Failed to read lut", "lut cannot be read, DoInit");
+ if(!ReadLookUpTable(lookupTable,lutFileName)){
+ HLTError("Failed to read lut, lut cannot be read, DoInit");
return ENOENT ; /* No such file or directory */
}else{
- for(int i = 0;i<lutline; i++){
- //#ifdef MY_DEBUG
-// printf("%d\t%d\t%d\t%f\t%f\t%f\t%d\t\n",
-// lookupTable[i].fIdManuChannel,
-// lookupTable[i].fIX,
-// lookupTable[i].fIY,
-// lookupTable[i].fRealX,
-// lookupTable[i].fRealY,
-// lookupTable[i].fRealZ,
-// lookupTable[i].fPcbZone,
-// lookupTable[i].fPlane
-// );
- //#endif
- }
-
+
BusToDetElem busToDetElem;
- if(!ReadBusPatchToDetElemFile(busToDetElem,buspatchFileName)){
- Logging(kHLTLogInfo, "AliHLTMUONHitReconstructorComponent::DoInit", "Failed to read buspatchmap", "buspatchmap cannot be read, DoInit");
+ BusToDDL busToDDL;
+ if(!ReadBusPatchToDetElemFile(busToDetElem,busToDDL,buspatchFileName)){
+ HLTError("Failed to read buspatchmap, buspatchmap cannot be read, DoInit");
return ENOENT ; /* No such file or directory */
}
-
+
fHitRec->SetBusToDetMap(busToDetElem);
- fHitRec->LoadLookUpTable(lookupTable,iDDL);
-
+ fHitRec->SetBusToDDLMap(busToDDL);
+ fHitRec->LoadLookUpTable(lookupTable,fDDL);
+
}// reading lut
+ delete []lookupTable;
+
+ HLTInfo("Initialisation of DHLT HitReconstruction Component is done");
+
return 0;
}
-int AliHLTMUONHitReconstructorComponent::DoDeinit(){
- // see header file for class documentation
+
+int AliHLTMUONHitReconstructorComponent::DoDeinit()
+{
if(fHitRec)
delete fHitRec;
- HLTInfo("dHLT hitrec");
+
+ HLTInfo(" Deinitialising DHLT HitReconstruction Component");
+
return 0;
}
-int AliHLTMUONHitReconstructorComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) {
- // see header file for class documentation
- HLTInfo("dHLT hitrec");
-
-// if (evtData.fStructSize==0 && blocks==NULL && trigData.fStructSize==0 &&
-// outputPtr==0 && size==0)
-// {
-// outputBlocks.clear();
-// // this is just to get rid of the warning "unused parameter"
-// }
+int AliHLTMUONHitReconstructorComponent::DoEvent(
+ const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ std::vector<AliHLTComponentBlockData>& outputBlocks
+ )
+{
+ // Process an event
unsigned long totalSize = 0;
- unsigned long mySize;
- //cout<<"Block Count : "<<evtData.fBlockCnt<<endl;
- for(UInt_t i=0;i<evtData.fBlockCnt;i++){
-
- cout<<"0: totalsize : "<<totalSize<<"\tkAliHLTBlockAlignment :"<<kAliHLTBlockAlignment<<"\t size :"<<size<<endl;
-
- // Align the beginning of this block to the required value.
- // if ( totalSize % kAliHLTBlockAlignment ){
- // totalSize += kAliHLTBlockAlignment-(totalSize % kAliHLTBlockAlignment);
- // }
-
- if ( totalSize > size )
- break;
-
- cout<<"1: totalsize : "<<totalSize<<"\tkAliHLTBlockAlignment :"<<kAliHLTBlockAlignment<<endl;
- // Determine the size we should use for the output for this block (the input block's size times the relative output size)
-
-
- int totalDDLSize = blocks[i].fSize/4;
- int ddlRawDataSize = totalDDLSize - AliHLTMUONHitReconstructor::GetkDDLHeaderSize();
- int ddlHeader[8];
- memcpy((char *) & ddlHeader,blocks[i].fPtr,(size_t)4*(AliHLTMUONHitReconstructor::GetkDDLHeaderSize()));
-
-// for(int j=0;j<8;j++)
-// HLTDebug("ddlHeader[%d] : %d\n",j,ddlHeader[j]);
-
- int* buffer = new int[ddlRawDataSize];
- memcpy((int*)buffer,((int*)blocks[i].fPtr + AliHLTMUONHitReconstructor::GetkDDLHeaderSize()),(sizeof(int)*ddlRawDataSize));
-
-// for(int j=0;j<ddlRawDataSize;j++)
-// HLTDebug("buffer[%d] : %x\n",j,buffer[j]);
-
-
- AliHLTMUONRecHitStruct recHit[300];
- int nofHit = 300;
-
- if(! (fHitRec->Run(buffer,&ddlRawDataSize,recHit,&nofHit))){
- cerr <<"AliHLTMUONHitReconstructorComponent::DoEvent : ERROR In Processing of HitRec Algo "<< endl;
- return EIO;
- }
+
+ HLTDebug("Event : %d has : %lu blocks",(int)evtData.fEventID,evtData.fBlockCnt);
+
+ // Loop over all input blocks in the event
+ for ( unsigned long n = 0; n < evtData.fBlockCnt; n++ )
+ {
+
+ HLTDebug("block : %d, block rawData : %p, block.fSize (bytes) : %d, blocks.fDataType.fID : %s, blocks.fDataType.fOrigin : %s, required type : %s\n",
+ n,blocks[n].fPtr,blocks[n].fSize,(char *)(blocks[n].fDataType.fID),
+ (char *)(blocks[n].fDataType.fOrigin,(char *)(AliHLTMUONConstants::TrackingDDLRawDataType().fID)));
+
- mySize = sizeof(AliHLTMUONRecHitStruct)*nofHit;
-
- HLTInfo("mySize set (1) mySize == %lu B - blocks[%lu].fSize == %lu",
- mySize, i, blocks[i].fSize);
-
- // Check how much space we have left and adapt this output block's size accordingly.
- if ( totalSize + mySize > size )
- mySize = size-totalSize;
-
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "mySize set (2)", "mySize == %lu B - totalSize == %lu - size == %lu",
- mySize, totalSize, size );
-
- if ( mySize<=0 )
- continue; // No room left to write a further block.
-
- // Now copy the input block
- unsigned long copied = 0;
- // First copy all full multiples of the input block
- while ( copied+blocks[i].fSize <= mySize )
- {
- Logging( kHLTLogInfo, "0 : HLT::Dummy::DoEvent", "Copying", "Copying %lu B - Copied: %lu B - totalSize: %lu B",
- blocks[i].fSize, copied, totalSize );
- memcpy( outputPtr+totalSize+copied, blocks[i].fPtr, blocks[i].fSize );
- copied += blocks[i].fSize;
+ if(strncmp((char *)(blocks[n].fDataType.fID),(char *)(AliHLTMUONConstants::TrackingDDLRawDataType().fID),kAliHLTComponentDataTypefIDsize)) continue;
+
+
+ if ( totalSize > size )
+ break;
+
+ int totalDDLSize = blocks[n].fSize/sizeof(int);
+
+ if(!totalDDLSize) continue;
+
+ int ddlRawDataSize = totalDDLSize - fHitRec->GetkDDLHeaderSize();
+ int *buffer = (int *)blocks[n].fPtr;
+
+
+ for(int j=0;j<totalDDLSize;j++)
+ HLTDebug("buffer[%d] : %x\n",j,buffer[j]);
+
+ buffer = (int *)((int *)blocks[n].fPtr + fHitRec->GetkDDLHeaderSize()) ;
+
+ AliHLTMUONRecHitStruct recHit[300];
+ int nofHit = 300;
+
+ if(! (fHitRec->Run(buffer,&ddlRawDataSize,recHit,&nofHit))){
+ HLTError("ERROR In Processing of HitRec Algo ");
+ return EIO;
}
- // And the copy the remaining fragment of the block
- Logging( kHLTLogInfo, "1 : HLT::Dummy::DoEvent", "Copying", "Copying %lu B - Copied: %lu B - totalSize: %lu B",
- mySize-copied, copied, totalSize );
- memcpy( outputPtr+totalSize+copied, blocks[i].fPtr, mySize-copied );
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "Copied", "Copied: %lu B - totalSize: %lu B",
- copied, totalSize );
-
-
-
- AliHLTComponentBlockData bd;
- FillBlockData( bd );
- bd.fOffset = totalSize;;
- bd.fSize = mySize;
- //bd.fPtr = (AliHLTUInt8_t*)(&recHit[0]);
- bd.fSpecification = blocks[i].fSpecification;
- outputBlocks.push_back( bd );
-
- totalSize += mySize;
-
- // for(int j=0; j<nofHit; j++){
-// printf("%d\t\t%d\t\t%f\t%f\t%f\n",
-// i,outPtr->fRecPoint[j].fDetElemId,outPtr->fRecPoint[j].fX,
-// outPtr->fRecPoint[j].fY,outPtr->fRecPoint[j].fZ);
-// printf("1 : %d\t\t%d\t\t%f\t%f\t%f\n",
-// i,(((AliHLTMUONRecHitStruct*)bd.fPtr) + j)->fDetElemId,
-// (((AliHLTMUONRecHitStruct*)bd.fPtr) + j)->fX,
-// (((AliHLTMUONRecHitStruct*)bd.fPtr) + j)->fY,
-// (((AliHLTMUONRecHitStruct*)bd.fPtr) + j)->fZ);
-// }// nof RecHits
-
-
- if(totalSize > size){
- cout<<"size : "<<size<<"\t totalSize: "<<totalSize<<"\t mySize :"<<mySize<<endl;
- Logging( kHLTLogError, "AliHLTMUONHitReconstructorComponent::DoEvent", "Size exceeds the quota", "Size Exceeds the maximum quota" );
- return EMSGSIZE;
+
+ unsigned long mySize = sizeof(AliHLTMUONRecHitStruct) * nofHit;
+
+ HLTDebug("Event %d and block %d has nofHit %d\n",(int)evtData.fEventID,n,nofHit);
+
+ // Check how much space we have left and adapt this output block's size accordingly.
+ if ( totalSize + mySize > size )
+ mySize = size-totalSize;
+
+ Logging( kHLTLogDebug, "HLT::MUONHitRec::DoEvent", "mySize set (2)", "mySize == %lu B - totalSize == %lu - size == %lu",
+ mySize, totalSize, size );
+
+ if ( mySize<=0 )
+ continue; // No room left to write a further block.
+
+ // Now copy the input block
+ unsigned long copied = 0;
+ // First copy all full multiples of the input block
+
+ // And the copy the remaining fragment of the block
+ Logging( kHLTLogDebug, "1 : HLT::MUONHitRec::DoEvent", "Copying", "Copying %lu B - Copied: %lu B - totalSize: %lu B",
+ mySize-copied, copied, totalSize );
+ memcpy( outputPtr+totalSize+copied, &recHit[0], mySize);
+ Logging( kHLTLogDebug, "HLT::MUONHitRec::DoEvent", "Copied", "Copied: %lu B - totalSize: %lu B",
+ copied, totalSize );
+
+ // Fill a block data structure for our output block.
+ AliHLTComponentBlockData bd;
+ FillBlockData(bd);
+ bd.fPtr = outputPtr;
+ // This block's start (offset) is after all other blocks written so far.
+ bd.fOffset = totalSize;
+ bd.fSize = mySize;
+ bd.fDataType = AliHLTMUONConstants::RecHitsBlockDataType();
+ bd.fSpecification = blocks[n].fSpecification;
+ outputBlocks.push_back(bd);
+
+ // Increase the total amount of data written so far to our output memory
+ totalSize += mySize;
}
-
- }// block loop
-
+ // Finally we set the total size of output memory we consumed.
size = totalSize;
return 0;
}
-bool AliHLTMUONHitReconstructorComponent::ReadLookUpTable(
- AliHLTMUONHitReconstructor::DHLTLut* lookupTable, const char* lutpath, int iDDL
- )
+bool AliHLTMUONHitReconstructorComponent::ReadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookupTable, const char* lutpath)
{
-// Reads in a lookup table for the hit reconstruction algorithm from file.
-
- if (iDDL < AliHLTMUONHitReconstructor::GetkDDLOffSet() ||
- iDDL >= AliHLTMUONHitReconstructor::GetkDDLOffSet() + AliHLTMUONHitReconstructor::GetkNofDDL())
- {
-// Logging(kHLTLogError, "AliHLTMUONHitReconstructorComponent::ReadLookUpTable", "Invalid DDL")
-// << "DDL number is out of range (must be " << AliHLTLog::kDec << HLTMUONHitRec::fgkDDLOffSet
-// << " <= iDDL < " << AliHLTLog::kDec
-// << HLTMUONHitRec::fgkDDLOffSet + HLTMUONHitRec::fgkNofDDL
-// << ENDLOG;
- return false;
- }
-
- int lutLine = fHitRec->GetLutLine(iDDL);
-// cout<<"LutLine :"<<lutLine<<endl;
- FILE* fin = fopen(lutpath, "r");
- if (fin == NULL)
- {
-// LOG(kHLTLogError, "AliHLTMUONHitReconstructorComponent::ReadLookUpTable", "I/O error")
-// << "Failed to open file: " << lutpath << ENDLOG;
- return false;
- }
-
-# ifdef DEBUG
-// Logging(kHLTLogError, "AliHLTMUONHitReconstructorComponent::ReadLookUpTable", "Trace")
-// << "Reading LUT file: " << lutpath << ENDLOG;
-# endif
-
- for(int i=0;i<lutLine;i++)
- {
- fscanf(
- fin,
- "%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",
- &lookupTable[i].fIdManuChannel,
- &lookupTable[i].fIX,
- &lookupTable[i].fIY,
- &lookupTable[i].fRealX,
- &lookupTable[i].fRealY,
- &lookupTable[i].fRealZ,
- &lookupTable[i].fPcbZone,
- &lookupTable[i].fPlane
- );
- }
-
- fclose(fin);
- return true;
+ if (fDDL < AliHLTMUONHitReconstructor::GetkDDLOffSet() ||
+ fDDL >= AliHLTMUONHitReconstructor::GetkDDLOffSet() + AliHLTMUONHitReconstructor::GetkNofDDL()){
+ HLTError("DDL number is out of range");
+ return false;
+ }
+
+ int lutLine = fHitRec->GetLutLine(fDDL);
+
+ FILE* fin = fopen(lutpath, "r");
+ if (fin == NULL){
+ HLTError("Failed to open file: %s",lutpath);
+ return false;
+ }
+
+ for(int i=0;i<lutLine;i++){
+ fscanf(
+ fin,
+ "%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",
+ &lookupTable[i].fIdManuChannel,
+ &lookupTable[i].fIX,
+ &lookupTable[i].fIY,
+ &lookupTable[i].fRealX,
+ &lookupTable[i].fRealY,
+ &lookupTable[i].fRealZ,
+ &lookupTable[i].fPcbZone,
+ &lookupTable[i].fPlane
+ );
+ }
+
+ fclose(fin);
+ return true;
}
-// implement this as well.
-bool AliHLTMUONHitReconstructorComponent::ReadBusPatchToDetElemFile(
- BusToDetElem& busToDetElem, const char* buspatchmappath
- )
+bool AliHLTMUONHitReconstructorComponent::ReadBusPatchToDetElemFile(BusToDetElem& busToDetElem, BusToDDL& busToDDL, const char* buspatchmappath)
{
-// Loads the bus patch to detector element ID map from an ASCII file.
-
- char getLine[80];
- char temp;
- int detElem, minBusPatch, maxBusPatch;
-
- FILE* fin = fopen(buspatchmappath, "r");
- if (fin == NULL)
- {
-// Logging(kHLTLogError, "AliHLTMUONHitReconstructorComponent::ReadBusPatchToDetElemFile", "I/O error")
-// << "Failed to open file: " << buspatchmappath << ENDLOG;
- return false;
- }
-
-# ifdef DEBUG
-// Logging(kHLTLogError, "AliHLTMUONHitReconstructorComponent::ReadBusPatchToDetElemFile", "Trace")
-// << "Reading bus patch mapping file: " << buspatchmappath << ENDLOG;
-# endif
-
- while (feof(fin)==0)
- {
- fgets(getLine,80,fin);
- sscanf(getLine, "%d\t%d %c %d", &detElem, &minBusPatch, &temp, &maxBusPatch);
- if (detElem >= 700 && detElem <= 1025)
- {
- for(int i = minBusPatch; i <= maxBusPatch; i++)
- busToDetElem[i] = detElem;
- } // detElem condn
- } // while loop for file
-
- fclose(fin);
- return true;
+ char getLine[80];
+ char temp;
+ int detElem, minBusPatch, maxBusPatch, ddl;
+
+ FILE* fin = fopen(buspatchmappath, "r");
+ if (fin == NULL){
+ HLTError("Failed to open file: %s",buspatchmappath);
+ return false;
+ }
+
+ while (feof(fin)==0){
+ fgets(getLine,80,fin);
+ sscanf(getLine, "%d\t%d %c %d\t%d", &detElem, &minBusPatch, &temp, &maxBusPatch,&ddl);
+ if (detElem >= 700 && detElem <= 1025){
+
+ for(int i = minBusPatch; i <= maxBusPatch; i++){
+ busToDetElem[i] = detElem;
+ busToDDL[i] = ddl;
+ }//for loop
+ } // detElem condn
+ } // while loop for file
+
+ fclose(fin);
+ return true;
}
#ifndef ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
-#define ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
-/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
+#define ALIHLTMUONHITREONSTRUCTORCCOMPONENT_H
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
+ * *
+ * Primary Authors: *
+ * Indranil Das <indra.das@saha.ac.in> *
+ * *
+ * 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$ */
// */
#include "AliHLTProcessor.h"
-#include "AliHLTMUONConstants.h"
-
+#include <TString.h>
#include "AliHLTMUONHitReconstructor.h"
-//class AliHLTMUONHitReconstructor;
-
-
-class AliHLTMUONHitReconstructorComponent : public AliHLTProcessor {
-
-public:
- AliHLTMUONHitReconstructorComponent();
- virtual ~AliHLTMUONHitReconstructorComponent();
-
- const char* GetComponentID() /*const*/ { return "MUONHitRec";}
-
- void GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
- list.clear();
- list.push_back( AliHLTMUONConstants::TrackingDDLRawDataType() );
- }
-
- AliHLTComponentDataType GetOutputDataType() /*const*/ {return AliHLTMUONConstants::RecHitsBlockDataType();}
- virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {constBase = 0;inputMultiplier = 0;};
-
- // Spawn function, return new class instance
- AliHLTComponent* Spawn() /*const*/ {return new AliHLTMUONHitReconstructorComponent;};
-
- protected:
-
- int DoInit( int argc, const char** argv );
- int DoDeinit();
- int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
-
-private:
-
- // Do not allow to copy these objects.
- AliHLTMUONHitReconstructorComponent(const AliHLTMUONHitReconstructorComponent& /*object*/);
- AliHLTMUONHitReconstructorComponent& operator = (const AliHLTMUONHitReconstructorComponent& /*object*/);
-
- /** array of input data types */
-
- AliHLTMUONHitReconstructor* fHitRec; // Class instance implementing the hit reconstruction algorithm.
- bool ReadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookupTable, const char* lutpath, int iDDL);
- bool ReadBusPatchToDetElemFile(BusToDetElem& busToDetElem, const char* buspatchmappath);
-
- ClassDef(AliHLTMUONHitReconstructorComponent, 0)
+#if __GNUC__ < 3
+#define std
+#endif
+
+
+class AliHLTMUONHitReconstructorComponent : public AliHLTProcessor
+{
+ public:
+ AliHLTMUONHitReconstructorComponent();
+ virtual ~AliHLTMUONHitReconstructorComponent();
+
+ // Public functions to implement AliHLTComponent's interface.
+ // These functions are required for the registration process
+
+ const char* GetComponentID();
+ void GetInputDataTypes(std::vector<AliHLTComponentDataType>& list);
+ AliHLTComponentDataType GetOutputDataType();
+ virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ AliHLTComponent* Spawn();
+
+ protected:
+
+ // Protected functions to implement AliHLTComponent's interface.
+ // These functions provide initialization as well as the actual processing
+ // capabilities of the component.
+
+ int DoInit(int argc, const char** argv);
+ int DoDeinit();
+ int DoEvent(
+ const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ std::vector<AliHLTComponentBlockData>& outputBlocks
+ );
+
+ private:
+
+ AliHLTMUONHitReconstructor* fHitRec;
+ bool ReadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookupTable, const char* lutpath);
+ bool ReadBusPatchToDetElemFile(BusToDetElem& busToDetElem, BusToDDL& busToDDL, const char* buspatchmappath);
+
+ TString fDDLDir;
+ Int_t fDDL;
+ bool fReaderType;
+
+ ClassDef(AliHLTMUONHitReconstructorComponent, 0)
};
#endif // ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
/**********************************************************************
Created on : 16/05/2007
Purpose : This class is supposed to read the tracker DDL files and
- give the output AliHLTMUONTriggerRecordStruct
+ give the output AliMUONCoreTriggerRecord
Author : Indranil Das, HEP Division, SINP
Email : indra.das@saha.ac.in | indra.ehep@gmail.com
**********************************************************************/
///*
//
-// The TrigRec class is designed to deal the rawdata inputfiles to findout the
-// the reconstructed hits at the trigger DDL. The output is send to the output block for further
-// processing.
+// The trigger reconstructor class is designed to deal the rawdata inputfiles
+// to findout the the reconstructed hits at the trigger DDL. The output is send
+// to the output block for further processing.
//
// Author : Indranil Das ( indra.das@saha.ac.in || indra.ehep@gmail.com )
//
//*/
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-#include <vector>
-
-#include "TObjArray.h"
-
#include "AliHLTMUONTriggerReconstructor.h"
-#include "AliMUONTriggerCrate.h"
-#include "AliMUONLocalTriggerBoard.h"
-#include "AliMUONTriggerCircuit.h"
-
-#include "AliMpPad.h"
-#include "AliMpVSegmentation.h"
-#include "AliMpSegmentation.h"
-#include "AliMpDDLStore.h"
-
-
const int AliHLTMUONTriggerReconstructor::fgkDetectorId = 0xB00;
const int AliHLTMUONTriggerReconstructor::fgkDDLOffSet = 20 ;
const int AliHLTMUONTriggerReconstructor::fgkNofDDL = 2 ;
const int AliHLTMUONTriggerReconstructor::fgkDDLHeaderSize = 8;
-
-const int AliHLTMUONTriggerReconstructor::fgkEvenLutSize = 5208448+ 1;
-const int AliHLTMUONTriggerReconstructor::fgkOddLutSize = 5058432 + 1;
+const int AliHLTMUONTriggerReconstructor::fgkEvenLutSize = 2602351 + 1;
+const int AliHLTMUONTriggerReconstructor::fgkOddLutSize = 2528735 + 1;
const int AliHLTMUONTriggerReconstructor::fgkLutLine = 10496;
-const int AliHLTMUONTriggerReconstructor::fgkMinIdManuChannel[2] = {1638400, 1720320};
-const int AliHLTMUONTriggerReconstructor::fgkMaxIdManuChannel[2] = {6846848, 6778752};
+const int AliHLTMUONTriggerReconstructor::fgkMinIdManuChannel[2] = {819616, 862288};
+const int AliHLTMUONTriggerReconstructor::fgkMaxIdManuChannel[2] = {3421966, 3391022};
const float AliHLTMUONTriggerReconstructor::fgkHalfPadSizeXB[3] = {8.5, 17.0, 25.5};
const float AliHLTMUONTriggerReconstructor::fgkHalfPadSizeYNB[2] = {25.5, 34.0};
const int AliHLTMUONTriggerReconstructor::fgkDetElem = 9*4 ; // 9 detele per half chamber
-AliHLTMUONTriggerReconstructor::AliHLTMUONTriggerReconstructor() :
+
+AliHLTMUONTriggerReconstructor::AliHLTMUONTriggerReconstructor()
+ :
fPadData(NULL),
fLookUpTableData(NULL),
fRecPoints(NULL),
fRecPointsCount(NULL),
fMaxRecPointsCount(0),
- fDigitPerDDL(0),
- fNofFiredDetElem(0),
- fMaxFiredPerDetElem(NULL),
- fDetManuChannelIdList(NULL),
- fCentralChargeB(NULL),
- fCentralChargeNB(NULL),
+ fMaxFiredPerDetElem(),
+ fDetElemToDataId(),
fDDLId(0),
- fIdOffSet(0),
- fCrateManager(NULL)
+ fIdOffSet(0)
{
// ctor
fPadData = new AliHLTMUONHitReconstructor::DHLTPad[AliHLTMUONTriggerReconstructor::fgkOddLutSize];
}
- fMaxFiredPerDetElem = new int[fgkDetElem] ;
-
- fCrateManager = new AliMUONTriggerCrateStore();
- fCrateManager->ReadFromFile();
-
bzero(fGetIdTotalData,104*64*2*sizeof(int));
}
AliHLTMUONTriggerReconstructor::~AliHLTMUONTriggerReconstructor()
{
// dtor
-
- //HLTError("\nEnd of Run\n");
-
delete []fPadData;
delete []fLookUpTableData;
- delete fCrateManager ;
- delete []fMaxFiredPerDetElem;
+}
+
+bool AliHLTMUONTriggerReconstructor::SetRegToLocCardMap(RegToLoc* regToLoc)
+{
+ if(!memcpy(fRegToLocCard,regToLoc,128*sizeof(RegToLoc)))
+ return false;
+
+ for(int i=0;i<128;i++){
+ HLTDebug("DDL : %d, reg : %d, loc : %d",fRegToLocCard[i].fTrigDDL,
+ fRegToLocCard[i].fRegId,fRegToLocCard[i].fLocId);
+ }
+
+ return true;
}
bool AliHLTMUONTriggerReconstructor::LoadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookUpTableData, int lookUpTableId)
fLookUpTableData = new AliHLTMUONHitReconstructor::DHLTLut[lutSize];
- fLookUpTableData[0].fIdManuChannel = 0;
- fLookUpTableData[0].fIX = 0 ;
- fLookUpTableData[0].fIY = 0 ;
- fLookUpTableData[0].fRealX = 0.0 ;
- fLookUpTableData[0].fRealY = 0.0 ;
- fLookUpTableData[0].fRealZ = 0.0 ;
- fLookUpTableData[0].fPlane = -1 ;
- fLookUpTableData[0].fPcbZone = -1 ;
+ memset(fLookUpTableData,-1,lutSize*sizeof(AliHLTMUONHitReconstructor::DHLTLut));
for(int i=0; i<nofLutLine; i++){
fMaxRecPointsCount = *nofTrigRec;
fRecPointsCount = nofTrigRec;
*fRecPointsCount = 0;
+ fMaxFiredPerDetElem.clear();
+ fDetElemToDataId.clear();
fPadData[0].fDetElemId = 0;
fPadData[0].fBuspatchId = 0;
bool AliHLTMUONTriggerReconstructor::ReadDDL(int *rawData, int *rawDataSize)
{
- vector<AliHLTMUONHitReconstructor::DHLTPad> padList;
int idManuChannel ;
int index = 0;
int dataCount = 0;
- fNofFiredDetElem = 0;
int detElemId = 0 ;
- int prevDetElemId = 0 ;
+ int reg_output,reg_phys_trig_occur ;
+ int iLocIndex,loc,locDec,triggY,sign,loDev,triggX;
+ int iRegLoc, locId ;
+ short pattern[2][4]; // 2 stands for two cathode planes and 4 stands for 4 chambers
+
+ Int_t offset,ithSwitch,secondLocation,idetElemId;
- fDetManuChannelIdList = new int[(*rawDataSize)];
+ int shiftIndex = 10 - 6 - 1; // the one comes due to indexing from zero
+ DataIdIndex dataIndex;
#ifdef DEBUG
int globalcard_data_occurance = (rawData[index]>>10)&0x1; //Set to 1 if global info present in DDL else set to 0
int version = (rawData[index]>>12)&0xFF; // software version
#endif
int phys_trig_occur = (rawData[index]>>30)&0x1; // 1 for physics trigger, 0 for software trigger
- // Values not set
-// int regional_structure = (rawData[index])&0xFF ;
-// int DAQ_interfaced = (rawData[index]>>8)&0x1;
-// int central_or_LTU = (rawData[index]>>9)&0x1;
-// int VME_trigger = (rawData[index]>>11)&0x1;
-// int DARC_type = (rawData[index]>>24)&0x3;
-// int dimuon_ZDC = (rawData[index]>>27)&0x3;
-// int MBZ = (rawData[index]>>31)&0x1;
-
HLTDebug("globalcard_data_occurance %d, version %d, serial_number %d, phys_trig_occur %d",
globalcard_data_occurance,version,serial_number,phys_trig_occur);
int pairLikeLpt = (rawData[index] >> 2) & 0x1;
int pairLikeHpt = (rawData[index] >> 3) & 0x1;
-#endif // DEBUG
-
+#endif
HLTDebug("singleLpt : %x, singleHpt : %x, pairUnlikeLpt : %x, pairUnlikeHpt : %x, pairLikeLpt : %x, pairLikeHpt : %x",
singleLpt,singleHpt,pairUnlikeLpt,pairUnlikeHpt,pairLikeLpt,pairLikeHpt);
}
if(!phys_trig_occur)
index += 10 ;// corresponds to scalar words
-
+
index += 1; // separator 0xDEADBEEF
for (int iReg = 0; iReg < 8; iReg++) {
index += 1; // DARC Status Word
index += 1; // Regeional Word
- //int reg_output = rawData[index] & 0xFF;
- int reg_phys_trig_occur = ( rawData[index] >> 31) & 0x1;
-// int reg_version;// = ;
-// int reg_Id ;//= ;
-// int reg_serial_number;// = ;
+ reg_output = rawData[index] & 0xFF;
+ reg_phys_trig_occur = ( rawData[index] >> 31) & 0x1;
index += 2; // 2 words for regional input
if(!reg_phys_trig_occur)
index += 10;
- index += 1 ; // end of Regeonal header
-
- AliMUONTriggerCrate* crate = fCrateManager->Crate((fDDLId - AliHLTMUONTriggerReconstructor::fgkDDLOffSet), iReg);
- TObjArray *boards = crate->Boards();
-
+ index += 1 ; // end of Regeonal header 0xBEEFFACE
for(int iLoc = 0; iLoc < 16 ; iLoc++){
- int iLocIndex = index ;
+ iLocIndex = index ;
- int locId = (rawData[index+5] >> 19) & 0xF ;
+ loc = (rawData[index+5] >> 19) & 0xF ;
- AliMUONLocalTriggerBoard* localBoard = (AliMUONLocalTriggerBoard*)boards->At(locId + 1);
- int iLocCard = localBoard->GetNumber();
-
- int dec = (rawData[index+5] >> 15) & 0xF;
- //int triggY = (rawData[index+5] >> 14) & 0x1 ;
- //int sign = (rawData[index+5] >> 9) & 0x1;
- //int loDev = (rawData[index+5] >> 5) & 0xF ;
- //int triggX = (loDev >> 4 & 0x1 ) && !(loDev & 0xF) ;
+ locDec = (rawData[index+5] >> 15) & 0xF;
+ triggY = (rawData[index+5] >> 14) & 0x1 ;
+ sign = (rawData[index+5] >> 9) & 0x1;
+ loDev = (rawData[index+5] >> 5) & 0xF ;
+ triggX = (loDev >> 4 & 0x1 ) && !(loDev & 0xF) ;
-
-// HLTDebug(" \n",
-// iLocCard,locId);
-
-// index += 5;
-
- if(iLocCard > 0){
- if( dec != 0x9 ){ // check for Dec
-
- index += 1;
- short X1_pattern = rawData[index] & 0xFFFF;
- short X2_pattern = (rawData[index] >> 16) & 0xFFFF;
- index += 1;
- short X3_pattern = rawData[index] & 0xFFFF;
- short X4_pattern = (rawData[index] >> 16) & 0xFFFF;
+ if( locDec != 0x9 ){ // check for Dec
+
+ iRegLoc = iReg*16 + iLoc;
+ locId = fRegToLocCard[iRegLoc].fLocId ;
+
+ if(locId<=234){ // to avoid the copy locCards
index += 1;
- short Y1_pattern = rawData[index] & 0xFFFF;
- short Y2_pattern = (rawData[index] >> 16) & 0xFFFF;
- index += 1;
- short Y3_pattern = rawData[index] & 0xFFFF;
- short Y4_pattern = (rawData[index] >> 16) & 0xFFFF;
+ pattern[0][0] = rawData[index] & 0xFFFF; // x-strip pattern for chaber 0
+ pattern[0][1] = (rawData[index] >> 16) & 0xFFFF; // x-strip pattern for chaber 1
+ index += 1;
+ pattern[0][2] = rawData[index] & 0xFFFF;
+ pattern[0][3] = (rawData[index] >> 16) & 0xFFFF;
- TArrayS xyPattern[2];
- xyPattern[0].Set(4);
- xyPattern[1].Set(4);
+ index += 1;
+ pattern[1][0] = rawData[index] & 0xFFFF; // y-strip pattern for chaber 0
+ pattern[1][1] = (rawData[index] >> 16) & 0xFFFF; // y-strip pattern for chaber 0
+ index += 1;
+ pattern[1][2] = rawData[index] & 0xFFFF;
+ pattern[1][3] = (rawData[index] >> 16) & 0xFFFF;
- xyPattern[0].AddAt(X1_pattern,0);
- xyPattern[0].AddAt(X2_pattern,1);
- xyPattern[0].AddAt(X3_pattern,2);
- xyPattern[0].AddAt(X4_pattern,3);
+ if(pattern[0][0] || pattern[0][1] || pattern[0][2] || pattern[0][3]
+ || pattern[1][0] || pattern[1][1] || pattern[1][2] || pattern[1][3]
+ ){
+
+ HLTDebug("iReg: %d, iLoc :%d, locId : %d,X : %x, %x, %x, %x ...Y : %x, %x, %x, %x",
+ iReg,iLoc,locId,pattern[0][0],pattern[0][1],pattern[0][2],pattern[0][3],
+ pattern[1][0],pattern[1][1],pattern[1][2],pattern[1][3]);
+
+ for(int iChamber = 0; iChamber < 4 ; iChamber++){ //4 chambers per DDL
+ for(int iPlane = 0; iPlane < 2 ; iPlane++){// 2 cathode plane
+ if(pattern[iPlane][iChamber]){
+ detElemId = fRegToLocCard[iRegLoc].fDetElemId[iChamber];
+ HLTDebug("\tdetElemId : %d\n",detElemId);
+ for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
+ if ((pattern[iPlane][iChamber] >> ibitxy) & 0x1) {
- xyPattern[1].AddAt(Y1_pattern,0);
- xyPattern[1].AddAt(Y2_pattern,1);
- xyPattern[1].AddAt(Y3_pattern,2);
- xyPattern[1].AddAt(Y4_pattern,3);
-
- HLTDebug("iLocCard : %d, locId : %d, X : %x, %x, %x, %x .... Y : %x, %x, %x, %x\n",
- iLocCard,locId,X1_pattern,X2_pattern,X3_pattern,X4_pattern,
- Y1_pattern,Y2_pattern,Y3_pattern,Y4_pattern);
-
+ // not quite sure about this
+ offset = 0;
+ ithSwitch = (fRegToLocCard[iRegLoc].fSwitch >> shiftIndex) & 0x1;
+ if (iPlane && ithSwitch) offset = -8;
+
+ secondLocation = ibitxy + offset;
+
+ idetElemId = detElemId%1000;
+
+ idetElemId &= 0x1FF ;
+ iPlane &= 0x1 ;
+ locId &= 0xFF ;
+ secondLocation &= 0xF ;
+
+ idManuChannel &= 0x0;
+ idManuChannel = (idManuChannel|idetElemId)<<1;
+ idManuChannel = (idManuChannel|iPlane)<<8;
+ idManuChannel = (idManuChannel|locId)<<4 ;
+ idManuChannel |= secondLocation ;
+
+ idManuChannel -= fIdOffSet ;
+
+ if(fLookUpTableData[idManuChannel+1].fIdManuChannel == -1) //skip uninitialized values
+ continue;
+
+ fPadData[idManuChannel].fDetElemId = detElemId;
+ fPadData[idManuChannel].fIdManuChannel = idManuChannel;
+ fPadData[idManuChannel].fIX = fLookUpTableData[idManuChannel+1].fIX;
+ fPadData[idManuChannel].fIY = fLookUpTableData[idManuChannel+1].fIY;
+ fPadData[idManuChannel].fRealX = fLookUpTableData[idManuChannel+1].fRealX;
+ fPadData[idManuChannel].fRealY = fLookUpTableData[idManuChannel+1].fRealY;
+ fPadData[idManuChannel].fRealZ = fLookUpTableData[idManuChannel+1].fRealZ;
+ fPadData[idManuChannel].fPcbZone = fLookUpTableData[idManuChannel+1].fPcbZone;
+ fPadData[idManuChannel].fPlane = fLookUpTableData[idManuChannel+1].fPlane;
+ HLTDebug("\t Hit Found fo ich : %d, iPlane : %d, detelem %d, id : %d, at (%lf, %lf, %lf) cm"
+ ,iChamber,fLookUpTableData[idManuChannel+1].fPlane,detElemId,fLookUpTableData[idManuChannel+1].fIdManuChannel,
+ fPadData[idManuChannel].fRealX,
+ fPadData[idManuChannel].fRealY,fPadData[idManuChannel].fRealZ);
+
+ if(fMaxFiredPerDetElem[detElemId] == 0){
+ DataIdIndex first;
+ first.push_back(idManuChannel);
+ fDetElemToDataId[detElemId] = first;
+ }else{
+ dataIndex = fDetElemToDataId[detElemId];
+ dataIndex.push_back(idManuChannel);
+ fDetElemToDataId[detElemId] = dataIndex;
+ }
+
+ fMaxFiredPerDetElem[detElemId] = fMaxFiredPerDetElem[detElemId] + 1;
+
+ dataCount ++;
+
+ }//pattern maching is found
+ }// loop of ibitxy
+ }// if pattern
+ }// iplane
+ }// ichamber
+
+ }// if any non zero pattern found
+
+
index += 1 ; // skipping the last word though it is important
- padList.clear() ;
- if( Pattern2Pad(iLocCard, xyPattern, padList) ) {
-
- for (UInt_t iEntry = 0; iEntry < padList.size(); iEntry++) {
-
- AliHLTMUONHitReconstructor::DHLTPad dPad = padList[iEntry];
-
- detElemId = dPad.fDetElemId;
- int idetElemId = (detElemId)%1000;
- idetElemId &= 0x1FF ;
- int iPlane = dPad.fPlane & 0x1 ;
- int iX = dPad.fIX & 0x7F ;
- int iY = dPad.fIY & 0x3F ;
-
- idManuChannel &= 0x0;
- idManuChannel = (idManuChannel|idetElemId)<<1;
- idManuChannel = (idManuChannel|iPlane)<<7;
- idManuChannel = (idManuChannel|iX)<<6 ;
- idManuChannel |= iY ;
- idManuChannel -= fIdOffSet ;
-
- fPadData[idManuChannel].fDetElemId = dPad.fDetElemId;
- fPadData[idManuChannel].fIdManuChannel = idManuChannel;
- fPadData[idManuChannel].fIX = fLookUpTableData[idManuChannel+1].fIX;
- fPadData[idManuChannel].fIY = fLookUpTableData[idManuChannel+1].fIY;
- fPadData[idManuChannel].fRealX = fLookUpTableData[idManuChannel+1].fRealX;
- fPadData[idManuChannel].fRealY = fLookUpTableData[idManuChannel+1].fRealY;
- fPadData[idManuChannel].fRealZ = fLookUpTableData[idManuChannel+1].fRealZ;
- fPadData[idManuChannel].fPcbZone = fLookUpTableData[idManuChannel+1].fPcbZone;
- fPadData[idManuChannel].fPlane = fLookUpTableData[idManuChannel+1].fPlane;
-
- fDetManuChannelIdList[dataCount] = idManuChannel;
- if(detElemId != prevDetElemId){
- if(fNofFiredDetElem>0){
- fMaxFiredPerDetElem[fNofFiredDetElem-1] = dataCount;
- }
- fNofFiredDetElem++;
- prevDetElemId = detElemId ;
- } // if detelem condn
- dataCount ++;
-
-// printf("detelemId : %d, plane : %d, IX : %d, IY : %d realX : %f, realY : %f , realZ %f\n",
-// dPad.fDetElemId,dPad.fPlane,dPad.fIX,dPad.fIY,
-// fPadData[idManuChannel].fRealX,fPadData[idManuChannel].fRealY,fPadData[idManuChannel].fRealZ);
-
- }// for loop of entry
-
- }//pattern2pad
-
+ }// if locId <=234
}// Dec Condn
-
- }// iLocCard > 0
-
- if(!reg_phys_trig_occur)
- index += 45;
- index += 1; // end of local Data
- HLTDebug("iReg %d, iLoc %d, iLocCard : %d, locId : %d, trigY %x, triggX %x, loDev %x, dec %x, sign %x,rawData : %x",
- iReg,iLoc,iLocCard,locId,triggY,triggX,loDev,dec,sign, rawData[index]);
-
- index = iLocIndex + 6 ;
-// delete localBoard;
-
- }// iLoc loop
-
-// delete crate;
-// delete boards;
- }// iReg Loop
-
-// fDigitPerDDL = dataCount;
-// fMaxFiredPerDetElem[fNofFiredDetElem-1] = dataCount;
-
-
- return true;
-}
-
-bool AliHLTMUONTriggerReconstructor::Pattern2Pad(int nBoard, TArrayS* xyPattern, vector<AliHLTMUONHitReconstructor::DHLTPad>& padList)
-{
-
- Int_t detElemId;
- Int_t previousDetElemId[4] = {0};
- Int_t previousBoard[4] = {0};
+ if(!reg_phys_trig_occur)
+ index += 45;
+
+ index += 1; // end of local Data 0xCAFEFADE
+ HLTDebug("iReg %d, iLoc %d, locId : %d, trigY %x, triggX %x, loDev %x, dec %x, sign %x,rawData : %x",
+ iReg,iLoc,locId,triggY,triggX,loDev,dec,sign, rawData[index]);
- // loop over x1-4 and y1-4
- for(Int_t iChamber = 0; iChamber < 4; ++iChamber){
- for(Int_t iCath = 0; iCath < 2; ++iCath){
- //int index = 0;
- Int_t pattern = (Int_t)xyPattern[iCath].At(iChamber);
- if (!pattern) continue;
+ index = iLocIndex + 6 ; //important to reset the index counter for fake locids like 235
- // get detElemId
- /*
- AliMUONTriggerCircuit triggerCircuit;
- AliMUONLocalTriggerBoard* localBoard = fCrateManager->LocalBoard(nBoard);
- detElemId = triggerCircuit.DetElemId(iChamber+10, localBoard->GetName());//FIXME +/-10 (should be ok with new mapping)
- */
- AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
- if (ddlStore != NULL) continue;
- AliMpLocalBoard* localBoard = ddlStore->GetLocalBoard(nBoard);
- if (localBoard == NULL) continue;
- detElemId = localBoard->GetDEIdByChamber(iChamber);
-
-
- if(iCath == 1){ // FIXME should find a more elegant way
- // Don't save twice the same digit
- // (since strips in non bending plane can cross several boards)
- Int_t prevDetElemId = previousDetElemId[iChamber];
- Int_t prevBoard = previousBoard[iChamber];
- previousDetElemId[iChamber] = detElemId;
- previousBoard[iChamber] = nBoard;
-
- if(detElemId == prevDetElemId){
- if(nBoard-prevBoard==1) continue;
- }
- }
-
- const AliMpVSegmentation* seg
- = AliMpSegmentation::Instance()
- ->GetMpSegmentation(detElemId, AliMp::GetCathodType(iCath));
-
- // loop over the 16 bits of pattern
- for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
-
- if ((pattern >> ibitxy) & 0x1) {
-
- //Int_t temp = (pattern >> ibitxy) & 0x1 ;
- // not quite sure about this
- Int_t offset = 0;
- if (iCath && localBoard->GetSwitch(6)) offset = -8;
-
- AliMpPad pad = seg->PadByLocation(AliMpIntPair(nBoard,ibitxy+offset),kTRUE);
-
- AliHLTMUONHitReconstructor::DHLTPad dPad;
- if (!pad.IsValid()) {
- //AliWarning(Form("No pad for detElemId: %d, nboard %d, ibitxy: %d\n",
- // detElemId, nBoard, ibitxy));
- continue ;
- } //
-
- Int_t padX = pad.GetIndices().GetFirst();
- Int_t padY = pad.GetIndices().GetSecond();
- // file digit
- dPad.fIX = padX ;
- dPad.fIY = padY ;
- dPad.fPlane = iCath ;
- dPad.fDetElemId = detElemId ;
- //printf("nBoard : %d, detElemId : %d, chamber %d, iCath %d, ibitxy %d, pattern %d, switch %d, offset %d, temp %x, padX : %d, padY: %d\n",nBoard,detElemId,iChamber,iCath,ibitxy,pattern,localBoard->GetSwitch(6), offset, temp,padX,padY);
- //dPad.fDetElemId = detElemId ;
-
- padList.push_back(dPad);
-
- }// xyPattern
- }// ibitxy
-// delete localBoard;
- }// cath
- } // ichamber
+ }// iLoc loop
+
+ }// iReg Loop
return true;
}
bool AliHLTMUONTriggerReconstructor::FindTrigHits()
{
- for(int iDet=0; iDet<fNofFiredDetElem ; iDet++){
-
- if(iDet>0)
- MergeTrigHits(fMaxFiredPerDetElem[iDet-1],fMaxFiredPerDetElem[iDet]);
- else
- MergeTrigHits(0,fMaxFiredPerDetElem[iDet]);
-
-// if(iDet==0)
-// for(int i=0;i<fMaxFiredPerDetElem[iDet];i++)
-// fGetIdTotalData[fPadData[fDetManuChannelIdList[i]].fIX][fPadData[fDetManuChannelIdList[i]].fIY][fPadData[fDetManuChannelIdList[i]].fPlane] = 0;
-// else
-// for(int i=fMaxFiredPerDetElem[iDet-1];i<fMaxFiredPerDetElem[iDet];i++)
-// fGetIdTotalData[fPadData[fDetManuChannelIdList[i]].fIX][fPadData[fDetManuChannelIdList[i]].fIY][fPadData[fDetManuChannelIdList[i]].fPlane] = 0;
+ map<int,DataIdIndex>::iterator it;
+ for(it = fDetElemToDataId.begin(); it != fDetElemToDataId.end(); it++){
+ HLTDebug("Nof data found in Detelem : %d = %d",it->first,(it->second).size());
+ if(!MergeTrigHits(it->second))
+ return false;
}// loop over detection element
-
- //for(int iPad=fDataPerDetElem[i];iPad<fDataPerDetElem[i+1];iPad++){
- for(int iPad=0;iPad<fDigitPerDDL;iPad++){
-// fGetIdTotalData[fPadData[fDetManuChannelIdList[iPad]].fIX][fPadData[fDetManuChannelIdList[iPad]].fIY][fPadData[fDetManuChannelIdList[iPad]].fPlane] = 0;
- fPadData[fDetManuChannelIdList[iPad]].fDetElemId = 0;
- fPadData[fDetManuChannelIdList[iPad]].fBuspatchId = 0;
- fPadData[fDetManuChannelIdList[iPad]].fIdManuChannel = 0;
- fPadData[fDetManuChannelIdList[iPad]].fIX = 0 ;
- fPadData[fDetManuChannelIdList[iPad]].fIY = 0 ;
- fPadData[fDetManuChannelIdList[iPad]].fRealX = 0.0 ;
- fPadData[fDetManuChannelIdList[iPad]].fRealY = 0.0 ;
- fPadData[fDetManuChannelIdList[iPad]].fRealZ = 0.0 ;
- fPadData[fDetManuChannelIdList[iPad]].fPlane = -1 ;
- fPadData[fDetManuChannelIdList[iPad]].fPcbZone = -1 ;
- fPadData[fDetManuChannelIdList[iPad]].fCharge = 0 ;
- }
-
- for(int i=0;i<fgkDetElem;i++)
- fMaxFiredPerDetElem[i] = 0;
-
- delete []fDetManuChannelIdList;
+ DataIdIndex dataIndex;
+ for(it = fDetElemToDataId.begin(); it != fDetElemToDataId.end(); it++){
+ dataIndex = it->second;
+ for(size_t i=0;i<dataIndex.size();i++){
+ fPadData[dataIndex.at(i)].fDetElemId = 0;
+ fPadData[dataIndex.at(i)].fBuspatchId = 0;
+ fPadData[dataIndex.at(i)].fIdManuChannel = 0;
+ fPadData[dataIndex.at(i)].fIX = 0 ;
+ fPadData[dataIndex.at(i)].fIY = 0 ;
+ fPadData[dataIndex.at(i)].fRealX = 0.0 ;
+ fPadData[dataIndex.at(i)].fRealY = 0.0 ;
+ fPadData[dataIndex.at(i)].fRealZ = 0.0 ;
+ fPadData[dataIndex.at(i)].fPlane = -1 ;
+ fPadData[dataIndex.at(i)].fPcbZone = -1 ;
+ fPadData[dataIndex.at(i)].fCharge = 0 ;
+ }// data per detelem loop
+ }//detelem loop
+
return true;
}
-bool AliHLTMUONTriggerReconstructor::MergeTrigHits(int minPadId, int maxPadId)
+bool AliHLTMUONTriggerReconstructor::MergeTrigHits(DataIdIndex& dataIndex)
{
int idManuChannelB, idManuChannelNB;
float halfPadLengthX,halfPadLengthY;
float diffX,diffY;
- for(int iPad=minPadId;iPad<maxPadId;iPad++){
- idManuChannelB = fDetManuChannelIdList[iPad];
- //printf("idManuChannelB : %d, fPadData[idManuChannelB].fPlane : %d\n",idManuChannelB,fPadData[idManuChannelB].fPlane);
+ HLTDebug("\tThe bending plane hits are :");
+ for(size_t iPad=0;iPad<dataIndex.size();iPad++){
+ idManuChannelB = dataIndex.at(iPad);
+ if(fPadData[idManuChannelB].fPlane == 0){
+ HLTDebug("\t detelem :%d, pcbzone : %d, (%f, %f, %f) cm",fPadData[idManuChannelB].fDetElemId,fPadData[idManuChannelB].fPcbZone,fPadData[idManuChannelB].fRealX,
+ fPadData[idManuChannelB].fRealY,fPadData[idManuChannelB].fRealZ);
+ }
+ }
+
+ HLTDebug("\tThe non-bending plane hits are :");
+ for(size_t jPad=0;jPad<dataIndex.size();jPad++){
+ idManuChannelNB = dataIndex.at(jPad);
+ if(fPadData[idManuChannelNB].fPlane == 1){
+ HLTDebug("\t detelem :%d, pcbzone : %d,(%f, %f, %f) cm",fPadData[idManuChannelNB].fDetElemId,fPadData[idManuChannelNB].fPcbZone,fPadData[idManuChannelNB].fRealX,
+ fPadData[idManuChannelNB].fRealY,fPadData[idManuChannelNB].fRealZ);
+ }
+ }
+
+
+ for(size_t iPad=0;iPad<dataIndex.size();iPad++){
+ idManuChannelB = dataIndex.at(iPad);
if(fPadData[idManuChannelB].fPlane == 0){
halfPadLengthX = AliHLTMUONTriggerReconstructor::fgkHalfPadSizeXB[fPadData[idManuChannelB].fPcbZone] ;
- for(int iPad=minPadId;iPad<maxPadId;iPad++){
- idManuChannelNB = fDetManuChannelIdList[iPad];
+ for(size_t jPad=0;jPad<dataIndex.size();jPad++){
+ idManuChannelNB = dataIndex.at(jPad);;
if(fPadData[idManuChannelNB].fPlane == 1){
halfPadLengthY = AliHLTMUONTriggerReconstructor::fgkHalfPadSizeYNB[fPadData[idManuChannelNB].fPcbZone] ;
diffY = fabsf(fPadData[idManuChannelNB].fRealY) - fabsf(fPadData[idManuChannelB].fRealY);
else
diffY = fabsf(fPadData[idManuChannelB].fRealY) - fabsf(fPadData[idManuChannelNB].fRealY) ;
- //printf("diffX %f, halfPadLengthX %f, diffY %f, halfPadLengthY %f\n",diffX,halfPadLengthX,diffY,halfPadLengthY);
+ HLTDebug("\tdiffX %f, halfPadLengthX %f, diffY %f, halfPadLengthY %f\n",diffX,halfPadLengthX,diffY,halfPadLengthY);
- if(diffX < halfPadLengthX + 1.0 && diffY < halfPadLengthY + 1.0 ){// added redundancy of 1.0 cm due to the pb of geometrical segmentation
+ if(diffX < halfPadLengthX + 1.0 && diffY < halfPadLengthY + 1.0 ){// added redundancy of 1.0 cm due to the pb of geometrical segmentation
AliHLTMUONRecHitStruct hit;
hit.fX = fPadData[idManuChannelNB].fRealX;
- hit.fY = fPadData[idManuChannelNB].fRealY;
+ hit.fY = fPadData[idManuChannelB].fRealY;
hit.fZ = fPadData[idManuChannelNB].fRealZ;
- int ichamber = int((fPadData[idManuChannelB].fDetElemId - 1000)/100);
- ichamber--;
- fRecPoints[(*fRecPointsCount)].fHit[ichamber] = hit;
+ fRecPoints[(*fRecPointsCount)].fHit[0] = hit;
+ fRecPoints[(*fRecPointsCount)].fId = fPadData[idManuChannelB].fDetElemId ;
(*fRecPointsCount)++;
if((*fRecPointsCount) == fMaxRecPointsCount){
- printf("Nof RecHit (i.e. %d) exceeds the max nof RecHit limit %d\n",(*fRecPointsCount),fMaxRecPointsCount);
+ HLTFatal("Nof RecHit (i.e. %d) exceeds the max nof RecHit limit %d\n",(*fRecPointsCount),fMaxRecPointsCount);
return false;
}
- printf("ichamber : %d, detelem : %d, x %f, y %f, z %f\n",ichamber,fPadData[idManuChannelB].fDetElemId,fPadData[idManuChannelNB].fRealX,
+ HLTDebug("\t\t\tdetelem : %d, x %f, y %f, z %f\n",fPadData[idManuChannelB].fDetElemId,fPadData[idManuChannelNB].fRealX,
fPadData[idManuChannelB].fRealY,fPadData[idManuChannelB].fRealZ);
}
-
-
-
}//condn for non-bending plane
}//for loop for non-bending plane
**********************************************************************/
#include <vector>
-#include <TArrayS.h>
#include <AliHLTLogging.h>
+
#include "AliHLTMUONTriggerRecordsBlockStruct.h"
#include "AliHLTMUONHitReconstructor.h"
-#include "AliMUONTriggerCrateStore.h"
+
+#if __GNUC__ < 3
+#define std
+#endif
+
+typedef std::vector<int> DataIdIndex;
class AliHLTMUONTriggerReconstructor : public AliHLTLogging
{
public:
+ struct RegToLoc{
+ int fTrigDDL; // trigger id (0 or 1)
+ int fRegId,fLoc,fLocId; // regeonal and local id.
+ int fSwitch; // packed switch word of 10 bits.
+ int fDetElemId[4]; // Four detection element correspond to four detection element for each local card.
+ };
+
+
AliHLTMUONTriggerReconstructor();
virtual ~AliHLTMUONTriggerReconstructor();
bool LoadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookUpTableData, int lookUpTableId);
-
+
+ bool SetRegToLocCardMap(RegToLoc* regToLoc);
//bool Run(int iEvent, int iDDL, AliHLTMUONTriggerRecordStruct trigRecord, int *nofTrigRec); // for Reading using rawreader
bool Run(int *rawData, int *rawDataSize, AliHLTMUONTriggerRecordStruct trigRecord[], int *nofTrigRec);
int GetLutLine(){return fgkLutLine ;}
- static int GetkDetectorId() { return fgkDetectorId; }
- static int GetkDDLOffSet() { return fgkDDLOffSet; }
- static int GetkNofDDL() { return fgkNofDDL; }
- static int GetkDDLHeaderSize() { return fgkDDLHeaderSize; }
+ static int GetkDetectorId() { return AliHLTMUONTriggerReconstructor::fgkDetectorId ; }
+ static int GetkDDLOffSet() { return AliHLTMUONTriggerReconstructor::fgkDDLOffSet; }
+ static int GetkNofDDL() { return AliHLTMUONTriggerReconstructor::fgkNofDDL; }
+ static int GetkDDLHeaderSize() { return AliHLTMUONTriggerReconstructor::fgkDDLHeaderSize; }
-private:
- static const int fgkDetectorId ; // DDL Offset
+ private:
+ static const int fgkDetectorId ; // Detector ID
static const int fgkDDLOffSet ; // DDL Offset
static const int fgkNofDDL ; // Number of DDL
static const int fgkDDLHeaderSize ; // DDL header size
static const int fgkOddLutSize ; // Size of the LookupTable with odd DDLID
static const int fgkLutLine; // nof Line in LookupTable
- static const int fgkMinIdManuChannel[2]; // Minimum value of idManuChannel in LookupTable
+ static const int fgkMinIdManuChannel[2]; // Minimum value of idManuChannel in LookupTable, 2 corresponds to two types of DDL (even/odd)
static const int fgkMaxIdManuChannel[2]; // Maximum value of idManuChannel in LookupTable
- static const float fgkHalfPadSizeXB[3]; // pad halflength for the pcb zones
- static const float fgkHalfPadSizeYNB[2]; // pad halflength for the pcb zones
+ static const float fgkHalfPadSizeXB[3]; // pad halflength for the pcb zones, 3 corresponds to 3 types of pad in bending side
+ static const float fgkHalfPadSizeYNB[2]; // pad halflength for the pcb zones, 2 corresponds to 2 types on nonbneding pad
static const int fgkDetElem; // nof Detection element per DDL
AliHLTMUONTriggerRecordStruct *fRecPoints; // Reconstructed hits
int *fRecPointsCount; // nof reconstructed hit
int fMaxRecPointsCount; // max nof reconstructed hit
- int fDigitPerDDL; // Total nof Digits perDDL
-
+ //104 correspond to maximum nuber of x indices a nonbending side of detelem may have (i.e. 1101)
+ //and 64 corresponds to the maximum number of y indices occurs in bending side of detelem (i.e 1100)
int fGetIdTotalData[104][64][2] ; // an array of idManuChannel with argumrnt of centralX,centralY and planeType
- int fNofFiredDetElem,*fMaxFiredPerDetElem; // counter for detector elements that are fired
- int *fDetManuChannelIdList; // pointer to an array of idManuChannel
- int *fCentralChargeB,*fCentralChargeNB; // pointer to an array of central hit
-
+ RegToLoc fRegToLocCard[128]; // 8 regional card per ddl and 16 slots per regional crate together made 16*8 = 128.
+ map<int,int> fMaxFiredPerDetElem; // counter for detector elements that are fired
+ map<int,DataIdIndex> fDetElemToDataId; // detelem to pointer to dataId index mapping
+
int fDDLId ;
int fIdOffSet ;
- AliMUONTriggerCrateStore* fCrateManager;
-
- bool MergeTrigHits(int minPadId, int maxPadId);
+ bool MergeTrigHits(DataIdIndex& dataIndex);
bool FindTrigHits() ;
bool ReadDDL(int *rawData, int *rawDataSize);
- bool Pattern2Pad(int nBoard, TArrayS* xyPattern, vector<AliHLTMUONHitReconstructor::DHLTPad>& padList);
-
};
#endif // AliHLTMUONTRIGGERRECONSTRUCTOR_H
/** @file AliHLTMUONTriggerReconstructorComponent.cxx
@author Indranil Das
@date
- @brief A processing component for the dHLT TrigRec. */
+ @brief Implementation of the trigger DDL reconstructor component. */
#if __GNUC__ >= 3
using namespace std;
#include "AliHLTSystem.h"
#include "AliHLTMUONTriggerReconstructorComponent.h"
-#include "AliHLTDefinitions.h"
+#include "AliHLTMUONTriggerReconstructor.h"
+#include "AliHLTMUONHitReconstructor.h"
+#include "AliHLTMUONConstants.h"
+
#include <stdlib.h>
#include <errno.h>
-// this is a global object used for automatic component registration, do not use this
-AliHLTMUONTriggerReconstructorComponent gAliHLTMUONTriggerReconstructorComponent;
+namespace
+{
+ // This is a global object used for automatic component registration,
+ // do not use this for calculation.
+ AliHLTMUONTriggerReconstructorComponent gAliHLTMUONTriggerReconstructorComponent;
+} // end of namespace
+
ClassImp(AliHLTMUONTriggerReconstructorComponent)
+
AliHLTMUONTriggerReconstructorComponent::AliHLTMUONTriggerReconstructorComponent()
:
- fOutputPercentage(100), // By default we copy to the output exactly what we got as input
+ fTrigRec(NULL),
fDDLDir(""),
- fDDL(0),
- fTrigRec(NULL)
- {
- }
+ fDDL(0)
+{
+}
+
AliHLTMUONTriggerReconstructorComponent::~AliHLTMUONTriggerReconstructorComponent()
- {
- }
+{
+}
+
const char* AliHLTMUONTriggerReconstructorComponent::GetComponentID()
- {
- return "MUONTrigRec"; // The ID of this component
- }
+{
+ return "MUONTrigRec"; // The ID of this component
+}
+
+
+void AliHLTMUONTriggerReconstructorComponent::GetInputDataTypes( std::vector<AliHLTComponentDataType>& list)
+{
+ list.clear();
+ list.push_back( AliHLTMUONConstants::TriggerDDLRawDataType() );
+}
-void AliHLTMUONTriggerReconstructorComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
- {
- /* in order to be backward compatible we have to keep the old code, at
- * least for a while. Remember to use the new const kAliHLTVoidDataType
- * if you are using a more recent AliRoot version (from Jan 07)
- list.push_back(kAliHLTAnyDataType); // We do not have any requirements for our input data type(s).
- */
-
- list.clear();
- list.push_back( AliHLTMUONConstants::TriggerDDLRawDataType() );
- }
AliHLTComponentDataType AliHLTMUONTriggerReconstructorComponent::GetOutputDataType()
- {
- /* in order to be backward compatible we have to keep the old code, at
- * least for a while. Remember to use the new const kAliHLTVoidDataType
- * if you are using a more recent AliRoot version (from Jan 07)
- return kAliHLTVoidDataType;
- */
- return AliHLTMUONConstants::TriggerRecordsBlockDataType();
- }
+{
+ return AliHLTMUONConstants::TriggerRecordsBlockDataType();
+}
-void AliHLTMUONTriggerReconstructorComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
- {
- constBase = 0;
- inputMultiplier = ((double)fOutputPercentage)/100.0;
- }
+void AliHLTMUONTriggerReconstructorComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ constBase = 0;
+ inputMultiplier = 1;
+}
// Spawn function, return new instance of this class
AliHLTComponent* AliHLTMUONTriggerReconstructorComponent::Spawn()
- {
- return new AliHLTMUONTriggerReconstructorComponent;
- }
+{
+ return new AliHLTMUONTriggerReconstructorComponent;
+}
+
-int AliHLTMUONTriggerReconstructorComponent::DoInit( int argc, const char** argv )
+int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
{
- // perform initialization. We check whether our relative output size is specified in the arguments.
-
- fTrigRec = new AliHLTMUONTriggerReconstructor();
+ // perform initialization. We check whether our relative output size is specified in the arguments.
+
+ HLTInfo("Initialising DHLT Trigger Record Component");
+
+ fTrigRec = new AliHLTMUONTriggerReconstructor();
- HLTInfo("dHLT trigrec");
- if (argc==0 && argv==NULL) {
- Logging( kHLTLogError, "AliHLTMUONTriggerReconstructorComponent::DoInit", "Arguments missing", " no arguments" );
- // this is just to get rid of the warning "unused parameter"
- }
+ // this is just to get rid of the warning "unused parameter"
+ if (argc==0 && argv==NULL) {
+ HLTError("Arguments missing, no arguments" );
+ }
+
+
+ char lutFileName[500],reglocFileName[500];
- //Int_t i = 0;
- char lutFileName[500], ddlDir[500];
-
- fOutputPercentage = 100;
- int i = 0;
- char* cpErr;
- while ( i < argc )
- {
- Logging( kHLTLogDebug, "HLT::MUONTrigRec::DoInit", "Arguments", "argv[%d] == %s", i, argv[i] );
- if ( !strcmp( argv[i], "output_percentage" ) )
- {
- if ( i+1>=argc )
- {
- Logging(kHLTLogError, "HLT::MUONTrigRec::DoInit", "Missing Argument", "Missing output_percentage parameter");
- return ENOTSUP;
- }
- Logging( kHLTLogDebug, "HLT::MUONTrigRec::DoInit", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
- fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
- if ( *cpErr )
- {
- Logging(kHLTLogError, "HLT::MUONTrigRec::DoInit", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
- return EINVAL;
- }
- Logging( kHLTLogInfo, "HLT::MUONTrigRec::DoInit", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
- i += 2;
- continue;
- }
+ int i = 0;
+ char* cpErr;
+ while ( i < argc )
+ {
+ HLTDebug("argv[%d] == %s", i, argv[i] );
+
+ if ( !strcmp( argv[i], "lut" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("LookupTable filename not specified" );
+ return EINVAL; /* Invalid argument */
+ }
+ sprintf(lutFileName,"%s",argv[i+1]);
+
+ i += 2;
+ continue;
+ }// lut argument
+
+ if ( !strcmp( argv[i], "ddl" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("DDL number not specified" );
+ return EINVAL; /* Invalid argument */
+ }
- if ( !strcmp( argv[i], "lut" ) ) {
- if ( argc <= i+1 ) {
- Logging( kHLTLogError, "AliHLTMUONTriggerReconstructorComponent::DoInit", "Missing LookupTable filename", "LookupTable filename not specified" );
- return EINVAL; /* Invalid argument */
- }
-
- sprintf(lutFileName,"%s",argv[i+1]);
-
- i += 2;
- continue;
- }// lut argument
-
-
- if ( !strcmp( argv[i], "ddl" ) ) {
- if ( argc <= i+1 ) {
- Logging( kHLTLogError, "AliHLTMUONTriggerReconstructorComponent::DoInit", "Missing DDL argument", "DDL number not specified" );
- HLTError("AliHLTMUONTriggerReconstructorComponent::DoInit : DDL number is not specified ");
- return EINVAL; /* Invalid argument */
- }
-
- fDDL = atoi(argv[i+1]);
-
- i += 2;
- continue;
- }// ddl argument
+ fDDL = strtoul( argv[i+1], &cpErr, 0 );
+ if ( *cpErr )
+ {
+ HLTError("Cannot convert '%s' to DDL Number ", argv[i+1] );
+ return EINVAL;
+ }
+ //fDDL = atoi(argv[i+1]);
+
+ i += 2;
+ continue;
+ }// ddl argument
+ if ( !strcmp( argv[i], "rawdir" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("DDL directory not specified" );
+ return EINVAL; /* Invalid argument */
+ }
+
+ fDDLDir = argv[i+1] ;
+ i += 2;
+ continue;
+ }// ddl directory argument
+
+ if ( !strcmp( argv[i], "reglocmap" ) ) {
+ if ( argc <= i+1 ) {
+ HLTError("Regional to Local Card mapping filename not specified" );
+ return EINVAL; /* Invalid argument */
+ }
- if ( !strcmp( argv[i], "rawdir" ) ) {
- if ( argc <= i+1 ) {
- Logging( kHLTLogError, "AliHLTMUONTriggerReconstructorComponent::DoInit", "Missing DDL directory", "DDL directory not specified" );
- HLTError("AliHLTMUONTriggerReconstructorComponent::DoInit : DDL directory is not specified ");
- return EINVAL; /* Invalid argument */
- }
-
- fDDLDir = argv[i+1] ;
-
- i += 2;
- continue;
- }// ddl directory argument
-
- Logging(kHLTLogError, "HLT::MUONTrigRec::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
- return EINVAL;
+ sprintf(reglocFileName,"%s",argv[i+1]);
+
+ i += 2;
+ continue;
+ }// regtolocalmap argument
+
+ HLTError("Unknown option '%s'", argv[i] );
+ return EINVAL;
- }//while loop
+ }//while loop
int lutline = fTrigRec->GetLutLine();
AliHLTMUONHitReconstructor::DHLTLut* lookupTable = new AliHLTMUONHitReconstructor::DHLTLut[lutline];
if(!ReadLookUpTable(lookupTable,lutFileName)){
- Logging(kHLTLogInfo, "AliHLTMUONTriggerReconstructorComponent::DoInit", "Failed to read lut", "lut cannot be read, DoInit");
+ HLTError("Failed to read lut, lut cannot be read");
return ENOENT ; /* No such file or directory */
}else{
- fTrigRec->LoadLookUpTable(lookupTable,fDDL);
+ fTrigRec->LoadLookUpTable(lookupTable,fDDL+AliHLTMUONTriggerReconstructor::GetkDDLOffSet());
+
+ AliHLTMUONTriggerReconstructor::RegToLoc regToLocMap[128]; // 16(locCard)*8(regCard)
+ if(!ReadRegToLocMap(regToLocMap,reglocFileName)){
+ HLTError("Failed to read RegToLocMap file");
+ return ENOENT ; /* No such file or directory */
+ }
+
+ if(!(fTrigRec->SetRegToLocCardMap(regToLocMap))){
+ HLTError("Failed to assign RegToLocMap to TrigRec Class due to memory problem");
+ return ENOMEM ; /*cannot allocate memory*/
+ }
}// reading lut
delete []lookupTable;
+ HLTInfo("Initialisation of DHLT Trigger Record Component is done");
+
return 0;
}
+
int AliHLTMUONTriggerReconstructorComponent::DoDeinit()
- {
- if(fTrigRec)
- delete fTrigRec;
- HLTInfo("dHLT trigrec");
- return 0;
+{
+ if(fTrigRec)
+ delete fTrigRec;
- return 0;
- }
+ HLTInfo(" Deinitialising DHLT Trigger Record Component");
+
+ return 0;
+}
-int AliHLTMUONTriggerReconstructorComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
+int AliHLTMUONTriggerReconstructorComponent::DoEvent(
+ const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ std::vector<AliHLTComponentBlockData>& outputBlocks
+ )
+{
+ // Process an event
+ unsigned long totalSize = 0;
+ HLTDebug("Output percentage set to %lu and totalSize %lu",fOutputPercentage,totalSize );
+
+ HLTDebug("Event : %d has : %lu blocks",(int)evtData.fEventID,evtData.fBlockCnt);
+ // Loop over all input blocks in the event
+ for ( unsigned long n = 0; n < evtData.fBlockCnt; n++ )
{
- // Process an event
- unsigned long totalSize = 0;
- Logging( kHLTLogInfo, "HLT::MUONTrigRec::DoEvent", "Output percentage set", "Output percentage set to %lu %% and totalSize %lu", fOutputPercentage,totalSize );
- // Loop over all input blocks in the event
- for ( unsigned long n = 0; n < evtData.fBlockCnt; n++ )
- {
+ HLTDebug("block : %d, block rawData : %p, block.fSize (bytes) : %d, blocks.fDataType.fID : %s, blocks.fDataType.fOrigin : %s, required type : %s\n",
+ n,blocks[n].fPtr,blocks[n].fSize,(char *)(blocks[n].fDataType.fID),
+ (char *)(blocks[n].fDataType.fOrigin,(char *)(AliHLTMUONConstants::TriggerDDLRawDataType().fID)));
+
- if ( totalSize > size )
- break;
+ if(strncmp((char *)(blocks[n].fDataType.fID),(char *)(AliHLTMUONConstants::TriggerDDLRawDataType().fID),kAliHLTComponentDataTypefIDsize)) continue;
- int totalDDLSize = blocks[n].fSize/4;
- int ddlRawDataSize = totalDDLSize - AliHLTMUONTriggerReconstructor::GetkDDLHeaderSize();
- //cout<<"ddlRawDataSize :"<<ddlRawDataSize<<endl;
- int *buffer = (int *)((int *)blocks[n].fPtr + AliHLTMUONTriggerReconstructor::GetkDDLHeaderSize()) ;
-
- AliHLTMUONTriggerRecordStruct trigRecord[300];
- int nofTrigRec = 300;
-
- if(! (fTrigRec->Run(buffer,&ddlRawDataSize,trigRecord,&nofTrigRec))){
- HLTError("ERROR In Processing of TrigRec Algo ");
- return EIO;
- }
+ if ( totalSize > size )
+ break;
+
+ int totalDDLSize = blocks[n].fSize/sizeof(int);
+ int ddlRawDataSize = totalDDLSize - fTrigRec->GetkDDLHeaderSize();
-// if(! (fTrigRec->Run((int)evtData.fEventID,fDDL,trigRecord,&nofTrigRec))){
-// HLTError("ERROR In Processing of TrigRec Algo ");
-// return EIO;
-// }
+ int *buffer = (int *)((int *)blocks[n].fPtr + fTrigRec->GetkDDLHeaderSize()) ;
+
+ AliHLTMUONTriggerRecordStruct trigRecord[300];
+ int nofTrigRec = 300;
- unsigned long mySize = sizeof(AliHLTMUONTriggerRecordStruct)*nofTrigRec;
+ if(! (fTrigRec->Run(buffer,&ddlRawDataSize,&trigRecord[0],&nofTrigRec))){
+ HLTError("ERROR In Processing of TrigRec Algo ");
+ return EIO;
+ }
+
+ // if(! (fTrigRec->Run((int)evtData.fEventID,fDDL,trigRecord,&nofTrigRec))){
+ // HLTError("ERROR In Processing of TrigRec Algo ");
+ // return EIO;
+ // }
+
+ unsigned long mySize = sizeof(AliHLTMUONTriggerRecordStruct)*nofTrigRec;
-// cout<<"nofHit "<<nofHit<<endl;
-// for(int i=0;i<nofHit;i++)
-// cout<<"\t 0 : recHit["<<i<<"].fX :"<<recHit[i].fX
-// <<" recHit["<<i<<"].fY :"<<recHit[i].fY
-// <<" recHit["<<i<<"].fZ :"<<recHit[i].fZ
-// <<" recHit["<<i<<"].fDetElemId :"<<recHit[i].fDetElemId
-// <<endl;
-
- //unsigned long mySize = (blocks[n].fSize * fOutputPercentage) / 100;
-
- Logging( kHLTLogInfo, "HLT::MUONTrigRec::DoEvent", "mySize set (1)", "mySize == %lu B - blocks[%lu].fSize == %lu - fOutputPercentage == %lu",
- mySize, n, blocks[n].fSize, fOutputPercentage );
+ HLTDebug("Number record found is %d",nofTrigRec);
+// for(int ihit=0;ihit<nofTrigRec;ihit++)
+// cout<<"\tdetelem : "<<trigRecord[ihit].fId
+// <<"\t"<<trigRecord[ihit].fHit[0].fX
+// <<"\t"<<trigRecord[ihit].fHit[0].fY
+// <<"\t"<<trigRecord[ihit].fHit[0].fZ
+// <<endl;
// Check how much space we have left and adapt this output block's size accordingly.
if ( totalSize + mySize > size )
mySize = size-totalSize;
- Logging( kHLTLogInfo, "HLT::MUONTrigRec::DoEvent", "mySize set (2)", "mySize == %lu B - totalSize == %lu - size == %lu",
+ Logging( kHLTLogDebug, "AliHLTMUONTriggerReconstructor::DoEvent", "mySize set (2)", "mySize == %lu B - totalSize == %lu - size == %lu",
mySize, totalSize, size );
if ( mySize<=0 )
// First copy all full multiples of the input block
// And the copy the remaining fragment of the block
- Logging( kHLTLogInfo, "1 : HLT::MUONTrigRec::DoEvent", "Copying", "Copying %lu B - Copied: %lu B - totalSize: %lu B",
+ Logging( kHLTLogDebug, "AliHLTMUONTriggerReconstructor::DoEvent", "Copying", "Copying %lu B - Copied: %lu B - totalSize: %lu B",
mySize-copied, copied, totalSize );
//memcpy( outputPtr+totalSize+copied, blocks[n].fPtr, mySize-copied );
memcpy( outputPtr+totalSize+copied, &trigRecord[0], mySize);
- Logging( kHLTLogInfo, "HLT::MUONTrigRec::DoEvent", "Copied", "Copied: %lu B - totalSize: %lu B",
+ Logging( kHLTLogDebug, "AliHLTMUONTriggerReconstructor::DoEvent", "Copied", "Copied: %lu B - totalSize: %lu B",
copied, totalSize );
+
// Fill a block data structure for our output block.
- AliHLTComponentBlockData ob;
- // Let the structure be filled with the default values.
- // This takes care of setting the shared memory and data type values to default values,
- // so that they can be filled in by the calling code.
- FillBlockData( ob );
- // This block's start (offset) is after all other blocks written so far
- ob.fOffset = totalSize;
- // the size of this block's data.
- ob.fSize = mySize;
- // The specification of the data is copied from the input block.
- ob.fSpecification = blocks[n].fSpecification;
- // The data type is set automatically to the component's specified output data type.
- // Place this block into the list of output blocks
- outputBlocks.push_back( ob );
+ AliHLTComponentBlockData bd;
+ FillBlockData(bd);
+ bd.fPtr = outputPtr;
+ // This block's start (offset) is after all other blocks written so far.
+ bd.fOffset = totalSize;
+ bd.fSize = mySize;
+ bd.fDataType = AliHLTMUONConstants::TriggerRecordsBlockDataType();
+ bd.fSpecification = blocks[n].fSpecification;
+ outputBlocks.push_back(bd);
+
// Increase the total amount of data written so far to our output memory
totalSize += mySize;
- }
+ }
// Finally we set the total size of output memory we consumed.
size = totalSize;
return 0;
- }
+}
+
bool AliHLTMUONTriggerReconstructorComponent::ReadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookupTable, const char* lutpath)
{
- if (fDDL < AliHLTMUONTriggerReconstructor::GetkDDLOffSet() ||
- fDDL >= AliHLTMUONTriggerReconstructor::GetkDDLOffSet() + AliHLTMUONTriggerReconstructor::GetkNofDDL()){
+ if (fDDL < 0 || fDDL >= 2){
HLTError("DDL number is out of range");
return false;
}
&lookupTable[i].fRealX,
&lookupTable[i].fRealY,
&lookupTable[i].fRealZ,
- &lookupTable[i].fPlane,
- &lookupTable[i].fPcbZone
+ &lookupTable[i].fPcbZone,
+ &lookupTable[i].fPlane
);
}
return true;
}
-// implement this as well.
+bool AliHLTMUONTriggerReconstructorComponent::ReadRegToLocMap(AliHLTMUONTriggerReconstructor::RegToLoc* regToLocMap,const char* reglocFileName)
+{
+ int iTrigDDL,iReg,iLoc,locId,switchWord,detElemId[4];
+ int index;
+
+ memset(regToLocMap,-1,128*sizeof(AliHLTMUONTriggerReconstructor::RegToLoc));
+
+ char s[100];
+ ifstream fin(reglocFileName);
+
+ if(!fin){
+ HLTError("Failed to open file %s",reglocFileName);
+ return false;
+ }
+
+ while(fin.getline(s,100)){
+ sscanf(s,"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d",
+ &iTrigDDL,&iReg,&iLoc,&locId,&switchWord,&detElemId[0],&detElemId[1],&detElemId[2],&detElemId[3]);
+ if(iTrigDDL==fDDL){
+ index = iReg*16 + iLoc;
+ regToLocMap[index].fTrigDDL = iTrigDDL ;
+ regToLocMap[index].fRegId = iReg ;
+ regToLocMap[index].fLoc = iLoc ;
+ regToLocMap[index].fLocId = locId ;
+ regToLocMap[index].fSwitch = switchWord ;
+ for(int idet = 0; idet<4; idet++)
+ regToLocMap[index].fDetElemId[idet] = detElemId[idet] ;
+ }// if matches with fDDL
+ }//file loop
+
+ fin.close();
+ return true;
+}
/** @file AliHLTMUONTriggerReconstructorComponent.h
@author Timm Steinbeck, Matthias Richter
@date
- @brief Declaration of a dummy component. */
+ @brief A processing component for the dHLT trigger DDL reconstruction. */
#include "AliHLTProcessor.h"
-#include "AliHLTMUONConstants.h"
-
#include "AliHLTMUONTriggerReconstructor.h"
+#include "AliHLTMUONHitReconstructor.h"
+#if __GNUC__ < 3
+#define std
+#endif
/**
* @class AliHLTMUONTriggerReconstructorComponent
// These functions are required for the registration process
const char* GetComponentID();
- void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
+ void GetInputDataTypes( std::vector<AliHLTComponentDataType>& list);
AliHLTComponentDataType GetOutputDataType();
- virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
AliHLTComponent* Spawn();
protected:
// These functions provide initialization as well as the actual processing
// capabilities of the component.
- int DoInit( int argc, const char** argv );
+ int DoInit(int argc, const char** argv);
int DoDeinit();
- int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
+
+ int DoEvent(
+ const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ std::vector<AliHLTComponentBlockData>& outputBlocks
+ );
private:
-
- // The size of the output data produced, as a percentage of the input data's size.
- // Can be greater than 100 (%)
- unsigned fOutputPercentage;
AliHLTMUONTriggerReconstructor* fTrigRec;
+
bool ReadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookupTable, const char* lutpath);
+ bool ReadRegToLocMap(AliHLTMUONTriggerReconstructor::RegToLoc* regToLoc,const char* reglocFileName);
TString fDDLDir;
Int_t fDDL;
ClassDef(AliHLTMUONTriggerReconstructorComponent, 0)
};
-
+
#endif // AliHLTMUONTRIGGERRECONSTRUCTORCOMPONENT_H