+//------------------------------------------------------------------
+void AliMUONResponseTriggerV1::SetHV()
+{
+ //
+ /// Set HV values from OCDB
+ //
+ fHVvalues.Set(72);
+ TString side;
+ Int_t newRPC=0,newPlane=0;
+
+ AliCDBManager *manager = AliCDBManager::Instance();
+ AliCDBPath path("MUON/Calib/TriggerDCS");
+ AliCDBEntry *entry = manager->Get(path);
+ if (entry == NULL) {
+ AliWarning("No map found in MUON/Calib/TriggerDCS");
+ return;
+ }
+ TMap *hvMap = dynamic_cast<TMap*>(entry->GetObject());
+ TObjArray *objArr = 0x0;
+
+ AliDCSValue *dcsValue = 0x0;
+ UInt_t time1,time2,timebegin=0,timeend=0;
+ Int_t nEntries;
+ Float_t voltage = 0;
+
+ for(Int_t iPlane=0; iPlane<4; iPlane++) //loop on MT
+ {
+ for(Int_t iRPC=0; iRPC<18; iRPC++) //loop on RPC
+ {
+ if(iRPC>=5 && iRPC<=13)
+ {
+ side = "OUTSIDE";
+ newRPC = 14-iRPC;
+ }
+
+ else
+ {
+ side = "INSIDE";
+
+ if(iRPC>=14)
+ newRPC = iRPC-13;
+ else
+ newRPC = iRPC+5;
+ }
+
+ switch(iPlane)
+ {
+ case 0: newPlane = 11; break;
+ case 1: newPlane = 12; break;
+ case 2: newPlane = 21; break;
+ case 3: newPlane = 22; break;
+ }
+
+ objArr = (TObjArray*)hvMap->GetValue(Form("MTR_%s_MT%d_RPC%d_HV.vEff",side.Data(),newPlane,newRPC));
+ nEntries = objArr->GetEntries();
+
+ for(Int_t i=0; i<nEntries-1; i++)
+ {
+ dcsValue = (AliDCSValue*)objArr->At(i+1);
+ time2 = dcsValue->GetTimeStamp();
+
+ if(i==nEntries-2)
+ timeend = time2;
+
+ dcsValue = (AliDCSValue*)objArr->At(i);
+ time1 = dcsValue->GetTimeStamp();
+
+ if(i==0)
+ timebegin = time1;
+
+ voltage += (dcsValue->GetFloat())*(time2-time1);
+ }
+
+ Double_t deltaTime = timeend - timebegin;
+ Double_t meanVoltage = ( deltaTime == 0. ) ? 0. : voltage/deltaTime/1000.;
+ fHVvalues.AddAt(meanVoltage,18*iPlane+iRPC); //voltage in kV, not in V
+
+ voltage=0;
+ AliDebug(1,Form("HV value for MTR_%s_MT%d_RPC%d_HV.vEff = %g (kV)",side.Data(),newPlane,newRPC,meanVoltage));
+ }
+ }
+}
+
+//------------------------------------------------------------------
+void AliMUONResponseTriggerV1::SetBValues()
+{
+ //
+ /// Set B values for cluster size function
+ //
+
+ fBValues.Set(144);
+
+ Float_t bValues[2][4][18] = {{{1.97,2.47,2.47,2.47,2.97,2.97,2.47,2.47,1.97,2.22,1.97,2.47,1.97,2.97,2.97,2.47,2.47,1.97}, //MT11BP
+ {2.22,2.22,1.97,2.47,2.97,2.97,1.97,2.47,1.97,1.97,1.97,2.47,1.97,2.97,2.97,1.97,1.97,1.97}, //MT12BP
+ {2.22,2.22,2.47,2.47,2.97,2.97,2.47,2.47,2.22,1.97,1.97,2.47,1.97,2.97,2.97,1.97,1.97,1.97}, //MT21BP
+ {1.97,1.97,2.97,2.97,2.97,2.97,2.47,1.97,1.97,1.97,1.72,2.47,2.22,2.97,2.97,1.97,1.97,1.97}}, //MT22BP
+ {{1.97,2.47,2.47,2.97,2.97,2.97,2.97,2.47,1.97,1.97,2.22,2.47,2.97,2.97,2.97,2.97,1.97,1.72}, //MT11NBP
+ {2.47,1.97,2.22,2.97,2.97,2.97,2.47,2.97,1.97,1.97,1.97,2.97,2.97,2.97,2.97,2.97,1.97,1.97}, //MT12NBP
+ {1.97,2.47,2.47,2.97,2.97,2.97,2.97,2.47,2.22,1.97,2.22,2.47,2.97,2.97,2.97,2.47,1.97,1.97}, //MT21NBP
+ {1.72,1.97,2.97,2.97,2.97,2.97,2.97,1.97,1.72,2.22,1.97,2.47,2.97,2.47,2.97,1.97,1.97,1.97}}};//MT22NBP
+
+ for(Int_t iCath=0; iCath<2; iCath++) //loop on side
+ {
+ for(Int_t iPlane=0; iPlane<4; iPlane++) //loop on MT
+ {
+ for(Int_t iRPC=0; iRPC<18; iRPC++) //loop on RPC
+ {
+ fBValues.AddAt(bValues[iCath][iPlane][iRPC],72*iCath+18*iPlane+iRPC);
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------
+void AliMUONResponseTriggerV1::Neighbours(const Int_t cath, const Int_t ix, const Int_t iy, Int_t Xlist[30], Int_t Ylist[30]) const
+{
+ ///-----------------BENDING----------------------------------------- /n
+ /// Returns list of 30 next neighbours for given X strip (ix, iy) /n
+ /// neighbour number 4 in the list - /n
+ /// neighbour number 3 in the list | /n
+ /// neighbour number 2 in the list |_ Upper part /n
+ /// neighbour number 1 in the list | /n
+ /// neighbour number 0 in the list - /n
+ /// X strip (ix, iy) /n
+ /// neighbour number 5 in the list - /n
+ /// neighbour number 6 in the list | _ Lower part /n
+ /// neighbour number 7 in the list | /n
+ /// neighbour number 8 in the list | /n
+ /// neighbour number 9 in the list - /n
+ /// /n
+ ///-----------------NON-BENDING------------------------------------- /n
+ /// Returns list of 30 next neighbours for given Y strip (ix, iy) /n
+ /// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list /n
+ /// |_______| |_______| /n
+ /// left right /n
+
+ for (Int_t i=0; i<30; i++)
+ {
+ Xlist[i] = -1;
+ Ylist[i] = -1;
+ }
+
+ Int_t iList[30]={29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
+
+ // need to iterate in iy/ix for bending/non-bending plane
+ Int_t iNeigh = (cath == 0) ? iy : ix;
+
+ Int_t i=0;
+ for (Int_t j=iNeigh-15; j<=iNeigh+15; j++)
+ {
+ if (j == iNeigh)
+ continue;
+
+ // need to iterate in iy/ix for bending/non-bending plane
+ Int_t ixNeigh = ( cath == 0 ) ? ix : j;
+ Int_t iyNeigh = ( cath == 0 ) ? j : iy;
+
+// cout << " " << cath << " " << ix << " " << iy
+// << " " << ixNeigh << " " << iyNeigh << "\n";
+
+ Xlist[iList[i]]=ixNeigh;
+ Ylist[iList[i]]=iyNeigh;
+ i++;
+ }
+}