- Eliminated last remnants of TGeometry. Some more may linger around in ITS, the authors will be contacted
- Most of the simulation functionality moved from AliRun to AliSimulation. Some still to be moved. More work will be needed to further reduce AliRun
functionality and move it into the runloader
#include <TLorentzVector.h>
#include <TVirtualMC.h>
#include <TPDGCode.h>
-#include <TGeometry.h>
-#include <TBRIK.h>
-#include <TNode.h>
#include "AliRun.h"
#include <Riostream.h>
#include <TGeoMatrix.h>
-#include <TGeometry.h>
#include <TMath.h>
-#include <TTUBE.h>
#include <TString.h>
#include <TSystem.h>
#include <TLorentzVector.h>
#include <TVirtualMC.h>
#include <TPDGCode.h>
-#include <TBRIK.h>
-#include <TNode.h>
-
#include "AliRun.h"
#include "AliConst.h"
// --- ROOT system ---
#include <cassert>
-#include <TNode.h>
-#include <TBRIK.h>
-#include <TTRD1.h>
-#include <TTRAP.h>
-#include <TPGON.h>
-#include <TTUBS.h>
#include <TGeometry.h>
#include <TGeoPhysicalNode.h>
#include <TGeoManager.h>
class TFile;
class TList;
-class TNode;
class AliEMCALShishKebabTrd1Module;
class AliEMCALSpaceFrame;
#include "TLorentzVector.h"
#include "AliStack.h"
#include "AliGenAfterBurnerFlow.h"
+#include "AliMC.h"
#include "AliGenCocktailAfterBurner.h"
// emanuele ---------------------------------------------------------------(
Float_t pt, y;
// Get Stack of the first Generator
- gen = (AliGenCocktailAfterBurner *)gAlice->Generator();
+ gen = (AliGenCocktailAfterBurner *)gAlice->GetMCApp()->Generator();
// emanuele ---------------------------------------------------------------(
// files by including them with `#include "..."'
#include <cmath> // __CMATH__
#include <TClonesArray.h> // ROOT_TClonesArray
-#include <TGeometry.h> // ROOT_TGeomtry
-#include <TNode.h> // ROOT_TNode
-#include <TXTRU.h> // ROOT_TXTRU
#include <TRotMatrix.h> // ROOT_TRotMatrix
-#include <TTUBE.h> // ROOT_TTUBE
#include <TTree.h> // ROOT_TTree
#include <TBrowser.h> // ROOT_TBrowser
#include <TVirtualMC.h> // ROOT_TVirtualMC
////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
-#include <TGeometry.h>
#include <TShape.h>
#include <TMath.h>
///////////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
#include <TMath.h>
-#include <TNode.h>
#include <TObjArray.h>
#include <TRandom.h>
-#include <TTUBE.h>
#include <TVector.h>
#include <TVirtualMC.h>
-#include <TGeometry.h>
#include <TGeoManager.h>
#include "AliMagF.h"
/* $Id$ */
-#include <TGeometry.h>
#include <TGeoManager.h>
-#include <TNode.h>
#include <TLorentzVector.h>
#include <TClonesArray.h>
-#include <TBRIK.h>
#include <TGeoMatrix.h>
#include <TVirtualMC.h>
#include "Riostream.h"
#include <AliPDG.h>
-#include <TBRIK.h>
#include <TCanvas.h>
#include <TDirectory.h>
#include <TFile.h>
-#include <TGeometry.h>
#include <TMinuit.h>
-#include <TNode.h>
#include <TNtuple.h>
#include <TObjArray.h>
#include <TObject.h>
#include <TROOT.h>
#include <TRandom.h>
#include <TRotMatrix.h>
-#include <TTUBE.h>
-#include <TTUBE.h>
#include <TTree.h>
#include <TVector.h>
#include <TVirtualMC.h>
// --- ROOT system ---
-#include "TBRIK.h"
-#include "TNode.h"
#include "TRandom.h"
#include "TTree.h"
// --- ROOT system ---
-#include <TBRIK.h>
#include <TFolder.h>
#include <TGeometry.h>
-#include <TNode.h>
#include <TROOT.h>
#include <TRandom.h>
-#include <TTRD1.h>
#include <TTree.h>
#include <TVirtualMC.h>
#include <TGeoPhysicalNode.h>
// --- ROOT system ---
-#include <TBRIK.h>
#include <TGeometry.h>
-#include <TNode.h>
#include <TParticle.h>
#include "TClonesArray.h"
#include <TVirtualMC.h>
+++ /dev/null
-#ifndef __MAKECINT__
- #ifndef __CINT__
-#include <TROOT.h>
-#include <TRint.h>
-#include <TMath.h>
-#include <TRandom.h>
-#include <TVector.h>
-#include <TMatrix.h>
-#include <TGeometry.h>
-#include <TNode.h>
-#include <TTUBS.h>
-#include <TObjectTable.h>
-#include <iostream.h>
-#include <fstream.h>
-#include <TFile.h>
-#include <TStyle.h>
-#include <TCanvas.h>
-#include <TPad.h>
-#include <TLine.h>
-#include <TText.h>
-#include <TTree.h>
-#include <TBranch.h>
-#include "AliModule.h"
-#include "AliRunLoader.h"
-#include "AliHeader.h"
-#include "AliDetector.h"
-#include "AliConfig.h"
-#include "AliRun.h"
-#include "AliRunLoader.h"
-#include <TParticle.h>
-#include "TBranchClones.h"
-#include "TBranchElement.h"
-
-#include "PHOS/AliPHOSClusterizerv1.h"
-#include "PHOS/AliPHOSDigitizer.h"
-#include "PHOS/AliPHOSSDigitizer.h"
-#include "PHOS/AliPHOSTrackSegmentMakerv1.h"
-#include "PHOS/AliPHOSPIDv1.h"
-
- #endif
-#endif
-
-void ConvertPHOSToNewIO(const char* name = "galice.root", TString branch ="Event" )
-{
-// AliLoader::SetDebug();
- AliConfig* conf = AliConfig::Instance();
- TClass* detclass = AliDetector::Class();
- void * pbuf[100];
- TBranch* branches[100];
- Int_t nbranches = 0;
-// AliLoader::SetDebug(5);
- AliRunLoader* rl = AliRunLoader::Open("galiceNewIO.root",branch,"recreate");
- rl->SetCompressionLevel(2);
- rl->SetNumberOfEventsPerFile(1000);
-
- AliRun* outAliRun;
-
- if (gAlice == 0x0)
- {
- outAliRun = new AliRun("OutgAlice","Output gAlice");
- }
- else
- {
- outAliRun = gAlice;
- }
- gAlice = 0x0;
-
- outAliRun->SetRunLoader(rl);
- TString fSdig = "PHOS.SDigits."+branch+".root";
- TString fDig = "PHOS.Digits."+branch+".root";
- TString fRec = "PHOS.RecData."+branch+".root";
-
- TFile* insdfile = TFile::Open(fSdig);
- TFile* indigfile = TFile::Open(fDig);
- TFile* inrecfile = TFile::Open(fRec);
- TFile* infile = TFile::Open(name);
-
- if (infile == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not open input file %s",name);
- return;
- }
-
- AliRun* inAliRun = (AliRun*)infile->Get("gAlice");
-
- if(inAliRun == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not find gAlice in input file");
- return;
- }
- gAlice = inAliRun;
-
- TObjArray* modules = inAliRun->Modules();
- if (modules == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not get array with modules from AliRun");
- return;
- }
- TIter next(modules);
- AliModule* module;
- while ((module = (AliModule*)next()))
- {
- outAliRun->AddModule(module);
-
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
- if (det)
- {
- ////::Info("ConvertToNewIO.C"," Adding %s to RL.",det->GetName());
- conf->Add(det,branch);
- rl->AddLoader(det);
- }
- }
-
- TParticle* particleBuffer = new TParticle();
- /***************************************************/
- /**** Event to Event **************/
- /***************************************************/
-
- TTree* treeE = (TTree*)infile->Get("TE");
-
- if (treeE == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not get TreeE from AliRun");
- return;
- }
- rl->MakeTree("E");
-
- AliHeader* inheader = new AliHeader();
- treeE->SetBranchAddress("Header",&inheader);
-
- Int_t nevents = (Int_t)treeE->GetEntries();
- for (Int_t i = 0; i<nevents; i++)
- {
- ::Info("ConvertToNewIO.C","Converting Event %d.",i);
- rl->SetEventNumber(i);
- treeE->GetEvent(i);
- /*****************************************/
- /* H E A D E R */
- /*****************************************/
-
- ////::Info("ConvertToNewIO.C","Copying Header");
- AliHeader* outheader = rl->GetHeader();
-
- outheader->SetEvent(inheader->GetEvent());
- outheader->SetNvertex(inheader->GetNvertex());
- outheader->SetNprimary(inheader->GetNprimary());
- outheader->SetNtrack(inheader->GetNtrack());
- outheader->SetRun(inheader->GetRun());
- outheader->SetEventNrInRun(inheader->GetEventNrInRun());
- outheader->SetStack(inheader->Stack());
- outheader->SetGenEventHeader(inheader->GenEventHeader());
- rl->TreeE()->Fill();
- rl->SetNumberOfEventsPerFile(1000);
- /*****************************************/
- /* K I N E M A T I C S */
- /*****************************************/
- ////::Info("ConvertToNewIO.C","Copying Kinematics.");
- TString treeKname("TreeK");
- treeKname+=i;
- TTree* treeK = (TTree*)infile->Get(treeKname);
- if (treeK)
- {
- if (treeK->GetEntries() > 0)
- {
- //I do this gimnastics to set directory correctly, without changing NewIO code
- //only for this purpose
- rl->SetNumberOfEventsPerFile(1000);
- rl->LoadKinematics("update");
- rl->MakeTree("K");
- rl->GetEventFolder()->Remove(rl->TreeK());
- delete rl->TreeK();
-
- treeK->SetBranchAddress("Particles",&particleBuffer);
- ////::Info("ConvertToNewIO.C","Cloning TreeK ...");
- TTree* tk = treeK->CloneTree();
- ////::Info("ConvertToNewIO.C","Cloning TreeK ... Done");
- tk->SetName(AliRunLoader::fgkKineContainerName);
- rl->GetEventFolder()->Add(tk);
- rl->WriteKinematics("OVERWRITE");
- rl->UnloadKinematics();
- }
- else
- {
- Info("ConvertToNewIO.C","Kinematics Tree is Empty");
- }
- }
- else
- {
- Error("ConvertToNewIO.C","Could not find Kinematics tree named %s",treeKname.Data());
- }
- delete treeK;
- /*****************************************/
- /* T R A C K R E F E R E N C E S */
- /*****************************************/
- ////::Info("ConvertToNewIO.C","Copying Track Refs.");
- TString treeTRname("TreeTR");
- treeTRname+=i;
- TTree* treeTR = (TTree*)infile->Get(treeTRname);
- if (treeTR)
- {
- if (treeTR->GetEntries() > 0)
- {
- next.Reset();
- while ((module = (AliModule*)next()))
- {
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
- if (det)
- {
- TClonesArray* trbuffer = new TClonesArray("AliTrackReference", 100);
- treeTR->SetBranchAddress(det->GetName(),&trbuffer);
- }
- }
-
- //I do this gimnastics to set directory correctly, without changing NewIO code
- //only for this purpose
- rl->SetNumberOfEventsPerFile(1000);
- rl->LoadTrackRefs("update");
- rl->MakeTrackRefsContainer();
- rl->GetEventFolder()->Remove(rl->TreeTR());
- delete rl->TreeTR();
-
- ////::Info("ConvertToNewIO.C","Cloning TreeTR ...");
- TTree* tr = treeTR->CloneTree();
- ////::Info("ConvertToNewIO.C","Cloning TreeTR ... Done");
-
- tr->SetName(AliRunLoader::fgkTrackRefsContainerName);
- rl->GetEventFolder()->Add(tr);
- rl->WriteTrackRefs("OVERWRITE");
- rl->UnloadTrackRefs();
- }
- else
- {
- Info("ConvertToNewIO.C","Track References Tree is Empty");
- }
- }
- else
- {
- Error("ConvertToNewIO.C","Could not find Track Refs tree named %s",treeTRname.Data());
- }
- delete treeTR;
-
- /*****************************************/
- /* H I T S */
- /*****************************************/
- ////::Info("ConvertToNewIO.C","Copying Hits.");
- TString treeHname("TreeH");
- treeHname+=i;
- TTree* treeH = (TTree*)infile->Get(treeHname);
-
- if (treeH)
- {
- if (treeH->GetEntries() > 0)
- {
- TObjArray* lob = treeH->GetListOfBranches();
- TObjArray* loaders = new TObjArray();
- TIter nextnewmodule(outAliRun->Modules());
-
- while ((module = (AliModule*)nextnewmodule()))
- {
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
- //TClonesArray* ca = 0;
- if (det)
- {
- AliLoader* loader = det->GetLoader();
- if (loader == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName());
- continue;
- }
-
- TString mask(det->GetName());
-
- loader->LoadHits("update");
- loader->MakeTree("H");
- loaders->Add(loader);
- for(Int_t b=0; b<lob->GetEntries();b++)
- {
- TBranch* branch = (TBranch*)lob->At(b);
- TString bname(branch->GetName());//
- if ( bname.BeginsWith(det->GetName()) )
- {
- ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName());
- ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName());
- TString contname(branch->GetClassName());
-
- Int_t splitlvl = branch->GetSplitLevel();
- // if (splitlvl) splitlvl = 99;
-
- if( contname.CompareTo("TClonesArray") == 0)
- {
- TBranchElement* belem = (TBranchElement*)branch;
- //::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName());
-
- TClonesArray *ca = new TClonesArray(belem->GetClonesName());
- pbuf[nbranches] = ca;
-
- branch->SetAddress(&(pbuf[nbranches]));
- //::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]);
-
- //::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl);
- branches[nbranches] = loader->TreeH()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- else
- {
- //::Info("ConvertToNewIO.C","Class Nmme is %s",branch->GetClassName());
- TClass* bcl = gROOT->GetClass(branch->GetClassName());
- if (bcl == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not get TClass object of class named %s",branch->GetClassName());
- continue;
- }
- pbuf[nbranches] = bcl->New();
- //::Info("ConvertToNewIO.C","Dumping buffer:");
- //((TObject*)pbuf[nbranches])->Dump();
- //::Info("ConvertToNewIO.C","Setting Adress:");
- branch->SetAddress(&(pbuf[nbranches]));
- //::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl);
- branches[nbranches] =loader->TreeH()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- }
- }//loop over branches
- }//if module is detector
- }//while loop over modules
- Int_t nentr = (Int_t)treeH->GetEntries();
- //::Info("ConvertToNewIO.C","Copying Hits . Number of entries %d ... ",nentr);
-
-
- Int_t nl = loaders->GetEntries();
- for (Int_t e = 0; e < nentr; e++)
- {
- //printf("%d\n",e);
- treeH->GetEntry(e);
-
- for (Int_t l = 0; l < nbranches; l++)
- {
- //printf("Branch %d addr %#x\n",l,pbuf[l]);
- //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]);
- branches[l]->SetAddress(&(pbuf[l]));
- }
-
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- //printf("Filling %s\n",loader->GetName());
- loader->TreeH()->Fill();
- }
- #ifndef __MAKECINT__
- #ifndef __CINT__
- fflush(0);
- #endif
- #endif
- }
- ////printf("\n");
-
- ////::Info("ConvertToNewIO.C","Copying Hits ... Done");
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- loader->WriteHits("OVERWRITE");
- loader->UnloadHits();
- }
- delete loaders;
- for (Int_t l = 0; l < nbranches; l++)
- {
- delete (TObject*)pbuf[l];
- }
- nbranches = 0;
- }
- else //tree has any entries
- {
- Info("ConvertToNewIO.C","Hits Tree is Empty");
- }
- }
- else //treeH
- {
- ::Warning("ConvertToNewIO.C","Could not get TreeH from in AliRun.");
- }
- delete treeH;
-
- /*****************************************/
- /* S D i g i t s */
- /*****************************************/
- //::Info("ConvertToNewIO.C","Copying S Digits.\n\n\n");
- TString treeSname("TreeS");
- treeSname+=i;
-
- TTree* treeS = (TTree*)insdfile->Get(treeSname);
- if (treeS)
- {
- TObjArray* lob = treeS->GetListOfBranches();
- TObjArray* loaders = new TObjArray();
- TIter nextnewmodule(outAliRun->Modules());
-
- while ((module = (AliModule*)nextnewmodule()))
- {
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
- //TClonesArray* ca = 0;
- if (det)
- {
- AliLoader* loader = det->GetLoader();
- if (loader == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName());
- continue;
- }
-
- TString mask(det->GetName());
-
- loader->LoadSDigits("update");
- loader->MakeTree("S");
- loaders->Add(loader);
- for(Int_t b=0; b<lob->GetEntries();b++)
- {
- TBranch* branch = (TBranch*)lob->At(b);
-
- TString bname(branch->GetName());//
- if ( bname.BeginsWith(det->GetName()) )
- {
-
- ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName());
- ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName());
- TString contname(branch->GetClassName());
-
- Int_t splitlvl = branch->GetSplitLevel();
- // if (splitlvl) splitlvl = 99;
-
- if ( contname.CompareTo("TClonesArray") == 0)
- {
- TBranchElement* belem = (TBranchElement*)branch;
- //::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName());
-
- TClonesArray * ca = new TClonesArray(belem->GetClonesName());
- pbuf[nbranches] = ca;
-
- branch->SetAddress(&(pbuf[nbranches]));
- //::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]);
-
- //::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl);
- branches[nbranches] = loader->TreeS()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- else
- {
- TClass* bcl = gROOT->GetClass(branch->GetClassName());
- pbuf[nbranches] = bcl->New();
- //::Info("ConvertToNewIO.C","Dumping buffer:");
- //((TObject*)pbuf[nbranches])->Dump();
- //::Info("ConvertToNewIO.C","Setting Adress:");
- branch->SetAddress(&(pbuf[nbranches]));
- //::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl);
- branches[nbranches] =loader->TreeS()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- }
- }//loop over branches
- }//if module is detector
- }//while loop over modules
- TBranch* bbb = treeS->GetBranch("PHOS");
- Int_t nentr = (Int_t)bbb->GetEntries();
- ////::Info("ConvertToNewIO.C","Copying SDigits. Number of entries in PHSO branch %d ... ",nentr);
-
- Int_t nl = loaders->GetEntries();
- for (Int_t e = 0; e < nentr; e++)
- {
- ////printf("%d\r",e);
-// treeS->GetEntry(e);
- bbb->GetEntry(e);
-
- for (Int_t l = 0; l < nbranches; l++)
- {
-// //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]);
- branches[l]->SetAddress(&(pbuf[l]));
- }
-
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
-// //printf("Filling %s\n",loader->GetName());
- loader->TreeS()->Fill();
- }
- #ifndef __MAKECINT__
- #ifndef __CINT__
- fflush(0);
- #endif
- #endif
- }
- ////printf("\n");
-
- ////::Info("ConvertToNewIO.C","Copying SDigits ... Done");
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- loader->WriteSDigits("OVERWRITE");
- loader->UnloadSDigits();
- }
- delete loaders;
- for (Int_t l = 0; l < nbranches; l++)
- {
- delete (TObject*)pbuf[l];
- }
- nbranches = 0;
-
- }
- else //treeS
- {
- ::Warning("ConvertToNewIO.C","Could not get TreeS from in AliRun.");
- }
- delete treeS;
-
- /*****************************************/
- /* D i g i t s */
- /*****************************************/
- //::Info("ConvertToNewIO.C","Copying Digits.\n\n\n");
- TString treeDname("TreeD");
- treeDname+=i;
-
- TTree* treeD = (TTree*)indigfile->Get(treeDname);
- if (treeD)
- {
- TObjArray* lob = treeD->GetListOfBranches();
- TObjArray* loaders = new TObjArray();
- TIter nextnewmodule(outAliRun->Modules());
-
- while ((module = (AliModule*)nextnewmodule()))
- {
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
- //TClonesArray* ca = 0;
- if (det)
- {
- AliLoader* loader = det->GetLoader();
- if (loader == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName());
- continue;
- }
-
- TString mask(det->GetName());
-
- loader->LoadDigits("update");
- loader->MakeTree("D");
- loaders->Add(loader);
- for(Int_t b=0; b<lob->GetEntries();b++)
- {
- TBranch* branch = (TBranch*)lob->At(b);
-
- TString bname(branch->GetName());//
- if ( bname.BeginsWith(det->GetName()) )
- {
-
- ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName());
- ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName());
- TString contname(branch->GetClassName());
-
- Int_t splitlvl = branch->GetSplitLevel();
- // if (splitlvl) splitlvl = 99;
-
- if ( contname.CompareTo("TClonesArray") == 0)
- {
- TBranchElement* belem = (TBranchElement*)branch;
- ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName());
-
- TClonesArray * ca = new TClonesArray(belem->GetClonesName());
- pbuf[nbranches] = ca;
-
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]);
-
- ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl);
- branches[nbranches] = loader->TreeD()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- else
- {
- TClass* bcl = gROOT->GetClass(branch->GetClassName());
- pbuf[nbranches] = bcl->New();
- ////::Info("ConvertToNewIO.C","Dumping buffer:");
- //((TObject*)pbuf[nbranches])->Dump();
- ////::Info("ConvertToNewIO.C","Setting Adress:");
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl);
- branches[nbranches] =loader->TreeD()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- }
- }//loop over branches
- }//if module is detector
- }//while loop over modules
- TBranch* bbb = treeD->GetBranch("PHOS");
- Int_t nentr = (Int_t)bbb->GetEntries();
- ////::Info("ConvertToNewIO.C","Copying Digits. Number of entries %d ... ",nentr);
-
- Int_t nl = loaders->GetEntries();
- for (Int_t e = 0; e < nentr; e++)
- {
- ////printf("%d\r",e);
- //treeD->GetEntry(e);
- bbb->GetEntry(e);
-
- for (Int_t l = 0; l < nbranches; l++)
- {
-// //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]);
- branches[l]->SetAddress(&(pbuf[l]));
- }
-
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
-// //printf("Filling %s\n",loader->GetName());
- loader->TreeD()->Fill();
- }
- #ifndef __MAKECINT__
- #ifndef __CINT__
- fflush(0);
- #endif
- #endif
- }
- ////printf("\n");
-
- ////::Info("ConvertToNewIO.C","Copying Digits ... Done");
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- loader->WriteDigits("OVERWRITE");
- loader->UnloadDigits();
- }
- delete loaders;
- for (Int_t l = 0; l < nbranches; l++)
- {
- delete (TObject*)pbuf[l];
- }
- nbranches = 0;
- }
- else //treeD
- {
- ::Warning("ConvertToNewIO.C","Could not get TreeD from in AliRun.");
- }
- delete treeD;
-
-
- /*****************************************/
- /* R e c P o i n t s */
- /*****************************************/
- ////::Info("ConvertToNewIO.C","Copying RecPoints.");
- TString treeRname("TreeR");
- treeRname+=i;
-
- TTree* treeR = (TTree*)inrecfile->Get(treeRname);
- if (treeR)
- {
- TObjArray* lob = treeR->GetListOfBranches();
- TObjArray* loaders = new TObjArray();
- TIter nextnewmodule(outAliRun->Modules());
-
- while ((module = (AliModule*)nextnewmodule()))
- {
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
-
- if (det)
- {
- AliLoader* loader = det->GetLoader();
- if (loader == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName());
- continue;
- }
-
- TString mask(det->GetName());
-
- loader->LoadRecPoints("update");
- loader->MakeTree("R");
- loaders->Add(loader);
- for(Int_t b=0; b<lob->GetEntries();b++)
- {
- TBranch* branch = (TBranch*)lob->At(b);
-
- TString bname(branch->GetName());//
- if ( bname.Contains(det->GetName()) )
- {
- if(bname.Contains("Emc")||bname.Contains("Cpv"))
- {
- ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName());
- ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName());
- TString contname(branch->GetClassName());
-
- Int_t splitlvl = branch->GetSplitLevel();
- // if (splitlvl) splitlvl = 99;
-
- if ( contname.CompareTo("TClonesArray") == 0)
- {
- TBranchElement* belem = (TBranchElement*)branch;
- ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName());
-
- TClonesArray * ca = new TClonesArray(belem->GetClonesName());
- pbuf[nbranches] = ca;
-
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]);
-
- ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl);
- branches[nbranches] = loader->TreeR()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- else
- {
- TClass* bcl = gROOT->GetClass(branch->GetClassName());
- pbuf[nbranches] = bcl->New();
- ////::Info("ConvertToNewIO.C","Dumping buffer:");
- //((TObject*)pbuf[nbranches])->Dump();
- ////::Info("ConvertToNewIO.C","Setting Adress:");
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl);
- branches[nbranches] =loader->TreeR()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- }
- }
- }//loop over branches
- }//if module is detector
- }//while loop over modules
- TBranch* bbb = treeR->GetBranch("PHOSEmcRP");
- Int_t nentr = (Int_t)bbb->GetEntries();
- ////::Info("ConvertToNewIO.C","Copying RecPoints. Number of entries %d ... ",nentr);
-
-
- //Int_t nl = loaders->GetEntries();
- // //printf(">>>>>>>>>>>>>>>>>>>>%d\n",nl);
- bbb->SetAddress(&(pbuf[0]));
-
- for (Int_t e = 0; e < nentr; e++)
- {
- ////printf("%d\r",e);
-
- bbb->GetEntry(e);
- AliLoader* loader = (AliLoader*)loaders->At(0);
-
- TBranch* bbb = treeR->GetBranch("PHOSCpvRP");
- Int_t nentr = (Int_t)bbb->GetEntries();
- ////::Info("ConvertToNewIO.C","Copying RecPoints. Number of entries %d ... ",nentr);
-
- bbb->SetAddress(&(pbuf[1]));
-
- for (Int_t e = 0; e < nentr; e++)
- {
- // //printf("%d\r",e);
- bbb->GetEntry(e);
- // AliLoader* loader = (AliLoader*)loaders->At(0);
- }
- ////printf("Filling %s\n",loader->GetName());
- loader->TreeR()->Fill();
-
- #ifndef __MAKECINT__
- #ifndef __CINT__
- fflush(0);
- #endif
- #endif
- }
- ////printf("\n");
-
-
- ////::Info("ConvertToNewIO.C","Copying RecPoints ... Done");
- Int_t nl = loaders->GetEntries();
- for (Int_t l = 0; l < nl; l++)
- {
-
- AliLoader* loader = (AliLoader*)loaders->At(l);
- loader->WriteRecPoints("OVERWRITE");
- loader->UnloadRecPoints();
- }
- delete loaders;
- for (Int_t l = 0; l < nbranches; l++)
- {
- delete (TObject*)pbuf[l];//delete branches buffers
- }
- nbranches = 0;
-
- }
- else //treeR
- {
- ::Warning("ConvertToNewIO.C","Could not get TreeR from in AliRun.");
- }
- delete treeR;
-
- /*****************************************/
- /* Track Segments */
- /*****************************************/
- ////::Info("ConvertToNewIO.C","Copying Tracks.");
- TString treeTname("TreeR");
- treeTname+=i;
-
- TTree* treeT = (TTree*)inrecfile->Get(treeTname);
- if (treeT)
- {
- TObjArray* lob = treeT->GetListOfBranches();
- TObjArray* loaders = new TObjArray();
- TIter nextnewmodule(outAliRun->Modules());
-
- while ((module = (AliModule*)nextnewmodule()))
- {
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
- //TClonesArray* ca = 0;
- if (det)
- {
- AliLoader* loader = det->GetLoader();
- if (loader == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName());
- continue;
- }
-
- TString mask(det->GetName());
-
- loader->LoadTracks("update");
- loader->MakeTree("T");
- loaders->Add(loader);
- for(Int_t b=0; b<lob->GetEntries();b++)
- {
- TBranch* branch = (TBranch*)lob->At(b);
-
- TString bname(branch->GetName());//
- if ( bname.Contains(det->GetName()) )
- {
- if(bname.Contains("TS"))
- {
- ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName());
- ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName());
- TString contname(branch->GetClassName());
-
- Int_t splitlvl = branch->GetSplitLevel();
- // if (splitlvl) splitlvl = 99;
-
- if ( contname.CompareTo("TClonesArray") == 0)
- {
- TBranchElement* belem = (TBranchElement*)branch;
- ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName());
-
- TClonesArray * ca = new TClonesArray(belem->GetClonesName());
- pbuf[nbranches] = ca;
-
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]);
-
- ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl);
- branches[nbranches] = loader->TreeT()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- else
- {
- TClass* bcl = gROOT->GetClass(branch->GetClassName());
- pbuf[nbranches] = bcl->New();
- ////::Info("ConvertToNewIO.C","Dumping buffer:");
- //((TObject*)pbuf[nbranches])->Dump();
- ////::Info("ConvertToNewIO.C","Setting Adress:");
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl);
- branches[nbranches] =loader->TreeT()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- }
- }
- }//loop over branches
- }//if module is detector
- }//while loop over modules
- TBranch* bbb = treeT->GetBranch("PHOSTS");
- Int_t nentr = (Int_t)bbb->GetEntries();
- ////::Info("ConvertToNewIO.C","Copying Tracks. Number of entries %d ... ",nentr);
-
-
- Int_t nl = loaders->GetEntries();
- for (Int_t e = 0; e < nentr; e++)
- {
- // //printf("%d\r",e);
- //bbb->GetEntry(e);
- //treeR->GetEntry(e);
-
- for (Int_t l = 0; l < nbranches; l++)
- {
- // //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]);
- branches[l]->SetAddress(&(pbuf[l]));
- }
- bbb->GetEntry(e);
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- ////printf("Filling %s\n",loader->GetName());
- loader->TreeT()->Fill();
- }
-
-
- #ifndef __MAKECINT__
- #ifndef __CINT__
- fflush(0);
- #endif
- #endif
- }
- ////printf("\n");
-
- ////::Info("ConvertToNewIO.C","Copying Tracks ... Done");
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- loader->WriteTracks("OVERWRITE");
- loader->UnloadTracks();
- }
- delete loaders;
- for (Int_t l = 0; l < nbranches; l++)
- {
- delete (TObject*)pbuf[l];//delete branches buffers
- }
- nbranches = 0;
-
- }
- else //treeT
- {
- ::Warning("ConvertToNewIO.C","Could not get TreeR from in AliRun.");
- }
- delete treeT;
-
-
-
-
-
- /*****************************************/
- /* Rec Particles */
- /*****************************************/
- ////::Info("ConvertToNewIO.C","Copying RecParticles.");
- TString treePname("TreeR");
- treePname+=i;
-
- TTree* treeP = (TTree*)inrecfile->Get(treeTname);
- if (treeP)
- {
- TObjArray* lob = treeP->GetListOfBranches();
- TObjArray* loaders = new TObjArray();
- TIter nextnewmodule(outAliRun->Modules());
-
- while ((module = (AliModule*)nextnewmodule()))
- {
- TClass* modclass = module->IsA();
- AliDetector *det = (AliDetector*)(modclass->DynamicCast(detclass,module));
- //TClonesArray* ca = 0;
- if (det)
- {
- AliLoader* loader = det->GetLoader();
- if (loader == 0x0)
- {
- ::Error("ConvertToNewIO.C","Can not find loader from %s.",det->GetName());
- continue;
- }
-
- TString mask(det->GetName());
-
- loader->LoadRecParticles("update");
- loader->MakeTree("P");
- loaders->Add(loader);
- for(Int_t b=0; b<lob->GetEntries();b++)
- {
- TBranch* branch = (TBranch*)lob->At(b);
-
- TString bname(branch->GetName());//
- if ( bname.Contains(det->GetName()) )
- {
- if(bname.Contains("PHOSRP"))
- {
- ////::Info("ConvertToNewIO.C","Found branch %s.",branch->GetName());
- ////::Info("ConvertToNewIO.C","Buffer Class Name %s.",branch->GetClassName());
- TString contname(branch->GetClassName());
-
- Int_t splitlvl = branch->GetSplitLevel();
- // if (splitlvl) splitlvl = 99;
-
- if ( contname.CompareTo("TClonesArray") == 0)
- {
- TBranchElement* belem = (TBranchElement*)branch;
- ////::Info("ConvertToNewIO.C","Clones Class Name %s.",belem->GetClonesName());
-
- TClonesArray * ca = new TClonesArray(belem->GetClonesName());
- pbuf[nbranches] = ca;
-
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Buffer addrss %#x",pbuf[nbranches]);
-
- ////::Info("ConvertToNewIO.C","Creating branch for Clones SpliLvl = %d",splitlvl);
- branches[nbranches] = loader->TreeP()->Branch(branch->GetName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- else
- {
- TClass* bcl = gROOT->GetClass(branch->GetClassName());
- pbuf[nbranches] = bcl->New();
- ////::Info("ConvertToNewIO.C","Dumping buffer:");
- //((TObject*)pbuf[nbranches])->Dump();
- ////::Info("ConvertToNewIO.C","Setting Adress:");
- branch->SetAddress(&(pbuf[nbranches]));
- ////::Info("ConvertToNewIO.C","Creating branch SpliLvl = %d",splitlvl);
- branches[nbranches] =loader->TreeP()->Branch(branch->GetName(),branch->GetClassName(),&(pbuf[nbranches]),4000,splitlvl);
- nbranches++;
- }
- }
- }
- }//loop over branches
- }//if module is detector
- }//while loop over modules
- TBranch* bbb = treeP->GetBranch("PHOSRP");
- Int_t nentr = (Int_t)bbb->GetEntries();
- ////::Info("ConvertToNewIO.C","Copying RecParticles. Number of entries %d ... ",nentr);
-
-
- Int_t nl = loaders->GetEntries();
- for (Int_t e = 0; e < nentr; e++)
- {
- ////printf("%d\r",e);
- bbb->GetEntry(e);
- //treeR->GetEntry(e);
-
- for (Int_t l = 0; l < nbranches; l++)
- {
- // //printf("%s %#x \n", branches[l]->GetName(),pbuf[l]);
- branches[l]->SetAddress(&(pbuf[l]));
- }
-
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- ////printf("Filling %s\n",loader->GetName());
- loader->TreeP()->Fill();
- }
-
-
- #ifndef __MAKECINT__
- #ifndef __CINT__
- fflush(0);
- #endif
- #endif
- }
- ////printf("\n");
-
- ////::Info("ConvertToNewIO.C","Copying RecParticles ... Done");
- for (Int_t l = 0; l < nl; l++)
- {
- AliLoader* loader = (AliLoader*)loaders->At(l);
- loader->WriteRecParticles("OVERWRITE");
- loader->UnloadRecParticles();
- }
- delete loaders;
- for (Int_t l = 0; l < nbranches; l++)
- {
- delete (TObject*)pbuf[l];//delete branches buffers
- }
- nbranches = 0;
-
- }
- else //treeP
- {
- ::Warning("ConvertToNewIO.C","Could not get TreeR from in AliRun.");
- }
- delete treeP;
-
-
-
- }//end of loop over events
- /***************************************************/
- /**** Write Tasks *************/
- /***************************************************/
-
- AliLoader * loader = rl->GetLoader("PHOSLoader");
- /**** S Digits *************/
- TTree * s = (TTree*)insdfile->Get("TreeS0");
- TBranch * bsd = s->GetBranch("AliPHOSSDigitizer");
- AliPHOSSDigitizer * sdig = 0;
- bsd->SetAddress(&sdig);
- bsd->GetEntry(0) ;
- sdig->SetEventFolderName(sdig->GetName()) ;
- sdig->SetName("PHOSSDigitizer");
- sdig->Print() ;
- TFile fsd(loader->GetSDigitsFileName(), "update") ;
- sdig->Write() ;
- fsd.Print() ;
- fsd.Close() ;
- delete s ;
-
- /**** Digits *************/
- TTree * d = (TTree*)indigfile->Get("TreeD0");
- TBranch * bd = d->GetBranch("AliPHOSDigitizer");
- AliPHOSDigitizer * dig = 0 ;
- bd->SetAddress(&dig) ;
- bd->GetEntry(0) ;
- dig->SetEventFolderName(dig->GetName()) ;
- dig->SetName("PHOSDigitizer");
- dig->Print() ;
- //dig->Dump() ;
- ////::Info("Digitizer","Print done");
- TFile fd(loader->GetDigitsFileName(), "update") ;
- dig->Write() ;
- fd.Print() ;
- fd.Close() ;
- delete d;
- /**** Rec Data *************/
- TTree * t = (TTree*)inrecfile->Get("TreeR0");
- /**** Clusterizer *************/
- TBranch * bclu = t->GetBranch("AliPHOSClusterizer");
- AliPHOSClusterizerv1 * clu = 0;
- bclu->SetAddress(&clu);
- bclu->GetEntry(0) ;
- clu->SetEventFolderName(clu->GetName()) ;
- clu->SetName("PHOSReconstructioner");
- clu->Print() ;
- TFile fclu(loader->GetRecPointsFileName(), "update") ;
- clu->Write() ;
- fclu.Print() ;
- fclu.Close() ;
- /**** TrackSegmentMaker *************/
- TBranch * btr = t->GetBranch("AliPHOSTrackSegmentMaker");
- AliPHOSTrackSegmentMakerv1 * tra = 0 ;
- btr->SetAddress(&tra);
- btr->GetEntry(0) ;
- tra->SetEventFolderName(tra->GetName()) ;
- tra->SetName("PHOSTracker");
- tra->Print() ;
- TFile ftr(loader->GetTracksFileName(), "update") ;
- tra->Write() ;
- ftr.Print() ;
- ftr.Close() ;
-
- /**** PID *************/
-
- TBranch * bpid = t->GetBranch("AliPHOSPID");
- AliPHOSPIDv1 * pid = 0 ;
- bpid->SetAddress(&pid);
- bpid->GetEntry(0) ;
- pid->SetEventFolderName(pid->GetName()) ;
- pid->SetName("PHOSPIDTask");
- pid->Print() ;
- TFile fpid(loader->GetRecParticlesFileName(), "update") ;
- pid->Write() ;
- fpid.Print() ;
- fpid.Close() ;
- delete t;
-
-
-
- /***************************************************/
- /**** Run to Run *************/
- /***************************************************/
-
- rl->WriteHeader("OVERWRITE");
-
- infile->cd();
- TGeometry* geo = inAliRun->GetGeometry();
- rl->CdGAFile();
- geo->Write();
-
- rl->WriteAliRun();
- rl->WriteRunLoader();
-
- ////::Info("ConvertToNewIO.C","Done");
-
-}
-
#include "AliRun.h"
#include "TParticle.h"
#include "AliHeader.h"
-#include "TGeometry.h"
#include "TObjArray.h"
#include "TString.h"
#endif
treeENew->Write();
cout<<"done"<<endl;
- cout<<"Copy AliceGeom: ";
- TGeometry *AliceGeom = static_cast<TGeometry*>(fileOrig->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr<<"AliceGeom was not found in the input file "<<fnNew.Data()<<endl;
- return;
- }
- AliceGeom->Write();
- cout<<"done"<<endl;
- }
-
-
if (copyTreeK) {
cout<<"Copy TreeK: ";
TTree *treeK = gAlice->TreeK();
// //
///////////////////////////////////////////////////////////////////////////////
-#include <TBRIK.h>
#include <TClonesArray.h>
-#include <TGeometry.h>
-#include <TNode.h>
#include <TTree.h>
#include <TVirtualMC.h>
//-----------------------------------------------------//
#include <Riostream.h>
-#include <TBRIK.h>
-#include <TNode.h>
#include <TTree.h>
-#include <TGeometry.h>
#include <TObjArray.h>
#include <TClonesArray.h>
#include <TFile.h>
for (Int_t track=0; track<ntracks;track++)
{
- gAlice->ResetHits();
+ gAlice->GetMCApp()->ResetHits();
treeH->GetEvent(track);
if (fPMD)
{
for (Int_t track=0; track<ntracks;track++)
{
- gAlice->ResetHits();
+ gAlice->GetMCApp()->ResetHits();
treeH->GetEvent(track);
if (fPMD)
#include <Riostream.h>
#include <TMath.h>
-#include <TBRIK.h>
-#include <TNode.h>
#include <TTree.h>
-#include <TGeometry.h>
#include <TObjArray.h>
#include <TClonesArray.h>
#include <TFile.h>
#include <Riostream.h>
#include <TMath.h>
-#include <TBRIK.h>
-#include <TNode.h>
#include <TTree.h>
-#include <TGeometry.h>
#include <TObjArray.h>
#include <TClonesArray.h>
#include <TFile.h>
#include <TParticle.h>
#include "AliLog.h"
-//#include "AliPMDcluster.h"
#include "AliPMDrecpoint1.h"
#include "AliPMDclupid.h"
#include "AliPMDDiscriminator.h"
#include <Riostream.h>
#include <TMath.h>
-#include <TBRIK.h>
-#include <TNode.h>
#include <TTree.h>
-#include <TGeometry.h>
#include <TObjArray.h>
#include <TClonesArray.h>
#include <TFile.h>
#include "TParticle.h"
#include "TSystem.h"
#include "TCanvas.h"
-#include "TGeometry.h"
#include "TPolyLine3D.h"
//ALIROOT includes
#include "TParticle.h"
#include "TSystem.h"
#include "TCanvas.h"
-#include "TGeometry.h"
#include "TPolyLine3D.h"
//ALIROOT includes
#include "TF1.h"
#include "TView.h"
#include "TView3D.h"
-#include "TGeometry.h"
#include "TPolyLine3D.h"
#include "TPolyMarker3D.h"
#include "TObjString.h"
// track is returned
//
if(track>=0) {
- gAlice->ResetHits(); //stupid = if N detector this method is called N times
+ gAlice->GetMCApp()->ResetHits(); //stupid = if N detector this method is called N times
fLoader->TreeH()->GetEvent(track); //skowron
}
//
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-
-///////////////////////////////////////////////////////////////////////////
-/*
-
-Origin: marian.ivanov@cern.ch
-
-Macro to generate comples MC information - used for Comparison later on
-How to use it?
-
-.L $ALICE_ROOT/STEER/AliGenInfo.C+
-AliGenInfoMaker *t = new AliGenInfoMaker("galice.root","genTracks.root",0,0)
-t->Exec();
-
-*/
-
-#if !defined(__CINT__) || defined(__MAKECINT__)
-#include <stdio.h>
-#include <string.h>
-//ROOT includes
-#include "Rtypes.h"
-#include "TFile.h"
-#include "TTree.h"
-#include "TChain.h"
-#include "TCut.h"
-#include "TString.h"
-#include "TBenchmark.h"
-#include "TStopwatch.h"
-#include "TParticle.h"
-#include "TSystem.h"
-#include "TTimer.h"
-#include "TVector3.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TCanvas.h"
-#include "TPad.h"
-#include "TF1.h"
-#include "TView.h"
-#include "TGeometry.h"
-#include "TPolyLine3D.h"
-
-//ALIROOT includes
-#include "AliRun.h"
-#include "AliStack.h"
-#include "AliSimDigits.h"
-#include "AliTPCParam.h"
-#include "AliTPC.h"
-#include "AliTPCLoader.h"
-#include "AliDetector.h"
-#include "AliTrackReference.h"
-#include "AliTPCParamSR.h"
-#include "AliTracker.h"
-#include "AliMagF.h"
-#include "AliHelix.h"
-#include "AliMathBase.h"
-
-#endif
-#include "AliGenInfo.h"
-//
-//
-
-AliTPCParam * GetTPCParam(){
- AliTPCParamSR * par = new AliTPCParamSR;
- par->Update();
- return par;
-}
-
-AliPointsMI::AliPointsMI(){
- fN=0;
- fX=0;
- fY=0;
- fZ=0;
- fCapacity = 0;
- fLabel0=0;
- fLabel1=0;
-}
-
-
-AliPointsMI::AliPointsMI(Int_t n, Float_t *x,Float_t *y, Float_t *z){
- //
- //
- fN=n;
- fCapacity = 1000+2*n;
- fX= new Float_t[n];
- fY= new Float_t[n];
- fZ= new Float_t[n];
- memcpy(fX,x,n*sizeof(Float_t));
- memcpy(fY,y,n*sizeof(Float_t));
- memcpy(fZ,z,n*sizeof(Float_t));
- fLabel0=0;
- fLabel1=0;
-}
-
-void AliPointsMI::Reset()
-{
- fN=0;
-}
-
-void AliPointsMI::Reset(AliDetector * det, Int_t particle){
- //
- // write points from detector points
- //
- Reset();
- if (!det) return;
- TObjArray *array = det->Points();
- if (!array) return;
- for (Int_t i=0;i<array->GetEntriesFast();i++){
- AliPoints * points = (AliPoints*) array->At(i);
- if (!points) continue;
- if (points->GetIndex()!=particle) continue;
- Int_t npoints = points->GetN();
- if (npoints<2) continue;
- Int_t delta = npoints/100;
- if (delta<1) delta=1;
- if (delta>10) delta=10;
- Int_t mypoints = npoints/delta;
- //
- fN = mypoints;
- if (fN>fCapacity){
- fCapacity = 1000+2*fN;
- delete []fX;
- delete []fY;
- delete []fZ;
- fX = new Float_t[fCapacity];
- fY = new Float_t[fCapacity];
- fZ = new Float_t[fCapacity];
- }
- Float_t *xyz = points->GetP();
- for (Int_t ipoint=0;ipoint<mypoints;ipoint++){
- Int_t index = 3*ipoint*delta;
- fX[ipoint]=0;
- fY[ipoint]=0;
- fZ[ipoint]=0;
- if (index+2<npoints*3){
- fX[ipoint] = xyz[index];
- fY[ipoint] = xyz[index+1];
- fZ[ipoint] = xyz[index+2];
- }
- }
- }
- fLabel0 = particle;
-}
-
-
-AliPointsMI::~AliPointsMI(){
- fN=0;
- fCapacity =0;
- delete[] fX;
- delete[]fY;
- delete []fZ;
- fX=0;fY=0;fZ=0;
-}
-
-
-
-
-
-////////////////////////////////////////////////////////////////////////
-AliMCInfo::AliMCInfo()
-{
- fTPCReferences = new TClonesArray("AliTrackReference",10);
- fITSReferences = new TClonesArray("AliTrackReference",10);
- fTRDReferences = new TClonesArray("AliTrackReference",10);
- fTOFReferences = new TClonesArray("AliTrackReference",10);
- fTRdecay.SetTrack(-1);
- fCharge = 0;
-}
-
-AliMCInfo::~AliMCInfo()
-{
- if (fTPCReferences) {
- delete fTPCReferences;
- }
- if (fITSReferences){
- delete fITSReferences;
- }
- if (fTRDReferences){
- delete fTRDReferences;
- }
- if (fTOFReferences){
- delete fTOFReferences;
- }
-
-}
-
-
-
-void AliMCInfo::Update()
-{
- //
- //
- fMCtracks =1;
- if (!fTPCReferences) {
- fNTPCRef =0;
- return;
- }
- Float_t direction=1;
- //Float_t rlast=0;
- fNTPCRef = fTPCReferences->GetEntriesFast();
- fNITSRef = fITSReferences->GetEntriesFast();
- fNTRDRef = fTRDReferences->GetEntriesFast();
- fNTOFRef = fTOFReferences->GetEntriesFast();
-
- for (Int_t iref =0;iref<fTPCReferences->GetEntriesFast();iref++){
- AliTrackReference * ref = (AliTrackReference *) fTPCReferences->At(iref);
- //Float_t r = (ref->X()*ref->X()+ref->Y()*ref->Y());
- Float_t newdirection = ref->X()*ref->Px()+ref->Y()*ref->Py(); //inside or outside
- if (iref==0) direction = newdirection;
- if ( newdirection*direction<0){
- //changed direction
- direction = newdirection;
- fMCtracks+=1;
- }
- //rlast=r;
- }
- //
- // decay info
- fTPCdecay=kFALSE;
- if (fTRdecay.GetTrack()>0){
- fDecayCoord[0] = fTRdecay.X();
- fDecayCoord[1] = fTRdecay.Y();
- fDecayCoord[2] = fTRdecay.Z();
- if ( (fTRdecay.R()<250)&&(fTRdecay.R()>85) && (TMath::Abs(fTRdecay.Z())<250) ){
- fTPCdecay=kTRUE;
- }
- else{
- fDecayCoord[0] = 0;
- fDecayCoord[1] = 0;
- fDecayCoord[2] = 0;
- }
- }
- //
- //
- //digits information update
- fRowsWithDigits = fTPCRow.RowsOn();
- fRowsWithDigitsInn = fTPCRow.RowsOn(63); // 63 = number of inner rows
- fRowsTrackLength = fTPCRow.Last() - fTPCRow.First();
- //
- //
- // calculate primary ionization per cm
- if (fParticle.GetPDG()){
- fMass = fParticle.GetMass();
- fCharge = fParticle.GetPDG()->Charge();
- if (fTPCReferences->GetEntriesFast()>0){
- fTrackRef = *((AliTrackReference*)fTPCReferences->At(0));
- }
- if (fMass>0){
- Float_t p = TMath::Sqrt(fTrackRef.Px()*fTrackRef.Px()+
- fTrackRef.Py()*fTrackRef.Py()+
- fTrackRef.Pz()*fTrackRef.Pz());
- if (p>0.001){
- Float_t betagama = p /fMass;
- fPrim = AliMathBase::BetheBlochAleph(betagama);
- }else fPrim=0;
- }
- }else{
- fMass =0;
- fPrim =0;
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////
-/*
-void AliGenV0Info::Update()
-{
- fMCPd[0] = fMCd.fParticle.Px();
- fMCPd[1] = fMCd.fParticle.Py();
- fMCPd[2] = fMCd.fParticle.Pz();
- fMCPd[3] = fMCd.fParticle.P();
- //
- fMCX[0] = fMCd.fParticle.Vx();
- fMCX[1] = fMCd.fParticle.Vy();
- fMCX[2] = fMCd.fParticle.Vz();
- fMCR = TMath::Sqrt( fMCX[0]*fMCX[0]+fMCX[1]*fMCX[1]);
- //
- fPdg[0] = fMCd.fParticle.GetPdgCode();
- fPdg[1] = fMCm.fParticle.GetPdgCode();
- //
- fLab[0] = fMCd.fParticle.GetUniqueID();
- fLab[1] = fMCm.fParticle.GetUniqueID();
- //
-}
-*/
-
-void AliGenV0Info::Update(Float_t vertex[3])
-{
- fMCPd[0] = fMCd.fParticle.Px();
- fMCPd[1] = fMCd.fParticle.Py();
- fMCPd[2] = fMCd.fParticle.Pz();
- fMCPd[3] = fMCd.fParticle.P();
- //
- fMCX[0] = fMCd.fParticle.Vx();
- fMCX[1] = fMCd.fParticle.Vy();
- fMCX[2] = fMCd.fParticle.Vz();
- fMCR = TMath::Sqrt( fMCX[0]*fMCX[0]+fMCX[1]*fMCX[1]);
- //
- fPdg[0] = fMCd.fParticle.GetPdgCode();
- fPdg[1] = fMCm.fParticle.GetPdgCode();
- //
- fLab[0] = fMCd.fParticle.GetUniqueID();
- fLab[1] = fMCm.fParticle.GetUniqueID();
- //
- //
- //
- Double_t x1[3],p1[3];
- TParticle & pdaughter = fMCd.fParticle;
- x1[0] = pdaughter.Vx();
- x1[1] = pdaughter.Vy();
- x1[2] = pdaughter.Vz();
- p1[0] = pdaughter.Px();
- p1[1] = pdaughter.Py();
- p1[2] = pdaughter.Pz();
- Double_t sign = (pdaughter.GetPDG()->Charge()>0)? -1:1;
- AliHelix dhelix1(x1,p1,sign);
- //
- //
- Double_t x2[3],p2[3];
- //
- TParticle & pmother = fMCm.fParticle;
- x2[0] = pmother.Vx();
- x2[1] = pmother.Vy();
- x2[2] = pmother.Vz();
- p2[0] = pmother.Px();
- p2[1] = pmother.Py();
- p2[2] = pmother.Pz();
- //
- //
- sign = (pmother.GetPDG()->Charge()>0) ? -1:1;
- AliHelix mhelix(x2,p2,sign);
-
- //
- //
- //
- //find intersection linear
- //
- Double_t distance1, distance2;
- Double_t phase[2][2],radius[2];
- Int_t points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
- Double_t delta1=10000,delta2=10000;
- if (points>0){
- dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- }
- else{
- fInvMass=-1;
- return;
- }
- if (points==2){
- dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- }
- distance1 = TMath::Min(delta1,delta2);
- //
- //find intersection parabolic
- //
- points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
- delta1=10000,delta2=10000;
-
- if (points>0){
- dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- }
- if (points==2){
- dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- }
-
- distance2 = TMath::Min(delta1,delta2);
- //
- if (delta1<delta2){
- //get V0 info
- dhelix1.Evaluate(phase[0][0],fMCXr);
- dhelix1.GetMomentum(phase[0][0],fMCPdr);
- mhelix.GetMomentum(phase[0][1],fMCPm);
- dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fMCAngle);
- fMCRr = TMath::Sqrt(radius[0]);
- }
- else{
- dhelix1.Evaluate(phase[1][0],fMCXr);
- dhelix1.GetMomentum(phase[1][0],fMCPdr);
- mhelix.GetMomentum(phase[1][1],fMCPm);
- dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fMCAngle);
- fMCRr = TMath::Sqrt(radius[1]);
- }
- //
- //
- fMCDist1 = TMath::Sqrt(distance1);
- fMCDist2 = TMath::Sqrt(distance2);
- //
- //
- //
- Float_t v[3] = {fMCXr[0]-vertex[0],fMCXr[1]-vertex[1],fMCXr[2]-vertex[2]};
- //Float_t v[3] = {fMCXr[0],fMCXr[1],fMCXr[2]};
- Float_t p[3] = {fMCPdr[0]+fMCPm[0], fMCPdr[1]+fMCPm[1],fMCPdr[2]+fMCPm[2]};
- Float_t vnorm2 = v[0]*v[0]+v[1]*v[1];
- Float_t vnorm3 = TMath::Sqrt(v[2]*v[2]+vnorm2);
- vnorm2 = TMath::Sqrt(vnorm2);
- Float_t pnorm2 = p[0]*p[0]+p[1]*p[1];
- Float_t pnorm3 = TMath::Sqrt(p[2]*p[2]+pnorm2);
- pnorm2 = TMath::Sqrt(pnorm2);
- //
- fPointAngleFi = (v[0]*p[0]+v[1]*p[1])/(vnorm2*pnorm2);
- fPointAngleTh = (v[2]*p[2]+vnorm2*pnorm2)/(vnorm3*pnorm3);
- fPointAngle = (v[0]*p[0]+v[1]*p[1]+v[2]*p[2])/(vnorm3*pnorm3);
- Double_t mass1 = fMCd.fMass;
- Double_t mass2 = fMCm.fMass;
-
-
- Double_t e1 = TMath::Sqrt(mass1*mass1+
- fMCPd[0]*fMCPd[0]+
- fMCPd[1]*fMCPd[1]+
- fMCPd[2]*fMCPd[2]);
- Double_t e2 = TMath::Sqrt(mass2*mass2+
- fMCPm[0]*fMCPm[0]+
- fMCPm[1]*fMCPm[1]+
- fMCPm[2]*fMCPm[2]);
-
- fInvMass =
- (fMCPm[0]+fMCPd[0])*(fMCPm[0]+fMCPd[0])+
- (fMCPm[1]+fMCPd[1])*(fMCPm[1]+fMCPd[1])+
- (fMCPm[2]+fMCPd[2])*(fMCPm[2]+fMCPd[2]);
-
- // fInvMass = TMath::Sqrt((e1+e2)*(e1+e2)-fInvMass);
- fInvMass = (e1+e2)*(e1+e2)-fInvMass;
- if (fInvMass>0) fInvMass = TMath::Sqrt(fInvMass);
-
-
-}
-
-
-
-/////////////////////////////////////////////////////////////////////////////////
-void AliGenKinkInfo::Update()
-{
- fMCPd[0] = fMCd.fParticle.Px();
- fMCPd[1] = fMCd.fParticle.Py();
- fMCPd[2] = fMCd.fParticle.Pz();
- fMCPd[3] = fMCd.fParticle.P();
- //
- fMCX[0] = fMCd.fParticle.Vx();
- fMCX[1] = fMCd.fParticle.Vy();
- fMCX[2] = fMCd.fParticle.Vz();
- fMCR = TMath::Sqrt( fMCX[0]*fMCX[0]+fMCX[1]*fMCX[1]);
- //
- fPdg[0] = fMCd.fParticle.GetPdgCode();
- fPdg[1] = fMCm.fParticle.GetPdgCode();
- //
- fLab[0] = fMCd.fParticle.GetUniqueID();
- fLab[1] = fMCm.fParticle.GetUniqueID();
- //
- //
- //
- Double_t x1[3],p1[3];
- TParticle & pdaughter = fMCd.fParticle;
- x1[0] = pdaughter.Vx();
- x1[1] = pdaughter.Vy();
- x1[2] = pdaughter.Vz();
- p1[0] = pdaughter.Px();
- p1[1] = pdaughter.Py();
- p1[2] = pdaughter.Pz();
- Double_t sign = (pdaughter.GetPDG()->Charge()>0)? -1:1;
- AliHelix dhelix1(x1,p1,sign);
- //
- //
- Double_t x2[3],p2[3];
- //
- TParticle & pmother = fMCm.fParticle;
- x2[0] = pmother.Vx();
- x2[1] = pmother.Vy();
- x2[2] = pmother.Vz();
- p2[0] = pmother.Px();
- p2[1] = pmother.Py();
- p2[2] = pmother.Pz();
- //
- AliTrackReference & pdecay = fMCm.fTRdecay;
- x2[0] = pdecay.X();
- x2[1] = pdecay.Y();
- x2[2] = pdecay.Z();
- p2[0] = pdecay.Px();
- p2[1] = pdecay.Py();
- p2[2] = pdecay.Pz();
- //
- sign = (pmother.GetPDG()->Charge()>0) ? -1:1;
- AliHelix mhelix(x2,p2,sign);
-
- //
- //
- //
- //find intersection linear
- //
- Double_t distance1, distance2;
- Double_t phase[2][2],radius[2];
- Int_t points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
- Double_t delta1=10000,delta2=10000;
- if (points>0){
- dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- }
- if (points==2){
- dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- }
- distance1 = TMath::Min(delta1,delta2);
- //
- //find intersection parabolic
- //
- points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
- delta1=10000,delta2=10000;
-
- if (points>0){
- dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
- }
- if (points==2){
- dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
- }
-
- distance2 = TMath::Min(delta1,delta2);
- //
- if (delta1<delta2){
- //get V0 info
- dhelix1.Evaluate(phase[0][0],fMCXr);
- dhelix1.GetMomentum(phase[0][0],fMCPdr);
- mhelix.GetMomentum(phase[0][1],fMCPm);
- dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fMCAngle);
- fMCRr = TMath::Sqrt(radius[0]);
- }
- else{
- dhelix1.Evaluate(phase[1][0],fMCXr);
- dhelix1.GetMomentum(phase[1][0],fMCPdr);
- mhelix.GetMomentum(phase[1][1],fMCPm);
- dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fMCAngle);
- fMCRr = TMath::Sqrt(radius[1]);
- }
- //
- //
- fMCDist1 = TMath::Sqrt(distance1);
- fMCDist2 = TMath::Sqrt(distance2);
-
-}
-
-
-Float_t AliGenKinkInfo::GetQt(){
- //
- //
- Float_t momentumd = TMath::Sqrt(fMCPd[0]*fMCPd[0]+fMCPd[1]*fMCPd[1]+fMCPd[2]*fMCPd[2]);
- return TMath::Sin(fMCAngle[2])*momentumd;
-}
-
-
-
-
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-//
-// End of implementation of the class AliMCInfo
-//
-////////////////////////////////////////////////////////////////////////
-
-
-
-////////////////////////////////////////////////////////////////////////
-digitRow::digitRow()
-{
- Reset();
-}
-////////////////////////////////////////////////////////////////////////
-digitRow & digitRow::operator=(const digitRow &digOld)
-{
- for (Int_t i = 0; i<kgRowBytes; i++) fDig[i] = digOld.fDig[i];
- return (*this);
-}
-////////////////////////////////////////////////////////////////////////
-void digitRow::SetRow(Int_t row)
-{
- if (row >= 8*kgRowBytes) {
- cerr<<"digitRow::SetRow: index "<<row<<" out of bounds."<<endl;
- return;
- }
- Int_t iC = row/8;
- Int_t iB = row%8;
- SETBIT(fDig[iC],iB);
-}
-
-////////////////////////////////////////////////////////////////////////
-Bool_t digitRow::TestRow(Int_t row)
-{
-//
-// return kTRUE if row is on
-//
- Int_t iC = row/8;
- Int_t iB = row%8;
- return TESTBIT(fDig[iC],iB);
-}
-////////////////////////////////////////////////////////////////////////
-Int_t digitRow::RowsOn(Int_t upto)
-{
-//
-// returns number of rows with a digit
-// count only rows less equal row number upto
-//
- Int_t total = 0;
- for (Int_t i = 0; i<kgRowBytes; i++) {
- for (Int_t j = 0; j < 8; j++) {
- if (i*8+j > upto) return total;
- if (TESTBIT(fDig[i],j)) total++;
- }
- }
- return total;
-}
-////////////////////////////////////////////////////////////////////////
-void digitRow::Reset()
-{
-//
-// resets all rows to zero
-//
- for (Int_t i = 0; i<kgRowBytes; i++) {
- fDig[i] <<= 8;
- }
-}
-////////////////////////////////////////////////////////////////////////
-Int_t digitRow::Last()
-{
-//
-// returns the last row number with a digit
-// returns -1 if now digits
-//
- for (Int_t i = kgRowBytes-1; i>=0; i--) {
- for (Int_t j = 7; j >= 0; j--) {
- if TESTBIT(fDig[i],j) return i*8+j;
- }
- }
- return -1;
-}
-////////////////////////////////////////////////////////////////////////
-Int_t digitRow::First()
-{
-//
-// returns the first row number with a digit
-// returns -1 if now digits
-//
- for (Int_t i = 0; i<kgRowBytes; i++) {
- for (Int_t j = 0; j < 8; j++) {
- if (TESTBIT(fDig[i],j)) return i*8+j;
- }
- }
- return -1;
-}
-
-////////////////////////////////////////////////////////////////////////
-//
-// end of implementation of a class digitRow
-//
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-AliGenInfoMaker::AliGenInfoMaker()
-{
- Reset();
-}
-
-////////////////////////////////////////////////////////////////////////
-AliGenInfoMaker::AliGenInfoMaker(const char * fnGalice, const char* fnRes,
- Int_t nEvents, Int_t firstEvent)
-{
- Reset();
- fFirstEventNr = firstEvent;
- fEventNr = firstEvent;
- fNEvents = nEvents;
- // fFnRes = fnRes;
- sprintf(fFnRes,"%s",fnRes);
- //
- fLoader = AliRunLoader::Open(fnGalice);
- if (gAlice){
- delete AliRunLoader::GetRunLoader();
- delete gAlice;
- gAlice = 0x0;
- }
- if (fLoader->LoadgAlice()){
- cerr<<"Error occured while l"<<endl;
- }
- Int_t nall = fLoader->GetNumberOfEvents();
- if (nEvents==0) {
- nEvents =nall;
- fNEvents=nall;
- fFirstEventNr=0;
- }
-
- if (nall<=0){
- cerr<<"no events available"<<endl;
- fEventNr = 0;
- return;
- }
- if (firstEvent+nEvents>nall) {
- fEventNr = nall-firstEvent;
- cerr<<"restricted number of events availaible"<<endl;
- }
- AliMagF * magf = gAlice->Field();
- AliTracker::SetFieldMap(magf,0);
-}
-
-
-AliMCInfo * AliGenInfoMaker::MakeInfo(UInt_t i)
-{
- //
- if (i<fNParticles) {
- if (fGenInfo[i]) return fGenInfo[i];
- fGenInfo[i] = new AliMCInfo;
- fNInfos++;
- return fGenInfo[i];
- }
- else
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////
-void AliGenInfoMaker::Reset()
-{
- fEventNr = 0;
- fNEvents = 0;
- fTreeGenTracks = 0;
- fFileGenTracks = 0;
- fGenInfo = 0;
- fNInfos = 0;
- //
- //
- fDebug = 0;
- fVPrim[0] = -1000.;
- fVPrim[1] = -1000.;
- fVPrim[2] = -1000.;
- fParamTPC = 0;
-}
-////////////////////////////////////////////////////////////////////////
-AliGenInfoMaker::~AliGenInfoMaker()
-{
-
- if (fLoader){
- fLoader->UnloadgAlice();
- gAlice = 0;
- delete fLoader;
- }
-}
-
-Int_t AliGenInfoMaker::SetIO()
-{
- //
- //
- CreateTreeGenTracks();
- if (!fTreeGenTracks) return 1;
- // AliTracker::SetFieldFactor();
-
- fParamTPC = GetTPCParam();
- //
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::SetIO(Int_t eventNr)
-{
- //
- //
- // SET INPUT
- fLoader->SetEventNumber(eventNr);
- //
- fLoader->LoadHeader();
- fLoader->LoadKinematics();
- fStack = fLoader->Stack();
- //
- fLoader->LoadTrackRefs();
- fLoader->LoadHits();
- fTreeTR = fLoader->TreeTR();
- //
- AliTPCLoader * tpcl = (AliTPCLoader*)fLoader->GetLoader("TPCLoader");
- tpcl->LoadDigits();
- fTreeD = tpcl->TreeD();
- return 0;
-}
-
-Int_t AliGenInfoMaker::CloseIOEvent()
-{
- fLoader->UnloadHeader();
- fLoader->UnloadKinematics();
- fLoader->UnloadTrackRefs();
- AliTPCLoader * tpcl = (AliTPCLoader*)fLoader->GetLoader("TPCLoader");
- tpcl->UnloadDigits();
- return 0;
-}
-
-Int_t AliGenInfoMaker::CloseIO()
-{
- fLoader->UnloadgAlice();
- return 0;
-}
-
-
-
-////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::Exec(Int_t nEvents, Int_t firstEventNr)
-{
- fNEvents = nEvents;
- fFirstEventNr = firstEventNr;
- return Exec();
-}
-
-////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::Exec()
-{
- TStopwatch timer;
- timer.Start();
- Int_t status =SetIO();
- if (status>0) return status;
- //
-
- for (fEventNr = fFirstEventNr; fEventNr < fFirstEventNr+fNEvents;
- fEventNr++) {
- SetIO(fEventNr);
- fNParticles = fStack->GetNtrack();
- //
- fGenInfo = new AliMCInfo*[fNParticles];
- for (UInt_t i = 0; i<fNParticles; i++) {
- fGenInfo[i]=0;
- }
- //
- cout<<"Start to process event "<<fEventNr<<endl;
- cout<<"\tfNParticles = "<<fNParticles<<endl;
- if (fDebug>2) cout<<"\n\n\n\tStart loop over TreeTR"<<endl;
- if (TreeTRLoop()>0) return 1;
- //
- if (fDebug>2) cout<<"\n\n\n\tStart loop over TreeD"<<endl;
- if (TreeDLoop()>0) return 1;
- //
- if (fDebug>2) cout<<"\n\n\n\tStart loop over TreeK"<<endl;
- if (TreeKLoop()>0) return 1;
- if (fDebug>2) cout<<"\tEnd loop over TreeK"<<endl;
- //
- if (BuildKinkInfo()>0) return 1;
- if (BuildV0Info()>0) return 1;
- //if (BuildHitLines()>0) return 1;
- if (fDebug>2) cout<<"\tEnd loop over TreeK"<<endl;
- //
- for (UInt_t i = 0; i<fNParticles; i++) {
- if (fGenInfo[i]) delete fGenInfo[i];
- }
- delete []fGenInfo;
- CloseIOEvent();
- }
- //
- CloseIO();
- CloseOutputFile();
-
- cerr<<"Exec finished"<<endl;
-
- timer.Stop();
- timer.Print();
- return 0;
-}
-////////////////////////////////////////////////////////////////////////
-void AliGenInfoMaker::CreateTreeGenTracks()
-{
- fFileGenTracks = TFile::Open(fFnRes,"RECREATE");
- if (!fFileGenTracks) {
- cerr<<"Error in CreateTreeGenTracks: cannot open file "<<fFnRes<<endl;
- return;
- }
- fTreeGenTracks = new TTree("genTracksTree","genTracksTree");
- AliMCInfo * info = new AliMCInfo;
- fTreeGenTracks->Branch("MC","AliMCInfo",&info);
- delete info;
- //
- AliGenKinkInfo *kinkinfo = new AliGenKinkInfo;
- fTreeKinks = new TTree("genKinksTree","genKinksTree");
- fTreeKinks->Branch("MC","AliGenKinkInfo",&kinkinfo);
- delete kinkinfo;
- //
- AliGenV0Info *v0info = new AliGenV0Info;
- fTreeV0 = new TTree("genV0Tree","genV0Tree");
- fTreeV0->Branch("MC","AliGenV0Info",&v0info);
- delete v0info;
- //
- //
- AliPointsMI * points0 = new AliPointsMI;
- AliPointsMI * points1 = new AliPointsMI;
- AliPointsMI * points2 = new AliPointsMI;
- fTreeHitLines = new TTree("HitLines","HitLines");
- fTreeHitLines->Branch("TPC.","AliPointsMI",&points0,32000,10);
- fTreeHitLines->Branch("TRD.","AliPointsMI",&points1,32000,10);
- fTreeHitLines->Branch("ITS.","AliPointsMI",&points2,32000,10);
- Int_t label=0;
- fTreeHitLines->Branch("Label",&label,"label/I");
- //
- fTreeGenTracks->AutoSave();
- fTreeKinks->AutoSave();
- fTreeV0->AutoSave();
- fTreeHitLines->AutoSave();
-}
-////////////////////////////////////////////////////////////////////////
-void AliGenInfoMaker::CloseOutputFile()
-{
- if (!fFileGenTracks) {
- cerr<<"File "<<fFnRes<<" not found as an open file."<<endl;
- return;
- }
- fFileGenTracks->cd();
- fTreeGenTracks->Write();
- delete fTreeGenTracks;
- fTreeKinks->Write();
- delete fTreeKinks;
- fTreeV0->Write();
- delete fTreeV0;
-
- fFileGenTracks->Close();
- delete fFileGenTracks;
- return;
-}
-
-////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::TreeKLoop()
-{
-//
-// open the file with treeK
-// loop over all entries there and save information about some tracks
-//
-
- AliStack * stack = fStack;
- if (!stack) {cerr<<"Stack was not found!\n"; return 1;}
-
- if (fDebug > 0) {
- cout<<"There are "<<fNParticles<<" primary and secondary particles in event "
- <<fEventNr<<endl;
- }
- Int_t ipdg = 0;
- TParticlePDG *ppdg = 0;
- // not all generators give primary vertex position. Take the vertex
- // of the particle 0 as primary vertex.
- TDatabasePDG pdg; //get pdg table
- //thank you very much root for this
- TBranch * br = fTreeGenTracks->GetBranch("MC");
- TParticle *particle = stack->ParticleFromTreeK(0);
- fVPrim[0] = particle->Vx();
- fVPrim[1] = particle->Vy();
- fVPrim[2] = particle->Vz();
- for (UInt_t iParticle = 0; iParticle < fNParticles; iParticle++) {
- // load only particles with TR
- AliMCInfo * info = GetInfo(iParticle);
- if (!info) continue;
- //////////////////////////////////////////////////////////////////////
- info->fLabel = iParticle;
- //
- info->fParticle = *(stack->Particle(iParticle));
- info->fVDist[0] = info->fParticle.Vx()-fVPrim[0];
- info->fVDist[1] = info->fParticle.Vy()-fVPrim[1];
- info->fVDist[2] = info->fParticle.Vz()-fVPrim[2];
- info->fVDist[3] = TMath::Sqrt(info->fVDist[0]*info->fVDist[0]+
- info->fVDist[1]*info->fVDist[1]+info->fVDist[2]*info->fVDist[2]);
- //
- //
- ipdg = info->fParticle.GetPdgCode();
- info->fPdg = ipdg;
- ppdg = pdg.GetParticle(ipdg);
- info->fEventNr = fEventNr;
- info->Update();
- //////////////////////////////////////////////////////////////////////
- br->SetAddress(&info);
- fTreeGenTracks->Fill();
- }
- fTreeGenTracks->AutoSave();
- if (fDebug > 2) cerr<<"end of TreeKLoop"<<endl;
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::BuildKinkInfo()
-{
- //
- // Build tree with Kink Information
- //
- AliStack * stack = fStack;
- if (!stack) {cerr<<"Stack was not found!\n"; return 1;}
-
- if (fDebug > 0) {
- cout<<"There are "<<fNParticles<<" primary and secondary particles in event "
- <<fEventNr<<endl;
- }
- // Int_t ipdg = 0;
- //TParticlePDG *ppdg = 0;
- // not all generators give primary vertex position. Take the vertex
- // of the particle 0 as primary vertex.
- TDatabasePDG pdg; //get pdg table
- //thank you very much root for this
- TBranch * br = fTreeKinks->GetBranch("MC");
- //
- AliGenKinkInfo * kinkinfo = new AliGenKinkInfo;
- //
- for (UInt_t iParticle = 0; iParticle < fNParticles; iParticle++) {
- // load only particles with TR
- AliMCInfo * info = GetInfo(iParticle);
- if (!info) continue;
- if (info->fCharge==0) continue;
- if (info->fTRdecay.P()<0.13) continue; //momenta cut
- if (info->fTRdecay.R()>500) continue; //R cut - decay outside barrel
- TParticle & particle = info->fParticle;
- Int_t first = particle.GetDaughter(0);
- if (first ==0) continue;
-
- Int_t last = particle.GetDaughter(1);
- if (last ==0) last=first;
- AliMCInfo * info2 = 0;
- AliMCInfo * dinfo = 0;
-
- for (Int_t id2=first;id2<=last;id2++){
- info2 = GetInfo(id2);
- if (!info2) continue;
- TParticle &p2 = info2->fParticle;
- Double_t r = TMath::Sqrt(p2.Vx()*p2.Vx()+p2.Vy()*p2.Vy());
- if ( TMath::Abs(info->fTRdecay.R()-r)>0.01) continue;
- if (!(p2.GetPDG())) continue;
- dinfo =info2;
-
- kinkinfo->fMCm = (*info);
- kinkinfo->fMCd = (*dinfo);
- if (kinkinfo->fMCm.fParticle.GetPDG()==0 || kinkinfo->fMCd.fParticle.GetPDG()==0) continue;
- kinkinfo->Update();
- br->SetAddress(&kinkinfo);
- fTreeKinks->Fill();
- }
- /*
- if (dinfo){
- kinkinfo->fMCm = (*info);
- kinkinfo->fMCd = (*dinfo);
- kinkinfo->Update();
- br->SetAddress(&kinkinfo);
- fTreeKinks->Fill();
- }
- */
- }
- fTreeGenTracks->AutoSave();
- if (fDebug > 2) cerr<<"end of Kink Loop"<<endl;
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::BuildV0Info()
-{
- //
- // Build tree with V0 Information
- //
- AliStack * stack = fStack;
- if (!stack) {cerr<<"Stack was not found!\n"; return 1;}
-
- if (fDebug > 0) {
- cout<<"There are "<<fNParticles<<" primary and secondary particles in event "
- <<fEventNr<<endl;
- }
- // Int_t ipdg = 0;
- //TParticlePDG *ppdg = 0;
- // not all generators give primary vertex position. Take the vertex
- // of the particle 0 as primary vertex.
- TDatabasePDG pdg; //get pdg table
- //thank you very much root for this
- TBranch * br = fTreeV0->GetBranch("MC");
- //
- AliGenV0Info * v0info = new AliGenV0Info;
- //
- //
- for (UInt_t iParticle = 0; iParticle < fNParticles; iParticle++) {
- // load only particles with TR
- AliMCInfo * info = GetInfo(iParticle);
- if (!info) continue;
- if (info->fCharge==0) continue;
- //
- //
- TParticle & particle = info->fParticle;
- Int_t mother = particle.GetMother(0);
- if (mother <=0) continue;
- //
- TParticle * motherparticle = stack->Particle(mother);
- if (!motherparticle) continue;
- //
- Int_t last = motherparticle->GetDaughter(1);
- if (last==(int)iParticle) continue;
- AliMCInfo * info2 = info;
- AliMCInfo * dinfo = GetInfo(last);
- if (!dinfo) continue;
- if (!dinfo->fParticle.GetPDG()) continue;
- if (!info2->fParticle.GetPDG()) continue;
- if (dinfo){
- v0info->fMCm = (*info);
- v0info->fMCd = (*dinfo);
- v0info->fMotherP = (*motherparticle);
- v0info->Update(fVPrim);
- br->SetAddress(&v0info);
- fTreeV0->Fill();
- }
- }
- fTreeV0->AutoSave();
- if (fDebug > 2) cerr<<"end of V0 Loop"<<endl;
- return 0;
-}
-
-
-
-
-////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::BuildHitLines()
-{
-
-//
-// open the file with treeK
-// loop over all entries there and save information about some tracks
-//
-
- AliStack * stack = fStack;
- if (!stack) {cerr<<"Stack was not found!\n"; return 1;}
-
- if (fDebug > 0) {
- cout<<"There are "<<fNParticles<<" primary and secondary particles in event "
- <<fEventNr<<endl;
- }
- Int_t ipdg = 0;
- // TParticlePDG *ppdg = 0;
- // not all generators give primary vertex position. Take the vertex
- // of the particle 0 as primary vertex.
- TDatabasePDG pdg; //get pdg table
- //thank you very much root for this
- AliPointsMI *tpcp = new AliPointsMI;
- AliPointsMI *trdp = new AliPointsMI;
- AliPointsMI *itsp = new AliPointsMI;
- Int_t label =0;
- //
- TBranch * brtpc = fTreeHitLines->GetBranch("TPC.");
- TBranch * brtrd = fTreeHitLines->GetBranch("TRD.");
- TBranch * brits = fTreeHitLines->GetBranch("ITS.");
- TBranch * brlabel = fTreeHitLines->GetBranch("Label");
- brlabel->SetAddress(&label);
- brtpc->SetAddress(&tpcp);
- brtrd->SetAddress(&trdp);
- brits->SetAddress(&itsp);
- //
- AliDetector *dtpc = gAlice->GetDetector("TPC");
- AliDetector *dtrd = gAlice->GetDetector("TRD");
- AliDetector *dits = gAlice->GetDetector("ITS");
-
- for (UInt_t iParticle = 0; iParticle < fNParticles; iParticle++) {
- // load only particles with TR
- AliMCInfo * info = GetInfo(iParticle);
- if (!info) continue;
- Int_t primpart = info->fPrimPart;
- ipdg = info->fParticle.GetPdgCode();
- label = iParticle;
- //
- gAlice->ResetHits();
- tpcp->Reset();
- itsp->Reset();
- trdp->Reset();
- tpcp->fLabel1 = ipdg;
- trdp->fLabel1 = ipdg;
- itsp->fLabel1 = ipdg;
- if (dtpc->TreeH()->GetEvent(primpart)){
- dtpc->LoadPoints(primpart);
- tpcp->Reset(dtpc,iParticle);
- }
- if (dtrd->TreeH()->GetEvent(primpart)){
- dtrd->LoadPoints(primpart);
- trdp->Reset(dtrd,iParticle);
- }
- if (dits->TreeH()->GetEvent(primpart)){
- dits->LoadPoints(primpart);
- itsp->Reset(dits,iParticle);
- }
- //
- fTreeHitLines->Fill();
- dtpc->ResetPoints();
- dtrd->ResetPoints();
- dits->ResetPoints();
- }
- delete tpcp;
- delete trdp;
- delete itsp;
- fTreeHitLines->AutoSave();
- if (fDebug > 2) cerr<<"end of TreeKLoop"<<endl;
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::TreeDLoop()
-{
- //
- // open the file with treeD
- // loop over all entries there and save information about some tracks
- //
-
- Int_t nInnerSector = fParamTPC->GetNInnerSector();
- Int_t rowShift = 0;
- Int_t zero=fParamTPC->GetZeroSup()+6;
- //
- //
- AliSimDigits digitsAddress, *digits=&digitsAddress;
- fTreeD->GetBranch("Segment")->SetAddress(&digits);
-
- Int_t sectorsByRows=(Int_t)fTreeD->GetEntries();
- if (fDebug > 1) cout<<"\tsectorsByRows = "<<sectorsByRows<<endl;
- for (Int_t i=0; i<sectorsByRows; i++) {
- if (!fTreeD->GetEvent(i)) continue;
- Int_t sec,row;
- fParamTPC->AdjustSectorRow(digits->GetID(),sec,row);
- if (fDebug > 1) cout<<sec<<' '<<row<<" \r";
- // here I expect that upper sectors follow lower sectors
- if (sec > nInnerSector) rowShift = fParamTPC->GetNRowLow();
- //
- digits->ExpandTrackBuffer();
- digits->First();
- do {
- Int_t iRow=digits->CurrentRow();
- Int_t iColumn=digits->CurrentColumn();
- Short_t digitValue = digits->CurrentDigit();
- if (digitValue >= zero) {
- Int_t label;
- for (Int_t j = 0; j<3; j++) {
- // label = digits->GetTrackID(iRow,iColumn,j);
- label = digits->GetTrackIDFast(iRow,iColumn,j)-2;
- if (label >= (Int_t)fNParticles) { //don't label from bakground event
- continue;
- }
- if (label >= 0 && label <= (Int_t)fNParticles) {
- if (fDebug > 6 ) {
- cout<<"Inner loop: sector, iRow, iColumn, label, value, row "
- <<sec<<" "
- <<iRow<<" "<<iColumn<<" "<<label<<" "<<digitValue
- <<" "<<row<<endl;
- }
- AliMCInfo * info = GetInfo(label);
- if (info){
- info->fTPCRow.SetRow(row+rowShift);
- }
- }
- }
- }
- } while (digits->Next());
- }
-
- if (fDebug > 2) cerr<<"end of TreeDLoop"<<endl;
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-Int_t AliGenInfoMaker::TreeTRLoop()
-{
- //
- // loop over TrackReferences and store the first one for each track
- //
- TTree * treeTR = fTreeTR;
- Int_t nPrimaries = (Int_t) treeTR->GetEntries();
- if (fDebug > 1) cout<<"There are "<<nPrimaries<<" entries in TreeTR"<<endl;
- //
- //
- //track references for TPC
- TClonesArray* TPCArrayTR = new TClonesArray("AliTrackReference");
- TClonesArray* ITSArrayTR = new TClonesArray("AliTrackReference");
- TClonesArray* TRDArrayTR = new TClonesArray("AliTrackReference");
- TClonesArray* TOFArrayTR = new TClonesArray("AliTrackReference");
- TClonesArray* RunArrayTR = new TClonesArray("AliTrackReference");
- //
- if (treeTR->GetBranch("TPC")) treeTR->GetBranch("TPC")->SetAddress(&TPCArrayTR);
- if (treeTR->GetBranch("ITS")) treeTR->GetBranch("ITS")->SetAddress(&ITSArrayTR);
- if (treeTR->GetBranch("TRD")) treeTR->GetBranch("TRD")->SetAddress(&TRDArrayTR);
- if (treeTR->GetBranch("TOF")) treeTR->GetBranch("TOF")->SetAddress(&TOFArrayTR);
- if (treeTR->GetBranch("AliRun")) treeTR->GetBranch("AliRun")->SetAddress(&RunArrayTR);
- //
- //
- //
- for (Int_t iPrimPart = 0; iPrimPart<nPrimaries; iPrimPart++) {
- treeTR->GetEntry(iPrimPart);
- //
- // Loop over TPC references
- //
- for (Int_t iTrackRef = 0; iTrackRef < TPCArrayTR->GetEntriesFast(); iTrackRef++) {
- AliTrackReference *trackRef = (AliTrackReference*)TPCArrayTR->At(iTrackRef);
- //
- if (trackRef->TestBit(BIT(2))){
- //if decay
- if (trackRef->P()<fgTPCPtCut) continue;
- Int_t label = trackRef->GetTrack();
- AliMCInfo * info = GetInfo(label);
- if (!info) info = MakeInfo(label);
- info->fTRdecay = *trackRef;
- }
- //
- if (trackRef->P()<fgTPCPtCut) continue;
- Int_t label = trackRef->GetTrack();
- AliMCInfo * info = GetInfo(label);
- if (!info) info = MakeInfo(label);
- if (!info) continue;
- info->fPrimPart = iPrimPart;
- TClonesArray & arr = *(info->fTPCReferences);
- new (arr[arr.GetEntriesFast()]) AliTrackReference(*trackRef);
- }
- //
- // Loop over ITS references
- //
- for (Int_t iTrackRef = 0; iTrackRef < ITSArrayTR->GetEntriesFast(); iTrackRef++) {
- AliTrackReference *trackRef = (AliTrackReference*)ITSArrayTR->At(iTrackRef);
- //
- //
- if (trackRef->P()<fgTPCPtCut) continue;
- Int_t label = trackRef->GetTrack();
- AliMCInfo * info = GetInfo(label);
- if ( (!info) && trackRef->Pt()<fgITSPtCut) continue;
- if (!info) info = MakeInfo(label);
- if (!info) continue;
- info->fPrimPart = iPrimPart;
- TClonesArray & arr = *(info->fITSReferences);
- new (arr[arr.GetEntriesFast()]) AliTrackReference(*trackRef);
- }
- //
- // Loop over TRD references
- //
- for (Int_t iTrackRef = 0; iTrackRef < TRDArrayTR->GetEntriesFast(); iTrackRef++) {
- AliTrackReference *trackRef = (AliTrackReference*)TRDArrayTR->At(iTrackRef);
- //
- if (trackRef->P()<fgTPCPtCut) continue;
- Int_t label = trackRef->GetTrack();
- AliMCInfo * info = GetInfo(label);
- if ( (!info) && trackRef->Pt()<fgTRDPtCut) continue;
- if (!info) info = MakeInfo(label);
- if (!info) continue;
- info->fPrimPart = iPrimPart;
- TClonesArray & arr = *(info->fTRDReferences);
- new (arr[arr.GetEntriesFast()]) AliTrackReference(*trackRef);
- }
- //
- // Loop over TOF references
- //
- for (Int_t iTrackRef = 0; iTrackRef < TOFArrayTR->GetEntriesFast(); iTrackRef++) {
- AliTrackReference *trackRef = (AliTrackReference*)TOFArrayTR->At(iTrackRef);
- Int_t label = trackRef->GetTrack();
- AliMCInfo * info = GetInfo(label);
- if (!info){
- if (trackRef->Pt()<fgTPCPtCut) continue;
- if ( (!info) && trackRef->Pt()<fgTOFPtCut) continue;
- }
- if (!info) info = MakeInfo(label);
- if (!info) continue;
- info->fPrimPart = iPrimPart;
- TClonesArray & arr = *(info->fTOFReferences);
- new (arr[arr.GetEntriesFast()]) AliTrackReference(*trackRef);
- }
- //
- // get dacay position
- for (Int_t iTrackRef = 0; iTrackRef < RunArrayTR->GetEntriesFast(); iTrackRef++) {
- AliTrackReference *trackRef = (AliTrackReference*)RunArrayTR->At(iTrackRef);
- //
- Int_t label = trackRef->GetTrack();
- AliMCInfo * info = GetInfo(label);
- if (!info) continue;
- if (!trackRef->TestBit(BIT(2))) continue; //if not decay
- // if (TMath::Abs(trackRef.X());
- info->fTRdecay = *trackRef;
- }
- }
- //
- TPCArrayTR->Delete();
- delete TPCArrayTR;
- TRDArrayTR->Delete();
- delete TRDArrayTR;
- TOFArrayTR->Delete();
- delete TOFArrayTR;
-
- ITSArrayTR->Delete();
- delete ITSArrayTR;
- RunArrayTR->Delete();
- delete RunArrayTR;
- //
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////
-Float_t AliGenInfoMaker::TR2LocalX(AliTrackReference *trackRef,
- AliTPCParam *paramTPC) {
-
- Float_t x[3] = { trackRef->X(),trackRef->Y(),trackRef->Z()};
- Int_t index[4];
- paramTPC->Transform0to1(x,index);
- paramTPC->Transform1to2(x,index);
- return x[0];
-}
-////////////////////////////////////////////////////////////////////////
-
-
-
-TH1F * AliComparisonDraw::DrawXY(const char * chx, const char *chy, const char* selection,
- const char * quality, Int_t nbins, Float_t minx, Float_t maxx, Float_t miny, Float_t maxy, Int_t nBinsRes)
-{
- //
- Double_t* bins = CreateLogBins(nbins, minx, maxx);
- TH2F* hRes2 = new TH2F("hRes2", "residuals", nbins, minx, maxx, nBinsRes, miny, maxy);
- char cut[1000];
- sprintf(cut,"%s&&%s",selection,quality);
- char expression[1000];
- sprintf(expression,"%s:%s>>hRes2",chy,chx);
- fTree->Draw(expression, cut, "groff");
- TH1F* hMean=0;
- TH1F* hRes = CreateResHisto(hRes2, &hMean);
- AliLabelAxes(hRes, chx, chy);
- //
- delete hRes2;
- delete[] bins;
- fRes = hRes;
- fMean = hMean;
- return hRes;
-}
-
-TH1F * AliComparisonDraw::DrawLogXY(const char * chx, const char *chy, const char* selection,
- const char * quality, Int_t nbins, Float_t minx, Float_t maxx, Float_t miny, Float_t maxy, Int_t nBinsRes)
-{
- //
- Double_t* bins = CreateLogBins(nbins, minx, maxx);
- TH2F* hRes2 = new TH2F("hRes2", "residuals", nbins, bins, nBinsRes, miny, maxy);
- char cut[1000];
- sprintf(cut,"%s&&%s",selection,quality);
- char expression[1000];
- sprintf(expression,"%s:%s>>hRes2",chy,chx);
- fTree->Draw(expression, cut, "groff");
- TH1F* hMean=0;
- TH1F* hRes = CreateResHisto(hRes2, &hMean);
- AliLabelAxes(hRes, chx, chy);
- //
- delete hRes2;
- delete[] bins;
- fRes = hRes;
- fMean = hMean;
- return hRes;
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////
-TH1F * AliComparisonDraw::Eff(const char *variable, const char* selection, const char * quality,
- Int_t nbins, Float_t min, Float_t max)
-{
- //
- //
- TH1F* hGen = new TH1F("hGen", "gen. tracks", nbins, min, max);
- TH1F* hRec = new TH1F("hRec", "rec. tracks", nbins, min, max);
- char inputGen[1000];
- sprintf(inputGen,"%s>>hGen", variable);
- fTree->Draw(inputGen, selection, "groff");
- char selectionRec[256];
- sprintf(selectionRec, "%s && %s", selection, quality);
- char inputRec[1000];
- sprintf(inputRec,"%s>>hRec", variable);
- fTree->Draw(inputRec, selectionRec, "groff");
- //
- TH1F* hEff = CreateEffHisto(hGen, hRec);
- AliLabelAxes(hEff, variable, "#epsilon [%]");
- fRes = hEff;
- delete hRec;
- delete hGen;
- return hEff;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////
-TH1F * AliComparisonDraw::EffLog(const char *variable, const char* selection, const char * quality,
- Int_t nbins, Float_t min, Float_t max)
-{
- //
- //
- Double_t* bins = CreateLogBins(nbins, min, max);
- TH1F* hGen = new TH1F("hGen", "gen. tracks", nbins, bins);
- TH1F* hRec = new TH1F("hRec", "rec. tracks", nbins, bins);
- char inputGen[1000];
- sprintf(inputGen,"%s>>hGen", variable);
- fTree->Draw(inputGen, selection, "groff");
- char selectionRec[256];
- sprintf(selectionRec, "%s && %s", selection, quality);
- char inputRec[1000];
- sprintf(inputRec,"%s>>hRec", variable);
- fTree->Draw(inputRec, selectionRec, "groff");
- //
- TH1F* hEff = CreateEffHisto(hGen, hRec);
- AliLabelAxes(hEff, variable, "#epsilon [%]");
- fRes = hEff;
- delete hRec;
- delete hGen;
- delete[] bins;
- return hEff;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////
-
-Double_t* AliComparisonDraw::CreateLogBins(Int_t nBins, Double_t xMin, Double_t xMax)
-{
- Double_t* bins = new Double_t[nBins+1];
- bins[0] = xMin;
- Double_t factor = pow(xMax/xMin, 1./nBins);
- for (Int_t i = 1; i <= nBins; i++)
- bins[i] = factor * bins[i-1];
- return bins;
-}
-
-
-
-
-void AliComparisonDraw::AliLabelAxes(TH1* histo, const char* xAxisTitle, const char* yAxisTitle)
-{
- //
- histo->GetXaxis()->SetTitle(xAxisTitle);
- histo->GetYaxis()->SetTitle(yAxisTitle);
-}
-
-
-TH1F* AliComparisonDraw::CreateEffHisto(TH1F* hGen, TH1F* hRec)
-{
- //
- Int_t nBins = hGen->GetNbinsX();
- TH1F* hEff = (TH1F*) hGen->Clone("hEff");
- hEff->SetTitle("");
- hEff->SetStats(kFALSE);
- hEff->SetMinimum(0.);
- hEff->SetMaximum(110.);
- //
- for (Int_t iBin = 0; iBin <= nBins; iBin++) {
- Double_t nGen = hGen->GetBinContent(iBin);
- Double_t nRec = hRec->GetBinContent(iBin);
- if (nGen > 0) {
- Double_t eff = nRec/nGen;
- hEff->SetBinContent(iBin, 100. * eff);
- Double_t error = sqrt((eff*(1.-eff)+0.01) / nGen);
- // if (error == 0) error = sqrt(0.1/nGen);
- //
- if (error == 0) error = 0.0001;
- hEff->SetBinError(iBin, 100. * error);
- } else {
- hEff->SetBinContent(iBin, 100. * 0.5);
- hEff->SetBinError(iBin, 100. * 0.5);
- }
- }
- return hEff;
-}
-
-
-
-TH1F* AliComparisonDraw::CreateResHisto(TH2F* hRes2, TH1F **phMean, Bool_t drawBinFits,
- Bool_t overflowBinFits)
-{
- TVirtualPad* currentPad = gPad;
- TAxis* axis = hRes2->GetXaxis();
- Int_t nBins = axis->GetNbins();
- TH1F* hRes, *hMean;
- if (axis->GetXbins()->GetSize()){
- hRes = new TH1F("hRes", "", nBins, axis->GetXbins()->GetArray());
- hMean = new TH1F("hMean", "", nBins, axis->GetXbins()->GetArray());
- }
- else{
- hRes = new TH1F("hRes", "", nBins, axis->GetXmin(), axis->GetXmax());
- hMean = new TH1F("hMean", "", nBins, axis->GetXmin(), axis->GetXmax());
-
- }
- hRes->SetStats(false);
- hRes->SetOption("E");
- hRes->SetMinimum(0.);
- //
- hMean->SetStats(false);
- hMean->SetOption("E");
-
- // create the fit function
- //TKFitGaus* fitFunc = new TKFitGaus("resFunc");
- // TF1 * fitFunc = new TF1("G","[3]+[0]*exp(-(x-[1])*(x-[1])/(2.*[2]*[2]))",-3,3);
- TF1 * fitFunc = new TF1("G","[0]*exp(-(x-[1])*(x-[1])/(2.*[2]*[2]))",-3,3);
-
- fitFunc->SetLineWidth(2);
- fitFunc->SetFillStyle(0);
- // create canvas for fits
- TCanvas* canBinFits = NULL;
- Int_t nPads = (overflowBinFits) ? nBins+2 : nBins;
- Int_t nx = Int_t(sqrt(nPads-1.));// + 1;
- Int_t ny = (nPads-1) / nx + 1;
- if (drawBinFits) {
- canBinFits = (TCanvas*)gROOT->FindObject("canBinFits");
- if (canBinFits) delete canBinFits;
- canBinFits = new TCanvas("canBinFits", "fits of bins", 200, 100, 500, 700);
- canBinFits->Divide(nx, ny);
- }
-
- // loop over x bins and fit projection
- Int_t dBin = ((overflowBinFits) ? 1 : 0);
- for (Int_t bin = 1-dBin; bin <= nBins+dBin; bin++) {
- if (drawBinFits) canBinFits->cd(bin + dBin);
- TH1D* hBin = hRes2->ProjectionY("hBin", bin, bin);
- //
- if (hBin->GetEntries() > 5) {
- fitFunc->SetParameters(hBin->GetMaximum(),hBin->GetMean(),hBin->GetRMS());
- hBin->Fit(fitFunc,"s");
- Double_t sigma = TMath::Abs(fitFunc->GetParameter(2));
-
- if (sigma > 0.){
- hRes->SetBinContent(bin, TMath::Abs(fitFunc->GetParameter(2)));
- hMean->SetBinContent(bin, fitFunc->GetParameter(1));
- }
- else{
- hRes->SetBinContent(bin, 0.);
- hMean->SetBinContent(bin,0);
- }
- hRes->SetBinError(bin, fitFunc->GetParError(2));
- hMean->SetBinError(bin, fitFunc->GetParError(1));
-
- //
- //
-
- } else {
- hRes->SetBinContent(bin, 0.);
- hRes->SetBinError(bin, 0.);
- hMean->SetBinContent(bin, 0.);
- hMean->SetBinError(bin, 0.);
- }
-
-
- if (drawBinFits) {
- char name[256];
- if (bin == 0) {
- sprintf(name, "%s < %.4g", axis->GetTitle(), axis->GetBinUpEdge(bin));
- } else if (bin == nBins+1) {
- sprintf(name, "%.4g < %s", axis->GetBinLowEdge(bin), axis->GetTitle());
- } else {
- sprintf(name, "%.4g < %s < %.4g", axis->GetBinLowEdge(bin),
- axis->GetTitle(), axis->GetBinUpEdge(bin));
- }
- canBinFits->cd(bin + dBin);
- hBin->SetTitle(name);
- hBin->SetStats(kTRUE);
- hBin->DrawCopy("E");
- canBinFits->Update();
- canBinFits->Modified();
- canBinFits->Update();
- }
-
- delete hBin;
- }
-
- delete fitFunc;
- currentPad->cd();
- *phMean = hMean;
- return hRes;
-}
-
-
-void AliComparisonDraw::DrawFriend2D(const char * chx, const char *chy, const char* selection, TTree * tfriend)
-{
-
-}
-
-
-void AliComparisonDraw::GetPoints3D(const char * label, const char * chpoints, const char* selection, TTree * tpoints, Int_t color,Float_t rmin){
- //
- //
- if (!fPoints) fPoints = new TObjArray;
- if (tpoints->GetIndex()==0) tpoints->BuildIndex("Label","Label");
- AliPointsMI * points = new AliPointsMI;
- TBranch * br = tpoints->GetBranch(chpoints);
- br->SetAddress(&points);
- Int_t npoints = fTree->Draw(label,selection);
- Float_t xyz[30000];
- rmin*=rmin;
- for (Int_t i=0;i<npoints;i++){
- Int_t index = (Int_t)fTree->GetV1()[i];
- tpoints->GetEntryWithIndex(index,index);
- if (points->fN<2) continue;
- Int_t goodpoints=0;
- for (Int_t i=0;i<points->fN; i++){
- xyz[goodpoints*3] = points->fX[i];
- xyz[goodpoints*3+1] = points->fY[i];
- xyz[goodpoints*3+2] = points->fZ[i];
- if ( points->fX[i]*points->fX[i]+points->fY[i]*points->fY[i]>rmin) goodpoints++;
- }
- TPolyMarker3D * marker = new TPolyMarker3D(goodpoints,xyz);
- // marker->SeWidth(1);
- marker->SetMarkerColor(color);
- marker->SetMarkerStyle(1);
- fPoints->AddLast(marker);
- }
-}
-
-void AliComparisonDraw::Draw3D(Int_t min, Int_t max){
- if (!fPoints) return;
- Int_t npoints = fPoints->GetEntriesFast();
- max = TMath::Min(npoints,max);
- min = TMath::Min(npoints,min);
-
- for (Int_t i =min; i<max;i++){
- TObject * obj = fPoints->At(i);
- if (obj) obj->Draw();
- }
-}
-
-void AliComparisonDraw:: SavePoints(const char* name)
-{
- char fname[25];
- sprintf(fname,"TH_%s.root",name);
- TFile f(fname,"new");
- fPoints->Write("Tracks",TObject::kSingleKey);
- f.Close();
- sprintf(fname,"TH%s.gif",name);
- fCanvas->SaveAs(fname);
-}
-
-void AliComparisonDraw::InitView(){
- //
- //
- AliRunLoader* rl = AliRunLoader::Open();
- rl->GetEvent(0);
- rl->CdGAFile();
- //
- fCanvas = new TCanvas("cdisplay", "Cluster display",0,0,700,730);
- fView = new TView(1);
- fView->SetRange(-330,-360,-330, 360,360, 330);
- fCanvas->Clear();
- fCanvas->SetFillColor(1);
- fCanvas->SetTheta(90.);
- fCanvas->SetPhi(0.);
- //
- TGeometry *geom =(TGeometry*)gDirectory->Get("AliceGeom");
- geom->Draw("same");
-
-}
// Federico.Carminati@cern.ch
#include <RVersion.h>
-#include <TBrowser.h>
+#include <TArrayI.h>
#include <TClonesArray.h>
+#include <TFile.h>
#include <TGeoManager.h>
+#include <TParticle.h>
+#include <TROOT.h>
#include <TStopwatch.h>
#include <TSystem.h>
#include <TVirtualMC.h>
-#include <TParticle.h>
-#include <TROOT.h>
-#include <TFile.h>
-#include "AliLog.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
#include "AliDetector.h"
#include "AliGenerator.h"
+#include "AliGeomManager.h"
#include "AliHeader.h"
+#include "AliHit.h"
#include "AliLego.h"
+#include "AliLog.h"
#include "AliMC.h"
+#include "AliMagF.h"
#include "AliRun.h"
-#include "AliHit.h"
+#include "AliSimulation.h"
#include "AliStack.h"
-#include "AliMagF.h"
#include "AliTrackReference.h"
-#include "AliSimulation.h"
-#include "AliGeomManager.h"
-#include "AliCDBManager.h"
-#include "AliCDBStorage.h"
-#include "AliCDBEntry.h"
-
ClassImp(AliMC)
SetAllAlignableVolumes();
}
// Misalign geometry via AliSimulation instance
- if (!AliSimulation::GetInstance()) return kFALSE;
+ if (!AliSimulation::Instance()) return kFALSE;
AliGeomManager::SetGeometry(gGeoManager);
if(!AliGeomManager::CheckSymNamesLUT("ALL"))
AliFatal("Current loaded geometry differs in the definition of symbolic names!");
- return AliSimulation::GetInstance()->MisalignGeometry(AliRunLoader::GetRunLoader());
+ return AliSimulation::Instance()->MisalignGeometry(AliRunLoader::GetRunLoader());
}
//_______________________________________________________________________
//
// --- If lego option, do it and leave
- if (gAlice->Lego())
- gAlice->Lego()->StepManager();
+ if (AliSimulation::Instance()->Lego())
+ AliSimulation::Instance()->Lego()->StepManager();
else {
Int_t copy;
//Update energy deposition tables
runloader->MakeStack();//or make a new one
- if(gAlice->Lego() == 0x0)
+ if(AliSimulation::Instance()->Lego() == 0x0)
{
AliDebug(1, "fRunLoader->MakeTree(K)");
runloader->MakeTree("K");
gAlice->GetEventNrInRun());
// fRunLoader->WriteKinematics("OVERWRITE"); is there any reason to rewrite here since MakeTree does so
- if(gAlice->Lego())
+ if(AliSimulation::Instance()->Lego())
{
- gAlice->Lego()->BeginEvent();
+ AliSimulation::Instance()->Lego()->BeginEvent();
return;
}
}
}
+//_______________________________________________________________________
+void AliMC::ResetDigits()
+{
+ //
+ // Reset all Detectors digits
+ //
+ TIter next(gAlice->Modules());
+ AliModule *detector;
+ while((detector = dynamic_cast<AliModule*>(next()))) {
+ detector->ResetDigits();
+ }
+}
+
+//_______________________________________________________________________
+void AliMC::ResetSDigits()
+{
+ //
+ // Reset all Detectors digits
+ //
+ TIter next(gAlice->Modules());
+ AliModule *detector;
+ while((detector = dynamic_cast<AliModule*>(next()))) {
+ detector->ResetSDigits();
+ }
+}
+
//_______________________________________________________________________
void AliMC::PostTrack()
{
//
- if(gAlice->Lego()) gAlice->Lego()->FinishEvent();
+ if(AliSimulation::Instance()->Lego()) AliSimulation::Instance()->Lego()->FinishEvent();
TIter next(gAlice->Modules());
AliModule *detector;
header->SetNtrack(stack->GetNtrack());
// Write out the kinematics
- if (!gAlice->Lego()) stack->FinishEvent();
+ if (!AliSimulation::Instance()->Lego()) stack->FinishEvent();
// Synchronize the TreeTR with TreeK
if (fTmpTreeTR) ReorderAndExpandTreeTR();
AliError("Can not get TreeE from RL");
}
- if(gAlice->Lego() == 0x0)
+ if(AliSimulation::Instance()->Lego() == 0x0)
{
runloader->WriteKinematics("OVERWRITE");
runloader->WriteTrackRefs("OVERWRITE");
}
//_______________________________________________________________________
-void AliMC::PushTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom,
- Float_t *vpos, Float_t *polar, Float_t tof,
+void AliMC::PushTrack(Int_t done, Int_t parent, Int_t pdg, const Float_t *pmom,
+ const Float_t *vpos, const Float_t *polar, Float_t tof,
TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) const
{
// Delegate to stack
#include <TArrayF.h>
#include <TArrayI.h>
-#include <TList.h>
#include <TClonesArray.h>
+#include <TList.h>
#include <TMCProcess.h>
#include <TVirtualMCApplication.h>
void AddEnergyDeposit(Int_t id, Float_t edep)
{fEventEnergy[id]+=edep;}
virtual void ResetHits();
+ virtual void ResetDigits();
+ virtual void ResetSDigits();
virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10)
{fTrRmax=rmax; fTrZmax=zmax;}
virtual void DecayLimits( Float_t rmin = -1., Float_t rmax = -1., Int_t pdg = 0)
const TObjArray* Particles() const;
TParticle *Particle(Int_t i) const;
virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
- Float_t *pmom, Float_t *vpos, Float_t *polar,
+ const Float_t *pmom, const Float_t *vpos, const Float_t *polar,
Float_t tof, TMCProcess mech, Int_t &ntr,
Float_t weight = 1, Int_t is = 0) const;
virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
"ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT", "Global", "CORR"} ;
TString AliQA::fgGRPPath = "GRP/GRP/Data" ;
TString AliQA::fgTaskNames[] = {"Raws", "Hits", "SDigits", "Digits", "RecPoints", "TrackSegments", "RecParticles", "ESDs"} ;
-const TString AliQA::fkgLabLocalFile = "file://" ;
-const TString AliQA::fkgLabLocalOCDB = "local://" ;
-const TString AliQA::fkgLabAliEnOCDB = "alien://" ;
-const TString AliQA::fkgRefFileName = "QA.root" ;
-const TString AliQA::fkgQAName = "QA" ;
-const TString AliQA::fkgQACorrNtName = "CorrQA" ;
-const TString AliQA::fkgRefOCDBDirName = "QA" ;
-TString AliQA::fkgRefDataDirName = "" ;
-const TString AliQA::fkgQARefOCDBDefault = "alien://folder=/alice/QA/20" ;
-const TString AliQA::fkgExpert = "Expert" ;
-const UInt_t AliQA::fkgExpertBit = 16 ;
-const UInt_t AliQA::fkgQABit = 17 ;
+const TString AliQA::fgkLabLocalFile = "file://" ;
+const TString AliQA::fgkLabLocalOCDB = "local://" ;
+const TString AliQA::fgkLabAliEnOCDB = "alien://" ;
+const TString AliQA::fgkRefFileName = "QA.root" ;
+const TString AliQA::fgkQAName = "QA" ;
+const TString AliQA::fgkQACorrNtName = "CorrQA" ;
+const TString AliQA::fgkRefOCDBDirName = "QA" ;
+TString AliQA::fgRefDataDirName = "" ;
+const TString AliQA::fgkQARefOCDBDefault = "alien://folder=/alice/QA/20" ;
+const TString AliQA::fgkExpert = "Expert" ;
+const UInt_t AliQA::fgkExpertBit = 16 ;
+const UInt_t AliQA::fgkQABit = 17 ;
//____________________________________________________________________________
AliQA::AliQA() :
fgQAResultFile = 0x0 ;
// if (!fgQAResultFile) {
TString dirName(fgQAResultDirName) ;
- if ( dirName.Contains(fkgLabLocalFile))
- dirName.ReplaceAll(fkgLabLocalFile, "") ;
+ if ( dirName.Contains(fgkLabLocalFile))
+ dirName.ReplaceAll(fgkLabLocalFile, "") ;
TString fileName(dirName + fgQAResultFileName) ;
TString opt("") ;
if ( !gSystem->AccessPathName(fileName) )
// Set the root directory where the QA reference data are stored
fgQARefDirName = name ;
- if ( fgQARefDirName.Contains(fkgLabLocalFile) )
- fgQARefFileName = fkgRefFileName ;
- else if ( fgQARefDirName.Contains(fkgLabLocalOCDB) )
- fgQARefFileName = fkgQAName ;
- else if ( fgQARefDirName.Contains(fkgLabAliEnOCDB) )
- fgQARefFileName = fkgQAName ;
+ if ( fgQARefDirName.Contains(fgkLabLocalFile) )
+ fgQARefFileName = fgkRefFileName ;
+ else if ( fgQARefDirName.Contains(fgkLabLocalOCDB) )
+ fgQARefFileName = fgkQAName ;
+ else if ( fgQARefDirName.Contains(fgkLabAliEnOCDB) )
+ fgQARefFileName = fgkQAName ;
else {
printf("ERROR: %s is an invalid storage definition\n", name) ;
fgQAResultDirName.Prepend(name) ;
printf("AliQA::SetQAResultDirName: QA results are in %s\n", fgQAResultDirName.Data()) ;
- if ( fgQAResultDirName.Contains(fkgLabLocalFile))
- fgQAResultDirName.ReplaceAll(fkgLabLocalFile, "") ;
+ if ( fgQAResultDirName.Contains(fgkLabLocalFile))
+ fgQAResultDirName.ReplaceAll(fgkLabLocalFile, "") ;
fgQAResultFileName.Prepend(fgQAResultDirName) ;
}
class AliQA : public TNamed {
public:
-
- enum DETECTORINDEX_t {
+
+ enum DETECTORINDEX_t {
kNULLDET=-1, kITS, kTPC, kTRD, kTOF, kPHOS, kHMPID, kEMCAL, kMUON, kFMD,
kZDC, kPMD, kT0, kVZERO, kACORDE, kHLT, kGLOBAL, kCORR, kNDET};
- enum ALITASK_t {
+ enum ALITASK_t {
kNULLTASK=-1, kRAW, kSIM, kREC, kESD, kANA, kNTASK };
- enum QABIT_t {
+ enum QABIT_t {
kNULLBit=-1, kINFO, kWARNING, kERROR, kFATAL, kNBIT };
- enum TASKINDEX_t {
+ enum TASKINDEX_t {
kNULLTASKINDEX=-1, kRAWS, kHITS, kSDIGITS, kDIGITS, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
- // Creators - destructors
- AliQA(); // beware singleton, not to be used
- AliQA(const ALITASK_t tsk) ;
- AliQA(const DETECTORINDEX_t det) ;
- AliQA(const AliQA& qa) ;
- AliQA& operator = (const AliQA& qa) ;
- virtual ~AliQA();
-
- static AliQA * Instance() ;
- static AliQA * Instance(const DETECTORINDEX_t det) ;
- static AliQA * Instance(const ALITASK_t tsk) ;
- static AliQA * Instance(const TASKINDEX_t tsk) ;
- Bool_t CheckFatal() const ;
- static void Close() ;
- static const char * GetAliTaskName(ALITASK_t tsk) ;
- static const TString GetExpert() { return fkgExpert ; }
- static UInt_t GetExpertBit() { return fkgExpertBit ; }
- static const TString GetLabLocalFile() { return fkgLabLocalFile ; }
- static const TString GetLabLocalOCDB() { return fkgLabLocalOCDB ; }
- static const TString GetLabAliEnOCDB() { return fkgLabAliEnOCDB ; }
- static DETECTORINDEX_t GetDetIndex(const char * name) ;
- static const TString GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
- static const char * GetDetName(Int_t det) ;
- static const TString GetGRPPath() { return fgGRPPath ; }
- static UInt_t GetQABit() { return fkgQABit ; }
- static TFile * GetQADataFile(const char * name, Int_t run) ;
- static TFile * GetQADataFile(const char * fileName) ;
- static const char * GetQADataFileName(const char * name, Int_t run)
- {return Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run) ; }
- static const char * GetQADataFileName() { return fgQADataFileName.Data() ; }
- static const char * GetQAName() { return fkgQAName ; }
- static const char * GetQACorrName() { return fkgQACorrNtName ; }
- static TFile * GetQAResultFile() ;
- static const char * GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
- static const char * GetQARefDefaultStorage() { return fkgQARefOCDBDefault.Data() ; }
- static const char * GetQARefFileName() { return fgQARefFileName ; }
- static const char * GetQARefStorage() { return fgQARefDirName.Data() ; }
- static const char * GetRefOCDBDirName() { return fkgRefOCDBDirName.Data() ; }
- static const char * GetRefDataDirName() { return fkgRefDataDirName.Data() ; }
- static TASKINDEX_t GetTaskIndex(const char * name) ;
- static TString GetTaskName(UInt_t tsk) { return fgTaskNames[tsk] ; }
- Bool_t IsEventSpecieSet(AliRecoParam::EventSpecie_t es) const { return fEventSpecies[(Int_t)TMath::Log2(es)] ; }
+ // Creators - destructors
+ AliQA(); // beware singleton, not to be used
+ AliQA(const ALITASK_t tsk) ;
+ AliQA(const DETECTORINDEX_t det) ;
+ AliQA(const AliQA& qa) ;
+ AliQA& operator = (const AliQA& qa) ;
+ virtual ~AliQA();
+
+ static AliQA * Instance() ;
+ static AliQA * Instance(const DETECTORINDEX_t det) ;
+ static AliQA * Instance(const ALITASK_t tsk) ;
+ static AliQA * Instance(const TASKINDEX_t tsk) ;
+ Bool_t CheckFatal() const ;
+ static void Close() ;
+ static const char * GetAliTaskName(ALITASK_t tsk) ;
+ static const TString GetExpert() { return fgkExpert ; }
+ static UInt_t GetExpertBit() { return fgkExpertBit ; }
+ static const TString GetLabLocalFile() { return fgkLabLocalFile ; }
+ static const TString GetLabLocalOCDB() { return fgkLabLocalOCDB ; }
+ static const TString GetLabAliEnOCDB() { return fgkLabAliEnOCDB ; }
+ static DETECTORINDEX_t GetDetIndex(const char * name) ;
+ static const TString GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
+ static const char * GetDetName(Int_t det) ;
+ static const TString GetGRPPath() { return fgGRPPath ; }
+ static UInt_t GetQABit() { return fgkQABit ; }
+ static TFile * GetQADataFile(const char * name, Int_t run) ;
+ static TFile * GetQADataFile(const char * fileName) ;
+ static const char * GetQADataFileName(const char * name, Int_t run)
+ {return Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run) ; }
+ static const char * GetQADataFileName() { return fgQADataFileName.Data() ; }
+ static const char * GetQAName() { return fgkQAName ; }
+ static const char * GetQACorrName() { return fgkQACorrNtName ; }
+ static TFile * GetQAResultFile() ;
+ static const char * GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
+ static const char * GetQARefDefaultStorage() { return fgkQARefOCDBDefault.Data() ; }
+ static const char * GetQARefFileName() { return fgQARefFileName ; }
+ static const char * GetQARefStorage() { return fgQARefDirName.Data() ; }
+ static const char * GetRefOCDBDirName() { return fgkRefOCDBDirName.Data() ; }
+ static const char * GetRefDataDirName() { return fgRefDataDirName.Data() ; }
+ static TASKINDEX_t GetTaskIndex(const char * name) ;
+ static TString GetTaskName(UInt_t tsk) { return fgTaskNames[tsk] ; }
+ Bool_t IsEventSpecieSet(AliRecoParam::EventSpecie_t es) const
+ {Int_t ibit=0; while(es!=1<<ibit) ++ibit; return fEventSpecies[ibit];}
Bool_t IsEventSpecieSet(Int_t es) const { return fEventSpecies[es] ; }
Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) const ;
Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, Int_t es, QABIT_t bit) const ;
Bool_t IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const ;
Bool_t IsSetAny(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const ;
- void Merge(TCollection * list) ;
- void Set(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
- void Set(QABIT_t bit, Int_t es) ;
- void SetEventSpecie(AliRecoParam::EventSpecie_t es) { fEventSpecies[(Int_t)TMath::Log2(es)] = kTRUE ; }
- static void SetQAResultDirName(const char * name) ;
- static void SetQARefStorage(const char * name) ;
- static void SetQARefDataDirName(AliRecoParam::EventSpecie_t es) { fkgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
- static void SetQARefDataDirName(Int_t es) { fkgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
- void Show() const ;
- void Show(DETECTORINDEX_t det) const ;
- void ShowAll() const ;
- void ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault) const ;
- void UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
- void UnSet(QABIT_t bit, Int_t es) ;
-
+ void Merge(TCollection * list) ;
+ void Set(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
+ void Set(QABIT_t bit, Int_t es) ;
+ void SetEventSpecie(AliRecoParam::EventSpecie_t es)
+ {Int_t ibit=0; while(es!=1<<ibit) ++ibit; fEventSpecies[ibit] = kTRUE ; }
+ static void SetQAResultDirName(const char * name) ;
+ static void SetQARefStorage(const char * name) ;
+ static void SetQARefDataDirName(AliRecoParam::EventSpecie_t es) { fgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
+ static void SetQARefDataDirName(Int_t es) { fgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
+ void Show() const ;
+ void Show(DETECTORINDEX_t det) const ;
+ void ShowAll() const ;
+ void ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault) const ;
+ void UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
+ void UnSet(QABIT_t bit, Int_t es) ;
+
private:
-
- Bool_t CheckRange(DETECTORINDEX_t det) const ;
- Bool_t CheckRange(ALITASK_t tsk) const ;
- Bool_t CheckRange(QABIT_t bit) const ;
- Bool_t CheckRange(AliRecoParam::EventSpecie_t es) const ;
- const char * GetBitName(QABIT_t bit) const ;
- ULong_t GetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const { return fQA[det*fNEventSpecies+(Int_t)TMath::Log2(es)] ;}
- void Finish() const ;
- ULong_t Offset(ALITASK_t tsk) const ;
- void ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const ;
- void ResetStatus(DETECTORINDEX_t det) ;
- void Set(DETECTORINDEX_t det) { fDet = det ;}
- void Set(ALITASK_t tsk) { fTask = tsk ; AliDebug(1, Form("Ready to set QA status in %s", GetAliTaskName(tsk) )) ; }
- void SetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es, ULong_t status) { fQA[det*fNEventSpecies+(Int_t)TMath::Log2(es)] = status ; }
- void SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
- void UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
-
- static AliQA * fgQA ; // pointer to the instance of the singleton
- Int_t fNdet ; // number of detectors
- Int_t fNEventSpecies ; // number of Event Species (see AliRecoParam)
- Int_t fLengthQA ; // Auxiliary length of fQA
- ULong_t * fQA ; //[fNdet][fNEventSpecie] the status word 4 bits for SIM, REC, ESD, ANA each
- DETECTORINDEX_t fDet ; //! the current detector (ITS, TPC, ....)
- ALITASK_t fTask ; //! the current environment (SIM, REC, ESD, ANA)
+
+ Bool_t CheckRange(DETECTORINDEX_t det) const ;
+ Bool_t CheckRange(ALITASK_t tsk) const ;
+ Bool_t CheckRange(QABIT_t bit) const ;
+ Bool_t CheckRange(AliRecoParam::EventSpecie_t es) const ;
+ const char * GetBitName(QABIT_t bit) const ;
+ ULong_t GetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const { return fQA[det*fNEventSpecies+(Int_t)TMath::Log2(es)] ;}
+ void Finish() const ;
+ ULong_t Offset(ALITASK_t tsk) const ;
+ void ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const ;
+ void ResetStatus(DETECTORINDEX_t det) ;
+ void Set(DETECTORINDEX_t det) { fDet = det ;}
+ void Set(ALITASK_t tsk) { fTask = tsk ; AliDebug(1, Form("Ready to set QA status in %s", GetAliTaskName(tsk) )) ; }
+ void SetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es, ULong_t status) { fQA[det*fNEventSpecies+(Int_t)TMath::Log2(es)] = status ; }
+ void SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
+ void UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
+
+ static AliQA * fgQA ; // pointer to the instance of the singleton
+ Int_t fNdet ; // number of detectors
+ Int_t fNEventSpecies ; // number of Event Species (see AliRecoParam)
+ Int_t fLengthQA ; // Auxiliary length of fQA
+ ULong_t * fQA ; //[fNdet][fNEventSpecie] the status word 4 bits for SIM, REC, ESD, ANA each
+ DETECTORINDEX_t fDet ; //! the current detector (ITS, TPC, ....)
+ ALITASK_t fTask ; //! the current environment (SIM, REC, ESD, ANA)
AliRecoParam::EventSpecie_t fEventSpecie ; //! the current event specie
- static TString fgDetNames[] ; //! list of detector names
- static TString fgGRPPath ; //! path of the GRP object in OCDB
- static TFile * fgQADataFile ; //! the output file where the quality assurance maker store their results
- static TString fgQADataFileName ; //! the name of the file where the quality assurance maker store their results
- static TFile * fgQARefFile ; //! the output file where the quality assurance maker store their results
- static TString fgQARefDirName ; //! name of directory where to find the reference data file
- static TString fgQARefFileName ; //! file name where to find the reference data
- static TFile * fgQAResultFile ; //! File where to find the QA result
- static TString fgQAResultDirName ; //! the location of the output file where the QA results are stored
- static TString fgQAResultFileName ; //! the output file where the QA results are stored
- static TString fgRTNames[] ; //! list of Run Type names
- static TString fgTaskNames[] ; //! list of tasks names
- static const TString fkgExpert ; //! name for the expert directory
- static const UInt_t fkgExpertBit ; //! TObject bit identifing the object as "expert"
- static const TString fkgLabLocalFile ; //! label to identify a file as local
- static const TString fkgLabLocalOCDB ; //! label to identify a file as local OCDB
- static const TString fkgLabAliEnOCDB ; //! label to identify a file as AliEn OCDB
- static const TString fkgRefFileName ; //! name of Reference File Name
- static const UInt_t fkgQABit ; //! bit in the QA data object which is set when Checker does not return 0
- static const TString fkgQAName ; //! name of QA object
- static const TString fkgQACorrNtName ; //! name of QA Correlation Ntuple
- static const TString fkgRefOCDBDirName ; //! name of Reference directory name in OCDB
- static TString fkgRefDataDirName ; //! name of Reference directory name in OCDB for data
- static const TString fkgQARefOCDBDefault ; //! default storage for QA in OCDB
+ static TString fgDetNames[] ; //! list of detector names
+ static TString fgGRPPath ; //! path of the GRP object in OCDB
+ static TFile * fgQADataFile ; //! the output file where the quality assurance maker store their results
+ static TString fgQADataFileName ; //! the name of the file where the quality assurance maker store their results
+ static TFile * fgQARefFile ; //! the output file where the quality assurance maker store their results
+ static TString fgQARefDirName ; //! name of directory where to find the reference data file
+ static TString fgQARefFileName ; //! file name where to find the reference data
+ static TFile * fgQAResultFile ; //! File where to find the QA result
+ static TString fgQAResultDirName ; //! the location of the output file where the QA results are stored
+ static TString fgQAResultFileName ; //! the output file where the QA results are stored
+ static TString fgRTNames[] ; //! list of Run Type names
+ static TString fgTaskNames[] ; //! list of tasks names
+ static const TString fgkExpert ; //! name for the expert directory
+ static const UInt_t fgkExpertBit ; //! TObject bit identifing the object as "expert"
+ static const TString fgkLabLocalFile ; //! label to identify a file as local
+ static const TString fgkLabLocalOCDB ; //! label to identify a file as local OCDB
+ static const TString fgkLabAliEnOCDB ; //! label to identify a file as AliEn OCDB
+ static const TString fgkRefFileName ; //! name of Reference File Name
+ static const UInt_t fgkQABit ; //! bit in the QA data object which is set when Checker does not return 0
+ static const TString fgkQAName ; //! name of QA object
+ static const TString fgkQACorrNtName ; //! name of QA Correlation Ntuple
+ static const TString fgkRefOCDBDirName ; //! name of Reference directory name in OCDB
+ static TString fgRefDataDirName ; //! name of Reference directory name in OCDB for data
+ static const TString fgkQARefOCDBDefault ; //! default storage for QA in OCDB
Bool_t * fEventSpecies ; //[fNEventSpecies] list of event species encountered in a run
- ClassDef(AliQA,1) //ALICE Quality Assurance Object
+ ClassDef(AliQA,2) //ALICE Quality Assurance Object
};
#endif
// //
///////////////////////////////////////////////////////////////////////////////
-#include <TBRIK.h>
#include <TCint.h>
-#include <TGeometry.h>
#include <TROOT.h>
#include <TRandom3.h>
#include <TSystem.h>
#include "AliLog.h"
#include "AliDetector.h"
#include "AliHeader.h"
-#include "AliLego.h"
-#include "AliLegoGenerator.h"
#include "AliMC.h"
#include "AliMagFC.h"
#include "AliMagFCM.h"
#include "AliStack.h"
#include "AliCDBManager.h"
#include "AliAlignObj.h"
+#include "AliSimulation.h"
+#include "AliLego.h"
AliRun *gAlice;
AliRun::AliRun():
fRun(-1),
fEvent(0),
- fEventNrInRun(0),
+ fEventNrInRun(-1),
fModules(0),
fMCApp(0),
fField(0),
fNdets(0),
- fLego(0),
fConfigFunction(""),
fRandom(0),
fBaseFileName(""),
TNamed(name,title),
fRun(-1),
fEvent(0),
- fEventNrInRun(0),
+ fEventNrInRun(-1),
fModules(new TObjArray(77)), // Support list for the Detectors
- fMCApp(0),
+ fMCApp(new AliMC(GetName(),GetTitle())),
fField(0),
fNdets(0),
- fLego(0),
fConfigFunction("Config();"),
fRandom(new TRandom3()),
fBaseFileName(""),
gROOT->GetListOfBrowsables()->Add(this,name);
// Create default mag field
- SetField();
+ fField = new AliMagFC("Map1"," ",2.,1.,10.);
}
modfold->Remove(mod);
}
}
-
-
+
delete fField;
delete fMCApp;
delete gMC; gMC=0;
- delete fLego;
if (fModules) {
fModules->Delete();
delete fModules;
}
-//_______________________________________________________________________
-void AliRun::ResetHits()
-{
- fMCApp->ResetHits();
-}
-
-//_______________________________________________________________________
-AliGenerator* AliRun::Generator() const
-{
- return fMCApp->Generator();
-}
-
//_______________________________________________________________________
void AliRun::SetField(AliMagF* magField)
{
}
}
-//_______________________________________________________________________
-void AliRun::SetField(Int_t type, Int_t version, Float_t scale,
- Float_t maxField, const char* filename)
-{
- //
- // Set magnetic field parameters
- // type Magnetic field transport flag 0=no field, 2=helix, 3=Runge Kutta
- // version Magnetic field map version (only 1 active now)
- // scale Scale factor for the magnetic field
- // maxField Maximum value for the magnetic field
-
- //
- // --- Sanity check on mag field flags
- if(fField) delete fField;
- if(version==1) {
- fField = new AliMagFC("Map1"," ",type,scale,maxField);
- } else if(version<=2) {
- fField = new AliMagFCM("Map2-3",filename,type,scale,maxField);
- fField->ReadField();
- } else if(version==3) {
- fField = new AliMagFDM("Map4",filename,type,scale,maxField);
- fField->ReadField();
- } else {
- AliWarning(Form("Invalid map %d",version));
- }
-}
-
//_____________________________________________________________________________
void AliRun::InitLoaders()
}
AliDebug(1, "Done");
}
-//_____________________________________________________________________________
-
-void AliRun::FinishRun()
-{
- //
- // Called at the end of the run.
- //
-
- if(fLego)
- {
- AliDebug(1, "Finish Lego");
- AliRunLoader::GetRunLoader()->CdGAFile();
- fLego->FinishRun();
- }
-
- // Clean detector information
- TIter next(fModules);
- AliModule *detector;
- while((detector = dynamic_cast<AliModule*>(next()))) {
- AliDebug(2, Form("%s->FinishRun()", detector->GetName()));
- detector->FinishRun();
- }
-
- AliDebug(1, "AliRunLoader::GetRunLoader()->WriteHeader(OVERWRITE)");
- AliRunLoader::GetRunLoader()->WriteHeader("OVERWRITE");
-
- // Write AliRun info and all detectors parameters
- AliRunLoader::GetRunLoader()->CdGAFile();
- Write(0,TObject::kOverwrite);//write AliRun
- AliRunLoader::GetRunLoader()->Write(0,TObject::kOverwrite);//write RunLoader itself
-
- if(fMCApp) fMCApp->FinishRun();
- AliRunLoader::GetRunLoader()->Synchronize();
-}
//_______________________________________________________________________
void AliRun::Announce() const
// Reset existing structures
fMCApp->ResetHits();
fMCApp->ResetTrackReferences();
- ResetDigits();
- ResetSDigits();
+ fMCApp->ResetDigits();
+ fMCApp->ResetSDigits();
/*****************************************/
/**** R E L O A D ****/
fBaseFileName = filename;
}
-//_______________________________________________________________________
-void AliRun::ResetDigits()
-{
- //
- // Reset all Detectors digits
- //
- TIter next(fModules);
- AliModule *detector;
- while((detector = dynamic_cast<AliModule*>(next()))) {
- detector->ResetDigits();
- }
-}
-
-//_______________________________________________________________________
-void AliRun::ResetSDigits()
-{
- //
- // Reset all Detectors digits
- //
- TIter next(fModules);
- AliModule *detector;
- while((detector = dynamic_cast<AliModule*>(next()))) {
- detector->ResetSDigits();
- }
-}
-
-
-//_______________________________________________________________________
-void AliRun::InitMC(const char *setup)
-{
- //
- // Initialize ALICE Simulation run
- //
-
- static Bool_t initDone=kFALSE;
-
- Announce();
-
- if(initDone) {
- AliError("AliRun already initialised! Check your logic!");
- return;
- } else initDone=kTRUE;
-
- if (!fMCApp)
- fMCApp=new AliMC(GetName(),GetTitle());
-
- gROOT->LoadMacro(setup);
- gInterpreter->ProcessLine(fConfigFunction.Data());
-
- if(AliCDBManager::Instance()->GetRun() >= 0) {
- SetRunNumber(AliCDBManager::Instance()->GetRun());
- } else {
- AliWarning("Run number not initialized!!");
- }
-
- AliRunLoader::GetRunLoader()->CdGAFile();
-
- AliPDG::AddParticlesToPdgDataBase();
-
- fMCApp->Init();
-
- //Must be here because some MCs (G4) adds detectors here and not in Config.C
- InitLoaders();
- AliRunLoader::GetRunLoader()->MakeTree("E");
- if (fLego == 0x0)
- {
- AliRunLoader::GetRunLoader()->LoadKinematics("RECREATE");
- AliRunLoader::GetRunLoader()->LoadTrackRefs("RECREATE");
- AliRunLoader::GetRunLoader()->LoadHits("all","RECREATE");
- }
- //
- // Save stuff at the beginning of the file to avoid file corruption
- AliRunLoader::GetRunLoader()->CdGAFile();
- Write();
- fEventNrInRun = -1; //important - we start Begin event from increasing current number in run
-}
//_______________________________________________________________________
void AliRun::Hits2Digits(const char *selected)
}
}
-//_______________________________________________________________________
-void AliRun::RunLego(const char *setup, Int_t nc1, Float_t c1min,
- Float_t c1max,Int_t nc2,Float_t c2min,Float_t c2max,
- Float_t rmin,Float_t rmax,Float_t zmax, AliLegoGenerator* gener, Int_t nev)
-{
- //
- // Generates lego plots of:
- // - radiation length map phi vs theta
- // - radiation length map phi vs eta
- // - interaction length map
- // - g/cm2 length map
- //
- // ntheta bins in theta, eta
- // themin minimum angle in theta (degrees)
- // themax maximum angle in theta (degrees)
- // nphi bins in phi
- // phimin minimum angle in phi (degrees)
- // phimax maximum angle in phi (degrees)
- // rmin minimum radius
- // rmax maximum radius
- //
- //
- // The number of events generated = ntheta*nphi
- // run input parameters in macro setup (default="Config.C")
- //
- // Use macro "lego.C" to visualize the 3 lego plots in spherical coordinates
- //Begin_Html
- /*
- <img src="picts/AliRunLego1.gif">
- */
- //End_Html
- //Begin_Html
- /*
- <img src="picts/AliRunLego2.gif">
- */
- //End_Html
- //Begin_Html
- /*
- <img src="picts/AliRunLego3.gif">
- */
- //End_Html
- //
- // Number of events
- if (nev == -1) nev = nc1 * nc2;
-
- // check if initialisation has been done
- // If runloader has been initialized, set the number of events per file to nc1 * nc2
-
- // Set new generator
- if (!gener) gener = new AliLegoGenerator();
- //
- // Configure Generator
-
- gener->SetRadiusRange(rmin, rmax);
- gener->SetZMax(zmax);
- gener->SetCoor1Range(nc1, c1min, c1max);
- gener->SetCoor2Range(nc2, c2min, c2max);
-
-
- //Create Lego object
- fLego = new AliLego("lego",gener);
-
- InitMC(setup);
- //Save current generator
-
- AliGenerator *gen=fMCApp->Generator();
- fMCApp->ResetGenerator(gener);
- //Prepare MC for Lego Run
- gMC->InitLego();
-
- //Run Lego Object
-
-
- if (fRunLoader) fRunLoader->SetNumberOfEventsPerFile(nev);
- gMC->ProcessRun(nev);
-
- // End of this run, close files
- FinishRun();
- // Restore current generator
- fMCApp->ResetGenerator(gen);
- // Delete Lego Object
- delete fLego; fLego=0;
-}
-
-//_______________________________________________________________________
-void AliRun::SetConfigFunction(const char * config)
-{
- //
- // Set the signature of the function contained in Config.C to configure
- // the run
- //
- fConfigFunction=config;
-}
-
//
// MC Application
//
// Return the value of the magnetic field
//
- Float_t xfloat[3];
- for (Int_t i=0; i<3; i++) xfloat[i] = x[i];
-
- if (Field()) {
+ if (Field()) Field()->Field(x,b);
- Float_t bfloat[3];
- Field()->Field(xfloat,bfloat);
- for (Int_t j=0; j<3; j++) b[j] = bfloat[j];
- }
else {
AliError("No mag field defined!");
b[0]=b[1]=b[2]=0.;
fNdets++;
}
-//_____________________________________________________________________________
-/*inline*/ Bool_t AliRun::IsFileAccessible(const char* fnam, EAccessMode mode)
-{ return !gSystem->AccessPathName(fnam,mode);}
-
-//______________________________________________________
-/*inline*/ Bool_t AliRun::IsFileAccessible(Char_t* name,EAccessMode mode)
-{
- TString str = name; gSystem->ExpandPathName(str);
- return !gSystem->AccessPathName(str.Data(),mode);
-}
class AliGenEventHeader;
class AliGenerator;
class AliHeader;
-class AliLego;
-class AliLegoGenerator;
class AliMC;
class AliMagF;
class AliStack;
TObjArray *Detectors() const {return fModules;}
TObjArray *Modules() const {return fModules;}
virtual AliMagF *Field() const {return fField;}
- virtual void FinishRun();
void AddModule(AliModule* mod);
Int_t GetEvNumber() const;
Int_t GetRunNumber() const {return fRun;}
{return fBaseFileName.Data();}
virtual Int_t GetEvent(Int_t event);
virtual void SetEvent(Int_t event) {fEvent=event;}
- virtual void SetConfigFunction(const char * config="Config();");
+ virtual void SetConfigFunction(const char * config="Config();")
+ {fConfigFunction=config;}
virtual const char *GetConfigFunction() const
- {return fConfigFunction.Data();}
+ {return fConfigFunction.Data();}
virtual void SetGenEventHeader(AliGenEventHeader* header);
AliMC* GetMCApp() const {return fMCApp;}
virtual void Hits2Digits(const char *detector=0);
virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);}
virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);}
virtual void Digits2Reco(const char *detector=0) {Tree2Tree("R",detector);}
- virtual void InitMC(const char *setup="Config.C");
Bool_t IsFolder() const {return kTRUE;}
- virtual AliLego* Lego() const {return fLego;}
Bool_t IsRootGeometry() const {return fIsRootGeometry;}
void SetRootGeometry(Bool_t flag=kTRUE);
const char* GetGeometryFileName() const {return fGeometryFileName.Data();}
Bool_t IsGeomFromCDB() const {return fGeometryFromCDB;}
const char* GetTriggerDescriptor() const {return fTriggerDescriptor.Data();}
void SetTriggerDescriptor(const char *name) {fTriggerDescriptor = name;}
- virtual void ResetDigits();
- virtual void ResetSDigits();
virtual void SetBaseFile(const char *filename="galice.root");
- virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
- Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0,
- Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL, Int_t nev = -1);
- virtual Bool_t IsLegoRun() const {return (fLego!=0);}
- virtual void SetField(Int_t type=2, Int_t version=1, Float_t scale=1, Float_t maxField=10, const char* filename="$(ALICE_ROOT)/data/field01.dat");
virtual void SetField(AliMagF* magField);
virtual void Field(const Double_t* x, Double_t* b) const;
- // Delegations
- virtual void ResetHits();
- virtual AliGenerator* Generator() const;
-
- Bool_t IsFileAccessible(Char_t* name, EAccessMode mode = kFileExists);
- static Bool_t IsFileAccessible(const char* fnam, EAccessMode mode = kFileExists);
-
//
// End of MC Application
virtual void Announce() const;
virtual void InitLoaders(); //prepares run (i.e. creates getters)
+ void SetRunNumber(Int_t run) {fRun=run;}
protected:
- void SetRunNumber(Int_t run) {fRun=run;}
virtual void Tree2Tree(Option_t *option, const char *detector=0);
Int_t fRun; //! Current run number
Int_t fEvent; //! Current event number (from 1)
AliMC *fMCApp; // Pointer to virtual MC Application
AliMagF *fField; // Magnetic Field Map
Int_t fNdets; // Number of detectors
- AliLego *fLego; //! Pointer to aliLego object if it exists
TString fConfigFunction; // Configuration file to be executed
TRandom *fRandom; // Pointer to the random number generator
TString fBaseFileName; // Name of the base root file
#include <TBranch.h>
#include <TFile.h>
#include <TFolder.h>
-#include <TGeometry.h>
#include <TObjArray.h>
#include <TString.h>
class TTask;
// //
///////////////////////////////////////////////////////////////////////////////
-#include <TVirtualMCApplication.h>
-#include <TVirtualMC.h>
+#include <TCint.h>
+#include <TFile.h>
#include <TGeoManager.h>
#include <TObjString.h>
-#include <TSystem.h>
-#include <TFile.h>
#include <TROOT.h>
+#include <TSystem.h>
+#include <TVirtualMC.h>
+#include <TVirtualMCApplication.h>
-#include "AliCodeTimer.h"
-#include "AliCDBStorage.h"
+#include "AliAlignObj.h"
#include "AliCDBEntry.h"
#include "AliCDBManager.h"
-#include "AliGeomManager.h"
-#include "AliAlignObj.h"
+#include "AliCDBStorage.h"
+#include "AliCTPRawData.h"
+#include "AliCentralTrigger.h"
#include "AliCentralTrigger.h"
+#include "AliCodeTimer.h"
#include "AliDAQ.h"
#include "AliDigitizer.h"
+#include "AliESD.h"
+#include "AliGRPObject.h"
+#include "AliGenEventHeader.h"
#include "AliGenerator.h"
+#include "AliGeomManager.h"
+#include "AliHLTSimulation.h"
+#include "AliHeader.h"
#include "AliLog.h"
+#include "AliMC.h"
+#include "AliMagF.h"
#include "AliModule.h"
+#include "AliPDG.h"
+#include "AliRawReaderDate.h"
+#include "AliRawReaderFile.h"
+#include "AliRawReaderRoot.h"
#include "AliRun.h"
#include "AliRunDigitizer.h"
#include "AliRunLoader.h"
#include "AliSimulation.h"
-#include "AliVertexGenFile.h"
-#include "AliCentralTrigger.h"
-#include "AliCTPRawData.h"
-#include "AliRawReaderFile.h"
-#include "AliRawReaderRoot.h"
-#include "AliRawReaderDate.h"
-#include "AliESD.h"
-#include "AliHeader.h"
-#include "AliGenEventHeader.h"
-#include "AliMC.h"
-#include "AliHLTSimulation.h"
#include "AliSysInfo.h"
-#include "AliMagF.h"
-#include "AliGRPObject.h"
+#include "AliVertexGenFile.h"
+#include "AliLegoGenerator.h"
+#include "AliLego.h"
ClassImp(AliSimulation)
fInitRunNumberCalled(kFALSE),
fSetRunNumberFromDataCalled(kFALSE),
fEmbeddingFlag(kFALSE),
+ fLego(NULL),
fQADetectors("ALL"),
fQATasks("ALL"),
fQASteer(NULL),
return kTRUE;
}
+//_______________________________________________________________________
+Bool_t AliSimulation::RunLego(const char *setup, Int_t nc1, Float_t c1min,
+ Float_t c1max,Int_t nc2,Float_t c2min,Float_t c2max,
+ Float_t rmin,Float_t rmax,Float_t zmax, AliLegoGenerator* gener, Int_t nev)
+{
+ //
+ // Generates lego plots of:
+ // - radiation length map phi vs theta
+ // - radiation length map phi vs eta
+ // - interaction length map
+ // - g/cm2 length map
+ //
+ // ntheta bins in theta, eta
+ // themin minimum angle in theta (degrees)
+ // themax maximum angle in theta (degrees)
+ // nphi bins in phi
+ // phimin minimum angle in phi (degrees)
+ // phimax maximum angle in phi (degrees)
+ // rmin minimum radius
+ // rmax maximum radius
+ //
+ //
+ // The number of events generated = ntheta*nphi
+ // run input parameters in macro setup (default="Config.C")
+ //
+ // Use macro "lego.C" to visualize the 3 lego plots in spherical coordinates
+ //Begin_Html
+ /*
+ <img src="picts/AliRunLego1.gif">
+ */
+ //End_Html
+ //Begin_Html
+ /*
+ <img src="picts/AliRunLego2.gif">
+ */
+ //End_Html
+ //Begin_Html
+ /*
+ <img src="picts/AliRunLego3.gif">
+ */
+ //End_Html
+ //
+
+// run the generation and simulation
+
+ AliCodeTimerAuto("")
+
+ // initialize CDB storage and run number from external environment
+ // (either CDB manager or AliSimulation setters)
+ InitCDB();
+ InitRunNumber();
+ SetCDBLock();
+
+ if (!gAlice) {
+ AliError("no gAlice object. Restart aliroot and try again.");
+ return kFALSE;
+ }
+ if (gAlice->Modules()->GetEntries() > 0) {
+ AliError("gAlice was already run. Restart aliroot and try again.");
+ return kFALSE;
+ }
+
+ AliInfo(Form("initializing gAlice with config file %s",
+ fConfigFileName.Data()));
+
+ // Number of events
+ if (nev == -1) nev = nc1 * nc2;
+
+ // check if initialisation has been done
+ // If runloader has been initialized, set the number of events per file to nc1 * nc2
+
+ // Set new generator
+ if (!gener) gener = new AliLegoGenerator();
+ //
+ // Configure Generator
+
+ gener->SetRadiusRange(rmin, rmax);
+ gener->SetZMax(zmax);
+ gener->SetCoor1Range(nc1, c1min, c1max);
+ gener->SetCoor2Range(nc2, c2min, c2max);
+
+
+ //Create Lego object
+ fLego = new AliLego("lego",gener);
+
+ //__________________________________________________________________________
+
+ gAlice->Announce();
+
+ gROOT->LoadMacro(setup);
+ gInterpreter->ProcessLine(gAlice->GetConfigFunction());
+
+ if(AliCDBManager::Instance()->GetRun() >= 0) {
+ SetRunNumber(AliCDBManager::Instance()->GetRun());
+ } else {
+ AliWarning("Run number not initialized!!");
+ }
+
+ AliRunLoader::GetRunLoader()->CdGAFile();
+
+ AliPDG::AddParticlesToPdgDataBase();
+
+ gAlice->GetMCApp()->Init();
+
+ //Must be here because some MCs (G4) adds detectors here and not in Config.C
+ gAlice->InitLoaders();
+ AliRunLoader::GetRunLoader()->MakeTree("E");
+
+ //
+ // Save stuff at the beginning of the file to avoid file corruption
+ AliRunLoader::GetRunLoader()->CdGAFile();
+ gAlice->Write();
+
+ //Save current generator
+ AliGenerator *gen=gAlice->GetMCApp()->Generator();
+ gAlice->GetMCApp()->ResetGenerator(gener);
+ //Prepare MC for Lego Run
+ gMC->InitLego();
+
+ //Run Lego Object
+
+
+ AliRunLoader::GetRunLoader()->SetNumberOfEventsPerFile(nev);
+ gMC->ProcessRun(nev);
+
+ // End of this run, close files
+ FinishRun();
+ // Restore current generator
+ gAlice->GetMCApp()->ResetGenerator(gen);
+ // Delete Lego Object
+ delete fLego;
+
+ return kTRUE;
+}
+
//_____________________________________________________________________________
Bool_t AliSimulation::RunTrigger(const char* config, const char* detectors)
{
AliInfo(Form("initializing gAlice with config file %s",
fConfigFileName.Data()));
- StdoutToAliInfo(StderrToAliError(
- gAlice->InitMC(fConfigFileName.Data());
- ););
+
+ //
+ // Initialize ALICE Simulation run
+ //
+
+ gAlice->Announce();
+
+ gROOT->LoadMacro(fConfigFileName.Data());
+ gInterpreter->ProcessLine(gAlice->GetConfigFunction());
+
+ if(AliCDBManager::Instance()->GetRun() >= 0) {
+ gAlice->SetRunNumber(AliCDBManager::Instance()->GetRun());
+ } else {
+ AliWarning("Run number not initialized!!");
+ }
+
+ AliRunLoader::GetRunLoader()->CdGAFile();
+
+ AliPDG::AddParticlesToPdgDataBase();
+
+ gAlice->GetMCApp()->Init();
+
+ //Must be here because some MCs (G4) adds detectors here and not in Config.C
+ gAlice->InitLoaders();
+ AliRunLoader::GetRunLoader()->MakeTree("E");
+ AliRunLoader::GetRunLoader()->LoadKinematics("RECREATE");
+ AliRunLoader::GetRunLoader()->LoadTrackRefs("RECREATE");
+ AliRunLoader::GetRunLoader()->LoadHits("all","RECREATE");
+ //
+ // Save stuff at the beginning of the file to avoid file corruption
+ AliRunLoader::GetRunLoader()->CdGAFile();
+ gAlice->Write();
+ gAlice->SetEventNrInRun(-1); //important - we start Begin event from increasing current number in run
+ //___________________________________________________________________________________________
// Get the trigger descriptor string
// Either from AliSimulation or from
// }
// SetGAliceFile(runLoader->GetFileName());
- if (!gAlice->Generator()) {
+ if (!gAlice->GetMCApp()->Generator()) {
AliError(Form("gAlice has no generator object. "
"Check your config file: %s", fConfigFileName.Data()));
return kFALSE;
"file %s with nSignalPerBackground = %d",
fileName, signalPerBkgrd));
AliVertexGenFile* vtxGen = new AliVertexGenFile(fileName, signalPerBkgrd);
- gAlice->Generator()->SetVertexGenerator(vtxGen);
+ gAlice->GetMCApp()->Generator()->SetVertexGenerator(vtxGen);
}
if (!fRunSimulation) {
- gAlice->Generator()->SetTrackingFlag(0);
+ gAlice->GetMCApp()->Generator()->SetTrackingFlag(0);
}
// set the number of events per file for given detectors and data types
gMC->ProcessRun(nEvents);
// End of this run, close files
- if(nEvents>0) gAlice->FinishRun();
+ if(nEvents>0) FinishRun();
AliSysInfo::AddStamp("Stop_simulation");
delete runLoader;
//
// If an ESD file is given the reconstructed vertex is taken from it and stored in the event header.
//
- if (!gAlice) {
- AliError("no gAlice object. Restart aliroot and try again.");
- return kFALSE;
- }
- if (gAlice->Modules()->GetEntries() > 0) {
- AliError("gAlice was already run. Restart aliroot and try again.");
- return kFALSE;
- }
+ if (!gAlice) {
+ AliError("no gAlice object. Restart aliroot and try again.");
+ return kFALSE;
+ }
+ if (gAlice->Modules()->GetEntries() > 0) {
+ AliError("gAlice was already run. Restart aliroot and try again.");
+ return kFALSE;
+ }
+
+ AliInfo(Form("initializing gAlice with config file %s",fConfigFileName.Data()));
+
+ gAlice->Announce();
+
+ gROOT->LoadMacro(fConfigFileName.Data());
+ gInterpreter->ProcessLine(gAlice->GetConfigFunction());
+
+ if(AliCDBManager::Instance()->GetRun() >= 0) {
+ SetRunNumber(AliCDBManager::Instance()->GetRun());
+ } else {
+ AliWarning("Run number not initialized!!");
+ }
+
+ AliRunLoader::GetRunLoader()->CdGAFile();
- AliInfo(Form("initializing gAlice with config file %s",fConfigFileName.Data()));
- StdoutToAliInfo(StderrToAliError(gAlice->InitMC(fConfigFileName.Data());););
+ AliPDG::AddParticlesToPdgDataBase();
+
+ gAlice->GetMCApp()->Init();
+
+ //Must be here because some MCs (G4) adds detectors here and not in Config.C
+ gAlice->InitLoaders();
+ AliRunLoader::GetRunLoader()->MakeTree("E");
+ AliRunLoader::GetRunLoader()->LoadKinematics("RECREATE");
+ AliRunLoader::GetRunLoader()->LoadTrackRefs("RECREATE");
+ AliRunLoader::GetRunLoader()->LoadHits("all","RECREATE");
+ //
+ // Save stuff at the beginning of the file to avoid file corruption
+ AliRunLoader::GetRunLoader()->CdGAFile();
+ gAlice->Write();
//
// Initialize CDB
InitCDB();
return kTRUE;
}
+//_____________________________________________________________________________
+void AliSimulation::FinishRun()
+{
+ //
+ // Called at the end of the run.
+ //
+
+ if(IsLegoRun())
+ {
+ AliDebug(1, "Finish Lego");
+ AliRunLoader::GetRunLoader()->CdGAFile();
+ fLego->FinishRun();
+ }
+
+ // Clean detector information
+ TIter next(gAlice->Modules());
+ AliModule *detector;
+ while((detector = dynamic_cast<AliModule*>(next()))) {
+ AliDebug(2, Form("%s->FinishRun()", detector->GetName()));
+ detector->FinishRun();
+ }
+
+ AliDebug(1, "AliRunLoader::GetRunLoader()->WriteHeader(OVERWRITE)");
+ AliRunLoader::GetRunLoader()->WriteHeader("OVERWRITE");
+
+ // Write AliRun info and all detectors parameters
+ AliRunLoader::GetRunLoader()->CdGAFile();
+ gAlice->Write(0,TObject::kOverwrite);//write AliRun
+ AliRunLoader::GetRunLoader()->Write(0,TObject::kOverwrite);//write RunLoader itself
+
+ if(gAlice->GetMCApp()) gAlice->GetMCApp()->FinishRun();
+ AliRunLoader::GetRunLoader()->Synchronize();
+}
+
//_____________________________________________________________________________
Int_t AliSimulation::GetDetIndex(const char* detector)
{
grpObj->SetTimeStart(0);
grpObj->SetTimeEnd(9999);
- const AliGenerator *gen = gAlice->Generator();
+ const AliGenerator *gen = gAlice->GetMCApp()->Generator();
if (gen) {
grpObj->SetBeamEnergy(gen->GetEnergyCMS());
TString projectile;
class AliCDBId;
class AliCDBParam;
class AliRunLoader;
+class AliLegoGenerator;
+class AliLego;
class AliSimulation: public TNamed {
public:
const char* title = "generation, simulation and digitization");
virtual ~AliSimulation();
- static AliSimulation *GetInstance() {return fgInstance;}
+ static AliSimulation *Instance() {return fgInstance;}
void SetNumberOfEvents(Int_t nEvents);
void SetConfigFile(const char* fileName);
void SetSpecificStorage(const char* calibType, const char* uri);
virtual Bool_t Run(Int_t nEvents = 0);
+ virtual Bool_t RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
+ Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0,
+ Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL, Int_t nev = -1);
virtual Bool_t RunSimulation(Int_t nEvents = 0);
virtual Bool_t RunSDigitization(const char* detectors = "ALL");
// HLT
void SetRunHLT(const char* options) {fRunHLT=options;}
virtual Bool_t RunHLT();
+ virtual Bool_t IsLegoRun() const {return (fLego!=0);}
+ AliLego* Lego() const {return fLego;}
+ virtual void FinishRun();
//Quality Assurance
Int_t GetDetIndex(const char * detector);
Bool_t fSetRunNumberFromDataCalled; //! flag to check if run number is already loaded from run loader
Bool_t fEmbeddingFlag; // Flag for embedding
+ AliLego *fLego; //! Pointer to aliLego object if it exists
//QA stuff
static const Int_t fgkNDetectors = 15 ; // number of detectors
//
//_____________________________________________________________________________
-void AliStack::PushTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom,
- Float_t *vpos, Float_t *polar, Float_t tof,
+void AliStack::PushTrack(Int_t done, Int_t parent, Int_t pdg, const Float_t *pmom,
+ const Float_t *vpos, const Float_t *polar, Float_t tof,
TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
{
//
return kTRUE;
}
-Bool_t AliStack::KeepPhysics(TParticle* part)
+Bool_t AliStack::KeepPhysics(const TParticle* part)
{
//
// Some particles have to kept on the stack for reasons motivated
}
//__________________________________________________________________________________________
-TTree* AliStack::TreeK()
-{
-//returns TreeK
- return fTreeK;
-}
-//__________________________________________________________________________________________
-
void AliStack::ConnectTree(TTree* tree)
{
//
// methods
virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
- Float_t *pmom, Float_t *vpos, Float_t *polar,
+ const Float_t *pmom, const Float_t *vpos, const Float_t *polar,
Float_t tof, TMCProcess mech, Int_t &ntr,
Float_t weight, Int_t is);
virtual Int_t GetCurrentParentTrackNumber() const;
TParticle* Particle(Int_t id);
Int_t GetPrimary(Int_t id);
- TTree* TreeK();
+ TTree* TreeK() const {return fTreeK;}
TParticle* ParticleFromTreeK(Int_t id) const;
Int_t TreeKEntry(Int_t id) const;
Bool_t IsPhysicalPrimary(Int_t i);
- Int_t TrackLabel(Int_t label) {return fTrackLabelMap[label];}
+ Int_t TrackLabel(Int_t label) const {return fTrackLabelMap[label];}
Int_t* TrackLabelMap() {return fTrackLabelMap.GetArray();}
const TObjArray* Particles() const;
void CleanParents();
void ResetArrays(Int_t size);
TParticle* GetNextParticle();
- Bool_t KeepPhysics(TParticle* part);
+ Bool_t KeepPhysics(const TParticle* part);
Bool_t IsStable(Int_t pdg) const;
private:
void Copy(TObject &st) const;
//
///////////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
-//#include <cstdlib>
+#include <TCint.h>
+#include <TFile.h>
+#include <TKey.h>
+#include <TObjArray.h>
+#include <TObjString.h>
#include <TObject.h>
+#include <TROOT.h>
#include <TString.h>
-#include <TObjString.h>
-#include <TObjArray.h>
#include <TSystem.h>
-#include <TKey.h>
-#include <TFile.h>
+#include "AliCDBManager.h"
#include "AliLog.h"
+#include "AliMC.h"
+#include "AliModule.h"
+#include "AliPDG.h"
#include "AliRun.h"
#include "AliRunLoader.h"
-#include "AliModule.h"
-
-#include "AliTriggerInput.h"
-//#include "AliTriggerDetector.h"
-#include "AliTriggerInteraction.h"
#include "AliTriggerBCMask.h"
-#include "AliTriggerCluster.h"
-#include "AliTriggerPFProtection.h"
-#include "AliTriggerDescriptor.h"
#include "AliTriggerClass.h"
+#include "AliTriggerCluster.h"
#include "AliTriggerConfiguration.h"
+#include "AliTriggerDescriptor.h"
+#include "AliTriggerInput.h"
+#include "AliTriggerInteraction.h"
+#include "AliTriggerPFProtection.h"
ClassImp(AliTriggerConfiguration)
AliInfo( Form( "initializing gAlice with config file %s",
configfile.Data() ) );
- StdoutToAliInfo( StderrToAliError(
- gAlice->InitMC( configfile.Data() );
- ););
+//_______________________________________________________________________
+ gAlice->Announce();
+
+ gROOT->LoadMacro(configfile.Data());
+ gInterpreter->ProcessLine(gAlice->GetConfigFunction());
+
+ if(AliCDBManager::Instance()->GetRun() >= 0) {
+ gAlice->SetRunNumber(AliCDBManager::Instance()->GetRun());
+ } else {
+ AliWarning("Run number not initialized!!");
+ }
+
+ AliRunLoader::GetRunLoader()->CdGAFile();
+
+ AliPDG::AddParticlesToPdgDataBase();
+
+ gAlice->GetMCApp()->Init();
+
+ //Must be here because some MCs (G4) adds detectors here and not in Config.C
+ gAlice->InitLoaders();
+ AliRunLoader::GetRunLoader()->MakeTree("E");
+ AliRunLoader::GetRunLoader()->LoadKinematics("RECREATE");
+ AliRunLoader::GetRunLoader()->LoadTrackRefs("RECREATE");
+ AliRunLoader::GetRunLoader()->LoadHits("all","RECREATE");
+ //
+ // Save stuff at the beginning of the file to avoid file corruption
+ AliRunLoader::GetRunLoader()->CdGAFile();
+ gAlice->Write();
AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
if( !runLoader ) {
// //
///////////////////////////////////////////////////////////////////////////////
-//#include <Riostream.h>
-
-//#include <TFile.h>
-#include <TGeometry.h>
-//#include <TMath.h>
-#include <TNode.h>
-//#include <TParticle.h>
-//#include <TRandom.h>
-#include <TTUBE.h>
-//#include <TVirtualMC.h>
+#include "TClonesArray.h"
+#include "AliLoader.h"
+#include "AliLog.h"
#include "AliLog.h"
#include "AliMC.h"
-#include "AliLoader.h"
#include "AliRun.h"
-#include "TClonesArray.h"
#include "AliT0.h"
-//#include "AliT0Loader.h"
-#include "AliT0digit.h"
-#include "AliT0hit.h"
#include "AliT0Digitizer.h"
#include "AliT0RawData.h"
#include "AliT0RecPoint.h"
-//#include "AliT0Parameters.h"
-#include "AliLog.h"
+#include "AliT0digit.h"
+#include "AliT0hit.h"
ClassImp(AliT0)
#include <Riostream.h>
#include <stdlib.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
-#include <TTUBE.h>
#include <TVirtualMC.h>
#include "AliLog.h"
#include <Riostream.h>
#include <stdlib.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
-#include <TTUBE.h>
#include <TVirtualMC.h>
#include "TGeoManager.h"
#include "TGeoMatrix.h"
#include <Riostream.h>
#include <stdlib.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
-#include <TTUBE.h>
#include <TVirtualMC.h>
#include "AliMagF.h"
#include "AliT0hit.h"
#include "AliT0v2.h"
#include "AliMC.h"
-//#include "AliT0hitPhoton.h"
-//#include "TGeant3.h"
ClassImp(AliT0v2)
#include "THBTprocessor.h"
#include "AliStack.h"
+#include "AliMC.h"
#include "AliGenCocktailAfterBurner.h"
#include "AliLog.h"
Int_t AliGenHBTprocessor::GetNumberOfEvents()
{
//returns number of available events
- AliGenerator* g = gAlice->Generator();
+ AliGenerator* g = gAlice->GetMCApp()->Generator();
AliGenCocktailAfterBurner* cab = (g)?dynamic_cast<AliGenCocktailAfterBurner*>(g):0x0;
if (cab == 0x0)
{
Int_t AliGenHBTprocessor::GetNumberOfTracks()
{
//returns number of tracks in active event
- AliGenerator* g = gAlice->Generator();
+ AliGenerator* g = gAlice->GetMCApp()->Generator();
AliGenCocktailAfterBurner* cab = (g)?dynamic_cast<AliGenCocktailAfterBurner*>(g):0x0;
if (cab == 0x0)
{
{
//returns track that hbtp thinks is n in active event
AliDebug(5,Form("n = %d",n));
- AliGenerator* g = gAlice->Generator();
+ AliGenerator* g = gAlice->GetMCApp()->Generator();
AliGenCocktailAfterBurner* cab = (g)?dynamic_cast<AliGenCocktailAfterBurner*>(g):0x0;
if (cab == 0x0)
{
void AliGenHBTprocessor::GetTrackEventIndex(Int_t n, Int_t &evno, Int_t &index) const
{
//returns event(stack) number and particle index
- AliGenerator* g = gAlice->Generator();
+ AliGenerator* g = gAlice->GetMCApp()->Generator();
AliGenCocktailAfterBurner* cab = (g)?dynamic_cast<AliGenCocktailAfterBurner*>(g):0x0;
if (cab == 0x0)
{
"Running HBT Processor without gAlice... Exiting \n");
return 0x0;//pro forma
}
- AliGenerator * gen = gAlice->Generator();
+ AliGenerator * gen = gAlice->GetMCApp()->Generator();
if (!gen)
{
+++ /dev/null
-////////////////////////////////////////////////////////////////////////
-//
-// name: AliHits2SDigits
-// date: 4.4.2002
-// last update: 4.4.2002
-// author: Jiri Chudoba
-// version: 1.0
-//
-// description:
-// creates sdigits for several detectors
-// stores sdigits in separate file (or in the source file
-// with hits). Stores gAlice object and copies TE to the
-// file with sdigits
-//
-// input:
-// TString fileNameSDigits ... output file with sdigits
-// TString fileNameHits ... input file with hits
-// Int_t nEvents ... how many events to proceed
-// Int_t firstEvent ... first event number
-// Int_t ITS, TPC, ... many flags for diff. detectors
-//
-// History:
-//
-// 04.04.02 - first version
-//
-////////////////////////////////////////////////////////////////////////
-
-#if !defined(__CINT__) || defined(__MAKECINT__)
-#include "iostream.h"
-#include "TTree.h"
-#include "TBranch.h"
-#include "TDirectory.h"
-#include "TFile.h"
-#include "AliRun.h"
-#include "TParticle.h"
-#include "TPC/AliTPCDigitsArray.h"
-#include "AliHeader.h"
-#include "TGeometry.h"
-#include "TObjArray.h"
-#include "TString.h"
-#include "ITS/AliITS.h"
-#include "TPC/AliTPC.h"
-#include "PHOS/AliPHOSSDigitizer.h"
-#include "TOF/AliTOFSDigitizer.h"
-#include "TRD/AliTRDdigitizer.h"
-#include "TStopwatch.h"
-#include "TRD/AliTRDparameter.h"
-#endif
-
-TFile* Init(TString fileNameSDigits, TString fileNameHits);
-TFile* OpenFile(TString fileName);
-Bool_t ImportgAlice(TFile *file);
-AliTRDdigitizer *InitTRDdigitizer();
-void AliCopy(TFile *inputFile, TFile *outputFile);
-
-// global variables
-
-TFile *gFileHits = 0;
-Bool_t gSameFiles = kFALSE;
-Int_t gDEBUG = 1;
-
-
-Int_t AliHits2SDigits(TString fileNameSDigits="sdigits.root",
- TString fileNameHits="galice.root",
- Int_t nEvents = 1, Int_t firstEvent = 0, Int_t iITS = 0,
- Int_t iTPC = 0, Int_t iTRD = 0,Int_t iPHOS = 0,
- Int_t iTOF = 1, Int_t iCopy = 1)
-{
-//
-// Initialization
-//
- TFile *fileSDigits;
- fileSDigits = Init(fileNameSDigits, fileNameHits);
- if (!fileSDigits) return 1;
- if (iCopy) {
- AliCopy(gFileHits,fileSDigits);
- gFileHits->cd();
- }
-
-// ITS
- AliITS *ITS;
- if (iITS) {
- ITS = (AliITS*) gAlice->GetModule("ITS");
- if (!ITS) {
- iITS = 0;
- cerr<<"AliITS object not found on file." << endl;
- } else if (!ITS->GetITSgeom()) {
- cerr<<"AliITSgeom not found." << endl;
- iITS = 0;
- }
- }
-
-// TPC
- AliTPC *TPC;
- if (iTPC) {
- TPC = (AliTPC*)gAlice->GetDetector("TPC");
- if (!TPC) {
- iTPC = 0;
- cerr<<"AliTPC object not found"<<endl;
- }
- }
-
-// TRD
- AliTRDdigitizer *sdTRD;
- if (iTRD) {
- sdTRD = InitTRDdigitizer();
- }
-
-
-// PHOS
- AliPHOSSDigitizer *sdPHOS;
- if (iPHOS) {
- sdPHOS = new AliPHOSSDigitizer(fileNameHits.Data());
- }
-
-// TOF
- AliTOFSDigitizer *sdTOF;
- if (iTOF) {
- sdTOF = new AliTOFSDigitizer(fileNameHits.Data(),firstEvent,nEvents);
- }
-
-
-//
-// loop over events
-//
- TStopwatch timer;
- timer.Start();
- for (Int_t iEvent = firstEvent;iEvent<firstEvent+nEvents;iEvent++){
- gAlice->GetEvent(iEvent);
- gAlice->MakeTree("S",fileSDigits);
-
-// ITS
- if (iITS) {
- if (gDEBUG) {cout<<" Create ITS sdigits: ";}
- ITS->MakeBranch("S");
- ITS->SetTreeAddress();
- ITS->Hits2SDigits();
- if (gDEBUG) {cout<<"done"<<endl;}
- }
-
-// TPC
- if (iTPC) {
- if (gDEBUG) {cout<<" Create TPC sdigits: ";}
- TPC->SetActiveSectors(1);
- TPC->Hits2SDigits2(iEvent);
- if (gDEBUG) {cout<<"done"<<endl;}
- }
-
-// TRD
- if (iTRD) {
- if (gDEBUG) {cout<<" Create TRD sdigits: ";}
- sdTRD->InitOutput(fileSDigits, iEvent);
- sdTRD->MakeDigits();
- sdTRD->WriteDigits();
- if (gDEBUG) {cout<<"done"<<endl;}
- }
-
- } // end of loop over events
-
-// PHOS processes always all events
- if (iPHOS) {
- sdPHOS->ExecuteTask("deb all");
- }
-
-// TOF (precesses the events as specified in the AliTOFSDigitizer
-// par ctor)
- if (iTOF) {
- // Activate this line if you want to print the
- // parameters used for sdigitization
- // sdTOF->PrintParameters();
- sdTOF->Exec("all");
- }
-
-//
-// finish
-//
- timer.Stop();
- timer.Print();
-
- if (iTRD) {
- fileSDigits->cd();
- sdTRD->GetParameter()->Write();
- gFileHits->cd();
- }
-
- fileSDigits->Close();
- delete fileSDigits;
- if (!gSameFiles) {
- gFileHits->Close();
- delete gFileHits;
- }
-
-}
-
-
-////////////////////////////////////////////////////////////////////////
-TFile* Init(TString fileNameSDigits, TString fileNameHits) {
-// open input file, read in gAlice, prepare output file
- if (gAlice) delete gAlice;
- gAlice = 0;
-
- Bool_t gSameFiles = kFALSE;
- if (fileNameSDigits == fileNameHits || fileNameSDigits == "") gSameFiles = kTRUE;
-
- TString fileMode = "read";
- if (gSameFiles) fileMode = "update";
-
- gFileHits = TFile::Open(fileNameHits.Data(),fileMode.Data());
- if (!gFileHits->IsOpen()) {
- cerr<<"Can't open "<<fileNameHits.Data()<<" !\n";
- return 0;
- }
- if (!ImportgAlice(gFileHits)) return 0;
- if (!gSameFiles) return gAlice->InitTreeFile("S",fileNameSDigits.Data());
- return gFileHits;
-
-}
-
-////////////////////////////////////////////////////////////////////////
-TFile* OpenFile(TString fileName) {
-// open file fileName
- TFile *file = TFile::Open(fileName.Data());
- if (!file->IsOpen()) {
- cerr<<"Can't open "<<fileName.Data()<<" !\n";
- return 0;
- }
- return file;
-}
-
-////////////////////////////////////////////////////////////////////////
-Bool_t ImportgAlice(TFile *file) {
-// read in gAlice object from the file
- gAlice = (AliRun*)file->Get("gAlice");
- if (!gAlice) return kFALSE;
- return kTRUE;
-}
-////////////////////////////////////////////////////////////////////////
-AliTRDdigitizer *InitTRDdigitizer() {
-// initialization of TRD digitizer
- AliTRDdigitizer *sdTRD = new AliTRDdigitizer("TRDdigitizer"
- ,"TRD digitizer class");
- sdTRD->SetDebug(0);
- sdTRD->SetSDigits(kTRUE);
- AliTRDparameter *TRDparam = new AliTRDparameter("TRDparameter"
- ,"TRD parameter class");
-
- sdTRD->SetParameter(TRDparam);
- sdTRD->InitDetector();
- return sdTRD;
-}
-////////////////////////////////////////////////////////////////////////
-void AliCopy(TFile *inputFile, TFile *outputFile) {
-// copy some objects
-
-// copy gAlice
- if (gDEBUG) cout<<"Copy gAlice: ";
- outputFile->cd();
- gAlice->Write();
- if (gDEBUG) cout<<"done"<<endl;
-
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr<<"No TreeE found "<<endl;
- return;
- }
-
-// copy TreeE
- if (gDEBUG) cout<<"Copy TreeE: ";
- AliHeader *header = new AliHeader();
- treeE->SetBranchAddress("Header", &header);
- treeE->SetBranchStatus("*",1);
- TTree *treeENew = treeE->CloneTree();
- treeENew->Write();
- if (gDEBUG) cout<<"done"<<endl;
-
-// copy AliceGeom
- if (gDEBUG) cout<<"Copy AliceGeom: ";
- TGeometry *AliceGeom = static_cast<TGeometry*>(inputFile->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr<<"AliceGeom was not found in the input file "<<endl;
- return;
- }
- AliceGeom->Write();
- if (gDEBUG) cout<<"done"<<endl;
-
-}
Int_t ntracks = static_cast<Int_t>(hitTree->GetEntries());
for (Int_t track = 0; track < ntracks; track++)
{
- gAlice->ResetHits();
+ gAlice->GetMCApp()->ResetHits();
tofHitsBranch->GetEvent(track);
AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
{
if(nset>=5) break; // check on the number of set analyzed
- gAlice->ResetHits();
+ gAlice->GetMCApp()->ResetHits();
hitTree->GetEvent(track);
AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
#include <Riostream.h>
#include <stdlib.h>
-#include <TBRIK.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
-#include <TNode.h>
#include <TObject.h>
#include <TVirtualMC.h>
#include <Riostream.h>
#include <stdlib.h>
-#include <TBRIK.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
-#include <TNode.h>
#include <TObject.h>
#include <TVirtualMC.h>
#include <Riostream.h>
#include <stdlib.h>
-#include <TBRIK.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
-#include <TNode.h>
#include <TObject.h>
#include <TVirtualMC.h>
#include <Riostream.h>
#include <stdlib.h>
-#include <TBRIK.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
-#include <TNode.h>
#include <TObject.h>
#include <TVirtualMC.h>
#include <Riostream.h>
#include <stdlib.h>
-#include <TBRIK.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
-#include <TNode.h>
#include <TObject.h>
#include <TVirtualMC.h>
#include <Riostream.h>
#include <stdlib.h>
-#include <TBRIK.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
-#include <TNode.h>
#include <TObject.h>
#include <TVirtualMC.h>
// //
///////////////////////////////////////////////////////////////////////////////
-#include "TBRIK.h"
-#include "TGeometry.h"
#include "TLorentzVector.h"
-#include "TNode.h"
#include "TVirtualMC.h"
#include "AliConst.h"
///////////////////////////////////////////////////////////////////////////////
#include "TDirectory.h"
-#include "TBRIK.h"
-#include "TGeometry.h"
#include "TLorentzVector.h"
-#include "TNode.h"
#include "TVirtualMC.h"
#include "TGeoManager.h"
#include <TGeoMatrix.h>
///////////////////////////////////////////////////////////////////////////////
#include "TDirectory.h"
-#include "TBRIK.h"
-#include "TGeometry.h"
#include "TLorentzVector.h"
-#include "TNode.h"
#include "TVirtualMC.h"
#include "TGeoManager.h"
#include <TGeoMatrix.h>
+++ /dev/null
-#ifndef __CINT__
- #include "TView.h"
- #include "TPolyMarker3D.h"
-
-#endif
-
-Int_t DrawROOTTOF() {
- //
- // author: F. Pierella
- // report bug to pierella@bo.infn.it
- //
- // use case
- // generate an event with TOF included
- // start aliroot
- // .x DrawROOTTOF.C
- cerr<<"ROOT TOF Geometry...\n";
- cerr<<"(TRD and TPC are included)\n";
- TFile *file=TFile::Open("galice.root");
- if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
-
- TCanvas *c1=new TCanvas("ddisplay", "TOF display",0,0,700,730);
- TView *v=new TView(1);
- v->SetRange(-430,-560,-430,430,560,1710);
- c1->Clear();
- c1->SetFillColor(10);
- c1->SetTheta(90.);
- c1->SetPhi(0.);
-
-
- //draw TOF with TRD and TPC included
- TGeometry *geom=(TGeometry*)file->Get("AliceGeom");
- TList *list = geom->GetListOfNodes();
- TNode * main = (TNode*)((geom->GetListOfNodes())->First());
- TIter next(main->GetListOfNodes());
- TNode *module=0;
- while((module = (TNode*)next())) {
- char ch[100];
- sprintf(ch,"%s\n",module->GetTitle());
- //printf("%s\n",module->GetTitle());
- if ((ch[0]=='F'&&ch[1]=='T' && ch[2]=='O') || (ch[0]=='T'&&ch[1]=='R' && ch[2]=='D') || (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C')){ //if TOF or TPC or TRD draw
- module->SetVisibility(3);
- }else{
- module->SetVisibility(-1);
- }
- }
-
- c1->cd();
- geom->Draw("same");
- //v->Draw();
- c1->Modified(); c1->Update();
-
- //
- // Draw the geometry using the x3d viewver.
-
- c1->x3d();
- //
- // once in x3d viewer, type m to see the menu.
- // For example typing r will show a solid model of this geometry.
-
- file->Close();
- return 0;
-}
#include <stdlib.h>
#include <TFile.h>
-#include <TGeometry.h>
#include <TInterpreter.h>
#include <TMath.h>
#include <TMatrixF.h>
#include <TVector.h>
-#include <TNode.h>
#include <TObjectTable.h>
#include <TParticle.h>
#include <TROOT.h>
#include <TRandom.h>
#include <TSystem.h>
-#include <TTUBS.h>
#include <TTree.h>
#include <TVirtualMC.h>
#include <TString.h>
// track is returned
//
if(track>=0) {
- gAlice->ResetHits();
+ gAlice->GetMCApp()->ResetHits();
fLoader->TreeH()->GetEvent(track);
}
//
+++ /dev/null
-/****************************************************************************
- * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
- ****************************************************************************/
-
-#ifndef __CINT__
-#include <Riostream.h>
-#include <TFile.h>
-#include <TTree.h>
-#include <TCanvas.h>
-#include <TView.h>
-#include <TPolyMarker3D.h>
-#include <TNode.h>
-#include <TGeometry.h>
-
-#include "AliTPCParam.h"
-#include "AliClusters.h"
-#include "AliTPCcluster.h"
-#endif
-
-Int_t AliTPCDisplayClusters(Int_t eventn=0, Int_t noiseth=15) {
- cerr<<"Displaying clusters...\n";
-
- TFile *file=TFile::Open("galice.root");
- if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
-
- TFile *cf=TFile::Open("AliTPCclusters.root");
- if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;}
-
- AliTPCParam *dig=(AliTPCParam *)cf->Get("75x40_100x60_150x60");
- if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 2;}
-
- TCanvas *c1=new TCanvas("cdisplay", "Cluster display",0,0,700,730);
- TView *v=new TView(1);
- v->SetRange(-430,-560,-430,430,560,1710);
- c1->Clear();
- c1->SetFillColor(1);
- c1->SetTheta(90.);
- c1->SetPhi(0.);
-
- char cname[100];
- sprintf(cname,"TreeC_TPC_%d",eventn);
- TTree *cTree=(TTree *)cf->Get(cname);
- if (!cTree) {
- cerr<<"Can't find tree : "<<cname<<endl;
- return 1;
- }
-
- AliClusters *clusters=new AliClusters();
- clusters->SetClass("AliTPCcluster");
-
- cTree->SetBranchAddress("Segment",&clusters);
-
- Int_t nrows=Int_t(cTree->GetEntries());
- for (Int_t n=0; n<nrows; n++) {
- cTree->GetEvent(n);
- Int_t sec,row;
- dig->AdjustSectorRow(clusters->GetID(),sec,row);
- TClonesArray &clrow=*clusters->GetArray();
- Int_t ncl=clrow.GetEntriesFast();
- TPolyMarker3D *pm=new TPolyMarker3D(ncl);
- while (ncl--) {
- AliTPCcluster *cl=(AliTPCcluster*)clrow[ncl];
- Double_t x=dig->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ();
- if (cl->GetQ()<noiseth) continue;
- Float_t cs, sn, tmp;
- dig->AdjustCosSin(sec,cs,sn);
- tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
- pm->SetPoint(ncl,x,y,z);
- }
- clrow.Clear();
- pm->SetMarkerSize(1); pm->SetMarkerColor(2); pm->SetMarkerStyle(1);
- pm->Draw();
- }
- delete cTree;
- delete dig;
- cf->Close();
-
- TGeometry *geom=(TGeometry*)file->Get("AliceGeom");
- TNode * main = (TNode*)((geom->GetListOfNodes())->First());
- TIter next(main->GetListOfNodes());
- TNode *module=0;
- while((module = (TNode*)next())) {
- char ch[100];
- sprintf(ch,"%s\n",module->GetTitle());
- //printf("%s\n",module->GetTitle());
- if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw
- module->SetVisibility(3);
- else
- module->SetVisibility(-1);
- }
-
-
- geom->Draw("same");
- c1->Modified(); c1->Update();
-
- file->Close();
- return 0;
-}
-
+++ /dev/null
-#if !defined(__CINT__) || defined(__MAKECINT__)
-#include "alles.h"
-#include "AliTPCtracker.h"
-#include "TView3D.h"
-#include "TPolyMarker3D.h"
-#include "AliSimDigits.h"
-#include "AliTPCParam.h"
-#include "AliRunLoader.h"
-#include "AliTPCclusterMI.h"
-#endif
-
-/*
- Author: marian.ivanov@cern.ch
-
- How to use ?
- TGeoManager::Import("geometry.root");
- .L AliTPCDisplayClustersMI.C+
- AliTPCDisplayClusters disp;
- disp.Init(0,0); //specify event number, and threshold for the noise
- disp.DisplayClusters();
-
-*/
-
-
-
-
-class AliTPCDisplayClusters{
-public:
- AliTPCDisplayClusters();
- void SetIO(Int_t event);
- void LoadClusters(Int_t noiseth);
- void DisplayClusters(Int_t first=0, Int_t last=-1);
- void Init(Int_t event, Int_t noiseth){SetIO(event); LoadClusters(noiseth);}
- TObjArray * fArray;
- AliTPCParam * fParam;
- TTree * fTree;
- TGeometry * fGeom;
-};
-
-
-//----------------------------------------------------------------------
-AliTPCDisplayClusters::AliTPCDisplayClusters()
-{
- fArray = 0;
- fParam = 0;
- fTree = 0;
- fGeom = 0;
-}
-//----------------------------------------------------------------------
-void AliTPCDisplayClusters::SetIO(Int_t event)
-{
- AliRunLoader* rl = AliRunLoader::Open();
- rl->GetEvent(event);
- AliLoader* tpcl = (AliLoader*)rl->GetLoader("TPCLoader");
- if (tpcl == 0x0)
- {
- cerr<<"Can not get TPC Loader"<<endl;
- return;
- }
- rl->CdGAFile();
- fParam=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
- fGeom=(TGeometry*)gDirectory->Get("AliceGeom");
- if(!fParam){
- fParam = new AliTPCParamSR();
- fParam->Update();
- }
-
- if (!fParam) {cerr<<"TPC parameters have not been found !\n"; return ;}
- tpcl->LoadRecPoints();
- fTree = tpcl->TreeR();
-
-}
-//----------------------------------------------------------------------
-void AliTPCDisplayClusters::LoadClusters(Int_t noiseth)
-{
- //
- // load all clusters to memory
- if (fArray) {
- fArray->Delete();
- delete fArray;
- }
- fArray = new TObjArray(fParam->GetNSegmentsTotal());
- //
- AliTPCClustersRow * pclrow = new AliTPCClustersRow;
- pclrow->SetClass("AliTPCclusterMI");
- pclrow->SetArray(0);
- TBranch *br = fTree->GetBranch("Segment");
- br->SetAddress(&pclrow);
- //
- //
- Int_t nrows=Int_t(fTree->GetEntries());
- for (Int_t n=0; n<nrows; n++) {
- //
- pclrow = new AliTPCClustersRow;
- pclrow->SetClass("AliTPCclusterMI");
- pclrow->SetArray(0);
- br->SetAddress(&pclrow);
- //
- br->GetEntry(n);
- AliTPCClustersRow &clrow = *pclrow;
- Int_t ncl=clrow.GetArray()->GetEntriesFast();
- TObjArray * arrrow = new TObjArray(0);
- fArray->AddAt(arrrow,pclrow->GetID());
-
- // printf("segment\t%d\trow\t%d\tclusters\t%d",n,pclrow->GetID(),ncl);
- while (ncl--) {
- AliTPCclusterMI *cl=(AliTPCclusterMI*)clrow[ncl];
- if (cl->GetQ()>noiseth){
- arrrow->AddLast(cl);
- }
- }
- // printf("over\t%d\n",arrrow->GetEntries());
-
- }
-}
-
-
-void AliTPCDisplayClusters::DisplayClusters(Int_t first, Int_t last)
-{
- Int_t nrows = fParam->GetNSegmentsTotal();
- // some "constants"
- Int_t markerColorSignal = 5;
- Int_t markerColorBgr = 2;
- Int_t MASK = 10000000;
-
- TCanvas *c1=new TCanvas("cdisplay", "Cluster display",0,0,700,730);
- TView3D *v=new TView3D();
- v->SetRange(-330,-360,-330,360,360,1710);
- c1->Clear();
- c1->SetFillColor(1);
- c1->SetTheta(90.);
- c1->SetPhi(0.);
-
- for (Int_t irow=0; irow<nrows; irow++) {
-
- TObjArray * arr = (TObjArray*)fArray->At(irow);
- if (!arr) continue;
-
- Int_t sec,row;
- fParam->AdjustSectorRow(irow,sec,row);
- Int_t ncl=arr->GetEntriesFast();
-
- TPolyMarker3D *pm=new TPolyMarker3D(ncl);
- TPolyMarker3D *pmSignal=new TPolyMarker3D(ncl); // polymarker for signal
- Int_t imarBgr=0;
- Int_t imarSignal=0;
-
- while (ncl--) {
- AliTPCclusterMI *cl=(AliTPCclusterMI*)arr->At(ncl);
- if (cl){
- //
- Double_t x=fParam->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ();
- Float_t cs, sn, tmp;
- fParam->AdjustCosSin(sec,cs,sn);
- tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
- Float_t clxyz[3];
- cl->GetGlobalXYZ(clxyz);
-
- Int_t trackId = cl->GetLabel(0);
- if ( (last>0) &&trackId>last) continue;
- if (trackId<first) continue;
- if (trackId < MASK-1) {
- pmSignal->SetPoint(imarSignal,clxyz[0],clxyz[1],clxyz[2]);
- imarSignal++;
- } else {
- pm->SetPoint(imarBgr,clxyz[0],clxyz[1],clxyz[2]);
- imarBgr++;
- }
- }
- }
-
- // change color for signal
- pm->SetMarkerSize(1);
- pm->SetMarkerColor(markerColorBgr);
- pm->SetMarkerStyle(1);
- pm->Draw();
-
- pmSignal->SetMarkerSize(1);
- pmSignal->SetMarkerColor(markerColorSignal);
- pmSignal->SetMarkerStyle(1);
- pmSignal->Draw();
- }
-
-
- // TNode * main = (TNode*)((fGeom->GetListOfNodes())->First());
-// TIter next(main->GetListOfNodes());
-// TNode *module=0;
-// while((module = (TNode*)next())) {
-// char ch[100];
-// sprintf(ch,"%s\n",module->GetTitle());
-// //printf("%s\n",module->GetTitle());
-// if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw
-// module->SetVisibility(3);
-// else
-// module->SetVisibility(-1);
-// }
-
-
-// fGeom->Draw("same");
- c1->Modified(); c1->Update();
-
-
-
-}
+++ /dev/null
-#ifndef __CINT__
- #include "alles.h"
- #include "AliTPCtracker.h"
- #include "TView.h"
- #include "TPolyMarker3D.h"
-
-#endif
-Int_t AliTPCDisplayDigits3D(Int_t eventn=0, Int_t noiseth=15) {
- cerr<<"Displaying digits...\n";
-
- TFile *file=TFile::Open("galice.root");
- if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
-
- TFile *cf=TFile::Open("galice.root");
- // if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;}
-
- AliTPCParam *param=(AliTPCParam *)cf->Get("75x40_100x60");
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;}
-
- TCanvas *c1=new TCanvas("ddisplay", "Digits display",0,0,700,730);
- TView *v=new TView(1);
- v->SetRange(-430,-560,-430,430,560,1710);
- c1->Clear();
- c1->SetFillColor(1);
- c1->SetTheta(90.);
- c1->SetPhi(0.);
-
- AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
- digarr->Setup(param);
- char cname[100];
- sprintf(cname,"TreeD_75x40_100x60_%d",eventn);
-
- digarr->ConnectTree(cname);
- Int_t nrows=Int_t(digarr->GetTree()->GetEntries());
- for (Int_t n=0; n<nrows; n++) {
- AliSimDigits *s=(AliSimDigits*)digarr->LoadEntry(n);
- Int_t sec,row;
- param->AdjustSectorRow(s->GetID(),sec,row);
- Int_t npads, sign;
- {
- const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector();
- if (sec < kNIS) {
- npads = param->GetNPadsLow(row);
- sign = (sec < kNIS/2) ? 1 : -1;
- } else {
- npads = param->GetNPadsUp(row);
- sign = ((sec-kNIS) < kNOS/2) ? 1 : -1;
- }
- }
-
- AliSimDigits *digrow = (AliSimDigits*)digarr->GetRow(sec,row);
- Int_t ncl=0;
- if (digrow->First()){
- while(digrow->Next()) ncl++;
- ncl++;
- }
- TPolyMarker3D *pm=new TPolyMarker3D(ncl);
- digrow->First();
- Int_t imar=0;
- do {
- Short_t dig=digrow->CurrentDigit();
- Double_t y = (digrow->CurrentColumn()- 0.5 - 0.5*npads)*param->GetPadPitchWidth(sec);
- Double_t z = sign*(param->GetZLength()-param->GetZWidth()*digrow->CurrentRow());
- Double_t x=param->GetPadRowRadii(sec,row);
- if (dig<noiseth) continue;
- Float_t cs, sn, tmp;
- param->AdjustCosSin(sec,cs,sn);
- tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
- pm->SetPoint(imar,x,y,z);
- imar++;
- } while (digrow->Next());
- digarr->ClearRow(sec,row);
- pm->SetMarkerSize(1); pm->SetMarkerColor(2); pm->SetMarkerStyle(1);
- pm->Draw();
- }
- delete digarr;
- cf->Close();
- //draw TPC
- TGeometry *geom=(TGeometry*)file->Get("AliceGeom");
- TList *list = geom->GetListOfNodes();
- TNode * main = (TNode*)((geom->GetListOfNodes())->First());
- TIter next(main->GetListOfNodes());
- TNode *module=0;
- while((module = (TNode*)next())) {
- char ch[100];
- sprintf(ch,"%s\n",module->GetTitle());
- //printf("%s\n",module->GetTitle());
- if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw
- module->SetVisibility(3);
- else
- module->SetVisibility(-1);
- }
-
-
- geom->Draw("same");
- //v->Draw();
- c1->Modified(); c1->Update();
-
- file->Close();
- return 0;
-}
-
+++ /dev/null
-#ifndef __CINT__
- #include "alles.h"
- #include "AliTPCtracker.h"
- #include "TView.h"
- #include "TPolyMarker3D.h"
- #include "AliSimDigits.h"
- #include "AliRunLoader.h"
- #include "AliLoader.h"
- #include "AliTPCParamSR.h"
-#endif
-
-//
-// display 3D digits
-// input parameter is event number - threshol to the noise
-// if sdigits=kTRUE it will display Sdigits - otherwise it display digits
-// signal event is displayed with yellow color
-
-Int_t AliTPCDisplayDigits3Dnew(Int_t eventn=0, Int_t noiseth=15, Bool_t sdigits=kFALSE) {
- cerr<<"Displaying digits...\n";
-
-// TFile *file=TFile::Open("galice.root");
-// if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
-
-// TFile *cf=TFile::Open("galice.root");
-// if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;}
-
- AliRunLoader* rl = AliRunLoader::Open();
- rl->GetEvent(eventn);
-
- AliLoader* tpcl = (AliLoader*)rl->GetLoader("TPCLoader");
- if (tpcl == 0x0)
- {
- cerr<<"Can not get TPC Loader"<<endl;
- return 1;
- }
-
- rl->CdGAFile();
- AliTPCParam *param=(AliTPCParam *)gDirectory->Get("75x40_100x60");
- if(param){
- cerr<<"2 pad-length geom hits with 3 pad-lengths geom parameters\n";
- delete param;
- param = new AliTPCParamSR();
- }
- else
- {
- param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
- }
-
- if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;}
-
- TCanvas *c1=new TCanvas("ddisplay", "Digits display",0,0,700,730);
- TView *v=new TView(1);
- v->SetRange(-430,-560,-430,430,560,1710);
- c1->Clear();
- c1->SetFillColor(1);
- c1->SetTheta(90.);
- c1->SetPhi(0.);
-
- AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
- digarr->Setup(param);
-
-
- TTree* tree;
-
- char cname[100];
- if (!sdigits)
- {
- tpcl->LoadDigits();
- tree = tpcl->TreeD();
- }
- else
- {
- tpcl->LoadSDigits();
- tree = tpcl->TreeS();
- }
-
-// some "constants"
- Int_t markerColorSignal = 5;
- Int_t markerColorBgr = 2;
- Int_t MASK = 10000000;
-
- Int_t imarBgr=0;
- Int_t imarSignal=0;
- Int_t ncl=0;
-
- digarr->ConnectTree(tree);
-
- Int_t nrows=Int_t(digarr->GetTree()->GetEntries());
- Int_t all0=0;
- for (Int_t n=0; n<nrows; n++) {
- AliSimDigits *s=(AliSimDigits*)digarr->LoadEntry(n);
- Int_t sec,row;
- param->AdjustSectorRow(s->GetID(),sec,row);
- Int_t npads, sign;
- {
- const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector();
- if (sec < kNIS) {
- npads = param->GetNPadsLow(row);
- sign = (sec < kNIS/2) ? 1 : -1;
- } else {
- npads = param->GetNPadsUp(row);
- sign = ((sec-kNIS) < kNOS/2) ? 1 : -1;
- }
- }
-
- AliSimDigits *digrow = (AliSimDigits*)digarr->GetRow(sec,row);
- ncl=0;
- if (digrow->First()){
- while(digrow->Next()) ncl++;
- ncl++;
- }
- TPolyMarker3D *pm=new TPolyMarker3D(ncl);
- TPolyMarker3D *pmSignal=new TPolyMarker3D(ncl); // polymarker for signal
- imarBgr=0;
- imarSignal=0;
- if (digrow->First()) do {
- Short_t dig=digrow->CurrentDigit();
- Double_t y = (digrow->CurrentColumn()- 0.5 - 0.5*npads)*param->GetPadPitchWidth(sec);
- Double_t z = sign*(param->GetZLength()-param->GetZWidth()*digrow->CurrentRow());
- Double_t x=param->GetPadRowRadii(sec,row);
-// cout<<dig<<endl;
- if (dig<noiseth) continue;
-// cout<<"\nAbove noise Threshold";
- Int_t trackId = digrow->GetTrackID(digrow->CurrentRow(),digrow->CurrentColumn(),0);
- Float_t cs, sn, tmp;
- param->AdjustCosSin(sec,cs,sn);
- tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
- if (trackId<0) continue; //if signal from croostalk - we don't have track ID information
-// cout<<"Track ID > 0";
- if (trackId < MASK-1) {
- pmSignal->SetPoint(imarSignal,x,y,z);
- imarSignal++;
- } else {
- pm->SetPoint(imarBgr,x,y,z);
- imarBgr++;
- }
- } while (digrow->Next());
-
-// change color for signal
- digarr->ClearRow(sec,row);
- pm->SetMarkerSize(1);
- pm->SetMarkerColor(markerColorBgr);
- pm->SetMarkerStyle(1);
- pm->Draw();
-
- pmSignal->SetMarkerSize(1);
- pmSignal->SetMarkerColor(markerColorSignal);
- pmSignal->SetMarkerStyle(1);
- pmSignal->Draw();
- all0+=imarSignal;
-// cout<<"imarSignal ="<<imarSignal<<" imarBgr ="<<imarBgr<<" ncl ="<<ncl<<endl;
- }
- printf("%d\n",all0);
-
-
-
- delete digarr;
-
- //draw TPC skeleton
- rl->CdGAFile();
- TGeometry *geom=(TGeometry*)gDirectory->Get("AliceGeom");
- TNode * main = (TNode*)((geom->GetListOfNodes())->First());
- TIter next(main->GetListOfNodes());
- TNode *module=0;
- while((module = (TNode*)next())) {
- char ch[100];
- sprintf(ch,"%s\n",module->GetTitle());
- //printf("%s\n",module->GetTitle());
- if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw
- module->SetVisibility(3);
- else
- module->SetVisibility(-1);
- }
-
-
- geom->Draw("same");
- //v->Draw();
- c1->Modified(); c1->Update();
-
- delete rl;
- return 0;
-}
-
#include <Riostream.h>
-#include <TGeometry.h>
#include <TMath.h>
-#include <TNode.h>
-#include <TTUBE.h>
#include <TVirtualMC.h>
#include <TString.h>
#include <TSystem.h>
#include <Riostream.h>
#include <stdlib.h>
-#include <TBRIK.h>
-#include <TGeometry.h>
#include <TInterpreter.h>
#include <TMath.h>
-#include <TNode.h>
-#include <TTUBE.h>
#include <TVirtualMC.h>
#include <TString.h>
#include <TSystem.h>
#include <TRandom.h>
#include <TVector.h>
#include <TMatrix.h>
-#include <TGeometry.h>
-#include <TNode.h>
-#include <TTUBS.h>
#include <TObjectTable.h>
#include <Riostream.h>
#include <TFile.h>
#include <TClonesArray.h>
#include <TFile.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
-#include <TPGON.h>
#include <TParticle.h>
#include <TROOT.h>
#include <TTree.h>
#include <TTask.h>
#include <TGeoManager.h>
#include "AliRun.h"
+#include "AliMC.h"
#include "AliRunLoader.h"
#include "AliLoader.h"
#include "AliConfig.h"
// Loop through all the tracks in the tree
for (Int_t iTrk = 0; iTrk < nTrk; iTrk++) {
- gAlice->ResetHits();
+ gAlice->GetMCApp()->ResetHits();
hitTree->GetEvent(iTrk);
if (!fTRD->Hits()) {
// --- ROOT libraries ---
#include <TClonesArray.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
#include <TObjectTable.h>
-#include <TTUBE.h>
-#include <TTUBS.h>
#include <TVirtualMC.h>
#include <TParticle.h>
// --- ROOT libraries ---
#include <TClonesArray.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
#include <TObjectTable.h>
-#include <TTUBE.h>
-#include <TTUBS.h>
#include <TVirtualMC.h>
#include <TParticle.h>
// --- ROOT libraries ---
#include <TClonesArray.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
#include <TObjectTable.h>
-#include <TTUBE.h>
-#include <TTUBS.h>
#include <TVirtualMC.h>
#include <TParticle.h>
// --- ROOT libraries ---
#include <TClonesArray.h>
-#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
#include <TObjectTable.h>
-#include <TTUBE.h>
-#include <TTUBS.h>
#include <TVirtualMC.h>
#include <TParticle.h>
///////////////////////////////////////////////////////////////////////////////
// --- ROOT system
-#include <TBRIK.h>
#include <TClonesArray.h>
-#include <TGeometry.h>
-#include <TNode.h>
#include <TTree.h>
#include <TFile.h>
#include <TSystem.h>
#include "stdio.h"
// --- ROOT system
-#include <TBRIK.h>
#include <TLorentzVector.h>
#include <TMath.h>
-#include <TNode.h>
#include <TRandom.h>
#include <TSystem.h>
#include <TTree.h>
#include "stdio.h"
// --- ROOT system
-#include <TBRIK.h>
#include <TMath.h>
-#include <TNode.h>
#include <TRandom.h>
#include <TSystem.h>
#include <TTree.h>
#include "stdio.h"
// --- ROOT system
-#include <TBRIK.h>
#include <TMath.h>
-#include <TNode.h>
#include <TRandom.h>
#include <TSystem.h>
#include <TTree.h>
// VOLUMES DEFINITION
// Volume: ZDCC
TGeoVolume *pZDCC = gGeoManager->GetVolume("ZDCC");
- //pZDCC->PrintNodes();
conpar[0] = (90.1-0.95-0.26)/2.;
conpar[1] = 0.0/2.;
// VOLUMES DEFINITION
// Volume: ZDCA
TGeoVolume *pZDCA = gGeoManager->GetVolume("ZDCA");
- //pZDCA->PrintNodes();
conpar[0] = (90.1-0.95-0.26)/2.;
conpar[1] = 0.0/2.;
#include "TStopwatch.h"
#include "TArrayF.h"
#include "TSystem.h"
-#include "TGeometry.h"
#include "TInterpreter.h"
// --- AliRoot header files ---
treeENew->Write();
if (fDEBUG) cout<<"done"<<endl;
-// copy AliceGeom
- if (fDEBUG) cout<<"Copy AliceGeom: ";
- TGeometry *AliceGeom = static_cast<TGeometry*>(inputFile->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr<<"AliceGeom was not found in the input file "<<endl;
- return kFALSE;
- }
- AliceGeom->Write();
- if (fDEBUG) cout<<"done"<<endl;
-
delete gAlice;
gAlice = 0;
rl->WriteHeader("OVERWRITE");
infile->cd();
- TGeometry* geo = inAliRun->GetGeometry();
rl->CdGAFile();
- geo->Write();
rl->WriteAliRun();
rl->WriteRunLoader();