]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New and updated simulation and reconstruction macros and test shell script
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Sep 2002 17:46:09 +0000 (17:46 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Sep 2002 17:46:09 +0000 (17:46 +0000)
plus the needed Config.C files.

ITS/AliITSDigits2RecPoints.C
ITS/AliITSHits2Digits.C
ITS/AliITSHits2SDigits.C
ITS/AliITSMerge.C
ITS/AliITStestAll0.sh [new file with mode: 0755]
ITS/Config_bg.C [new file with mode: 0644]
ITS/Config_muon.C [new file with mode: 0644]

index ac6a3c83777e588395d68732a9adc349741e7e1d..072a7f5b454a8538d0b093c673cc8a5653a68154 100644 (file)
+#if !defined(__CINT__) || defined(__MAKECINT__)
+
+#include "iostream.h"
+#include "TDatetime.h"
+#include "STEER/AliRun.h"
+#include "STEER/AliRunDigitizer.h"
+#include "ITS/AliITSDigitizer.h"
+#include "ITS/AliITS.h"
+#include "ITS/AliITSDetType.h"
+#include "ITS/AliITSresponseSDD.h"
+#include "TStopwatch.h"
+
+#endif
+
 TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
+void writeAR(TFile * fin, TFile *fou);
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
+#define DEBUG
+Int_t AliITSDigits2RecPoints(TString digFile="galiceD.root", 
+                           TString recFile="galiceR.root",TString opt=""){
+    // Standard ITS Digits to RecPoints.
 
-void AliITSDigits2RecPoints(TString inFile="galice.root", TString outFile="galice.root"){
-
-  TFile *file;
-  if(outFile.Data() == inFile.Data()){
-    file = AccessFile(inFile,"U");
-  }
-  else {
-    file = AccessFile(inFile);
-  }
-  
-  TStopwatch timer;
-
-  cout << "Creating reconstructed points from digits for the ITS..." << endl;
-  const char *nulptr=0;
-  AliITSreconstruction *itsr = new AliITSreconstruction(nulptr);
-  if(outFile.Data() != inFile.Data())itsr->SetOutputFile(outFile);
-  timer.Start();
-  itsr->Init();
-  itsr->Exec(); 
-  timer.Stop(); 
-  timer.Print();    
-  delete itsr;
-}
+    // Dynamically link some shared libs
+    if (gClassTable->GetID("AliRun") < 0) {
+       gROOT->LoadMacro("loadlibs.C");
+       loadlibs();
+    } // end if
+
+    // Connect the Root Galice file containing Geometry, Kine and Hits
+
+    TFile *digfile = 0;   // pointer to input file.
+    TFile *recfile = 0;  // possible output file for TreeD
+    if(recFile.CompareTo(digFile) == 0) { //write output to same file as input.
+       digfile = AccessFile(digFile,"U");  // input file open for update.
+    }else{ // different output file then input file.
+       digfile = AccessFile(digFile,"R"); // input file open as read only
+       recfile = new TFile(recFile,"NEW");
+    } // end if sdigFile == hitFile.
+/*
+    AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");      
+    if (!ITS) {
+       cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
+           << endl;
+       return 3;
+    }  // end if !ITS
+    if(!(ITS->GetITSgeom())){
+       cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
+       return 4;
+    } // end if
+
+    ChangeITSDefaults(digfile,ITS,opt);
+*/
+    // write the AliRun object to the output file if different from input file.
+    if(recfile) writeAR(digfile,recfile);
+    if(recfile){ recfile->Close(); recfile = 0;}
+//    if(digfile){ digfile->Close(); digfile = 0;}
+//    delete gAlice;
+//    gAlice = 0;
 
-//-------------------------------------------------------------------
+    TStopwatch timer;
+
+#ifdef DEBUG
+    cout << "Creating reconstructed points from digits for the ITS..." << endl;
+#endif
+//    const char *nulptr=0;
+    AliITSreconstruction *itsr = new AliITSreconstruction(gAlice);
+    if(digFile.CompareTo(recFile)!=0) {
+#ifdef DEBUG
+       cout << itsr << " filename="  << recFile << " compare="<<
+           digFile.CompareTo(recFile) << endl;
+#endif
+       itsr->SetOutputFile(recFile);
+    } // end if
+    timer.Start();
+    itsr->Init();
+    itsr->Exec(); 
+    timer.Stop(); 
+    timer.Print();
+    delete itsr;
+//    delete gAlice;
+//    gAlice = 0;
+    if(digfile){ digfile->Close(); digfile = 0;}
+    if(recfile){ recfile->Close(); recfile = 0;}
+    return 0;
+}
+//______________________________________________________________________
 TFile * AccessFile(TString FileName, TString acctype){
+    // Function used to open the input file and fetch the AliRun object
 
-  // Function used to open the input file and fetch the AliRun object
-
-  if (gAlice) {delete gAlice; gAlice = 0;}
-  TFile *retfil = 0;
-  TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
-  if (file) {file->Close(); delete file; file = 0;}
-  if(acctype.Contains("U")){
-    file = new TFile(FileName,"update");
-  }
-  if(acctype.Contains("N") && !file){
-    file = new TFile(FileName,"recreate");
-  }
-  if(!file) file = new TFile(FileName);   // default readonly
-  if (!file->IsOpen()) {
-       cerr<<"Can't open "<<FileName<<" !" << endl;
+    TFile *retfil = 0;
+    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
+    if(file) {
+       file->Close();
+       delete file;
+       file = 0;
+    } // end if file
+    if(acctype.Contains("U")){
+       file = new TFile(FileName,"UPDATE");
+    } // end if open for update
+    if(acctype.Contains("N") && !file){
+       file = new TFile(FileName,"RECREATE");
+    } // end if open a new file
+    if(!file) file = new TFile(FileName,"READ");   // default readonly
+    if (!file->IsOpen()) {
+       cerr << "Can't open " << FileName << " !" << endl;
        return retfil;
-  } 
+    } // end if error opeing file
 
-  // Get AliRun object from file or return if not on file
-  //  if (gAlice) {delete gAlice; gAlice = 0;}  
-  gAlice = (AliRun*)file->Get("gAlice");
-  if (!gAlice) {
-       cerr << "AliRun object not found on file"<< endl;
+    // Get AliRun object from file or return if not on file
+    if (gAlice) {delete gAlice; gAlice = 0;}
+    gAlice = (AliRun*)file->Get("gAlice");
+    if (!gAlice) {
+       cerr << "AliRun object not found on file "<< FileName << "!" << endl;
+       file->Close();  // close file and return error.
        return retfil;
-  } 
-  return file;
+    } // end if !gAlice
+    return file;
+}
+//______________________________________________________________________
+void writeAR(TFile * fin, TFile *fou) {
+    TDirectory *current = gDirectory;
+/*
+    TTree *TeOld;
+    TTree *TeNew;
+    AliHeader *alhe = new AliHeader();
+    TeOld = (TTree*)fin->Get("TE");
+    TeOld->SetBranchAddress("Header",&alhe);
+    TeOld->SetBranchStatus("*",1);
+    fou->cd();
+    TeNew = TeOld->CloneTree();
+    TeNew->Write(0,TObject::kOverwrite);
+*/
+    fou->cd();
+    gAlice->TreeE()->SetBranchStatus("*",1);
+    gAlice->TreeE()->Write(0,TObject::kOverwrite);
+    gAlice->Write(0,TObject::kOverwrite);
+    current->cd();
+//    delete alhe;
+#ifdef DEBUG
+    cout << "AliRun object written to file" << endl;
+#endif
+}
+//______________________________________________________________________
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt){
+
+    TDatime *ct0 = new TDatime(2002,04,26,00,00,00);
+    TDatime ct = hitfile->GetCreationDate();
+
+    if(ct0->GetDate()>ct.GetDate()){
+       // For old files, must change SDD noise.
+       AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)->
+           GetResponseModel();
+       resp1 = new AliITSresponseSDD();
+       ITS->SetResponseModel(1,resp1);
+       cout << "Changed response class for SDD:" << endl;
+       resp1->Print();
+    } // end if
+
+    if(opt.Contains("Dubna")){
+       AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna();
+       if(ITS->DetType(0)->GetResponseModel() !=0){
+           delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel());
+           ITS->DetType(0)->ResponseModel(0);
+       } // end if
+       ITS->DetType(0)->ResponseModel(resp0);
+       AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS->
+           DetType(0)->GetSegmentationModel();
+       AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0,
+                                                                     resp0);
+       if(ITS->DetType(0)->GetSimulationModel() !=0){
+           delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel());
+           ITS->DetType(0)->SimulationModel(0);
+       } // end if
+       ITS->DetType(0)->SimulationModel(sim0);
+    } // end if Dubna
 }
