]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Applying modification so that LUTs are generated from CDB, which also solves LUT...
authorszostak <szostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Nov 2007 16:29:35 +0000 (16:29 +0000)
committerszostak <szostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Nov 2007 16:29:35 +0000 (16:29 +0000)
HLT/MUON/macros/CreateBusToDetElemFile.C
HLT/MUON/macros/CreateHitRecoLookupTables.C

index 6a0264de85d695a2cc5a21c27802f26609b2b3c1..c284ba0bfdcbb036f9534393df7010fe141a2e2a 100644 (file)
@@ -27,32 +27,44 @@ Author:   Indranil Das, HEP, SINP, Kolkata
 Email:    indra.das@saha.ac.in
 ***********************************************/
 
+#include <iostream>
 
-#include <TArrayI.h>
+#include <TString.h>
+
+#include <AliCDBManager.h>
+
+#include <AliMpCDB.h>
 #include <AliMpDDLStore.h>
 #include <AliMpDetElement.h>
-#include <AliMpSegmentation.h>
 
-int CreateBusToDetElemFile()
+int CreateBusToDetElemFile(TString CDBPath = "local://$ALICE_ROOT", Int_t run = 0)
 {
   FILE *fp = fopen("BusToDetElem.dat","w");
 
   AliMpDetElement* fDetElement;
-  AliMpSegmentation::ReadData(); 
-  AliMpDDLStore::ReadData();
+  
+  AliCDBManager* cdbManager = AliCDBManager::Instance();
+  cdbManager->SetDefaultStorage(CDBPath.Data());
+  cdbManager->SetRun(run);
+
+  if (! AliMpCDB::LoadDDLStore(true)){
+    cerr<<__FILE__<<": Failed to Load DDLStore specified for CDBPath "<<CDBPath<<", and Run : "<<run<<endl;
+    return kFALSE;
+  }
 
   fprintf(fp,"#DE\tBusPatch\tDDL\n");
   for(int ch=7;ch<=10;ch++){
     fprintf(fp,"# Chamber %d\n",ch);
     for(int i=0; i<26 ; i++){
       fDetElement = AliMpDDLStore::Instance()->GetDetElement(ch*100 + i);
-       fprintf(fp,"%d\t%d - %d\t%d\n",ch*100 + i,fDetElement->GetBusPatchId(0),
-              fDetElement->GetBusPatchId(fDetElement->GetNofBusPatches()-1),fDetElement->GetDdlId());
+      fprintf(fp,"%d\t%d - %d\t%d\n",ch*100 + i,fDetElement->GetBusPatchId(0),
+             fDetElement->GetBusPatchId(fDetElement->GetNofBusPatches()-1),fDetElement->GetDdlId());
     }
   }
-  //delete fDDLStore;
-  delete fDetElement;
 
+
+  delete fDetElement;
   fclose(fp);
+
   return 0;
 }
index b00c84de37a470a00f24287c00a493edd2dfb547..14371fad863dc9651e88c12fd80524a8376a56e2 100644 (file)
@@ -40,11 +40,12 @@ Email:    indra.das@saha.ac.in
 
 //STEER 
 #include "AliCDBManager.h"
-
+#include "AliGeomManager.h"
 //MUON
 #include "AliMUONGeometryTransformer.h"
 
 //MUON/mapping 
+#include "AliMpCDB.h"
 #include "AliMpPad.h"
 #include "AliMpSegmentation.h"
 #include "AliMpDDLStore.h"
@@ -56,18 +57,34 @@ class AliMpDDLStore ;
 
 using namespace std;
 
