+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-2000, 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. *
- **************************************************************************/
-//Piotr.Skowronski@cern.ch
-//Fast fixes to be able to compile with new Folder and I/O structure
-//To be implemented correctly by the responsible person
-
-//PH 20/05/2003 It seems this class is obsolete and not used anymore
-
-/* $Id$ */
-
-#include "AliFMDMerger.h"
-
-
-#include <TTree.h>
-#include <TVector.h>
-#include <TObjArray.h>
-#include <TFile.h>
-#include <TDirectory.h>
-
-#include "AliDetector.h"
-#include "AliRunLoader.h"
-#include "AliLoader.h"
-
-#include "AliFMD.h"
-#include "AliFMDSDigitizer.h"
-#include "AliFMDhit.h"
-#include "AliFMDdigit.h"
-
-#include "AliRun.h"
-#include "AliPDG.h"
-
-#include <stdlib.h>
-#include <Riostream.h>
-#include <Riostream.h>
-
-ClassImp(AliFMDMerger)
-
-//___________________________________________
- AliFMDMerger::AliFMDMerger()
-{
-// Default constructor
- fEvNrSig = 0;
- fEvNrBgr = 0;
- fBgrLoader = 0x0;
- fSigLoader = 0x0;
- fMerge = kDigitize;
- fDigits = 0;
- fSDigits = 0;
- fFnBgr = 0;
- fFnSig = 0;
- fBgrFile = 0;
-}
-
-//------------------------------------------------------------------------
-AliFMDMerger::~AliFMDMerger()
-{
-// Destructor
- if(fSDigits) {
- fSDigits->Delete();
- delete fSDigits ;
- fSDigits = 0;
- }
-}
-
-
-//---------------------------------------------------------------------
-void AliFMDMerger::SetRingsSi1(Int_t ringsSi1)
-{
- fRingsSi1=ringsSi1;
-}
-void AliFMDMerger::SetSectorsSi1(Int_t sectorsSi1)
-{
- fSectorsSi1=sectorsSi1;
-}
-void AliFMDMerger::SetRingsSi2(Int_t ringsSi2)
-{
- fRingsSi2=ringsSi2;
-}
-void AliFMDMerger::SetSectorsSi2(Int_t sectorsSi2)
-{
- fSectorsSi2=sectorsSi2;
-}
-//---------------------------------------------------------------------
-
-//------------------------------------------------------------------------
-void AliFMDMerger::Init()
-{
-// Initialisation
- if (fMerge) fBgrFile = InitBgr();
-}
-
-
-
-//------------------------------------------------------------------------
-TFile* AliFMDMerger::InitBgr()
-{
-// Initialise background event
- fBgrLoader= AliRunLoader::Open(fFnBgr);
- TFile *file = TFile::Open(fFnBgr);
-// add error checking later
- printf("\n AliFMDMerger has opened %s file with background event \n", fFnBgr);
- return file;
-}
-
-//------------------------------------------------------------------------
-void AliFMDMerger::Digitise()
-{
-
- // keep galice.root for signal and name differently the file for
- // background when add! otherwise the track info for signal will be lost !
-
-
-
-#ifdef DEBUG
- cout<<"ALiFMDMerger::>SDigits2Digits start...\n";
-#endif
- if (fBgrLoader == 0x0)
- {
- cerr<<"AliFMDMerger::Digitise : Background Run Loader is NULL"<<endl;
- return;
- }
-
- fBgrLoader->LoadgAlice();
- fBgrLoader->LoadHeader();
- fBgrLoader->LoadKinematics();
-
- AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ;
-
- Int_t chargeSum[10][30][150];
- Int_t digit[5];
- Int_t ivol, iSector, iRing;
-
- Int_t NumberOfRings[5]=
- {fRingsSi1,fRingsSi2,fRingsSi1,fRingsSi2,fRingsSi1};
- Int_t NumberOfSectors[5]=
- {fSectorsSi1,fSectorsSi2,fSectorsSi1,fSectorsSi2,fSectorsSi1};
-
- TFile *f1 =0;
- TTree *TK = fBgrLoader->TreeK();
- if (TK) f1 = TK->GetCurrentFile();
-
- //just patches to be able to compile
-
-
- fBgrLoader->GetEvent(fEvNrSig) ;
- AliLoader* loader = fBgrLoader->GetLoader("FMDLoader");
- if (loader == 0x0)
- {
- cerr<<"AliFMDMerger::Digitise : Can not find loader for FMD. Exiting"<<endl;
- return;
- }
-
- Int_t retval;
- retval = loader->LoadDigits("UPDATE");
- if (retval == 0x0)
- {
- cerr<<"AliFMDMerger::Digitise : Error occured while loading digits. Exiting"<<endl;
- return;
- }
-
- if(loader->TreeD() == 0)
- loader->MakeTree("D") ;
-
- loader->TreeD()->Reset();
-
- //Make branches
- ReadDigit( chargeSum, fEvNrSig);
-
- if(fMerge){
-// fBgrFile->cd();
- // gAlice->TreeS()->Reset();
- gAlice = fBgrLoader->GetAliRun();
- Int_t chargeBgr[10][30][150];
- ReadDigit( chargeBgr,fEvNrBgr);
- for ( ivol=1; ivol<=5; ivol++)
- for ( iSector=1; iSector<=NumberOfSectors[ivol-1]; iSector++)
- for ( iRing=1; iRing<=NumberOfRings[ivol-1]; iRing++)
- chargeSum[ivol][iSector][iRing]=
- chargeBgr[ivol][iSector][iRing]+
- chargeSum[ivol][iSector][iRing];
-
- } //if merge
-
-
- // Put noise and make ADC signal
- for ( ivol=1; ivol<=5; ivol++){
- for ( iSector=1; iSector<=NumberOfSectors[ivol-1]; iSector++){
- for ( iRing=1; iRing<=NumberOfRings[ivol-1]; iRing++){
- digit[0]=ivol;
- digit[1]=iSector;
- digit[2]=iRing;
- digit[3]=PutNoise(chargeSum[ivol][iSector][iRing]);
- if(chargeSum[ivol][iSector][iRing] <= 500) digit[3]=500;
-
- //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV)
- //1024 ADC channels
- Float_t channelWidth=(22400*50)/1024;
- digit[4]=Int_t(digit[3]/channelWidth);
- if (digit[4]>1024) digit[4]=1024;
-
- FMD->AddDigit(digit);
-
- } //ivol
- } //iSector
- } //iRing
-
- f1->cd();
-
- //Make branch for digits
- FMD->MakeBranch("D");
-
- loader->TreeD()->Reset();
- loader->TreeD()->Fill();
-
- fDigits = FMD->Digits();//should be moved to specialized loader (AliFMDLoader)
-
- loader->WriteDigits("OVERWRITE");
-
- gAlice->ResetDigits();
-
-}
-
-//---------------------------------------------------------------------
-
-void AliFMDMerger::ReadDigit(Int_t chargeSum[][30][150], Int_t iEvNum)
-{
- AliFMDdigit *fmddigit;
-
- for (Int_t i=0; i<10; i++)
- for(Int_t j=0; j<30; j++)
- for(Int_t ij=0; ij<150; ij++)
- chargeSum[i][j][ij]=0;
-
- AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ;
-
- gAlice->GetEvent(iEvNum) ;
- if(gAlice->TreeS()==0) {
- cout<<" TreeS==0 -> return"<<gAlice->TreeS()<<endl;
- return ;}
-
- Int_t ndig, k;
- gAlice->ResetDigits();
- gAlice->TreeS()->GetEvent(iEvNum);
- TClonesArray * FMDdigits = FMD->SDigits();
-
- ndig=FMDdigits->GetEntries();
-
- for (k=0; k<ndig; k++) {
- fmddigit= (AliFMDdigit*) FMDdigits->UncheckedAt(k);
-
- Int_t iVolume=fmddigit->Volume();
- Int_t iNumberOfSector =fmddigit->NumberOfSector();
- Int_t iNumberOfRing=fmddigit->NumberOfRing();
- chargeSum[iVolume][iNumberOfSector][iNumberOfRing]=fmddigit->Charge();
- }
-}
-
-
+++ /dev/null
-#ifndef ALIFMDMERGER_H
-#define ALIFMDMERGER_H
-/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-// #include "AliMerger.h"
-// #include "AliMergable.h"
-#include "TRandom.h"
-
-
-
-class AliRunLoader;
-class TClonesArray;
-class TFile;
-
-typedef enum {kDigitize=0, kMerge = 1} MergeMode_t;
-
-class AliFMDMerger {
- public:
-
- AliFMDMerger();
- virtual ~AliFMDMerger();
-
-
- // Initialize merging and digitisation
- virtual void Init();
-
- // Do the main work
- void Digitise() ;
- Int_t PutNoise(Int_t charge){return (Int_t)(gRandom->Gaus(charge,500));}
- TClonesArray *SDigits() const {return fSDigits;}
-
- void ReadDigit(Int_t a[][30][150], Int_t);
-
- // Setters -> Later Communication with gAlice
- void SetSignalEventNumber(Int_t i) {fEvNrSig = i;}
- void SetBackgroundEventNumber(Int_t i) {fEvNrBgr = i;}
- void SetBackgroundFileName(char* file) {fFnBgr = file;}
- void SetSignalFileName(char* file) {fFnSig = file;}
- void SetMode(MergeMode_t mode) {fMerge = mode;}
-
- // Granularity
- virtual void SetRingsSi1(Int_t ringsSi1);
- virtual void SetSectorsSi1(Int_t sectorsSi1);
- virtual void SetRingsSi2(Int_t ringsSi2);
- virtual void SetSectorsSi2(Int_t sectorsSi2);
-
- enum {kBgTag = -1};
-
- private:
- // Open the bgr file
- TFile *InitBgr();
- //Granularity
- Int_t fRingsSi1; // Number of rings
- Int_t fSectorsSi1; // Number of sectors
- Int_t fRingsSi2; // Number of rings
- Int_t fSectorsSi2; // Number of sectors
-
- private:
- TClonesArray *fDigits; // ! array with digits
- TClonesArray *fSDigits ; // List of summable digits
- Int_t fEvNrSig; // signal event number
- Int_t fEvNrBgr; // background event number
- MergeMode_t fMerge; // merging type kDigitize, kMerge
- char *fFnBgr; // background file name
- char *fFnSig; // signal file name
- TFile *fBgrFile; // Pointer to background file
-
- AliRunLoader* fBgrLoader; //! Background event run loader
- AliRunLoader* fSigLoader; //! Signal event run loader
-
- ClassDef(AliFMDMerger,0)
-};
-#endif
-
+++ /dev/null
-#ifndef ALIFMDV2_H
-#define ALIFMDV2_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-///////////////////////////////////////////////
-// Manager and hits classes for set:FMD //
-////////////////////////////////////////////////
-
-#include "AliFMD.h"
-
-class AliFMDv2 : public AliFMD {
-
-public:
- AliFMDv2() {};
- AliFMDv2(const char *name, const char *title);
- virtual ~AliFMDv2() {}
- virtual void CreateGeometry();
- virtual void CreateMaterials();
- virtual void DrawDetector();
- virtual void Init();
- virtual Int_t IsVersion() const {return 1;}
- virtual void StepManager();
- // virtual void Hit2Digits(Int_t bgrEvent, Option_t *opt1=" ",
- // Option_t *opt2=" ",Text_t *name=" "); // hit to digit for v1 :test
- virtual void Response( Float_t Edep);
-//private:
- //Int_t fCharge;
-
-
-protected:
- Int_t fIdSens1; // Sensetive volume in FMD
- Int_t fIdSens2; // Sensetive volume in FMD
- Int_t fIdSens3; // Sensetive volume in FMD
- Int_t fIdSens4; // Sensetive volume in FMD
- Int_t fIdSens5; // Sensetive volume in FMD
-
-// Background event for event mixing
-
- ClassDef(AliFMDv2,2) //Class for FMD version 0
-};
-
-#endif
-
-
+++ /dev/null
-void FMDReconstruction (Int_t evNumber=1)
-{
- if (gClassTable->GetID("AliRun") < 0)
- {
- gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
- loadlibs();
- }
- if (gSystem->Getenv("CONFIG_SPLIT_FILE"))
- cout << "SPLIT" << endl;
- else
- cout << "NO SPLIT" << endl ;
- TFile * f = new TFile("mgalice.root","UPDATE");
- gAlice = (AliRun*) f->Get("gAlice") ;
- cout<<"gAlice="<<gAlice<<endl;
- AliFMD* FMD = (AliFMD *)gAlice->GetDetector("FMD");
- cout<<"\nFMD="<<FMD<<endl;
- gAlice->RunReco("FMD") ;
-}
-
+++ /dev/null
-void Hits2SDigits(){
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
- loadlibs();
- }
- // gSystem->Setenv("CONFIG_SPLIT_FILE","1") ;
- if (gSystem->Getenv("CONFIG_SPLIT_FILE"))
- cout << "SPLIT" << endl;
- else
- cout << "NO SPLIT" << endl ;
- TFile * f = new TFile("galice.root","UPDATE");
- gAlice = (AliRun*) f->Get("gAlice") ;
- AliFMD* FMD = (AliFMD *)gAlice->GetDetector("FMD") ;
- gAlice->GetEvent(0);
- gAlice->Hits2SDigits("FMD") ;
- gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
- }
+++ /dev/null
-void TestReconstruction (Int_t vol=1, const Int_t nRings=128, const Int_t nSectors=20)
-{
- // Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0)
- {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- }
- // Connect the Root Galice file containing Geometry, Kine and Hits
- char filename[]="galice.root";
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
- if (!file) file = new TFile(filename);
- // Get AliRun object from file or create it if not on file
- if (!gAlice)
- {
- gAlice = (AliRun*)file->Get("gAlice");
- if (gAlice) printf("\nAliRun object found on file\n");
- if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- }
- Int_t nbytes = 0;
- Int_t ipart;
- Int_t volume;
- Int_t np[nRings][nSectors];
-
-
- for (int i=0;i<nRings;i++)
- for(int j=0;j<nSectors;j++)
- np[i][j]=0;
-
- TH1F *hNReal = new TH1F("hNReal","Real number of particles",50,0,50);
- TH1F *hNRec = new TH1F("hNRec ","Reconst. number of particles",50,0,50);
-
- Int_t nparticles = gAlice->GetEvent(0);
- if (nparticles <= 0) return;
- printf("\nnparticles=%d\n",nparticles);
-
- gAlice->TreeR()->GetEvent(0);
- AliFMD *FMD = (AliFMD*)gAlice->GetDetector("FMD");
- TClonesArray *Particles = gAlice->Particles();
- TParticle *particle;
- AliFMDhit *fmdHit;
- AliFMDReconstParticles *fmdRP;
- if (FMD)
- {
- TClonesArray *FMDhits = FMD->Hits();
- TClonesArray *FMDrec = FMD->ReconParticles();
- TTree *TH = gAlice->TreeH();
- Int_t ntracks = TH->GetEntries();
- if (ntracks<=0) return;
-
- Int_t nPads=FMDrec->GetEntries();
-
-
-#ifdef DEBUG
- cout<<"\n(AliFMDReconstParticles*)FMDrec->UncheckedAt(0)="<<(AliFMDReconstParticles*)FMDrec->UncheckedAt(0);
- cout<<"\nFMDrec->UncheckedAt(0)="<<FMDrec->UncheckedAt(0);
-#endif
-
- for (Int_t track=0; track<ntracks;track++)
- {
- gAlice->ResetHits();
- nbytes += TH->GetEvent(track);//?
- particle=(TParticle*)Particles->UncheckedAt(track);
- // Int_t numpart=particle->GetKF();
- //Float_t eta=particle->GetEta();
-
- Int_t nhits=FMDhits->GetEntriesFast();
- for (Int_t hit=0;hit<nhits;hit++)
- {
- fmdHit = (AliFMDhit*)FMDhits->UncheckedAt(hit);
- volume=fmdHit->Volume();
- if(volume==vol)
- {
- np[fmdHit->NumberOfRing()-1][fmdHit->NumberOfSector()-1]++;
- }
- }
- }
- //Int_t nRecPart=FMDrec->GetEntriesFast();
- Int_t nDeterm=0; Int_t nReal=0;
- for (Int_t pad=0;pad<nPads;pad++)
- {
- fmdRP = (AliFMDReconstParticles*)FMDrec->UncheckedAt(pad);
- volume=fmdRP->GetVolume();
- if(volume==vol)
- {
-;
-#ifdef DEBUG
- fmdDigit = (AliFMDdigit*)FMDdig->UncheckedAt(pad);
- cout<<"\nfmdDigit->ADCsignal()="<<fmdDigit->ADCsignal();
- cout<<"\nfmdDigit->NumberOfRing()="<<fmdDigit->NumberOfRing();
- cout<<"\nfmdDigit->NumberOfSector()="<<fmdDigit->NumberOfSector();
-#endif
- nDeterm+=fmdRP->GetNumberOfReconstParticles();
- nReal+=np[fmdRP->GetNumberOfRing()-1][fmdRP->GetNumberOfSector()-1]; //-1=?
- Int_t RecRing=fmdRP->GetNumberOfRing()-1;
- Int_t RecSector=fmdRP->GetNumberOfSector()-1;
- hNReal->Fill(np[RecRing][RecSector]);
- hNRec->Fill(fmdRP->GetNumberOfReconstParticles());
- }
- }
- }
- cout<<"\nReal="<<nReal<<
- " nDeterm="<<nDeterm<<
- "\nerror="<<float(nDeterm-nReal)/float(nReal)<<endl;
-
-
- TCanvas *c1 = new TCanvas("c1","Alice FMD ",400,10,800,800);
- hNReal->SetFillColor(2);
- hNReal->Draw();
- hNRec->SetFillColor(4);
- hNRec->Draw("same");
-
-}
-
-
-
-
-
-