index 0c3675c34b1a792822db717d04fd488551af8119..7e55c9f7d20d3618c116028a7db1216f8f461ae7 100644 (file)
-TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
-void writeAR(TFile * fin, TFile *fou);
+#if !defined(__CINT__) || defined(__MAKECINT__)
 
-Int_t AliITSHits2Digits(Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", TString outFile="galice.root"){
+#include "iostream.h"
+#include "TDatetime.h"
+#include "STEER/AliRun.h"
+#include "STEER/AliRunDigitizer.h"
+#include "ITS/AliITSDigitizer.h"
+#include "ITS/AliITS.h"
+#include "ITS/AliITSDetType.h"
+#include "ITS/AliITSresponseSDD.h"
+#include "TStopwatch.h"
 
-  // Dynamically link some shared libs
-  if (gClassTable->GetID("AliRun") < 0) {
+#endif
+
+TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
+void writeAR(TFile * fin, TFile *fou);
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
+//#define DEBUG
+Int_t AliITSHits2Digits(TString hitFile = "galice.root", 
+                       TString digFile = "galiceD.root",TString opt=""){
+    // Standeard ITS Hits to Digits, excluding creation of SDigits.
+
+    // Dynamically link some shared libs
+    if (gClassTable->GetID("AliRun") < 0) {
        gROOT->LoadMacro("loadlibs.C");
        loadlibs();
-  } // end if
-
-  // Connect the Root Galice file containing Geometry, Kine and Hits
-
-  TFile *file;
-  if(outFile.Data() == inFile.Data()){
-    file = AccessFile(inFile,"U");
-  }
-  else {
-    file = AccessFile(inFile);
-  }
-  
-  TFile *file2 = 0;  // possible output file for TreeD
-
-  if(!(outFile.Data() == inFile.Data())){
-    // open output file and create TreeR on it
-    file2 = gAlice->InitTreeFile("D",outFile);
-  }
-
-  AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");      
-  if (!ITS) {
+    } // end if
+
+    // Connect the Root Galice file containing Geometry, Kine and Hits
+
+    TFile *hitfile = 0;   // pointer to input file.
+    TFile *digfile = 0;  // possible output file for TreeD
+    if(digFile.CompareTo(hitFile) == 0){// write output to same file as input.
+       hitfile = AccessFile(hitFile,"U");  // input file open for update.
+    }else{ // different output file then input file.
+       hitfile = AccessFile(hitFile,"R"); // input file open as read only
+       // open output file and create TreeR on it
+       digfile = gAlice->InitTreeFile("D",digFile);
+    } // end if digFile == hitFile.
+
+    AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");      
+    if (!ITS) {
        cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
            << endl;
        return 3;
-  }  // end if !ITS
-  if(!(ITS->GetITSgeom())){
+    }  // end if !ITS
+    if(!(ITS->GetITSgeom())){
        cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
        return 4;
-  } // end if
-
-  TDatime *ct0 = new TDatime(2002,04,26,00,00,00);
-  TDatime ct = file->GetCreationDate();
-
-  if(ct0->GetDate()>ct.GetDate()){
-       // For old files, must change SDD noise.
-    AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)->GetResponseModel();
-    resp1 = new AliITSresponseSDD();
-    ITS->SetResponseModel(1,resp1);
-    cout << "Changed response class for SDD: \n";
-    resp1->Print();
-  } // end if
-  TStopwatch timer;
-  timer.Start();
-
-  for(Int_t nevent = evNumber1; nevent <= evNumber2; nevent++){
-    cout<<"Producing Digits for event n."<<nevent<<endl;
-    gAlice->GetEvent(nevent);
-    if(!gAlice->TreeD() && file2 == 0){ 
-      cout << "Having to create the Digits Tree." << endl;
-      gAlice->MakeTree("D");
-    } 
-    if(file2)gAlice->MakeTree("D",file2);
-    ITS->MakeBranch("D");
-    ITS->SetTreeAddress();   
-    ITS->Hits2Digits();
-  }
-  timer.Stop();
-  timer.Print();
-
-  // write the AliRun object to the output file
-  if(file2)writeAR(file,file2);
-
-  delete gAlice;   
-  gAlice=0;
-  file->Close();
+    } // end if
+
+    ChangeITSDefaults(hitfile,ITS,opt);
+    // write the AliRun object to the output file if different from input file.
+    if(digfile) writeAR(hitfile,digfile);
+
+    TStopwatch timer;
+    Int_t evNumber1 = 0;
+    Int_t evNumber2 = gAlice->GetEventsPerRun();
+    timer.Start();
+    for(Int_t nevent = evNumber1; nevent < evNumber2; nevent++){
+       // cout<<"Producing Digits for event n."<<nevent<<endl;
+       gAlice->GetEvent(nevent);
+       if(!gAlice->TreeD() && digfile == 0){ 
+           cout << "Having to create the Digits Tree." << endl;
+           gAlice->MakeTree("D");
+       } // end if creating digits tree
+       if(digfile) gAlice->MakeTree("D",digfile);
+       ITS->MakeBranch("D");
+       ITS->SetTreeAddress();   
+       ITS->Hits2Digits();
+    } // end for nevent
+    timer.Stop();
+    timer.Print();
+    if(digfile!=0){
+       cout << digFile << " size =" << digfile->GetSize() << endl;
+    }else{
+       cout << hitFile << " size =" << hitfile->GetSize() << endl;
+    } // end if sdigfile!=0
+
+    delete gAlice; // digfile is closed by deleting gAlice if != hitfile.
+    gAlice = 0;
+    hitfile->Close(); hitfile = 0;
 }
-
-//-------------------------------------------------------------------
+//______________________________________________________________________
 TFile * AccessFile(TString FileName, TString acctype){
-
-  // Function used to open the input file and fetch the AliRun object
-
-  TFile *retfil = 0;
-  TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
-  if (file) {file->Close(); delete file; file = 0;}
-  if(acctype.Contains("U")){
-    file = new TFile(FileName,"update");
-  }
-  if(acctype.Contains("N") && !file){
-    file = new TFile(FileName,"recreate");
-  }
-  if(!file) file = new TFile(FileName);   // default readonly
-  if (!file->IsOpen()) {
-       cerr<<"Can't open "<<FileName<<" !" << endl;
+    // Function used to open the input file and fetch the AliRun object
+
+    TFile *retfil = 0;
+    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
+    if(file) {
+       file->Close();
+       delete file;
+       file = 0;
+    } // end if file
+    if(acctype.Contains("U")){
+       file = new TFile(FileName,"UPDATE");
+    } // end if open for update
+    if(acctype.Contains("N") && !file){
+       file = new TFile(FileName,"RECREATE");
+    } // end if open a new file
+    if(!file) file = new TFile(FileName,"READ");   // default readonly
+    if (!file->IsOpen()) {
+       cerr << "Can't open " << FileName << " !" << endl;
        return retfil;
-  } 
-
-  // Get AliRun object from file or return if not on file
-  if (gAlice) {delete gAlice; gAlice = 0;}
-  gAlice = (AliRun*)file->Get("gAlice");
-  if (!gAlice) {
-       cerr << "AliRun object not found on file"<< endl;
+    } // end if error opeing file
+
+    // Get AliRun object from file or return if not on file
+    if (gAlice) {delete gAlice; gAlice = 0;}
+    gAlice = (AliRun*)file->Get("gAlice");
+    if (!gAlice) {
+       cerr << "AliRun object not found on file "<< FileName << "!" << endl;
+       file->Close();  // close file and return error.
        return retfil;
-  } 
-  return file;
+    } // end if !gAlice
+    return file;
 }
