]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpDetElement.cxx
- Use dedicated splines for MC periods for 2012 pp (LHC14e2*)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpDetElement.cxx
index f3aaa4e07f4dbe9c52c8bbefc6ac63164e5dd5a4..fc702b0587b26e870f6421afffb632945341f154 100644 (file)
@@ -30,7 +30,7 @@
 #include "AliMpArrayI.h"
 #include "AliMpConstants.h"
 #include "AliMpDEManager.h"
-#include "AliMpHVNamer.h"
+#include "AliMpDCSNamer.h"
 #include "AliMpHVUID.h"
 #include "AliMpManuUID.h"
 #include "AliMpPadUID.h"
@@ -42,6 +42,7 @@
 
 #include <Riostream.h>
 
+using std::endl;
 /// \cond CLASSIMP
 ClassImp(AliMpDetElement)
 /// \endcond
@@ -58,17 +59,16 @@ AliMpDetElement::AliMpDetElement(Int_t id, const TString& name,
     fSegType(segType),
     fPlaneType(planeType),
     fBusPatchIds(false),
-    fManuToSerialNbs(1700),
-    fSerialNbToManus(1700),
-    fManuList(1700),
-    fTrackerChannels(1700*AliMpConstants::ManuNofChannels()),
-    fHVmanus(true)
+    fManuList(),
+    fTrackerChannels(),
+    fHVmanus(),
+    fNofChannels(0)
 {
 /// Standard constructor
 }
 
 //______________________________________________________________________________
-AliMpDetElement::AliMpDetElement(TRootIOCtor* /*ioCtor*/)
+AliMpDetElement::AliMpDetElement(TRootIOCtor* ioCtor)
   : TObject(),
     fId(0),
     fDdlId(-1),
@@ -76,11 +76,10 @@ AliMpDetElement::AliMpDetElement(TRootIOCtor* /*ioCtor*/)
     fSegType(),
     fPlaneType(),
     fBusPatchIds(),
-    fManuToSerialNbs(),
-    fSerialNbToManus(),
-    fManuList(true),
-    fTrackerChannels(true),
-    fHVmanus(true)
+    fManuList(),
+    fTrackerChannels(),
+    fHVmanus(ioCtor),
+    fNofChannels()
 {
 /// Root IO constructor
 }
@@ -113,21 +112,6 @@ Bool_t AliMpDetElement::AddBusPatch(Int_t busPatchId)
   return true;
 }  
  
-//______________________________________________________________________________
-void AliMpDetElement::AddManuSerial(Int_t manuId, Int_t serialNb)
-{
-/// Map the serial manu number 
-/// (Eventually add check if the given pair already present)
-
-  AliCodeTimerAuto("");
-  
-  AliDebug(1,Form("DE %4d ManuId %4d SerialNB %d",
-               fId,manuId,serialNb));
-  
-  fManuToSerialNbs.Add(Long_t(manuId), Long_t(serialNb)); 
-  fSerialNbToManus.Add(Long_t(serialNb), Long_t(manuId));
-}      
-
 //______________________________________________________________________________
 TString AliMpDetElement::GetSegName(AliMp::CathodType cathType) const
 {
@@ -177,17 +161,38 @@ AliMp::StationType AliMpDetElement::GetStationType() const
   Int_t chamberId = AliMpDEManager::GetChamberId(fId, false);
   if ( ! AliMpDEManager::IsValidChamberId(chamberId, true) ) {
     AliFatal("Cannot return AliMp::StationType value.");
-    return AliMp::kStation1;
+    return AliMp::kStation12;
   }  
   
-  if ( chamberId ==  0 || chamberId ==  1 )  return AliMp::kStation1;
-  if ( chamberId ==  2 || chamberId ==  3 )  return AliMp::kStation2;
+  if ( chamberId >=  0 && chamberId <=  3 )  return AliMp::kStation12;
   if ( chamberId >=  4 && chamberId <=  9 )  return AliMp::kStation345;
   if ( chamberId >= 10 && chamberId <= 13 )  return AliMp::kStationTrigger;
 
   // Should never get to this line
   AliFatal("Cannot return AliMp::StationType value.");
-  return AliMp::kStation1;
+  return AliMp::kStation12;
+}
+
+//______________________________________________________________________________
+AliMq::Station12Type AliMpDetElement::GetStation12Type() const
+{
+/// Return station12 type                                                      \n
+/// Failure causes Fatal error - as AliMp::Station12Type has no possibility
+/// to return undefined value
+
+  Int_t chamberId = AliMpDEManager::GetChamberId(fId, false);
+  if ( ! AliMpDEManager::IsValidChamberId(chamberId, true) ) {
+    AliFatal("Cannot return AliMp::StationType value.");
+    return AliMq::kNotSt12;
+  }  
+  
+  if ( chamberId ==  0 || chamberId ==  1 )  return AliMq::kStation1;
+  if ( chamberId ==  2 || chamberId ==  3 )  return AliMq::kStation2;
+  if ( chamberId >=  4 || chamberId <= 13 )  return AliMq::kNotSt12;
+
+  // Should never get to this line
+  AliFatal("Cannot return AliMp::StationType value.");
+  return AliMq::kNotSt12;
 }
 
 //______________________________________________________________________________
