]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added methods for finding a given module in the DDL map (F. Prino)
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Mar 2008 17:19:50 +0000 (17:19 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Mar 2008 17:19:50 +0000 (17:19 +0000)
ITS/AliITSDDLModuleMapSDD.cxx
ITS/AliITSDDLModuleMapSDD.h

index 1c625c38ecce5f5b08f32904bb06b0c6527e5039..a8d997b04679714584668e0c241546f98a694e38 100644 (file)
@@ -23,6 +23,7 @@
 ///////////////////////////////////////////////////////////////////
 
 #include "AliITSDDLModuleMapSDD.h"
+#include "AliLog.h"
 
 ClassImp(AliITSDDLModuleMapSDD)
 
@@ -204,6 +205,23 @@ void AliITSDDLModuleMapSDD::SetDDLMap(AliITSDDLModuleMapSDD* ddlmap){
   }
 }
 //______________________________________________________________________
+void AliITSDDLModuleMapSDD::FindInDDLMap(Int_t modIndex, Int_t &iDDL, Int_t &iCarlos) const {
+  // finds DDL and carlos number for a given module
+  for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
+    for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
+      if(fDDLModuleMap[iddl][ichan]==modIndex){
+       iDDL=iddl;
+       iCarlos=ichan;
+       return;
+      }
+    }
+  }
+  AliWarning("Module not found in DDL map");
+  iDDL=-1;
+  iCarlos=-1;
+  return;
+}
+//______________________________________________________________________
 void AliITSDDLModuleMapSDD::ReadDDLModuleMap(Char_t *ddlmapfile){
   // Fill DDL map from ASCCI data file
   FILE *fil;
index b36075e4c486959fc2404f31a4b77f996e289614..4d687c72f8ba55f55c881974d0045139a9f61220 100644 (file)
@@ -13,6 +13,7 @@
 ///////////////////////////////////////////////////////////////////
 
 #include<TObject.h>
+#include<AliITSgeomTGeo.h>
 
 
 class AliITSDDLModuleMapSDD : public TObject {
@@ -32,6 +33,10 @@ class AliITSDDLModuleMapSDD : public TObject {
   void ReadDDLModuleMap(Char_t *ddlmapfile);
 
   Int_t GetModuleNumber(UInt_t iDDL, UInt_t iChan) const {return fDDLModuleMap[iDDL][iChan];}
+  void FindInDDLMap(Int_t modIndex, Int_t &iDDL, Int_t &iCarlos) const;
+  void FindInDDLMap(Int_t lay, Int_t lad, Int_t det, Int_t &iDDL, Int_t &iCarlos) const {
+    FindInDDLMap(AliITSgeomTGeo::GetModuleIndex(lay,lad,det),iDDL,iCarlos);
+  }
   static Int_t GetNDDLs(){return kDDLsNumber;}
   static Int_t GetNModPerDDL(){return kModulesPerDDL;}