-
-Bool_t CreateHitRecoLookupTables(TString transformFileName = "geometry.root")
+Bool_t CreateHitRecoLookupTables(TString CDBPath = "local://$ALICE_ROOT", Int_t run = 0, Bool_t warn = kTRUE)
 {
   Char_t filename1[20], filename2[20];
   Int_t chamberId;
   
-  AliMpSegmentation *mpSegFactory = AliMpSegmentation::ReadData(); 
+  AliCDBManager* cdbManager = AliCDBManager::Instance();
+  cdbManager->SetDefaultStorage(CDBPath.Data());
+  cdbManager->SetRun(run);
 
-  AliMpDDLStore* fDDLStore = AliMpDDLStore::ReadData();
-  
+  if (! AliMpCDB::LoadDDLStore(warn)){
+    cerr<<__FILE__<<": Failed to Load DDLStore specified for CDBPath "<<CDBPath<<", and Run : "<<run<<endl;
+    return kFALSE;
+  }
+
+  AliMpSegmentation *mpSegFactory = AliMpSegmentation::Instance(); 
+  AliGeomManager::LoadGeometry();
   AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer();
-  chamberGeometryTransformer->LoadGeometryData(transformFileName);
+  if(! chamberGeometryTransformer->LoadGeometryData()){
+    cerr<<__FILE__<<": Failed to Load Geomerty Data "<<endl;
+    return kFALSE;
+  }
+  
+//   AliMpSegmentation *mpSegFactory = AliMpSegmentation::ReadData(); 
+
+//   AliMpDDLStore* fDDLStore = AliMpDDLStore::ReadData();
+  
+//   AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer();
+//   chamberGeometryTransformer->LoadGeometryData(transformFileName);
   
   for(Int_t iCh = 0; iCh < 4; iCh++){ // max 4
     
@@ -86,21 +103,20 @@ Bool_t CreateHitRecoLookupTables(TString transformFileName = "geometry.root")
       
       cout<<"Running for detElemId :"<<detElemId<<endl;
       
-      for(Int_t iPlane = 0 ; iPlane <= 1 ; iPlane++){
+      for(Int_t iCath = 0 ; iCath <= 1 ; iCath++){
        
        AliMp::CathodType cath;
 
-       if(iPlane == 0)
+       if(iCath == 0)
          cath = AliMp::kCath0 ;
        else
          cath = AliMp::kCath1 ;
        
-       AliMpVSegmentation* seg = mpSegFactory->CreateMpSegmentation(detElemId, cath);
-       
+       const AliMpVSegmentation* seg = mpSegFactory->CreateMpSegmentation(detElemId, cath);
+       AliMp::PlaneType plane = seg->PlaneType(); 
        Int_t maxIX = seg->MaxPadIndexX();  
        Int_t maxIY = seg->MaxPadIndexY(); 
        Int_t idManuChannel, manuId, channelId,idetElemId;
-       Int_t busPatchId;
        Double_t realX, realY, realZ;
        Double_t localX, localY, localZ;
        Double_t padSizeX, padSizeY;
@@ -116,8 +132,6 @@ Bool_t CreateHitRecoLookupTables(TString transformFileName = "geometry.root")
              manuId = pad.GetLocation().GetFirst();
              manuId &= 0x7FF; // 11 bits 
              
-             busPatchId = fDDLStore->GetBusPatchId(detElemId,manuId);
-             
              // Getting channel id
              channelId =  pad.GetLocation().GetSecond();
              channelId &= 0x3F; // 6 bits
@@ -139,7 +153,7 @@ Bool_t CreateHitRecoLookupTables(TString transformFileName = "geometry.root")
              padSizeX = 2.0*pad.Dimensions().X();
              padSizeY = 2.0*pad.Dimensions().Y();
 
-             if(iPlane == 0 ){
+             if(plane == 0 ){
                if(padSizeX==2.5)
                  pcbType = 0;
                else if(padSizeX==5.0)
@@ -157,10 +171,10 @@ Bool_t CreateHitRecoLookupTables(TString transformFileName = "geometry.root")
              }
                
              if(idetElemId<7 || idetElemId > 19){
-               fprintf(fout2,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,iPlane);
+               fprintf(fout2,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,plane);
              }
              else{
-               fprintf(fout1,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,iPlane);
+               fprintf(fout1,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,plane);
              }// HasPad Condn
              
            }