LCOV - code coverage report
Current view: top level - EMCAL/EMCALbase - AliEMCAL.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 85 149 57.0 %
Date: 2016-06-14 17:26:59 Functions: 12 15 80.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : //_________________________________________________________________________
      18             : // Base Class for EMCAL description:
      19             : // This class contains material definitions    
      20             : // for the EMCAL - It does not place the detector in Alice
      21             : //*-- Author: Yves Schutz (SUBATECH) 
      22             : //
      23             : //*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
      24             : //                            : Alexei Pavlinov (WSU) 
      25             : //
      26             : //////////////////////////////////////////////////////////////////////////////
      27             : 
      28             : // --- ROOT system ---
      29             : class TFile;
      30             : #include <TFolder.h> 
      31             : #include <TGeoGlobalMagField.h>
      32             : #include <TGraph.h> 
      33             : #include <TH1F.h> 
      34             : #include <TRandom.h> 
      35             : #include <TTree.h>
      36             : #include <TVirtualMC.h> 
      37             : 
      38             : // --- Standard library ---
      39             : 
      40             : // --- AliRoot header files ---
      41             : #include "AliMagF.h"
      42             : #include "AliLog.h"
      43             : #include "AliEMCAL.h"
      44             : #include "AliRun.h"
      45             : #include "AliRunLoader.h"
      46             : #include "AliCDBManager.h"
      47             : #include "AliEMCALLoader.h"
      48             : #include "AliEMCALSDigitizer.h"
      49             : #include "AliEMCALDigitizer.h"
      50             : #include "AliEMCALDigit.h"
      51             : #include "AliEMCALRawUtils.h"
      52             : #include "AliCDBManager.h"
      53             : #include "AliCDBEntry.h"
      54             : #include "AliEMCALRawUtils.h"
      55             : #include "AliRawReader.h"
      56             : #include "AliEMCALTriggerData.h"
      57             : #include "AliEMCALRecParam.h"
      58             : #include "AliRawEventHeaderBase.h"
      59             : 
      60          42 : ClassImp(AliEMCAL)
      61             : 
      62             : //for embedding
      63             : AliEMCALRawUtils*        AliEMCAL::fgRawUtils   = 0;   // EMCAL raw utilities class
      64             : 
      65             : //____________________________________________________________________________
      66             : AliEMCAL::AliEMCAL()
      67          12 :   : AliDetector(),
      68          12 :     fBirkC0(0),
      69          12 :     fBirkC1(0.),
      70          12 :     fBirkC2(0.),
      71          12 :     fGeometry(0), 
      72          12 :     fCheckRunNumberAndGeoVersion(kTRUE),
      73          12 :     fTriggerData(0x0)
      74          36 : {
      75             :   // Default ctor 
      76          12 :   fName = "EMCAL" ;
      77          12 :   InitConstants();
      78             :   
      79             :   // Should call  AliEMCALGeometry::GetInstance(EMCAL->GetTitle(),"") for getting EMCAL geometry
      80          12 : }
      81             : 
      82             : //____________________________________________________________________________
      83             : AliEMCAL::AliEMCAL(const char* name, const char* title, 
      84             :                    const Bool_t checkGeoAndRun)
      85           1 :   : AliDetector(name,title),
      86           1 :     fBirkC0(0),
      87           1 :     fBirkC1(0.),
      88           1 :     fBirkC2(0.),
      89           1 :     fGeometry(0), 
      90           1 :     fCheckRunNumberAndGeoVersion(checkGeoAndRun),
      91           1 :     fTriggerData(0x0)
      92           2 : {
      93             :   //   ctor : title is used to identify the layout
      94           1 :   InitConstants();
      95             :   
      96           1 : }
      97             : 
      98             : //____________________________________________________________________________
      99             : AliEMCAL::~AliEMCAL()
     100          26 : {
     101             :   //dtor
     102          13 :   delete fgRawUtils;
     103          13 :   delete fTriggerData;   
     104             :   //fTriggerData->Delete(); // RS: if TClonesArray is created, Delete will be called from ~TClonesArray
     105          13 : }
     106             : 
     107             : //____________________________________________________________________________
     108             : void AliEMCAL::InitConstants()
     109             : {
     110             :   //initialize EMCAL values
     111          26 :   fBirkC0 = 1;
     112          13 :   fBirkC1 = 0.013/1.032;
     113          13 :   fBirkC2 = 9.6e-6/(1.032 * 1.032);
     114          13 : }
     115             : 
     116             : //Not needed, modify $ALICE_ROOT/data/galice.cuts instead.
     117             : //Load the modified one in the configuration file with SetTransPar
     118             : // //____________________________________________________________________________
     119             : // void AliEMCAL::DefineMediumParameters()
     120             : // {
     121             : //   //
     122             : //   // EMCAL cuts (Geant3) 
     123             : //   // 
     124             : //   Int_t * idtmed = fIdtmed->GetArray() - 1599 ; 
     125             : // // --- Set decent energy thresholds for gamma and electron tracking
     126             : 
     127             : //   // Tracking threshold for photons and electrons in Lead 
     128             : //   Float_t cutgam=10.e-5; // 100 kev;
     129             : //   Float_t cutele=10.e-5; // 100 kev;
     130             : //   TString ntmp(GetTitle()); 
     131             : //   ntmp.ToUpper();
     132             : //   if(ntmp.Contains("10KEV")) {
     133             : //     cutele = cutgam = 1.e-5;
     134             : //   } else if(ntmp.Contains("50KEV")) {
     135             : //     cutele = cutgam = 5.e-5;
     136             : //   } else if(ntmp.Contains("100KEV")) {
     137             : //     cutele = cutgam = 1.e-4;
     138             : //   } else if(ntmp.Contains("200KEV")) {
     139             : //     cutele = cutgam = 2.e-4;
     140             : //   } else if(ntmp.Contains("500KEV")) {
     141             : //     cutele = cutgam = 5.e-4;
     142             : //   }
     143             : 
     144             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"CUTGAM", cutgam);
     145             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
     146             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     147             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     148             : //   // --- Generate explicitly delta rays in Lead ---
     149             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "LOSS", 3) ;
     150             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "DRAY", 1) ;
     151             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "DCUTE", cutele) ;
     152             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "DCUTM", cutele) ;
     153             : 
     154             : // // --- in aluminium parts ---
     155             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"CUTGAM", cutgam) ;
     156             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"CUTELE", cutele) ;
     157             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     158             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     159             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "LOSS",3.) ;
     160             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "DRAY",1.) ;
     161             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "DCUTE", cutele) ;
     162             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "DCUTM", cutele) ;
     163             : 
     164             : // // --- and finally thresholds for photons and electrons in the scintillator ---
     165             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"CUTGAM", cutgam) ;
     166             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"CUTELE", cutele) ;// 1MEV -> 0.1MEV; 15-aug-05
     167             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     168             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     169             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "LOSS",3) ; // generate delta rays 
     170             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "DRAY",1) ;
     171             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "DCUTE", cutele) ;
     172             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "DCUTM", cutele) ;
     173             : 
     174             : //   // S steel - 
     175             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"CUTGAM", cutgam);
     176             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"CUTELE", cutele);
     177             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     178             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
     179             : //   // --- Generate explicitly delta rays 
     180             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "LOSS",3);
     181             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "DRAY",1);
     182             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "DCUTE", cutele) ;
     183             : //   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "DCUTM", cutele) ;
     184             : 
     185             : //   AliEMCALGeometry* geom = GetGeometry();
     186             : //   if(geom->GetILOSS()>=0) {
     187             : //     for(int i=1600; i<=1603; i++) TVirtualMC::GetMC()->Gstpar(idtmed[i], "LOSS", geom->GetILOSS()) ; 
     188             : //   } 
     189             : //   if(geom->GetIHADR()>=0) {
     190             : //     for(int i=1600; i<=1603; i++) TVirtualMC::GetMC()->Gstpar(idtmed[i], "HADR", geom->GetIHADR()) ; 
     191             : //   }
     192             : // }
     193             : 
     194             : //____________________________________________________________________________
     195             : AliDigitizer* AliEMCAL::CreateDigitizer(AliDigitizationInput* digInput) const
     196             : {
     197             :   //create and return the digitizer
     198           3 :   return new AliEMCALDigitizer(digInput);
     199           0 : }
     200             : 
     201             : //____________________________________________________________________________
     202             : void AliEMCAL::CreateMaterials()
     203             : {
     204             :   // Definitions of materials to build EMCAL and associated tracking media.
     205             :   // media number in idtmed are 1599 to 1698.
     206             :   // --- Air ---               
     207           2 :   Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
     208           1 :   Float_t zAir[4]={6.,7.,8.,18.};
     209           1 :   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
     210             :   Float_t dAir = 1.20479E-3;
     211           1 :   AliMixture(0, "Air$", aAir, zAir, dAir, 4, wAir) ;
     212             : 
     213             :   // --- Lead ---                                                                     
     214           1 :   AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
     215             : 
     216             : 
     217             :   // --- The polysterene scintillator (CH) ---
     218           1 :   Float_t aP[2] = {12.011, 1.00794} ;
     219           1 :   Float_t zP[2] = {6.0, 1.0} ;
     220           1 :   Float_t wP[2] = {1.0, 1.0} ;
     221             :   Float_t dP = 1.032 ;
     222             : 
     223           1 :   AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
     224             : 
     225             :   // --- Aluminium ---
     226           1 :   AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
     227             :   // ---         Absorption length is ignored ^
     228             : 
     229             :   // 25-aug-04 by PAI - see  PMD/AliPMDv0.cxx for STEEL definition
     230           1 :   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
     231           1 :   Float_t zsteel[4] = { 26.,24.,28.,14. };
     232           1 :   Float_t wsteel[4] = { .715,.18,.1,.005 };
     233           1 :   AliMixture(4, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
     234             : 
     235             :   // Oct 26,2010 : Multipurpose Copy Paper UNV-21200), weiht 75 g/m**2. 
     236             :   // *Cellulose C6H10O5
     237             :   //    Component C  A=12.01   Z=6.    W=6./21.
     238             :   //    Component H  A=1.      Z=1.    W=10./21.
     239             :   //    Component O  A=16.     Z=8.    W=5./21.
     240           1 :   Float_t apaper[3] = { 12.01, 1.0, 16.0};
     241           1 :   Float_t zpaper[3] = {  6.0,  1.0,  8.0};
     242           1 :   Float_t wpaper[3] = {6./21., 10./21., 5./21.};
     243           1 :   AliMixture(5, "BondPaper$", apaper, zpaper, 0.75, 3, wpaper);
     244             :  
     245             :   // DEFINITION OF THE TRACKING MEDIA
     246             :   // Look to the $ALICE_ROOT/data/galice.cuts for particular values
     247             :   // of cuts.
     248             :   // Don't forget to add a new tracking medium with non-default cuts
     249             : 
     250             :   // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
     251           1 :   Int_t   isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ() ;
     252           1 :   Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max() ;
     253             : 
     254             :   // Air                                                                         -> idtmed[1599]
     255           1 :  AliMedium(0, "Air$", 0, 0,
     256             :              isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
     257             : 
     258             :   // The Lead                                                                      -> idtmed[1600]
     259             :  
     260           1 :   AliMedium(1, "Lead$", 1, 0,
     261             :              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
     262             : 
     263             :  // The scintillator of the CPV made of Polystyrene scintillator                   -> idtmed[1601]
     264             :   float deemax = 0.1; // maximum fractional energy loss in one step (0 < DEEMAX < deemax )
     265           1 :   AliMedium(2, "Scintillator$", 2, 1,
     266             :             isxfld, sxmgmx, 10.0, 0.001, deemax, 0.001, 0.001, 0, 0) ;
     267             : 
     268             :   // Various Aluminium parts made of Al                                            -> idtmed[1602]
     269           1 :   AliMedium(3, "Al$", 3, 0,
     270             :              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
     271             : 
     272             :   // 25-aug-04 by PAI : see  PMD/AliPMDv0.cxx for STEEL definition                 -> idtmed[1603]
     273           1 :   AliMedium(4, "S steel$", 4, 0, 
     274             :              isxfld, sxmgmx, 10.0, 0.01, 0.1, 0.001, 0.001, 0, 0) ;
     275             : 
     276             :   // Oct 26,2010; Nov 24,2010                                                      -> idtmed[1604]
     277             :   deemax = 0.01;
     278           1 :   AliMedium(5, "Paper$", 5, 0, 
     279             :              isxfld, sxmgmx, 10.0, deemax, 0.1, 0.001, 0.001, 0, 0) ;
     280             : 
     281             : 
     282             :   //set constants for Birk's Law implentation
     283           1 :   fBirkC0 =  1;
     284           1 :   fBirkC1 =  0.013/dP;
     285           1 :   fBirkC2 =  9.6e-6/(dP * dP);
     286             : 
     287           1 : }
     288             : 
     289             : //____________________________________________________________________________
     290             : void  AliEMCAL::Init()
     291             : { 
     292             :   // Init
     293             :   //Not needed, modify $ALICE_ROOT/data/galice.cuts instead.
     294             :   //Load the modified one in the configuration file with SetTransPar
     295             :   //DefineMediumParameters(); 
     296           2 : }     
     297             : 
     298             : //____________________________________________________________________________
     299             : void AliEMCAL::Digits2Raw() {
     300             : 
     301             :   //  static AliEMCALRawUtils rawUtils;
     302             :   // RS why this should be static? This makes root to die produce "double delete"
     303             :   // since the TF1 created in the rawUtils is garbage-collected by root before the 
     304             :   // destructor is called during garbage collecting of the static object
     305           8 :   AliEMCALRawUtils rawUtils;
     306           4 :   rawUtils.Digits2Raw();
     307             : 
     308           4 : }
     309             : //____________________________________________________________________________
     310             : void AliEMCAL::Hits2SDigits()  
     311             : { 
     312             : // create summable digits
     313             : 
     314           2 :   GetGeometry();
     315           4 :   AliEMCALSDigitizer emcalDigitizer(fLoader->GetRunLoader()->GetFileName().Data()) ;
     316           1 :   emcalDigitizer.SetEventRange(0, -1) ; // do all the events
     317           1 :   emcalDigitizer.Digitize() ;
     318           1 : }
     319             : 
     320             : //______________________________________________________________________
     321             : Bool_t AliEMCAL::Raw2SDigits(AliRawReader* rawReader){
     322             :   
     323             :   // Conversion from raw data to EMCAL sdigits. 
     324             :   // Does the same as AliEMCALReconstructor::ConvertDigits()
     325             :   // Needed to embed real data and simulation
     326             :   // Works on a single-event basis
     327             :   
     328           0 :   rawReader->Reset() ; 
     329             :   
     330             :   //Get/create the sdigits tree and array
     331           0 :         AliRunLoader *rl = AliRunLoader::Instance();
     332           0 :         AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL")); 
     333             :   
     334           0 :   if(!emcalLoader){
     335           0 :     AliFatal("NULL loader");
     336           0 :     return kFALSE;
     337             :   }
     338             :   
     339           0 :   emcalLoader->GetEvent();
     340           0 :   emcalLoader->LoadSDigits("UPDATE");
     341             : 
     342           0 :   TTree * treeS = emcalLoader->TreeS();
     343           0 :   if ( !treeS ) { 
     344           0 :     emcalLoader->MakeSDigitsContainer();
     345           0 :     treeS = emcalLoader->TreeS();
     346           0 :   }
     347             :   
     348           0 :   if(!emcalLoader->SDigits()) {
     349           0 :     AliFatal("No sdigits array available\n");
     350           0 :     return kFALSE;
     351             :   }
     352             :   
     353           0 :   TClonesArray * sdigits = emcalLoader->SDigits();
     354           0 :   sdigits->Clear("C");  
     355             :   
     356             :   //Trigger sdigits
     357           0 :   if (!fTriggerData) {
     358           0 :     int dsize = (GetGeometry()->GetTriggerMappingVersion() == 2) ? 2 : 1;
     359           0 :     fTriggerData = new TClonesArray("AliEMCALTriggerData",dsize);
     360           0 :     for (int i=0;i<dsize;i++) {
     361           0 :       new((*fTriggerData)[i]) AliEMCALTriggerData();
     362             :     }
     363           0 :   }
     364             :   
     365           0 :   for (int i=0;i<fTriggerData->GetEntriesFast();i++) {
     366           0 :     ((AliEMCALTriggerData*)fTriggerData->At(i))->SetMode(1);   
     367             :   }
     368             :   
     369           0 :   const Int_t nTRU = GetGeometry()->GetNTotalTRU();
     370           0 :   TClonesArray *digitsTrg = new TClonesArray("AliEMCALTriggerRawDigit", nTRU * 96);    
     371             :   Int_t bufsize = 32000;
     372           0 :   treeS->Branch("EMTRG", &digitsTrg, bufsize);
     373             :   
     374             :   
     375             :   //Only physics events
     376           0 :   if (rawReader->GetType()== AliRawEventHeaderBase::kPhysicsEvent) {
     377             : 
     378           0 :     if(!fgRawUtils)  fgRawUtils   = new AliEMCALRawUtils;
     379             :     //must be done here because, in constructor, option is not yet known
     380           0 :     fgRawUtils->SetOption(GetOption());
     381             :     
     382             :     // Set parameters from OCDB to raw utils
     383           0 :     AliEMCALRecParam* recpar = emcalLoader->ReconstructionParameters(0);
     384             :     // fgRawUtils->SetRawFormatHighLowGainFactor(recpar->GetHighLowGainFactor());
     385             :     // fgRawUtils->SetRawFormatOrder(recpar->GetOrderParameter());
     386             :     // fgRawUtils->SetRawFormatTau(recpar->GetTau());
     387           0 :     fgRawUtils->SetNoiseThreshold(recpar->GetNoiseThreshold());
     388           0 :     fgRawUtils->SetNPedSamples(recpar->GetNPedSamples());
     389           0 :     fgRawUtils->SetRemoveBadChannels(recpar->GetRemoveBadChannels());
     390           0 :     fgRawUtils->SetFittingAlgorithm(recpar->GetFittingAlgorithm());
     391           0 :     fgRawUtils->SetFALTROUsage(recpar->UseFALTRO());
     392             :     // fgRawUtils->SetTimeMin(recpar->GetTimeMin());
     393             :     // fgRawUtils->SetTimeMax(recpar->GetTimeMax());
     394             : 
     395             :     //Fit
     396           0 :     fgRawUtils->Raw2Digits(rawReader,sdigits,emcalLoader->PedestalData(),digitsTrg,fTriggerData);
     397             :     
     398           0 :   }//skip calibration event
     399             :   else{
     400           0 :     AliDebug(1," Calibration Event, skip!");
     401             :   }
     402             :   
     403             :   //Final arrangements of the array, set all sdigits as embedded
     404           0 :   sdigits->Sort() ;
     405           0 :   for (Int_t iSDigit = 0 ; iSDigit < sdigits->GetEntriesFast() ; iSDigit++) { 
     406           0 :     AliEMCALDigit * sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(iSDigit)) ;
     407           0 :     if(sdigit){
     408           0 :       sdigit->SetIndexInList(iSDigit) ;
     409           0 :       sdigit->SetType(AliEMCALDigit::kEmbedded);
     410           0 :     }
     411             :     else {
     412           0 :       AliFatal("sdigit is NULL!");
     413             :     }
     414             :   }     
     415             :   
     416           0 :   AliDebug(1,Form("Embedded sdigits entries %d \n",sdigits->GetEntriesFast()));
     417             :   
     418             :   //Write array, clean arrays, unload ..
     419             :   
     420             :   Int_t bufferSize = 32000 ;    
     421           0 :   TBranch * sdigitsBranch = treeS->GetBranch("EMCAL");
     422           0 :   if (sdigitsBranch)
     423           0 :     sdigitsBranch->SetAddress(&sdigits);
     424             :   else
     425           0 :     treeS->Branch("EMCAL",&sdigits,bufferSize);
     426             :   
     427           0 :   treeS->Fill();
     428           0 :   emcalLoader->WriteSDigits("OVERWRITE");
     429           0 :   emcalLoader->UnloadSDigits();
     430             : 
     431           0 :   digitsTrg->Delete();
     432           0 :   delete digitsTrg;
     433             :     
     434             :   return kTRUE;
     435             :   
     436           0 : }
     437             : 
     438             : //____________________________________________________________________________
     439             : 
     440             : AliLoader* AliEMCAL::MakeLoader(const char* topfoldername)
     441             : {
     442             : //different behaviour than standard (singleton getter)
     443             : // --> to be discussed and made eventually coherent
     444           4 :  fLoader = new AliEMCALLoader(GetName(),topfoldername);
     445           1 :  return fLoader;
     446           0 : }
     447             : 
     448             : //____________________________________________________________________________
     449             : 
     450             : AliEMCALGeometry* AliEMCAL::GetGeometry() const
     451             : {
     452             :   //Initializes and returns geometry
     453             :   
     454             :   // Pass the transpor model name (Geant3, Geant4, Fluka) and title to the geometry
     455             :   // Check the transport model name and option in the geometry, 
     456             :   // set sampling fraction depending on it (AliEMCALEMCGeometry::DefineSamplingFraction)
     457             : 
     458         124 :   TString mcname   = "";
     459          62 :   TString mctitle  = "";
     460         124 :   if(TVirtualMC::GetMC())
     461             :   {
     462         123 :     mcname  = TVirtualMC::GetMC()->GetName()  ;
     463         123 :     mctitle = TVirtualMC::GetMC()->GetTitle() ;
     464             :   }
     465             :  
     466         124 :   TString geoName(GetTitle());
     467             :   
     468             :   //Check if run number and requested geometry correspond to the same geometry as
     469             :   //in real data taking. To prevent errors in official simulation productions
     470         124 :   if(!(AliEMCALGeometry::GetInstance()))
     471             :   {
     472             :     // Set geometry with the name used in the configuration file
     473           2 :     if(!fCheckRunNumberAndGeoVersion)
     474             :     {
     475           0 :       AliInfo(Form("Geometry name in use <<%s>>, requested via Config file", geoName.Data()));
     476           0 :       return AliEMCALGeometry::GetInstance(GetTitle(),"EMCAL",mcname,mctitle) ;
     477             :     }
     478             :     else
     479             :     {
     480             :       // Check run number and version and set the corresponding one.
     481             :       // Get run number
     482             :       // AliRunLoader *rl = AliRunLoader::Instance();
     483             :       // Int_t runNumber = rl->GetRunNumber();
     484             :       
     485           2 :       AliCDBManager* man = AliCDBManager::Instance();
     486           2 :       Int_t runNumber = man->GetRun();
     487             :       
     488          10 :       return AliEMCALGeometry::GetInstanceFromRunNumber(runNumber,geoName,mcname,mctitle);
     489             :     }
     490             :   }// Init geometry for the first time
     491             :   
     492             :   
     493         120 :   return AliEMCALGeometry::GetInstance();
     494             :     
     495          62 : }

Generated by: LCOV version 1.11