-
-//-------------------------------------------------------------------
+//______________________________________________________________________
 void writeAR(TFile * fin, TFile *fou) {
-  TDirectory *current = gDirectory;
-  TTree *Te;
-  TTree *TeNew;
-  AliHeader *alhe = new AliHeader();
-  Te = (TTree*)fin->Get("TE");
-  Te->SetBranchAddress("Header",&alhe);
-  Te->SetBranchStatus("*",1);
-  fou->cd();
-  TeNew = Te->CloneTree();
-  TeNew->Write(0,TObject::kOverwrite);
-  gAlice->Write(0,TObject::kOverwrite);
-  current->cd();
-  delete alhe;
-  cout<<"AliRun object written to file\n";
+    TDirectory *current = gDirectory;
+    TTree *TeOld;
+    TTree *TeNew;
+    AliHeader *alhe = new AliHeader();
+    TeOld = (TTree*)fin->Get("TE");
+    TeOld->SetBranchAddress("Header",&alhe);
+    TeOld->SetBranchStatus("*",1);
+    fou->cd();
+    TeNew = TeOld->CloneTree();
+    TeNew->Write(0,TObject::kOverwrite);
+    gAlice->Write(0,TObject::kOverwrite);
+    current->cd();
+    delete alhe;
+#ifdef DEBUG
+    cout << "AliRun object written to file" << endl;
+#endif
 }
+//______________________________________________________________________
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt){
 
+    TDatime *ct0 = new TDatime(2002,04,26,00,00,00);
+    TDatime ct = hitfile->GetCreationDate();
 
-
-
-
+    if(ct0->GetDate()>ct.GetDate()){
+       // For old files, must change SDD noise.
+       AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)->
+           GetResponseModel();
+       resp1 = new AliITSresponseSDD();
+       ITS->SetResponseModel(1,resp1);
+       cout << "Changed response class for SDD:" << endl;
+       resp1->Print();
+    } // end if
+
+    if(opt.Contains("Dubna")){
+       AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna();
+       if(ITS->DetType(0)->GetResponseModel() !=0){
+           delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel());
+           ITS->DetType(0)->ResponseModel(0);
+       } // end if
+       ITS->DetType(0)->ResponseModel(resp0);
+       AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS->
+           DetType(0)->GetSegmentationModel();
+       AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0,
+                                                                     resp0);
+       if(ITS->DetType(0)->GetSimulationModel() !=0){
+           delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel());
+           ITS->DetType(0)->SimulationModel(0);
+       } // end if
+       ITS->DetType(0)->SimulationModel(sim0);
+    } // end if Dubna
+}
index c0bd7bad944e13b8f8d27de07aa5f18e54d886f2..a7d828cd5e5b081bfb4a55644d03bf050badcb38 100644 (file)
-TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
-void writeAR(TFile * fin, TFile *fou);
+#if !defined(__CINT__) || defined(__MAKECINT__)
+
+#include "iostream.h"
+#include "TDatetime.h"
+#include "STEER/AliRun.h"
+#include "STEER/AliRunDigitizer.h"
+#include "ITS/AliITSDigitizer.h"
+#include "ITS/AliITS.h"
+#include "ITS/AliITSDetType.h"
+#include "ITS/AliITSresponseSDD.h"
+#include "TStopwatch.h"
 
-Int_t AliITSHits2SDigits(Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", TString outFile="galice.root"){
+#endif
 
-  // Dynamically link some shared libs
-  if (gClassTable->GetID("AliRun") < 0) {
+TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
+void writeAR(TFile * fin, TFile *fou);
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
+//#define DEBUG
+Int_t AliITSHits2SDigits(TString  hitFile = "galice.root",
+                        TString sdigFile = "galiceS.root",TString opt=""){
+    // Standeard ITS Hits to SDigits.
+
+    // Dynamically link some shared libs
+    if (gClassTable->GetID("AliRun") < 0) {
        gROOT->LoadMacro("loadlibs.C");
        loadlibs();
-  } // end if
-
-  // Connect the Root Galice file containing Geometry, Kine and Hits
-
-  TFile *file;
-  if(outFile.Data() == inFile.Data()){
-    file = AccessFile(inFile,"U");
-  }
-  else {
-    file = AccessFile(inFile);
-  }
-  
-  TFile *file2 = 0;  // possible output file for TreeS
-
-  if(!(outFile.Data() == inFile.Data())){
-    // open output file and create TreeS on it
-    file2 = gAlice->InitTreeFile("S",outFile);
-  }
-
-  AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");      
-  if (!ITS) {
+    } // end if
+
+    // Connect the Root Galice file containing Geometry, Kine and Hits
+
+    TFile *hitfile = 0;   // pointer to input file.
+    TFile *sdigfile = 0;  // possible output file for TreeD
+    if(sdigFile.CompareTo(hitFile) == 0){// write output to same file as input.
+       hitfile = AccessFile(hitFile,"U");  // input file open for update.
+    }else{ // different output file then input file.
+       hitfile = AccessFile(hitFile,"R"); // input file open as read only
+       // open output file and create TreeR on it
+       sdigfile = gAlice->InitTreeFile("S",sdigFile);
+    } // end if sdigFile == hitFile.
+
+    AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");      
+    if (!ITS) {
        cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
            << endl;
        return 3;
-  }  // end if !ITS
-  if(!(ITS->GetITSgeom())){
+    }  // end if !ITS
+    if(!(ITS->GetITSgeom())){
        cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
        return 4;
-  } // end if
+    } // end if
 
-  TDatime *ct0 = new TDatime(2002,04,26,00,00,00);
-  TDatime ct = file->GetCreationDate();
+    ChangeITSDefaults(hitfile,ITS,opt);
+    // write the AliRun object to the output file if different from input file.
+    if(sdigfile) writeAR(hitfile,sdigfile);
 
-  if(ct0->GetDate()>ct.GetDate()){
-       // For old files, must change SDD noise.
-    AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)->GetResponseModel();
-    resp1 = new AliITSresponseSDD();
-    ITS->SetResponseModel(1,resp1);
-    cout << "Changed response class for SDD: \n";
-    resp1->Print();
-  } // end if
-  TStopwatch timer;
-  timer.Start();
-  for(Int_t nevent = evNumber1; nevent <= evNumber2; nevent++){
-    gAlice->GetEvent(nevent);
-    if(!gAlice->TreeS() && file2 == 0){ 
-      cout << "Having to create the SDigits Tree." << endl;
-      gAlice->MakeTree("S");
-    } // end if !gAlice->TreeS()
-    if(file2)gAlice->MakeTree("S",file2);
-    //    make branch
-    ITS->MakeBranch("S");
-    ITS->SetTreeAddress();
-    cout<<"Making ITS SDigits for event "<<nevent<<endl;
     TStopwatch timer;
-    Long_t size0 = file->GetSize();
-    ITS->Hits2SDigits();
-  }
-  timer.Stop();
-  timer.Print();
-
-  // write the AliRun object to the output file
-  if(file2)writeAR(file,file2);
-
-  delete gAlice;   gAlice=0;
-  file->Close();
+    Int_t evNumber1 = 0;
+    Int_t evNumber2 = gAlice->GetEventsPerRun();
+    timer.Start();
+    for(Int_t event = evNumber1; event < evNumber2; event++){
+       gAlice->GetEvent(event);
+       if(!gAlice->TreeS() && sdigfile == 0){ 
+           cout << "Having to create the SDigits Tree." << endl;
+           gAlice->MakeTree("S");
+       } // end if !gAlice->TreeS()
+       if(sdigfile) gAlice->MakeTree("S",sdigfile);
+       //    make branch
+       ITS->MakeBranch("S");
+       ITS->SetTreeAddress();
+#ifdef DEBUG
+       cout<<"Making ITS SDigits for event "<<event<<endl;
+#endif
+       ITS->Hits2SDigits();
+    } // end for event
+    timer.Stop();
+    timer.Print();
+    if(sdigfile!=0){
+       cout << sdigFile << " size =" << sdigfile->GetSize() << endl;
+    }else{
+       cout << hitFile << " size =" << hitfile->GetSize() << endl;
+    } // end if sdigfile!=0
+
+    delete gAlice; // sdigfile is closed by deleting gAlice if != hitfile.
+    gAlice = 0;
+    hitfile->Close(); hitfile=0;
 }
