]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.h
Adding fixes required for the component to generate output data in the correct format...
[u/mrichter/AliRoot.git] / HLT / MUON / OnlineAnalysis / AliHLTMUONTriggerReconstructor.h
1 #ifndef AliHLTMUONTRIGGERRECONSTRUCTOR_H
2 #define AliHLTMUONTRIGGERRECONSTRUCTOR_H
3 /**************************************************************************
4  * This file is property of and copyright by the ALICE HLT Project        * 
5  * All rights reserved.                                                   *
6  *                                                                        *
7  * Primary Authors:                                                       *
8  *   Indranil Das <indra.das@saha.ac.in>                                  *
9  *                                                                        *
10  * Permission to use, copy, modify and distribute this software and its   *
11  * documentation strictly for non-commercial purposes is hereby granted   *
12  * without fee, provided that the above copyright notice appears in all   *
13  * copies and that both the copyright notice and this permission notice   *
14  * appear in the supporting documentation. The authors make no claims     *
15  * about the suitability of this software for any purpose. It is          * 
16  * provided "as is" without express or implied warranty.                  *
17  **************************************************************************/
18
19 /* $Id$ */
20
21 /**********************************************************************
22  Created on : 16/05/2007
23  Purpose    : This class is supposed to read the trigger DDL files and 
24               give the output AliHLTMUONTriggerRecordStruct
25  Author     : Indranil Das, HEP Division, SINP
26  Email      : indra.das@saha.ac.in | indra.ehep@gmail.com
27 **********************************************************************/
28
29 #include <vector>
30
31 #include "AliHLTLogging.h"
32 #include "AliHLTMUONTriggerRecordsBlockStruct.h"
33 #include "AliHLTMUONHitReconstructor.h"
34
35 #if __GNUC__ < 3
36 #define std
37 #endif
38
39 typedef std::vector<int> DataIdIndex;
40
41 class AliHLTMUONTriggerReconstructor : public AliHLTLogging
42 {
43
44  public:
45
46   struct RegToLoc{
47     int fTrigDDL;  // trigger id (0 or 1)
48     int fRegId,fLoc,fLocId;  // regeonal and local id.
49     int fSwitch;  // packed switch word of 10 bits.
50     int fDetElemId[4];  // Four detection element correspond to four detection element for each local card.
51   };
52
53
54   AliHLTMUONTriggerReconstructor();
55   virtual ~AliHLTMUONTriggerReconstructor();
56
57   bool LoadLookUpTable(AliHLTMUONHitReconstructor::DHLTLut* lookUpTableData, int lookUpTableId);
58   
59   bool SetRegToLocCardMap(RegToLoc* regToLoc);
60   bool Run(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize, AliHLTMUONTriggerRecordStruct* trigRecord, AliHLTUInt32_t& nofTrigRec);
61
62   int GetLutLine(){return fgkLutLine ;}
63
64   static int GetkDetectorId() { return AliHLTMUONTriggerReconstructor::fgkDetectorId ; }
65   static int GetkDDLOffSet() { return AliHLTMUONTriggerReconstructor::fgkDDLOffSet; }
66   static int GetkNofDDL() { return AliHLTMUONTriggerReconstructor::fgkNofDDL; }
67   static int GetkDDLHeaderSize() { return AliHLTMUONTriggerReconstructor::fgkDDLHeaderSize; }
68   
69  private: 
70   static const int fgkDetectorId ;            // Detector ID
71   static const int fgkDDLOffSet ;             // DDL Offset
72   static const int fgkNofDDL ;                // Number of DDL 
73   static const int fgkDDLHeaderSize  ;        // DDL header size  
74
75  protected:
76
77   AliHLTMUONTriggerReconstructor(const AliHLTMUONTriggerReconstructor& rhs); // copy constructor
78   AliHLTMUONTriggerReconstructor& operator=(const AliHLTMUONTriggerReconstructor& rhs); // assignment operator
79   
80  private:
81
82   static const int fgkEvenLutSize ;           // Size of the LookupTable with event DDLID
83   static const int fgkOddLutSize ;            // Size of the LookupTable with odd DDLID
84   static const int fgkLutLine;                // nof Line in LookupTable    
85
86   static const int fgkMinIdManuChannel[2];    // Minimum value of idManuChannel in LookupTable, 2 corresponds to two types of DDL (even/odd)  
87   static const int fgkMaxIdManuChannel[2];    // Maximum value of idManuChannel in LookupTable  
88   static const float fgkHalfPadSizeXB[3];       // pad halflength for the pcb zones, 3 corresponds to 3 types of pad in bending side  
89   static const float fgkHalfPadSizeYNB[2];       // pad halflength for the pcb zones, 2 corresponds to 2 types on nonbneding pad  
90
91   static const int fgkDetElem;                // nof Detection element per DDL    
92
93   
94   AliHLTMUONHitReconstructor::DHLTPad* fPadData;                          // pointer to the array containing the information of each padhits
95   AliHLTMUONHitReconstructor::DHLTLut* fLookUpTableData;                  // pointer to the array of Lookuptable data
96   
97   AliHLTMUONTriggerRecordStruct *fRecPoints;    // Reconstructed hits
98   AliHLTUInt32_t *fRecPointsCount;                       // nof reconstructed hit  
99   AliHLTUInt32_t fMaxRecPointsCount;                    // max nof reconstructed hit  
100
101   //104 correspond to maximum nuber of x indices a nonbending side of detelem may have (i.e. 1101) 
102   //and 64 corresponds to the maximum number of y indices occurs in bending side of detelem (i.e 1100)
103   int fGetIdTotalData[104][64][2] ;           // an array of idManuChannel with argumrnt of centralX,centralY and  planeType
104   RegToLoc fRegToLocCard[128];              // 8 regional card per ddl and 16 slots per regional crate together made 16*8 = 128. 
105
106   map<int,int> fMaxFiredPerDetElem;                    // counter for detector elements that are fired 
107   map<int,DataIdIndex> fDetElemToDataId;              // detelem to pointer to dataId index mapping
108   
109   int fDDLId ;
110   int fIdOffSet ;
111   
112   AliHLTInt32_t fTrigRecId;  // A running counter for the trigger record ID.
113
114   bool MergeTrigHits(DataIdIndex& dataIndex);
115   bool FindTrigHits() ;
116
117   bool ReadDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize);
118 };
119
120 #endif // AliHLTMUONTRIGGERRECONSTRUCTOR_H