+++ /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. *
- **************************************************************************/
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// A singleton. This class should be used in the analysis stage to get
-// reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
-// instead of directly reading them from galice.root file. This container
-// ensures, that one reads Digits, made of these particular digits, RecPoints,
-// made of these particular RecPoints, TrackSegments and RecParticles.
-// This becomes non trivial if there are several identical branches, produced with
-// different set of parameters.
-//
-// An example of how to use (see also class AliEMCALAnalyser):
-// AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
-// for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
-// AliEMCALRecParticle * part = gime->RecParticle(1) ;
-// ................
-// gime->Event(event) ; // reads new event from galice.root
-//
-//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
-//*-- Completely redesigned by Dmitri Peressounko March 2001
-//
-//*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
-//*-- systematic usage of TFolders without changing the interface
-//////////////////////////////////////////////////////////////////////////////
-
-// --- ROOT system ---
-
-#include <TFile.h>
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TF1.h>
-#include <TGraph.h>
-//#include <TCanvas.h>
-//#include <TFrame.h>
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-#include "AliEMCAL.h"
-#include "AliEMCALGetter.h"
-#include "AliEMCALLoader.h"
-#include "AliHeader.h"
-#include "AliMC.h"
-#include "AliRunLoader.h"
-#include "AliStack.h"
-#include "AliEMCALRawStream.h"
-#include "AliRawReaderFile.h"
-
-ClassImp(AliEMCALGetter)
-
-AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
-AliEMCALLoader * AliEMCALGetter::fgEmcalLoader = 0;
-Int_t AliEMCALGetter::fgDebug = 0;
-
-// TFile * AliEMCALGetter::fgFile = 0 ;
-
-//____________________________________________________________________________
-AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* version, Option_t * openingOption) {
- AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ;
- if (!rl) {
- rl = AliRunLoader::Open(headerFile, version, openingOption);
- if (!rl) {
- Fatal("AliEMCALGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ;
- return ;
- }
- if (rl->GetAliRun() == 0x0) {
- rl->LoadgAlice();
- gAlice = rl->GetAliRun(); // should be removed
- }
- }
- fgEmcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetLoader("EMCALLoader"));
- if ( !fgEmcalLoader )
- Error("AliEMCALGetter", "Could not find EMCALLoader") ;
- else
- fgEmcalLoader->SetTitle(version);
-
- // initialize data members
- SetDebug(0) ;
- fLoadingStatus = "" ;
-
-}
-
-//____________________________________________________________________________
-AliEMCALGetter::~AliEMCALGetter()
-{
- if (fgEmcalLoader) {
- delete fgEmcalLoader;
- fgEmcalLoader = 0 ;
- }
- fgObjGetter = 0;
-}
-
-
-//____________________________________________________________________________
-void AliEMCALGetter::Reset()
-{
- // resets things in case the getter is called consecutively with different files
- // the EMCAL Loader is already deleted by the Run Loader
- fgEmcalLoader = 0;
- fgObjGetter = 0;
-
-}
-
-//____________________________________________________________________________
-AliEMCALClusterizer * AliEMCALGetter::Clusterizer()
-{
- // return pointer to Clusterizer Tree
- AliEMCALClusterizer * rv ;
- rv = dynamic_cast<AliEMCALClusterizer *>(EmcalLoader()->Reconstructioner()) ;
- if (!rv) {
- Event(0, "R") ;
- rv = dynamic_cast<AliEMCALClusterizer*>(EmcalLoader()->Reconstructioner()) ;
- }
- return rv ;
-}
-
-
-//____________________________________________________________________________
-TClonesArray * AliEMCALGetter::Digits() const
-{
- // asks the Loader to return the Digits container
-
- TClonesArray * rv = 0 ;
- rv = EmcalLoader()->Digits() ;
-
- if( !rv ) {
- EmcalLoader()->MakeDigitsArray() ;
- rv = EmcalLoader()->Digits() ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-AliEMCALDigitizer * AliEMCALGetter::Digitizer()
-{
- // return pointer to Digitizer Tree
- AliEMCALDigitizer * rv ;
- rv = dynamic_cast<AliEMCALDigitizer *>(EmcalLoader()->Digitizer()) ;
- if (!rv) {
- Event(0, "D") ;
- rv = dynamic_cast<AliEMCALDigitizer *>(EmcalLoader()->Digitizer()) ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-TObjArray * AliEMCALGetter::ECARecPoints() const
-{
- // asks the Loader to return the EMC RecPoints container
-
- TObjArray * rv = 0 ;
-
- rv = EmcalLoader()->ECARecPoints() ;
- if (!rv) {
- EmcalLoader()->MakeRecPointsArray() ;
- rv = EmcalLoader()->ECARecPoints() ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-TClonesArray * AliEMCALGetter::TrackSegments() const
-{
- // asks the Loader to return the TrackSegments container
-
- TClonesArray * rv = 0 ;
-
- rv = EmcalLoader()->TrackSegments() ;
- if (!rv) {
- EmcalLoader()->MakeTrackSegmentsArray() ;
- rv = EmcalLoader()->TrackSegments() ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-AliEMCALTrackSegmentMaker * AliEMCALGetter::TrackSegmentMaker()
-{
- // return pointer to TrackSegmentMaker Tree
- AliEMCALTrackSegmentMaker * rv ;
- rv = dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
- if (!rv) {
- Event(0, "T") ;
- rv = dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-TClonesArray * AliEMCALGetter::RecParticles() const
-{
- // asks the Loader to return the TrackSegments container
-
- TClonesArray * rv = 0 ;
-
- rv = EmcalLoader()->RecParticles() ;
- if (!rv) {
- EmcalLoader()->MakeRecParticlesArray() ;
- rv = EmcalLoader()->RecParticles() ;
- }
- return rv ;
-}
-//____________________________________________________________________________
-void AliEMCALGetter::Event(Int_t event, const char* opt)
-{
- // Reads the content of all Tree's S, D and R
-
-// if ( event >= MaxEvent() ) {
-// Error("Event", "%d not found in TreeE !", event) ;
-// return ;
-// }
-
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
- // checks if we are dealing with test-beam data
-// TBranch * btb = rl->TreeE()->GetBranch("AliEMCALBeamTestEvent") ;
-// if(btb){
-// if(!fBTE)
-// fBTE = new AliEMCALBeamTestEvent() ;
-// btb->SetAddress(&fBTE) ;
-// btb->GetEntry(event) ;
-// }
-// else{
-// if(fBTE){
-// delete fBTE ;
-// fBTE = 0 ;
-// }
-// }
-
- // Loads the type of object(s) requested
-
- rl->GetEvent(event) ;
-
- if( strstr(opt,"X") || (strcmp(opt,"")==0) )
- ReadPrimaries() ;
-
- if(strstr(opt,"H") )
- ReadTreeH();
-
- if(strstr(opt,"S") )
- ReadTreeS() ;
-
- if( strstr(opt,"D") )
- ReadTreeD() ;
-
- if( strstr(opt,"R") )
- ReadTreeR() ;
-
- if( strstr(opt,"T") )
- ReadTreeT() ;
-
- if( strstr(opt,"P") )
- ReadTreeP() ;
-
- if( strstr(opt,"W") )
- ReadRaw(event) ;
-
-}
-
-
-//____________________________________________________________________________
-Int_t AliEMCALGetter::EventNumber() const
- {
- // return the current event number
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
- return static_cast<Int_t>(rl->GetEventNumber()) ;
-}
-
-//____________________________________________________________________________
- TClonesArray * AliEMCALGetter::Hits() const
-{
- // asks the loader to return the Hits container
-
- TClonesArray * rv = 0 ;
-
- rv = EmcalLoader()->Hits() ;
- if ( !rv ) {
- EmcalLoader()->LoadHits("read");
- rv = EmcalLoader()->Hits() ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-AliEMCALGetter * AliEMCALGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption)
-{
- // Creates and returns the pointer of the unique instance
- // Must be called only when the environment has changed
-
- if(!fgObjGetter){ // first time the getter is called
- fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;
- }
- else { // the getter has been called previously
- AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
- if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name
- // check if the file is already open
- TFile * galiceFile = dynamic_cast<TFile *>(gROOT->FindObject(rl->GetFileName()) ) ;
-
- if ( !galiceFile )
- fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption);
-
- else { // the file is already open check the version name
- TString currentVersionName = rl->GetEventFolder()->GetName() ;
- TString newVersionName(version) ;
- if (currentVersionName == newVersionName)
- if(fgDebug)
- ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ;
- else {
- fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;
- }
- }
- }
- else {
- AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
- if ( strstr(version, AliConfig::GetDefaultEventFolderName()) ) // false in case of merging
- delete rl ;
- fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;
- }
- }
- if (!fgObjGetter)
- ::Error("AliEMCALGetter::Instance", "Failed to create the EMCAL Getter object") ;
- else
- if (fgDebug)
- Print() ;
-
- return fgObjGetter ;
-}
-
-//____________________________________________________________________________
-AliEMCALGetter * AliEMCALGetter::Instance()
-{
- // Returns the pointer of the unique instance already defined
-
- if(!fgObjGetter && fgDebug)
- ::Warning("AliEMCALGetter::Instance", "Getter not initialized") ;
-
- return fgObjGetter ;
-
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALGetter::MaxEvent() const
-{
- // returns the number of events in the run (from TE)
-
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
- return static_cast<Int_t>(rl->GetNumberOfEvents()) ;
-}
-
-//____________________________________________________________________________
-TParticle * AliEMCALGetter::Primary(Int_t index) const
-{
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
- return rl->Stack()->Particle(index) ;
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALGetter::NPrimaries() const
-{
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
- return (rl->GetHeader())->GetNtrack();
-}
-
-//____________________________________________________________________________
-AliEMCAL * AliEMCALGetter:: EMCAL() const
-{
- // returns the EMCAL object
- AliEMCALLoader * loader = 0;
- static AliEMCALLoader * oldloader = 0;
- static AliEMCAL * emcal = 0;
-
- loader = EmcalLoader();
-
- if (loader != oldloader ) {
- emcal = dynamic_cast<AliEMCAL*>(loader->GetModulesFolder()->FindObject("EMCAL")) ;
- oldloader = loader;
- }
- if (!emcal)
- if (fgDebug)
- Warning("EMCAL", "EMCAL module not found in module folders: %s", EmcalLoader()->GetModulesFolder()->GetName() ) ;
- return emcal ;
-}
-
-
-
-//____________________________________________________________________________
-AliEMCALPID * AliEMCALGetter::PID()
-{
- // return pointer to PID Tree
- AliEMCALPID * rv ;
- rv = dynamic_cast<AliEMCALPID *>(EmcalLoader()->PIDTask()) ;
- if (!rv) {
- Event(0, "P") ;
- rv = dynamic_cast<AliEMCALPID *>(EmcalLoader()->PIDTask()) ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() const
-{
- // Returns EMCAL geometry
-
- AliEMCALGeometry * rv = 0 ;
- if (EMCAL() )
- rv = EMCAL()->GetGeometry() ;
- return rv ;
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::Print()
-{
- // Print usefull information about the getter
-
- AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
- ::Info("Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ;
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::ReadPrimaries()
-{
- // Read Primaries from Kinematics.root
-
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
-
- // gets kine tree from the root file (Kinematics.root)
- if ( ! rl->TreeK() ) // load treeK the first time
- rl->LoadKinematics() ;
-
- if (fgDebug)
- Info("ReadTreeK", "Found %d particles in event # %d", NPrimaries(), EventNumber() ) ;
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time)
-{
- // Fits the raw signal time distribution
-
- const Int_t kNoiseThreshold = 0 ;
- Double_t timezero1 = 0., timezero2 = 0., timemax = 0. ;
- Double_t signal = 0., signalmax = 0. ;
- Double_t energy = time = 0. ;
-
- if (lowGainFlag) {
- timezero1 = timezero2 = signalmax = timemax = 0. ;
- signalF->FixParameter(0, EMCAL()->GetRawFormatLowCharge()) ;
- signalF->FixParameter(1, EMCAL()->GetRawFormatLowGain()) ;
- Int_t index ;
- for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) {
- gLowGain->GetPoint(index, time, signal) ;
- if (signal > kNoiseThreshold && timezero1 == 0.)
- timezero1 = time ;
- if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.)
- timezero2 = time ;
- if (signal > signalmax) {
- signalmax = signal ;
- timemax = time ;
- }
- }
- signalmax /= EMCAL()->RawResponseFunctionMax(EMCAL()->GetRawFormatLowCharge(),
- EMCAL()->GetRawFormatLowGain()) ;
- if ( timezero1 + EMCAL()->GetRawFormatTimePeak() < EMCAL()->GetRawFormatTimeMax() * 0.4 ) { // else its noise
- signalF->SetParameter(2, signalmax) ;
- signalF->SetParameter(3, timezero1) ;
- gLowGain->Fit(signalF, "QRON", "", 0., timezero2); //, "QRON") ;
- energy = signalF->GetParameter(2) ;
- time = signalF->GetMaximumX() - EMCAL()->GetRawFormatTimePeak() - EMCAL()->GetRawFormatTimeTrigger() ;
- }
- } else {
- timezero1 = timezero2 = signalmax = timemax = 0. ;
- signalF->FixParameter(0, EMCAL()->GetRawFormatHighCharge()) ;
- signalF->FixParameter(1, EMCAL()->GetRawFormatHighGain()) ;
- Int_t index ;
- for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) {
- gHighGain->GetPoint(index, time, signal) ;
- if (signal > kNoiseThreshold && timezero1 == 0.)
- timezero1 = time ;
- if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.)
- timezero2 = time ;
- if (signal > signalmax) {
- signalmax = signal ;
- timemax = time ;
- }
- }
- signalmax /= EMCAL()->RawResponseFunctionMax(EMCAL()->GetRawFormatHighCharge(),
- EMCAL()->GetRawFormatHighGain()) ;;
- if ( timezero1 + EMCAL()->GetRawFormatTimePeak() < EMCAL()->GetRawFormatTimeMax() * 0.4 ) { // else its noise
- signalF->SetParameter(2, signalmax) ;
- signalF->SetParameter(3, timezero1) ;
- gHighGain->Fit(signalF, "QRON", "", 0., timezero2) ;
- energy = signalF->GetParameter(2) ;
- time = signalF->GetMaximumX() - EMCAL()->GetRawFormatTimePeak() - EMCAL()->GetRawFormatTimeTrigger() ;
- }
- }
-
- if (time == 0. && energy == 0.)
- amp = 0 ;
- else {
- AliEMCALDigitizer * digitizer = Digitizer() ;
- amp = static_cast<Int_t>( (energy - digitizer->GetECApedestal()) / digitizer->GetECAchannel() + 0.5 ) ;
- }
- // dessin
-// TCanvas * c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
-// c1->SetFillColor(42);
-// c1->SetGrid();
-// gLowGain->SetLineColor(2);
-// gLowGain->SetLineWidth(4);
-// gLowGain->SetMarkerColor(4);
-// gLowGain->SetMarkerStyle(21);
-// gLowGain->SetTitle("Lowgain");
-// gLowGain->GetXaxis()->SetTitle("X title");
-// gLowGain->GetYaxis()->SetTitle("Y title");
-// gLowGain->Draw("ACP");
-
-// c1->Update();
-// c1->GetFrame()->SetFillColor(21);
-// c1->GetFrame()->SetBorderSize(12);
-// c1->Modified();
-
-// TCanvas * c2 = new TCanvas("c2","A Simple Graph Example",200,10,700,500);
-// c2->SetFillColor(42);
-// c2->SetGrid();
-// gHighGain->SetLineColor(2);
-// gHighGain->SetLineWidth(4);
-// gHighGain->SetMarkerColor(4);
-// gHighGain->SetMarkerStyle(21);
-// gHighGain->SetTitle("Highgain");
-// gHighGain->GetXaxis()->SetTitle("X title");
-// gHighGain->GetYaxis()->SetTitle("Y title");
-// gHighGain->Draw("ACP");
-
-// c2->Update();
-// c2->GetFrame()->SetFillColor(21);
-// c2->GetFrame()->SetBorderSize(12);
-// c2->Modified();
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALGetter::ReadRaw(Int_t event)
-{
- // reads the raw format data, converts it into digits format and store digits in Digits()
- // container.
-
- AliRawReaderFile rawReader(event) ;
- AliEMCALRawStream in(&rawReader);
-
- Bool_t first = kTRUE ;
-
- TF1 * signalF = new TF1("signal", AliEMCAL::RawResponseFunction, 0, EMCAL()->GetRawFormatTimeMax(), 4);
- signalF->SetParNames("Charge", "Gain", "Amplitude", "TimeZero") ;
-
-
- Int_t id = -1;
- Bool_t lowGainFlag = kFALSE ;
-
- TClonesArray * digits = Digits() ;
- digits->Clear() ;
- Int_t idigit = 0 ;
- Int_t amp = 0 ;
- Double_t time = 0. ;
-
- TGraph * gLowGain = new TGraph(EMCAL()->GetRawFormatTimeBins()) ;
- TGraph * gHighGain= new TGraph(EMCAL()->GetRawFormatTimeBins()) ;
-
- while ( in.Next() ) { // EMCAL entries loop
- if ( in.IsNewId() ) {
- if (!first) {
- FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, amp, time) ;
- if (amp > 0) {
- new((*digits)[idigit]) AliEMCALDigit( -1, -1, id, amp, time) ;
- idigit++ ;
- }
- Int_t index ;
- for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) {
- gLowGain->SetPoint(index, index * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), 0) ;
- gHighGain->SetPoint(index, index * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), 0) ;
- }
- }
- first = kFALSE ;
- id = in.GetId() ;
- if (in.GetModule() == EMCAL()->GetRawFormatLowGainOffset() )
- lowGainFlag = kTRUE ;
- else
- lowGainFlag = kFALSE ;
- }
- if (lowGainFlag)
- gLowGain->SetPoint(in.GetTime(),
- in.GetTime()* EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(),
- in.GetSignal()) ;
- else
- gHighGain->SetPoint(in.GetTime(),
- in.GetTime() * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(),
- in.GetSignal() ) ;
-
- } // EMCAL entries loop
- digits->Sort() ;
-
- delete signalF ;
- delete gLowGain;
- delete gHighGain ;
-
- return Digits()->GetEntriesFast() ;
-}
-
- //____________________________________________________________________________
-Int_t AliEMCALGetter::ReadTreeD()
-{
- // Read the Digits
-
- EmcalLoader()->CleanDigits() ;
- EmcalLoader()->LoadDigits("UPDATE") ;
- EmcalLoader()->LoadDigitizer("UPDATE") ;
- return Digits()->GetEntries() ;
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALGetter::ReadTreeH()
-{
- // Read the Hits
- EmcalLoader()->CleanHits() ;
- // gets TreeH from the root file (EMCAL.Hit.root)
- //if ( !IsLoaded("H") ) {
- EmcalLoader()->LoadHits("UPDATE") ;
- //SetLoaded("H") ;
- //}
- return Hits()->GetEntries() ;
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALGetter::ReadTreeR()
-{
- // Read the RecPoints
-
- EmcalLoader()->CleanRecPoints() ;
- // gets TreeR from the root file (EMCAL.RecPoints.root)
- //if ( !IsLoaded("R") ) {
- EmcalLoader()->LoadRecPoints("UPDATE") ;
- EmcalLoader()->LoadClusterizer("UPDATE") ;
- // SetLoaded("R") ;
- //}
-
- return ECARecPoints()->GetEntries() ;
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALGetter::ReadTreeT()
-{
- // Read the TrackSegments
-
- EmcalLoader()->CleanTracks() ;
- // gets TreeT from the root file (EMCAL.TrackSegments.root)
- //if ( !IsLoaded("T") ) {
- EmcalLoader()->LoadTracks("UPDATE") ;
- EmcalLoader()->LoadTrackSegmentMaker("UPDATE") ;
- // SetLoaded("T") ;
- //}
-
- return TrackSegments()->GetEntries() ;
-}
-//____________________________________________________________________________
-Int_t AliEMCALGetter::ReadTreeP()
-{
- // Read the RecParticles
-
- EmcalLoader()->CleanRecParticles() ;
- // gets TreeP from the root file (EMCAL.RecParticles.root)
- // if ( !IsLoaded("P") ) {
- EmcalLoader()->LoadRecParticles("UPDATE") ;
- EmcalLoader()->LoadPID("UPDATE") ;
- // SetLoaded("P") ;
- // }
-
- return RecParticles()->GetEntries() ;
-}
-//____________________________________________________________________________
-Int_t AliEMCALGetter::ReadTreeS()
-{
- // Read the SDigits
-
- // EmcalLoader()->CleanSDigits() ;
- // gets TreeS from the root file (EMCAL.SDigits.root)
- // if ( !IsLoaded("S") ) {
- EmcalLoader()->LoadSDigits("READ") ;
- EmcalLoader()->LoadSDigitizer("READ") ;
- // SetLoaded("S") ;
- //}
-
- return SDigits()->GetEntries() ;
-}
-
-//____________________________________________________________________________
-TClonesArray * AliEMCALGetter::SDigits() const
-{
- // asks the Loader to return the Digits container
-
- TClonesArray * rv = 0 ;
-
- rv = EmcalLoader()->SDigits() ;
- if (!rv) {
- EmcalLoader()->MakeSDigitsArray() ;
- rv = EmcalLoader()->SDigits() ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-AliEMCALSDigitizer * AliEMCALGetter::SDigitizer()
-{
- // Return pointer to SDigitizer task
- AliEMCALSDigitizer * rv ;
- rv = dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
- if (!rv) {
- Event(0, "S") ;
- rv = dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-TParticle * AliEMCALGetter::Secondary(const TParticle* p, Int_t index) const
-{
- // Return first (index=1) or second (index=2) secondary particle of primary particle p
-
- if(index <= 0)
- return 0 ;
- if(index > 2)
- return 0 ;
-
- if(p) {
- Int_t daughterIndex = p->GetDaughter(index-1) ;
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
- return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ;
- }
- else
- return 0 ;
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::Track(Int_t itrack)
-{
- // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
-
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
-
- if( !TreeH() ) // load treeH the first time
- rl->LoadHits() ;
-
- // first time create the container
- TClonesArray * hits = Hits() ;
- if ( hits )
- hits->Clear() ;
-
- TBranch * emcalbranch = dynamic_cast<TBranch*>(TreeH()->GetBranch("EMCAL")) ;
- emcalbranch->SetAddress(&hits) ;
- emcalbranch->GetEntry(itrack) ;
-}
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeD() const
-{
- // return pointer to Digits Tree
- TTree * rv = 0 ;
- rv = EmcalLoader()->TreeD() ;
- if ( !rv ) {
- EmcalLoader()->MakeTree("D");
- rv = EmcalLoader()->TreeD() ;
- }
-
- return rv ;
-}
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeH() const
-{
- // return pointer to Hits Tree
- TTree * rv = 0 ;
- rv = EmcalLoader()->TreeH() ;
- if ( !rv ) {
- EmcalLoader()->MakeTree("H");
- rv = EmcalLoader()->TreeH() ;
- }
-
- return rv ;
-}
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeR() const
-{
- // return pointer to RecPoints Tree
-
- TTree * rv = 0 ;
- rv = EmcalLoader()->TreeR() ;
- if ( !rv ) {
- EmcalLoader()->MakeTree("R");
- rv = EmcalLoader()->TreeR() ;
- }
-
- return rv ;
-}
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeT() const
-{
- // return pointer to TrackSegments Tree
- TTree * rv = 0 ;
- rv = EmcalLoader()->TreeT() ;
- if ( !rv ) {
- EmcalLoader()->MakeTree("T");
- rv = EmcalLoader()->TreeT() ;
- }
-
- return rv ;
-}
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeP() const
-{
- // return pointer to RecParticles Tree
- TTree * rv = 0 ;
- rv = EmcalLoader()->TreeP() ;
- if ( !rv ) {
- EmcalLoader()->MakeTree("P");
- rv = EmcalLoader()->TreeP() ;
- }
-
- return rv ;
-}
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeS() const
-{
- // return pointer to SDigits Tree
- TTree * rv = 0 ;
- rv = EmcalLoader()->TreeS() ;
- if ( !rv ) {
- EmcalLoader()->MakeTree("S");
- rv = EmcalLoader()->TreeS() ;
- }
-
- return rv ;
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::VersionExists(TString & opt) const
-{
- // checks if the version with the present name already exists in the same directory
-
- Bool_t rv = kFALSE ;
-
- AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
- TString version( rl->GetEventFolder()->GetName() ) ;
-
- opt.ToLower() ;
-
- if ( opt == "sdigits") {
- // add the version name to the root file name
- TString fileName( EmcalLoader()->GetSDigitsFileName() ) ;
- if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
- fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
- if ( !(gSystem->AccessPathName(fileName)) ) {
- Warning("VersionExists", "The file %s already exists", fileName.Data()) ;
- rv = kTRUE ;
- }
- EmcalLoader()->SetSDigitsFileName(fileName) ;
- }
-
- if ( opt == "digits") {
- // add the version name to the root file name
- TString fileName( EmcalLoader()->GetDigitsFileName() ) ;
- if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
- fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
- if ( !(gSystem->AccessPathName(fileName)) ) {
- Warning("VersionExists", "The file %s already exists", fileName.Data()) ;
- rv = kTRUE ;
- }
- }
-
- return rv ;
-
-}
-
-//____________________________________________________________________________
-UShort_t AliEMCALGetter::EventPattern(void) const
-{
- // Return the pattern (trigger bit register) of the beam-test event
-// if(fBTE)
-// return fBTE->GetPattern() ;
-// else
- return 0 ;
-}
-//____________________________________________________________________________
-Float_t AliEMCALGetter::BeamEnergy(void) const
-{
- // Return the beam energy of the beam-test event
-// if(fBTE)
-// return fBTE->GetBeamEnergy() ;
-// else
- return 0 ;
-}
+++ /dev/null
-#ifndef ALIEMCALGETTER_H
-#define ALIEMCALGETTER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// A singleton that returns various objects
-// Should be used on the analysis stage to avoid confusing between different
-// branches of reconstruction tree: e.g. reading RecPoints and TS made from
-// another set of RecPoints.
-//
-// The objects are retrived from folders.
-//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
-//
-
-
-// --- ROOT system ---
-#include "TObject.h"
-#include "TClonesArray.h"
-class TParticle ;
-class TTree ;
-class TGraph ;
-class TF1 ;
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliConfig.h"
-
-// #include "AliRun.h"
-#include "AliEMCALHit.h"
-#include "AliEMCALRecParticle.h"
-#include "AliEMCALDigitizer.h"
-#include "AliEMCALSDigitizer.h"
-#include "AliEMCALLoader.h"
-class AliEMCAL ;
-class AliEMCALGeometry ;
-class AliEMCALClusterizer ;
-class AliEMCALRecPoint ;
-class AliEMCALTrackSegmentMaker ;
-class AliEMCALTrackSegment ;
-class AliEMCALPID ;
-class AliEMCALBeamTestEvent ;
-
-
-class AliEMCALGetter : public TObject {
-
- public:
- AliEMCALGetter() {
- // ctor: this is a singleton, the ctor should never be called but cint needs it as public
- Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ;
- }
- AliEMCALGetter(const AliEMCALGetter & obj):TObject(obj) {
- // cpy ctor requested by Coding Convention
- Fatal("cpy ctor", "not implemented") ;
- }
-
- AliEMCALGetter & operator = (const AliEMCALGetter & ) {
- // assignement operator requested by coding convention, but not needed
- Fatal("operator =", "not implemented") ;
- return *this ;
- }
- virtual ~AliEMCALGetter() ;
-
- //=========== Instantiators ================
- static AliEMCALGetter * Instance(const char* headerFile,
- const char* version = AliConfig::GetDefaultEventFolderName(),
- Option_t * openingOption = "READ" ) ;
- static AliEMCALGetter * Instance() ;
-
- static void Print() ;
-
-// //=========== General information about run ==============
- Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; }
- void SetLoaded(TString tree) { fLoadingStatus += tree ; }
-
- Int_t MaxEvent() const ;
- Int_t EventNumber() const ;
- Bool_t VersionExists(TString & opt) const ;
- UShort_t EventPattern(void) const ;
- Float_t BeamEnergy(void) const ;
-
-// //========== EMCALGeometry and EMCAL =============
- AliEMCAL * EMCAL() const ;
- AliEMCALGeometry * EMCALGeometry() const ;
-
-// //========== Methods to read something from file ==========
- void Event(Int_t event, const char * opt = "HSDRP") ;
- void Track(Int_t itrack) ;
-
-// //-----------------now getter's data--------------------------------------
-// // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; }
-// // void ReadCalibrationDB(const char * name, const char * filename) ;
-
- //=========== Primaries ============
-// TTree * TreeK(TString filename="") ;
- TParticle * Primary(Int_t index) const ;
- Int_t NPrimaries() const;
- TParticle * Secondary(const TParticle * p, Int_t index=1) const ;
-
-// //=========== Hits =================
-// TTree * TreeH(TString filename="") ;
- TClonesArray * Hits(void) const ;
- AliEMCALHit * Hit(Int_t index) const { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );}
- TTree * TreeH() const ;
-
- //=========== SDigits ==============
- TClonesArray * SDigits() const ;
- AliEMCALDigit * SDigit(Int_t index) const { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;}
- TTree * TreeS() const ;
- AliEMCALSDigitizer * SDigitizer() ;
-
- TString GetSDigitsFileName() const { return EmcalLoader()->GetSDigitsFileName() ; }
- Int_t LoadSDigits(Option_t* opt="") const { return EmcalLoader()->LoadSDigits(opt) ; }
- Int_t LoadSDigitizer(Option_t* opt="") const { return EmcalLoader()->LoadSDigitizer(opt) ; }
- Int_t WriteSDigits(Option_t* opt="") const { return EmcalLoader()->WriteSDigits(opt) ; }
- Int_t WriteSDigitizer(Option_t* opt="") const {
- return EmcalLoader()->WriteSDigitizer(opt) ; }
-
- //========== Digits ================
- TClonesArray * Digits() const ;
- AliEMCALDigit * Digit(Int_t index) const { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;}
- TTree * TreeD() const ;
- AliEMCALDigitizer * Digitizer() ;
- TString GetDigitsFileName() const { return EmcalLoader()->GetDigitsFileName() ; }
- Int_t LoadDigits(Option_t* opt="") const { return EmcalLoader()->LoadDigits(opt) ; }
- Int_t LoadDigitizer(Option_t* opt="") const {
- return EmcalLoader()->LoadDigitizer(opt) ; }
- Int_t WriteDigits(Option_t* opt="") const { return EmcalLoader()->WriteDigits(opt) ; }
- Int_t WriteDigitizer(Option_t* opt="") const {
- return EmcalLoader()->WriteDigitizer(opt) ; }
-
- //========== RecPoints =============
- TObjArray * ECARecPoints() const;
- AliEMCALRecPoint * ECARecPoint(Int_t index) const{ return static_cast<AliEMCALRecPoint *>(ECARecPoints()->At(index)) ;}
- TTree * TreeR() const ;
- AliEMCALClusterizer * Clusterizer() ;
- TString GetRecPointsFileName() const { return EmcalLoader()->GetRecPointsFileName() ; }
- Int_t LoadRecPoints(Option_t* opt="") const { return EmcalLoader()->LoadRecPoints(opt) ; }
- Int_t LoadClusterizer(Option_t* opt="") const {
- return EmcalLoader()->LoadClusterizer(opt) ; }
- Int_t WriteRecPoints(Option_t* opt="") const { return EmcalLoader()->WriteRecPoints(opt) ; }
- Int_t WriteClusterizer(Option_t* opt="") const {
- return EmcalLoader()->WriteClusterizer(opt) ; }
-
- //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
- TClonesArray * TrackSegments() const ;
- AliEMCALTrackSegment * TrackSegments(Int_t index) const { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;}
- TTree * TreeT() const ;
- AliEMCALTrackSegmentMaker * TrackSegmentMaker() ;
- TString GetTracksFileName() const { return EmcalLoader()->GetTracksFileName() ; }
- Int_t LoadTracks(Option_t* opt="") const { return EmcalLoader()->LoadTracks(opt) ; }
- Int_t LoadTrackSegementMaker(Option_t* opt="") const {
- return EmcalLoader()->LoadTrackSegmentMaker(opt) ; }
- Int_t WriteTracks(Option_t* opt="") const { return EmcalLoader()->WriteTracks(opt) ; }
- Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
- return EmcalLoader()->WriteTracker(opt) ; }
- //========== RecParticles ===========
-
- TClonesArray * RecParticles() const ;
- AliEMCALRecParticle * RecParticle(Int_t index) const { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;}
- TTree * TreeP() const ;
- AliEMCALPID * PID() ;
- TString GetRecParticlesFileName() const { return EmcalLoader()->GetRecParticlesFileName() ; }
- Int_t LoadRecParticles(Option_t* opt="") const { return EmcalLoader()->LoadRecParticles(opt) ; }
- Int_t LoadPID(Option_t* opt="") const {
- return EmcalLoader()->LoadPID(opt) ; }
- Int_t WriteRecParticles(Option_t* opt="") const { return EmcalLoader()->WriteRecParticles(opt) ; }
- Int_t WritePID(Option_t* opt="") const {
- return EmcalLoader()->WritePID(opt) ; }
-
- //========== Raw ===========
- Int_t ReadRaw(Int_t event) ;
-
- void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
- void PostClusterizer(AliEMCALClusterizer * clu)
- const{EmcalLoader()->PostClusterizer(clu) ; }
- void PostPID(AliEMCALPID * pid)
- const{EmcalLoader()->PostPID(pid) ; }
- void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr)
- const{EmcalLoader()->PostTrackSegmentMaker(tr) ; }
- void PostSDigitizer (AliEMCALSDigitizer * sdigitizer)
- const {EmcalLoader()->PostSDigitizer(sdigitizer);}
- void PostDigitizer (AliEMCALDigitizer * digitizer)
- const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
-
- TString Version() const { return EmcalLoader()->GetTitle() ; }
- AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader; }
- void Reset() ;
-
-private:
-
- AliEMCALGetter(const char* headerFile,
- const char* version = AliConfig::GetDefaultEventFolderName(),
- Option_t * openingOption = "READ") ;
-
-
- Int_t ReadTreeD(void) ;
- Int_t ReadTreeH(void) ;
- Int_t ReadTreeR(void) ;
- Int_t ReadTreeT(void) ;
- Int_t ReadTreeS(void) ;
- Int_t ReadTreeP(void) ;
-
-
- void ReadPrimaries(void) ;
-
- void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time) ;
-
-private:
-
-
- static Int_t fgDebug ; //! Debug level
-
- TString fLoadingStatus ; //! tells which trees are loaded
-
-// AliEMCALCalibrationDB * fcdb ; //!
-
- static AliEMCALLoader * fgEmcalLoader ; // pointer to EMCAL Loader
- static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
-
- enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
-
-
- ClassDef(AliEMCALGetter,6) // Algorithm class that provides methods to retrieve objects from a list knowing the index
-
-};
-
-#endif // AliEMCALGETTER_H
+++ /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. *
- **************************************************************************/
-/* $Id$ */
-//_________________________________________________________________________
-// Algorithm class used only by AliEMCALTrackSegmentMaker
-// Links recpoints into tracksegments
-//*-- Author: Dmitri Peressounko (SUBATECH)
-//*-- Author: Adapted from PHOS by Y. Schutz (SUBATECH)
-
-// --- ROOT system ---
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-#include "AliEMCALLink.h"
-
-ClassImp(AliEMCALLink)
-//____________________________________________________________________________
- AliEMCALLink::AliEMCALLink(Float_t prod, Int_t eca, Int_t rp)
-{
- // ctor
-
- if (gDebug == 2 )
- printf("ctor: prod = %f, ec=%d , rp=%d", prod, eca, rp) ;
- fProd = prod ;
- fECAN = eca ;
- fOtherN = rp ;
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALLink::Compare(const TObject * obj) const
-{
- // Compare according to the distance between two recpoints in a track segment
-
- Int_t rv ;
-
- AliEMCALLink * link = (AliEMCALLink *)obj ;
-
- if(GetProd() < link->GetProd() )
- rv = -1 ;
- else
- rv = 1 ;
-
- return rv ;
-}
+++ /dev/null
-#ifndef ALIEMCALLINK_H
-#define ALIEMCALLINK_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Algorithm class used only by AliEMCALTrackSegmentMaker
-// Links recpoints
-// into tracksegments
-//*-- Author: Dmitri Peressounko (SUBATECH)
-//*-- Author: Adapted from PHOS by Y. Schutz (SUBATECH)
-
-// --- ROOT system ---
-
-#include "TObject.h"
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-class AliEMCALLink : public TObject
-{
-
-public:
-
- AliEMCALLink( Float_t prod, Int_t ec, Int_t rp) ; // ctor
- virtual ~AliEMCALLink(){
- // dtor
- }
- Int_t Compare(const TObject * obj) const ;
- Int_t GetECA(void) const { return fECAN ; }
- Int_t GetOther(void) const { return fOtherN ; }
- Float_t GetProd(void) const { return fProd ; }
- Bool_t IsSortable() const{ return kTRUE; }
-
-private:
-
- Int_t fECAN ; // ECAL index
- Int_t fOtherN ; // index of the linked recpoint
- Float_t fProd ; // Scalar produc of the direction of the 2 recpoints
-
- ClassDef(AliEMCALLink,1) // Auxilliary algorithm class used by AliEMCALTrackSegmentMaker
-
-};
-
-#endif // AliEMCALLINK_H
+++ /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. *
- **************************************************************************/
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Algorithm class for the identification of particles detected in EMCAL
-// base class of identified particle
-// Why should I put meaningless comments
-// just to satisfy
-// the code checker
-
-//
-//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko
-
-
-// --- ROOT system ---
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliEMCALPID.h"
-#include "AliEMCALGetter.h"
-
-ClassImp(AliEMCALPID)
-
-//____________________________________________________________________________
- AliEMCALPID::AliEMCALPID():TTask("","")
-{
- // ctor
- fEventFolderName = "" ;
- fFirstEvent = 0 ;
- fLastEvent = -1 ;
-}
-
-
-//____________________________________________________________________________
-AliEMCALPID::AliEMCALPID(const TString alirunFileName, const TString eventFolderName):
- TTask("EMCAL"+AliConfig::Instance()->GetPIDTaskName(), alirunFileName),
- fEventFolderName(eventFolderName)
-{
- // ctor
- fFirstEvent = 0 ;
- fLastEvent = -1 ;
-}
-
-//____________________________________________________________________________
-AliEMCALPID::~AliEMCALPID()
-{
- // dtor
- //Remove this from the parental task before destroying
- AliEMCALGetter::Instance()->EmcalLoader()->CleanPIDTask();
-
-}
+++ /dev/null
-#ifndef ALIEMCALPID_H
-#define ALIEMCALPID_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Algorithm class for the identification of particles detected in EMCAL
-// base class
-// of identified particles
-//*-- Author: Yves Schutz (SUBATECH)
-
-// --- ROOT system ---
-
-#include "TTask.h"
-#include "AliConfig.h"
-class TFormula ;
-class TClonesArray ;
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-class AliEMCALGeometry ;
-class AliEMCALClusterizer ;
-class AliEMCALTrackSegmentMaker ;
-
-class AliEMCALPID : public TTask {
-
- public:
-
- AliEMCALPID() ; // ctor
- AliEMCALPID(const TString alirunFileName, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
- AliEMCALPID(const AliEMCALPID & pid):TTask(pid) {;}
- virtual ~AliEMCALPID() ; // dtor
-
- virtual void Exec(Option_t *) = 0;
- virtual Int_t GetRecParticlesInRun() const { Warning("GetRecParticlesInRun", "not defined" ) ; return 0 ;}
- virtual void Print() const { Warning("Print", "not defined" ) ;}
- void SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
- void SetEventFolderName(TString name) { fEventFolderName = name ; }
- virtual void SetPREtoECADistanceCut(Float_t, TString, Float_t) { Warning("SetCpvtoEmcDistanceCut", "not defined" ) ;}
- virtual void SetTimeGate(Float_t /*Cluster_En*/, TString /*Eff_Pur*/, Float_t /*gate*/) { Warning("SetTimeGate", "not defined" ) ; }
- virtual const char * Version() const { Warning("Version", "not defined" ) ; return 0 ; }
- virtual void WriteRecParticles() = 0;
-
-private:
- virtual void Init() { Warning("Init", "not defined" ) ; }
-
-protected:
- TString fEventFolderName ; // event folder name
- Int_t fFirstEvent; // first event to process
- Int_t fLastEvent; // last event to process
-
- ClassDef(AliEMCALPID,3) // Particle Identifier algorithm (base class)
-
-} ;
-
-#endif // ALIEMCALPID_H
+++ /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. *
- **************************************************************************/
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Implementation version v1 of the EMCAL particle identifier
-
-//*-- Author: Yves Schutz (SUBATECH)
-//
-// --- ROOT system ---
-//#include "TROOT.h"
-#include "TTree.h"
-#include "TBenchmark.h"
-#include "TSystem.h"
-
- // --- Standard library ---
-
- // --- AliRoot header files ---
-#include "AliGenerator.h"
-#include "AliEMCALPIDv1.h"
-#include "AliEMCALRecParticle.h"
-#include "AliEMCALGetter.h"
-
- ClassImp( AliEMCALPIDv1)
-
-//____________________________________________________________________________
-AliEMCALPIDv1::AliEMCALPIDv1():AliEMCALPID()
-{
- // default ctor
-
- InitParameters() ;
- fDefaultInit = kTRUE ;
-
-}
-
-//____________________________________________________________________________
-AliEMCALPIDv1::AliEMCALPIDv1(const AliEMCALPIDv1 & pid ):AliEMCALPID(pid)
-{
- // ctor
- InitParameters() ;
- Init() ;
-
-}
-
-//____________________________________________________________________________
-AliEMCALPIDv1::AliEMCALPIDv1(const TString alirunFileName, const TString eventFolderName):AliEMCALPID(alirunFileName, eventFolderName)
-{
- //ctor with the indication on where to look for the track segments
-
- InitParameters() ;
- Init() ;
- fDefaultInit = kFALSE ;
-
-}
-
-//____________________________________________________________________________
-AliEMCALPIDv1::~AliEMCALPIDv1()
-{
- // dtor
-}
-
-//____________________________________________________________________________
-const TString AliEMCALPIDv1::BranchName() const
-{
-
- return GetName() ;
-}
-
-//____________________________________________________________________________
-Float_t AliEMCALPIDv1::GetCalibratedEnergy(Float_t e) const
-{
-// It calibrates Energy depending on the recpoint energy.
-// The energy of the reconstructed cluster is corrected with
-// the formula A + B* E + C* E^2, whose parameters where obtained
-// through the study of the reconstructed energy distribution of
-// monoenergetic photons.
-
- //Float_t p[]={0.,0.,0.};
- //for (Int_t i=0; i<3; i++) p[i] = GetParameterCalibration(i);
- Float_t enerec = e ; // p[0] + p[1]*e + p[2]*e*e;
- return enerec ;
-
-}
-//____________________________________________________________________________
-TVector3 AliEMCALPIDv1::GetMomentumDirection(AliEMCALRecPoint * emc)const
-{
- // Calculates the momentum direction:
- // direction is given by IP and this RecPoint
-
-
- TVector3 dir(0,0,0) ;
- TVector3 emcglobalpos ;
- // TMatrix dummy ;
-
- emc->GetGlobalPosition(emcglobalpos) ;
-
-
- dir = emcglobalpos ;
- // dir.SetMag(1.) ; Removed to avoid warings !!!!!!!!!!!!!! TO BE REVISED
-
- //account correction to the position of IP
- Float_t xo,yo,zo ; //Coordinates of the origin
- gAlice->Generator()->GetOrigin(xo,yo,zo) ;
- TVector3 origin(xo,yo,zo);
- dir = dir - origin ;
-
- return dir ;
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1::Init()
-{
- // Make all memory allocations that are not possible in default constructor
- // Add the PID task to the list of EMCAL tasks
-
-
- AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data()) ;
-
- if ( !gime->PID() )
- gime->PostPID(this) ;
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1::InitParameters()
-{
- // Initialize the parameters
- fRecParticlesInRun = 0 ;
- fNEvent = 0 ;
- fRecParticlesInRun = 0 ;
-}
-
-//____________________________________________________________________________
-
-void AliEMCALPIDv1::Exec(Option_t * option)
-{
- //Steering method
-
- if(strstr(option,"tim"))
- gBenchmark->Start("EMCALPID");
-
- if(strstr(option,"print")) {
- Print("") ;
- return ;
- }
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
-
- if (fLastEvent == -1)
- fLastEvent = gime->MaxEvent() - 1 ;
- else
- fLastEvent = TMath::Min(fLastEvent,gime->MaxEvent());
- Int_t nEvents = fLastEvent - fFirstEvent + 1;
-
- Int_t ievent ;
-
- for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- gime->Event(ievent,"R") ;
- MakeRecParticles() ;
- WriteRecParticles();
- if(strstr(option,"deb"))
- PrintRecParticles(option) ;
- //increment the total number of rec particles per run
- fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ;
- }
- if(strstr(option,"tim")){
- gBenchmark->Stop("EMCALPID");
- printf("Exec: took %f seconds for PID %f seconds per event",
- gBenchmark->GetCpuTime("EMCALPID"),
- gBenchmark->GetCpuTime("EMCALPID")/nEvents) ;
- }
-
- Unload();
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1::MakeRecParticles(){
-
- // Makes a RecParticle out of a TrackSegment
-
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- TObjArray * aECARecPoints = gime->ECARecPoints() ;
- if ( !aECARecPoints ) {
- Fatal("MakeRecParticles", "RecPoints or TrackSegments not found !") ;
- }
- TClonesArray * recParticles = gime->RecParticles() ;
- recParticles->Clear();
-
- TIter next(aECARecPoints) ;
- AliEMCALRecPoint * eca ;
- Int_t index = 0 ;
- AliEMCALRecParticle * rp ;
- while ( (eca = (AliEMCALRecPoint *)next()) ) {
-
- new( (*recParticles)[index] ) AliEMCALRecParticle() ;
- rp = (AliEMCALRecParticle *)recParticles->At(index) ;
- rp->SetRecPoint(index) ;
- rp->SetIndexInList(index) ;
-
- // Now set type (reconstructed) of the particle
-
- // Choose the cluster energy range
-
- Float_t lambda[2] ;
- eca->GetElipsAxis(lambda) ;
-
- if((lambda[0]>0.01) && (lambda[1]>0.01)){
- // Looking PCA. Define and calculate the data (X),
- // introduce in the function X2P that gives the components (P).
-
- Float_t spher = 0. ;
- Float_t emaxdtotal = 0. ;
-
- if((lambda[0]+lambda[1])!=0)
- spher=fabs(lambda[0]-lambda[1])/(lambda[0]+lambda[1]);
-
- emaxdtotal=eca->GetMaximalEnergy()/eca->GetEnergy();
- }
-
- // Float_t time = eca->GetTime() ;
-
- //Set momentum, energy and other parameters
- Float_t encal = GetCalibratedEnergy(eca->GetEnergy());
- TVector3 dir = GetMomentumDirection(eca) ;
- // dir.SetMag(encal) ;Removed to avoid warings !!!!!!!!!!!!!! TO BE REVISED
- rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),encal) ;
- rp->SetCalcMass(0);
- rp->Name(); //If photon sets the particle pdg name to gamma
- rp->SetProductionVertex(0,0,0,0);
- rp->SetFirstMother(-1);
- rp->SetLastMother(-1);
- rp->SetFirstDaughter(-1);
- rp->SetLastDaughter(-1);
- rp->SetPolarisation(0,0,0);
- //Set the position in global coordinate system from the RecPoint
- //AliEMCALGeometry * geom = gime->EMCALGeometry() ;
- //AliEMCALTowerRecPoint * erp = gime->ECARecPoint(rp->GetEMCALRPIndex()) ;
- TVector3 pos ;
- //geom->GetGlobal(erp, pos) ; !!!!!!!!!! to check
- rp->SetPos(pos);
-
-
- index++ ;
- }
-
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1:: Print(Option_t * /*option*/) const
-{
- // Print the parameters used for the particle type identification
-
- printf("Print: =============== AliEMCALPID1 ================") ;
- printf("Making PID\n");
- printf(" Pricipal analysis file from 0.5 to 100 %s\n", fFileName.Data() ) ;
- printf(" Name of parameters file %s\n", fFileNamePar.Data() ) ;
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1::Print() const
-{
- // Print the parameters used for the particle type identification
-
- Info("Print", "=============== AliEMCALPIDv1 ================") ;
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1::PrintRecParticles(Option_t * option)
-{
- // Print table of reconstructed particles
-
- AliEMCALGetter *gime = AliEMCALGetter::Instance() ;
-
- TClonesArray * recParticles = gime->RecParticles() ;
-
- printf("\nevent %i", gAlice->GetEvNumber());
- printf(" found %i", recParticles->GetEntriesFast());
- printf(" RecParticles\n");
-
- if(strstr(option,"all")) { // printing found TS
- printf("\n PARTICLE Index \n");
-
- Int_t index ;
- for (index = 0 ; index < recParticles->GetEntries() ; index++) {
- AliEMCALRecParticle * rp = (AliEMCALRecParticle * ) recParticles->At(index) ;
- printf("\n");
- printf(rp->Name().Data());
- printf(" %i", rp->GetIndexInList());
- printf(" %i", rp->GetType());
- }
- }
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1::Unload()
-{
- // Unloads RecPoints, TrackSegments and RecParticles from the folder
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- gime->EmcalLoader()->UnloadRecPoints() ;
- gime->EmcalLoader()->UnloadTracks() ;
- gime->EmcalLoader()->UnloadRecParticles() ;
-}
-
-//____________________________________________________________________________
-void AliEMCALPIDv1::WriteRecParticles()
-{
- // Write RecParticles array to file
- AliEMCALGetter *gime = AliEMCALGetter::Instance() ;
-
- TClonesArray * recParticles = gime->RecParticles() ;
- recParticles->Expand(recParticles->GetEntriesFast() ) ;
- TTree * treeP = gime->TreeP() ;
-
-
-
- //First rp
- Int_t bufferSize = 32000 ;
- TBranch * rpBranch = treeP->Branch("EMCALRP",&recParticles,bufferSize);
- rpBranch->SetTitle(BranchName());
-
- rpBranch->Fill() ;
-
- gime->WriteRecParticles("OVERWRITE");
- gime->WritePID("OVERWRITE");
-
-}
-
+++ /dev/null
-#ifndef ALIEMCALPIDV1_H
-#define ALIEMCALPIDV1_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-
-//_________________________________________________________________________
-// Implementation version v1 of the EMCAL particle identifier
-// Identification is based on information from CPV and EMC
-// Oh yeah
-//*-- Author: Yves Schutz (SUBATECH), Gustavo Conesa.
-
-// --- ROOT system ---
-//class TFormula ;
-class TVector3 ;
-class TPrincipal ;
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-class AliEMCALRecPoint ;
-
-#include "AliEMCALPID.h"
-
-class AliEMCALPIDv1 : public AliEMCALPID {
-
- public:
-
- AliEMCALPIDv1() ; // ctor
- AliEMCALPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
- AliEMCALPIDv1(const AliEMCALPIDv1 & pid) ; // cpy ctor
-
- virtual ~AliEMCALPIDv1() ; // dtor
-
- virtual void Exec(Option_t * option) ;
-
- virtual Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}
- Float_t GetCalibratedEnergy (Float_t e) const;
- TVector3 GetMomentumDirection(AliEMCALRecPoint * emc)const ;
-
- virtual void Print(Option_t * option) const ;
-
- //To turn on or off the Pi0 analysis
- Bool_t GetPi0Analysis() const {return fPi0Analysis;}
- void SetPi0Analysis(Bool_t turnonoff){ fPi0Analysis = turnonoff; }
-
- private:
-
- const TString BranchName() const ;
- virtual void Init() ;
- virtual void InitParameters() ;
- void MakeRecParticles(void ) ;
- void PrintRecParticles(Option_t * option) ;
- virtual void WriteRecParticles() ;
- void Unload();
-
- void Print() const ;
-
- virtual const char * Version() const { return "pid-v1" ; }
-
- AliEMCALPIDv1 & operator = (const AliEMCALPIDv1 & /*pid*/) { return *this ;}
-
- private:
-
- Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
- Int_t fNEvent ; //! current event number
- TString fFileName ; // File that contains the Principal file for analysis
- TString fFileNamePar ; // File that contains the parameters for analysis
- Bool_t fPi0Analysis; //! Pi0 analysis on or off
- Int_t fRecParticlesInRun ; //! Total number of recparticles in one run
-
- ClassDef( AliEMCALPIDv1,8) // Particle identifier implementation version 1
-
-};
-
-#endif // AliEMCALPIDV1_H
+++ /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. *
- **************************************************************************/
-/* $Id$ */
-//_________________________________________________________________________
-// A Reconstructed Particle in EMCAL
-// To become a general class of AliRoot ?
-// Why should I put meaningless comments
-// just to satisfy
-// the code checker
-//
-//*-- Author: Yves Schutz (SUBATECH)
-
-
-// --- ROOT system ---
-
-// --- Standard library ---
-
-
-// --- AliRoot header files ---
-#include "AliEMCALRecParticle.h"
-#include "AliEMCALGetter.h"
-#include "TParticle.h"
-
-ClassImp(AliEMCALRecParticle)
-
-
-//____________________________________________________________________________
- AliEMCALRecParticle::AliEMCALRecParticle(): fEMCALRecPoint(0), fDebug(kFALSE)
-{
- // ctor
- const Int_t nSPECIES = AliPID::kSPECIESN;
- for(Int_t i = 0; i<nSPECIES ; i++)
- fPID[i]=0.;
-}
-//____________________________________________________________________________
-AliEMCALRecParticle::AliEMCALRecParticle(const AliEMCALRecParticle & rp)
- : AliEMCALFastRecParticle(rp)
-{
- // copy ctor
-
- fEMCALRecPoint = rp.fEMCALRecPoint ;
- fDebug = kFALSE ;
- fType = rp.fType ;
- fIndexInList = rp.fIndexInList ;
-
- fPdgCode = rp.fPdgCode;
- fStatusCode = rp.fStatusCode;
- fMother[0] = rp.fMother[0];
- fMother[1] = rp.fMother[1];
- fDaughter[0] = rp.fDaughter[0];
- fDaughter[1] = rp.fDaughter[1];
- fWeight = rp.fWeight;
- fCalcMass = rp.fCalcMass;
- fPx = rp.fPx;
- fPy = rp.fPy;
- fPz = rp.fPz;
- fE = rp.fE;
- fVx = rp.fVx;
- fVy = rp.fVy;
- fVz = rp.fVz;
- fVt = rp.fVt;
- fPolarTheta = rp.fPolarTheta;
- fPolarPhi = rp.fPolarPhi;
- fParticlePDG = rp.fParticlePDG;
- const Int_t nSPECIES = AliPID::kSPECIESN;
- for(Int_t i = 0; i<nSPECIES ; i++)
- fPID[i]=rp.fPID[i];
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALRecParticle::GetNPrimaries() const
-{
- return -1;
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALRecParticle::GetNPrimariesToRecParticles() const
-{
- // Returns the number of primaries at the origine of a RecParticle
- Int_t rv = 0 ;
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- dynamic_cast<AliEMCALRecPoint*>(gime->ECARecPoints()->At(GetEMCALRPIndex()))->GetPrimaries(rv) ;
-
- return rv ;
-}
-
-//____________________________________________________________________________
-const TParticle * AliEMCALRecParticle::GetPrimary(Int_t index) const
-{
- // Getts the list of primary particles at the origine of the RecParticle
- if ( index > GetNPrimariesToRecParticles() ) {
- if (fDebug)
- Warning("GetPrimary", "AliEMCALRecParticle::GetPrimary -> %d is larger that the number of primaries %d",
- index, GetNPrimaries()) ;
- return 0 ;
- }
- Int_t dummy ;
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
-
- Int_t primaryindex = dynamic_cast<AliEMCALRecPoint*>(gime->ECARecPoints()->At(GetEMCALRPIndex()))->GetPrimaries(dummy)[index] ;
-
- return gime->Primary(primaryindex) ;
-}
-
-//____________________________________________________________________________
-const Double_t * AliEMCALRecParticle::GetPID()
-{
- // Get the probability densities that this reconstructed particle
- // has a type of i:
- // i particle types
- // ----------------------
- // 0 electron
- // 1 muon
- // 2 pi+-
- // 3 K+-
- // 4 p/pbar
- // 5 photon
- // 6 pi0 at high pt
- // 7 neutron
- // 8 K0L
-
-
- if (IsElectron() ) fPID[0] = 1.0;
- if (IsChargedHadron()) {
- fPID[1] = 0.25;
- fPID[2] = 0.25;
- fPID[3] = 0.25;
- fPID[4] = 0.25;
- }
- if (IsFastChargedHadron()) {
- fPID[1] = 0.33;
- fPID[2] = 0.33;
- fPID[3] = 0.33;
- fPID[4] = 0.00;
- }
- if (IsSlowChargedHadron()) {
- fPID[1] = 0.00;
- fPID[2] = 0.00;
- fPID[3] = 0.00;
- fPID[4] = 1.00;
- }
-
- if (IsPhoton() || IsHardPhoton()) fPID[5] = 1.0;
- if (IsHardPi0()) fPID[6] = 1.0;
- if (IsFastNeutralHadron()) fPID[7] = 1.0;
- if (IsSlowNeutralHadron()) fPID[8] = 1.0;
-
- if (IsEleCon()) fPID[9] = 1.0;
- return fPID;
-}
+++ /dev/null
-#ifndef ALIEMCALRECPARTICLE_H
-#define ALIEMCALRECPARTICLE_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// A Reconstructed Particle in EMCAL
-// To become a general class of AliRoot ?
-// why not
-//*-- Author: Yves Schutz (SUBATECH)
-
-// --- ROOT system ---
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-#include "AliESDtrack.h"
-#include "AliEMCALFastRecParticle.h"
-class TParticle ;
-#include "TVector3.h"
-
-class AliEMCALRecParticle : public AliEMCALFastRecParticle {
-
- public:
-
- AliEMCALRecParticle() ;
- AliEMCALRecParticle(const AliEMCALRecParticle & rp) ; // ctor
- virtual ~AliEMCALRecParticle(){ }
-
- Int_t GetEMCALRPIndex()const { return fEMCALRecPoint ; }
- virtual Int_t GetNPrimariesToRecParticles() const ;
- virtual Int_t GetNPrimaries() const ;
- TVector3 GetPos() const { return fPos ; }
- virtual const TParticle * GetPrimary(Int_t index) const ;
- const Double_t *GetPID();
- void SetDebug() { fDebug = kTRUE ; }
- void SetPos(TVector3 pos) { fPos.SetXYZ( pos.X(), pos.Y(), pos.Z() ); }
- void UnsetDebug() { fDebug = kFALSE ; }
- void SetRecPoint(Int_t index){fEMCALRecPoint = index; }
-
- typedef TClonesArray RecParticlesList ;
-
- private:
-
- Int_t fEMCALRecPoint ; // pointer to the associated track segment in EMCAL
- Bool_t fDebug ; // to steer debug output
- TVector3 fPos ; // position in the global alice coordinate system
- Double_t fPID[AliPID::kSPECIESN] ; // PID probability densities
-
- ClassDef(AliEMCALRecParticle,3) // Reconstructed Particle
-};
-
-#endif // AliEMCALRECPARTICLE_H
+++ /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. *
- **************************************************************************/
-/* $Id$ */
-//_________________________________________________________________________
-// Track segment in EMCAL
-// Can be : 1 EmcRecPoint
-// 1 EmcRecPoint + 1 PPSD
-// 1 EmcRecPoint + 1 PPSD + 1 PPSD
-//
-//*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
-// Adapted from PHOS by Y. Schutz (SUBATECH)
-
-// --- ROOT system ---
-
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliEMCALTrackSegment.h"
-
-ClassImp(AliEMCALTrackSegment)
-
-//____________________________________________________________________________
-AliEMCALTrackSegment::AliEMCALTrackSegment( AliEMCALRecPoint * eca)
-{
- // ctor
- if( eca )
- fECARecPoint = eca->GetIndexInList() ;
- else
- fECARecPoint = -1 ;
- fIndexInList = -1 ;
-}
-
-//____________________________________________________________________________
-AliEMCALTrackSegment::AliEMCALTrackSegment( const AliEMCALTrackSegment & ts)
- : TObject(ts)
-{
- // Copy ctor
-
- ( (AliEMCALTrackSegment &)ts ).Copy(*this) ;
-}
-
-
-//____________________________________________________________________________
-void AliEMCALTrackSegment::Copy(TObject & obj)
-{
- // Copy of a track segment into another track segment
-
- TObject::Copy(obj) ;
- ( (AliEMCALTrackSegment &)obj ).fECARecPoint = fECARecPoint ;
- ( (AliEMCALTrackSegment &)obj ).fIndexInList = fIndexInList ;
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegment::Print(Option_t *) const
-{
- // Print all information on this track Segment
- printf("Print: TrackSegment information:") ;
- printf("--------AliEMCALTrackSegment-------- \n");
- printf("Stored at position %d\n", fIndexInList) ;
- if (fECARecPoint)
- printf("EC RecPoint # %d\n", fECARecPoint) ;
- printf("------------------------------------ \n") ;
-}
+++ /dev/null
-#ifndef ALIEMCALTRACKSEGMENT_H
-#define ALIEMCALTRACKSEGMENT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Track segment in EMCAL
-//
-//*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
-// Adapted from PHOS by Y. Schutz (SUBATECH)
-// --- ROOT system ---
-
-#include "TObject.h"
-class TClonesArray ;
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliEMCALRecPoint.h"
-class AliEMCALRecPoint ;
-
-class AliEMCALTrackSegment : public TObject {
-
-public:
-
- AliEMCALTrackSegment() {}
- AliEMCALTrackSegment(AliEMCALRecPoint * ec) ;
- AliEMCALTrackSegment(const AliEMCALTrackSegment & ts) ; // ctor
- virtual ~AliEMCALTrackSegment() { }
-
- void Copy(TObject & obj) ;
-
- Int_t GetIndexInList() const { return fIndexInList ; }
- Int_t GetECAIndex() const { return fECARecPoint; }
-
- virtual void Print(Option_t * option) const;
- void SetIndexInList(Int_t val){ fIndexInList = val ; }
-
- typedef TClonesArray TrackSegmentsList ;
-
- private:
- Int_t fECARecPoint ; // The EC reconstructed point index in array stored in TreeR/EMCALECRP
- Int_t fIndexInList ; // The index of this TrackSegment in the list stored in TreeR (to be set by analysis)
-
- ClassDef(AliEMCALTrackSegment,2) // Track segment in EMCAL
-
-};
-
-#endif // ALIEMCALTRACKSEGMENT_H
+++ /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. *
- **************************************************************************/
-/* $Id$ */
-//_________________________________________________________________________
-// Algorithm Base class to construct EMCAL track segments
-// Associates EMC and PPSD clusters
-// Unfolds the EMC cluster
-//*--
-//*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH)
-// Adapted from PHOS by Y. Schutz (SUBATECH)
-
-
-// --- ROOT system ---
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliEMCALTrackSegmentMaker.h"
-#include "AliEMCALGetter.h"
-
-ClassImp( AliEMCALTrackSegmentMaker)
-
-
-//____________________________________________________________________________
- AliEMCALTrackSegmentMaker:: AliEMCALTrackSegmentMaker() : TTask("","")
-{
- // ctor
- fEventFolderName = "" ;
-
-}
-
-//____________________________________________________________________________
-AliEMCALTrackSegmentMaker::AliEMCALTrackSegmentMaker(const TString alirunFileName,
- const TString eventFolderName):
- TTask("EMCAL"+AliConfig::Instance()->GetTrackerTaskName(), alirunFileName),
- fEventFolderName(eventFolderName)
-{
- // ctor
-
-}
-
-//____________________________________________________________________________
-AliEMCALTrackSegmentMaker::~AliEMCALTrackSegmentMaker()
-{
- //Remove this from the parental task before destroying
- AliEMCALGetter::Instance()->EmcalLoader()->CleanTracker();
-}
-
+++ /dev/null
-#ifndef ALIEMCALTRACKSEGMENTMAKER_H
-#define ALIEMCALTRACKSEGMENTMAKER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Algorithm Base class to construct EMCAL track segments
-// Associates EMC and PPSD clusters
-// Unfolds the EMC cluster
-//
-//*-- Author: Dmitri Peressounko (RRC Kurchatov Institute & SUBATECH)
-// Adapted from PHOS by Y. Schutz (SUBATECH)
-
-// --- ROOT system ---
-#include "TTask.h"
-class TFile ;
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliConfig.h"
-class AliEMCALClusterizer ;
-class AliEMCALGeometry ;
-
-class AliEMCALTrackSegmentMaker : public TTask {
-
-public:
-
- AliEMCALTrackSegmentMaker() ;
- AliEMCALTrackSegmentMaker(const TString alirunFileName, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
- AliEMCALTrackSegmentMaker(const AliEMCALTrackSegmentMaker & tsmaker):TTask(tsmaker) { ; }
- virtual ~ AliEMCALTrackSegmentMaker() ;
-
- virtual void Exec(Option_t *) = 0;
- virtual Int_t GetTrackSegmentsInRun() const {Warning("GetTrackSegmentsInRun", "Not Defined" ) ; return 0 ; }
-
- virtual void Print(Option_t *) = 0;
- virtual const char * Version() const {Warning("Version", "Not Defined" ) ; return 0 ; }
- virtual void WriteTrackSegments() = 0;
-
-protected:
- TString fEventFolderName ; // event folder name
-
- ClassDef( AliEMCALTrackSegmentMaker,2) // Algorithm class to make EMCAL track segments (Base Class)
-
-};
-
-#endif // ALIEMCALTRACKSEGMENTMAKER_H
+++ /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. *
- **************************************************************************/
-/* $Id$ */
-//_________________________________________________________________________
-// Implementation version 1 of algorithm class to construct EMCAL track segments
-// Track segment for EMCAL is list of
-// ECAL RecPoint + (possibly) PRE RecPoint + (possibly) HCAL RecPoint
-// To find TrackSegments we do the following:
-// for each ECAL RecPoint we look for PRE and HC RecPoints with same direction within fSame.
-// If there is such a PRE or ECAL RecPoint,
-// we make a "Link": indexes of ECAL and PRE, HCAL RecPoints and their scalar product.
-// Then we sort "Links", starting from the
-// least "Link" pointing to the unassigned RecPoints assigning them to a new TrackSegment.
-// If there is no PRE, HCAL RecPoint we make a TrackSegment
-// consisting from ECAL alone. There is no TrackSegments without ECAL RecPoint.
-//// In principle this class should be called from AliEMCALReconstructioner, but
-// one can use it as well in standalone mode.
-//
-//*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH) & Yves Schutz (SUBATECH)
-//
-
-// --- ROOT system ---
-#include "TTree.h"
-#include "TBenchmark.h"
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-#include "AliEMCALTrackSegmentMakerv1.h"
-#include "AliEMCALTrackSegment.h"
-#include "AliEMCALLink.h"
-#include "AliEMCALGetter.h"
-
-ClassImp( AliEMCALTrackSegmentMakerv1)
-
-
-//____________________________________________________________________________
- AliEMCALTrackSegmentMakerv1::AliEMCALTrackSegmentMakerv1() : AliEMCALTrackSegmentMaker()
-{
- // default ctor (to be used mainly by Streamer)
-
- InitParameters() ;
- fDefaultInit = kTRUE ;
-}
-
-//____________________________________________________________________________
- AliEMCALTrackSegmentMakerv1::AliEMCALTrackSegmentMakerv1(const TString alirunFileName, const TString eventFolderName)
- :AliEMCALTrackSegmentMaker(alirunFileName, eventFolderName)
-{
- // ctor
-
- InitParameters() ;
- Init() ;
- fDefaultInit = kFALSE ;
-
-}
-
-//____________________________________________________________________________
- AliEMCALTrackSegmentMakerv1::~AliEMCALTrackSegmentMakerv1()
-{
- // dtor
- // fDefaultInit = kTRUE if TrackSegmentMaker created by default ctor (to get just the parameters)
-
-}
-
-//____________________________________________________________________________
-const TString AliEMCALTrackSegmentMakerv1::BranchName() const
-{
- return GetName() ;
-
-}
-
-//____________________________________________________________________________
-Float_t AliEMCALTrackSegmentMakerv1::HowClose(AliEMCALRecPoint * ec, AliEMCALRecPoint * rp, Bool_t &toofar)const
-{
- // Calculates the distance between the EMC RecPoint and the PPSD RecPoint
- // Clusters are sorted in "rows" and "columns" of width 1 cm
-
- Float_t r = -1. ;
- Float_t delta = 10. ; // large enough to be ineffective ??!
-
-
- TVector3 vecEC;
- TVector3 vecRP;
- ec->GetGlobalPosition(vecEC);
- rp->GetGlobalPosition(vecRP);
-
- Float_t pro = TMath::Abs(1 - (vecEC * vecRP / ( vecEC.Mag() * vecRP.Mag() ))) ;
-
- if(pro <= delta) {
- r = pro ;
- toofar = kFALSE ;
- }
- else
- toofar = kTRUE ;
-
- if (gDebug == 2 )
- printf("HowClose: ec = %d, rp = %d pro = %f, toofar=%d", ec->GetIndexInList(), rp->GetIndexInList(), pro, toofar ) ;
-
- return r ;
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::Init()
-{
- // Make all memory allocations that are not possible in default constructor
-
- AliEMCALGetter* gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data());
-
- if ( !gime->TrackSegmentMaker() ) {
- gime->PostTrackSegmentMaker(this);
- }
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::InitParameters()
-{
- fClose = 10e-3 ;
- fTrackSegmentsInRun = 0 ;
-}
-
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::MakeLinks()const
-{
- // Finds distances (links) between all PRE, EC and HC clusters,
- // which are not further apart from each other than fDangle
- // and sort them in accordance with this distance
-
- /* AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- TObjArray * aECARecPoints = gime->ECARecPoints() ;
- // TObjArray * aPRERecPoints = gime->PRERecPoints() ;
- //TObjArray * aHCARecPoints = gime->HCARecPoints() ;
-
- fPRELinkArray->Clear() ;
- fHCALinkArray->Clear() ;
-
- AliEMCALRecPoint * pre ;
- AliEMCALRecPoint * eca ;
- AliEMCALRecPoint * hca ;
-
- Int_t iPRELink = 0 ;
- Int_t iHCALink = 0 ;
-
- Int_t iECARP;
- for(iECARP = 0; iECARP < aECARecPoints->GetEntriesFast(); iECARP++ ) {
- eca = dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(iECARP)) ;
- Bool_t toofar = kTRUE ;
- Int_t iPRERP = 0 ;
- for(iPRERP = 0; iPRERP < aPRERecPoints->GetEntriesFast(); iPRERP++ ) {
- pre = dynamic_cast<AliEMCALRecPoint *>(aPRERecPoints->At(iPRERP)) ;
- Float_t prod = HowClose(eca, pre, toofar) ;
- if(toofar)
- break ;
- if(prod < fClose) {
- new ((*fPRELinkArray)[iPRELink++]) AliEMCALLink(prod, iECARP, iPRERP, 0) ;
- }
- }
- toofar = kTRUE ;
- Int_t iHCARP = 0 ;
- for(iHCARP = 0; iHCARP < aHCARecPoints->GetEntriesFast(); iHCARP++ ) {
- hca = dynamic_cast<AliEMCALRecPoint *>(aHCARecPoints->At(iHCARP)) ;
- Float_t prod = HowClose(eca, hca, toofar) ;
- if(toofar)
- break ;
- if(prod < fClose) {
- new ((*fHCALinkArray)[iHCALink++]) AliEMCALLink(prod, iECARP, iHCARP, 1) ;
- }
- }
- }
-
- fPRELinkArray->Sort() ; //first links with largest scalar product
- fHCALinkArray->Sort() ; //first links with largest scalar product
- */
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::MakePairs()
-{
- // Using the previously made list of "links", we found the best link - i.e.
- // link with the largest scalar product (closest to one) to still
- // unassigned RecParticles. We assign these RecPoints to TrackSegment and
- // remove them from the list of "unassigned".
-
- /*AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- TObjArray * aECARecPoints = gime->ECARecPoints() ;
- TObjArray * aPRERecPoints = gime->PRERecPoints() ;
- TObjArray * aHCARecPoints = gime->HCARecPoints() ;
- TClonesArray * trackSegments = gime->TrackSegments() ;
-
- //Make arrays to mark clusters already chosen
- Int_t * ecaExist = 0;
- Int_t nECA = aECARecPoints->GetEntriesFast() ;
- if (nECA)
- ecaExist = new Int_t[nECA] ;
-
- Int_t index;
- for(index = 0; index < nECA; index ++)
- ecaExist[index] = 1 ;
-
- Bool_t * preExist = 0;
- Int_t nPRE = aPRERecPoints->GetEntriesFast() ;
- if(nPRE)
- preExist = new Bool_t[nPRE] ;
- for(index = 0; index < nPRE; index ++)
- preExist[index] = kTRUE ;
-
- Bool_t * hcaExist = 0;
- Int_t nHCA = aHCARecPoints->GetEntriesFast() ;
- if(nHCA)
- hcaExist = new Bool_t[nHCA] ;
- for(index = 0; index < nHCA; index ++)
- hcaExist[index] = kTRUE ;
-
- AliEMCALRecPoint * null = 0 ;
- // Finds the smallest links and makes pairs of PRE and ECAL clusters with largest scalar product
-
- TIter nextPRE(fPRELinkArray) ;
- AliEMCALLink * linkPRE ;
-
- while ( (linkPRE = static_cast<AliEMCALLink *>(nextPRE()) ) ){
-
- if(ecaExist[linkPRE->GetECA()] != -1){ //without PRE yet
-
- if(preExist[linkPRE->GetOther()]){ // PRE still exist
-
- new ((* trackSegments)[fNTrackSegments])
- AliEMCALTrackSegment(dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(linkPRE->GetECA())) ,
- dynamic_cast<AliEMCALRecPoint *>(aPRERecPoints->At(linkPRE->GetOther())), null) ;
- (dynamic_cast<AliEMCALTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
- fNTrackSegments++ ;
- if (gDebug == 2 )
- printf("MakePairs: ECAL section with PRE section") ;
- ecaExist[linkPRE->GetECA()] = -1 ; //Mark ecal that pre was found
- //mark PRE recpoint as already used
- preExist[linkPRE->GetOther()] = kFALSE ;
- } //if PRE still exist
- }
- }
-
- // Finds the smallest links and makes pairs of HCAL and ECAL clusters with largest scalar product
-
- TIter nextHCA(fHCALinkArray) ;
- AliEMCALLink * linkHCA ;
-
- while ( (linkHCA = static_cast<AliEMCALLink *>(nextHCA()) ) ){
-
- if(ecaExist[linkHCA->GetECA()] != -2){ //without HCAL yet
-
- if(hcaExist[linkHCA->GetOther()]){ // HCAL still exist
- // search among the already existing track segments
- Int_t ii ;
- Bool_t found = kFALSE ;
- AliEMCALTrackSegment * ts = 0 ;
- for ( ii = 0 ; ii < fNTrackSegments ; ii++ ) {
- ts = dynamic_cast<AliEMCALTrackSegment *>(trackSegments->At(ii)) ;
- if ( ts->GetECAIndex() == linkHCA->GetECA() ) {
- found = kTRUE ;
- break ;
- }
- }
- if (found){
- ts->SetHCARecPoint( dynamic_cast<AliEMCALRecPoint *>(aHCARecPoints->At(linkHCA->GetOther())) ) ;
- if (gDebug == 2 )
- printf("MakePairs: ECAL section with PRE and HCAL sections") ;
- }
- if (!found) {
- new ((* trackSegments)[fNTrackSegments])
- AliEMCALTrackSegment(dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(linkHCA->GetECA())), null,
- dynamic_cast<AliEMCALRecPoint *>(aHCARecPoints->At(linkHCA->GetOther()))) ;
- (dynamic_cast<AliEMCALTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
- fNTrackSegments++ ;
- if (gDebug == 2 )
- printf("MakePairs: ECAL section with HCAL section") ;
- }
- ecaExist[linkHCA->GetECA()] = -2 ; //Mark ecal that hcal was found
- //mark HCAL recpoint as already used
- hcaExist[linkHCA->GetOther()] = kFALSE ;
- } //if HCAL still exist
- }
- }
-
-
- //look through ECAL recPoints left without PRE/HCAL
- if(ecaExist){ //if there is ecal rec point
- Int_t iECARP ;
- for(iECARP = 0; iECARP < nECA ; iECARP++ ){
- if(ecaExist[iECARP] > 0 ){
- new ((*trackSegments)[fNTrackSegments])
- AliEMCALTrackSegment(dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(iECARP)), null, null) ;
- (dynamic_cast<AliEMCALTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
- fNTrackSegments++;
- if( gDebug == 2 )
- printf("MakePairs: ECAL section alone") ;
- }
- }
- }
- delete [] ecaExist ;
- delete [] preExist ;
- delete [] hcaExist ;
- */
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::Exec(Option_t * option)
-{
- // STEERing method
-
-
- if(strstr(option,"tim"))
- gBenchmark->Start("EMCALTSMaker");
-
- if(strstr(option,"print")) {
- Print("") ;
- return ;
- }
-
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
-
- Int_t nevents = gime->MaxEvent() ;
- Int_t ievent ;
-
- for(ievent = 0; ievent < nevents; ievent++){
- gime->Event(ievent,"R") ;
- //Make some initializations
- fNTrackSegments = 0 ;
-
- gime->TrackSegments()->Clear() ;
-
- MakeLinks() ;
- MakePairs() ;
-
- WriteTrackSegments() ;
-
- if(strstr(option,"deb"))
- PrintTrackSegments(option) ;
-
- //increment the total number of track segments per run
- fTrackSegmentsInRun += gime->TrackSegments()->GetEntriesFast() ;
-
- }
-
- if(strstr(option,"tim")){
- gBenchmark->Stop("EMCALTSMaker");
- printf("Exec: took %f seconds for making TS %f seconds per event",
- gBenchmark->GetCpuTime("EMCALTSMaker"), gBenchmark->GetCpuTime("EMCALTSMaker")/nevents) ;
- }
- Unload();
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::Unload()
-{
- // Unloads the RecPoints and Tracks
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
- gime->EmcalLoader()->UnloadRecPoints() ;
- gime->EmcalLoader()->UnloadTracks() ;
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::Print(Option_t * /*option*/)const
-{
- // Print TrackSegmentMaker parameters
-
- printf("Print: TrackSegmentMakerv1 parameters:") ;
- if( strcmp(GetName(), "") != 0 ) {
- printf("Making Track segments with parameters:\n") ;
- printf(" Allowed spred on the scalar product of two recpoints with same direction: %f\n", fClose) ;
- printf("============================================\n") ;
- }
- else
- printf("AliEMCALTrackSegmentMakerv1 not initialized ") ;
-}
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::WriteTrackSegments()
-{
- // Writes found TrackSegments to TreeR. Creates branches
- // "EMCALTS" and "AliEMCALTrackSegmentMaker" with the same title.
- // In the former branch found TrackSegments are stored, while
- // in the latter all parameters, with which TS were made.
- // ROOT does not allow overwriting existing branches, therefore
- // first we check, if branches with the same title already exist.
- // If yes - exits without writing.
-
- AliEMCALGetter *gime = AliEMCALGetter::Instance() ;
-
- TClonesArray * trackSegments = gime->TrackSegments() ;
- trackSegments->Expand(trackSegments->GetEntriesFast()) ;
-
- TTree * treeT = gime->TreeT();
-
- //First TS
- Int_t bufferSize = 32000 ;
- TBranch * tsBranch = treeT->Branch("EMCALTS",&trackSegments,bufferSize);
- tsBranch->Fill() ;
-
- gime->WriteTracks("OVERWRITE");
- gime->WriteTrackSegmentMaker("OVERWRITE");
-}
-
-
-//____________________________________________________________________________
-void AliEMCALTrackSegmentMakerv1::PrintTrackSegments(Option_t * option)
-{
- // option deb - prints # of found TrackSegments
- // option deb all - prints as well indexed of found RecParticles assigned to the TS
-
- TClonesArray * trackSegments = AliEMCALGetter::Instance()->TrackSegments() ;
-
-
- printf("PrintTrackSegments: Results from TrackSegmentMaker:") ;
- printf("nevent: %d\n", gAlice->GetEvNumber()) ;
- printf(" Found %d TrackSegments\n", trackSegments->GetEntriesFast() );
-
- if(strstr(option,"all")) { // printing found TS
- printf("TrackSegment# ECAL RP# \n") ;
- Int_t index;
- for (index = 0 ; index < fNTrackSegments ; index++) {
- AliEMCALTrackSegment * ts = (AliEMCALTrackSegment * )trackSegments->At(index) ;
- printf(" %d %d \n",
- ts->GetIndexInList(), ts->GetECAIndex());
- }
- }
-}
+++ /dev/null
-#ifndef ALIEMCALTRACKSEGMENTMAKERV1_H
-#define ALIEMCALTRACKSEGMENTMAKERV1_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Implementation version 1 of algorithm class to construct EMCAL track segments
-// Associates EMC and PPSD clusters
-// Unfolds the EMC cluster
-//
-//*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH) & Yves Schutz (SUBATECH)
-
-// --- ROOT system ---
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliEMCALTrackSegmentMaker.h"
-
-class AliEMCALRecPoint ;
-
-class AliEMCALTrackSegmentMakerv1 : public AliEMCALTrackSegmentMaker {
-
-public:
-
- AliEMCALTrackSegmentMakerv1() ;
- AliEMCALTrackSegmentMakerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName());
- AliEMCALTrackSegmentMakerv1(const AliEMCALTrackSegmentMakerv1 & tsm):AliEMCALTrackSegmentMaker(tsm) {
- // cpy ctor: no implementation yet
- // requested by the Coding Convention
- Fatal("cpy ctor", "not implemented") ;
-}
-
- virtual ~ AliEMCALTrackSegmentMakerv1() ; // dtor
-
- virtual Int_t GetTrackSegmentsInRun()const {return fTrackSegmentsInRun ;}
-
- virtual void Exec(Option_t * option) ;
- Float_t HowClose(AliEMCALRecPoint * ec, AliEMCALRecPoint * rp, Bool_t &toofar) const ;
- void MakeLinks() const; //Evaluates distances(links) between recpoints
- void MakePairs() ; //Finds pairs(triplets) with smallest link
- virtual void Print(Option_t * option) const ;
- virtual const char * Version() const { return "tsm-v1" ; }
-
- AliEMCALTrackSegmentMakerv1 & operator = (const AliEMCALTrackSegmentMakerv1 & ) {
- // assignement operator requested by coding convention but not needed
- Fatal("operator =", "not implemented") ;
- return *this ;
- }
-
-
-private:
-
- const TString BranchName() const ;
- void Init() ;
- void InitParameters() ;
- void PrintTrackSegments(Option_t *option) ;
- void Unload() ;
- virtual void WriteTrackSegments() ;
-
-private:
-
- Float_t fClose ; // Spread within which 2 recpoints are declared to have the same direction
- Bool_t fDefaultInit ; //! Says if the task was created by defaut ctor (only parameters are initialized)
- Int_t fNTrackSegments ; // number of track segments found
- Int_t fTrackSegmentsInRun ; //! Total number of track segments in one run
-
- ClassDef( AliEMCALTrackSegmentMakerv1,4) // Implementation version 1 of algorithm class to make EMCAL track segments
-
-};
-
-#endif // AliEMCALTRACKSEGMENTMAKERV1_H
+++ /dev/null
-#include "AliEMCALTracker.h"
-#include "AliEMCALPIDv1.h"
-#include "AliRunLoader.h"
-#include "AliESD.h"
-
-//-------------------------------------------------------------------------
-// EMCAL tracker.
-// Matches ESD tracks with the EMCAL and makes the PID.
-// Currently, has only one function implemented : PropagateBack(AliESD*)
-//-------------------------------------------------------------------------
-
-ClassImp(AliEMCALTracker)
-
-Bool_t AliEMCALTracker::fgDebug = kFALSE ;
-
-Int_t AliEMCALTracker::PropagateBack(AliESD *esd) {
- // Makes the Particle Identification
-
- esd=0; // This is to avoid a compilation warning.
- // This pointer is reserved for future needs
-
- Int_t eventNumber = fRunLoader->GetEventNumber() ;
-
- TString headerFile(fRunLoader->GetFileName()) ;
- TString branchName(fRunLoader->GetEventFolder()->GetName()) ;
-
- AliEMCALPIDv1 pid(headerFile, branchName);
-
- // do current event; the loop over events is done by AliReconstruction::Run()
- pid.SetEventRange(eventNumber, eventNumber) ;
- if ( Debug() )
- pid.ExecuteTask("deb all") ;
- else
- pid.ExecuteTask("") ;
-
- return 0;
-}
+++ /dev/null
-#ifndef AliEMCALTracker_h
-#define AliEMCALTracker_h
-
-//-------------------------------------------------------------------------
-// EMCAL tracker.
-// Matches ESD tracks with the EMCAL and makes the PID.
-// Currently, has only one function implemented : PropagateBack(AliESD*).
-//-------------------------------------------------------------------------
-
-#include <AliTracker.h>
-#include <AliLog.h>
-
-class AliCluster;
-class AliESD;
-class TTree;
-class AliRunLoader;
-
-class AliEMCALTracker : public AliTracker
-{
-public:
- AliEMCALTracker():AliTracker() {fRunLoader=0;}
- AliEMCALTracker(AliRunLoader *loader):AliTracker() {fRunLoader=loader;}
- virtual ~AliEMCALTracker() {AliDebug(1,"Start.");}
-
- Int_t Clusters2Tracks(AliESD *) {AliDebug(1,"Start.");return 0;}
- Int_t RefitInward(AliESD *) {AliDebug(1,"Start.");return 0;}
- void UnloadClusters() {AliDebug(1,"Start.");}
- AliCluster *GetCluster(Int_t ) const {AliDebug(1,"Start.");return 0;}
- Int_t PropagateBack(AliESD *);
- Int_t LoadClusters(TTree *) {AliDebug(1,"Start.");return 0;}
-
- static void SetDebug() { fgDebug = kTRUE ; }
- static void ResetDebug() { fgDebug = kFALSE ; }
- static Bool_t Debug() { return fgDebug ; }
-
-private:
- static Bool_t fgDebug ; //! Verbosity controller
- AliRunLoader *fRunLoader; //! Pointer to the run loader
- ClassDef(AliEMCALTracker,0)
-};
-
-#endif