@@ -203,7 +208,7 @@ Int_t AliMpDetElement::GetBusPatchId(Int_t index) const
 {
 /// Return the index-th bus patch
 
-  if ( index < 0 || index > GetNofBusPatches() ) {
+  if ( index < 0 || index >= GetNofBusPatches() ) {
     AliErrorStream()
       << "In DE = " << fId << ": Index " << index << " outside limits." << endl;
     return 0;
@@ -221,22 +226,6 @@ Bool_t  AliMpDetElement::HasBusPatchId(Int_t busPatchId) const
   return fBusPatchIds.HasValue(busPatchId);; 
 }
 
-//______________________________________________________________________________
-Int_t  AliMpDetElement::GetManuSerialFromId(Int_t manuId) const
-{
-/// Return manu serial number from manuId
-
-  return (Int_t)fManuToSerialNbs.GetValue(Long_t(manuId));
-}
-
-//______________________________________________________________________________
-Int_t  AliMpDetElement::GetManuIdFromSerial(Int_t serialNb) const
-{
-/// Return manuId from manu serial number
-  
-  return (Int_t)fSerialNbToManus.GetValue(Long_t(serialNb));
-}
-
 //______________________________________________________________________________
 Int_t 
 AliMpDetElement::NofChannelsInManu(Int_t manuId) const
@@ -286,7 +275,7 @@ AliMpDetElement::AddManu(Int_t manuId)
   
   if ( stationType == AliMp::kStationTrigger ) return;
     
-  AliCodeTimerAuto("")
+  AliCodeTimerAuto("",0)
   
   AliDebug(1,Form("DE %4d Manu %4d",fId,manuId));
 
@@ -322,7 +311,7 @@ AliMpDetElement::AddManu(Int_t manuId)
   
   for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i ) 
   {
-    if ( seg->PadByLocation(AliMpIntPair(manuId,i),kFALSE).IsValid() )
+    if ( seg->PadByLocation(manuId,i,kFALSE).IsValid() )
     {
       ++n;
       fTrackerChannels.Add((Long_t)AliMpPadUID::BuildUniqueID(fId,manuId,i),
@@ -331,8 +320,10 @@ AliMpDetElement::AddManu(Int_t manuId)
   }
   
   fManuList.Add(AliMpManuUID::BuildUniqueID(fId,manuId),(Long_t)n);
+
+  fNofChannels += n;
   
-  AliMpHVNamer hvNamer;
+  AliMpDCSNamer hvNamer("TRACKER");
   
   Int_t index = hvNamer.ManuId2Index(fId,manuId);
                             
@@ -360,14 +351,6 @@ AliMpDetElement::ManusForHV(Int_t hvIndex) const
   return static_cast<AliMpArrayI*>(fHVmanus.GetValue(AliMpHVUID::BuildUniqueID(fId,hvIndex)));
 }
 
-//______________________________________________________________________________
-Int_t 
-AliMpDetElement::NofManusWithSerialNumber() const
-{
-  /// Return the number of manus which have a serial number in this detection element  
-  return fManuToSerialNbs.GetSize();
-}
-
 //______________________________________________________________________________
 Int_t 
 AliMpDetElement::NofManus() const