]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRcuProcessor.cxx
633582d8a5aff95797dc62f79581ea7a8ad891f0
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRcuProcessor.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the Experimental Nuclear     *
3  * Physics Group, Dep. of Physics                                         *
4  * University of Oslo, Norway, 2007                                       *
5  *                                                                        *
6  * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
7  * Contributors are mentioned in the code where appropriate.              *
8  * Please report bugs to perthi@fys.uio.no                                *
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 #include "AliHLTPHOSRcuProcessor.h"
19
20 AliHLTPHOSRcuProcessor::AliHLTPHOSRcuProcessor(): fkEquippmentID(0)
21 {
22
23 }
24
25 AliHLTPHOSRcuProcessor::~AliHLTPHOSRcuProcessor()
26 {
27
28 }
29
30
31 const AliHLTUInt16_t
32 AliHLTPHOSRcuProcessor::GetEquippmentID() const
33 {
34   return fkEquippmentID;
35 }
36
37 void 
38 AliHLTPHOSRcuProcessor::SetEquippmentID(AliHLTUInt16_t id)
39 {
40   AliHLTUInt16_t  &ref = const_cast<AliHLTUInt16_t&>(fkEquippmentID); 
41   ref = id;
42 }
43
44
45 int
46 AliHLTPHOSRcuProcessor::ScanArguments(int argc, const char** argv)
47 {
48   fPrintInfo = kFALSE;
49   int iResult=0;
50   TString argument="";
51
52   for(int i=0; i<argc && iResult>=0; i++) 
53     {
54       argument=argv[i];
55       
56       if (argument.IsNull()) 
57         {
58           continue;
59         }
60                          
61     if (argument.CompareTo("-equipmentID") == 0) 
62         {
63           cout << "AliHLTPHOSProcessor:DoInit  argument = -equipmentID   "  <<endl;  
64           if(i+1 <= argc)
65             {
66               SetEquippmentID((AliHLTUInt16_t)atoi(argv[i+1]));
67               cout << "AliHLTPHOSRawAnalyzerComponent:DoInit  setting equippment ID to  " << fkEquippmentID <<endl;
68               SetCoordinates(fkEquippmentID);
69               fIsSetEquippmentID = kTRUE;
70               cout << " fIsSetEquippmentID = kTRUE"<< endl;
71             }
72           else
73             {
74                iResult= -1;
75                Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument",
76                         "The argument -equippmentID expects a number");
77                return  iResult;   
78             }
79         }
80     
81     
82     if (argument.CompareTo("-printinfo") == 0) 
83       {
84         if(i+1 <= argc)
85           {
86             argument=argv[i+1];
87             fPrintInfoFrequncy = atoi(argv[i+1]);
88             fPrintInfo = kTRUE;
89             cout << "AliHLTPHOSRawAnalyzerComponent::DoIni  setting printinfo = kTRUE, with update frequency every  "<< fPrintInfoFrequncy << "th event" <<endl; 
90           }
91         else
92           {
93             cout << "WARNING: asking for event info, but no update frequency is specified, option is ignored" << endl;
94           }
95       }
96  
97     }
98
99
100   if(fIsSetEquippmentID == kFALSE)
101     {
102       Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument",
103                "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID  <number>");
104       iResult = -3; 
105     }
106   return iResult;
107 }
108
109 void 
110 AliHLTPHOSRcuProcessor::SetCoordinates(AliHLTUInt16_t /*equippmentID*/)
111 {
112   int rcuIndex =  (fkEquippmentID - 1792)%N_RCUS_PER_MODULE;
113   fModuleID = (fkEquippmentID  -1792 -rcuIndex)/N_RCUS_PER_MODULE;
114   
115   if(rcuIndex == 0)
116     {
117       fRcuX = 0; 
118       fRcuZ = 0;
119     }
120
121   if(rcuIndex == 1)
122     {
123       fRcuX = 0; 
124       fRcuZ = 1;
125     }
126  
127   if(rcuIndex == 2)
128     {
129       fRcuX = 1; 
130       fRcuZ = 0;
131     }
132
133   if(rcuIndex == 3)
134     {
135       fRcuX = 1; 
136       fRcuZ = 1;
137     }
138
139   fRcuZOffset =  N_ZROWS_RCU*fRcuZ;
140   fRcuXOffset =  N_XCOLUMNS_RCU*fRcuX;
141
142   cout <<"********InitInfo************"<< endl;
143   cout <<"AliHLTPHOSRawAnalyzerComponent::SetCoordinate casted"<< endl;
144   cout <<"Equpippment ID =\t"<< fkEquippmentID <<endl;
145   cout <<"Module ID =\t"<<  (int)fModuleID<<endl;
146   cout <<"RCUX =\t\t" << (int)fRcuX << endl;
147   cout <<"RCUZ =\t\t" << (int)fRcuZ << endl;
148   cout <<"RcuZOffset = \t" <<  (int)fRcuZOffset << endl;
149   cout <<"RcuXOffset = \t" <<  (int)fRcuXOffset << endl << endl;
150
151 }