From c2ef87c2a6b39d93755efddce42e65740148925e Mon Sep 17 00:00:00 2001 From: gconesab Date: Tue, 21 Jun 2011 02:54:09 +0000 Subject: [PATCH] Call fatal when anchored simulations have the wrong geometry initialized, on by default but can be switched off --- EMCAL/AliEMCAL.cxx | 8 ++++-- EMCAL/AliEMCAL.h | 11 +++++--- EMCAL/AliEMCALv0.cxx | 41 +++++++++++++++++++++++++----- EMCAL/AliEMCALv0.h | 12 ++++----- EMCAL/macros/Config.C | 3 +++ EMCAL/macros/TestEMCALSimulation.C | 6 +++-- 6 files changed, 61 insertions(+), 20 deletions(-) diff --git a/EMCAL/AliEMCAL.cxx b/EMCAL/AliEMCAL.cxx index 7c0527582bf..55bb424a8f6 100644 --- a/EMCAL/AliEMCAL.cxx +++ b/EMCAL/AliEMCAL.cxx @@ -57,7 +57,9 @@ AliEMCAL::AliEMCAL() fBirkC0(0), fBirkC1(0.), fBirkC2(0.), - fGeometry(0) + fGeometry(0), + fCheckRunNumberAndGeoVersion(kTRUE) + { // Default ctor fName = "EMCAL" ; @@ -72,7 +74,9 @@ AliEMCAL::AliEMCAL(const char* name, const char* title) fBirkC0(0), fBirkC1(0.), fBirkC2(0.), - fGeometry(0) + fGeometry(0), + fCheckRunNumberAndGeoVersion(kTRUE) + { // ctor : title is used to identify the layout InitConstants(); diff --git a/EMCAL/AliEMCAL.h b/EMCAL/AliEMCAL.h index 2769cb0747f..63ba6711aec 100644 --- a/EMCAL/AliEMCAL.h +++ b/EMCAL/AliEMCAL.h @@ -72,21 +72,24 @@ class AliEMCAL : public AliDetector { virtual AliLoader* MakeLoader(const char* topfoldername); virtual const TString Version() const {return TString(" ") ; } + virtual void SetCheckRunNumberAndGeoVersion(Bool_t check) { fCheckRunNumberAndGeoVersion = check ; } + + protected: void InitConstants(); //initializes some params - //void DefineMediumParameters(); // define tracking medium parameters; not needed set in galice.cuts - Int_t fBirkC0; // constants for Birk's Law implementation + Int_t fBirkC0; // constants for Birk's Law implementation Double_t fBirkC1; // constants for Birk's Law implementation Double_t fBirkC2; // constants for Birk's Law implementation - AliEMCALGeometry* fGeometry; //! + AliEMCALGeometry* fGeometry; //! + Bool_t fCheckRunNumberAndGeoVersion; // Check if run number corresponds to the requested geometry and V1 is used private: AliEMCAL(const AliEMCAL& emcal); AliEMCAL & operator = (const AliEMCAL & /*rvalue*/); - ClassDef(AliEMCAL,10) // Electromagnetic calorimeter (base class) + ClassDef(AliEMCAL,11) // Electromagnetic calorimeter (base class) } ; diff --git a/EMCAL/AliEMCALv0.cxx b/EMCAL/AliEMCALv0.cxx index 97d122e167e..8ed293f2ba1 100644 --- a/EMCAL/AliEMCALv0.cxx +++ b/EMCAL/AliEMCALv0.cxx @@ -37,22 +37,24 @@ #include #include -//--- EMCAL system--- -#include "AliEMCALShishKebabTrd1Module.h" - // --- Standard library --- //#include // --- AliRoot header files --- - -#include "AliEMCALv0.h" -#include "AliEMCALGeometry.h" #include "AliRun.h" +#include "AliRunLoader.h" #include "AliLog.h" #include "AliGeomManager.h" + +//--- EMCAL system--- +#include "AliEMCALShishKebabTrd1Module.h" +#include "AliEMCALv0.h" +#include "AliEMCALGeometry.h" #include "AliEMCALSpaceFrame.h" + + ClassImp(AliEMCALv0) // EMCAL material: look to the AliEMCAL.cxx @@ -115,6 +117,33 @@ void AliEMCALv0::CreateGeometry() Error("CreateGeometry","EMCAL Geometry class has not been set up."); } // end if + //Check if run number and requested geometry correspond to the same geometry as + //in real data taking. To prevent errors in official productions + if(fCheckRunNumberAndGeoVersion){ + AliRunLoader *rl = AliRunLoader::Instance(); + Int_t runNumber = rl->GetRunNumber(); + TString geoName = geom->GetEMCGeometry()->GetGeoName(); + Bool_t ok = kTRUE; + if(!geoName.Contains("V1")) { + ok = kFALSE; + AliFatal(Form("Add <> to set EMCAL geometry name <<%s>>", geoName.Data())); + } + else if(runNumber > 140000){ + if(geoName.Contains("FIRSTYEAR")) ok = kFALSE; + } + else { + if(geoName.Contains("COMPLETE")) ok = kFALSE; + } + + if(!ok) { + AliFatal(Form("Run number -%d-, does not correspond to the requested geometry <<%s>> with -%d- SuperModules", + runNumber, geoName.Data(), geom->GetNumberOfSuperModules())); + } + + AliDebug(0,Form("Run number %d and geometry %s, N Super Modules %d\n", + runNumber, geoName.Data(), geom->GetNumberOfSuperModules())); + } + // Get pointer to the array containing media indices fIdTmedArr = fIdtmed->GetArray() - 1599 ; diff --git a/EMCAL/AliEMCALv0.h b/EMCAL/AliEMCALv0.h index 06f8d6146e2..0279a6fbbd3 100644 --- a/EMCAL/AliEMCALv0.h +++ b/EMCAL/AliEMCALv0.h @@ -36,11 +36,11 @@ class AliEMCALv0 : public AliEMCAL { using AliEMCAL::AddHit; - virtual void AddAlignableVolumes() const; - virtual void AddAlignableVolumesInALICE() const; - virtual void AddAlignableVolumesInWSUC() const; - - virtual void CreateGeometry() ;// creates the geometry for GEANT + virtual void AddAlignableVolumes() const; + virtual void AddAlignableVolumesInALICE() const; + virtual void AddAlignableVolumesInWSUC() const; + + virtual void CreateGeometry() ;// creates the geometry for GEANT virtual void Init(void) ; // does nothing virtual Int_t IsVersion(void) const { // Gives the version number @@ -85,7 +85,7 @@ class AliEMCALv0 : public AliEMCAL { Double_t fSmodPar2; //! z size of super module Double_t fParEMOD[5]; //! parameters of EMCAL module (TRD1,2) AliEMCALSpaceFrame* fCalFrame; //EMCAL Space frame object - + AliEMCALv0(const AliEMCALv0 & emcal); AliEMCALv0 & operator = (const AliEMCALv0 & /*rvalue*/); diff --git a/EMCAL/macros/Config.C b/EMCAL/macros/Config.C index 7c2700bd643..97545200a04 100755 --- a/EMCAL/macros/Config.C +++ b/EMCAL/macros/Config.C @@ -46,6 +46,7 @@ Float_t EtaToTheta(Float_t arg); void LoadPythia(); Int_t year =2011; +Bool_t checkGeoAndRun=kFALSE; void Config() { @@ -328,6 +329,8 @@ void Config() AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1"); else // Old configuration with 110 degrees but not perfect geometry AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE"); + + EMCAL->SetCheckRunNumberAndGeoVersion(checkGeoAndRun); } if (iACORDE) diff --git a/EMCAL/macros/TestEMCALSimulation.C b/EMCAL/macros/TestEMCALSimulation.C index be8f9a7f3e1..94ada2a7d87 100644 --- a/EMCAL/macros/TestEMCALSimulation.C +++ b/EMCAL/macros/TestEMCALSimulation.C @@ -7,13 +7,13 @@ LLNL */ -void TestEMCALSimulation(Int_t nev =10) { +void TestEMCALSimulation(Int_t nev =10, Bool_t raw = kFALSE) { AliSimulation simulator; simulator.SetConfigFile("Config.C"); simulator.SetMakeSDigits("EMCAL"); simulator.SetMakeDigits("EMCAL"); - simulator.SetWriteRawData("EMCAL","raw.root",kTRUE); + if(raw) simulator.SetWriteRawData("EMCAL","raw.root",kTRUE); //OCDB settings simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB"); @@ -26,6 +26,8 @@ void TestEMCALSimulation(Int_t nev =10) { TStopwatch timer; timer.Start(); +// simulator.SetRunNumber(140234); + simulator.Run(nev); timer.Stop(); -- 2.39.3