Added a method which loads TPC parameters in AliL3Transform through the runloader
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 May 2004 14:43:51 +0000 (14:43 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 May 2004 14:43:51 +0000 (14:43 +0000)
HLT/src/AliHLTReconstructor.cxx
HLT/src/AliL3Transform.cxx
HLT/src/AliL3Transform.h

index f185ae71f15c5d700059d1006b93ff7e0087b545..9858b63099bdcc06104a4fc7b673b0928cc894dd 100644 (file)
@@ -42,15 +42,14 @@ void AliHLTReconstructor::Reconstruct(AliRunLoader* runLoader) const
   if(!runLoader) {
     LOG(AliL3Log::kFatal,"AliHLTReconstructor::Reconstruct","RunLoader")
       <<" Missing RunLoader! 0x0"<<ENDLOG;
+    return;
   }
   gSystem->Exec("rm -rf hlt");
   gSystem->MakeDirectory("hlt");
   gSystem->Exec("rm -rf hough");
   gSystem->MakeDirectory("hough");
-  gSystem->Exec("rm -f alirunfile.root");
-  gSystem->Exec("ln -s galice.root alirunfile.root");
 
-  Bool_t isinit=AliL3Transform::Init("./",kTRUE);
+  Bool_t isinit=AliL3Transform::Init(runLoader);
   if(!isinit){
     cerr << "Could not create transform settings, please check log for error messages!" << endl;
     return;
index 73e02d66810e3e05b75efc89c2c2989916cdd01a..7fb92d3e32601c03d36009c5fd8060ae5f5cadb5 100644 (file)
@@ -706,6 +706,138 @@ Double_t AliL3Transform::fSin[36] = { 0.1736481786,
                                      -0.1736481786
 };
 
+#ifdef use_aliroot
+Bool_t AliL3Transform::Init(AliRunLoader *runLoader)
+{
+  if(!runLoader) {
+    LOG(AliL3Log::kFatal,"AliL3Transform::Init","RunLoader")
+      <<" Missing RunLoader! 0x0"<<ENDLOG;
+    return kFALSE;
+  }
+  if(fVersion != fV_default)
+    LOG(AliL3Log::kWarning,"AliL3Transform::Init","Init values")
+      <<AliL3Log::kDec<<"You are initializing the parameters more than once; check your code please! "<<fVersion<<ENDLOG;
+
+  TDirectory* savedir1 = gDirectory;
+  runLoader->CdGAFile();
+  AliTPCParamSR *param=(AliTPCParamSR*)gDirectory->Get(GetParamName());
+  savedir1->cd();
+  if(!param)
+    {
+      LOG(AliL3Log::kFatal,"AliL3Transform::Init","File")
+       <<"No TPC parameters found!"<<ENDLOG;
+      return kFALSE;
+    }
+
+  AliTPCPRF2D    * prfinner    = new AliTPCPRF2D;
+  AliTPCPRF2D    * prfouter1   = new AliTPCPRF2D;
+  AliTPCPRF2D    * prfouter2   = new AliTPCPRF2D;  
+  AliTPCRF1D     * rf    = new AliTPCRF1D(kTRUE);
+  rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
+  rf->SetOffset(3*param->GetZSigma());
+  rf->Update();
+  
+  TDirectory *savedir2=gDirectory;
+  TFile *prf_file = TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
+  if (!prf_file->IsOpen()) 
+    { 
+      LOG(AliL3Log::kError,"AliL3Transform::Init","File")
+       <<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !"<<ENDLOG;
+      return kFALSE;
+    }
+  prfinner ->Read("prf_07504_Gati_056068_d02");
+  prfouter1->Read("prf_10006_Gati_047051_d03");
+  prfouter2->Read("prf_15006_Gati_047051_d03");  
+  prf_file->Close();
+  savedir2->cd();
+  
+  param->SetInnerPRF(prfinner);
+  param->SetOuter1PRF(prfouter1); 
+  param->SetOuter2PRF(prfouter2);
+  param->SetTimeRF(rf);
+  
+  fNTimeBins = param->GetMaxTBin()+1;
+  fNRowLow = param->GetNRowLow();
+  fNRowUp  = param->GetNRowUp();
+  fNRowUp1 = param->GetNRowUp1();
+  fNRowUp2 = param->GetNRowUp2();
+  fNRow= fNRowLow + fNRowUp;
+  if(fNRow!=159){
+    LOG(AliL3Log::kError,"AliL3Transform::Init","fNRow")
+      <<"Number of rows have changed in ALIROOT"<<ENDLOG;
+    return kFALSE;
+  }
+  
+  fNSectorLow = param->GetNInnerSector();
+  fNSectorUp = param->GetNOuterSector();
+  fNSector = fNSectorLow + fNSectorUp;
+
+  //test whether they were changes to the rotation shift
+  fNRotShift=0;
+  Float_t irotshift = param->GetInnerAngleShift(); //shift angle
+  Float_t orotshift = param->GetOuterAngleShift(); //shift angle
+  const Float_t kDegtoRad = 0.01745329251994;
+  Int_t shift1=TMath::Nint(irotshift/kDegtoRad);
+  Int_t shift2=TMath::Nint(orotshift/kDegtoRad+0.1);
+  if((shift1!=shift2) || (shift1!=10)){
+    LOG(AliL3Log::kError,"AliL3Transform::Init","Rotshiftangle")
+      <<"Rotation shift angle has changed in ALIROOT"<<ENDLOG;
+    return kFALSE;
+  } else {
+    fNRotShift=0.5; //our version of the shift angle
+  }
+  
+  fVersion=fV_aliroot;
+  SetBFieldFactor((Double_t)runLoader->GetAliRun()->Field()->Factor());
+  SetSolenoidBField((Double_t)runLoader->GetAliRun()->Field()->SolenoidField());
+  fPadPitchWidthLow=param->GetInnerPadPitchWidth();
+  fPadPitchWidthUp=param->GetOuterPadPitchWidth();
+  fZWidth=param->GetZWidth();
+  fZSigma=param->GetZSigma();
+  fZLength=param->GetZLength();
+  fZOffset=param->GetZOffset();
+  fDiffT=param->GetDiffT();
+  fDiffL=param->GetDiffL();
+  fOmegaTau=param->GetOmegaTau();
+  fInnerPadLength=param->GetInnerPadLength();
+  fOuter1PadLength=param->GetOuter1PadLength();
+  fOuter2PadLength=param->GetOuter2PadLength();
+  fInnerPRFSigma=param->GetInnerPRF()->GetSigmaX();
+  fOuter1PRFSigma=param->GetOuter1PRF()->GetSigmaX();
+  fOuter2PRFSigma=param->GetOuter2PRF()->GetSigmaX();
+  fTimeSigma=param->GetTimeRF()->GetSigma();
+  fADCSat=param->GetADCSat();
+  fZeroSup=param->GetZeroSup();
+  fNSlice=fNSectorLow;
+    
+  //now do the arrays
+  for(Int_t i=0;i<fNRow;i++){
+    Int_t sec,row;
+    if( i < fNRowLow){sec =0;row =i;}
+    else{sec = fNSectorLow;row =i-fNRowLow;}
+    fX[i]=param->GetPadRowRadii(sec,row);
+  } 
+  for(Int_t i=0;i<fNRow;i++){
+    Int_t sec,row;
+    if( i < fNRowLow){sec =0;row =i;}
+    else{sec = fNSectorLow;row =i-fNRowLow;}
+    fNPads[i]=param->GetNPads(sec,row);
+  }
+  for(Int_t i=0;i<fNSector;i++){
+    if(i<fNSectorLow) fSectorLow[i]=1;
+    else fSectorLow[i]=0;
+  }
+
+  TTimeStamp time;
+  Char_t tmpfile[1024];
+  sprintf(tmpfile,"./l3transform.config-%d",(Int_t)time.GetSec());
+
+  return SaveInitFile(tmpfile);
+
+}
+#endif
+
 Bool_t AliL3Transform::Init(Char_t* path,Bool_t UseAliTPCParam)
 {
   //Overwrite the parameters with values stored in file "l3transform.config" in path.
index 6f7cee1110b2e867db3ea02e71d77baf1279f408..7ed3cbe1ab4b26278e4eeb92fced80d0f88c4ff4 100644 (file)
@@ -64,6 +64,9 @@ class AliL3Transform {
   static Double_t fSin[36]; //stores the sin value for local to global rotations  
 
  public:
+#ifdef use_aliroot
+  static Bool_t Init(AliRunLoader *runLoader); //init transformer params using a run loader
+#endif
   static Bool_t Init(Char_t* path,Bool_t UseAliTPCParam=kFALSE); //init transformer settings (versions)
   static Bool_t MakeInitFile(Char_t *rootfilename,Char_t *filename); //create the init file from rootfile
   static Bool_t ReadInit(Char_t *path);         //read init (possibly from root file)