-
-//-------------------------------------------------------------------
+//______________________________________________________________________
 TFile * AccessFile(TString FileName, TString acctype){
-
-  // Function used to open the input file and fetch the AliRun object
-
-  TFile *retfil = 0;
-  TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
-  if (file) {file->Close(); delete file; file = 0;}
-  if(acctype.Contains("U")){
-    file = new TFile(FileName,"update");
-  }
-  if(acctype.Contains("N") && !file){
-    file = new TFile(FileName,"recreate");
-  }
-  if(!file) file = new TFile(FileName);   // default readonly
-  if (!file->IsOpen()) {
-       cerr<<"Can't open "<<FileName<<" !" << endl;
+    // Function used to open the input file and fetch the AliRun object
+
+    TFile *retfil = 0;
+    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
+    if(file) {
+       file->Close();
+       delete file;
+       file = 0;
+    } // end if file
+    if(acctype.Contains("U")){
+       file = new TFile(FileName,"UPDATE");
+    } // end if open for update
+    if(acctype.Contains("N") && !file){
+       file = new TFile(FileName,"RECREATE");
+    } // end if open a new file
+    if(!file) file = new TFile(FileName,"READ");   // default readonly
+    if (!file->IsOpen()) {
+       cerr << "Can't open " << FileName << " !" << endl;
        return retfil;
-  } 
-
-  // Get AliRun object from file or return if not on file
-  if (gAlice) {delete gAlice; gAlice = 0;}
-  gAlice = (AliRun*)file->Get("gAlice");
-  if (!gAlice) {
-       cerr << "AliRun object not found on file"<< endl;
+    } // end if error opeing file
+
+    // Get AliRun object from file or return if not on file
+    if (gAlice) {delete gAlice; gAlice = 0;}
+    gAlice = (AliRun*)file->Get("gAlice");
+    if (!gAlice) {
+       cerr << "AliRun object not found on file "<< FileName << "!" << endl;
+       file->Close();  // close file and return error.
        return retfil;
-  } 
-  return file;
+    } // end if !gAlice
+    return file;
 }
-
-//-------------------------------------------------------------------
+//______________________________________________________________________
 void writeAR(TFile * fin, TFile *fou) {
-  TDirectory *current = gDirectory;
-  TTree *Te;
-  TTree *TeNew;
-  AliHeader *alhe = new AliHeader();
-  Te = (TTree*)fin->Get("TE");
-  Te->SetBranchAddress("Header",&alhe);
-  Te->SetBranchStatus("*",1);
-  fou->cd();
-  TeNew = Te->CloneTree();
-  TeNew->Write(0,TObject::kOverwrite);
-  gAlice->Write(0,TObject::kOverwrite);
-  current->cd();
-  delete alhe;
-  cout<<"AliRun object written to file\n";
+    TDirectory *current = gDirectory;
+    TTree *TeOld;
+    TTree *TeNew;
+    AliHeader *alhe = new AliHeader();
+    TeOld = (TTree*)fin->Get("TE");
+    TeOld->SetBranchAddress("Header",&alhe);
+    TeOld->SetBranchStatus("*",1);
+    fou->cd();
+    TeNew = TeOld->CloneTree();
+    TeNew->Write(0,TObject::kOverwrite);
+    gAlice->Write(0,TObject::kOverwrite);
+    current->cd();
+    delete alhe;
+#ifdef DEBUG
+    cout << "AliRun object written to file" << endl;
+#endif
 }
+//______________________________________________________________________
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt){
 
+    TDatime *ct0 = new TDatime(2002,04,26,00,00,00);
+    TDatime ct = hitfile->GetCreationDate();
 
-
-
-
+    if(ct0->GetDate()>ct.GetDate()){
+       // For old files, must change SDD noise.
+       AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)->
+           GetResponseModel();
+       resp1 = new AliITSresponseSDD();
+       ITS->SetResponseModel(1,resp1);
+       cout << "Changed response class for SDD:" << endl;
+       resp1->Print();
+    } // end if
+
+    if(opt.Contains("Dubna")){
+       AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna();
+       if(ITS->DetType(0)->GetResponseModel() !=0){
+           delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel());
+           ITS->DetType(0)->ResponseModel(0);
+       } // end if
+       ITS->DetType(0)->ResponseModel(resp0);
+       AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS->
+           DetType(0)->GetSegmentationModel();
+       AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0,
+                                                                     resp0);
+       if(ITS->DetType(0)->GetSimulationModel() !=0){
+           delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel());
+           ITS->DetType(0)->SimulationModel(0);
+       } // end if
+       ITS->DetType(0)->SimulationModel(sim0);
+    } // end if Dubna
+}
index 77d38edffa117417b7f8d41294c6cdb1f838fdb2..fbb83d3a837e5928296ede6927936d5b0d198c09 100644 (file)
@@ -1,34 +1,5 @@
-////////////////////////////////////////////////////////////////////////
-//
-// name: AliITSMerge
-// date: 11.4.2002
-// last update: 11.4.2002
-// Updated 5/6/02
-// author: Jiri Chudoba
-// update by Bjorn Nilsen
-// version: 1.1
-//
-// description: 
-//       creates digits from sdigits for several detectors
-//       stores sdigits in separate file (or in the source file
-//       with sdigits). Stores gAlice object and copies TE to the
-//       file with digits
-//       ITS region of Interest is set
-//       test
-//
-// input:
-//       TString fileNameSDigits ... input file with sdigits
-//       TString fileNameDigits ... output file with digits
-//       Int_t nEvents  ... how many events to process
-//       Int_t ITS, many flags for diff. detectors
-//
-// History:
-//
-// 04.04.02 - first version
-// 
-////////////////////////////////////////////////////////////////////////
-
 #if !defined(__CINT__) || defined(__MAKECINT__)
+
 #include "iostream.h"
 #include "TDatetime.h"
 #include "STEER/AliRun.h"
 #include "ITS/AliITSDetType.h"
 #include "ITS/AliITSresponseSDD.h"
 #include "TStopwatch.h"
+
 #endif
 
-// #include "AliHits2SDigits.C"
-
-Int_t AliITSMerge(TString fileNameDigits="digits.root", 
-           TString fileNameSDigitsSig="sig.sdigits.root", 
-           TString fileNameSDigitsBgr="bgr.sdigits.root", 
-           Int_t nEvents = 1, Int_t iITS = 2){
-// delete the current gAlice object, the one from input file
-//  will be used
-
-  if(gAlice){
-    delete gAlice;
-    gAlice = 0;
-  } // end if gAlice
-
-  // Connect the Root Galice file containing Geometry, Kine and Hits
-  TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(fileNameSDigitsSig.Data());
-  if(!file) file = new TFile(fileNameSDigitsSig.Data());
-  TDatime *ct0 = new TDatime(2002,04,26,00,00,00), ct = file->GetCreationDate();
-  
-  // Get AliRun object from file or create it if not on file
-  if(!gAlice) {
-      gAlice = (AliRun*)file->Get("gAlice");
-      if(gAlice) printf("AliRun object found on file\n");
-      if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
-  } // end if !gAlice
-
-  AliRunDigitizer * manager = new AliRunDigitizer(2,1);
-  manager->SetInputStream(0,fileNameSDigitsSig.Data());
-  manager->SetInputStream(1,fileNameSDigitsBgr.Data());
-  if (fileNameDigits != "") {
-    manager->SetOutputFile(fileNameDigits);
-  }
-  manager->SetNrOfEventsToWrite(nEvents);
-  
-  if (iITS) {
-    AliITSDigitizer *dITS  = new AliITSDigitizer(manager);
-    if (iITS == 2) dITS->SetByRegionOfInterestFlag(1);
-    // For old files, must change SDD noise.
-    // and for new file we will do it anyway for simplicity.
-    AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
-    AliITSresponseSDD *resp1 = ITS->DetType(1)->GetResponseModel();
-    resp1->SetNoiseParam();
-    resp1->SetNoiseAfterElectronics();
-    Float_t n,b;
-    Int_t cPar[8];
-    resp1->GetNoiseParam(n,b);
-    n = resp1->GetNoiseAfterElectronics();
-    cPar[0]=0;
-    cPar[1]=0;
-    cPar[2]=(Int_t)(b + 2.*n + 0.5);
-    cPar[3]=(Int_t)(b + 2.*n + 0.5);
-    cPar[4]=0;
-    cPar[5]=0;
-    cPar[6]=0;
-    cPar[7]=0;
-    resp1->SetCompressParam(cPar);
-  }
-  TStopwatch timer;
-  timer.Start();
-  manager->Exec("deb all");
-  timer.Stop(); 
-  timer.Print();
-  // gAlice may need to be deleted but not if as part of larger production.
-  delete manager;
+TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
+void writeAR(TFile * fin, TFile *fou);
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt="");
+//#define DEBUG
+Int_t AliITSMerge(TString digFile="galiceMD.root", 
+           TString sdigFileSig="galiceS_sig.root", 
+           TString sdigFileBg="",TString opt=""){
+    // Standeard ITS SDigits to Digits, with posible merging.
+
+    // Dynamically link some shared libs
+    if (gClassTable->GetID("AliRun") < 0) {
+       gROOT->LoadMacro("loadlibs.C");
+       loadlibs();
+    } // end if
+    // Connect the Root Galice file containing Geometry, Kine and Hits
+    if (gAlice) {delete gAlice; gAlice = 0;}
+
+    TFile *sdigfilesig = 0;   // pointer to signal input file.
+    TFile *sdigfilebg  = 0;   // pointer to background input file.
+    TFile *digfile = 0;  // possible output file for TreeD
+
+    // Setup to copy gAlice and the event tree to the output file.
+
+    if(digFile.CompareTo(sdigFileSig)==0){//write output to same file as input.
+       sdigfilesig = AccessFile(sdigFileSig,"U");//input file open for update.
+    }else{ // different output file then input file.
+       sdigfilesig = AccessFile(sdigFileSig,"R");//input file open read only
+       digfile = new TFile(digFile,"NEW");
+    } // end if digFile == hitFile.
+
+    AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");      
+    if (!ITS) {
+       cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
+           << endl;
+       return 3;
+    }  // end if !ITS
+
+    ChangeITSDefaults(sdigfilesig,ITS,opt);
+    // write the AliRun object to the output file if different from input file.
+    if(digfile){
+       writeAR(sdigfilesig,digfile);
+       digfile->Close(); // Manager will open in update mode.
+       digfile = 0;
+    } // end if digfile
+    sdigfilesig->Close();
+    sdigfilesig = 0;
+//    delete gAlice; gAlice=0;   // there is a problem with deleting gAlice????
+
+    AliRunDigitizer *manager;
+    if(sdigFileBg.CompareTo("")==0) { // do not merge.
+       manager = new AliRunDigitizer(1,1);
+    }else{
+       manager = new AliRunDigitizer(2,1);
+       manager->SetInputStream(0,sdigFileSig.Data());
+       manager->SetInputStream(1,sdigFileBg.Data());
+    } // end if
+    if (digFile.CompareTo(sdigFileSig) !=0) {
+       manager->SetOutputFile(digFile);
+    } // end if
+//    manager->SetCopyTreesFromInput(0);
+    AliITSDigitizer *dITS = new AliITSDigitizer(manager);
+    if(opt.Contains("ROI")==0) dITS->SetByRegionOfInterestFlag(1);
+
+    TStopwatch timer;
+    timer.Start();
+    manager->Exec("all");
+    timer.Stop(); 
+    timer.Print();
+
+    if(digfile!=0){
+       cout << digFile << " size =" << digfile->GetSize() << endl;
+    }else if(sdigfilesig!=0){
+       cout << sdigFileSig << " size =" << sdigfilesig->GetSize() << endl;
+    } // end if sdigfile!=0
+
+
+    if(digfile) digfile->Close();
+    if(sdigfilesig) sdigfilesig->Close();
+    if(sdigfilebg)  sdigfilebg->Close();
+
+    // There is a problem deleting gAlice. It is related to the destructor
+    // and the fTreeE in AliRun. So for now it is not deleted.
+//    delete gAlice; // digfile is closed by deleting gAlice if != hitfile.
+//    gAlice = 0;
+    delete manager;
 }
+//______________________________________________________________________
+TFile * AccessFile(TString FileName, TString acctype){
+    // Function used to open the input file and fetch the AliRun object
 
+    TFile *retfil = 0;
+    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
+    if(file) {
+       file->Close();
+       delete file;
+       file = 0;
+    } // end if file
+    if(acctype.Contains("U")){
+       file = new TFile(FileName,"UPDATE");
+    } // end if open for update
+    if(acctype.Contains("N") && !file){
+       file = new TFile(FileName,"RECREATE");
+    } // end if open a new file
+    if(!file) file = new TFile(FileName,"READ");   // default readonly
+    if (!file->IsOpen()) {
+       cerr << "Can't open " << FileName << " !" << endl;
+       return retfil;
+    } // end if error opeing file
+
+    // Get AliRun object from file or return if not on file
+    if (gAlice) {delete gAlice; gAlice = 0;}
+    gAlice = (AliRun*)file->Get("gAlice");
+    if (!gAlice) {
+       cerr << "AliRun object not found on file "<< FileName << "!" << endl;
+       file->Close();  // close file and return error.
+       return retfil;
+    } // end if !gAlice
+    return file;
+}
+//______________________________________________________________________
+void writeAR(TFile * fin, TFile *fou) {
+    TDirectory *current = gDirectory;
+    TTree *TeOld;
+    TTree *TeNew;
+    AliHeader *alhe = new AliHeader();
+    TeOld = (TTree*)fin->Get("TE");
+    TeOld->SetBranchAddress("Header",&alhe);
+    TeOld->SetBranchStatus("*",1);
+    fou->cd();
+    TeNew = TeOld->CloneTree();
+    TeNew->Write(0,TObject::kOverwrite);
+    gAlice->Write(0,TObject::kOverwrite);
+    current->cd();
+    delete alhe;
+#ifdef DEBUG
+    cout << "AliRun object written to file" << endl;
+#endif
+}
+//______________________________________________________________________
+Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt){
+
+    TDatime *ct0 = new TDatime(2002,04,26,00,00,00);
+    TDatime ct = hitfile->GetCreationDate();
+
+    if(ct0->GetDate()>ct.GetDate()){
+       // For old files, must change SDD noise.
+       AliITSresponseSDD *resp1 = (AliITSresponseSDD*)ITS->DetType(1)->
+           GetResponseModel();
+       resp1 = new AliITSresponseSDD();
+       ITS->SetResponseModel(1,resp1);
+       cout << "Changed response class for SDD:" << endl;
+       resp1->Print();
+    } // end if
+
+    if(opt.Contains("Dubna")){
+       AliITSresponseSPDdubna *resp0 = new AliITSresponseSPDdubna();
+       if(ITS->DetType(0)->GetResponseModel() !=0){
+           delete ((AliITSresponse*)ITS->DetType(0)->GetResponseModel());
+           ITS->DetType(0)->ResponseModel(0);
+       } // end if
+       ITS->DetType(0)->ResponseModel(resp0);
+       AliITSsegmentationSPD *seg0 = (AliITSsegmentationSPD*)ITS->
+           DetType(0)->GetSegmentationModel();
+       AliITSsimulationSPDdubna *sim0 = new AliITSsimulationSPDdubna(seg0,
+                                                                     resp0);
+       if(ITS->DetType(0)->GetSimulationModel() !=0){
+           delete ((AliITSsimulation*)ITS->DetType(0)->GetSimulationModel());
+           ITS->DetType(0)->SimulationModel(0);
+       } // end if
+       ITS->DetType(0)->SimulationModel(sim0);
+    } // end if Dubna
+}
diff --git a/ITS/AliITStestAll0.sh b/ITS/AliITStestAll0.sh
new file mode 100755 (executable)
index 0000000..41baf4b
--- /dev/null
@@ -0,0 +1,29 @@
+#
+set echo on
+#
+aliroot -b -q grun.C\(2,\"$ALICE_ROOT/ITS/Config_muon.C\"\) >& aliroot_muon.log 
+#
+mv galice.root galice_muon.root
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSHits2SDigits.C\(\"galice_muon.root\"\,\"galice_muonS.root\"\) >& aliroot_muonS.log
+#
+aliroot -b -q grun.C\(2,\"$ALICE_ROOT/ITS/Config_bg.C\"\) >& aliroot_bg.log
+#
+cp galice.root galice_all.root
+mv galice.root galice_bg.root
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSHits2SDigits.C\(\"galice_bg.root\"\,\"galice_bgS.root\"\) >& aliroot_bgS.log
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSHits2Digits.C\(\"galice_bg.root\"\,\"galice_D.root\"\) >& aliroot_D.log
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSHits2Digits.C\(\"galice_all.root\"\,\"galice_all.root\"\) >& aliroot_allD.log
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSMerge.C\(\"galice_mD.root\",\"galice_muonS.root\",\"galice_bgS.root\"\) >& aliroot_m.log
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSDigits2RecPoints.C\(\"galice_mD.root\",\"galice_mR.root\"\) >& aliroot_mRec.log
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSDigits2RecPoints.C\(\"galice_D.root\",\"galice_R.root\"\) >& aliroot_Rec.log
+#
+aliroot -q -b $ALICE_ROOT/ITS/AliITSDigits2RecPoints.C\(\"galice_all.root\",\"galice_all.root\"\) >& aliroot_allRec.log
+#
+
diff --git a/ITS/Config_bg.C b/ITS/Config_bg.C
new file mode 100644 (file)
index 0000000..6862bd9
--- /dev/null
@@ -0,0 +1,257 @@
+void Config(){
+    // 7-DEC-2000 09:00
+    // Switch on Transition Radiation simulation. 6/12/00 18:00
+    // iZDC=1  7/12/00 09:00
+    // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
+    // Theta range given through pseudorapidity limits 22/6/2001
+
+    // Set Random Number seed
+    // gRandom->SetSeed(12345);
+
+    new     AliGeant3("C++ Interface to Geant3");
+
+    if (!gSystem->Getenv("CONFIG_FILE"))
+    {
+        TFile  *rootfile = new TFile("galice.root", "recreate");
+
+        rootfile->SetCompressionLevel(2);
+    }
+
+    TGeant3 *geant3 = (TGeant3 *) gMC;
+
+    //
+    // Set External decayer
+    AliDecayer *decayer = new AliDecayerPythia();
+
+    decayer->SetForceDecay(kAll);
+    decayer->Init();
+    gMC->SetExternalDecayer(decayer);
+    //
+    //
+    //=======================================================================
+    // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
+    geant3->SetTRIG(1);         //Number of events to be processed 
+    geant3->SetSWIT(4, 10);
+    geant3->SetDEBU(0, 0, 1);
+    //geant3->SetSWIT(2,2);
+    geant3->SetDCAY(1);
+    geant3->SetPAIR(1);
+    geant3->SetCOMP(1);
+    geant3->SetPHOT(1);
+    geant3->SetPFIS(0);
+    geant3->SetDRAY(0);
+    geant3->SetANNI(1);
+    geant3->SetBREM(1);
+    geant3->SetMUNU(1);
+    geant3->SetCKOV(1);
+    geant3->SetHADR(1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
+    geant3->SetLOSS(2);
+    geant3->SetMULS(1);
+    geant3->SetRAYL(1);
+    geant3->SetAUTO(1); //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
+    geant3->SetABAN(0); //Restore 3.16 behaviour for abandoned tracks
+    geant3->SetOPTI(2); //Select optimisation level for GEANT geometry searches (0,1,2)
+    geant3->SetERAN(5.e-7);
+
+    Float_t cut = 1.e-3;        // 1MeV cut by default
+    Float_t tofmax = 1.e10;
+
+    //             GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX
+    geant3->SetCUTS(cut, cut, cut, cut, cut, cut, cut, cut, cut, cut,
+                    tofmax);
+    //
+    //=======================================================================
+    // ************* STEERING parameters FOR ALICE SIMULATION **************
+    // --- Specify event type to be tracked through the ALICE setup
+    // --- All positions are in cm, angles in degrees, and P and E in GeV
+    if (gSystem->Getenv("CONFIG_NPARTICLES")){
+        int     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
+    } else{
+        int     nParticles = 500;
+    } // end if
+    AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
+
+    gener->SetMomentumRange(0, 999);
+    gener->SetPhiRange(0, 360);
+    // Set pseudorapidity range from -8 to 8.
+    Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
+    Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
+    gener->SetThetaRange(thmin,thmax);
+    gener->SetOrigin(0, 0, 0);  //vertex position
+    gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
+    gener->Init();
+    // 
+    // Activate this line if you want the vertex smearing to happen
+    // track by track
+    //
+    //gener->SetVertexSmear(perTrack); 
+
+    gAlice->SetField(-999, 2);  //Specify maximum magnetic field in Tesla (neg. ==> default field)
+
+    Int_t   iABSO  = 1;
+    Int_t   iDIPO  = 1;
+    Int_t   iFMD   = 1;
+    Int_t   iFRAME = 1;
+    Int_t   iHALL  = 1;
+    Int_t   iITS   = 1;
+    Int_t   iMAG   = 1;
+    Int_t   iMUON  = 1;
+    Int_t   iPHOS  = 1;
+    Int_t   iPIPE  = 1;
+    Int_t   iPMD   = 1;
+    Int_t   iRICH  = 1;
+    Int_t   iSHIL  = 1;
+    Int_t   iSTART = 1;
+    Int_t   iTOF   = 1;
+    Int_t   iTPC   = 1;
+    Int_t   iTRD   = 1;
+    Int_t   iZDC   = 1;
+    Int_t   iEMCAL = 1;
+
+    //=================== Alice BODY parameters =============================
+    AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
+
+    if (iMAG){
+        //=================== MAG parameters ============================
+        // --- Start with Magnet since detector layouts may be depending ---
+        // --- on the selected Magnet dimensions ---
+        AliMAG *MAG = new AliMAG("MAG", "Magnet");
+    }
+    if (iABSO){
+        //=================== ABSO parameters ============================
+        AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
+    }
+    if (iDIPO){
+        //=================== DIPO parameters ============================
+        AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
+    }
+    if (iHALL){
+        //=================== HALL parameters ============================
+        AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
+    }
+    if (iFRAME){
+        //=================== FRAME parameters ============================
+        AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
+    }
+    if (iSHIL){
+        //=================== SHIL parameters ============================
+        AliSHIL *SHIL = new AliSHILvF("SHIL", "Shielding");
+    }
+    if (iPIPE){
+        //=================== PIPE parameters ============================
+        AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
+    }
+    if(iITS) {
+       //=================== ITS parameters ============================
+       //
+       // As the innermost detector in ALICE, the Inner Tracking System 
+       // "impacts" on almost all other detectors. This involves the fact
+       // that the ITS geometry still has several options to be followed
+       //in parallel in order to determine the best set-up which minimizes
+       // the induced background. All the geometries available to date are
+       // described in the following. Read carefully the comments and use
+       // the default version (the only one uncommented) unless you are making
+       // comparisons and you know what you are doing. In this case just
+       // uncomment the ITS geometry you want to use and run Aliroot.
+       // Detailed geometries:
+       AliITSvPPRasymm *ITS  = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
+       ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
+       ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
+       ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
+       ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
+       ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
+       ITS->SetThicknessChip2(200.);// chip thickness on layer 2 must be in the range [150,300]
+       ITS->SetRails(1);            // 1 --> rails in ; 0 --> rails out
+       ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
+       // Geant3 <-> EUCLID conversion
+       // ============================
+       // SetEUCLID is a flag to output (=1) or not to output (=0) both
+       // geometry and media to two ASCII files (called by default
+       // ITSgeometry.euc and ITSgeometry.tme) in a format understandable
+       // to the CAD system EUCLID.  The default (=0) means that you dont
+       // want to use this facility.
+       ITS->SetEUCLID(0);  
+    }
+    if (iTPC){
+        //============================ TPC parameters =========================
+        // This allows the user to specify sectors for the SLOW (TPC geometry
+       // 2) Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
+        // sectors are specified, any value other than that requires at least
+       // one sector (lower or upper)to be specified!
+        // Reminder: sectors  1-24 are lower sectors  ( 1-12->z>0,13-24->z<0)
+        //           sectors 25-72 are the upper ones (25-48->z>0,49-72->z<0)
+        // SecLows - number of lower sectors specified (up to 6)
+        // SecUps - number of upper sectors specified (up to 12)
+        // Sens - sensitive strips for the Slow Simulator !!!
+        // This does NOT work if all S or L-sectors are specified, i.e.
+        // if SecAL or SecAU < 0
+        //---------------------------------------------------------------------
+        //  gROOT->LoadMacro("SetTPCParam.C");
+        //  AliTPCParam *param = SetTPCParam();
+        AliTPC *TPC = new AliTPCv2("TPC", "Default");
+        // All sectors included 
+        TPC->SetSecAL(-1);
+        TPC->SetSecAU(-1);
+    }
+    if (iTOF){
+        //=================== TOF parameters ============================
+        AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
+    }
+    if (iRICH){
+        //=================== RICH parameters ===========================
+        AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
+    }
+    if (iZDC){
+        //=================== ZDC parameters ============================
+        AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
+    }
+    if (iTRD){
+        //=================== TRD parameters ============================
+        AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
+        // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe +
+       // 10% CO2)
+        TRD->SetGasMix(1);
+        // With hole in front of PHOS
+        TRD->SetPHOShole();
+        // With hole in front of RICH
+        TRD->SetRICHhole();
+        // Switch on TR
+        AliTRDsim *TRDsim = TRD->CreateTR();
+    }
+    if (iFMD){
+        //=================== FMD parameters ============================
+        AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
+        FMD->SetRingsSi1(256);
+        FMD->SetRingsSi2(64);
+        FMD->SetSectorsSi1(20);
+        FMD->SetSectorsSi2(24);
+    }
+    if (iMUON){
+        //=================== MUON parameters ===========================
+        AliMUON *MUON = new AliMUONv1("MUON", "default");
+    }
+    if (iPHOS){
+       //=================== PHOS parameters ===========================
+        AliPHOS *PHOS = new AliPHOSv1("PHOS", "GPS2");
+    }
+    if (iPMD){
+        //=================== PMD parameters ============================
+        AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
+        PMD->SetPAR(1., 1., 0.8, 0.02);
+        PMD->SetIN(6., 18., -580., 27., 27.);
+        PMD->SetGEO(0.0, 0.2, 4.);
+        PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
+    }
+    if (iEMCAL){
+        //=================== EMCAL parameters ============================
+        AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a");
+    }
+    if (iSTART){
+        //=================== START parameters ============================
+        AliSTART *START = new AliSTARTv1("START", "START Detector");
+    }
+}
+//----------------------------------------------------------------------
+Float_t EtaToTheta(Float_t arg){
+  return (180./TMath::Pi())*2.*atan(exp(-arg));
+}
diff --git a/ITS/Config_muon.C b/ITS/Config_muon.C
new file mode 100644 (file)
index 0000000..4a87c13
--- /dev/null
@@ -0,0 +1,256 @@
+void Config(){
+    // 7-DEC-2000 09:00
+    // Switch on Transition Radiation simulation. 6/12/00 18:00
+    // iZDC=1  7/12/00 09:00
+    // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
+    // Theta range given through pseudorapidity limits 22/6/2001
+
+    // Set Random Number seed
+    // gRandom->SetSeed(12345);
+
+    new     AliGeant3("C++ Interface to Geant3");
+
+    if (!gSystem->Getenv("CONFIG_FILE"))
+    {
+        TFile  *rootfile = new TFile("galice.root", "recreate");
+
+        rootfile->SetCompressionLevel(2);
+    }
+
+    TGeant3 *geant3 = (TGeant3 *) gMC;
+
+    //
+    // Set External decayer
+    AliDecayer *decayer = new AliDecayerPythia();
+
+    decayer->SetForceDecay(kAll);
+    decayer->Init();
+    gMC->SetExternalDecayer(decayer);
+    //
+    //
+    //=======================================================================
+    // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
+    geant3->SetTRIG(1);         //Number of events to be processed 
+    geant3->SetSWIT(4, 10);
+    geant3->SetDEBU(0, 0, 1);
+    //geant3->SetSWIT(2,2);
+    geant3->SetDCAY(1);
+    geant3->SetPAIR(1);
+    geant3->SetCOMP(1);
+    geant3->SetPHOT(1);
+    geant3->SetPFIS(0);
+    geant3->SetDRAY(0);
+    geant3->SetANNI(1);
+    geant3->SetBREM(1);
+    geant3->SetMUNU(1);
+    geant3->SetCKOV(1);
+    geant3->SetHADR(1);         //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
+    geant3->SetLOSS(2);
+    geant3->SetMULS(1);
+    geant3->SetRAYL(1);
+    geant3->SetAUTO(1);         //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
+    geant3->SetABAN(0);         //Restore 3.16 behaviour for abandoned tracks
+    geant3->SetOPTI(2);         //Select optimisation level for GEANT geometry searches (0,1,2)
+    geant3->SetERAN(5.e-7);
+
+    Float_t cut = 1.e-3;        // 1MeV cut by default
+    Float_t tofmax = 1.e10;
+
+    //             GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX
+    geant3->SetCUTS(cut, cut, cut, cut, cut, cut, cut, cut, cut, cut,
+                    tofmax);
+    //
+    //=======================================================================
+    // ************* STEERING parameters FOR ALICE SIMULATION **************
+    // --- Specify event type to be tracked through the ALICE setup
+    // --- All positions are in cm, angles in degrees, and P and E in GeV
+    if (gSystem->Getenv("CONFIG_NPARTICLES")){
+        int     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
+    }else{
+        int     nParticles = 2;
+    } // end if
+//*********************************************
+// Example for Fixed Particle Gun
+//*********************************************
+     AliGenFixed *gener = new AliGenFixed(nParticles);
+     gener->SetMomentum(50);
+     gener->SetPhi(180.);
+     gener->SetTheta(95.);
+     gener->SetOrigin(0,0,0);          //vertex position
+     gener->SetPart(13);                //GEANT particle type
+    gener->Init();
+    // 
+    // Activate this line if you want the vertex smearing to happen
+    // track by track
+    //
+    //gener->SetVertexSmear(perTrack); 
+
+    gAlice->SetField(-999, 2);  //Specify maximum magnetic field in Tesla (neg. ==> default field)
+
+    Int_t   iABSO  = 1;
+    Int_t   iDIPO  = 1;
+    Int_t   iFMD   = 1;
+    Int_t   iFRAME = 1;
+    Int_t   iHALL  = 1;
+    Int_t   iITS   = 1;
+    Int_t   iMAG   = 1;
+    Int_t   iMUON  = 1;
+    Int_t   iPHOS  = 1;
+    Int_t   iPIPE  = 1;
+    Int_t   iPMD   = 1;
+    Int_t   iRICH  = 1;
+    Int_t   iSHIL  = 1;
+    Int_t   iSTART = 1;
+    Int_t   iTOF   = 1;
+    Int_t   iTPC   = 1;
+    Int_t   iTRD   = 1;
+    Int_t   iZDC   = 1;
+    Int_t   iEMCAL = 1;
+
+    //=================== Alice BODY parameters =============================
+    AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
+
+    if (iMAG){
+        //=================== MAG parameters ============================
+        // --- Start with Magnet since detector layouts may be depending ---
+        // --- on the selected Magnet dimensions ---
+        AliMAG *MAG = new AliMAG("MAG", "Magnet");
+    }
+    if (iABSO){
+        //=================== ABSO parameters ============================
+        AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
+    }
+    if (iDIPO){
+        //=================== DIPO parameters ============================
+        AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
+    }
+    if (iHALL){
+        //=================== HALL parameters ============================
+        AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
+    }
+    if (iFRAME){
+        //=================== FRAME parameters ============================
+        AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
+    }
+    if (iSHIL){
+        //=================== SHIL parameters ============================
+        AliSHIL *SHIL = new AliSHILvF("SHIL", "Shielding");
+    }
+    if (iPIPE){
+        //=================== PIPE parameters ============================
+        AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
+    }
+    if(iITS) {
+       //=================== ITS parameters ============================
+       //
+       // As the innermost detector in ALICE, the Inner Tracking System 
+       // "impacts" on almost all other detectors. This involves the fact
+       // that the ITS geometry still has several options to be followed
+       //in parallel in order to determine the best set-up which minimizes
+       // the induced background. All the geometries available to date are
+       // described in the following. Read carefully the comments and use
+       // the default version (the only one uncommented) unless you are making
+       // comparisons and you know what you are doing. In this case just
+       // uncomment the ITS geometry you want to use and run Aliroot.
+       // Detailed geometries:
+       AliITSvPPRasymm *ITS  = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
+       ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
+       ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
+       ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
+       ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
+       ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
+       ITS->SetThicknessChip2(200.);// chip thickness on layer 2 must be in the range [150,300]
+       ITS->SetRails(1);            // 1 --> rails in ; 0 --> rails out
+       ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
+       // Geant3 <-> EUCLID conversion
+       // ============================
+       // SetEUCLID is a flag to output (=1) or not to output (=0) both
+       // geometry and media to two ASCII files (called by default
+       // ITSgeometry.euc and ITSgeometry.tme) in a format understandable
+       // to the CAD system EUCLID.  The default (=0) means that you dont
+       // want to use this facility.
+       ITS->SetEUCLID(0);  
+    }
+    if (iTPC){
+        //============================ TPC parameters =========================
+        // This allows the user to specify sectors for the SLOW (TPC geometry
+       // 2) Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
+        // sectors are specified, any value other than that requires at least
+       // one sector (lower or upper)to be specified!
+        // Reminder: sectors  1-24 are lower sectors  ( 1-12->z>0,13-24->z<0)
+        //           sectors 25-72 are the upper ones (25-48->z>0,49-72->z<0)
+        // SecLows - number of lower sectors specified (up to 6)
+        // SecUps - number of upper sectors specified (up to 12)
+        // Sens - sensitive strips for the Slow Simulator !!!
+        // This does NOT work if all S or L-sectors are specified, i.e.
+        // if SecAL or SecAU < 0
+        //---------------------------------------------------------------------
+        //  gROOT->LoadMacro("SetTPCParam.C");
+        //  AliTPCParam *param = SetTPCParam();
+        AliTPC *TPC = new AliTPCv2("TPC", "Default");
+        // All sectors included 
+        TPC->SetSecAL(-1);
+        TPC->SetSecAU(-1);
+    }
+    if (iTOF){
+        //=================== TOF parameters ============================
+        AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
+    }
+    if (iRICH){
+        //=================== RICH parameters ===========================
+        AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
+    }
+    if (iZDC){
+        //=================== ZDC parameters ============================
+        AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
+    }
+    if (iTRD){
+        //=================== TRD parameters ============================
+        AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
+        // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe +
+       // 10% CO2)
+        TRD->SetGasMix(1);
+        // With hole in front of PHOS
+        TRD->SetPHOShole();
+        // With hole in front of RICH
+        TRD->SetRICHhole();
+        // Switch on TR
+        AliTRDsim *TRDsim = TRD->CreateTR();
+    }
+    if (iFMD){
+        //=================== FMD parameters ============================
+        AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
+        FMD->SetRingsSi1(256);
+        FMD->SetRingsSi2(64);
+        FMD->SetSectorsSi1(20);
+        FMD->SetSectorsSi2(24);
+    }
+    if (iMUON){
+        //=================== MUON parameters ===========================
+        AliMUON *MUON = new AliMUONv1("MUON", "default");
+    }
+    if (iPHOS){
+       //=================== PHOS parameters ===========================
+        AliPHOS *PHOS = new AliPHOSv1("PHOS", "GPS2");
+    }
+    if (iPMD){
+        //=================== PMD parameters ============================
+        AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
+        PMD->SetPAR(1., 1., 0.8, 0.02);
+        PMD->SetIN(6., 18., -580., 27., 27.);
+        PMD->SetGEO(0.0, 0.2, 4.);
+        PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
+    }
+    if (iEMCAL){
+        //=================== EMCAL parameters ============================
+        AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a");
+    }
+    if (iSTART){
+        //=================== START parameters ============================
+        AliSTART *START = new AliSTARTv1("START", "START Detector");
+    }
+}
+//----------------------------------------------------------------------
+Float_t EtaToTheta(Float_t arg){
+  return (180./TMath::Pi())*2.*atan(exp(-arg));
+}