From 9598711821a27c4a4f4f70e7e9019a585c3cd8a5 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Fri, 27 Dec 2024 16:18:48 +0100 Subject: [PATCH 01/35] cleanup CData.h --- inc/CData.h | 750 +----------------------------------------------- src/CData.C | 51 ---- src/CData.cpp | 770 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 772 insertions(+), 799 deletions(-) delete mode 100644 src/CData.C create mode 100644 src/CData.cpp diff --git a/inc/CData.h b/inc/CData.h index 5be55722..bcf6733c 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -12,6 +12,7 @@ #include #include "VGlobalRunParameter.h" +#include "VDispAnalyzer.h" #include #include @@ -244,13 +245,10 @@ class CData CData( TTree* tree = 0, bool bMC = false, int iVersion = 5, bool bShort = false ); virtual ~CData(); - virtual Int_t Cut( Long64_t entry ); virtual Int_t GetEntry( Long64_t entry ); virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); - virtual void Loop(); virtual Bool_t Notify(); - virtual void Show( Long64_t entry = -1 ); bool isMC() { return fMC; @@ -259,750 +257,6 @@ class CData { return fVersion; } + void reconstruct_3tel_images(); }; #endif - -#ifdef CData_cxx - -CData::CData( TTree* tree, bool bMC, int iVersion, bool bShort ) -{ - fMC = bMC; - fShort = bShort; - fVersion = iVersion; - fBOOLteltype = false; - fBOOLdE = false; - - Init( tree ); -} - - -CData::~CData() -{ - if(!fChain ) - { - return; - } - delete fChain->GetCurrentFile(); -} - - -Int_t CData::GetEntry( Long64_t entry ) -{ - // Read contents of entry. - if(!fChain ) - { - return 0; - } - - int a = fChain->GetEntry( entry ); - if( a > 0 && fVersion < 6 ) - { - LTrig = ( ULong64_t )LTrigS; - ImgSel = ( ULong64_t )ImgSelS; - } - return a; -} - - -Long64_t CData::LoadTree( Long64_t entry ) -{ - // Set the environment to read one entry - if(!fChain ) - { - return -5; - } - Long64_t centry = fChain->LoadTree( entry ); - if( centry < 0 ) - { - return centry; - } - if( fChain->IsA() != TChain::Class() ) - { - return centry; - } - TChain* chain = ( TChain* )fChain; - if( chain->GetTreeNumber() != fCurrent ) - { - fCurrent = chain->GetTreeNumber(); - Notify(); - } - return centry; -} - - -void CData::Init( TTree* tree ) -{ - - // Set branch addresses - if( tree == 0 ) - { - return; - } - - // get version number - string itemp = tree->GetTitle(); - if( itemp.find( "VERSION" ) < itemp.size() ) - { - fVersion = atoi( itemp.substr( itemp.find( "VERSION" ) + 7, itemp.size() ).c_str() ); - } - // data is in a chain -> get first tree and version number from it - else if( tree->IsA() == TChain::Class() ) - { - if( tree->LoadTree( 0 ) >= 0 ) - { - string itemp = ""; - if( tree->GetTree() ) - { - itemp = tree->GetTree()->GetTitle(); - } - if( itemp.find( "VERSION" ) < itemp.size() ) - { - fVersion = atoi( itemp.substr( itemp.find( "VERSION" ) + 7, itemp.size() ).c_str() ); - } - } - } - // test if this is a MC file - if( tree->GetBranchStatus( "MCe0" ) ) - { - fMC = true; - } - // test if teltype branches exist - if( tree->GetBranchStatus( "NTtype" ) ) - { - fBOOLteltype = true; - } - // test if dE branches exist - if( tree->GetBranchStatus( "dE" ) ) - { - fBOOLdE = true; - } - - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass( 1 ); - - fChain->SetBranchAddress( "runNumber", &runNumber ); - fChain->SetBranchAddress( "eventNumber", &eventNumber ); - if(!fShort ) - { - fChain->SetBranchAddress( "MJD", &MJD ); - fChain->SetBranchAddress( "Time", &Time ); - } - else - { - MJD = 0; - Time = 0; - } - fChain->SetBranchAddress( "TelElevation", TelElevation ); - fChain->SetBranchAddress( "TelAzimuth", TelAzimuth ); - if(!fShort ) - { - fChain->SetBranchAddress( "TelDec", TelDec ); - fChain->SetBranchAddress( "TelRA", TelRA ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - TelDec[i] = 0.; - TelRA[i] = 0.; - } - } - fChain->SetBranchAddress( "ArrayPointing_Azimuth", &ArrayPointing_Azimuth); - fChain->SetBranchAddress( "ArrayPointing_Elevation", &ArrayPointing_Elevation); - if( fChain->GetBranchStatus( "Array_PointingStatus" ) ) - { - fChain->SetBranchAddress( "Array_PointingStatus", &Array_PointingStatus ); - } - else - { - Array_PointingStatus = 0; - } - - // MC tree - if( fMC ) - { - if( fVersion > 7 ) - { - fChain->SetBranchAddress( "MCprimary", &MCprimary ); - } - else - { - MCprimary = -99; - } - fChain->SetBranchAddress( "MCe0", &MCe0 ); - fChain->SetBranchAddress( "MCxcore", &MCxcore ); - fChain->SetBranchAddress( "MCycore", &MCycore ); - if(!fShort ) - { - fChain->SetBranchAddress( "MCxcore_SC", &MCxcore_SC ); - fChain->SetBranchAddress( "MCycore_SC", &MCycore_SC ); - fChain->SetBranchAddress( "MCxcos", &MCxcos ); - fChain->SetBranchAddress( "MCycos", &MCycos ); - } - else - { - MCxcore_SC = MCycore_SC = MCxcos = MCycos = 0.; - } - fChain->SetBranchAddress( "MCaz", &MCaz ); - fChain->SetBranchAddress( "MCze", &MCze ); - fChain->SetBranchAddress( "MCxoff", &MCxoff ); - fChain->SetBranchAddress( "MCyoff", &MCyoff ); - } - else - { - MCprimary = -99; - MCe0 = 0.; - MCxcore = 0.; - MCycore = 0.; - MCxcore_SC = 0.; - MCycore_SC = 0.; - MCxcos = 0.; - MCycos = 0.; - MCaz = 0.; - MCze = 0.; - MCxoff = 0.; - MCyoff = 0.; - } - - - if( fVersion < 6 ) - { - fChain->SetBranchAddress( "LTrig", <rigS ); - } - else - { - fChain->SetBranchAddress( "LTrig", <rig ); - } - fChain->SetBranchAddress( "NTrig", &NTrig ); - fChain->SetBranchAddress( "NImages", &NImages ); - if( fVersion < 6 ) - { - fChain->SetBranchAddress( "ImgSel", &ImgSelS ); - } - else - { - fChain->SetBranchAddress( "ImgSel", &ImgSel ); - } - fChain->SetBranchAddress( "img2_ang", &img2_ang ); - fChain->SetBranchAddress( "Ze", &Ze ); - fChain->SetBranchAddress( "Az", &Az ); - if(!fShort ) - { - fChain->SetBranchAddress( "ra", &ra ); - fChain->SetBranchAddress( "dec", &dec ); - } - else - { - ra = dec = 0.; - } - fChain->SetBranchAddress( "Xoff", &Xoff ); - fChain->SetBranchAddress( "Yoff", &Yoff ); - if( fChain->GetBranchStatus( "Xoff_derot" ) ) - { - fChain->SetBranchAddress( "Xoff_derot", &Xoff_derot ); - } - if( fChain->GetBranchStatus( "Yoff_derot" ) ) - { - fChain->SetBranchAddress( "Yoff_derot", &Yoff_derot ); - } - - if(!fShort ) - { - fChain->SetBranchAddress( "stdS", &stdS ); - fChain->SetBranchAddress( "theta2", &theta2 ); - } - else - { - stdS = 0.; - theta2 = 0.; - } - fChain->SetBranchAddress( "Xcore", &Xcore ); - fChain->SetBranchAddress( "Ycore", &Ycore ); - if(!fShort ) - { - fChain->SetBranchAddress( "Xcore_SC", &Xcore_SC ); - fChain->SetBranchAddress( "Ycore_SC", &Ycore_SC ); - } - else - { - Xcore_SC = Ycore_SC = 0.; - } - fChain->SetBranchAddress( "stdP", &stdP ); - fChain->SetBranchAddress( "Chi2", &Chi2 ); - if( fVersion > 4 ) - { - fChain->SetBranchAddress( "meanPedvar_Image", &meanPedvar_Image ); - if(!fShort ) - { - fChain->SetBranchAddress( "meanPedvar_ImageT", meanPedvar_ImageT ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - meanPedvar_ImageT[i] = 0.; - } - } - - } - else - { - meanPedvar_Image = 0.; - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - meanPedvar_ImageT[i] = 0.; - } - } - - fChain->SetBranchAddress( "SizeSecondMax", &SizeSecondMax ); - - if( fBOOLteltype ) - { - fChain->SetBranchAddress( "ImgSel_list", ImgSel_list ); - fChain->SetBranchAddress( "NTtype", &NTtype ); - fChain->SetBranchAddress( "NImages_Ttype", NImages_Ttype ); - } - else - { - NTtype = 0; - for( unsigned int tt = 0; tt < VDST_MAXTELESCOPES; tt++ ) - { - NImages_Ttype[tt] = 0; - } - } - - if(!fShort ) - { - fChain->SetBranchAddress( "dist", dist ); - fChain->SetBranchAddress( "size", size ); - if( fChain->GetBranchStatus( "fracLow" ) ) - { - fChain->SetBranchAddress( "fracLow", fraclow ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - fraclow[i] = 0.; - } - } - if( fVersion > 2 ) - { - fChain->SetBranchAddress( "loss", loss ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - loss[i] = 0.; - } - } - - fChain->SetBranchAddress( "max1", max1 ); - fChain->SetBranchAddress( "max2", max2 ); - fChain->SetBranchAddress( "max3", max3 ); - fChain->SetBranchAddress( "maxindex1", maxindex1 ); - fChain->SetBranchAddress( "maxindex2", maxindex2 ); - fChain->SetBranchAddress( "maxindex3", maxindex3 ); - fChain->SetBranchAddress( "width", width ); - fChain->SetBranchAddress( "length", length ); - fChain->SetBranchAddress( "ntubes", ntubes ); - if( fVersion > 2 ) - { - fChain->SetBranchAddress( "nsat", nsat ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - nsat[i] = 0; - } - } - if( fChain->GetBranchStatus( "nlowgain" ) ) - { - fChain->SetBranchAddress( "nlowgain", nlowgain ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - nlowgain[i] = 0; - } - } - if( fChain->GetBranchStatus( "ntubesBNI" ) ) - { - fChain->SetBranchAddress( "ntubesBNI", ntubesBNI ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - ntubesBNI[i] = 0; - } - } - fChain->SetBranchAddress( "alpha", alpha ); - fChain->SetBranchAddress( "los", los ); - fChain->SetBranchAddress( "asym", asym ); - fChain->SetBranchAddress( "cen_x", cen_x ); - fChain->SetBranchAddress( "cen_y", cen_y ); - fChain->SetBranchAddress( "cosphi", cosphi ); - fChain->SetBranchAddress( "sinphi", sinphi ); - fChain->SetBranchAddress( "tgrad_x", tgrad_x ); - fChain->SetBranchAddress( "Fitstat", Fitstat ); - fChain->SetBranchAddress( "DispXoff_T", DispXoff_T ); - fChain->SetBranchAddress( "DispYoff_T", DispYoff_T ); - fChain->SetBranchAddress( "DispWoff_T", DispWoff_T ); - fChain->SetBranchAddress( "Disp_T", Disp_T ); - fChain->SetBranchAddress( "tchisq_x", tchisq_x ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - dist[i] = 0.; - size[i] = 0.; - fraclow[i] = 0.; - loss[i] = 0.; - max1[i] = 0.; - max2[i] = 0.; - max3[i] = 0.; - maxindex1[i] = 0; - maxindex2[i] = 0; - maxindex3[i] = 0; - width[i] = 0.; - length[i] = 0.; - ntubes[i] = 0; - nsat[i] = 0; - nlowgain[i] = 0; - ntubesBNI[i] = 0; - alpha[i] = 0.; - los[i] = 0.; - asym[i] = 0.; - cen_x[i] = 0.; - cen_y[i] = 0.; - cosphi[i] = 0.; - sinphi[i] = 0.; - tgrad_x[i] = 0.; - Fitstat[i] = 0; - DispXoff_T[i] = 0.; - DispYoff_T[i] = 0.; - DispWoff_T[i] = 0.; - Disp_T[i] = 0.; - tchisq_x[i] = 0.; - } - } - fChain->SetBranchAddress( "R_core", R_core ); - if(!fShort ) - { - fChain->SetBranchAddress( "MSCWT", MSCWT ); - fChain->SetBranchAddress( "MSCLT", MSCLT ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - MSCWT[i] = 0.; - MSCLT[i] = 0.; - } - } - if(!fShort ) - { - fChain->SetBranchAddress( "ES", ES ); - fChain->SetBranchAddress( "E", E ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - ES[i] = 0.; - E[i] = 0.; - } - } - if(!fShort ) - { - fChain->SetBranchAddress( "NMSCW", &NMSCW ); - } - else - { - NMSCW = 0; - } - fChain->SetBranchAddress( "MSCW", &MSCW ); - fChain->SetBranchAddress( "MSCL", &MSCL ); - if( fVersion > 3 ) - { - fChain->SetBranchAddress( "MWR", &MWR ); - fChain->SetBranchAddress( "MLR", &MLR ); - } - else - { - MWR = 0.; - MLR = 0.; - } - fChain->SetBranchAddress( "Erec", &Erec ); - fChain->SetBranchAddress( "EChi2", &EChi2 ); - fChain->SetBranchAddress( "ErecS", &ErecS ); - fChain->SetBranchAddress( "EChi2S", &EChi2S ); - if( fBOOLdE ) - { - fChain->SetBranchAddress( "dE", &dE ); - fChain->SetBranchAddress( "dES", &dES ); - } - else - { - dE = 0.; - dES = 0.; - } - if( fVersion > 3 ) - { - EmissionHeight = -99.; - fChain->SetBranchAddress( "EmissionHeight", &EmissionHeight ); - fChain->SetBranchAddress( "EmissionHeightChi2", &EmissionHeightChi2 ); - fChain->SetBranchAddress( "NTelPairs", &NTelPairs ); - if(!fShort ) - { - fChain->SetBranchAddress( "EmissionHeightT", EmissionHeightT ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES * VDST_MAXTELESCOPES; i++ ) - { - EmissionHeightT[i] = 0.; - } - } - } - else - { - EmissionHeight = -999.; - EmissionHeightChi2 = -999.; - NTelPairs = 0; - for( unsigned int i = 0; i < VDST_MAXTELESCOPES * VDST_MAXTELESCOPES; i++ ) - { - EmissionHeightT[i] = 0.; - } - } - if( fChain->GetBranchStatus( "DispDiff" ) ) - { - fChain->SetBranchAddress( "DispDiff", &DispDiff ); - } - else - { - DispDiff = 0.; - } - if( fChain->GetBranchStatus( "DispAbsSumWeigth" ) ) - { - fChain->SetBranchAddress( "DispAbsSumWeigth", &DispAbsSumWeigth ); - } - else - { - DispAbsSumWeigth = 0.; - } - if( fChain->GetBranchStatus( "Xoff_intersect" ) ) - { - fChain->SetBranchAddress( "Xoff_intersect", &Xoff_intersect ); - } - else - { - Xoff_intersect = 0.; - } - if( fChain->GetBranchStatus( "Yoff_intersect" ) ) - { - fChain->SetBranchAddress( "Yoff_intersect", &Yoff_intersect ); - } - else - { - Yoff_intersect = 0.; - } - - Notify(); -} - - -Bool_t CData::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. Typically here the branch pointers - // will be retrieved. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. - - // Get branch pointers - b_runNumber = fChain->GetBranch( "runNumber" ); - b_eventNumber = fChain->GetBranch( "eventNumber" ); - b_MJD = fChain->GetBranch( "MJD" ); - b_Time = fChain->GetBranch( "Time" ); - b_TelElevation = fChain->GetBranch( "TelElevation" ); - b_TelAzimuth = fChain->GetBranch( "TelAzimuth" ); - b_TelDec = fChain->GetBranch( "TelDec" ); - b_TelRA = fChain->GetBranch( "TelRA" ); - b_ArrayPointing_Elevation = fChain->GetBranch( "ArrayPointing_Elevation" ); - b_ArrayPointing_Azimuth = fChain->GetBranch( "ArrayPointing_Azimuth" ); - - if( fMC ) - { - b_MCprimary = fChain->GetBranch( "MCprimary" ); - b_MCe0 = fChain->GetBranch( "MCe0" ); - b_MCxcore = fChain->GetBranch( "MCxcore" ); - b_MCycore = fChain->GetBranch( "MCycore" ); - b_MCxcore_SC = fChain->GetBranch( "MCxcore_SC" ); - b_MCycore_SC = fChain->GetBranch( "MCycore_SC" ); - b_MCxcos = fChain->GetBranch( "MCxcos" ); - b_MCycos = fChain->GetBranch( "MCycos" ); - b_MCaz = fChain->GetBranch( "MCaz" ); - b_MCze = fChain->GetBranch( "MCze" ); - b_MCxoff = fChain->GetBranch( "MCxoff" ); - b_MCyoff = fChain->GetBranch( "MCyoff" ); - } - - b_LTrig = fChain->GetBranch( "LTrig" ); - b_NTrig = fChain->GetBranch( "NTrig" ); - b_NImages = fChain->GetBranch( "NImages" ); - b_ImgSel = fChain->GetBranch( "ImgSel" ); - b_img2_ang = fChain->GetBranch( "img2_ang" ); - b_Ze = fChain->GetBranch( "Ze" ); - b_Az = fChain->GetBranch( "Az" ); - b_ra = fChain->GetBranch( "ra" ); - b_dec = fChain->GetBranch( "dec" ); - b_Xoff_derot = fChain->GetBranch( "Xoff_derot" ); - b_Yoff_derot = fChain->GetBranch( "Yoff_derot" ); - b_Xoff = fChain->GetBranch( "Xoff" ); - b_Yoff = fChain->GetBranch( "Yoff" ); - b_stdS = fChain->GetBranch( "stdS" ); - b_theta2 = fChain->GetBranch( "theta2" ); - b_Xcore = fChain->GetBranch( "Xcore" ); - b_Ycore = fChain->GetBranch( "Ycore" ); - b_Xcore_SC = fChain->GetBranch( "Xcore_SC" ); - b_Ycore_SC = fChain->GetBranch( "Ycore_SC" ); - b_stdP = fChain->GetBranch( "stdP" ); - b_Chi2 = fChain->GetBranch( "Chi2" ); - if( fVersion > 4 ) - { - b_meanPedvar_Image = fChain->GetBranch( "meanPedvar_Image" ); - b_meanPedvar_ImageT = fChain->GetBranch( "meanPedvar_ImageT" ); - } - else - { - b_meanPedvar_Image = 0; - b_meanPedvar_ImageT = 0; - } - - b_SizeSecondMax = fChain->GetBranch( "SizeSecondMax" ); - b_dist = fChain->GetBranch( "dist" ); - b_size = fChain->GetBranch( "size" ); - b_fraclow = fChain->GetBranch( "fraclow" ); - b_max1 = fChain->GetBranch( "max1" ); - b_max2 = fChain->GetBranch( "max2" ); - b_max3 = fChain->GetBranch( "max3" ); - b_maxindex1 = fChain->GetBranch( "maxindex1" ); - b_maxindex2 = fChain->GetBranch( "maxindex2" ); - b_maxindex3 = fChain->GetBranch( "maxindex3" ); - b_width = fChain->GetBranch( "width" ); - b_length = fChain->GetBranch( "length" ); - b_ntubes = fChain->GetBranch( "ntubes" ); - b_ntubesBNI = fChain->GetBranch( "ntubesBNI" ); - b_alpha = fChain->GetBranch( "alpha" ); - b_los = fChain->GetBranch( "los" ); - b_asym = fChain->GetBranch( "asym" ); - b_cen_x = fChain->GetBranch( "cen_x" ); - b_cen_y = fChain->GetBranch( "cen_y" ); - b_cosphi = fChain->GetBranch( "cosphi" ); - b_sinphi = fChain->GetBranch( "sinphi" ); - b_tgrad_x = fChain->GetBranch( "tgrad_x" ); - b_Fitstat = fChain->GetBranch( "Fitstat" ); - b_tchisq_x = fChain->GetBranch( "tchisq_x" ); - b_R_core = fChain->GetBranch( "R_core" ); - b_MSCWT = fChain->GetBranch( "MSCWT" ); - b_MSCLT = fChain->GetBranch( "MSCLT" ); - b_E = fChain->GetBranch( "E" ); - b_ES = fChain->GetBranch( "ES" ); - b_NMSCW = fChain->GetBranch( "NMSCW" ); - b_MSCW = fChain->GetBranch( "MSCW" ); - b_MSCL = fChain->GetBranch( "MSCL" ); - if( fVersion > 3 ) - { - b_MWR = fChain->GetBranch( "MWR" ); - b_MLR = fChain->GetBranch( "MLR" ); - } - else - { - b_MWR = 0; - b_MLR = 0; - } - b_Erec = fChain->GetBranch( "Erec" ); - b_EChi2 = fChain->GetBranch( "EChi2" ); - b_ErecS = fChain->GetBranch( "ErecS" ); - b_EChi2S = fChain->GetBranch( "EChi2S" ); - if( fVersion > 3 ) - { - b_EmissionHeight = fChain->GetBranch( "EmissionHeight" ); - b_EmissionHeightChi2 = fChain->GetBranch( "EmissionHeightChi2" ); - b_NTelPairs = fChain->GetBranch( "NTelPairs" ); - b_EmissionHeightT = fChain->GetBranch( "EmissionHeightT" ); - } - else - { - b_EmissionHeight = 0; - b_EmissionHeightChi2 = 0; - b_NTelPairs = 0; - b_EmissionHeightT = 0; - } - if( fChain->GetBranchStatus( "DispDiff" ) ) - { - b_DispDiff = fChain->GetBranch( "DispDiff" ); - } - else - { - b_DispDiff = 0; - } - if( fChain->GetBranchStatus( "DispAbsSumWeigth" ) ) - { - b_DispAbsSumWeigth = fChain->GetBranch( "DispAbsSumWeigth" ); - } - else - { - b_DispAbsSumWeigth = 0; - } - if( fChain->GetBranchStatus( "Xoff_intersect" ) ) - { - b_Xoff_intersect = fChain->GetBranch( "Xoff_intersect" ); - } - else - { - b_Xoff_intersect = 0; - } - if( fChain->GetBranchStatus( "Yoff_intersect" ) ) - { - b_Yoff_intersect = fChain->GetBranch( "Yoff_intersect" ); - } - else - { - b_Yoff_intersect = 0; - } - - return kTRUE; -} - - -void CData::Show( Long64_t entry ) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if(!fChain ) - { - return; - } - fChain->Show( entry ); -} - - -Int_t CData::Cut( Long64_t entry ) -{ - // This function may be called from Loop. - // returns 1 if entry is accepted. - // returns -1 otherwise. - entry = 0; - - return 1; -} -#endif // #ifdef CData_cxx diff --git a/src/CData.C b/src/CData.C deleted file mode 100644 index 4d167934..00000000 --- a/src/CData.C +++ /dev/null @@ -1,51 +0,0 @@ -#define CData_cxx -#include "CData.h" -#include -#include -#include - -void CData::Loop() -{ - // In a ROOT session, you can do: - // Root > .L CData.C - // Root > CData t - // Root > t.GetEntry(12); // Fill t data members with entry number 12 - // Root > t.Show(); // Show values of entry 12 - // Root > t.Show(16); // Read and show values of entry 16 - // Root > t.Loop(); // Loop on all entries - // - - // This is the loop skeleton where: - // jentry is the global entry number in the chain - // ientry is the entry number in the current Tree - // Note that the argument to GetEntry must be: - // jentry for TChain::GetEntry - // ientry for TTree::GetEntry and TBranch::GetEntry - // - // To read only selected branches, Insert statements like: - // METHOD1: - // fChain->SetBranchStatus("*",0); // disable all branches - // fChain->SetBranchStatus("branchname",1); // activate branchname - // METHOD2: replace line - // fChain->GetEntry(jentry); //read all branches - //by b_branchname->GetEntry(ientry); //read only this branch - if( fChain == 0 ) - { - return; - } - - Long64_t nentries = fChain->GetEntriesFast(); - - Long64_t nbytes = 0, nb = 0; - for( Long64_t jentry = 0; jentry < nentries; jentry++ ) - { - Long64_t ientry = LoadTree( jentry ); - if( ientry < 0 ) - { - break; - } - nb = fChain->GetEntry( jentry ); - nbytes += nb; - // if (Cut(ientry) < 0) continue; - } -} diff --git a/src/CData.cpp b/src/CData.cpp new file mode 100644 index 00000000..09cb34dd --- /dev/null +++ b/src/CData.cpp @@ -0,0 +1,770 @@ + +#include "CData.h" + + +CData::CData( TTree* tree, bool bMC, int iVersion, bool bShort ) +{ + fMC = bMC; + fShort = bShort; + fVersion = iVersion; + fBOOLteltype = false; + fBOOLdE = false; + + Init( tree ); +} + + +CData::~CData() +{ + if(!fChain ) + { + return; + } + delete fChain->GetCurrentFile(); +} + + +Int_t CData::GetEntry( Long64_t entry ) +{ + if(!fChain ) + { + return 0; + } + + int a = fChain->GetEntry( entry ); + if( a > 0 && fVersion < 6 ) + { + LTrig = ( ULong64_t )LTrigS; + ImgSel = ( ULong64_t )ImgSelS; + } + bool fMC_3tel_reconstruction = true; + if( fMC_3tel_reconstruction && NImages == 4 ) + { + reconstruct_3tel_images(); + } + return a; +} + + +Long64_t CData::LoadTree( Long64_t entry ) +{ + if(!fChain ) + { + return -5; + } + Long64_t centry = fChain->LoadTree( entry ); + if( centry < 0 ) + { + return centry; + } + if( fChain->IsA() != TChain::Class() ) + { + return centry; + } + TChain* chain = ( TChain* )fChain; + if( chain->GetTreeNumber() != fCurrent ) + { + fCurrent = chain->GetTreeNumber(); + Notify(); + } + return centry; +} + + +void CData::Init( TTree* tree ) +{ + if( tree == 0 ) + { + return; + } + + // get version number + string itemp = tree->GetTitle(); + if( itemp.find( "VERSION" ) < itemp.size() ) + { + fVersion = atoi( itemp.substr( itemp.find( "VERSION" ) + 7, itemp.size() ).c_str() ); + } + // data is in a chain -> get first tree and version number from it + else if( tree->IsA() == TChain::Class() ) + { + if( tree->LoadTree( 0 ) >= 0 ) + { + string itemp = ""; + if( tree->GetTree() ) + { + itemp = tree->GetTree()->GetTitle(); + } + if( itemp.find( "VERSION" ) < itemp.size() ) + { + fVersion = atoi( itemp.substr( itemp.find( "VERSION" ) + 7, itemp.size() ).c_str() ); + } + } + } + // test if this is a MC file + if( tree->GetBranchStatus( "MCe0" ) ) + { + fMC = true; + } + // test if teltype branches exist + if( tree->GetBranchStatus( "NTtype" ) ) + { + fBOOLteltype = true; + } + // test if dE branches exist + if( tree->GetBranchStatus( "dE" ) ) + { + fBOOLdE = true; + } + + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass( 1 ); + + fChain->SetBranchAddress( "runNumber", &runNumber ); + fChain->SetBranchAddress( "eventNumber", &eventNumber ); + if(!fShort ) + { + fChain->SetBranchAddress( "MJD", &MJD ); + fChain->SetBranchAddress( "Time", &Time ); + } + else + { + MJD = 0; + Time = 0; + } + fChain->SetBranchAddress( "TelElevation", TelElevation ); + fChain->SetBranchAddress( "TelAzimuth", TelAzimuth ); + if(!fShort ) + { + fChain->SetBranchAddress( "TelDec", TelDec ); + fChain->SetBranchAddress( "TelRA", TelRA ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + TelDec[i] = 0.; + TelRA[i] = 0.; + } + } + fChain->SetBranchAddress( "ArrayPointing_Azimuth", &ArrayPointing_Azimuth); + fChain->SetBranchAddress( "ArrayPointing_Elevation", &ArrayPointing_Elevation); + if( fChain->GetBranchStatus( "Array_PointingStatus" ) ) + { + fChain->SetBranchAddress( "Array_PointingStatus", &Array_PointingStatus ); + } + else + { + Array_PointingStatus = 0; + } + + // MC tree + if( fMC ) + { + if( fVersion > 7 ) + { + fChain->SetBranchAddress( "MCprimary", &MCprimary ); + } + else + { + MCprimary = -99; + } + fChain->SetBranchAddress( "MCe0", &MCe0 ); + fChain->SetBranchAddress( "MCxcore", &MCxcore ); + fChain->SetBranchAddress( "MCycore", &MCycore ); + if(!fShort ) + { + fChain->SetBranchAddress( "MCxcore_SC", &MCxcore_SC ); + fChain->SetBranchAddress( "MCycore_SC", &MCycore_SC ); + fChain->SetBranchAddress( "MCxcos", &MCxcos ); + fChain->SetBranchAddress( "MCycos", &MCycos ); + } + else + { + MCxcore_SC = MCycore_SC = MCxcos = MCycos = 0.; + } + fChain->SetBranchAddress( "MCaz", &MCaz ); + fChain->SetBranchAddress( "MCze", &MCze ); + fChain->SetBranchAddress( "MCxoff", &MCxoff ); + fChain->SetBranchAddress( "MCyoff", &MCyoff ); + } + else + { + MCprimary = -99; + MCe0 = 0.; + MCxcore = 0.; + MCycore = 0.; + MCxcore_SC = 0.; + MCycore_SC = 0.; + MCxcos = 0.; + MCycos = 0.; + MCaz = 0.; + MCze = 0.; + MCxoff = 0.; + MCyoff = 0.; + } + + + if( fVersion < 6 ) + { + fChain->SetBranchAddress( "LTrig", <rigS ); + } + else + { + fChain->SetBranchAddress( "LTrig", <rig ); + } + fChain->SetBranchAddress( "NTrig", &NTrig ); + fChain->SetBranchAddress( "NImages", &NImages ); + if( fVersion < 6 ) + { + fChain->SetBranchAddress( "ImgSel", &ImgSelS ); + } + else + { + fChain->SetBranchAddress( "ImgSel", &ImgSel ); + } + fChain->SetBranchAddress( "img2_ang", &img2_ang ); + fChain->SetBranchAddress( "Ze", &Ze ); + fChain->SetBranchAddress( "Az", &Az ); + if(!fShort ) + { + fChain->SetBranchAddress( "ra", &ra ); + fChain->SetBranchAddress( "dec", &dec ); + } + else + { + ra = dec = 0.; + } + fChain->SetBranchAddress( "Xoff", &Xoff ); + fChain->SetBranchAddress( "Yoff", &Yoff ); + if( fChain->GetBranchStatus( "Xoff_derot" ) ) + { + fChain->SetBranchAddress( "Xoff_derot", &Xoff_derot ); + } + if( fChain->GetBranchStatus( "Yoff_derot" ) ) + { + fChain->SetBranchAddress( "Yoff_derot", &Yoff_derot ); + } + + if(!fShort ) + { + fChain->SetBranchAddress( "stdS", &stdS ); + fChain->SetBranchAddress( "theta2", &theta2 ); + } + else + { + stdS = 0.; + theta2 = 0.; + } + fChain->SetBranchAddress( "Xcore", &Xcore ); + fChain->SetBranchAddress( "Ycore", &Ycore ); + if(!fShort ) + { + fChain->SetBranchAddress( "Xcore_SC", &Xcore_SC ); + fChain->SetBranchAddress( "Ycore_SC", &Ycore_SC ); + } + else + { + Xcore_SC = Ycore_SC = 0.; + } + fChain->SetBranchAddress( "stdP", &stdP ); + fChain->SetBranchAddress( "Chi2", &Chi2 ); + if( fVersion > 4 ) + { + fChain->SetBranchAddress( "meanPedvar_Image", &meanPedvar_Image ); + if(!fShort ) + { + fChain->SetBranchAddress( "meanPedvar_ImageT", meanPedvar_ImageT ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + meanPedvar_ImageT[i] = 0.; + } + } + + } + else + { + meanPedvar_Image = 0.; + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + meanPedvar_ImageT[i] = 0.; + } + } + + fChain->SetBranchAddress( "SizeSecondMax", &SizeSecondMax ); + + if( fBOOLteltype ) + { + fChain->SetBranchAddress( "ImgSel_list", ImgSel_list ); + fChain->SetBranchAddress( "NTtype", &NTtype ); + fChain->SetBranchAddress( "NImages_Ttype", NImages_Ttype ); + } + else + { + NTtype = 0; + for( unsigned int tt = 0; tt < VDST_MAXTELESCOPES; tt++ ) + { + NImages_Ttype[tt] = 0; + } + } + + if(!fShort ) + { + fChain->SetBranchAddress( "dist", dist ); + fChain->SetBranchAddress( "size", size ); + if( fChain->GetBranchStatus( "fracLow" ) ) + { + fChain->SetBranchAddress( "fracLow", fraclow ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + fraclow[i] = 0.; + } + } + if( fVersion > 2 ) + { + fChain->SetBranchAddress( "loss", loss ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + loss[i] = 0.; + } + } + + fChain->SetBranchAddress( "max1", max1 ); + fChain->SetBranchAddress( "max2", max2 ); + fChain->SetBranchAddress( "max3", max3 ); + fChain->SetBranchAddress( "maxindex1", maxindex1 ); + fChain->SetBranchAddress( "maxindex2", maxindex2 ); + fChain->SetBranchAddress( "maxindex3", maxindex3 ); + fChain->SetBranchAddress( "width", width ); + fChain->SetBranchAddress( "length", length ); + fChain->SetBranchAddress( "ntubes", ntubes ); + if( fVersion > 2 ) + { + fChain->SetBranchAddress( "nsat", nsat ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + nsat[i] = 0; + } + } + if( fChain->GetBranchStatus( "nlowgain" ) ) + { + fChain->SetBranchAddress( "nlowgain", nlowgain ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + nlowgain[i] = 0; + } + } + if( fChain->GetBranchStatus( "ntubesBNI" ) ) + { + fChain->SetBranchAddress( "ntubesBNI", ntubesBNI ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + ntubesBNI[i] = 0; + } + } + fChain->SetBranchAddress( "alpha", alpha ); + fChain->SetBranchAddress( "los", los ); + fChain->SetBranchAddress( "asym", asym ); + fChain->SetBranchAddress( "cen_x", cen_x ); + fChain->SetBranchAddress( "cen_y", cen_y ); + fChain->SetBranchAddress( "cosphi", cosphi ); + fChain->SetBranchAddress( "sinphi", sinphi ); + fChain->SetBranchAddress( "tgrad_x", tgrad_x ); + fChain->SetBranchAddress( "Fitstat", Fitstat ); + fChain->SetBranchAddress( "DispXoff_T", DispXoff_T ); + fChain->SetBranchAddress( "DispYoff_T", DispYoff_T ); + fChain->SetBranchAddress( "DispWoff_T", DispWoff_T ); + fChain->SetBranchAddress( "Disp_T", Disp_T ); + fChain->SetBranchAddress( "tchisq_x", tchisq_x ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + dist[i] = 0.; + size[i] = 0.; + fraclow[i] = 0.; + loss[i] = 0.; + max1[i] = 0.; + max2[i] = 0.; + max3[i] = 0.; + maxindex1[i] = 0; + maxindex2[i] = 0; + maxindex3[i] = 0; + width[i] = 0.; + length[i] = 0.; + ntubes[i] = 0; + nsat[i] = 0; + nlowgain[i] = 0; + ntubesBNI[i] = 0; + alpha[i] = 0.; + los[i] = 0.; + asym[i] = 0.; + cen_x[i] = 0.; + cen_y[i] = 0.; + cosphi[i] = 0.; + sinphi[i] = 0.; + tgrad_x[i] = 0.; + Fitstat[i] = 0; + DispXoff_T[i] = 0.; + DispYoff_T[i] = 0.; + DispWoff_T[i] = 0.; + Disp_T[i] = 0.; + tchisq_x[i] = 0.; + } + } + fChain->SetBranchAddress( "R_core", R_core ); + if(!fShort ) + { + fChain->SetBranchAddress( "MSCWT", MSCWT ); + fChain->SetBranchAddress( "MSCLT", MSCLT ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + MSCWT[i] = 0.; + MSCLT[i] = 0.; + } + } + if(!fShort ) + { + fChain->SetBranchAddress( "ES", ES ); + fChain->SetBranchAddress( "E", E ); + } + else + { + for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + ES[i] = 0.; + E[i] = 0.; + } + } + if(!fShort ) + { + fChain->SetBranchAddress( "NMSCW", &NMSCW ); + } + else + { + NMSCW = 0; + } + fChain->SetBranchAddress( "MSCW", &MSCW ); + fChain->SetBranchAddress( "MSCL", &MSCL ); + if( fVersion > 3 ) + { + fChain->SetBranchAddress( "MWR", &MWR ); + fChain->SetBranchAddress( "MLR", &MLR ); + } + else + { + MWR = 0.; + MLR = 0.; + } + fChain->SetBranchAddress( "Erec", &Erec ); + fChain->SetBranchAddress( "EChi2", &EChi2 ); + fChain->SetBranchAddress( "ErecS", &ErecS ); + fChain->SetBranchAddress( "EChi2S", &EChi2S ); + if( fBOOLdE ) + { + fChain->SetBranchAddress( "dE", &dE ); + fChain->SetBranchAddress( "dES", &dES ); + } + else + { + dE = 0.; + dES = 0.; + } + if( fVersion > 3 ) + { + EmissionHeight = -99.; + fChain->SetBranchAddress( "EmissionHeight", &EmissionHeight ); + fChain->SetBranchAddress( "EmissionHeightChi2", &EmissionHeightChi2 ); + fChain->SetBranchAddress( "NTelPairs", &NTelPairs ); + if(!fShort ) + { + fChain->SetBranchAddress( "EmissionHeightT", EmissionHeightT ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXTELESCOPES * VDST_MAXTELESCOPES; i++ ) + { + EmissionHeightT[i] = 0.; + } + } + } + else + { + EmissionHeight = -999.; + EmissionHeightChi2 = -999.; + NTelPairs = 0; + for( unsigned int i = 0; i < VDST_MAXTELESCOPES * VDST_MAXTELESCOPES; i++ ) + { + EmissionHeightT[i] = 0.; + } + } + if( fChain->GetBranchStatus( "DispDiff" ) ) + { + fChain->SetBranchAddress( "DispDiff", &DispDiff ); + } + else + { + DispDiff = 0.; + } + if( fChain->GetBranchStatus( "DispAbsSumWeigth" ) ) + { + fChain->SetBranchAddress( "DispAbsSumWeigth", &DispAbsSumWeigth ); + } + else + { + DispAbsSumWeigth = 0.; + } + if( fChain->GetBranchStatus( "Xoff_intersect" ) ) + { + fChain->SetBranchAddress( "Xoff_intersect", &Xoff_intersect ); + } + else + { + Xoff_intersect = 0.; + } + if( fChain->GetBranchStatus( "Yoff_intersect" ) ) + { + fChain->SetBranchAddress( "Yoff_intersect", &Yoff_intersect ); + } + else + { + Yoff_intersect = 0.; + } + + Notify(); +} + + +Bool_t CData::Notify() +{ + b_runNumber = fChain->GetBranch( "runNumber" ); + b_eventNumber = fChain->GetBranch( "eventNumber" ); + b_MJD = fChain->GetBranch( "MJD" ); + b_Time = fChain->GetBranch( "Time" ); + b_TelElevation = fChain->GetBranch( "TelElevation" ); + b_TelAzimuth = fChain->GetBranch( "TelAzimuth" ); + b_TelDec = fChain->GetBranch( "TelDec" ); + b_TelRA = fChain->GetBranch( "TelRA" ); + b_ArrayPointing_Elevation = fChain->GetBranch( "ArrayPointing_Elevation" ); + b_ArrayPointing_Azimuth = fChain->GetBranch( "ArrayPointing_Azimuth" ); + + if( fMC ) + { + b_MCprimary = fChain->GetBranch( "MCprimary" ); + b_MCe0 = fChain->GetBranch( "MCe0" ); + b_MCxcore = fChain->GetBranch( "MCxcore" ); + b_MCycore = fChain->GetBranch( "MCycore" ); + b_MCxcore_SC = fChain->GetBranch( "MCxcore_SC" ); + b_MCycore_SC = fChain->GetBranch( "MCycore_SC" ); + b_MCxcos = fChain->GetBranch( "MCxcos" ); + b_MCycos = fChain->GetBranch( "MCycos" ); + b_MCaz = fChain->GetBranch( "MCaz" ); + b_MCze = fChain->GetBranch( "MCze" ); + b_MCxoff = fChain->GetBranch( "MCxoff" ); + b_MCyoff = fChain->GetBranch( "MCyoff" ); + } + + b_LTrig = fChain->GetBranch( "LTrig" ); + b_NTrig = fChain->GetBranch( "NTrig" ); + b_NImages = fChain->GetBranch( "NImages" ); + b_ImgSel = fChain->GetBranch( "ImgSel" ); + b_img2_ang = fChain->GetBranch( "img2_ang" ); + b_Ze = fChain->GetBranch( "Ze" ); + b_Az = fChain->GetBranch( "Az" ); + b_ra = fChain->GetBranch( "ra" ); + b_dec = fChain->GetBranch( "dec" ); + b_Xoff_derot = fChain->GetBranch( "Xoff_derot" ); + b_Yoff_derot = fChain->GetBranch( "Yoff_derot" ); + b_Xoff = fChain->GetBranch( "Xoff" ); + b_Yoff = fChain->GetBranch( "Yoff" ); + b_stdS = fChain->GetBranch( "stdS" ); + b_theta2 = fChain->GetBranch( "theta2" ); + b_Xcore = fChain->GetBranch( "Xcore" ); + b_Ycore = fChain->GetBranch( "Ycore" ); + b_Xcore_SC = fChain->GetBranch( "Xcore_SC" ); + b_Ycore_SC = fChain->GetBranch( "Ycore_SC" ); + b_stdP = fChain->GetBranch( "stdP" ); + b_Chi2 = fChain->GetBranch( "Chi2" ); + if( fVersion > 4 ) + { + b_meanPedvar_Image = fChain->GetBranch( "meanPedvar_Image" ); + b_meanPedvar_ImageT = fChain->GetBranch( "meanPedvar_ImageT" ); + } + else + { + b_meanPedvar_Image = 0; + b_meanPedvar_ImageT = 0; + } + + b_SizeSecondMax = fChain->GetBranch( "SizeSecondMax" ); + b_dist = fChain->GetBranch( "dist" ); + b_size = fChain->GetBranch( "size" ); + b_fraclow = fChain->GetBranch( "fraclow" ); + b_max1 = fChain->GetBranch( "max1" ); + b_max2 = fChain->GetBranch( "max2" ); + b_max3 = fChain->GetBranch( "max3" ); + b_maxindex1 = fChain->GetBranch( "maxindex1" ); + b_maxindex2 = fChain->GetBranch( "maxindex2" ); + b_maxindex3 = fChain->GetBranch( "maxindex3" ); + b_width = fChain->GetBranch( "width" ); + b_length = fChain->GetBranch( "length" ); + b_ntubes = fChain->GetBranch( "ntubes" ); + b_ntubesBNI = fChain->GetBranch( "ntubesBNI" ); + b_alpha = fChain->GetBranch( "alpha" ); + b_los = fChain->GetBranch( "los" ); + b_asym = fChain->GetBranch( "asym" ); + b_cen_x = fChain->GetBranch( "cen_x" ); + b_cen_y = fChain->GetBranch( "cen_y" ); + b_cosphi = fChain->GetBranch( "cosphi" ); + b_sinphi = fChain->GetBranch( "sinphi" ); + b_tgrad_x = fChain->GetBranch( "tgrad_x" ); + b_Fitstat = fChain->GetBranch( "Fitstat" ); + b_tchisq_x = fChain->GetBranch( "tchisq_x" ); + b_R_core = fChain->GetBranch( "R_core" ); + b_MSCWT = fChain->GetBranch( "MSCWT" ); + b_MSCLT = fChain->GetBranch( "MSCLT" ); + b_E = fChain->GetBranch( "E" ); + b_ES = fChain->GetBranch( "ES" ); + b_NMSCW = fChain->GetBranch( "NMSCW" ); + b_MSCW = fChain->GetBranch( "MSCW" ); + b_MSCL = fChain->GetBranch( "MSCL" ); + if( fVersion > 3 ) + { + b_MWR = fChain->GetBranch( "MWR" ); + b_MLR = fChain->GetBranch( "MLR" ); + } + else + { + b_MWR = 0; + b_MLR = 0; + } + b_Erec = fChain->GetBranch( "Erec" ); + b_EChi2 = fChain->GetBranch( "EChi2" ); + b_ErecS = fChain->GetBranch( "ErecS" ); + b_EChi2S = fChain->GetBranch( "EChi2S" ); + if( fVersion > 3 ) + { + b_EmissionHeight = fChain->GetBranch( "EmissionHeight" ); + b_EmissionHeightChi2 = fChain->GetBranch( "EmissionHeightChi2" ); + b_NTelPairs = fChain->GetBranch( "NTelPairs" ); + b_EmissionHeightT = fChain->GetBranch( "EmissionHeightT" ); + } + else + { + b_EmissionHeight = 0; + b_EmissionHeightChi2 = 0; + b_NTelPairs = 0; + b_EmissionHeightT = 0; + } + if( fChain->GetBranchStatus( "DispDiff" ) ) + { + b_DispDiff = fChain->GetBranch( "DispDiff" ); + } + else + { + b_DispDiff = 0; + } + if( fChain->GetBranchStatus( "DispAbsSumWeigth" ) ) + { + b_DispAbsSumWeigth = fChain->GetBranch( "DispAbsSumWeigth" ); + } + else + { + b_DispAbsSumWeigth = 0; + } + if( fChain->GetBranchStatus( "Xoff_intersect" ) ) + { + b_Xoff_intersect = fChain->GetBranch( "Xoff_intersect" ); + } + else + { + b_Xoff_intersect = 0; + } + if( fChain->GetBranchStatus( "Yoff_intersect" ) ) + { + b_Yoff_intersect = fChain->GetBranch( "Yoff_intersect" ); + } + else + { + b_Yoff_intersect = 0; + } + + return kTRUE; +} + + +/* + * Redo stereo reconstruction for a selection of 3-telescope images. + * Used for calculation of effective areas from 4-telescope mscw files + * + * Note! This is very fine tuned and should be used for effective area calculation only + */ +void CData::reconstruct_3tel_images() +{ +// reconstruct_3tel_images_scaled_variables(); +// reconstruct_3tel_images_scaled_emission_height(); +// reconstruct_3tel_images_direction(); +// reconstruct_3tel_images_energy(); + VDispAnalyzer i_dispAnalyzer; + NImages = 3; + SizeSecondMax = 0.; +} +/* + +void reconstruct_3tel_images_scaled_emission_height() +{ + EmissionHeight = -9999.; + EmissionHeightChi2 = -9999.; + +} + + +void reconstruct_3tel_images_scaled_variables() +{ + MSCW = -9999.; + MSCL = -9999.; + MWR = -9999.; + MLR = -9999.; +} + +void reconstruct_3tel_images_direction() +{ + Xoff = -9999.; + Yoff = -9999.; + Xoff_derot = -9999.; + Yoff_derot = -9999.; + DispAbsSumWeigth = -9999.; + + Xcore = -9999.; + Xcore+Ycore = -9999.; +} + +void reconstruct_3tel_images_energy() +{ + ErecS = -9999.; + EChi2S = EChi2S +} + +*/ From 107f929c114e86002610a5dd2c880f30f0fc2cf0 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Fri, 27 Dec 2024 16:23:48 +0100 Subject: [PATCH 02/35] file setup --- Makefile | 16 ++++++++++++++++ inc/CData.h | 16 ++++------------ src/CData.cpp | 21 ++++++++++++++------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 10a0b940..181d0094 100644 --- a/Makefile +++ b/Makefile @@ -412,6 +412,8 @@ ACCOBJECT = ./obj/makeRadialAcceptance.o \ ./obj/VAnaSumRunParameter.o ./obj/VAnaSumRunParameter_Dict.o \ ./obj/VEvndispRunParameter.o ./obj/VEvndispRunParameter_Dict.o \ ./obj/VImageCleaningRunParameter.o ./obj/VImageCleaningRunParameter_Dict.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/VUtilities.o @@ -457,6 +459,8 @@ ACCOBJECT = ./obj/VTS.getRun_TimeElevAzim.o \ ./obj/VStarCatalogue.o ./obj/VStarCatalogue_Dict.o \ ./obj/VStar.o ./obj/VStar_Dict.o \ ./obj/VDB_Connection.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/VUtilities.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -496,6 +500,8 @@ EFFOBJECT = ./obj/VGammaHadronCuts.o ./obj/VGammaHadronCuts_Dict.o ./obj/CData.o ./obj/VMathsandFunctions.o ./obj/VMathsandFunctions_Dict.o \ ./obj/VAstronometry.o ./obj/VAstronometry_Dict.o \ ./obj/VEnergySpectrumfromLiterature.o ./obj/VEnergySpectrumfromLiterature_Dict.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/makeEffectiveArea.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -624,6 +630,8 @@ ANASUMOBJECTS = ./obj/VAnaSum.o ./obj/VGammaHadronCuts.o ./obj/VGammaHadronCuts_ ./obj/VGlobalRunParameter.o ./obj/VGlobalRunParameter_Dict.o \ ./obj/VSkyCoordinatesUtilities.o ./obj/VUtilities.o \ ./obj/VMathsandFunctions.o ./obj/VMathsandFunctions_Dict.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/anasum.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -911,6 +919,8 @@ COMPAREDATAMCOBJ= ./obj/CData.o \ ./obj/VPlotUtilities.o ./obj/VPlotUtilities_Dict.o ./obj/Ctelconfig.o \ ./obj/VHistogramUtilities.o ./obj/VHistogramUtilities_Dict.o \ ./obj/VMathsandFunctions.o ./obj/VMathsandFunctions_Dict.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/compareDatawithMC.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -1072,6 +1082,8 @@ WRITEPARTPHYSOBJ= ./obj/writeParticleRateFilesForTMVA.o \ ./obj/VTimeMask.o ./obj/VTimeMask_Dict.o \ ./obj/VAnaSumRunParameter.o ./obj/VAnaSumRunParameter_Dict.o \ ./obj/VImageCleaningRunParameter.o ./obj/VImageCleaningRunParameter_Dict.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/VUtilities.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -1251,6 +1263,8 @@ calculateCrabRateFromMC: ./obj/CEffArea.o ./obj/CEffArea_Dict.o \ ./obj/VImageCleaningRunParameter.o ./obj/VImageCleaningRunParameter_Dict.o \ ./obj/VTimeMask.o ./obj/VTimeMask_Dict.o \ ./obj/VAnaSumRunParameter.o ./obj/VAnaSumRunParameter_Dict.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/calculateCrabRateFromMC.o $(LD) $(LDFLAGS) $^ $(GLIBS) $(OutPutOpt) ./bin/$@ @echo "$@ done" @@ -1357,6 +1371,8 @@ calculateBinaryPhases: ./obj/CData.o \ ./obj/VImageCleaningRunParameter.o ./obj/VImageCleaningRunParameter_Dict.o \ ./obj/VTableLookupRunParameter.o ./obj/VTableLookupRunParameter_Dict.o \ ./obj/VGlobalRunParameter.o ./obj/VGlobalRunParameter_Dict.o \ + ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o \ ./obj/VOrbitalPhase.o ./obj/VOrbitalPhase_Dict.o \ ./obj/VSkyCoordinatesUtilities.o \ ./obj/VAstronometry.o \ diff --git a/inc/CData.h b/inc/CData.h index bcf6733c..484c9e9f 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -1,9 +1,4 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Fri Sep 22 23:32:42 2006 by ROOT version 5.06/00 -// from TTree data/MSWC and energy lookup results -// found on file: 31391.mscw.root -////////////////////////////////////////////////////////// +// Reading of 'data' tree for mscw_energy output. #ifndef CData_h #define CData_h @@ -30,10 +25,9 @@ class CData bool fShort; int fVersion; - TTree* fChain; //!pointer to the analyzed TTree or TChain - Int_t fCurrent; //!current Tree number in a TChain + TTree* fChain; + Int_t fCurrent; - // Declaration of leave types Int_t runNumber; Int_t eventNumber; Int_t MJD; @@ -45,7 +39,7 @@ class CData Float_t ArrayPointing_Elevation; Float_t ArrayPointing_Azimuth; UInt_t Array_PointingStatus; - // MC parameters + Int_t MCprimary; Double_t MCe0; Double_t MCxcore; @@ -137,14 +131,12 @@ class CData Float_t EmissionHeight; Float_t EmissionHeightChi2; UInt_t NTelPairs; - //[NTelPairs] Float_t EmissionHeightT[VDST_MAXTELESCOPES * VDST_MAXTELESCOPES]; Double_t DispDiff; // from disp method Float_t DispAbsSumWeigth; Float_t Xoff_intersect; Float_t Yoff_intersect; - // List of branches TBranch* b_runNumber; //! TBranch* b_eventNumber; //! TBranch* b_MJD; //! diff --git a/src/CData.cpp b/src/CData.cpp index 09cb34dd..353247d4 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -1,7 +1,14 @@ +/* + * Reading of 'data' tree from mscw_energy output + * + * Allows a simplified 3-telescope reconstruction for + * 4-telescope data (for MC data and for effective area + * calculation only) + * + */ #include "CData.h" - CData::CData( TTree* tree, bool bMC, int iVersion, bool bShort ) { fMC = bMC; @@ -147,8 +154,8 @@ void CData::Init( TTree* tree ) TelRA[i] = 0.; } } - fChain->SetBranchAddress( "ArrayPointing_Azimuth", &ArrayPointing_Azimuth); - fChain->SetBranchAddress( "ArrayPointing_Elevation", &ArrayPointing_Elevation); + fChain->SetBranchAddress( "ArrayPointing_Azimuth", &ArrayPointing_Azimuth ); + fChain->SetBranchAddress( "ArrayPointing_Elevation", &ArrayPointing_Elevation ); if( fChain->GetBranchStatus( "Array_PointingStatus" ) ) { fChain->SetBranchAddress( "Array_PointingStatus", &Array_PointingStatus ); @@ -723,10 +730,10 @@ Bool_t CData::Notify() */ void CData::reconstruct_3tel_images() { -// reconstruct_3tel_images_scaled_variables(); -// reconstruct_3tel_images_scaled_emission_height(); -// reconstruct_3tel_images_direction(); -// reconstruct_3tel_images_energy(); + // reconstruct_3tel_images_scaled_variables(); + // reconstruct_3tel_images_scaled_emission_height(); + // reconstruct_3tel_images_direction(); + // reconstruct_3tel_images_energy(); VDispAnalyzer i_dispAnalyzer; NImages = 3; SizeSecondMax = 0.; From 543297ef7414aee64df1fbfe1f1bb89d006198ad Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Fri, 27 Dec 2024 16:43:55 +0100 Subject: [PATCH 03/35] ttype removal --- inc/VTMVAEvaluator.h | 1 - src/VTMVAEvaluator.cpp | 24 ------------------------ 2 files changed, 25 deletions(-) diff --git a/inc/VTMVAEvaluator.h b/inc/VTMVAEvaluator.h index 3f467af9..3fc112f2 100644 --- a/inc/VTMVAEvaluator.h +++ b/inc/VTMVAEvaluator.h @@ -139,7 +139,6 @@ class VTMVAEvaluator : public TNamed, public VPlotUtilities float fdES; float fSizeSecondMax_log10; float fCoreDist; - float fImages_Ttype[VDST_MAXTELESCOPES]; float fDispDiff; float fDispDiff_log10; float fDispAbsSumWeigth; diff --git a/src/VTMVAEvaluator.cpp b/src/VTMVAEvaluator.cpp index b28c42e4..888e4a84 100644 --- a/src/VTMVAEvaluator.cpp +++ b/src/VTMVAEvaluator.cpp @@ -37,10 +37,6 @@ void VTMVAEvaluator::reset() fDispDiff_log10 = 0.; fDispAbsSumWeigth = 0.; fDummy = 0.; - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - fImages_Ttype[i] = 0.; - } setTMVACutValue(); setSignalEfficiency(); @@ -468,19 +464,6 @@ bool VTMVAEvaluator::initializeWeightFiles( string iWeightFileName, { fTMVAData[b]->fTMVAReader->AddVariable( "DispAbsSumWeigth", &fDispAbsSumWeigth ); } - // Note: assume not more then 3 different telescope types - else if( iTrainingVariables[t] == "NImages_Ttype[0]" && !iVariableIsASpectator[t] ) - { - fTMVAData[b]->fTMVAReader->AddVariable( "NImages_Ttype[0]", &fImages_Ttype[0] ); - } - else if( iTrainingVariables[t] == "NImages_Ttype[1]" && !iVariableIsASpectator[t] ) - { - fTMVAData[b]->fTMVAReader->AddVariable( "NImages_Ttype[1]", &fImages_Ttype[1] ); - } - else if( iTrainingVariables[t] == "NImages_Ttype[2]" && !iVariableIsASpectator[t] ) - { - fTMVAData[b]->fTMVAReader->AddVariable( "NImages_Ttype[2]", &fImages_Ttype[2] ); - } else if( iVariableIsASpectator[t] ) { fTMVAData[b]->fTMVAReader->AddSpectator( iTrainingVariables[t].c_str(), &fDummy ); @@ -736,13 +719,6 @@ bool VTMVAEvaluator::evaluate( bool interpolate_mva, bool use_average_zenith_ang fDispDiff_log10 = 0.; // !!! not clear what the best value is } fDispAbsSumWeigth = fData->DispAbsSumWeigth; - if( fData->NTtype < VDST_MAXTELESCOPES ) - { - for( int i = 0; i < fData->NTtype; i++ ) - { - fImages_Ttype[i] = ( float )fData->NImages_Ttype[i]; - } - } } else { From 37b81562a866a0f77337d1fc13b00934e7ff1007 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Fri, 27 Dec 2024 16:47:10 +0100 Subject: [PATCH 04/35] comments --- src/CData.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/CData.cpp b/src/CData.cpp index 353247d4..8a8699c7 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -736,6 +736,8 @@ void CData::reconstruct_3tel_images() // reconstruct_3tel_images_energy(); VDispAnalyzer i_dispAnalyzer; NImages = 3; + // ImgSel_list + // ImgSel SizeSecondMax = 0.; } /* @@ -758,20 +760,36 @@ void reconstruct_3tel_images_scaled_variables() void reconstruct_3tel_images_direction() { + Chi2 = -9999.; + Xoff = -9999.; Yoff = -9999.; Xoff_derot = -9999.; Yoff_derot = -9999.; + Xoff_intersect = -9999.; + Yoff_intersect = -9999.; DispAbsSumWeigth = -9999.; + DispDiff = -9999.; + + Ze = Ze; Xcore = -9999.; - Xcore+Ycore = -9999.; + Ycore = -9999.; + // R_core[t] } void reconstruct_3tel_images_energy() { ErecS = -9999.; EChi2S = EChi2S + dES = dES; + + Erec // (?) + EChi2 // (?) + dE // (?) } */ + +/* + * - is applyMeanStereoShapeCuts correct? Loop over ntel? From b07cf52da4862b9f82e1181cd8936dd16b8b9e42 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Fri, 27 Dec 2024 17:22:45 +0100 Subject: [PATCH 05/35] cleanup --- inc/CData.h | 15 ++-- src/CData.cpp | 218 ++++++++++++++++---------------------------------- 2 files changed, 76 insertions(+), 157 deletions(-) diff --git a/inc/CData.h b/inc/CData.h index 484c9e9f..49c5a803 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -9,6 +9,7 @@ #include "VGlobalRunParameter.h" #include "VDispAnalyzer.h" +#include #include #include #include @@ -17,6 +18,11 @@ using namespace std; class CData { + private : + void reconstruct_3tel_images_scaled_variables(); + void reconstruct_3tel_images_scaled_emission_height(); + void reconstruct_3tel_images(long unsigned int); + public : bool fMC; @@ -53,15 +59,13 @@ class CData Double_t MCxoff; Double_t MCyoff; - UInt_t LTrigS; ULong64_t LTrig; UInt_t NTrig; Int_t NImages; - UInt_t ImgSelS; ULong64_t ImgSel; UInt_t ImgSel_list[VDST_MAXTELESCOPES]; Int_t NTtype; - UInt_t NImages_Ttype[VDST_MAXTELESCOPES]; + UInt_t NImages_Ttype[VDST_MAXTELESCOPES]; Double_t img2_ang; Double_t Ze; Double_t Az; @@ -72,7 +76,7 @@ class CData Double_t Xoff_derot; Double_t Yoff_derot; Double_t stdS; - Float_t theta2; + Float_t theta2; Double_t Xcore; Double_t Ycore; Double_t Xcore_SC; @@ -237,7 +241,7 @@ class CData CData( TTree* tree = 0, bool bMC = false, int iVersion = 5, bool bShort = false ); virtual ~CData(); - virtual Int_t GetEntry( Long64_t entry ); + virtual Int_t GetEntry( Long64_t entry, unsigned long int telescope_combination = 15 ); virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); virtual Bool_t Notify(); @@ -249,6 +253,5 @@ class CData { return fVersion; } - void reconstruct_3tel_images(); }; #endif diff --git a/src/CData.cpp b/src/CData.cpp index 8a8699c7..2ad66770 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -31,7 +31,7 @@ CData::~CData() } -Int_t CData::GetEntry( Long64_t entry ) +Int_t CData::GetEntry( Long64_t entry, unsigned long int telescope_combination ) { if(!fChain ) { @@ -39,15 +39,10 @@ Int_t CData::GetEntry( Long64_t entry ) } int a = fChain->GetEntry( entry ); - if( a > 0 && fVersion < 6 ) - { - LTrig = ( ULong64_t )LTrigS; - ImgSel = ( ULong64_t )ImgSelS; - } - bool fMC_3tel_reconstruction = true; - if( fMC_3tel_reconstruction && NImages == 4 ) + + if( telescope_combination != 15 && NImages == 4 ) { - reconstruct_3tel_images(); + reconstruct_3tel_images(telescope_combination); } return a; } @@ -168,14 +163,7 @@ void CData::Init( TTree* tree ) // MC tree if( fMC ) { - if( fVersion > 7 ) - { - fChain->SetBranchAddress( "MCprimary", &MCprimary ); - } - else - { - MCprimary = -99; - } + fChain->SetBranchAddress( "MCprimary", &MCprimary ); fChain->SetBranchAddress( "MCe0", &MCe0 ); fChain->SetBranchAddress( "MCxcore", &MCxcore ); fChain->SetBranchAddress( "MCycore", &MCycore ); @@ -212,24 +200,10 @@ void CData::Init( TTree* tree ) } - if( fVersion < 6 ) - { - fChain->SetBranchAddress( "LTrig", <rigS ); - } - else - { - fChain->SetBranchAddress( "LTrig", <rig ); - } + fChain->SetBranchAddress( "LTrig", <rig ); fChain->SetBranchAddress( "NTrig", &NTrig ); fChain->SetBranchAddress( "NImages", &NImages ); - if( fVersion < 6 ) - { - fChain->SetBranchAddress( "ImgSel", &ImgSelS ); - } - else - { - fChain->SetBranchAddress( "ImgSel", &ImgSel ); - } + fChain->SetBranchAddress( "ImgSel", &ImgSel ); fChain->SetBranchAddress( "img2_ang", &img2_ang ); fChain->SetBranchAddress( "Ze", &Ze ); fChain->SetBranchAddress( "Az", &Az ); @@ -276,26 +250,14 @@ void CData::Init( TTree* tree ) } fChain->SetBranchAddress( "stdP", &stdP ); fChain->SetBranchAddress( "Chi2", &Chi2 ); - if( fVersion > 4 ) + fChain->SetBranchAddress( "meanPedvar_Image", &meanPedvar_Image ); + if(!fShort ) { - fChain->SetBranchAddress( "meanPedvar_Image", &meanPedvar_Image ); - if(!fShort ) - { - fChain->SetBranchAddress( "meanPedvar_ImageT", meanPedvar_ImageT ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - meanPedvar_ImageT[i] = 0.; - } - } - + fChain->SetBranchAddress( "meanPedvar_ImageT", meanPedvar_ImageT ); } else { - meanPedvar_Image = 0.; - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) + for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) { meanPedvar_ImageT[i] = 0.; } @@ -333,18 +295,7 @@ void CData::Init( TTree* tree ) fraclow[i] = 0.; } } - if( fVersion > 2 ) - { - fChain->SetBranchAddress( "loss", loss ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - loss[i] = 0.; - } - } - + fChain->SetBranchAddress( "loss", loss ); fChain->SetBranchAddress( "max1", max1 ); fChain->SetBranchAddress( "max2", max2 ); fChain->SetBranchAddress( "max3", max3 ); @@ -354,17 +305,7 @@ void CData::Init( TTree* tree ) fChain->SetBranchAddress( "width", width ); fChain->SetBranchAddress( "length", length ); fChain->SetBranchAddress( "ntubes", ntubes ); - if( fVersion > 2 ) - { - fChain->SetBranchAddress( "nsat", nsat ); - } - else - { - for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - nsat[i] = 0; - } - } + fChain->SetBranchAddress( "nsat", nsat ); if( fChain->GetBranchStatus( "nlowgain" ) ) { fChain->SetBranchAddress( "nlowgain", nlowgain ); @@ -475,16 +416,8 @@ void CData::Init( TTree* tree ) } fChain->SetBranchAddress( "MSCW", &MSCW ); fChain->SetBranchAddress( "MSCL", &MSCL ); - if( fVersion > 3 ) - { - fChain->SetBranchAddress( "MWR", &MWR ); - fChain->SetBranchAddress( "MLR", &MLR ); - } - else - { - MWR = 0.; - MLR = 0.; - } + fChain->SetBranchAddress( "MWR", &MWR ); + fChain->SetBranchAddress( "MLR", &MLR ); fChain->SetBranchAddress( "Erec", &Erec ); fChain->SetBranchAddress( "EChi2", &EChi2 ); fChain->SetBranchAddress( "ErecS", &ErecS ); @@ -499,29 +432,16 @@ void CData::Init( TTree* tree ) dE = 0.; dES = 0.; } - if( fVersion > 3 ) + EmissionHeight = -99.; + fChain->SetBranchAddress( "EmissionHeight", &EmissionHeight ); + fChain->SetBranchAddress( "EmissionHeightChi2", &EmissionHeightChi2 ); + fChain->SetBranchAddress( "NTelPairs", &NTelPairs ); + if(!fShort ) { - EmissionHeight = -99.; - fChain->SetBranchAddress( "EmissionHeight", &EmissionHeight ); - fChain->SetBranchAddress( "EmissionHeightChi2", &EmissionHeightChi2 ); - fChain->SetBranchAddress( "NTelPairs", &NTelPairs ); - if(!fShort ) - { - fChain->SetBranchAddress( "EmissionHeightT", EmissionHeightT ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES * VDST_MAXTELESCOPES; i++ ) - { - EmissionHeightT[i] = 0.; - } - } + fChain->SetBranchAddress( "EmissionHeightT", EmissionHeightT ); } else { - EmissionHeight = -999.; - EmissionHeightChi2 = -999.; - NTelPairs = 0; for( unsigned int i = 0; i < VDST_MAXTELESCOPES * VDST_MAXTELESCOPES; i++ ) { EmissionHeightT[i] = 0.; @@ -614,17 +534,8 @@ Bool_t CData::Notify() b_Ycore_SC = fChain->GetBranch( "Ycore_SC" ); b_stdP = fChain->GetBranch( "stdP" ); b_Chi2 = fChain->GetBranch( "Chi2" ); - if( fVersion > 4 ) - { - b_meanPedvar_Image = fChain->GetBranch( "meanPedvar_Image" ); - b_meanPedvar_ImageT = fChain->GetBranch( "meanPedvar_ImageT" ); - } - else - { - b_meanPedvar_Image = 0; - b_meanPedvar_ImageT = 0; - } - + b_meanPedvar_Image = fChain->GetBranch( "meanPedvar_Image" ); + b_meanPedvar_ImageT = fChain->GetBranch( "meanPedvar_ImageT" ); b_SizeSecondMax = fChain->GetBranch( "SizeSecondMax" ); b_dist = fChain->GetBranch( "dist" ); b_size = fChain->GetBranch( "size" ); @@ -657,34 +568,16 @@ Bool_t CData::Notify() b_NMSCW = fChain->GetBranch( "NMSCW" ); b_MSCW = fChain->GetBranch( "MSCW" ); b_MSCL = fChain->GetBranch( "MSCL" ); - if( fVersion > 3 ) - { - b_MWR = fChain->GetBranch( "MWR" ); - b_MLR = fChain->GetBranch( "MLR" ); - } - else - { - b_MWR = 0; - b_MLR = 0; - } + b_MWR = fChain->GetBranch( "MWR" ); + b_MLR = fChain->GetBranch( "MLR" ); b_Erec = fChain->GetBranch( "Erec" ); b_EChi2 = fChain->GetBranch( "EChi2" ); b_ErecS = fChain->GetBranch( "ErecS" ); b_EChi2S = fChain->GetBranch( "EChi2S" ); - if( fVersion > 3 ) - { - b_EmissionHeight = fChain->GetBranch( "EmissionHeight" ); - b_EmissionHeightChi2 = fChain->GetBranch( "EmissionHeightChi2" ); - b_NTelPairs = fChain->GetBranch( "NTelPairs" ); - b_EmissionHeightT = fChain->GetBranch( "EmissionHeightT" ); - } - else - { - b_EmissionHeight = 0; - b_EmissionHeightChi2 = 0; - b_NTelPairs = 0; - b_EmissionHeightT = 0; - } + b_EmissionHeight = fChain->GetBranch( "EmissionHeight" ); + b_EmissionHeightChi2 = fChain->GetBranch( "EmissionHeightChi2" ); + b_NTelPairs = fChain->GetBranch( "NTelPairs" ); + b_EmissionHeightT = fChain->GetBranch( "EmissionHeightT" ); if( fChain->GetBranchStatus( "DispDiff" ) ) { b_DispDiff = fChain->GetBranch( "DispDiff" ); @@ -728,29 +621,48 @@ Bool_t CData::Notify() * * Note! This is very fine tuned and should be used for effective area calculation only */ -void CData::reconstruct_3tel_images() +void CData::reconstruct_3tel_images(unsigned long int telescope_combination) { - // reconstruct_3tel_images_scaled_variables(); - // reconstruct_3tel_images_scaled_emission_height(); + bitset tel_bitset(telescope_combination); + NImages = (Int_t)tel_bitset.count(); + ImgSel = telescope_combination; + unsigned int z = 0; + SizeSecondMax = 0.; + for(unsigned int t = 0; t < 4; t++ ) + { + if( tel_bitset.test(t) ) + { + ImgSel_list[z] = t; + z++; + if( size[t] > SizeSecondMax ) + { + SizeSecondMax = size[t]; + } + } + } + + reconstruct_3tel_images_scaled_emission_height(); + reconstruct_3tel_images_scaled_variables(); // reconstruct_3tel_images_direction(); // reconstruct_3tel_images_energy(); - VDispAnalyzer i_dispAnalyzer; - NImages = 3; - // ImgSel_list - // ImgSel - SizeSecondMax = 0.; } -/* -void reconstruct_3tel_images_scaled_emission_height() +/* + * Calculate average emission height for 3-telescope image + * + * TODO requires telescope position vector +*/ +void CData::reconstruct_3tel_images_scaled_emission_height() { - EmissionHeight = -9999.; - EmissionHeightChi2 = -9999.; - + EmissionHeight = EmissionHeight; + EmissionHeightChi2 = EmissionHeightChi2; } - -void reconstruct_3tel_images_scaled_variables() +/* + * Calculate mean scaled variables for 3-telescope image + * +*/ +void CData::reconstruct_3tel_images_scaled_variables() { MSCW = -9999.; MSCL = -9999.; @@ -758,8 +670,11 @@ void reconstruct_3tel_images_scaled_variables() MLR = -9999.; } +/* + void reconstruct_3tel_images_direction() { + VDispAnalyzer i_dispAnalyzer; Chi2 = -9999.; Xoff = -9999.; @@ -793,3 +708,4 @@ void reconstruct_3tel_images_energy() /* * - is applyMeanStereoShapeCuts correct? Loop over ntel? + */ From 249208cadf740a677fce63fca9b734cb98b86d5d Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Fri, 27 Dec 2024 18:02:10 +0100 Subject: [PATCH 06/35] Add MWR calculator --- Makefile | 1 + inc/CData.h | 4 ++ inc/VMeanScaledVariables.h | 17 ++++++++ inc/VTableLookup.h | 1 + src/CData.cpp | 6 +++ src/VMeanScaledVariables.cpp | 81 ++++++++++++++++++++++++++++++++++++ src/VTableLookup.cpp | 57 ++++++------------------- 7 files changed, 122 insertions(+), 45 deletions(-) create mode 100644 inc/VMeanScaledVariables.h create mode 100644 src/VMeanScaledVariables.cpp diff --git a/Makefile b/Makefile index 181d0094..4bd0fa29 100644 --- a/Makefile +++ b/Makefile @@ -355,6 +355,7 @@ MSCOBJECTS= ./obj/Cshowerpars.o ./obj/Ctpars.o \ ./obj/VStatistics_Dict.o \ ./obj/VEvndispReconstructionParameter.o ./obj/VEvndispReconstructionParameter_Dict.o \ ./obj/VSimpleStereoReconstructor.o \ + ./obj/VMeanScaledVariables.o \ ./obj/VGrIsuAnalyzer.o \ ./obj/VDispAnalyzer.o \ ./obj/VDispTableReader.o \ diff --git a/inc/CData.h b/inc/CData.h index 49c5a803..5051de27 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -117,7 +117,9 @@ class CData Float_t Disp_T[VDST_MAXTELESCOPES]; Float_t R_core[VDST_MAXTELESCOPES]; Float_t MSCWT[VDST_MAXTELESCOPES]; + Float_t MSCWTSigma[VDST_MAXTELESCOPES]; Float_t MSCLT[VDST_MAXTELESCOPES]; + Float_t MSCLTSigma[VDST_MAXTELESCOPES]; Float_t E[VDST_MAXTELESCOPES]; Float_t ES[VDST_MAXTELESCOPES]; Int_t NMSCW; @@ -217,7 +219,9 @@ class CData TBranch* b_tchisq_x; //! TBranch* b_R_core; //! TBranch* b_MSCWT; //! + TBranch* b_MSCWTSigma; //! TBranch* b_MSCLT; //! + TBranch* b_MSCLTSigma; //! TBranch* b_E; //! TBranch* b_ES; //! TBranch* b_NMSCW; //! diff --git a/inc/VMeanScaledVariables.h b/inc/VMeanScaledVariables.h new file mode 100644 index 00000000..3d14f516 --- /dev/null +++ b/inc/VMeanScaledVariables.h @@ -0,0 +1,17 @@ +//! Mean scaled variables (e.g., mscw) calculations + +#ifndef VMEANSCALEDVARIABLED +#define VMEANSCALEDVARIABLED + +using namespace std; + +namespace VMeanScaledVariables +{ + double mean_reduced_scaled_variable(unsigned int ntel, float *data, float *mc_value, float *mc_sigma); + double mean_reduced_scaled_variable(unsigned int ntel, float *data, double *mc_value, double *mc_sigma); + + double mean_scaled_variable(unsigned int ntel, float *data, float *size, float *mc_value ); + double mean_scaled_variable(unsigned int ntel, float *data, float *size, double *mc_value ); +} + +#endif diff --git a/inc/VTableLookup.h b/inc/VTableLookup.h index dc2f7c56..b2dab309 100644 --- a/inc/VTableLookup.h +++ b/inc/VTableLookup.h @@ -9,6 +9,7 @@ #include "TMath.h" #include "TSystem.h" +#include "VMeanScaledVariables.h" #include "VStatistics.h" #include "VTableLookupDataHandler.h" #include "VTableLookupRunParameter.h" diff --git a/src/CData.cpp b/src/CData.cpp index 2ad66770..f5032b6a 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -383,14 +383,18 @@ void CData::Init( TTree* tree ) if(!fShort ) { fChain->SetBranchAddress( "MSCWT", MSCWT ); + fChain->SetBranchAddress( "MSCWTSigma", MSCWTSigma ); fChain->SetBranchAddress( "MSCLT", MSCLT ); + fChain->SetBranchAddress( "MSCLTSigma", MSCLTSigma ); } else { for( int i = 0; i < VDST_MAXTELESCOPES; i++ ) { MSCWT[i] = 0.; + MSCWTSigma[i] = 0.; MSCLT[i] = 0.; + MSCLTSigma[i] = 0.; } } if(!fShort ) @@ -562,7 +566,9 @@ Bool_t CData::Notify() b_tchisq_x = fChain->GetBranch( "tchisq_x" ); b_R_core = fChain->GetBranch( "R_core" ); b_MSCWT = fChain->GetBranch( "MSCWT" ); + b_MSCWTSigma = fChain->GetBranch( "MSCWTSigma" ); b_MSCLT = fChain->GetBranch( "MSCLT" ); + b_MSCLTSigma = fChain->GetBranch( "MSCLTSigma" ); b_E = fChain->GetBranch( "E" ); b_ES = fChain->GetBranch( "ES" ); b_NMSCW = fChain->GetBranch( "NMSCW" ); diff --git a/src/VMeanScaledVariables.cpp b/src/VMeanScaledVariables.cpp new file mode 100644 index 00000000..f7a2799e --- /dev/null +++ b/src/VMeanScaledVariables.cpp @@ -0,0 +1,81 @@ +/* + * Calculation of mean scaled and mean reduced scaled variables + * + */ + +#include "VMeanScaledVariables.h" + +/* + * Mean reduced scaled variable (e.g. mscw) + * +*/ +double VMeanScaledVariables::mean_reduced_scaled_variable(unsigned int ntel, float *data_value, float *mc_value, float *mc_sigma) +{ + double value = 0.; + double weight = 0; + + if(ntel < 1) + { + return -9999.; + } + + for( unsigned int t = 0; t < ntel; t++ ) + { + if( mc_value[t] > -90. && mc_sigma[t] > -99. ) + { + value += ( data_value[t] - mc_value[t] ) / mc_sigma[t] * (mc_value[t] * mc_value[t]) / ( mc_sigma[t] * mc_sigma[t] ); + weight += ( mc_value[t] * mc_value[t] ) / ( mc_sigma[t] * mc_sigma[t] ); + } + } + if( weight <= 0. ) + { + return -9999.; + } + return value / weight; +} + +double VMeanScaledVariables::mean_reduced_scaled_variable(unsigned int ntel, float *data_value, double *mc_value, double *mc_sigma) +{ + float f_mc_value[ntel]; + float f_mc_sigma[ntel]; + for(unsigned int t = 0; t < ntel; t++ ) + { + f_mc_value[t] = (float)mc_value[t]; + f_mc_sigma[t] = (float)mc_sigma[t]; + } + return VMeanScaledVariables::mean_reduced_scaled_variable(ntel, data_value, f_mc_value, f_mc_sigma ); +} + +/* + * mean scaled variables (e.g. MWR) + * +*/ +double VMeanScaledVariables::mean_scaled_variable(unsigned int ntel, float *data, float *size, float *mc_value ) +{ + double imr = 0.; + double inr = 0.; + // require size > 0 (to use only selected images for the MWR/MWL calculation) + for( unsigned int t = 0; t < ntel; t++ ) + { + if( data[t] > 0. && mc_value[t] && size[t] > 0. ) + { + imr += data[t] / mc_value[t]; + inr++; + } + } + if( inr > 0. ) + { + return imr / inr; + } + return -9999.; +} + +double VMeanScaledVariables::mean_scaled_variable(unsigned int ntel, float *data, float *size, double *mc_value ) +{ + float f_mc_value[ntel]; + for(unsigned int t = 0; t < ntel; t++ ) + { + f_mc_value[t] = (float)mc_value[t]; + } + return VMeanScaledVariables::mean_scaled_variable(ntel, data, size, f_mc_value ); +} diff --git a/src/VTableLookup.cpp b/src/VTableLookup.cpp index 8a3fd191..3f9eb6c5 100644 --- a/src/VTableLookup.cpp +++ b/src/VTableLookup.cpp @@ -618,8 +618,6 @@ void VTableLookup::readLookupTable() double ze = 0.; double woff = 0.; int fevent = 0; - double imr = 0.; - double inr = 0.; // lookup table index for interpolation unsigned int ize_up = 0; @@ -792,49 +790,18 @@ void VTableLookup::readLookupTable() } fData->setNMSCW( fnmscw ); // set msc value (mean reduced scaled variables) - fData->setMSCW( s_N->mscw ); - fData->setMSCL( s_N->mscl ); - - // calculate mean width ratio (mean scaled variables) - imr = 0.; - inr = 0.; - // require size > 0 (to use only selected images for the MWR/MWL calculation) - float* i_s = fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ); - for( unsigned int j = 0; j < s_N->fNTel; j++ ) - { - if( s_N->mscw_T[j] > 0. && fData->getWidth() && i_s && i_s[j] > 0. ) - { - imr += fData->getWidth()[j] / s_N->mscw_T[j]; - inr++; - } - } - if( inr > 0. ) - { - fData->setMWR( imr / inr ); - } - else - { - fData->setMWR(-99. ); - } - // calculate mean length ratio (mean scaled variables) - imr = 0.; - inr = 0.; - for( unsigned int j = 0; j < s_N->fNTel; j++ ) - { - if( s_N->mscl_T[j] > 0. && fData->getLength() && i_s && i_s[j] > 0. ) - { - imr += fData->getLength()[j] / s_N->mscl_T[j]; - inr++; - } - } - if( inr > 0. ) - { - fData->setMLR( imr / inr ); - } - else - { - fData->setMLR(-99. ); - } + // TODO - change of interpolation approach + // fData->setMSCW( s_N->mscw ); + fData->setMSCW( VMeanScaledVariables::mean_reduced_scaled_variable(s_N->fNTel, fData->getWidth(), s_N->mscw_T, s_N->mscw_Tsigma) ); + // fData->setMSCL( s_N->mscl ); + fData->setMSCL( VMeanScaledVariables::mean_reduced_scaled_variable(s_N->fNTel, fData->getLength(), s_N->mscl_T, s_N->mscl_Tsigma) ); + + fData->setMWR( VMeanScaledVariables::mean_scaled_variable( + s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + fData->getWidth(), s_N->mscw_T ) ); + fData->setMLR( VMeanScaledVariables::mean_scaled_variable( + s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + fData->getLength(), s_N->mscl_T ) ); // set energy values fData->setEnergy( s_N->energySR, true ); From 05ed6974b93070bd4f69e8aec71360e327fcdc35 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Fri, 27 Dec 2024 18:33:27 +0100 Subject: [PATCH 07/35] 3-tel reconstruction --- Makefile | 2 +- inc/CData.h | 1 + src/CData.cpp | 45 ++++++++++++++++++++++++++++++++------------- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 4bd0fa29..a3ff3a9a 100644 --- a/Makefile +++ b/Makefile @@ -502,7 +502,7 @@ EFFOBJECT = ./obj/VGammaHadronCuts.o ./obj/VGammaHadronCuts_Dict.o ./obj/CData.o ./obj/VAstronometry.o ./obj/VAstronometry_Dict.o \ ./obj/VEnergySpectrumfromLiterature.o ./obj/VEnergySpectrumfromLiterature_Dict.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ - ./obj/VTMVADispAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o \ ./obj/makeEffectiveArea.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) diff --git a/inc/CData.h b/inc/CData.h index 5051de27..e63aba72 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -7,6 +7,7 @@ #include #include "VGlobalRunParameter.h" +#include "VMeanScaledVariables.h" #include "VDispAnalyzer.h" #include diff --git a/src/CData.cpp b/src/CData.cpp index f5032b6a..0918f69f 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -630,6 +630,8 @@ Bool_t CData::Notify() void CData::reconstruct_3tel_images(unsigned long int telescope_combination) { bitset tel_bitset(telescope_combination); + // TODO below is wrong: need to check if those images + // are actually available; otherwise discard the event NImages = (Int_t)tel_bitset.count(); ImgSel = telescope_combination; unsigned int z = 0; @@ -645,6 +647,11 @@ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) SizeSecondMax = size[t]; } } + else + { + MSCWT[t] = -9999.; + MSCLT[t] = -9999.; + } } reconstruct_3tel_images_scaled_emission_height(); @@ -670,27 +677,35 @@ void CData::reconstruct_3tel_images_scaled_emission_height() */ void CData::reconstruct_3tel_images_scaled_variables() { - MSCW = -9999.; - MSCL = -9999.; - MWR = -9999.; - MLR = -9999.; + MSCW = VMeanScaledVariables::mean_reduced_scaled_variable(4, width, MSCWT, MSCWTSigma ); + MSCL = VMeanScaledVariables::mean_reduced_scaled_variable(4, length, MSCLT, MSCLTSigma ); + MWR = VMeanScaledVariables::mean_scaled_variable(4, width, size, MSCWT ); + MLR = VMeanScaledVariables::mean_scaled_variable(4, length, size, MSCLT ); } -/* - void reconstruct_3tel_images_direction() { + vector< float > v_x; + vector< float > v_y; + vector< float > v_weight; + float xs; + float ys; + float dispdiff; + VDispAnalyzer i_dispAnalyzer; - Chi2 = -9999.; + i_dispAnalyzer->calculateMeanShowerDirection(v_x, v_y, v_weigth, xs, ys, dispdiff, v_x.size() ); + Xoff = xs; + Yoff = ys; + DispAbsSumWeigth = i_dispAnalyzer->get_abs_sum_disp_weight(); // (!) needs to be checked; fdisp_sum_abs_weigth + DispDiff = fDispAnalyzerDirection->getDispDiff(); + Chi2 = DispDiff; + fimg2_ang = fDispAnalyzerDirection->getAngDiff(); + // expect that this is called for MC only + Xoff_derot = Xoff; + Yoff_derot = Yoff; - Xoff = -9999.; - Yoff = -9999.; - Xoff_derot = -9999.; - Yoff_derot = -9999.; Xoff_intersect = -9999.; Yoff_intersect = -9999.; - DispAbsSumWeigth = -9999.; - DispDiff = -9999.; Ze = Ze; @@ -699,6 +714,9 @@ void reconstruct_3tel_images_direction() // R_core[t] } +/* + + void reconstruct_3tel_images_energy() { ErecS = -9999.; @@ -714,4 +732,5 @@ void reconstruct_3tel_images_energy() /* * - is applyMeanStereoShapeCuts correct? Loop over ntel? + * - remove arraydispdiff? Only parameter which requires Xoff_intersect */ From 2518db94086d13910f890ca892d39efe7549a85b Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Sat, 28 Dec 2024 13:01:20 +0100 Subject: [PATCH 08/35] 3tel core and direction --- Makefile | 19 +- inc/CData.h | 20 ++- inc/VDispAnalyzer.h | 6 +- inc/VGlobalRunParameter.h | 2 +- inc/VInstrumentResponseFunctionRunParameter.h | 4 + src/CData.cpp | 163 ++++++++++++++---- src/VDispAnalyzer.cpp | 10 +- ...InstrumentResponseFunctionRunParameter.cpp | 13 +- src/VMeanScaledVariables.cpp | 2 +- src/VSimpleStereoReconstructor.cpp | 16 ++ src/makeEffectiveArea.cpp | 6 +- 11 files changed, 202 insertions(+), 59 deletions(-) diff --git a/Makefile b/Makefile index a3ff3a9a..d462c3da 100644 --- a/Makefile +++ b/Makefile @@ -414,7 +414,8 @@ ACCOBJECT = ./obj/makeRadialAcceptance.o \ ./obj/VEvndispRunParameter.o ./obj/VEvndispRunParameter_Dict.o \ ./obj/VImageCleaningRunParameter.o ./obj/VImageCleaningRunParameter_Dict.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ - ./obj/VTMVADispAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o \ + ./obj/VEmissionHeightCalculator.o ./obj/VSimpleStereoReconstructor.o ./obj/VGrIsuAnalyzer.o \ ./obj/VUtilities.o @@ -461,7 +462,8 @@ ACCOBJECT = ./obj/VTS.getRun_TimeElevAzim.o \ ./obj/VStar.o ./obj/VStar_Dict.o \ ./obj/VDB_Connection.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ - ./obj/VTMVADispAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o \ + ./obj/VEmissionHeightCalculator.o ./obj/VSimpleStereoReconstructor.o ./obj/VGrIsuAnalyzer.o \ ./obj/VUtilities.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -503,6 +505,7 @@ EFFOBJECT = ./obj/VGammaHadronCuts.o ./obj/VGammaHadronCuts_Dict.o ./obj/CData.o ./obj/VEnergySpectrumfromLiterature.o ./obj/VEnergySpectrumfromLiterature_Dict.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o \ + ./obj/VEmissionHeightCalculator.o ./obj/VSimpleStereoReconstructor.o ./obj/VGrIsuAnalyzer.o \ ./obj/makeEffectiveArea.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -632,7 +635,8 @@ ANASUMOBJECTS = ./obj/VAnaSum.o ./obj/VGammaHadronCuts.o ./obj/VGammaHadronCuts_ ./obj/VSkyCoordinatesUtilities.o ./obj/VUtilities.o \ ./obj/VMathsandFunctions.o ./obj/VMathsandFunctions_Dict.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ - ./obj/VTMVADispAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o \ + ./obj/VEmissionHeightCalculator.o ./obj/VSimpleStereoReconstructor.o ./obj/VGrIsuAnalyzer.o \ ./obj/anasum.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -921,7 +925,8 @@ COMPAREDATAMCOBJ= ./obj/CData.o \ ./obj/VHistogramUtilities.o ./obj/VHistogramUtilities_Dict.o \ ./obj/VMathsandFunctions.o ./obj/VMathsandFunctions_Dict.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ - ./obj/VTMVADispAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o \ + ./obj/VEmissionHeightCalculator.o ./obj/VSimpleStereoReconstructor.o ./obj/VGrIsuAnalyzer.o \ ./obj/compareDatawithMC.o ifeq ($(ASTRONMETRY),-DASTROSLALIB) @@ -1265,7 +1270,8 @@ calculateCrabRateFromMC: ./obj/CEffArea.o ./obj/CEffArea_Dict.o \ ./obj/VTimeMask.o ./obj/VTimeMask_Dict.o \ ./obj/VAnaSumRunParameter.o ./obj/VAnaSumRunParameter_Dict.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ - ./obj/VTMVADispAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o \ + ./obj/VEmissionHeightCalculator.o ./obj/VSimpleStereoReconstructor.o ./obj/VGrIsuAnalyzer.o \ ./obj/calculateCrabRateFromMC.o $(LD) $(LDFLAGS) $^ $(GLIBS) $(OutPutOpt) ./bin/$@ @echo "$@ done" @@ -1373,7 +1379,8 @@ calculateBinaryPhases: ./obj/CData.o \ ./obj/VTableLookupRunParameter.o ./obj/VTableLookupRunParameter_Dict.o \ ./obj/VGlobalRunParameter.o ./obj/VGlobalRunParameter_Dict.o \ ./obj/VDispAnalyzer.o ./obj/VDispTableReader.o ./obj/VDispTableReader_Dict.o ./obj/VDispTableAnalyzer.o \ - ./obj/VTMVADispAnalyzer.o \ + ./obj/VTMVADispAnalyzer.o ./obj/VMeanScaledVariables.o ./obj/VUtilities.o \ + ./obj/VEmissionHeightCalculator.o ./obj/VSimpleStereoReconstructor.o ./obj/VGrIsuAnalyzer.o \ ./obj/VOrbitalPhase.o ./obj/VOrbitalPhase_Dict.o \ ./obj/VSkyCoordinatesUtilities.o \ ./obj/VAstronometry.o \ diff --git a/inc/CData.h b/inc/CData.h index e63aba72..295a7a17 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -6,23 +6,34 @@ #include #include +#include "VEmissionHeightCalculator.h" #include "VGlobalRunParameter.h" #include "VMeanScaledVariables.h" #include "VDispAnalyzer.h" +#include "VSimpleStereoReconstructor.h" #include #include #include #include +#include using namespace std; class CData { private : - void reconstruct_3tel_images_scaled_variables(); - void reconstruct_3tel_images_scaled_emission_height(); + unsigned long int fTelescopeCombination; + double fStereoMinAngle; + vector< double > fTelX; + vector< double > fTelY; + vector< double > fTelZ; + void reconstruct_3tel_images(long unsigned int); + void reconstruct_3tel_images_direction(); + void reconstruct_3tel_images_scaled_emission_height(); + void reconstruct_3tel_images_scaled_variables(); + void reconstruct_3tel_reset_variables(); public : @@ -246,7 +257,7 @@ class CData CData( TTree* tree = 0, bool bMC = false, int iVersion = 5, bool bShort = false ); virtual ~CData(); - virtual Int_t GetEntry( Long64_t entry, unsigned long int telescope_combination = 15 ); + virtual Int_t GetEntry( Long64_t entry ); virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); virtual Bool_t Notify(); @@ -258,5 +269,8 @@ class CData { return fVersion; } + void initialize_3tel_reconstruction( + unsigned long int telescope_combination, + double stereo_reconstruction_min_angle, vector< double > tel_x, vector< double > tel_y, vector< double > tel_z ); }; #endif diff --git a/inc/VDispAnalyzer.h b/inc/VDispAnalyzer.h index 0613eee2..f73062a2 100644 --- a/inc/VDispAnalyzer.h +++ b/inc/VDispAnalyzer.h @@ -69,9 +69,6 @@ class VDispAnalyzer vector fTelescopeTypeList; vector fTelescopeFOV; - void calculateMeanShowerDirection( vector< float >& v_x, vector< float >& v_y, vector< float >& v_weight, - float& xs, float& ys, float& dispdiff, unsigned int iMaxN ); - unsigned int find_smallest_diff_element( vector< vector< float > >& i_sign, vector< float >& x, vector< float >& y, @@ -125,6 +122,9 @@ class VDispAnalyzer bool UseIntersectForHeadTail, int* img_fitstat ); + void calculateMeanShowerDirection( vector< float >& v_x, vector< float >& v_y, vector< float >& v_weight, + float& xs, float& ys, float& dispdiff, unsigned int iMaxN ); + vector< float > calculateExpectedDirectionError_or_Sign( unsigned int i_ntel, float iArrayElevation, float iArrayAzimuth, ULong64_t* iTelType, float* img_size, float* img_cen_x, float* img_cen_y, diff --git a/inc/VGlobalRunParameter.h b/inc/VGlobalRunParameter.h index b2279f46..9d17bba0 100644 --- a/inc/VGlobalRunParameter.h +++ b/inc/VGlobalRunParameter.h @@ -22,7 +22,7 @@ // HARDWIRED MAXIMUM NUMBER OF TELESCOPES AND CHANNELS, etc. // (changing anything here means that you have to rerun all stages // of the analysis again) -#define VDST_MAXTELESCOPES 100 // maximum number of telescopes +#define VDST_MAXTELESCOPES 10 // maximum number of telescopes #define VDST_MAXTELTYPES 7 // maximum number of telescope types #define VDST_MAXNNGROUPTYPES 6 // maximum number of NN-group types searched in NN-image cleaning #define VDST_MAXCHANNELS 2900 // maximum number of channels per telescopes diff --git a/inc/VInstrumentResponseFunctionRunParameter.h b/inc/VInstrumentResponseFunctionRunParameter.h index 0a442396..df3f50b9 100644 --- a/inc/VInstrumentResponseFunctionRunParameter.h +++ b/inc/VInstrumentResponseFunctionRunParameter.h @@ -84,6 +84,7 @@ class VInstrumentResponseFunctionRunParameter : public TNamed double fYoff; vector< double > fAzMin; vector< double > fAzMax; + double fRerunStereoReconstruction_minAngle; double fWobbleIsotropic; @@ -91,6 +92,9 @@ class VInstrumentResponseFunctionRunParameter : public TNamed double telconfig_arraycentre_X; double telconfig_arraycentre_Y; double telconfig_arraymax; + vector telconfig_telx; + vector telconfig_tely; + vector telconfig_telz; string fCREnergySpectrumFile; unsigned int fCREnergySpectrumID; diff --git a/src/CData.cpp b/src/CData.cpp index 0918f69f..b5b58ccf 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -16,6 +16,7 @@ CData::CData( TTree* tree, bool bMC, int iVersion, bool bShort ) fVersion = iVersion; fBOOLteltype = false; fBOOLdE = false; + fTelescopeCombination = 0; Init( tree ); } @@ -31,7 +32,7 @@ CData::~CData() } -Int_t CData::GetEntry( Long64_t entry, unsigned long int telescope_combination ) +Int_t CData::GetEntry( Long64_t entry ) { if(!fChain ) { @@ -40,9 +41,9 @@ Int_t CData::GetEntry( Long64_t entry, unsigned long int telescope_combination ) int a = fChain->GetEntry( entry ); - if( telescope_combination != 15 && NImages == 4 ) + if( fTelescopeCombination > 0 && fTelescopeCombination != 15 ) { - reconstruct_3tel_images(telescope_combination); + reconstruct_3tel_images(fTelescopeCombination); } return a; } @@ -629,46 +630,100 @@ Bool_t CData::Notify() */ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) { + reconstruct_3tel_reset_variables(); bitset tel_bitset(telescope_combination); - // TODO below is wrong: need to check if those images - // are actually available; otherwise discard the event - NImages = (Int_t)tel_bitset.count(); - ImgSel = telescope_combination; + bitset tel_nimages(0); + + // update list of available images + UInt_t tel_list[VDST_MAXTELESCOPES]; unsigned int z = 0; - SizeSecondMax = 0.; - for(unsigned int t = 0; t < 4; t++ ) + for(int i = 0; i < NImages; i++ ) { + unsigned int t = ImgSel_list[i]; if( tel_bitset.test(t) ) { - ImgSel_list[z] = t; + tel_list[z]=t; + tel_nimages.set(t); z++; - if( size[t] > SizeSecondMax ) - { - SizeSecondMax = size[t]; - } } else { + size[t] = 0.; + ntubes[t] = 0; MSCWT[t] = -9999.; MSCLT[t] = -9999.; } } + for(unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + ImgSel_list[i] = tel_list[i]; + } + NImages = z; + ImgSel = tel_nimages.to_ulong(); + // require at least two images to continue + if( z < 2 ) + { + return; + } + + SizeSecondMax = 0.; + for(int i = 0; i < NImages; i++ ) + { + unsigned int t = ImgSel_list[i]; + if( size[t] > SizeSecondMax ) + { + SizeSecondMax = size[t]; + } + } reconstruct_3tel_images_scaled_emission_height(); reconstruct_3tel_images_scaled_variables(); - // reconstruct_3tel_images_direction(); + reconstruct_3tel_images_direction(); // reconstruct_3tel_images_energy(); } +/* + * Reset all variables relevant for 3-telescope reconstruction + * + */ +void CData::reconstruct_3tel_reset_variables() +{ + NImages = 0; + ImgSel = 0; + SizeSecondMax = -9999.; + EmissionHeight = -9999.; + EmissionHeightChi2 = -9999.; + MSCW = -9999.; + MSCL = -9999.; + MWR = -9999.; + MLR = -9999.; + Xoff = Xoff_derot = -9999.; + Yoff = Yoff_derot = -9999.; + DispAbsSumWeigth = -9999.; + DispDiff = Chi2 = -9999.; + Xoff_intersect = Yoff_intersect = -9999.; + Xcore = -9999.; + Ycore = -9999.; + ErecS = -9999.; + EChi2S = -9999.; + dES = -999.; +} + /* * Calculate average emission height for 3-telescope image * - * TODO requires telescope position vector */ void CData::reconstruct_3tel_images_scaled_emission_height() { - EmissionHeight = EmissionHeight; - EmissionHeightChi2 = EmissionHeightChi2; + VEmissionHeightCalculator fEmissionHeightCalculator; + fEmissionHeightCalculator.setTelescopePositions( fTelX.size(), fTelX.data(), fTelY.data(), fTelZ.data() ); + fEmissionHeightCalculator.getEmissionHeight( cen_x, cen_y, size, ArrayPointing_Azimuth, ArrayPointing_Elevation ); + EmissionHeight = ( float )fEmissionHeightCalculator.getMeanEmissionHeight(); + EmissionHeightChi2 = ( float )fEmissionHeightCalculator.getMeanEmissionHeightChi2(); + if( EmissionHeightChi2 <= 0. ) + { + EmissionHeightChi2 = 1.e-10; + } } /* @@ -683,8 +738,20 @@ void CData::reconstruct_3tel_images_scaled_variables() MLR = VMeanScaledVariables::mean_scaled_variable(4, length, size, MSCLT ); } -void reconstruct_3tel_images_direction() +void CData::reconstruct_3tel_images_direction() { + // intersection method + VSimpleStereoReconstructor i_SR; + i_SR.initialize(2, fStereoMinAngle); + i_SR.reconstruct_direction( + fTelX.size(), + ArrayPointing_Elevation, ArrayPointing_Azimuth, + fTelX.data(), fTelY.data(), fTelZ.data(), + size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); + Xoff_intersect = i_SR.fShower_Xoffset; + Yoff_intersect = i_SR.fShower_Yoffset; + + // disp method vector< float > v_x; vector< float > v_y; vector< float > v_weight; @@ -693,25 +760,32 @@ void reconstruct_3tel_images_direction() float dispdiff; VDispAnalyzer i_dispAnalyzer; - i_dispAnalyzer->calculateMeanShowerDirection(v_x, v_y, v_weigth, xs, ys, dispdiff, v_x.size() ); - Xoff = xs; - Yoff = ys; - DispAbsSumWeigth = i_dispAnalyzer->get_abs_sum_disp_weight(); // (!) needs to be checked; fdisp_sum_abs_weigth - DispDiff = fDispAnalyzerDirection->getDispDiff(); - Chi2 = DispDiff; - fimg2_ang = fDispAnalyzerDirection->getAngDiff(); + i_dispAnalyzer.calculateMeanShowerDirection(v_x, v_y, v_weight, xs, ys, dispdiff, v_x.size() ); // expect that this is called for MC only - Xoff_derot = Xoff; - Yoff_derot = Yoff; - - Xoff_intersect = -9999.; - Yoff_intersect = -9999.; - - Ze = Ze; - - Xcore = -9999.; - Ycore = -9999.; - // R_core[t] + Xoff = Xoff_derot = xs; + Yoff = Yoff_derot = ys; + DispAbsSumWeigth = i_dispAnalyzer.get_abs_sum_disp_weight(); + DispDiff = Chi2 = dispdiff; + + // Average/min angle between images not updated + // approximiation for events which are reduced to 2-tel images; + // the cut on the minimal angle between images is not applied. + img2_ang = -9999.; + + i_SR.fillShowerDirection( Xoff, Yoff ); + Ze = i_SR.fShower_Ze; + Az = i_SR.fShower_Az; + + // core reconstruction + i_SR.reconstruct_core( + fTelX.size(), + ArrayPointing_Elevation, ArrayPointing_Azimuth, + Xoff, Yoff, + fTelX.data(), fTelY.data(), fTelZ.data(), + size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); + Xcore = i_SR.fShower_Xcore; + Ycore = i_SR.fShower_Ycore; + // R_core[t] // TODO } /* @@ -734,3 +808,18 @@ void reconstruct_3tel_images_energy() * - is applyMeanStereoShapeCuts correct? Loop over ntel? * - remove arraydispdiff? Only parameter which requires Xoff_intersect */ + +/* + * initialize stereo reconstruction for 3-telescope + * + */ +void CData::initialize_3tel_reconstruction( + unsigned long int telescope_combination, + double stereo_reconstruction_min_angle, vector< double > tel_x, vector< double > tel_y, vector< double > tel_z ) +{ + fTelescopeCombination = telescope_combination; + fStereoMinAngle = stereo_reconstruction_min_angle; + fTelX = tel_x; + fTelY = tel_y; + fTelZ = tel_z; +} diff --git a/src/VDispAnalyzer.cpp b/src/VDispAnalyzer.cpp index 63a6ec0a..c6d8431b 100644 --- a/src/VDispAnalyzer.cpp +++ b/src/VDispAnalyzer.cpp @@ -424,6 +424,11 @@ void VDispAnalyzer::calculateMeanShowerDirection( xs = -99999.; ys = -99999.; } + fdisp_sum_abs_weigth = 0.; + for( unsigned int i = 0; i < v_weight.size(); i++ ) + { + fdisp_sum_abs_weigth += TMath::Abs( v_weight[i] ); + } } /* @@ -563,11 +568,6 @@ void VDispAnalyzer::calculateMeanDispDirection( unsigned int i_ntel, tel_pointing_dx, tel_pointing_dy, f_dispDiff, xoff_4, yoff_4, UseIntersectForHeadTail ); fdisp_xy_weight_T = v_weight; - fdisp_sum_abs_weigth = 0.; - for( unsigned int i = 0; i < fdisp_xy_weight_T.size(); i++ ) - { - fdisp_sum_abs_weigth += TMath::Abs( fdisp_xy_weight_T[i] ); - } fdisp_T = v_disp; fdisplist_T = v_displist; } diff --git a/src/VInstrumentResponseFunctionRunParameter.cpp b/src/VInstrumentResponseFunctionRunParameter.cpp index 75792fc2..0b24d307 100644 --- a/src/VInstrumentResponseFunctionRunParameter.cpp +++ b/src/VInstrumentResponseFunctionRunParameter.cpp @@ -61,8 +61,9 @@ VInstrumentResponseFunctionRunParameter::VInstrumentResponseFunctionRunParameter fpedvar = 0.; fXoff = 0.; fYoff = 0.; + fRerunStereoReconstruction_minAngle = 0; - fWobbleIsotropic = 0.; //DS + fWobbleIsotropic = 0.; telconfig_ntel = 0; telconfig_arraycentre_X = 0.; @@ -494,6 +495,7 @@ bool VInstrumentResponseFunctionRunParameter::readRunParameters( string ifilenam fnoise = fR->fNoiseLevel; } fpedvar = fR->meanpedvars; + fRerunStereoReconstruction_minAngle = fR->fRerunStereoReconstruction_minAngle; // get wobble offset from first event in file // (should not change during a simulation run!) TTree* i_data = ( TTree* )iFile->Get( "data" ); @@ -534,12 +536,19 @@ bool VInstrumentResponseFunctionRunParameter::readRunParameters( string ifilenam if( telconfig->IsZombie() ) { cout << "error while reading telescope configuration" << endl; - exit( 0 ); + exit( EXIT_FAILURE ); } telconfig_ntel = telconfig->getNTel(); telconfig_arraycentre_X = telconfig->getArrayCentreX(); telconfig_arraycentre_Y = telconfig->getArrayCentreY(); telconfig_arraymax = telconfig->getArrayMaxSize(); + for(unsigned int t = 0; t < telconfig->fChain->GetEntries(); t++ ) + { + telconfig->GetEntry( t ); + telconfig_telx.push_back( telconfig->TelX ); + telconfig_tely.push_back( telconfig->TelY ); + telconfig_telz.push_back( telconfig->TelZ ); + } //////////////////////////////////////// diff --git a/src/VMeanScaledVariables.cpp b/src/VMeanScaledVariables.cpp index f7a2799e..37aa4e60 100644 --- a/src/VMeanScaledVariables.cpp +++ b/src/VMeanScaledVariables.cpp @@ -21,7 +21,7 @@ double VMeanScaledVariables::mean_reduced_scaled_variable(unsigned int ntel, flo for( unsigned int t = 0; t < ntel; t++ ) { - if( mc_value[t] > -90. && mc_sigma[t] > -99. ) + if( mc_value[t] > -90. && mc_sigma[t] > -90. ) { value += ( data_value[t] - mc_value[t] ) / mc_sigma[t] * (mc_value[t] * mc_value[t]) / ( mc_sigma[t] * mc_sigma[t] ); weight += ( mc_value[t] * mc_value[t] ) / ( mc_sigma[t] * mc_sigma[t] ); diff --git a/src/VSimpleStereoReconstructor.cpp b/src/VSimpleStereoReconstructor.cpp index efd66703..59e55260 100644 --- a/src/VSimpleStereoReconstructor.cpp +++ b/src/VSimpleStereoReconstructor.cpp @@ -78,6 +78,14 @@ bool VSimpleStereoReconstructor::reconstruct_direction( unsigned int i_ntel, fTelElevation = iArrayElevation; fTelAzimuth = iArrayAzimuth; + if( img_weight == 0 ) + { + for(unsigned int i = 0; i < i_ntel; i++ ) + { + img_weight[i] = 1.; + } + } + // make sure that all data arrays exist if(!img_size || !img_cen_x || !img_cen_y || !img_cosphi || !img_sinphi @@ -315,6 +323,14 @@ bool VSimpleStereoReconstructor::reconstruct_core( unsigned int i_ntel, // sign flip in reconstruction iShowerDir_ys *= -1.; + if( img_weight == 0 ) + { + for(unsigned int i = 0; i < i_ntel; i++ ) + { + img_weight[i] = 1.; + } + } + // make sure that all data arrays exist if(!img_size || !img_cen_x || !img_cen_y || !img_cosphi || !img_sinphi diff --git a/src/makeEffectiveArea.cpp b/src/makeEffectiveArea.cpp index 2ec55879..5abdb821 100644 --- a/src/makeEffectiveArea.cpp +++ b/src/makeEffectiveArea.cpp @@ -16,7 +16,6 @@ #include "VGlobalRunParameter.h" #include "CData.h" -#include "Ctelconfig.h" #include "VGammaHadronCuts.h" #include "VEffectiveAreaCalculatorMCHistograms.h" #include "VEffectiveAreaCalculator.h" @@ -192,6 +191,11 @@ int main( int argc, char* argv[] ) } CData d( c, true, 6, true ); + d.initialize_3tel_reconstruction( + 15, // TODO + fRunPara->fRerunStereoReconstruction_minAngle, + fRunPara->telconfig_telx, fRunPara->telconfig_tely, fRunPara->telconfig_telz + ); fCuts->setDataTree(&d ); TH1D* hE0mc = ( TH1D* )gDirectory->Get( "hE0mc" ); From 66550eb4f39921180bbb9799db7012c5128c929d Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 18:05:43 +0100 Subject: [PATCH 09/35] energy reconstruction --- inc/CData.h | 5 ++ inc/VDispAnalyzer.h | 1 + src/CData.cpp | 100 ++++++++++++++++++++++---------- src/VDispAnalyzer.cpp | 71 ++++++++++------------- src/VTableLookupDataHandler.cpp | 1 + 5 files changed, 106 insertions(+), 72 deletions(-) diff --git a/inc/CData.h b/inc/CData.h index 295a7a17..c35797f5 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -31,6 +31,7 @@ class CData void reconstruct_3tel_images(long unsigned int); void reconstruct_3tel_images_direction(); + void reconstruct_3tel_images_energy(); void reconstruct_3tel_images_scaled_emission_height(); void reconstruct_3tel_images_scaled_variables(); void reconstruct_3tel_reset_variables(); @@ -145,6 +146,8 @@ class CData Float_t ErecS; Float_t EChi2S; Float_t dES; // Error on ErecS + Int_t NErecST; + Int_t ErecQL; Double_t SizeSecondMax; Float_t EmissionHeight; Float_t EmissionHeightChi2; @@ -245,6 +248,8 @@ class CData TBranch* b_EChi2; //! TBranch* b_ErecS; //! TBranch* b_EChi2S; //! + TBranch* b_ErecQL; //! + TBranch* b_NErecST; //! TBranch* b_SizeSecondMax; //! TBranch* b_EmissionHeight; //! TBranch* b_EmissionHeightChi2; //! diff --git a/inc/VDispAnalyzer.h b/inc/VDispAnalyzer.h index f73062a2..51b59dd0 100644 --- a/inc/VDispAnalyzer.h +++ b/inc/VDispAnalyzer.h @@ -122,6 +122,7 @@ class VDispAnalyzer bool UseIntersectForHeadTail, int* img_fitstat ); + void calculateMeanEnergy(vector< float >& disp_energy_T, float* img_size, double* img_weight); void calculateMeanShowerDirection( vector< float >& v_x, vector< float >& v_y, vector< float >& v_weight, float& xs, float& ys, float& dispdiff, unsigned int iMaxN ); diff --git a/src/CData.cpp b/src/CData.cpp index b5b58ccf..28ef55a9 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -437,6 +437,16 @@ void CData::Init( TTree* tree ) dE = 0.; dES = 0.; } + if( fChain->GetBranchStatus( "ErecQL" ) ) + { + fChain->SetBranchAddress( "ErecQL", &ErecQL ); + fChain->SetBranchAddress( "NErecST", &NErecST ); + } + else + { + ErecQL = 0; + NErecST = 0; + } EmissionHeight = -99.; fChain->SetBranchAddress( "EmissionHeight", &EmissionHeight ); fChain->SetBranchAddress( "EmissionHeightChi2", &EmissionHeightChi2 ); @@ -623,10 +633,15 @@ Bool_t CData::Notify() /* - * Redo stereo reconstruction for a selection of 3-telescope images. - * Used for calculation of effective areas from 4-telescope mscw files + * Redo stereo reconstruction for a selection of 3-telescope events. + * Used for calculation of effective areas from 4-telescope mscw files. * * Note! This is very fine tuned and should be used for effective area calculation only + * + * Following variables are approximated or not calculated correctly: + * + * - img2_ang + * */ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) { @@ -654,6 +669,7 @@ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) MSCLT[t] = -9999.; } } + // TODO is this correct? Or is it a list of NTel length with 0/1 for telescopes set? for(unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) { ImgSel_list[i] = tel_list[i]; @@ -679,11 +695,11 @@ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) reconstruct_3tel_images_scaled_emission_height(); reconstruct_3tel_images_scaled_variables(); reconstruct_3tel_images_direction(); - // reconstruct_3tel_images_energy(); + reconstruct_3tel_images_energy(); } /* - * Reset all variables relevant for 3-telescope reconstruction + * Reset all variables relevant for 3-telescope reconstruction. * */ void CData::reconstruct_3tel_reset_variables() @@ -707,10 +723,13 @@ void CData::reconstruct_3tel_reset_variables() ErecS = -9999.; EChi2S = -9999.; dES = -999.; + NErecST = 0; + ErecQL = -99; + } /* - * Calculate average emission height for 3-telescope image + * Calculate average emission height for 3-telescope events. * */ void CData::reconstruct_3tel_images_scaled_emission_height() @@ -727,7 +746,7 @@ void CData::reconstruct_3tel_images_scaled_emission_height() } /* - * Calculate mean scaled variables for 3-telescope image + * Calculate mean scaled variables for 3-telescope events. * */ void CData::reconstruct_3tel_images_scaled_variables() @@ -738,6 +757,10 @@ void CData::reconstruct_3tel_images_scaled_variables() MLR = VMeanScaledVariables::mean_scaled_variable(4, length, size, MSCLT ); } +/* + * Reconstruct shower direction and core for 3-telescope events. + * +*/ void CData::reconstruct_3tel_images_direction() { // intersection method @@ -752,12 +775,8 @@ void CData::reconstruct_3tel_images_direction() Yoff_intersect = i_SR.fShower_Yoffset; // disp method - vector< float > v_x; - vector< float > v_y; - vector< float > v_weight; - float xs; - float ys; - float dispdiff; + vector v_x, v_y, v_weight; + float xs, ys, dispdiff; VDispAnalyzer i_dispAnalyzer; i_dispAnalyzer.calculateMeanShowerDirection(v_x, v_y, v_weight, xs, ys, dispdiff, v_x.size() ); @@ -767,7 +786,7 @@ void CData::reconstruct_3tel_images_direction() DispAbsSumWeigth = i_dispAnalyzer.get_abs_sum_disp_weight(); DispDiff = Chi2 = dispdiff; - // Average/min angle between images not updated + // Average/min angle between images not updated. TODO // approximiation for events which are reduced to 2-tel images; // the cut on the minimal angle between images is not applied. img2_ang = -9999.; @@ -785,30 +804,42 @@ void CData::reconstruct_3tel_images_direction() size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); Xcore = i_SR.fShower_Xcore; Ycore = i_SR.fShower_Ycore; - // R_core[t] // TODO + for( unsigned int t = 0; t < fTelX.size(); t++ ) + { + R_core[t] = -9999.; + if( ImgSel_list[t] && Ze >= 0. && Xcore > -9998. && Ycore > -9998. ) + { + R_core[t] = VUtilities::line_point_distance( + Ycore, -1.*Xcore, 0., Ze, Az, fTelY[t], -1.*fTelX[t], fTelZ[t] ); + } + } } /* - - -void reconstruct_3tel_images_energy() + * Reconstruct shower energy for 3-telescope events. + * +*/ +void CData:reconstruct_3tel_images_energy() { - ErecS = -9999.; - EChi2S = EChi2S - dES = dES; - - Erec // (?) - EChi2 // (?) - dE // (?) + VDispAnalyzer i_dispAnalyzer; + vector< float > disp_energy_T; + for(int i = 0; i < NImages; i++ ) + { + unsigned int t = ImgSel_list[i]; + disp_energy_T.push_back( E[t] ); + } + i_dispAnalyzer.calculateMeanEnergy( disp_energy_T, size, 0); + ErecS = i_dispAnalyzer.getEnergy(); + EChi2S = i_dispAnalyzer.getEnergyChi2(); + dES = i_dispAnalyzer.getEnergydES(); + NErecST = i_dispAnalyzer.getEnergyNT(); + ErecQL = i_dispAnalyzer.getEnergyQualityLabel(); + + Erec = -9999.; + EChi2 = -9999.; + dE = -9999.; } -*/ - -/* - * - is applyMeanStereoShapeCuts correct? Loop over ntel? - * - remove arraydispdiff? Only parameter which requires Xoff_intersect - */ - /* * initialize stereo reconstruction for 3-telescope * @@ -823,3 +854,10 @@ void CData::initialize_3tel_reconstruction( fTelY = tel_y; fTelZ = tel_z; } + +/* + * - is applyMeanStereoShapeCuts correct? Loop over ntel? + * - remove arraydispdiff? Only parameter which requires Xoff_intersect + * - unclear throughout the code if img_sel_list is NImages of NTel long + * - crosscheck usage of ErecS and Erec (which one is disp method result?) + */ diff --git a/src/VDispAnalyzer.cpp b/src/VDispAnalyzer.cpp index c6d8431b..43b20b12 100644 --- a/src/VDispAnalyzer.cpp +++ b/src/VDispAnalyzer.cpp @@ -779,52 +779,46 @@ void VDispAnalyzer::calculateEnergies( unsigned int i_ntel, { return; } + calculateMeanEnergy(fdisp_energy_T, img_size, img_weight); +} - /////////////////// - // calculate average energy - // (require at least two telescopes) - - // fill a 'clean' vector with good energy per telescopes +/* + * Calculate average energy + * (require at least two telescopes) + * +*/ +void VDispAnalyzer::calculateMeanEnergy( + vector< float >& disp_energy_T, + float *img_size, + double* img_weight) +{ vector< double > energy_tel; vector< double > energy_weight; - vector< double > iR; - vector< double > iS; - vector< double > iW; - vector< double > iL; - vector< double > iT; - vector< double > iLe; - vector< double > iWi; - - for( unsigned int i = 0; i < fdisp_energy_T.size(); i++ ) + for( unsigned int i = 0; i < disp_energy_T.size(); i++ ) { - if( fdisp_energy_T[i] > 0. && img_weight[i] > 0. && img_size[i] > 0. ) + if( disp_energy_T[i] > 0. && img_size[i] > 0. ) { - energy_tel.push_back( fdisp_energy_T[i] ); - energy_weight.push_back( img_size[i] * img_weight[i] * img_size[i] * img_weight[i] ); - if( fDebug ) + energy_tel.push_back( disp_energy_T[i] ); + if( img_weight ) + { + energy_weight.push_back( img_size[i] * img_weight[i] * img_size[i] * img_weight[i] ); + } + else { - iR.push_back( iRcore[i] ); - iW.push_back( img_weight[i] ); - iS.push_back( img_size[i] ); - iL.push_back( img_loss[i] ); - iT.push_back( img_tgrad[i] ); - iLe.push_back( img_length[i] ); - iWi.push_back( img_width[i] ); + energy_weight.push_back( img_size[i] * img_size[i] ); } } } double w = 0.; - unsigned int n2 = 0; fdisp_energy = 0.; for( unsigned int j = 0; j < energy_tel.size(); j++ ) { fdisp_energy += energy_tel[j] * energy_weight[j]; w += energy_weight[j]; - n2++; } - fdisp_energy_NT = n2; + fdisp_energy_NT = energy_tel.size(); if( w > 0. ) { fdisp_energy /= w; @@ -848,24 +842,19 @@ void VDispAnalyzer::calculateEnergies( unsigned int i_ntel, // calculate chi2 and dE // (note: different definition for dE // than in lookup table code) - z = 0.; fdisp_energy_chi = 0.; fdisp_energy_dEs = 0.; - for( unsigned int i = 0; i < fdisp_energy_T.size(); i++ ) + for( unsigned int i = 0; i < energy_tel.size(); i++ ) { - if( fdisp_energy_T[i] > 0. && fdisp_energy > 0. ) - { - fdisp_energy_chi += ( fdisp_energy_T[i] - fdisp_energy ) * - ( fdisp_energy_T[i] - fdisp_energy ) / - fdisp_energy / fdisp_energy; - fdisp_energy_dEs += TMath::Abs( fdisp_energy_T[i] - fdisp_energy ) / fdisp_energy; - z++; - } + fdisp_energy_chi += ( energy_tel[i] - fdisp_energy ) * + ( energy_tel[i] - fdisp_energy ) / + fdisp_energy / fdisp_energy; + fdisp_energy_dEs += TMath::Abs( energy_tel[i] - fdisp_energy ) / fdisp_energy; } - if( z > 1.5 ) + if( energy_tel.size() > 1 ) { - fdisp_energy_chi /= ( z - 1. ); - fdisp_energy_dEs /= z; + fdisp_energy_chi /= ( (float)energy_tel.size() - 1. ); + fdisp_energy_dEs /= (float)energy_tel.size(); } else { diff --git a/src/VTableLookupDataHandler.cpp b/src/VTableLookupDataHandler.cpp index b2b6654b..424720fd 100644 --- a/src/VTableLookupDataHandler.cpp +++ b/src/VTableLookupDataHandler.cpp @@ -2048,6 +2048,7 @@ void VTableLookupDataHandler::calcDistances() // check for successful reconstruction for( unsigned int tel = 0; tel < fNTel; tel++ ) { + // TODO - check if fImgSel_List is fNTel or NImages long if( fImgSel_list[tel] && fZe >= 0. && fXcore > -9998. && fYcore > -9998. ) { fR_core[tel] = VUtilities::line_point_distance( fYcore, -1.*fXcore, 0., fZe, fAz, fTelY[tel], -1.*fTelX[tel], fTelZ[tel] ); From a182390cff201bc944c4f67b4ccbbf01c7b95606 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 18:19:13 +0100 Subject: [PATCH 10/35] energy reconstruction --- inc/CData.h | 4 ++-- inc/VTableLookupDataHandler.h | 7 ++----- src/CData.cpp | 26 ++++++++++++++------------ src/VTableLookupDataHandler.cpp | 14 +------------- 4 files changed, 19 insertions(+), 32 deletions(-) diff --git a/inc/CData.h b/inc/CData.h index c35797f5..0a678d2e 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -146,7 +146,7 @@ class CData Float_t ErecS; Float_t EChi2S; Float_t dES; // Error on ErecS - Int_t NErecST; + Int_t NErecT; Int_t ErecQL; Double_t SizeSecondMax; Float_t EmissionHeight; @@ -249,7 +249,7 @@ class CData TBranch* b_ErecS; //! TBranch* b_EChi2S; //! TBranch* b_ErecQL; //! - TBranch* b_NErecST; //! + TBranch* b_NErecT; //! TBranch* b_SizeSecondMax; //! TBranch* b_EmissionHeight; //! TBranch* b_EmissionHeightChi2; //! diff --git a/inc/VTableLookupDataHandler.h b/inc/VTableLookupDataHandler.h index 0a80a821..8ec1363e 100644 --- a/inc/VTableLookupDataHandler.h +++ b/inc/VTableLookupDataHandler.h @@ -284,9 +284,6 @@ class VTableLookupDataHandler float fenergy; //!< reconstructed primary energy float fechi2; //!< chi2 from reconstructed primary energy float fdE; //!< dE from reconstructed primary energy - float fesys; //!< energy correction - float fesysVar; //!< energy correction (variance) - float fesysDist; //!< mean distance to maximum in emission height float fenergyS; //!< reconstructed primary energy float fechi2S; //!< chi2 from reconstructed primary energy float fdES; //!< dE from reconstructed primary energy @@ -547,11 +544,11 @@ class VTableLookupDataHandler } void setEnergy( float iE, bool iTableErecS = true ) { - if( iTableErecS ) + if( iTableErecS ) // table energy reconstruction { fenergyS = iE; } - else + else // dispBDT energy reconstruction { fenergy = iE; } diff --git a/src/CData.cpp b/src/CData.cpp index 28ef55a9..bfff67bf 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -440,12 +440,12 @@ void CData::Init( TTree* tree ) if( fChain->GetBranchStatus( "ErecQL" ) ) { fChain->SetBranchAddress( "ErecQL", &ErecQL ); - fChain->SetBranchAddress( "NErecST", &NErecST ); + fChain->SetBranchAddress( "NErecT", &NErecT ); } else { ErecQL = 0; - NErecST = 0; + NErecT = 0; } EmissionHeight = -99.; fChain->SetBranchAddress( "EmissionHeight", &EmissionHeight ); @@ -641,6 +641,7 @@ Bool_t CData::Notify() * Following variables are approximated or not calculated correctly: * * - img2_ang + * - ErecS, EChi2S, dES (lookup table based energy reconstruction results) * */ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) @@ -720,11 +721,16 @@ void CData::reconstruct_3tel_reset_variables() Xoff_intersect = Yoff_intersect = -9999.; Xcore = -9999.; Ycore = -9999.; + Erec = -9999.; + EChi2 = -9999.; + dE = -999.; + NErecT = 0; + ErecQL = -99; + + // not filled in 3-tel reconstruction ErecS = -9999.; EChi2S = -9999.; dES = -999.; - NErecST = 0; - ErecQL = -99; } @@ -829,15 +835,11 @@ void CData:reconstruct_3tel_images_energy() disp_energy_T.push_back( E[t] ); } i_dispAnalyzer.calculateMeanEnergy( disp_energy_T, size, 0); - ErecS = i_dispAnalyzer.getEnergy(); - EChi2S = i_dispAnalyzer.getEnergyChi2(); - dES = i_dispAnalyzer.getEnergydES(); - NErecST = i_dispAnalyzer.getEnergyNT(); + Erec = i_dispAnalyzer.getEnergy(); + EChi2 = i_dispAnalyzer.getEnergyChi2(); + dE = i_dispAnalyzer.getEnergydES(); + NErecT = i_dispAnalyzer.getEnergyNT(); ErecQL = i_dispAnalyzer.getEnergyQualityLabel(); - - Erec = -9999.; - EChi2 = -9999.; - dE = -9999.; } /* diff --git a/src/VTableLookupDataHandler.cpp b/src/VTableLookupDataHandler.cpp index 424720fd..8e61f2ca 100644 --- a/src/VTableLookupDataHandler.cpp +++ b/src/VTableLookupDataHandler.cpp @@ -1483,19 +1483,13 @@ bool VTableLookupDataHandler::setOutputFile( string iOutput, string iOption, str fOTree->Branch( "EChi2", &fechi2, iTT ); sprintf( iTT, "dE/F" ); fOTree->Branch( "dE", &fdE, iTT ); - sprintf( iTT, "Esys/F" ); - fOTree->Branch( "Esys", &fesys, iTT ); - sprintf( iTT, "EsysVar/F" ); - fOTree->Branch( "EsysVar", &fesysVar, iTT ); - sprintf( iTT, "EsysDist/F" ); - fOTree->Branch( "EsysDist", &fesysDist, iTT ); sprintf( iTT, "ErecS/F" ); fOTree->Branch( "ErecS", &fenergyS, iTT ); sprintf( iTT, "EChi2S/F" ); fOTree->Branch( "EChi2S", &fechi2S, iTT ); sprintf( iTT, "dES/F" ); fOTree->Branch( "dES", &fdES, iTT ); - fOTree->Branch( "NErecST", &fnenergyT, "NErecST" ); + fOTree->Branch( "NErecT", &fnenergyT, "NErecT" ); fOTree->Branch( "ErecQL", &fenergyQL, "ErecQL/I" ); sprintf( iTT, "EmissionHeight/F" ); @@ -2012,9 +2006,6 @@ void VTableLookupDataHandler::reset() fenergy = -99.; fechi2 = -99.; fdE = -99.; - fesys = 0.; - fesysVar = 0.; - fesysDist = 0.; fenergyS = -99.; fechi2S = -99.; fdES = -99.; @@ -2340,9 +2331,6 @@ void VTableLookupDataHandler::resetAll() fenergy = 0.; fechi2 = 0.; fdE = 0.; - fesys = 0.; - fesysVar = 0.; - fesysDist = 0.; fenergyS = 0.; fechi2S = 0.; fdES = 0.; From 704db907cb6439c51a84c98c1b4257b1c7b27a53 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 19:46:16 +0100 Subject: [PATCH 11/35] ntel --- src/CData.cpp | 26 ++++++++++++++----------- src/VGammaHadronCuts.cpp | 2 +- src/VInstrumentResponseFunctionData.cpp | 2 -- src/VTableLookupDataHandler.cpp | 5 +---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/CData.cpp b/src/CData.cpp index bfff67bf..1749e68d 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -652,6 +652,10 @@ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) // update list of available images UInt_t tel_list[VDST_MAXTELESCOPES]; + for(unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + tel_list[i] = 9999; + } unsigned int z = 0; for(int i = 0; i < NImages; i++ ) { @@ -670,15 +674,15 @@ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) MSCLT[t] = -9999.; } } - // TODO is this correct? Or is it a list of NTel length with 0/1 for telescopes set? - for(unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + // ImgSel_list lists the available images (e.g., 2, 3, 4) and is of length NImages + NImages = z; + for(int i = 0; i < NImages; i++ ) { ImgSel_list[i] = tel_list[i]; } - NImages = z; ImgSel = tel_nimages.to_ulong(); // require at least two images to continue - if( z < 2 ) + if( NImages < 2 ) { return; } @@ -810,10 +814,11 @@ void CData::reconstruct_3tel_images_direction() size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); Xcore = i_SR.fShower_Xcore; Ycore = i_SR.fShower_Ycore; + bitset tel_nimages(ImgSel); for( unsigned int t = 0; t < fTelX.size(); t++ ) { R_core[t] = -9999.; - if( ImgSel_list[t] && Ze >= 0. && Xcore > -9998. && Ycore > -9998. ) + if( tel_nimages.test(t) && Ze >= 0. && Xcore > -9998. && Ycore > -9998. ) { R_core[t] = VUtilities::line_point_distance( Ycore, -1.*Xcore, 0., Ze, Az, fTelY[t], -1.*fTelX[t], fTelZ[t] ); @@ -829,9 +834,8 @@ void CData:reconstruct_3tel_images_energy() { VDispAnalyzer i_dispAnalyzer; vector< float > disp_energy_T; - for(int i = 0; i < NImages; i++ ) + for(unsigned int t = 0; t < fTelX.size(); t++ ) { - unsigned int t = ImgSel_list[i]; disp_energy_T.push_back( E[t] ); } i_dispAnalyzer.calculateMeanEnergy( disp_energy_T, size, 0); @@ -858,8 +862,8 @@ void CData::initialize_3tel_reconstruction( } /* - * - is applyMeanStereoShapeCuts correct? Loop over ntel? - * - remove arraydispdiff? Only parameter which requires Xoff_intersect - * - unclear throughout the code if img_sel_list is NImages of NTel long - * - crosscheck usage of ErecS and Erec (which one is disp method result?) + * - crosscheck usage of ErecS and Erec + * - VGammaHadronCuts::getReconstructedEnergy() + * - Erec is dispEnergy (ErecS is simple table energy) + * */ diff --git a/src/VGammaHadronCuts.cpp b/src/VGammaHadronCuts.cpp index 5b6db0c3..44aff686 100644 --- a/src/VGammaHadronCuts.cpp +++ b/src/VGammaHadronCuts.cpp @@ -1652,7 +1652,7 @@ void VGammaHadronCuts::initializeCuts( int irun, string iFile ) { cout << "VGammaHadronCuts::initializeCuts: failed setting probability cuts for " << irun << " " << iFile << endl; cout << "exiting..." << endl; - exit(-1 ); + exit( EXIT_FAILURE ); } } // TMVA cuts diff --git a/src/VInstrumentResponseFunctionData.cpp b/src/VInstrumentResponseFunctionData.cpp index e1018647..a4504a93 100644 --- a/src/VInstrumentResponseFunctionData.cpp +++ b/src/VInstrumentResponseFunctionData.cpp @@ -1,8 +1,6 @@ /*! \class VInstrumentResponseFunctionData \brief data class for instrumental response functions - - */ diff --git a/src/VTableLookupDataHandler.cpp b/src/VTableLookupDataHandler.cpp index 8e61f2ca..de2bf8d0 100644 --- a/src/VTableLookupDataHandler.cpp +++ b/src/VTableLookupDataHandler.cpp @@ -1345,8 +1345,6 @@ bool VTableLookupDataHandler::setOutputFile( string iOutput, string iOption, str fOTree->Branch( "MCe0", &fMCEnergy, "MCe0/D" ); fOTree->Branch( "MCxcore", &fMCxcore, "MCxcore/D" ); fOTree->Branch( "MCycore", &fMCycore, "MCycore/D" ); - sprintf( iTT, "MCR[%d]/D", fNTel ); - // (nowhere needed) fOTree->Branch( "MCR", fMCR, iTT ); fOTree->Branch( "MCxcore_SC", &fMCxcore_SC, "MCxcore_SC/D" ); fOTree->Branch( "MCycore_SC", &fMCycore_SC, "MCycore_SC/D" ); fOTree->Branch( "MCxcos", &fMCxcos, "MCxcos/D" ); @@ -1489,7 +1487,7 @@ bool VTableLookupDataHandler::setOutputFile( string iOutput, string iOption, str fOTree->Branch( "EChi2S", &fechi2S, iTT ); sprintf( iTT, "dES/F" ); fOTree->Branch( "dES", &fdES, iTT ); - fOTree->Branch( "NErecT", &fnenergyT, "NErecT" ); + fOTree->Branch( "NErecT", &fnenergyT, "NErecT/I" ); fOTree->Branch( "ErecQL", &fenergyQL, "ErecQL/I" ); sprintf( iTT, "EmissionHeight/F" ); @@ -2039,7 +2037,6 @@ void VTableLookupDataHandler::calcDistances() // check for successful reconstruction for( unsigned int tel = 0; tel < fNTel; tel++ ) { - // TODO - check if fImgSel_List is fNTel or NImages long if( fImgSel_list[tel] && fZe >= 0. && fXcore > -9998. && fYcore > -9998. ) { fR_core[tel] = VUtilities::line_point_distance( fYcore, -1.*fXcore, 0., fZe, fAz, fTelY[tel], -1.*fTelX[tel], fTelZ[tel] ); From 884465627a7a1631bcff516a939b9f5517982170 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 19:55:52 +0100 Subject: [PATCH 12/35] energy reconstruction method should be 0 (dispBDT energy reconstruction) --- src/VAnaSumRunParameter.cpp | 24 ++++++++----------- ...InstrumentResponseFunctionRunParameter.cpp | 2 +- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/VAnaSumRunParameter.cpp b/src/VAnaSumRunParameter.cpp index 86618ef4..ac87a48f 100644 --- a/src/VAnaSumRunParameter.cpp +++ b/src/VAnaSumRunParameter.cpp @@ -119,7 +119,7 @@ VAnaSumRunParameter::VAnaSumRunParameter() // parameter for energy spectra (in log E) fEnergyReconstructionSpectralIndex = 2.5; - fEnergyReconstructionMethod = 1; + fEnergyReconstructionMethod = 0; fEffectiveAreaVsEnergyMC = 1; // default: use effective areas vs reconstructed energy (accurate method) fEnergySpectrumBinSize = 0.05; fEnergyEffectiveAreaSmoothingIterations = -1; @@ -584,18 +584,6 @@ int VAnaSumRunParameter::readRunParameter( string i_filename ) else if( temp == "ENERGYRECONSTRUCTIONMETHOD" ) { fEnergyReconstructionMethod = ( unsigned int )atoi( temp2.c_str() ); - // print a clear warning if method 0 is selected - if( fEnergyReconstructionMethod == 0 ) - { - cout << endl; - cout << "WARNING: energy reconstruction 0 is no longer valid. For any standard analysise, please use method 1 by:" << endl; - cout << " open your anasum run parameter file and replace " << endl; - cout << "* ENERGYRECONSTRUCTIONMETHOD 0" << endl; - cout << " by " << endl; - cout << "* ENERGYRECONSTRUCTIONMETHOD 1" << endl; - cout << "(if you really want to use method 0, you will have to look into the code to find the detour" << endl; - return 0; - } // horrible detour to make sure that users don't use the wrong method else if( fEnergyReconstructionMethod == 100 ) { @@ -1188,7 +1176,15 @@ void VAnaSumRunParameter::printStereoParameter( unsigned int i ) { cout << " (use effective area A_REC)"; } - cout << ", Method " << fEnergyReconstructionMethod << endl; + cout << ", Method " << fEnergyReconstructionMethod; + if( fEnergyReconstructionMethod == 0 ) + { + cout << " (dispBDT energy reconstruction)" << endl; + } + else + { + cout << " (lookup table energy reconstruction)" << endl; + } cout << "\t dead time calculation method: "; if( fDeadTimeCalculationMethod == 0 ) { diff --git a/src/VInstrumentResponseFunctionRunParameter.cpp b/src/VInstrumentResponseFunctionRunParameter.cpp index 0b24d307..f59c8d08 100644 --- a/src/VInstrumentResponseFunctionRunParameter.cpp +++ b/src/VInstrumentResponseFunctionRunParameter.cpp @@ -16,7 +16,7 @@ VInstrumentResponseFunctionRunParameter::VInstrumentResponseFunctionRunParameter fSpectralIndexMin = 2.0; fSpectralIndexStep = 0.1; - fEnergyReconstructionMethod = 1; + fEnergyReconstructionMethod = 0; fEnergyAxisBins_log10 = 60; fIgnoreEnergyReconstructionQuality = false; From 361476cfa1cccd384456d1932e945f1562e62d3b Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 19:58:43 +0100 Subject: [PATCH 13/35] obsolete comments --- src/CData.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/CData.cpp b/src/CData.cpp index 1749e68d..74e23655 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -860,10 +860,3 @@ void CData::initialize_3tel_reconstruction( fTelY = tel_y; fTelZ = tel_z; } - -/* - * - crosscheck usage of ErecS and Erec - * - VGammaHadronCuts::getReconstructedEnergy() - * - Erec is dispEnergy (ErecS is simple table energy) - * - */ From ca965334fc2f9d8b358d61896fd501149158f45a Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:04:46 +0100 Subject: [PATCH 14/35] cleanup todos --- inc/VExposure.h | 1 - src/VArrayAnalyzer.cpp | 3 - src/VDispTableAnalyzer.cpp | 15 ---- src/VExposure.cpp | 155 ----------------------------------- src/VTS.getRunListFromDB.cpp | 23 ------ 5 files changed, 197 deletions(-) diff --git a/inc/VExposure.h b/inc/VExposure.h index 4deebbb4..cdc46984 100644 --- a/inc/VExposure.h +++ b/inc/VExposure.h @@ -190,7 +190,6 @@ class VExposure : public TObject, public VGlobalRunParameter string ofile = "", unsigned int iVerbose = 0 ); void printListOfRuns(); void printShortRunList(); - void outputAnasumRunlist( string fAnasumFile ); void printTexTable(); bool readAcceptanceCurveFromFile( string iAcc, double iAcceptance_MaxDistance = 1.e9 ); bool readRootFile( string iname = "2006_2008.root", double iMinMJD = -99., double iMaxMJD = -99. ); diff --git a/src/VArrayAnalyzer.cpp b/src/VArrayAnalyzer.cpp index 4f5475b9..ab982101 100644 --- a/src/VArrayAnalyzer.cpp +++ b/src/VArrayAnalyzer.cpp @@ -1157,8 +1157,6 @@ float VArrayAnalyzer::recalculateImagePhi( double iDeltaX, double iDeltaY ) shower core by intersection of lines connecting reconstruced shower direction and image centroids - todo: core reconstruction - */ int VArrayAnalyzer::rcs_method_3( unsigned int iMethod ) { @@ -1316,7 +1314,6 @@ int VArrayAnalyzer::rcs_method_3( unsigned int iMethod ) (difference to rcs_method_3: direction reconstruction independent of CD routines) -todo: core construction */ int VArrayAnalyzer::rcs_method_4( unsigned int iMethod ) { diff --git a/src/VDispTableAnalyzer.cpp b/src/VDispTableAnalyzer.cpp index 6108edaa..5633390c 100644 --- a/src/VDispTableAnalyzer.cpp +++ b/src/VDispTableAnalyzer.cpp @@ -1,8 +1,6 @@ /*! \file VDispTableAnalyzer \brief get DISP values from tables - - */ #include "VDispTableAnalyzer.h" @@ -271,12 +269,6 @@ void VDispTableAnalyzer::terminate() Choose combination with smallest RMS compared to computed mean direction - Preliminary and todo : - - Attention analysis of large array data: use first 16 telescopes only - (should be: use try combinations if first XX telescopes; then choose - the direction with smallest difference to existing mean) - input: x: vector of x-coordinates @@ -302,14 +294,7 @@ void VDispTableAnalyzer::calculateMeanDirection( float& xs, float& ys, vector< f return; } - // use first NTOT_MAX telescopes for event reconstruction only - // (number of possible combinations is 2^NTOT_MAX ) - const unsigned int NTOT_MAX = 16; unsigned int iNTel_max = x.size(); - if( x.size() > NTOT_MAX ) - { - iNTel_max = NTOT_MAX; - } // prepare bit mask to go through all possible combinations of sign for disp calculation vector< bitset< NTOT_MAX > > iComb; diff --git a/src/VExposure.cpp b/src/VExposure.cpp index c94787fa..52419ba0 100644 --- a/src/VExposure.cpp +++ b/src/VExposure.cpp @@ -2369,161 +2369,6 @@ void VExposure::printListOfRuns() } -void VExposure::outputAnasumRunlist( string fAnasumFile ) -{ - - FILE* anasumFile; - - string fatmo; - string fepoch; - string fconfig; - string freplace; - - if( fAnasumFile != "" ) - { - anasumFile = fopen( fAnasumFile.c_str(), "w" ); - } - else - { - return; - } - - cout << "ANSUM output (warning: OLD, USE WITH CAUTION): " << endl; - - // loop over all runs - for( unsigned int j = 0; j < fRunRA.size(); j++ ) - { - fepoch = ""; - fconfig = ""; - freplace = "REPLACE_"; - - // check for atmospheric conditions (dates are set to full moon periods) - fatmo = "ATM"; - // did not looked into such old data files yet (set to undefined atmosphere) - if( fRunDate[j] < 20071026 ) - { - fatmo += "XX_"; - } - else if( fRunDate[j] > 20080420 && fRunDate[j] < 20081113 ) - { - fatmo += "22_"; - } - else if( fRunDate[j] > 20090509 && fRunDate[j] < 20091102 ) - { - fatmo += "22_"; - } - else if( fRunDate[j] > 20100428 && fRunDate[j] < 20101023 ) - { - fatmo += "22_"; - } - else if( fRunDate[j] > 20110418 && fRunDate[j] < 20111110 ) - { - fatmo += "22_"; - } - else if( fRunDate[j] > 20120506 && fRunDate[j] < 20121029 ) - { - fatmo += "22_"; - } - // TODO: not sure which of the two dates (still missing some data from Tucson) ??? - // else if( fRunDate[j] > 20130425 && fRunDate[j] < 20131019 ) fatmo += "22_"; - else if( fRunDate[j] > 20130425 && fRunDate[j] < 20131117 ) - { - fatmo += "22_"; - } - // did not looked into such new data files yet (set to undefined atmosphere) - else if( fRunDate[j] > 20140401 ) - { - fatmo += "XX_"; - } - else - { - fatmo += "21_"; - } - - - if( fRun[j] < 46642 ) - { - fepoch += "V4_"; - } - else if( fRun[j] > 46641 && fRun[j] < 63373 ) - { - fepoch += "V5_"; - } - else if( fRun[j] > 63372 ) - { - fepoch += "V6_"; - } - - if( fRunConfigMask[j] == 15 ) - { - fconfig = "1234"; - } - else if( fRunConfigMask[j] == 7 ) - { - fconfig = "123"; - } - else if( fRunConfigMask[j] == 11 ) - { - fconfig = "124"; - } - else if( fRunConfigMask[j] == 13 ) - { - fconfig = "134"; - } - else if( fRunConfigMask[j] == 14 ) - { - fconfig = "234"; - } - else - { - fconfig = "2Tel"; - } - - freplace += fatmo; - freplace += fepoch; - freplace += fconfig; - - // total time on object (new array configuration only) - if( fRunTelElevation[j] >= fTelMinElevation && fRunDuration[j] >= fMinDuration ) - { - - if( fStatus[j] == "good_run" ) - { - cout << "* "; - } - cout << fRun[j] << " "; - cout << fRun[j] << " "; - cout << " 0 "; - cout << freplace.c_str() << endl; - - if( fStatus[j] == "good_run" ) - { - fprintf( anasumFile, "* %d %d %s\n", fRun[j], fRun[j], freplace.c_str() ); - } - else - { - fprintf( anasumFile, "%d %d %s\n", fRun[j], fRun[j], freplace.c_str() ); - } - - } - - } - - - if( fatmo == "ATMXX_" ) - { - cout << endl; - cout << "Warning: You are using either old or new data runs for which no transition dates have been set in VExposure::outputAnasumRunlist()" << endl; - cout << " Please check radiosonde measurements to find the transition date (they should optiminally be chosen during a full moon period) ..." << endl; - } - - cout << endl; - cout << "ANASUM output written to: " << fAnasumFile.c_str() << endl; - cout << endl; - - fclose( anasumFile ); - -} void VExposure::checkRunList() { diff --git a/src/VTS.getRunListFromDB.cpp b/src/VTS.getRunListFromDB.cpp index 406bd072..5a03dfd6 100644 --- a/src/VTS.getRunListFromDB.cpp +++ b/src/VTS.getRunListFromDB.cpp @@ -22,7 +22,6 @@ string runlist = ""; string startdate = "2000-01-01"; string enddate = "2050-01-01"; string sourcename = "Crab"; -bool bANASUM = false; bool bCHECKDISK = false; bool bOBSMODE = false; string fAnasumFile = ""; @@ -73,10 +72,6 @@ int main( int argc, char* argv[] ) { a.downloadRunList(); } - if( bANASUM ) - { - a.outputAnasumRunlist( fAnasumFile ); - } a.printChecksumSummary(); return 0; } @@ -104,11 +99,6 @@ int main( int argc, char* argv[] ) a.checkRunList(); } - if( bANASUM ) - { - a.outputAnasumRunlist( fAnasumFile ); - } - a.printChecksumSummary(); return 0; @@ -126,10 +116,6 @@ int main( int argc, char* argv[] ) a.checkRunList(); } - if( bANASUM ) - { - a.outputAnasumRunlist( fAnasumFile ); - } a.printChecksumSummary(); return 0; @@ -161,11 +147,6 @@ int main( int argc, char* argv[] ) a.checkRunList(); } - if( bANASUM ) - { - a.outputAnasumRunlist( fAnasumFile ); - } - a.printChecksumSummary(); return 0; @@ -287,10 +268,6 @@ void parseOptions( int argc, char* argv[] ) case 'r': runnumber = atoi( optarg ); break; - case 'a': - bANASUM = true; - fAnasumFile = optarg; - break; case 'c': bCHECKDISK = true; break; From 1975fd481cf2678fba014386f3d4905cc1eac083 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:08:57 +0100 Subject: [PATCH 15/35] todos --- src/VLightCurveUtilities.cpp | 3 +-- src/VLikelihoodFitter.cpp | 5 ----- src/VLombScargle.cpp | 4 ---- src/VLowGainCalibrator.cpp | 1 - src/VSourceGeometryFitter.cpp | 8 +------- src/VStereoReconstruction.cpp | 3 --- src/VTableLookup.cpp | 2 +- src/writeVTSWPPhysSensitivityFiles.cpp | 8 -------- 8 files changed, 3 insertions(+), 31 deletions(-) diff --git a/src/VLightCurveUtilities.cpp b/src/VLightCurveUtilities.cpp index 4d572df5..dc3de5ce 100644 --- a/src/VLightCurveUtilities.cpp +++ b/src/VLightCurveUtilities.cpp @@ -22,11 +22,10 @@ VLightCurveUtilities::VLightCurveUtilities() reset light curve data vector - (TODO: this is a memory leak, fix it) */ void VLightCurveUtilities::resetLightCurveData() { - fLightCurveData.clear(); + fLightCurveData.clear(); // this is a memory leak fLightCurveMJD_min = 1.e99; fLightCurveMJD_max = -1.e99; diff --git a/src/VLikelihoodFitter.cpp b/src/VLikelihoodFitter.cpp index 7e00fc07..193313a7 100644 --- a/src/VLikelihoodFitter.cpp +++ b/src/VLikelihoodFitter.cpp @@ -3118,14 +3118,9 @@ float* VLikelihoodFitter::getIntegralFlux( double i_EMin, double i_EMax, TF1* i_ /* * calculate flux in Crab units * - * (GM) which Crab is this? Whipple? - * (SOB) Yes Whipple 1998 - * ToDo: Implement different Crab spectra options */ double VLikelihoodFitter::getCrabFlux( double iF, double i_EMin, double i_EMax ) { - // double i_N0 = 3.20e-11; - // double i_Crab = i_N0 * (TMath::Power(i_EMax, i_Gamma +1 ) - TMath::Power(i_EMin, i_Gamma +1 ) ) /( i_Gamma +1); if( bValidLiterature ) { double i_Crab = fLiteratureSpectra->getIntegralFlux( i_EMin, i_EMax, fCrabID ); diff --git a/src/VLombScargle.cpp b/src/VLombScargle.cpp index 72c27ca9..f64c8377 100644 --- a/src/VLombScargle.cpp +++ b/src/VLombScargle.cpp @@ -3,10 +3,6 @@ see e.g. Scargle, J., ApJ 263, 835 (1982) - TODO: - - calculate of error on resulting period (shuffling of light curve inside errors) - */ #include "VLombScargle.h" diff --git a/src/VLowGainCalibrator.cpp b/src/VLowGainCalibrator.cpp index f7571bcd..9caf6b98 100644 --- a/src/VLowGainCalibrator.cpp +++ b/src/VLowGainCalibrator.cpp @@ -757,7 +757,6 @@ bool VLowGainCalibrator::calculateMeanCharges() { continue; } - //todo test this if( fabs( sumfirst[tel][iChan] - start[ HiLo[tel][iChan] ] ) > 2*start2[ HiLo[tel][iChan] ] ) continue; if( level > -1 ) { diff --git a/src/VSourceGeometryFitter.cpp b/src/VSourceGeometryFitter.cpp index b6695efd..95197829 100644 --- a/src/VSourceGeometryFitter.cpp +++ b/src/VSourceGeometryFitter.cpp @@ -1,13 +1,7 @@ /*! \class VSourceGeometryFitter \brief analyse source geometry (position and extension) - - TODO: - - plotter - LL function - arcsec calculation - look at extension + Note: inoomplete functionality */ diff --git a/src/VStereoReconstruction.cpp b/src/VStereoReconstruction.cpp index a9983f67..9876919b 100644 --- a/src/VStereoReconstruction.cpp +++ b/src/VStereoReconstruction.cpp @@ -59,9 +59,6 @@ VStereoReconstruction::VStereoReconstruction() setPlottingCanvasSize(); } -/* - todo: check if this is valid -*/ bool VStereoReconstruction::setPlottingVariable( string iVar ) { fPlottingVariable = iVar; diff --git a/src/VTableLookup.cpp b/src/VTableLookup.cpp index 3f9eb6c5..a7862578 100644 --- a/src/VTableLookup.cpp +++ b/src/VTableLookup.cpp @@ -790,7 +790,7 @@ void VTableLookup::readLookupTable() } fData->setNMSCW( fnmscw ); // set msc value (mean reduced scaled variables) - // TODO - change of interpolation approach + // Note change of interpolation approach with v492.0 // fData->setMSCW( s_N->mscw ); fData->setMSCW( VMeanScaledVariables::mean_reduced_scaled_variable(s_N->fNTel, fData->getWidth(), s_N->mscw_T, s_N->mscw_Tsigma) ); // fData->setMSCL( s_N->mscl ); diff --git a/src/writeVTSWPPhysSensitivityFiles.cpp b/src/writeVTSWPPhysSensitivityFiles.cpp index 2ffc7336..b74c98a6 100644 --- a/src/writeVTSWPPhysSensitivityFiles.cpp +++ b/src/writeVTSWPPhysSensitivityFiles.cpp @@ -7,14 +7,6 @@ PRELIMINARY: many hardcoded values - # TODO; - - background rates same coarse binning as effective areas - - effective area vs true energy in fine binning (no) - - calculate offaxis values - - need to read in run parameters from a file? - - - */ #include "VAnalysisUtilities.h" From 483a12857412ca126c71cc5894c94a02851251ad Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:18:15 +0100 Subject: [PATCH 16/35] rerun stereo reconstruction --- inc/VInstrumentResponseFunctionRunParameter.h | 3 ++- inc/VSourceGeometryFitter.h | 4 +-- ...InstrumentResponseFunctionRunParameter.cpp | 27 ++++++++++++------- src/makeEffectiveArea.cpp | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/inc/VInstrumentResponseFunctionRunParameter.h b/inc/VInstrumentResponseFunctionRunParameter.h index df3f50b9..098e54e4 100644 --- a/inc/VInstrumentResponseFunctionRunParameter.h +++ b/inc/VInstrumentResponseFunctionRunParameter.h @@ -85,6 +85,7 @@ class VInstrumentResponseFunctionRunParameter : public TNamed vector< double > fAzMin; vector< double > fAzMax; double fRerunStereoReconstruction_minAngle; + unsigned long int fRerunStereoReconstruction_3telescopes; double fWobbleIsotropic; @@ -114,7 +115,7 @@ class VInstrumentResponseFunctionRunParameter : public TNamed bool readRunParameterFromTextFile( string iFile ); bool testRunparameters(); - ClassDef( VInstrumentResponseFunctionRunParameter, 17 ); + ClassDef( VInstrumentResponseFunctionRunParameter, 18 ); }; #endif diff --git a/inc/VSourceGeometryFitter.h b/inc/VSourceGeometryFitter.h index bf9909d4..f5b0f757 100644 --- a/inc/VSourceGeometryFitter.h +++ b/inc/VSourceGeometryFitter.h @@ -659,7 +659,7 @@ class VFun_SourceDescription_RadialSymmetricSource_Chi2 : public ROOT::Minuit2:: /////////////////////////////////////////////////////////////////////////////// // Source Description (3): Radial Symmetric Sources, LL -// TODO: needs more work to take zero and negative bins into account +// Note: needs more work to take zero and negative bins into account /////////////////////////////////////////////////////////////////////////////// class VFun_SourceDescription_RadialSymmetricSource_LL: public ROOT::Minuit2::FCNBase { @@ -766,7 +766,7 @@ class VFun_SourceDescription_RadialSymmetricSource_LL: public ROOT::Minuit2::FCN /////////////////////////////////////////////////////////////////////////////// // Source Description (4): Radial asymmetric gaussian, convolved with simple PSF -// TODO: needs more work to take zero and negative bins into account +// Note: needs more work to take zero and negative bins into account /////////////////////////////////////////////////////////////////////////////// class VFun_SourceDescription_RadialAsymmetricSource_LL: public ROOT::Minuit2::FCNBase { diff --git a/src/VInstrumentResponseFunctionRunParameter.cpp b/src/VInstrumentResponseFunctionRunParameter.cpp index f59c8d08..f17ad136 100644 --- a/src/VInstrumentResponseFunctionRunParameter.cpp +++ b/src/VInstrumentResponseFunctionRunParameter.cpp @@ -62,6 +62,7 @@ VInstrumentResponseFunctionRunParameter::VInstrumentResponseFunctionRunParameter fXoff = 0.; fYoff = 0.; fRerunStereoReconstruction_minAngle = 0; + fRerunStereoReconstruction_3telescopes = 15; // 15 == use all available telescopes fWobbleIsotropic = 0.; @@ -316,28 +317,36 @@ bool VInstrumentResponseFunctionRunParameter::readRunParameterFromTextFile( stri is_stream >> fCREnergySpectrumID; } } - //DS manually input the zenith - else if( temp == "ZENITH" ) //DS + // manually input the zenith + else if( temp == "ZENITH" ) { if(!( is_stream >> std::ws ).eof() ) { - is_stream >> fze; //DS + is_stream >> fze; } } - //DS manually input the zenith - else if( temp == "NOISE" ) //DS + // manually input the zenith + else if( temp == "NOISE" ) { if(!( is_stream >> std::ws ).eof() ) { - is_stream >> fnoise; //DS + is_stream >> fnoise; } } - //DS manually input the wobble - else if( temp == "WOBBLEISOTROPIC" ) //DS + // manually input the wobble + else if( temp == "WOBBLEISOTROPIC" ) { if(!( is_stream >> std::ws ).eof() ) { - is_stream >> fWobbleIsotropic; //DS + is_stream >> fWobbleIsotropic; + } + } + // 3-telescope reconstruction (MC only) + else if( temp == "RERUN_STEREO_RECONSTRUCTION_3TEL" ) + { + if(!( is_stream >> std::ws ).eof() ) + { + is_stream >> fRerunStereoReconstruction_3telescopes; } } } diff --git a/src/makeEffectiveArea.cpp b/src/makeEffectiveArea.cpp index 5abdb821..ab0d61ac 100644 --- a/src/makeEffectiveArea.cpp +++ b/src/makeEffectiveArea.cpp @@ -192,7 +192,7 @@ int main( int argc, char* argv[] ) CData d( c, true, 6, true ); d.initialize_3tel_reconstruction( - 15, // TODO + fRunPara->fRerunStereoReconstruction_3telescopes, fRunPara->fRerunStereoReconstruction_minAngle, fRunPara->telconfig_telx, fRunPara->telconfig_tely, fRunPara->telconfig_telz ); From 0e318cf7cf573a9b23e049bfca5cbeb5624193fe Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:23:20 +0100 Subject: [PATCH 17/35] simplification --- inc/CData.h | 2 -- src/CData.cpp | 20 ++++---------------- src/makeEffectiveArea.cpp | 2 +- src/makeRadialAcceptance.cpp | 2 +- src/writeFITS_eventlist.cpp | 2 +- 5 files changed, 7 insertions(+), 21 deletions(-) diff --git a/inc/CData.h b/inc/CData.h index 0a678d2e..7a956915 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -39,8 +39,6 @@ class CData public : bool fMC; - bool fBOOLteltype; - bool fBOOLdE; bool fShort; int fVersion; diff --git a/src/CData.cpp b/src/CData.cpp index 74e23655..aa7697d6 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -9,13 +9,11 @@ #include "CData.h" -CData::CData( TTree* tree, bool bMC, int iVersion, bool bShort ) +CData::CData( TTree* tree, bool bMC, bool bShort ) { fMC = bMC; fShort = bShort; - fVersion = iVersion; - fBOOLteltype = false; - fBOOLdE = false; + fVersion = 6; fTelescopeCombination = 0; Init( tree ); @@ -108,16 +106,6 @@ void CData::Init( TTree* tree ) { fMC = true; } - // test if teltype branches exist - if( tree->GetBranchStatus( "NTtype" ) ) - { - fBOOLteltype = true; - } - // test if dE branches exist - if( tree->GetBranchStatus( "dE" ) ) - { - fBOOLdE = true; - } fChain = tree; fCurrent = -1; @@ -266,7 +254,7 @@ void CData::Init( TTree* tree ) fChain->SetBranchAddress( "SizeSecondMax", &SizeSecondMax ); - if( fBOOLteltype ) + if( tree->GetBranchStatus( "NTtype" ) ) { fChain->SetBranchAddress( "ImgSel_list", ImgSel_list ); fChain->SetBranchAddress( "NTtype", &NTtype ); @@ -427,7 +415,7 @@ void CData::Init( TTree* tree ) fChain->SetBranchAddress( "EChi2", &EChi2 ); fChain->SetBranchAddress( "ErecS", &ErecS ); fChain->SetBranchAddress( "EChi2S", &EChi2S ); - if( fBOOLdE ) + if( tree->GetBranchStatus( "dE" ) ) { fChain->SetBranchAddress( "dE", &dE ); fChain->SetBranchAddress( "dES", &dES ); diff --git a/src/makeEffectiveArea.cpp b/src/makeEffectiveArea.cpp index ab0d61ac..ce14822b 100644 --- a/src/makeEffectiveArea.cpp +++ b/src/makeEffectiveArea.cpp @@ -190,7 +190,7 @@ int main( int argc, char* argv[] ) exit( EXIT_FAILURE ); } - CData d( c, true, 6, true ); + CData d( c, true, true ); d.initialize_3tel_reconstruction( fRunPara->fRerunStereoReconstruction_3telescopes, fRunPara->fRerunStereoReconstruction_minAngle, diff --git a/src/makeRadialAcceptance.cpp b/src/makeRadialAcceptance.cpp index 03795b0e..54eeea74 100644 --- a/src/makeRadialAcceptance.cpp +++ b/src/makeRadialAcceptance.cpp @@ -208,7 +208,7 @@ int main( int argc, char* argv[] ) exit( EXIT_FAILURE ); } TTree* c = ( TTree* )fTest.Get( "data" ); - CData* d = new CData( c, false, 5, true ); + CData* d = new CData( c, false, true ); // Check number of telescopes in run VEvndispRunParameter* iParV2 = ( VEvndispRunParameter* )fTest.Get( "runparameterV2" ); diff --git a/src/writeFITS_eventlist.cpp b/src/writeFITS_eventlist.cpp index e3b05f35..88f90ad1 100644 --- a/src/writeFITS_eventlist.cpp +++ b/src/writeFITS_eventlist.cpp @@ -304,7 +304,7 @@ int writeTELARRAY( string iInputFile, string iOutputFile ) FITSRecord rec3( iOutputFile, templ, "GTI" ); TChain *chain = new TChain("data"); chain->Add( iInputFile.c_str() ); - CData dchain( chain, true, 6, false ); + CData dchain( chain, true, false ); double decDiff = 0.; double raDiff = 0.; From 34a43bfc2e49155c1cd4a682a88ad8b757f04625 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:29:14 +0100 Subject: [PATCH 18/35] cleanup telconfig class --- inc/Ctelconfig.h | 311 +---------------------------------------------- src/Ctelconfig.C | 287 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 248 insertions(+), 350 deletions(-) diff --git a/inc/Ctelconfig.h b/inc/Ctelconfig.h index 8b3b9743..0e3dba37 100644 --- a/inc/Ctelconfig.h +++ b/inc/Ctelconfig.h @@ -1,9 +1,4 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Wed Feb 3 15:41:50 2010 by ROOT version 5.22/00a -// from TTree telconfig/detector configuration -// found on file: 10020.root -////////////////////////////////////////////////////////// +// Reading of 'telconfig' tree. #ifndef Ctelconfig_h #define Ctelconfig_h @@ -23,7 +18,6 @@ class Ctelconfig TTree* fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain - // Declaration of leaf types UInt_t NTel; Int_t TelID; ULong64_t TelType; @@ -84,7 +78,6 @@ class Ctelconfig Ctelconfig( TTree* tree = 0 ); virtual ~Ctelconfig(); - virtual Int_t Cut( Long64_t entry ); virtual double getArrayCentreX(); virtual double getArrayCentreY(); virtual double getArrayMaxSize(); @@ -93,307 +86,5 @@ class Ctelconfig virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); virtual bool IsZombie(); - virtual void Loop(); - virtual Bool_t Notify(); - virtual void Show( Long64_t entry = -1 ); }; #endif - -#ifdef Ctelconfig_cxx -Ctelconfig::Ctelconfig( TTree* tree ) -{ - Init( tree ); -} - - -Ctelconfig::~Ctelconfig() -{ - if(!fChain ) - { - return; - } - delete fChain->GetCurrentFile(); -} - -bool Ctelconfig::IsZombie() -{ - if( fChain ) - { - return false; - } - - return true; -} - - -Int_t Ctelconfig::GetEntry( Long64_t entry ) -{ - // Read contents of entry. - if(!fChain ) - { - return 0; - } - return fChain->GetEntry( entry ); -} - - -Long64_t Ctelconfig::LoadTree( Long64_t entry ) -{ - // Set the environment to read one entry - if(!fChain ) - { - return -5; - } - Long64_t centry = fChain->LoadTree( entry ); - if( centry < 0 ) - { - return centry; - } - if(!fChain->InheritsFrom( TChain::Class() ) ) - { - return centry; - } - TChain* chain = ( TChain* )fChain; - if( chain->GetTreeNumber() != fCurrent ) - { - fCurrent = chain->GetTreeNumber(); - Notify(); - } - return centry; -} - - -void Ctelconfig::Init( TTree* tree ) -{ - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normally not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set branch addresses and branch pointers - if(!tree ) - { - return; - } - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass( 1 ); - - NTel = 0; - fChain->SetBranchAddress( "NTel", &NTel, &b_NTel ); - if( fChain->GetBranchStatus( "TelID" ) ) - { - fChain->SetBranchAddress( "TelID", &TelID, &b_TelID ); - } - else - { - TelID = 0; - } - if( fChain->GetBranchStatus( "TelType" ) ) - { - fChain->SetBranchAddress( "TelType", &TelType, &b_TelType ); - } - else - { - TelType = 1; - } - if( fChain->GetBranchStatus( "TelID_hyperArray" ) ) - { - fChain->SetBranchAddress( "TelID_hyperArray", &TelID_hyperArray, &b_TelID_hyperArray ); - } - else - { - TelID_hyperArray = 0; - } - fChain->SetBranchAddress( "TelX", &TelX, &b_TelX ); - fChain->SetBranchAddress( "TelY", &TelY, &b_TelY ); - fChain->SetBranchAddress( "TelZ", &TelZ, &b_TelZ ); - if( fChain->GetBranchStatus( "NMirrors" ) ) - { - fChain->SetBranchAddress( "NMirrors", &NMirrors, &b_NMirrors ); - } - else - { - NMirrors = 0; - } - if( fChain->GetBranchStatus( "MirrorArea" ) ) - { - fChain->SetBranchAddress( "MirrorArea", &MirrorArea, &b_MirrorArea ); - } - else - { - MirrorArea = 0; - } - if( fChain->GetBranchStatus( "FOV" ) ) - { - fChain->SetBranchAddress( "FOV", &FOV, &b_FOV ); - } - else - { - FOV = 0; - } - fChain->SetBranchAddress( "FocalLength", &FocalLength, &b_FocalLength ); - fChain->SetBranchAddress( "CameraScaleFactor", &CameraScaleFactor, &b_CameraScaleFactor ); - fChain->SetBranchAddress( "CameraCentreOffset", &CameraCentreOffset, &b_CameraCentreOffset ); - fChain->SetBranchAddress( "CameraRotation", &CameraRotation, &b_CameraRotation ); - fChain->SetBranchAddress( "NPixel", &NPixel, &b_NPixel ); - fChain->SetBranchAddress( "NSamples", &NSamples, &b_NSamples ); - if( fChain->GetBranchStatus( "NGains" ) ) - { - fChain->SetBranchAddress( "NGains", &NGains, &b_NGains ); - } - else - { - NGains = 0; - } - if( fChain->GetBranchStatus( "HiLoScale" ) ) - { - fChain->SetBranchAddress( "HiLoScale", &HiLoScale, &b_HiLoScale ); - } - else - { - HiLoScale = 0.; - } - if( fChain->GetBranchStatus( "HiLoThreshold" ) ) - { - fChain->SetBranchAddress( "HiLoThreshold", &HiLoThreshold, &b_HiLoThreshold ); - } - else - { - HiLoThreshold = 0; - } - if( fChain->GetBranchStatus( "HiLoOffset" ) ) - { - fChain->SetBranchAddress( "HiLoOffset", &HiLoOffset, &b_HiLoOffset ); - } - else - { - HiLoOffset = 0.; - } - fChain->SetBranchAddress( "XTubeMM", XTubeMM, &b_XTubeMM ); - fChain->SetBranchAddress( "YTubeMM", YTubeMM, &b_YTubeMM ); - fChain->SetBranchAddress( "RTubeMM", RTubeMM, &b_RTubeMM ); - fChain->SetBranchAddress( "XTubeDeg", XTubeDeg, &b_XTubeDeg ); - fChain->SetBranchAddress( "YTubeDeg", YTubeDeg, &b_YTubeDeg ); - fChain->SetBranchAddress( "RTubeDeg", RTubeDeg, &b_RTubeDeg ); - Notify(); -} - - -Bool_t Ctelconfig::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - - -void Ctelconfig::Show( Long64_t entry ) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if(!fChain ) - { - return; - } - fChain->Show( entry ); -} - - -Int_t Ctelconfig::Cut( Long64_t entry ) -{ - // This function may be called from Loop. - // returns 1 if entry is accepted. - // returns -1 otherwise. - return 1; -} - -double Ctelconfig::getArrayCentreX() -{ - if( fChain ) - { - double iX = 0.; - double iN = 0.; - for( Long64_t i = 0; i < fChain->GetEntries(); i++ ) - { - fChain->GetEntry( i ); - - iX += TelX; - iN++; - } - if( iN > 0. ) - { - return iX / iN; - } - } - return -1.e99; -} - -double Ctelconfig::getArrayCentreY() -{ - if( fChain ) - { - double iY = 0.; - double iN = 0.; - for( Long64_t i = 0; i < fChain->GetEntries(); i++ ) - { - fChain->GetEntry( i ); - - iY += TelY; - iN++; - } - if( iN > 0. ) - { - return iY / iN; - } - } - return -1.e99; -} - -double Ctelconfig::getArrayMaxSize() -{ - if( fChain ) - { - double iXc = getArrayCentreX(); - double iYc = getArrayCentreY(); - double iMax = 0.; - for( Long64_t i = 0; i < fChain->GetEntries(); i++ ) - { - fChain->GetEntry( i ); - - if( TMath::Sqrt(( TelX - iXc ) * ( TelX - iXc ) + ( TelY - iYc ) * ( TelY - iYc ) ) > iMax ) - { - iMax = TMath::Sqrt(( TelX - iXc ) * ( TelX - iXc ) + ( TelY - iYc ) * ( TelY - iYc ) ); - } - } - - return iMax; - } - - return 0.; -} - -unsigned int Ctelconfig::getNTel() -{ - if( NTel > 0 ) - { - return NTel; - } - - if( fChain && fChain->GetEntries() > 0 ) - { - fChain->GetEntry( 0 ); - return NTel; - } - - return 0; -} - -#endif // #ifdef Ctelconfig_cxx diff --git a/src/Ctelconfig.C b/src/Ctelconfig.C index b4fd2a4c..09cb52d3 100644 --- a/src/Ctelconfig.C +++ b/src/Ctelconfig.C @@ -1,51 +1,258 @@ -#define Ctelconfig_cxx +/* + * Reading of 'telconfig' tree. +*/ + #include "Ctelconfig.h" -#include -#include -#include - -void Ctelconfig::Loop() -{ - // In a ROOT session, you can do: - // Root > .L Ctelconfig.C - // Root > Ctelconfig t - // Root > t.GetEntry(12); // Fill t data members with entry number 12 - // Root > t.Show(); // Show values of entry 12 - // Root > t.Show(16); // Read and show values of entry 16 - // Root > t.Loop(); // Loop on all entries - // - - // This is the loop skeleton where: - // jentry is the global entry number in the chain - // ientry is the entry number in the current Tree - // Note that the argument to GetEntry must be: - // jentry for TChain::GetEntry - // ientry for TTree::GetEntry and TBranch::GetEntry - // - // To read only selected branches, Insert statements like: - // METHOD1: - // fChain->SetBranchStatus("*",0); // disable all branches - // fChain->SetBranchStatus("branchname",1); // activate branchname - // METHOD2: replace line - // fChain->GetEntry(jentry); //read all branches - //by b_branchname->GetEntry(ientry); //read only this branch - if( fChain == 0 ) + +telconfig::Ctelconfig( TTree* tree ) +{ + Init( tree ); +} + + +Ctelconfig::~Ctelconfig() +{ + if(!fChain ) { return; } + delete fChain->GetCurrentFile(); +} - Long64_t nentries = fChain->GetEntriesFast(); +bool Ctelconfig::IsZombie() +{ + if( fChain ) + { + return false; + } - Long64_t nbytes = 0, nb = 0; - for( Long64_t jentry = 0; jentry < nentries; jentry++ ) + return true; +} + + +Int_t Ctelconfig::GetEntry( Long64_t entry ) +{ + if(!fChain ) + { + return 0; + } + return fChain->GetEntry( entry ); +} + + +Long64_t Ctelconfig::LoadTree( Long64_t entry ) +{ + // Set the environment to read one entry + if(!fChain ) + { + return -5; + } + Long64_t centry = fChain->LoadTree( entry ); + if( centry < 0 ) + { + return centry; + } + if(!fChain->InheritsFrom( TChain::Class() ) ) + { + return centry; + } + TChain* chain = ( TChain* )fChain; + if( chain->GetTreeNumber() != fCurrent ) + { + fCurrent = chain->GetTreeNumber(); + Notify(); + } + return centry; +} + + +void Ctelconfig::Init( TTree* tree ) +{ + if(!tree ) + { + return; + } + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass( 1 ); + + NTel = 0; + fChain->SetBranchAddress( "NTel", &NTel, &b_NTel ); + if( fChain->GetBranchStatus( "TelID" ) ) + { + fChain->SetBranchAddress( "TelID", &TelID, &b_TelID ); + } + else + { + TelID = 0; + } + if( fChain->GetBranchStatus( "TelType" ) ) + { + fChain->SetBranchAddress( "TelType", &TelType, &b_TelType ); + } + else + { + TelType = 1; + } + if( fChain->GetBranchStatus( "TelID_hyperArray" ) ) + { + fChain->SetBranchAddress( "TelID_hyperArray", &TelID_hyperArray, &b_TelID_hyperArray ); + } + else + { + TelID_hyperArray = 0; + } + fChain->SetBranchAddress( "TelX", &TelX, &b_TelX ); + fChain->SetBranchAddress( "TelY", &TelY, &b_TelY ); + fChain->SetBranchAddress( "TelZ", &TelZ, &b_TelZ ); + if( fChain->GetBranchStatus( "NMirrors" ) ) + { + fChain->SetBranchAddress( "NMirrors", &NMirrors, &b_NMirrors ); + } + else + { + NMirrors = 0; + } + if( fChain->GetBranchStatus( "MirrorArea" ) ) + { + fChain->SetBranchAddress( "MirrorArea", &MirrorArea, &b_MirrorArea ); + } + else + { + MirrorArea = 0; + } + if( fChain->GetBranchStatus( "FOV" ) ) { - Long64_t ientry = LoadTree( jentry ); - if( ientry < 0 ) + fChain->SetBranchAddress( "FOV", &FOV, &b_FOV ); + } + else + { + FOV = 0; + } + fChain->SetBranchAddress( "FocalLength", &FocalLength, &b_FocalLength ); + fChain->SetBranchAddress( "CameraScaleFactor", &CameraScaleFactor, &b_CameraScaleFactor ); + fChain->SetBranchAddress( "CameraCentreOffset", &CameraCentreOffset, &b_CameraCentreOffset ); + fChain->SetBranchAddress( "CameraRotation", &CameraRotation, &b_CameraRotation ); + fChain->SetBranchAddress( "NPixel", &NPixel, &b_NPixel ); + fChain->SetBranchAddress( "NSamples", &NSamples, &b_NSamples ); + if( fChain->GetBranchStatus( "NGains" ) ) + { + fChain->SetBranchAddress( "NGains", &NGains, &b_NGains ); + } + else + { + NGains = 0; + } + if( fChain->GetBranchStatus( "HiLoScale" ) ) + { + fChain->SetBranchAddress( "HiLoScale", &HiLoScale, &b_HiLoScale ); + } + else + { + HiLoScale = 0.; + } + if( fChain->GetBranchStatus( "HiLoThreshold" ) ) + { + fChain->SetBranchAddress( "HiLoThreshold", &HiLoThreshold, &b_HiLoThreshold ); + } + else + { + HiLoThreshold = 0; + } + if( fChain->GetBranchStatus( "HiLoOffset" ) ) + { + fChain->SetBranchAddress( "HiLoOffset", &HiLoOffset, &b_HiLoOffset ); + } + else + { + HiLoOffset = 0.; + } + fChain->SetBranchAddress( "XTubeMM", XTubeMM, &b_XTubeMM ); + fChain->SetBranchAddress( "YTubeMM", YTubeMM, &b_YTubeMM ); + fChain->SetBranchAddress( "RTubeMM", RTubeMM, &b_RTubeMM ); + fChain->SetBranchAddress( "XTubeDeg", XTubeDeg, &b_XTubeDeg ); + fChain->SetBranchAddress( "YTubeDeg", YTubeDeg, &b_YTubeDeg ); + fChain->SetBranchAddress( "RTubeDeg", RTubeDeg, &b_RTubeDeg ); +} + + +double Ctelconfig::getArrayCentreX() +{ + if( fChain ) + { + double iX = 0.; + double iN = 0.; + for( Long64_t i = 0; i < fChain->GetEntries(); i++ ) + { + fChain->GetEntry( i ); + + iX += TelX; + iN++; + } + if( iN > 0. ) + { + return iX / iN; + } + } + return -1.e99; +} + +double Ctelconfig::getArrayCentreY() +{ + if( fChain ) + { + double iY = 0.; + double iN = 0.; + for( Long64_t i = 0; i < fChain->GetEntries(); i++ ) + { + fChain->GetEntry( i ); + + iY += TelY; + iN++; + } + if( iN > 0. ) + { + return iY / iN; + } + } + return -1.e99; +} + +double Ctelconfig::getArrayMaxSize() +{ + if( fChain ) + { + double iXc = getArrayCentreX(); + double iYc = getArrayCentreY(); + double iMax = 0.; + for( Long64_t i = 0; i < fChain->GetEntries(); i++ ) { - break; + fChain->GetEntry( i ); + + if( TMath::Sqrt(( TelX - iXc ) * ( TelX - iXc ) + ( TelY - iYc ) * ( TelY - iYc ) ) > iMax ) + { + iMax = TMath::Sqrt(( TelX - iXc ) * ( TelX - iXc ) + ( TelY - iYc ) * ( TelY - iYc ) ); + } } - nb = fChain->GetEntry( jentry ); - nbytes += nb; - // if (Cut(ientry) < 0) continue; + + return iMax; + } + + return 0.; +} + +unsigned int Ctelconfig::getNTel() +{ + if( NTel > 0 ) + { + return NTel; } + + if( fChain && fChain->GetEntries() > 0 ) + { + fChain->GetEntry( 0 ); + return NTel; + } + + return 0; } From a8ca4a7cfa376b453bdcd28af6dcc2953e227173 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:29:46 +0100 Subject: [PATCH 19/35] consistent naming --- src/{Ctelconfig.C => Ctelconfig.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{Ctelconfig.C => Ctelconfig.cpp} (100%) diff --git a/src/Ctelconfig.C b/src/Ctelconfig.cpp similarity index 100% rename from src/Ctelconfig.C rename to src/Ctelconfig.cpp From a2b76eb1113281b88d3dcce2efe7cade9f62f463 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:32:31 +0100 Subject: [PATCH 20/35] tree cleanup --- inc/CRunSummary.h | 227 +--------------------------------------------- src/CRunSummary.C | 213 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 171 insertions(+), 269 deletions(-) diff --git a/inc/CRunSummary.h b/inc/CRunSummary.h index 7c47dfa7..3c4751b9 100644 --- a/inc/CRunSummary.h +++ b/inc/CRunSummary.h @@ -1,9 +1,4 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Fri Sep 28 10:52:52 2007 by ROOT version 5.04/00 -// from TTree tRunSummary/anasum results -// found on file: output.root -////////////////////////////////////////////////////////// +// Anasum run summary tree definition. #ifndef CRunSummary_h #define CRunSummary_h @@ -116,231 +111,11 @@ class CRunSummary : public TObject CRunSummary( TTree* tree = 0 ); virtual ~CRunSummary(); - virtual Int_t Cut( Long64_t entry ); virtual Int_t GetEntry( Long64_t entry ); virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); - virtual void Loop(); virtual Bool_t Notify(); - virtual void Show( Long64_t entry = -1 ); ClassDef( CRunSummary, 1 ); }; #endif - -#ifdef CRunSummary_cxx - -CRunSummary::CRunSummary( TTree* tree ) -{ - fChain = 0; - Init( tree ); -} - - -CRunSummary::~CRunSummary() -{ - if( fChain && fChain->GetCurrentFile() ) - { - delete fChain->GetCurrentFile(); - } -} - - -Int_t CRunSummary::GetEntry( Long64_t entry ) -{ - // Read contents of entry. - if(!fChain ) - { - return 0; - } - return fChain->GetEntry( entry ); -} - - -Long64_t CRunSummary::LoadTree( Long64_t entry ) -{ - // Set the environment to read one entry - if(!fChain ) - { - return -5; - } - Long64_t centry = fChain->LoadTree( entry ); - if( centry < 0 ) - { - return centry; - } - if( fChain->IsA() != TChain::Class() ) - { - return centry; - } - TChain* chain = ( TChain* )fChain; - if( chain->GetTreeNumber() != fCurrent ) - { - fCurrent = chain->GetTreeNumber(); - Notify(); - } - return centry; -} - - -void CRunSummary::Init( TTree* tree ) -{ - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses of the tree - // will be set. It is normally not necessary to make changes to the - // generated code, but the routine can be extended by the user if needed. - // Init() will be called many times when running with PROOF. - - // Set branch addresses - if( tree == 0 ) - { - return; - } - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass( 1 ); - - fChain->SetBranchAddress( "runOn", &runOn ); - fChain->SetBranchAddress( "runOff", &runOff ); - fChain->SetBranchAddress( "MJDOn", &MJDOn ); - fChain->SetBranchAddress( "MJDOff", &MJDOff ); - fChain->SetBranchAddress( "MJDrunstart", &MJDrunstart, &b_MJDrunstart ); - fChain->SetBranchAddress( "MJDrunstop", &MJDrunstop, &b_MJDrunstop ); - fChain->SetBranchAddress( "TargetName", TargetName, &b_TargetName ); - fChain->SetBranchAddress( "TargetRA", &TargetRA ); - fChain->SetBranchAddress( "TargetDec", &TargetDec ); - fChain->SetBranchAddress( "TargetRAJ2000", &TargetRAJ2000 ); - fChain->SetBranchAddress( "TargetDecJ2000", &TargetDecJ2000 ); - fChain->SetBranchAddress( "SkyMapCentreRAJ2000", &SkyMapCentreRAJ2000 ); - fChain->SetBranchAddress( "SkyMapCentreDecJ2000", &SkyMapCentreDecJ2000 ); - fChain->SetBranchAddress( "TargetShiftRAJ2000", &TargetShiftRAJ2000 ); - fChain->SetBranchAddress( "TargetShiftDecJ2000", &TargetShiftDecJ2000 ); - fChain->SetBranchAddress( "TargetShiftWest", &TargetShiftWest ); - fChain->SetBranchAddress( "TargetShiftNorth", &TargetShiftNorth ); - fChain->SetBranchAddress( "WobbleNorth", &WobbleNorth ); - fChain->SetBranchAddress( "WobbleWest", &WobbleWest ); - fChain->SetBranchAddress( "NTel", &NTel ); - fChain->SetBranchAddress( "TelList", TelList, &b_TelList ); - fChain->SetBranchAddress( "tOn", &tOn ); - fChain->SetBranchAddress( "tOff", &tOff ); - fChain->SetBranchAddress( "elevationOn", &elevationOn ); - fChain->SetBranchAddress( "azimuthOn", &azimuthOn ); - fChain->SetBranchAddress( "elevationOff", &elevationOff ); - fChain->SetBranchAddress( "azimuthOff", &azimuthOff ); - fChain->SetBranchAddress( "Theta2Max", &Theta2Max, &b_Theta2Max ); - fChain->SetBranchAddress( "RawRateOn", &RawRateOn ); - fChain->SetBranchAddress( "RawRateOff", &RawRateOff ); - if( fChain->GetBranchStatus( "pedvarsOn" ) ) - { - fChain->SetBranchAddress( "pedvarsOn", &pedvarsOn ); - fChain->SetBranchAddress( "pedvarsOff", &pedvarsOff ); - } - // no pedvars given, assume galactic source - else - { - pedvarsOn = 8.1; - pedvarsOff = 8.1; - } - fChain->SetBranchAddress( "NOn", &NOn ); - fChain->SetBranchAddress( "NOff", &NOff ); - fChain->SetBranchAddress( "NOffNorm", &NOffNorm ); - fChain->SetBranchAddress( "OffNorm", &OffNorm ); - fChain->SetBranchAddress( "Signi", &Signi ); - fChain->SetBranchAddress( "Rate", &Rate ); - fChain->SetBranchAddress( "RateE", &RateE ); - fChain->SetBranchAddress( "RateOff", &RateOff ); - fChain->SetBranchAddress( "RateOffE", &RateOffE ); - fChain->SetBranchAddress( "DeadTimeFracOn", &DeadTimeFracOn ); - fChain->SetBranchAddress( "DeadTimeFracOff", &DeadTimeFracOff ); - fChain->SetBranchAddress( "MaxSigni", &MaxSigni ); - fChain->SetBranchAddress( "MaxSigniX", &MaxSigniX ); - fChain->SetBranchAddress( "MaxSigniY", &MaxSigniY ); - Notify(); -} - - -Bool_t CRunSummary::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. Typically here the branch pointers - // will be retrieved. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. - - // Get branch pointers - b_runOn = fChain->GetBranch( "runOn" ); - b_runOff = fChain->GetBranch( "runOff" ); - b_MJDOn = fChain->GetBranch( "MJDOn" ); - b_MJDOff = fChain->GetBranch( "MJDOff" ); - b_TargetRA = fChain->GetBranch( "TargetRA" ); - b_TargetDec = fChain->GetBranch( "TargetDec" ); - b_TargetRAJ2000 = fChain->GetBranch( "TargetRAJ2000" ); - b_TargetDecJ2000 = fChain->GetBranch( "TargetDecJ2000" ); - b_SkyMapCentreRAJ2000 = fChain->GetBranch( "SkyMapCentreRAJ2000" ); - b_SkyMapCentreDecJ2000 = fChain->GetBranch( "SkyMapCentreDecJ2000" ); - b_TargetShiftRAJ2000 = fChain->GetBranch( "TargetShiftRAJ2000" ); - b_TargetShiftDecJ2000 = fChain->GetBranch( "TargetShiftDecJ2000" ); - b_TargetShiftWest = fChain->GetBranch( "TargetShiftWest" ); - b_TargetShiftNorth = fChain->GetBranch( "TargetShiftNorth" ); - b_WobbleNorth = fChain->GetBranch( "WobbleNorth" ); - b_WobbleWest = fChain->GetBranch( "WobbleWest" ); - b_NTel = fChain->GetBranch( "NTel" ); - b_tOn = fChain->GetBranch( "tOn" ); - b_tOff = fChain->GetBranch( "tOff" ); - if( fChain->GetBranchStatus( "pedvarsOn" ) ) - { - b_pedvarsOn = fChain->GetBranch( "pedvarsOn" ); - b_pedvarsOff = fChain->GetBranch( "pedvarsOff" ); - } - else - { - b_pedvarsOn = 0; - b_pedvarsOff = 0; - } - b_elevationOn = fChain->GetBranch( "elevationOn" ); - b_azimuthOn = fChain->GetBranch( "azimuthOn" ); - b_elevationOff = fChain->GetBranch( "elevationOff" ); - b_azimuthOff = fChain->GetBranch( "azimuthOff" ); - b_RawRateOn = fChain->GetBranch( "RawRateOn" ); - b_RawRateOff = fChain->GetBranch( "RawRateOff" ); - b_NOn = fChain->GetBranch( "NOn" ); - b_NOff = fChain->GetBranch( "NOff" ); - b_NOffNorm = fChain->GetBranch( "NOffNorm" ); - b_OffNorm = fChain->GetBranch( "OffNorm" ); - b_Signi = fChain->GetBranch( "Signi" ); - b_Rate = fChain->GetBranch( "Rate" ); - b_RateE = fChain->GetBranch( "RateE" ); - b_RateOff = fChain->GetBranch( "RateOff" ); - b_RateOffE = fChain->GetBranch( "RateOffE" ); - b_DeadTimeFracOn = fChain->GetBranch( "DeadTimeFracOn" ); - b_DeadTimeFracOff = fChain->GetBranch( "DeadTimeFracOff" ); - b_MaxSigni = fChain->GetBranch( "MaxSigni" ); - b_MaxSigniX = fChain->GetBranch( "MaxSigniX" ); - b_MaxSigniY = fChain->GetBranch( "MaxSigniY" ); - - return kTRUE; -} - - -void CRunSummary::Show( Long64_t entry ) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if(!fChain ) - { - return; - } - fChain->Show( entry ); -} - - -Int_t CRunSummary::Cut( Long64_t entry ) -{ - entry = 0; - // This function may be called from Loop. - // returns 1 if entry is accepted. - // returns -1 otherwise. - return 1; -} -#endif // #ifdef CRunSummary_cxx diff --git a/src/CRunSummary.C b/src/CRunSummary.C index 3cd71708..933748d8 100644 --- a/src/CRunSummary.C +++ b/src/CRunSummary.C @@ -1,55 +1,182 @@ +/* + * Anasum run summary tree definition. + */ + #define CRunSummary_cxx -#include "CRunSummary.h" -#include -#include -#include -#ifndef CRunSummary_C -#define CRunSummary_C +CRunSummary::CRunSummary( TTree* tree ) +{ + fChain = 0; + Init( tree ); +} + + +CRunSummary::~CRunSummary() +{ + if( fChain && fChain->GetCurrentFile() ) + { + delete fChain->GetCurrentFile(); + } +} + + +Int_t CRunSummary::GetEntry( Long64_t entry ) +{ + // Read contents of entry. + if(!fChain ) + { + return 0; + } + return fChain->GetEntry( entry ); +} + + +Long64_t CRunSummary::LoadTree( Long64_t entry ) +{ + // Set the environment to read one entry + if(!fChain ) + { + return -5; + } + Long64_t centry = fChain->LoadTree( entry ); + if( centry < 0 ) + { + return centry; + } + if( fChain->IsA() != TChain::Class() ) + { + return centry; + } + TChain* chain = ( TChain* )fChain; + if( chain->GetTreeNumber() != fCurrent ) + { + fCurrent = chain->GetTreeNumber(); + Notify(); + } + return centry; +} + -void CRunSummary::Loop() +void CRunSummary::Init( TTree* tree ) { - // In a ROOT session, you can do: - // Root > .L CRunSummary.C - // Root > CRunSummary t - // Root > t.GetEntry(12); // Fill t data members with entry number 12 - // Root > t.Show(); // Show values of entry 12 - // Root > t.Show(16); // Read and show values of entry 16 - // Root > t.Loop(); // Loop on all entries - // - - // This is the loop skeleton where: - // jentry is the global entry number in the chain - // ientry is the entry number in the current Tree - // Note that the argument to GetEntry must be: - // jentry for TChain::GetEntry - // ientry for TTree::GetEntry and TBranch::GetEntry - // - // To read only selected branches, Insert statements like: - // METHOD1: - // fChain->SetBranchStatus("*",0); // disable all branches - // fChain->SetBranchStatus("branchname",1); // activate branchname - // METHOD2: replace line - // fChain->GetEntry(jentry); //read all branches - //by b_branchname->GetEntry(ientry); //read only this branch - if( fChain == 0 ) + if( tree == 0 ) { return; } + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass( 1 ); + + fChain->SetBranchAddress( "runOn", &runOn ); + fChain->SetBranchAddress( "runOff", &runOff ); + fChain->SetBranchAddress( "MJDOn", &MJDOn ); + fChain->SetBranchAddress( "MJDOff", &MJDOff ); + fChain->SetBranchAddress( "MJDrunstart", &MJDrunstart, &b_MJDrunstart ); + fChain->SetBranchAddress( "MJDrunstop", &MJDrunstop, &b_MJDrunstop ); + fChain->SetBranchAddress( "TargetName", TargetName, &b_TargetName ); + fChain->SetBranchAddress( "TargetRA", &TargetRA ); + fChain->SetBranchAddress( "TargetDec", &TargetDec ); + fChain->SetBranchAddress( "TargetRAJ2000", &TargetRAJ2000 ); + fChain->SetBranchAddress( "TargetDecJ2000", &TargetDecJ2000 ); + fChain->SetBranchAddress( "SkyMapCentreRAJ2000", &SkyMapCentreRAJ2000 ); + fChain->SetBranchAddress( "SkyMapCentreDecJ2000", &SkyMapCentreDecJ2000 ); + fChain->SetBranchAddress( "TargetShiftRAJ2000", &TargetShiftRAJ2000 ); + fChain->SetBranchAddress( "TargetShiftDecJ2000", &TargetShiftDecJ2000 ); + fChain->SetBranchAddress( "TargetShiftWest", &TargetShiftWest ); + fChain->SetBranchAddress( "TargetShiftNorth", &TargetShiftNorth ); + fChain->SetBranchAddress( "WobbleNorth", &WobbleNorth ); + fChain->SetBranchAddress( "WobbleWest", &WobbleWest ); + fChain->SetBranchAddress( "NTel", &NTel ); + fChain->SetBranchAddress( "TelList", TelList, &b_TelList ); + fChain->SetBranchAddress( "tOn", &tOn ); + fChain->SetBranchAddress( "tOff", &tOff ); + fChain->SetBranchAddress( "elevationOn", &elevationOn ); + fChain->SetBranchAddress( "azimuthOn", &azimuthOn ); + fChain->SetBranchAddress( "elevationOff", &elevationOff ); + fChain->SetBranchAddress( "azimuthOff", &azimuthOff ); + fChain->SetBranchAddress( "Theta2Max", &Theta2Max, &b_Theta2Max ); + fChain->SetBranchAddress( "RawRateOn", &RawRateOn ); + fChain->SetBranchAddress( "RawRateOff", &RawRateOff ); + if( fChain->GetBranchStatus( "pedvarsOn" ) ) + { + fChain->SetBranchAddress( "pedvarsOn", &pedvarsOn ); + fChain->SetBranchAddress( "pedvarsOff", &pedvarsOff ); + } + // no pedvars given, assume galactic source + else + { + pedvarsOn = 8.1; + pedvarsOff = 8.1; + } + fChain->SetBranchAddress( "NOn", &NOn ); + fChain->SetBranchAddress( "NOff", &NOff ); + fChain->SetBranchAddress( "NOffNorm", &NOffNorm ); + fChain->SetBranchAddress( "OffNorm", &OffNorm ); + fChain->SetBranchAddress( "Signi", &Signi ); + fChain->SetBranchAddress( "Rate", &Rate ); + fChain->SetBranchAddress( "RateE", &RateE ); + fChain->SetBranchAddress( "RateOff", &RateOff ); + fChain->SetBranchAddress( "RateOffE", &RateOffE ); + fChain->SetBranchAddress( "DeadTimeFracOn", &DeadTimeFracOn ); + fChain->SetBranchAddress( "DeadTimeFracOff", &DeadTimeFracOff ); + fChain->SetBranchAddress( "MaxSigni", &MaxSigni ); + fChain->SetBranchAddress( "MaxSigniX", &MaxSigniX ); + fChain->SetBranchAddress( "MaxSigniY", &MaxSigniY ); + Notify(); +} - Long64_t nentries = fChain->GetEntriesFast(); - Long64_t nbytes = 0, nb = 0; - for( Long64_t jentry = 0; jentry < nentries; jentry++ ) +Bool_t CRunSummary::Notify() +{ + b_runOn = fChain->GetBranch( "runOn" ); + b_runOff = fChain->GetBranch( "runOff" ); + b_MJDOn = fChain->GetBranch( "MJDOn" ); + b_MJDOff = fChain->GetBranch( "MJDOff" ); + b_TargetRA = fChain->GetBranch( "TargetRA" ); + b_TargetDec = fChain->GetBranch( "TargetDec" ); + b_TargetRAJ2000 = fChain->GetBranch( "TargetRAJ2000" ); + b_TargetDecJ2000 = fChain->GetBranch( "TargetDecJ2000" ); + b_SkyMapCentreRAJ2000 = fChain->GetBranch( "SkyMapCentreRAJ2000" ); + b_SkyMapCentreDecJ2000 = fChain->GetBranch( "SkyMapCentreDecJ2000" ); + b_TargetShiftRAJ2000 = fChain->GetBranch( "TargetShiftRAJ2000" ); + b_TargetShiftDecJ2000 = fChain->GetBranch( "TargetShiftDecJ2000" ); + b_TargetShiftWest = fChain->GetBranch( "TargetShiftWest" ); + b_TargetShiftNorth = fChain->GetBranch( "TargetShiftNorth" ); + b_WobbleNorth = fChain->GetBranch( "WobbleNorth" ); + b_WobbleWest = fChain->GetBranch( "WobbleWest" ); + b_NTel = fChain->GetBranch( "NTel" ); + b_tOn = fChain->GetBranch( "tOn" ); + b_tOff = fChain->GetBranch( "tOff" ); + if( fChain->GetBranchStatus( "pedvarsOn" ) ) + { + b_pedvarsOn = fChain->GetBranch( "pedvarsOn" ); + b_pedvarsOff = fChain->GetBranch( "pedvarsOff" ); + } + else { - Long64_t ientry = LoadTree( jentry ); - if( ientry < 0 ) - { - break; - } - nb = fChain->GetEntry( jentry ); - nbytes += nb; - // if (Cut(ientry) < 0) continue; + b_pedvarsOn = 0; + b_pedvarsOff = 0; } + b_elevationOn = fChain->GetBranch( "elevationOn" ); + b_azimuthOn = fChain->GetBranch( "azimuthOn" ); + b_elevationOff = fChain->GetBranch( "elevationOff" ); + b_azimuthOff = fChain->GetBranch( "azimuthOff" ); + b_RawRateOn = fChain->GetBranch( "RawRateOn" ); + b_RawRateOff = fChain->GetBranch( "RawRateOff" ); + b_NOn = fChain->GetBranch( "NOn" ); + b_NOff = fChain->GetBranch( "NOff" ); + b_NOffNorm = fChain->GetBranch( "NOffNorm" ); + b_OffNorm = fChain->GetBranch( "OffNorm" ); + b_Signi = fChain->GetBranch( "Signi" ); + b_Rate = fChain->GetBranch( "Rate" ); + b_RateE = fChain->GetBranch( "RateE" ); + b_RateOff = fChain->GetBranch( "RateOff" ); + b_RateOffE = fChain->GetBranch( "RateOffE" ); + b_DeadTimeFracOn = fChain->GetBranch( "DeadTimeFracOn" ); + b_DeadTimeFracOff = fChain->GetBranch( "DeadTimeFracOff" ); + b_MaxSigni = fChain->GetBranch( "MaxSigni" ); + b_MaxSigniX = fChain->GetBranch( "MaxSigniX" ); + b_MaxSigniY = fChain->GetBranch( "MaxSigniY" ); + + return kTRUE; } -#endif From 34a5676fb1438020e9938fd4ba90b5d8737f3e60 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:32:50 +0100 Subject: [PATCH 21/35] consistent naming --- src/{CRunSummary.C => CRunSummary.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{CRunSummary.C => CRunSummary.cpp} (100%) diff --git a/src/CRunSummary.C b/src/CRunSummary.cpp similarity index 100% rename from src/CRunSummary.C rename to src/CRunSummary.cpp From e1b7740db592b2d5b172cdbdb8e643e87200bf63 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:34:38 +0100 Subject: [PATCH 22/35] obsolete code --- inc/CEffFit.h | 183 ------------------------- src/{CEffArea.C => CEffArea.cpp} | 0 src/CEffFit.C | 51 ------- src/{Cshowerpars.C => Cshowerpars.cpp} | 0 src/{Ctpars.C => Ctpars.cpp} | 0 5 files changed, 234 deletions(-) delete mode 100644 inc/CEffFit.h rename src/{CEffArea.C => CEffArea.cpp} (100%) delete mode 100644 src/CEffFit.C rename src/{Cshowerpars.C => Cshowerpars.cpp} (100%) rename src/{Ctpars.C => Ctpars.cpp} (100%) diff --git a/inc/CEffFit.h b/inc/CEffFit.h deleted file mode 100644 index 7610bba0..00000000 --- a/inc/CEffFit.h +++ /dev/null @@ -1,183 +0,0 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Wed May 2 10:23:50 2007 by ROOT version 5.13/06 -// from TTree EffFit/fit results for effective areas -// found on file: EffectiveAreas/effectiveArea_w0.5_ID08_ana12Fit.root -////////////////////////////////////////////////////////// - -#ifndef cEffFit_h -#define cEffFit_h - -#include -#include -#include - -class cEffFit -{ - public : - TTree* fChain; //!pointer to the analyzed TTree or TChain - Int_t fCurrent; //!current Tree number in a TChain - - // Declaration of leave types - Double_t Ze; - Int_t AMC; - TF1* fEff; - TGraphAsymmErrors* gEffAreaLog; - TGraphAsymmErrors* gEffArea; - Double_t Fitxmin; - Double_t Fitxmax; - - // List of branches - TBranch* b_Ze; //! - TBranch* b_AMC; //! - TBranch* b_fEff; //! - TBranch* b_gEffAreaLog; //! - TBranch* b_gEffArea; //! - TBranch* b_Fitxmin; //! - TBranch* b_Fitxmax; //! - - cEffFit( TTree* tree = 0 ); - virtual ~cEffFit(); - virtual Int_t Cut( Long64_t entry ); - virtual Int_t GetEntry( Long64_t entry ); - virtual Long64_t LoadTree( Long64_t entry ); - virtual void Init( TTree* tree ); - virtual void Loop(); - virtual Bool_t Notify(); - virtual void Show( Long64_t entry = -1 ); -}; -#endif - -#ifdef cEffFit_cxx -cEffFit::cEffFit( TTree* tree ) -{ - // if parameter tree is not specified (or zero), connect the file - // used to generate this class and read the Tree. - if( tree == 0 ) - { - TFile* f = ( TFile* )gROOT->GetListOfFiles()->FindObject( "EffectiveAreas/effectiveArea_w0.5_ID08_ana12Fit.root" ); - if(!f ) - { - f = new TFile( "EffectiveAreas/effectiveArea_w0.5_ID08_ana12Fit.root" ); - } - tree = ( TTree* )gDirectory->Get( "EffFit" ); - - } - Init( tree ); -} - - -cEffFit::~cEffFit() -{ - if(!fChain ) - { - return; - } - delete fChain->GetCurrentFile(); -} - - -Int_t cEffFit::GetEntry( Long64_t entry ) -{ - // Read contents of entry. - if(!fChain ) - { - return 0; - } - return fChain->GetEntry( entry ); -} - - -Long64_t cEffFit::LoadTree( Long64_t entry ) -{ - // Set the environment to read one entry - if(!fChain ) - { - return -5; - } - Long64_t centry = fChain->LoadTree( entry ); - if( centry < 0 ) - { - return centry; - } - if(!fChain->InheritsFrom( TChain::Class() ) ) - { - return centry; - } - TChain* chain = ( TChain* )fChain; - if( chain->GetTreeNumber() != fCurrent ) - { - fCurrent = chain->GetTreeNumber(); - Notify(); - } - return centry; -} - - -void cEffFit::Init( TTree* tree ) -{ - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normally not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set object pointer - fEff = 0; - gEffAreaLog = 0; - gEffArea = 0; - // Set branch addresses and branch pointers - if(!tree ) - { - return; - } - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass( 1 ); - - fChain->SetBranchAddress( "Ze", &Ze, &b_Ze ); - fChain->SetBranchAddress( "AMC", &AMC, &b_AMC ); - fChain->SetBranchAddress( "fEff", &fEff, &b_fEff ); - fChain->SetBranchAddress( "gEffAreaLog", &gEffAreaLog, &b_gEffAreaLog ); - fChain->SetBranchAddress( "gEffArea", &gEffArea, &b_gEffArea ); - fChain->SetBranchAddress( "Fitxmin", &Fitxmin, &b_Fitxmin ); - fChain->SetBranchAddress( "Fitxmax", &Fitxmax, &b_Fitxmax ); - Notify(); -} - - -Bool_t cEffFit::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - - -void cEffFit::Show( Long64_t entry ) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if(!fChain ) - { - return; - } - fChain->Show( entry ); -} - - -Int_t cEffFit::Cut( Long64_t entry ) -{ - entry = 1; - // This function may be called from Loop. - // returns 1 if entry is accepted. - // returns -1 otherwise. - return 1; -} -#endif // #ifdef cEffFit_cxx diff --git a/src/CEffArea.C b/src/CEffArea.cpp similarity index 100% rename from src/CEffArea.C rename to src/CEffArea.cpp diff --git a/src/CEffFit.C b/src/CEffFit.C deleted file mode 100644 index e6c233b6..00000000 --- a/src/CEffFit.C +++ /dev/null @@ -1,51 +0,0 @@ -#define cEffFit_cxx -#include "cEffFit.h" -#include -#include -#include - -void cEffFit::Loop() -{ - // In a ROOT session, you can do: - // Root > .L cEffFit.C - // Root > cEffFit t - // Root > t.GetEntry(12); // Fill t data members with entry number 12 - // Root > t.Show(); // Show values of entry 12 - // Root > t.Show(16); // Read and show values of entry 16 - // Root > t.Loop(); // Loop on all entries - // - - // This is the loop skeleton where: - // jentry is the global entry number in the chain - // ientry is the entry number in the current Tree - // Note that the argument to GetEntry must be: - // jentry for TChain::GetEntry - // ientry for TTree::GetEntry and TBranch::GetEntry - // - // To read only selected branches, Insert statements like: - // METHOD1: - // fChain->SetBranchStatus("*",0); // disable all branches - // fChain->SetBranchStatus("branchname",1); // activate branchname - // METHOD2: replace line - // fChain->GetEntry(jentry); //read all branches - //by b_branchname->GetEntry(ientry); //read only this branch - if( fChain == 0 ) - { - return; - } - - Long64_t nentries = fChain->GetEntriesFast(); - - Long64_t nbytes = 0, nb = 0; - for( Long64_t jentry = 0; jentry < nentries; jentry++ ) - { - Long64_t ientry = LoadTree( jentry ); - if( ientry < 0 ) - { - break; - } - nb = fChain->GetEntry( jentry ); - nbytes += nb; - // if (Cut(ientry) < 0) continue; - } -} diff --git a/src/Cshowerpars.C b/src/Cshowerpars.cpp similarity index 100% rename from src/Cshowerpars.C rename to src/Cshowerpars.cpp diff --git a/src/Ctpars.C b/src/Ctpars.cpp similarity index 100% rename from src/Ctpars.C rename to src/Ctpars.cpp From d7a53f59eac9be3b95a24d660aae76d4d4511ab5 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:49:15 +0100 Subject: [PATCH 23/35] tree simplification --- inc/CEffArea.h | 393 +--------------------------------- inc/Cshowerpars.h | 501 +------------------------------------------- inc/Ctpars.h | 498 +------------------------------------------ src/CEffArea.cpp | 359 +++++++++++++++++++++++++++---- src/Cshowerpars.cpp | 494 +++++++++++++++++++++++++++++++++++++++---- src/Ctelconfig.cpp | 1 - src/Ctpars.cpp | 497 +++++++++++++++++++++++++++++++++++++++---- 7 files changed, 1239 insertions(+), 1504 deletions(-) diff --git a/inc/CEffArea.h b/inc/CEffArea.h index 00c6a322..cd928d31 100644 --- a/inc/CEffArea.h +++ b/inc/CEffArea.h @@ -1,9 +1,4 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Thu Apr 10 17:00:24 2008 by ROOT version 5.18/00 -// from TTree fEffArea/effective area values -// found on file: effectiveArea.root -////////////////////////////////////////////////////////// +// Effective area data tree definition. #ifndef CEffArea_h #define CEffArea_h @@ -126,395 +121,9 @@ class CEffArea : public TObject CEffArea( TTree* tree = 0 ); virtual ~CEffArea(); - virtual Int_t Cut( Long64_t entry ); virtual Int_t GetEntry( Long64_t entry ); virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); - virtual void Loop(); - virtual Bool_t Notify(); - virtual void Show( Long64_t entry = -1 ); ClassDef( CEffArea, 3 ); }; #endif - -#ifdef CEffArea_cxx - -ClassImp( CEffArea ) - -CEffArea::CEffArea( TTree* tree ) -{ - // if parameter tree is not specified (or zero), connect the file - // used to generate this class and read the Tree. - if( tree == 0 ) - { - TFile* f = ( TFile* )gROOT->GetListOfFiles()->FindObject( "effectiveArea.root" ); - if(!f ) - { - f = new TFile( "effectiveArea.root" ); - } - tree = ( TTree* )gDirectory->Get( "fEffArea" ); - - } - Init( tree ); -} - - -CEffArea::~CEffArea() -{ - if(!fChain ) - { - return; - } - delete fChain->GetCurrentFile(); -} - - -Int_t CEffArea::GetEntry( Long64_t entry ) -{ - // Read contents of entry. - if(!fChain ) - { - return 0; - } - return fChain->GetEntry( entry ); -} - - -Long64_t CEffArea::LoadTree( Long64_t entry ) -{ - // Set the environment to read one entry - if(!fChain ) - { - return -5; - } - Long64_t centry = fChain->LoadTree( entry ); - if( centry < 0 ) - { - return centry; - } - if(!fChain->InheritsFrom( TChain::Class() ) ) - { - return centry; - } - TChain* chain = ( TChain* )fChain; - if( chain->GetTreeNumber() != fCurrent ) - { - fCurrent = chain->GetTreeNumber(); - Notify(); - } - return centry; -} - - -void CEffArea::Init( TTree* tree ) -{ - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normally not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set object pointer - hEmc = 0; - hEcut = 0; - hEcutUW = 0; - hEcut500 = 0; - hEcutLin = 0; - hEcutRec = 0; - hEcutRecUW = 0; - gEffAreaMC = 0; - gEffAreaRec = 0; - hEmcSWeight = 0; - hEsysRec = 0; - hEsysMC = 0; - hEsysMCRelative = 0; - hEsysMCRelativeRMS = 0; - hEsysMCRelative2D = 0; - hEsys2D = 0; - hEmcCutCTA = 0; - hResponseMatrix = 0; - hResponseMatrixProfile = 0; - hResponseMatrixQC = 0; - hResponseMatrixFineQC = 0; - hhEcutTrigger = 0; - hhEcutFiducialArea = 0; - hhEcutStereoQuality = 0; - hhEcutTelType = 0; - hhEcutDirection = 0; - hhEcutGammaHadron = 0; - hhEcutEnergyReconstruction = 0; - hWeightedRate = 0; - // Set branch addresses and branch pointers - if(!tree ) - { - return; - } - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass( 1 ); - - fChain->SetBranchAddress( "ze", &ze, &b_ze ); - fChain->SetBranchAddress( "az", &az, &b_az ); - fChain->SetBranchAddress( "azMin", &azMin, &b_azMin ); - fChain->SetBranchAddress( "azMax", &azMax, &b_azMax ); - if( fChain->GetBranchStatus( "Xoff" ) ) - { - fChain->SetBranchAddress( "Xoff", &Xoff, &b_Xoff ); - fChain->SetBranchAddress( "Yoff", &Yoff, &b_Yoff ); - } - else - { - Xoff = 0.; - Yoff = 0.; - } - fChain->SetBranchAddress( "Woff", &Woff, &b_Woff ); - fChain->SetBranchAddress( "noise", &noise, &b_noise ); - fChain->SetBranchAddress( "pedvar", &pedvar, &b_pedvar ); - if( fChain->GetBranchStatus( "index" ) ) - { - fChain->SetBranchAddress( "index", &index, &b_index ); - } - else - { - index = 0.; - } - if( fChain->GetBranchStatus( "nbins" ) ) - { - fChain->SetBranchAddress( "nbins", &nbins, &b_nbins ); - fChain->SetBranchAddress( "e0", e0, &b_e0 ); - fChain->SetBranchAddress( "eff", eff, &b_eff ); - } - else - { - nbins = 0; - for( int i = 0; i < 1000; i++ ) - { - e0[i] = 0.; - eff[i] = 0.; - } - } - if( fChain->GetBranchStatus( "seff_L" ) ) - { - fChain->SetBranchAddress( "seff_L", seff_L, &b_seff_L ); - fChain->SetBranchAddress( "seff_U", seff_U, &b_seff_U ); - } - else - { - for( int i = 0; i < 1000; i++ ) - { - seff_L[i] = 0.; - seff_U[i] = 0.; - } - } - if( fChain->GetBranchStatus( "Rec_seff_L" ) ) - { - fChain->SetBranchAddress( "Rec_seff_L", Rec_seff_L, &b_Rec_seff_L ); - fChain->SetBranchAddress( "Rec_seff_U", Rec_seff_U, &b_Rec_seff_U ); - } - else - { - for( int i = 0; i < 1000; i++ ) - { - Rec_seff_L[i] = 0.; - Rec_seff_U[i] = 0.; - } - } - if( fChain->GetBranchStatus( "Rec_nbins" ) ) - { - fChain->SetBranchAddress( "Rec_nbins", &Rec_nbins, &b_Rec_nbins ); - fChain->SetBranchAddress( "Rec_e0", Rec_e0, &b_Rec_e0 ); - fChain->SetBranchAddress( "Rec_eff", Rec_eff, &b_Rec_eff ); - } - else - { - Rec_nbins = 0; - for( int i = 0; i < 1000; i++ ) - { - Rec_e0[i] = 0.; - Rec_eff[i] = 0.; - } - } - if( fChain->GetBranchStatus( "hEmc" ) ) - { - fChain->SetBranchAddress( "hEmc", &hEmc, &b_hEmc ); - } - else - { - hEmc = 0; - } - if( fChain->GetBranchStatus( "hEcut" ) ) - { - fChain->SetBranchAddress( "hEcut", &hEcut, &b_hEcut ); - if( fChain->GetBranchStatus( "hEcutUW" ) ) - { - fChain->SetBranchAddress( "hEcutUW", &hEcutUW, &b_hEcutUW ); - } - else - { - hEcutUW = 0; - } - fChain->SetBranchAddress( "hEcut500", &hEcut500, &b_hEcut500 ); - fChain->SetBranchAddress( "hEcutRec", &hEcutRec, &b_hEcutRec ); - if( fChain->GetBranchStatus( "hEcutRecUW" ) ) - { - fChain->SetBranchAddress( "hEcutRecUW", &hEcutRecUW, &b_hEcutRecUW ); - } - else - { - hEcutRecUW = 0; - } - fChain->SetBranchAddress( "gEffAreaMC", &gEffAreaMC, &b_gEffAreaMC ); - fChain->SetBranchAddress( "gEffAreaRec", &gEffAreaRec, &b_gEffAreaRec ); - fChain->SetBranchAddress( "hEmcSWeight", &hEmcSWeight, &b_hEmcSWeight ); - fChain->SetBranchAddress( "hEsysRec", &hEsysRec, &b_hEsysRec ); - fChain->SetBranchAddress( "hEsysMC", &hEsysMC, &b_hEsysMC ); - fChain->SetBranchAddress( "hEsys2D", &hEsys2D, &b_hEsys2D ); - fChain->SetBranchAddress( "hEmcCutCTA", &hEmcCutCTA, &b_hEmcCutCTA ); - fChain->SetBranchAddress( "hResponseMatrix", &hResponseMatrix, &b_hResponseMatrix ); - if( fChain->GetBranchStatus( "hResponseMatrixQC" ) ) - { - fChain->SetBranchAddress( "hResponseMatrixQC", &hResponseMatrixQC, &b_hResponseMatrixQC ); - } - else - { - hResponseMatrixQC = 0; - } - if( fChain->GetBranchStatus( "hResponseMatrixProfile" ) ) - { - fChain->SetBranchAddress( "hResponseMatrixProfile", &hResponseMatrixProfile, &b_hResponseMatrixProfile ); - } - else - { - hResponseMatrixProfile = 0; - } - if( fChain->GetBranchStatus( "hResponseMatrixFineQC" ) ) - { - fChain->SetBranchAddress( "hResponseMatrixFineQC", &hResponseMatrixFineQC, &b_hResponseMatrixFineQC ); - } - else - { - hResponseMatrixFineQC = 0; - } - } - else - { - hEmc = 0; - hEcut = 0; - hEcutUW = 0; - hEcut500 = 0; - hEcutRec = 0; - hEcutRecUW = 0; - gEffAreaMC = 0; - gEffAreaRec = 0; - hEmcSWeight = 0; - hEsysRec = 0; - hEsysMC = 0; - hEsysMCRelative = 0; - hEsysMCRelativeRMS = 0; - hEsys2D = 0; - hEmcCutCTA = 0; - hResponseMatrix = 0; - hResponseMatrixProfile = 0; - hResponseMatrixQC = 0; - hResponseMatrixFineQC = 0; - } - if( fChain->GetBranchStatus( "hEcutLin" ) ) - { - fChain->SetBranchAddress( "hEcutLin", &hEcutLin, &b_hEcutLin ); - } - else - { - hEcutLin = 0; - } - if( fChain->GetBranchStatus( "hEsysMCRelative" ) ) - { - fChain->SetBranchAddress( "hEsysMCRelative", &hEsysMCRelative, &b_hEsysMCRelative ); - } - else - { - hEsysMCRelative = 0; - } - if( fChain->GetBranchStatus( "hEsysMCRelativeRMS" ) ) - { - fChain->SetBranchAddress( "hEsysMCRelativeRMS", &hEsysMCRelativeRMS, &b_hEsysMCRelativeRMS ); - } - else - { - hEsysMCRelativeRMS = 0; - } - if( fChain->GetBranchStatus( "hEsysMCRelative2D" ) ) - { - fChain->SetBranchAddress( "hEsysMCRelative2D", &hEsysMCRelative2D, &b_hEsysMCRelative2D ); - } - else - { - hEsysMCRelative2D = 0; - } - if( fChain->GetBranchStatus( "hhEcutTrigger" ) ) - { - fChain->SetBranchAddress( "hhEcutTrigger", &hhEcutTrigger, &b_hhEcutTrigger ); - fChain->SetBranchAddress( "hhEcutFiducialArea", &hhEcutFiducialArea, &b_hhEcutFiducialArea ); - fChain->SetBranchAddress( "hhEcutStereoQuality", &hhEcutStereoQuality, &b_hhEcutStereoQuality ); - fChain->SetBranchAddress( "hhEcutTelType", &hhEcutTelType, &b_hhEcutTelType ); - fChain->SetBranchAddress( "hhEcutDirection", &hhEcutDirection, &b_hhEcutDirection ); - fChain->SetBranchAddress( "hhEcutEnergyReconstruction", &hhEcutEnergyReconstruction, &b_hhEcutEnergyReconstruction ); - fChain->SetBranchAddress( "hhEcutGammaHadron", &hhEcutGammaHadron, &b_hhEcutGammaHadron ); - } - else - { - hhEcutTrigger = 0; - hhEcutFiducialArea = 0; - hhEcutStereoQuality = 0; - hhEcutTelType = 0; - hhEcutDirection = 0; - hhEcutGammaHadron = 0; - hhEcutEnergyReconstruction = 0; - } - if( fChain->GetBranchStatus( "hWeightedRate" ) ) - { - fChain->SetBranchAddress( "hWeightedRate", &hWeightedRate, &b_hWeightedRate ); - } - else - { - hWeightedRate = 0; - } - - Notify(); -} - - -Bool_t CEffArea::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - - -void CEffArea::Show( Long64_t entry ) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if(!fChain ) - { - return; - } - fChain->Show( entry ); -} - - -Int_t CEffArea::Cut( Long64_t entry ) -{ - entry = 1; - // This function may be called from Loop. - // returns 1 if entry is accepted. - // returns -1 otherwise. - return 1; -} -#endif // #ifdef CEffArea_cxx diff --git a/inc/Cshowerpars.h b/inc/Cshowerpars.h index 7e9099d2..bef9f87c 100644 --- a/inc/Cshowerpars.h +++ b/inc/Cshowerpars.h @@ -1,20 +1,4 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Thu Feb 8 14:35:23 2007 by ROOT version 5.10/00 -// from TTree showerpars/Shower Parameters -// found on file: output/32855.root -////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////// -// -// Adjusted to mscw_energy -// -// DO NOT OVERWRITE BY DOING SIMPLY A showerpars->MakeClass !!!! -// -// -// -// (GM) -// -//////////////////////////////////////////// +// Showerpars tree definition. #ifndef Cshowerpars_h #define Cshowerpars_h @@ -190,9 +174,7 @@ class Cshowerpars virtual Int_t GetEntry( Long64_t entry ); virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); - virtual void Loop(); virtual Bool_t Notify(); - virtual void Show( Long64_t entry = -1 ); bool isMC() { return bMC; @@ -203,484 +185,3 @@ class Cshowerpars } }; #endif - -#ifdef Cshowerpars_cxx - -Cshowerpars::Cshowerpars( TTree* tree, bool iMC, bool iShort ) -{ - if(!tree ) - { - return; - } - - bMC = iMC; - bDeRot = false; - bShort = iShort; - - Init( tree ); -} - - -Cshowerpars::~Cshowerpars() -{ - if(!fChain ) - { - return; - } - delete fChain->GetCurrentFile(); -} - - -Int_t Cshowerpars::GetEntry( Long64_t entry ) -{ - // Read contents of entry. - if(!fChain ) - { - return 0; - } - - return fChain->GetEntry( entry ); -} - - -Long64_t Cshowerpars::LoadTree( Long64_t entry ) -{ - // Set the environment to read one entry - if(!fChain ) - { - return -5; - } - Long64_t centry = fChain->LoadTree( entry ); - if( centry < 0 ) - { - return centry; - } - if( fChain->IsA() != TChain::Class() ) - { - return centry; - } - TChain* chain = ( TChain* )fChain; - if( chain->GetTreeNumber() != fCurrent ) - { - fCurrent = chain->GetTreeNumber(); - Notify(); - } - return centry; -} - - -void Cshowerpars::Init( TTree* tree ) -{ - - // Set branch addresses - if( tree == 0 ) - { - return; - } - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass( 1 ); - - if( tree->GetBranchStatus( "MCe0" ) ) - { - bMC = true; - } - if( tree->GetBranchStatus( "XoffDeRot" ) ) - { - bDeRot = true; - } - - fChain->SetBranchAddress( "runNumber", &runNumber ); - fChain->SetBranchAddress( "eventNumber", &eventNumber ); - if( fChain->GetBranchStatus( "eventStatus" ) ) - { - fChain->SetBranchAddress( "eventStatus", &eventStatus ); - } - else - { - eventStatus = 0; - } - fChain->SetBranchAddress( "MJD", &MJD ); - fChain->SetBranchAddress( "Time", &Time ); - if(!bShort ) - { - fChain->SetBranchAddress( "dataFormat", &dataFormat ); - } - else - { - dataFormat = 0; - } - fChain->SetBranchAddress( "NTel", &NTel ); - if(!bShort ) - { - fChain->SetBranchAddress( "traceFit", &traceFit ); - } - else - { - traceFit = 0; - } - fChain->SetBranchAddress( "TelElevation", TelElevation ); - fChain->SetBranchAddress( "TelAzimuth", TelAzimuth ); - - if(!bMC ) - { - fChain->SetBranchAddress( "TelDec", TelDec ); - fChain->SetBranchAddress( "TelRA", TelRA ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - TelDec[i] = 0.; - TelRA[i] = 0; - } - } - - if(!bMC && !bShort ) - { - fChain->SetBranchAddress( "TelElevationVBF", TelElevationVBF ); - fChain->SetBranchAddress( "TelAzimuthVBF", TelAzimuthVBF ); - fChain->SetBranchAddress( "TelPointingMismatch", TelPointingMismatch ); - fChain->SetBranchAddress( "Tel_x_SC", Tel_x_SC ); - fChain->SetBranchAddress( "Tel_y_SC", Tel_y_SC ); - fChain->SetBranchAddress( "Tel_z_SC", Tel_z_SC ); - fChain->SetBranchAddress( "TargetElev", &TargetElev ); - fChain->SetBranchAddress( "TargetAzim", &TargetAzim ); - fChain->SetBranchAddress( "TargetDec", &TargetDec ); - fChain->SetBranchAddress( "TargetRA", &TargetRA ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - TelElevationVBF[i] = 0.; - TelAzimuthVBF[i] = 0.; - TelPointingMismatch[i] = 0.; - Tel_x_SC[i] = 0.; - Tel_y_SC[i] = 0.; - Tel_z_SC[i] = 0.; - } - TargetElev = 0.; - TargetAzim = 0.; - TargetDec = 0.; - TargetRA = 0; - } - fChain->SetBranchAddress( "WobbleN", &WobbleN ); - fChain->SetBranchAddress( "WobbleE", &WobbleE ); - fChain->SetBranchAddress( "NTrig", &NTrig ); - fChain->SetBranchAddress( "LTrig", <rig ); - fChain->SetBranchAddress( "Trig_list", Trig_list, &b_Trig_list ); - if( fChain->GetBranchStatus( "Trig_type" ) ) - { - fChain->SetBranchAddress( "Trig_type", Trig_type, &b_Trig_type ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) - { - Trig_type[i] = 0; - } - } - fChain->SetBranchAddress( "NMethods", &NMethods ); - if(!bShort ) - { - fChain->SetBranchAddress( "MethodID", MethodID ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) - { - MethodID[i] = 0; - } - } - - fChain->SetBranchAddress( "NImages", NImages ); - fChain->SetBranchAddress( "img2_ang", img2_ang ); - fChain->SetBranchAddress( "ImgSel", ImgSel ); - fChain->SetBranchAddress( "ImgSel_list", ImgSel_list, &b_ImgSel_list ); - fChain->SetBranchAddress( "Ze", Ze ); - fChain->SetBranchAddress( "Az", Az ); - fChain->SetBranchAddress( "Xoff", Xoff ); - fChain->SetBranchAddress( "Yoff", Yoff ); - if( bDeRot ) - { - fChain->SetBranchAddress( "XoffDeRot", XoffDeRot ); - fChain->SetBranchAddress( "YoffDeRot", YoffDeRot ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) - { - XoffDeRot[i] = 0.; - YoffDeRot[i] = 0.; - } - } - if(!bShort ) - { - fChain->SetBranchAddress( "stds", stds ); - if( fChain->GetBranchStatus( "dec" ) ) - { - fChain->SetBranchAddress( "dec", dec ); - fChain->SetBranchAddress( "ra", ra ); - } - } - else - { - for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) - { - stds[i] = 0.; - dec[i] = 0.; - ra[i] = 0.; - } - } - fChain->SetBranchAddress( "Xcore", Xcore ); - fChain->SetBranchAddress( "Ycore", Ycore ); - if(!bShort ) - { - fChain->SetBranchAddress( "Xcore_SC", Xcore_SC ); - fChain->SetBranchAddress( "Ycore_SC", Ycore_SC ); - fChain->SetBranchAddress( "stdp", stdp ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) - { - Xcore_SC[i] = 0.; - Ycore_SC[i] = 0.; - stdp[i] = 0.; - } - } - fChain->SetBranchAddress( "Chi2", Chi2 ); - if( fChain->GetBranchStatus( "DispDiff" ) ) - { - fChain->SetBranchAddress( "DispDiff", DispDiff ); - } - else - { - for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) - { - DispDiff[i] = 0.; - } - } - if( bMC ) - { - fChain->SetBranchAddress( "MCprim", &MCprim ); - fChain->SetBranchAddress( "MCe0", &MCe0 ); - fChain->SetBranchAddress( "MCxcore", &MCxcore ); - fChain->SetBranchAddress( "MCycore", &MCycore ); - if(!bShort ) - { - fChain->SetBranchAddress( "MCxcos", &MCxcos ); - fChain->SetBranchAddress( "MCycos", &MCycos ); - } - else - { - MCxcos = 0.; - MCycos = 0.; - } - fChain->SetBranchAddress( "MCze", &MCze ); - fChain->SetBranchAddress( "MCaz", &MCaz ); - fChain->SetBranchAddress( "MCxoff", &MCxoff ); - fChain->SetBranchAddress( "MCyoff", &MCyoff ); - if(!bShort ) - { - fChain->SetBranchAddress( "MCxcore_SC", &MCxcore_SC ); - fChain->SetBranchAddress( "MCycore_SC", &MCycore_SC ); - fChain->SetBranchAddress( "MCzcore_SC", &MCzcore_SC ); - } - else - { - MCxcore_SC = 0.; - MCycore_SC = 0.; - MCzcore_SC = 0.; - } - } - Notify(); -} - - -Bool_t Cshowerpars::Notify() -{ - b_runNumber = fChain->GetBranch( "runNumber" ); - b_eventNumber = fChain->GetBranch( "eventNumber" ); - b_MJD = fChain->GetBranch( "MJD" ); - b_Time = fChain->GetBranch( "Time" ); - if(!bShort ) - { - b_dataFormat = fChain->GetBranch( "dataFormat" ); - } - else - { - b_dataFormat = 0; - } - b_NTel = fChain->GetBranch( "NTel" ); - b_traceFit = fChain->GetBranch( "traceFit" ); - b_TelElevation = fChain->GetBranch( "TelElevation" ); - b_TelAzimuth = fChain->GetBranch( "TelAzimuth" ); - if(!bMC ) - { - b_TelDec = fChain->GetBranch( "TelDec" ); - b_TelRA = fChain->GetBranch( "TelRA" ); - } - else - { - b_TelDec = 0; - b_TelRA = 0; - } - if(!bShort ) - { - b_TelElevationVBF = fChain->GetBranch( "TelElevationVBF" ); - b_TelAzimuthVBF = fChain->GetBranch( "TelAzimuthVBF" ); - b_TelPointingMismatch = fChain->GetBranch( "TelPointingMismatch" ); - b_Tel_x_SC = fChain->GetBranch( "Tel_x_SC" ); - b_Tel_y_SC = fChain->GetBranch( "Tel_y_SC" ); - b_Tel_z_SC = fChain->GetBranch( "Tel_z_SC" ); - b_TargetElev = fChain->GetBranch( "TargetElev" ); - b_TargetAzim = fChain->GetBranch( "TargetAzim" ); - b_TargetDec = fChain->GetBranch( "TargetDec" ); - b_TargetRA = fChain->GetBranch( "TargetRA" ); - } - else - { - b_TelElevationVBF = 0; - b_TelAzimuthVBF = 0; - b_TelPointingMismatch = 0; - b_Tel_x_SC = 0; - b_Tel_y_SC = 0; - b_Tel_z_SC = 0; - b_TargetElev = 0; - b_TargetAzim = 0; - b_TargetDec = 0; - b_TargetRA = 0; - } - b_WobbleN = fChain->GetBranch( "WobbleN" ); - b_WobbleE = fChain->GetBranch( "WobbleE" ); - b_NTrig = fChain->GetBranch( "NTrig" ); - b_LTrig = fChain->GetBranch( "LTrig" ); - b_NMethods = fChain->GetBranch( "NMethods" ); - if(!bShort ) - { - b_MethodID = fChain->GetBranch( "MethodID" ); - } - else - { - b_MethodID = 0; - } - b_NImages = fChain->GetBranch( "NImages" ); - b_ImgSel = fChain->GetBranch( "ImgSel" ); - b_ImgSel_list = fChain->GetBranch( "ImgSel_list" ); - if(!bShort ) - { - b_img2_ang = fChain->GetBranch( "img2_ang" ); - } - else - { - b_img2_ang = 0; - } - b_Ze = fChain->GetBranch( "Ze" ); - b_Az = fChain->GetBranch( "Az" ); - b_Xoff = fChain->GetBranch( "Xoff" ); - b_Yoff = fChain->GetBranch( "Yoff" ); - if( bDeRot ) - { - b_XoffDeRot = fChain->GetBranch( "XoffDeRot" ); - b_YoffDeRot = fChain->GetBranch( "YoffDeRot" ); - } - else - { - b_XoffDeRot = 0; - b_YoffDeRot = 0; - } - if(!bShort ) - { - b_stds = fChain->GetBranch( "stds" ); - } - if( fChain->GetBranchStatus( "dec" ) ) - { - b_dec = fChain->GetBranch( "dec" ); - } - if( fChain->GetBranchStatus( "ra" ) ) - { - b_ra = fChain->GetBranch( "ra" ); - } - else - { - b_stds = 0; - b_dec = 0; - b_ra = 0; - } - b_Xcore = fChain->GetBranch( "Xcore" ); - b_Ycore = fChain->GetBranch( "Ycore" ); - if(!bShort ) - { - b_Xcore_SC = fChain->GetBranch( "Xcore_SC" ); - b_Ycore_SC = fChain->GetBranch( "Ycore_SC" ); - b_stdp = fChain->GetBranch( "stdp" ); - } - else - { - b_Xcore_SC = 0; - b_Ycore_SC = 0; - b_stdp = 0; - } - - b_Chi2 = fChain->GetBranch( "Chi2" ); - b_DispDiff = fChain->GetBranch( "DispDiff" ); - if( bMC ) - { - if(!bShort ) - { - b_MCprim = fChain->GetBranch( "MCprim" ); - } - else - { - b_MCprim = 0; - } - b_MCe0 = fChain->GetBranch( "MCe0" ); - b_MCxcore = fChain->GetBranch( "MCxcore" ); - b_MCycore = fChain->GetBranch( "MCycore" ); - if(!bShort ) - { - b_MCxcos = fChain->GetBranch( "MCxcos" ); - b_MCycos = fChain->GetBranch( "MCycos" ); - } - else - { - b_MCxcos = 0; - b_MCycos = 0; - } - b_MCze = fChain->GetBranch( "MCze" ); - b_MCaz = fChain->GetBranch( "MCaz" ); - b_MCxoff = fChain->GetBranch( "MCxoff" ); - b_MCyoff = fChain->GetBranch( "MCyoff" ); - if(!bShort ) - { - b_MCxcore_SC = fChain->GetBranch( "MCycore_SC" ); - b_MCycore_SC = fChain->GetBranch( "MCycore_SC" ); - b_MCycore_SC = fChain->GetBranch( "MCycore_SC" ); - } - else - { - b_MCxcore_SC = 0; - b_MCycore_SC = 0; - b_MCycore_SC = 0; - } - } - - return kTRUE; -} - - -void Cshowerpars::Show( Long64_t entry ) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if(!fChain ) - { - return; - } - fChain->Show( entry ); -} - - -#endif // #ifdef Cshowerpars_cxx diff --git a/inc/Ctpars.h b/inc/Ctpars.h index 5f2c6030..27d7f55d 100644 --- a/inc/Ctpars.h +++ b/inc/Ctpars.h @@ -1,10 +1,4 @@ -////////////////////////////////////////////////////////// -// -// adjusted to mscw_energy -// -// DO NOT OVERWRITE !!!! -// -/////////////////////////////////////////// +// Image parameter tpars definition #ifndef Ctpars_h #define Ctpars_h @@ -175,9 +169,7 @@ class Ctpars virtual Int_t GetEntry( Long64_t entry ); virtual Long64_t LoadTree( Long64_t entry ); virtual void Init( TTree* tree ); - virtual void Loop(); virtual Bool_t Notify(); - virtual void Show( Long64_t entry = -1 ); bool has_sdevxy() { return bsdevxy; @@ -192,491 +184,3 @@ class Ctpars } }; #endif - -#ifdef Ctpars_cxx - -/* - - optimization of tree reading: - - bShort = 0: read all branches - bShort = 1: read limited number of branches needed for lookup table analysis - bShort = 2: read limited number of branched needed for lookup table filling - -*/ -Ctpars::Ctpars( TTree* tree, bool iMC, unsigned int iShort ) -{ - if(!tree ) - { - return; - } - bMC = iMC; - bShort = iShort; - // forward I/O - // is supposed to speed up reading significantly - // problem: large memory consumption (>12 GB for certain cta arrays) - // tree->SetCacheSize(10000000); - bsdevxy = false; - - Init( tree ); -} - - -Ctpars::~Ctpars() -{ - if(!fChain ) - { - return; - } - delete fChain->GetCurrentFile(); -} - - -Int_t Ctpars::GetEntry( Long64_t entry ) -{ - // Read contents of entry. - if(!fChain ) - { - return 0; - } - return fChain->GetEntry( entry ); -} - - -Long64_t Ctpars::LoadTree( Long64_t entry ) -{ - // Set the environment to read one entry - if(!fChain ) - { - return -5; - } - Long64_t centry = fChain->LoadTree( entry ); - if( centry < 0 ) - { - return centry; - } - if( fChain->IsA() != TChain::Class() ) - { - return centry; - } - TChain* chain = ( TChain* )fChain; - if( chain->GetTreeNumber() != fCurrent ) - { - fCurrent = chain->GetTreeNumber(); - Notify(); - } - return centry; -} - - -void Ctpars::Init( TTree* tree ) -{ - - // Set branch addresses - if( tree == 0 ) - { - return; - } - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass( 1 ); - ///////////////////////////////////////////////// - // bShort = 2: read limited number of branched needed for lookup table filling - if( bShort <= 2 ) - { - if( fChain->GetBranchStatus( "meanPedvar_Image" ) ) - { - fChain->SetBranchAddress( "meanPedvar_Image", &meanPedvar_Image ); - } - else - { - meanPedvar_Image = 0; - } - fChain->SetBranchAddress( "ntubes", &ntubes ); - fChain->SetBranchAddress( "length", &length ); - fChain->SetBranchAddress( "width", &width ); - fChain->SetBranchAddress( "size", &size ); - fChain->SetBranchAddress( "cen_x", &cen_x ); - fChain->SetBranchAddress( "cen_y", &cen_y ); - fChain->SetBranchAddress( "loss", &loss ); - fChain->SetBranchAddress( "cosphi", &cosphi ); - fChain->SetBranchAddress( "sinphi", &sinphi ); - if( fChain->GetBranchStatus( "fui" ) ) - { - fChain->SetBranchAddress( "fui", &fui ); - } - else - { - fui = 0.; - } - } - // bShort = 1: read limited number of branches needed for lookup table analysis - if( bShort <= 1 ) - { - if( fChain->GetBranchStatus( "eventNumber" ) ) - { - fChain->SetBranchAddress( "eventNumber", &eventNumber ); - } - else - { - eventNumber = 0; - } - if( fChain->GetBranchStatus( "meanPed_Image" ) ) - { - fChain->SetBranchAddress( "meanPed_Image", &meanPed_Image ); - } - else - { - meanPed_Image = 0; - } - if( fChain->GetBranchStatus( "f_d" ) ) - { - fChain->SetBranchAddress( "f_d", &f_d ); - bsdevxy = true; - } - else - { - f_d = 0.; - } - if( fChain->GetBranchStatus( "f_s" ) ) - { - fChain->SetBranchAddress( "f_s", &f_s ); - } - else - { - f_s = 0.; - } - if( fChain->GetBranchStatus( "f_sdevxy" ) ) - { - fChain->SetBranchAddress( "f_sdevxy", &f_sdevxy ); - } - else - { - f_sdevxy = 0.; - } - - if( fChain->GetBranchStatus( "fracLow" ) ) - { - - fChain->SetBranchAddress( "fracLow", &fracLow ); - } - else - { - fracLow = 0.; - } - fChain->SetBranchAddress( "dist", &dist ); - if( fChain->GetBranchStatus( "ntubesBNI" ) ) - { - fChain->SetBranchAddress( "ntubesBNI", &ntubesBNI ); - } - else - { - ntubesBNI = 0; - } - fChain->SetBranchAddress( "nsat", &nsat ); - if( fChain->GetBranchStatus( "nlowgain" ) ) - { - fChain->SetBranchAddress( "nlowgain", &nlowgain ); - } - else - { - nlowgain = 0; - } - fChain->SetBranchAddress( "asymmetry", &asymmetry ); - fChain->SetBranchAddress( "tgrad_x", &tgrad_x ); - fChain->SetBranchAddress( "Fitstat", &Fitstat ); - // reset variables which are not read out - alpha = 0.; - los = 0.; - phi = 0.; - max[0] = 0.; - max[1] = 0.; - max[2] = 0.; - index_of_max[0] = 0; - index_of_max[1] = 0; - index_of_max[2] = 0; - tchisq_x = 0.; - - //muon analysis// - if( fChain->GetBranchStatus( "muonX0" ) ) - { - fChain->SetBranchAddress( "muonX0", &muonX0 ); - } - else - { - muonX0 = 0; - } - if( fChain->GetBranchStatus( "muonY0" ) ) - { - fChain->SetBranchAddress( "muonY0", &muonY0 ); - } - else - { - muonY0 = 0; - } - if( fChain->GetBranchStatus( "muonRadius" ) ) - { - fChain->SetBranchAddress( "muonRadius", &muonRadius ); - } - else - { - muonRadius = 0; - } - if( fChain->GetBranchStatus( "muonRSigma" ) ) - { - fChain->SetBranchAddress( "muonRSigma", &muonRSigma ); - } - else - { - muonRSigma = 0; - } - if( fChain->GetBranchStatus( "muonSize" ) ) - { - fChain->SetBranchAddress( "muonSize", &muonSize ); - } - else - { - muonSize = 0; - } - if( fChain->GetBranchStatus( "muonSize" ) ) - { - fChain->SetBranchAddress( "muonSize", &muonSize ); - } - else - { - muonSize = 0; - } - if( fChain->GetBranchStatus( "muonIPCorrectedSize" ) ) - { - fChain->SetBranchAddress( "muonIPCorrectedSize", &muonIPCorrectedSize ); - } - else - { - muonIPCorrectedSize = 0; - } - if( fChain->GetBranchStatus( "muonValid" ) ) - { - fChain->SetBranchAddress( "muonValid", &muonValid ); - } - else - { - muonValid = 0; - } - if( fChain->GetBranchStatus( "houghMuonValid" ) ) - { - fChain->SetBranchAddress( "houghMuonValid", &houghMuonValid ); - } - else - { - houghMuonValid = 0; - } - - } - // bShort == 0: read all branches - if( bShort == 0 ) - { - fChain->SetBranchAddress( "alpha", &alpha ); - fChain->SetBranchAddress( "los", &los ); - fChain->SetBranchAddress( "phi", &phi ); - fChain->SetBranchAddress( "max", max ); - fChain->SetBranchAddress( "index_of_max", index_of_max ); - fChain->SetBranchAddress( "tchisq_x", &tchisq_x ); - } - Notify(); -} - -/* - Get branch pointers -*/ -Bool_t Ctpars::Notify() -{ - - b_eventNumber = 0; - b_meanPed_Image = 0; - b_meanPedvar_Image = 0; - b_length = 0; - b_width = 0; - b_size = 0; - b_cen_x = 0; - b_cen_y = 0; - b_f_s = 0; - b_f_d = 0; - b_f_sdevxy = 0; - b_loss = 0; - b_fracLow = 0; - b_alpha = 0; - b_los = 0; - b_phi = 0; - b_cosphi = 0; - b_sinphi = 0; - b_ntubesBNI = 0; - b_nlowgain = 0; - b_fui = 0; - b_max = 0; - b_index_of_max = 0; - b_tchisq_x = 0; - b_Fitstat = 0; - b_muonX0 = 0; - b_muonY0 = 0; - b_muonRadius = 0; - b_muonRSigma = 0; - b_muonSize = 0; - b_muonIPCorrectedSize = 0; - b_muonValid = 0; - b_houghMuonValid = 0; - - // get branch pointers - if( bShort <= 2 ) - { - if( fChain->GetBranchStatus( "meanPedvar_Image" ) ) - { - b_meanPedvar_Image = fChain->GetBranch( "meanPedvar_Image" ); - fChain->AddBranchToCache( b_meanPedvar_Image ); - } - else - { - b_meanPedvar_Image = 0; - } - b_ntubes = fChain->GetBranch( "ntubes" ); - fChain->AddBranchToCache( b_ntubes ); - b_length = fChain->GetBranch( "length" ); - fChain->AddBranchToCache( b_length ); - b_width = fChain->GetBranch( "width" ); - fChain->AddBranchToCache( b_width ); - b_size = fChain->GetBranch( "size" ); - fChain->AddBranchToCache( b_size ); - b_cen_x = fChain->GetBranch( "cen_x" ); - fChain->AddBranchToCache( b_cen_x ); - b_cen_y = fChain->GetBranch( "cen_y" ); - fChain->AddBranchToCache( b_cen_y ); - b_cosphi = fChain->GetBranch( "cosphi" ); - b_sinphi = fChain->GetBranch( "sinphi" ); - if( fChain->GetBranchStatus( "fui" ) ) - { - b_fui = fChain->GetBranch( "fui" ); - } - } - if( bShort <= 1 ) - { - if( fChain->GetBranchStatus( "eventNumber" ) ) - { - b_eventNumber = fChain->GetBranch( "eventNumber" ); - } - if( fChain->GetBranchStatus( "meanPed_Image" ) ) - { - b_meanPed_Image = fChain->GetBranch( "meanPed_Image" ); - } - else - { - b_meanPed_Image = 0; - } - if( fChain->GetBranchStatus( "f_d" ) ) - { - b_f_d = fChain->GetBranch( "f_d" ); - fChain->AddBranchToCache( b_f_d ); - } - if( fChain->GetBranchStatus( "f_s" ) ) - { - b_f_s = fChain->GetBranch( "f_s" ); - fChain->AddBranchToCache( b_f_s ); - } - if( fChain->GetBranchStatus( "f_sdevxy" ) ) - { - b_f_sdevxy = fChain->GetBranch( "f_sdevxy" ); - fChain->AddBranchToCache( b_f_sdevxy ); - } - b_loss = fChain->GetBranch( "loss" ); - fChain->AddBranchToCache( b_loss ); - if( fChain->GetBranchStatus( "fracLow" ) ) - { - b_fracLow = fChain->GetBranch( "fracLow" ); - fChain->AddBranchToCache( b_fracLow ); - } - b_dist = fChain->GetBranch( "dist" ); - fChain->AddBranchToCache( b_dist ); - if( fChain->GetBranchStatus( "ntubesBNI" ) ) - { - b_ntubesBNI = fChain->GetBranch( "ntubesBNI" ); - } - b_nsat = fChain->GetBranch( "nsat" ); - fChain->AddBranchToCache( b_nsat ); - if( fChain->GetBranchStatus( "nlowgain" ) ) - { - b_nlowgain = fChain->GetBranch( "nlowgain" ); - fChain->AddBranchToCache( b_nlowgain ); - } - b_asymmetry = fChain->GetBranch( "asymmetry" ); - fChain->AddBranchToCache( b_asymmetry ); - b_tgrad_x = fChain->GetBranch( "tgrad_x" ); - fChain->AddBranchToCache( b_tgrad_x ); - b_Fitstat = fChain->GetBranch( "Fitstat" ); - fChain->AddBranchToCache( b_Fitstat ); - //muon - if( fChain->GetBranchStatus( "muonX0" ) ) - { - b_muonX0 = fChain->GetBranch( "muonX0" ); - fChain->AddBranchToCache( b_muonX0 ); - } - if( fChain->GetBranchStatus( "muonY0" ) ) - { - b_muonY0 = fChain->GetBranch( "muonY0" ); - fChain->AddBranchToCache( b_muonY0 ); - } - if( fChain->GetBranchStatus( "muonRadius" ) ) - { - b_muonRadius = fChain->GetBranch( "muonRadius" ); - fChain->AddBranchToCache( b_muonRadius ); - } - if( fChain->GetBranchStatus( "muonRSigma" ) ) - { - b_muonRSigma = fChain->GetBranch( "muonRSigma" ); - fChain->AddBranchToCache( b_muonRSigma ); - } - if( fChain->GetBranchStatus( "muonSize" ) ) - { - b_muonSize = fChain->GetBranch( "muonSize" ); - fChain->AddBranchToCache( b_muonSize ); - } - if( fChain->GetBranchStatus( "muonIPCorrectedSize" ) ) - { - b_muonIPCorrectedSize = fChain->GetBranch( "muonIPCorrectedSize" ); - fChain->AddBranchToCache( b_muonIPCorrectedSize ); - } - if( fChain->GetBranchStatus( "muonValid" ) ) - { - b_muonValid = fChain->GetBranch( "muonValid" ); - fChain->AddBranchToCache( b_muonValid ); - } - if( fChain->GetBranchStatus( "houghMuonValid" ) ) - { - b_houghMuonValid = fChain->GetBranch( "houghMuonValid" ); - fChain->AddBranchToCache( b_houghMuonValid ); - } - } - if( bShort == 0 ) - { - b_alpha = fChain->GetBranch( "alpha" ); - b_los = fChain->GetBranch( "los" ); - b_phi = fChain->GetBranch( "phi" ); - b_max = fChain->GetBranch( "max" ); - b_index_of_max = fChain->GetBranch( "index_of_max" ); - b_tchisq_x = fChain->GetBranch( "tchisq_x" ); - } - - return kTRUE; -} - - -void Ctpars::Show( Long64_t entry ) -{ - // Print contents of entry. - // If entry is not specified, print current entry - if(!fChain ) - { - return; - } - fChain->Show( entry ); -} - - -#endif // #ifdef Ctpars_cxx diff --git a/src/CEffArea.cpp b/src/CEffArea.cpp index 67d5e4cd..a5c492b8 100644 --- a/src/CEffArea.cpp +++ b/src/CEffArea.cpp @@ -1,51 +1,334 @@ -#define CEffArea_cxx +// Effective area data tree definition. + #include "CEffArea.h" -#include -#include -#include -void CEffArea::Loop() +CEffArea::CEffArea( TTree* tree ) { - // In a ROOT session, you can do: - // Root > .L CEffArea.C - // Root > CEffArea t - // Root > t.GetEntry(12); // Fill t data members with entry number 12 - // Root > t.Show(); // Show values of entry 12 - // Root > t.Show(16); // Read and show values of entry 16 - // Root > t.Loop(); // Loop on all entries - // - - // This is the loop skeleton where: - // jentry is the global entry number in the chain - // ientry is the entry number in the current Tree - // Note that the argument to GetEntry must be: - // jentry for TChain::GetEntry - // ientry for TTree::GetEntry and TBranch::GetEntry - // - // To read only selected branches, Insert statements like: - // METHOD1: - // fChain->SetBranchStatus("*",0); // disable all branches - // fChain->SetBranchStatus("branchname",1); // activate branchname - // METHOD2: replace line - // fChain->GetEntry(jentry); //read all branches - //by b_branchname->GetEntry(ientry); //read only this branch - if( fChain == 0 ) + // if parameter tree is not specified (or zero), connect the file + // used to generate this class and read the Tree. + if( tree == 0 ) + { + TFile* f = ( TFile* )gROOT->GetListOfFiles()->FindObject( "effectiveArea.root" ); + if(!f ) + { + f = new TFile( "effectiveArea.root" ); + } + tree = ( TTree* )gDirectory->Get( "fEffArea" ); + + } + Init( tree ); +} + + +CEffArea::~CEffArea() +{ + if(!fChain ) { return; } + delete fChain->GetCurrentFile(); +} + + +Int_t CEffArea::GetEntry( Long64_t entry ) +{ + // Read contents of entry. + if(!fChain ) + { + return 0; + } + return fChain->GetEntry( entry ); +} + + +Long64_t CEffArea::LoadTree( Long64_t entry ) +{ + // Set the environment to read one entry + if(!fChain ) + { + return -5; + } + Long64_t centry = fChain->LoadTree( entry ); + if( centry < 0 ) + { + return centry; + } + if(!fChain->InheritsFrom( TChain::Class() ) ) + { + return centry; + } + TChain* chain = ( TChain* )fChain; + if( chain->GetTreeNumber() != fCurrent ) + { + fCurrent = chain->GetTreeNumber(); + } + return centry; +} - Long64_t nentries = fChain->GetEntriesFast(); - Long64_t nbytes = 0, nb = 0; - for( Long64_t jentry = 0; jentry < nentries; jentry++ ) +void CEffArea::Init( TTree* tree ) +{ + hEmc = 0; + hEcut = 0; + hEcutUW = 0; + hEcut500 = 0; + hEcutLin = 0; + hEcutRec = 0; + hEcutRecUW = 0; + gEffAreaMC = 0; + gEffAreaRec = 0; + hEmcSWeight = 0; + hEsysRec = 0; + hEsysMC = 0; + hEsysMCRelative = 0; + hEsysMCRelativeRMS = 0; + hEsysMCRelative2D = 0; + hEsys2D = 0; + hEmcCutCTA = 0; + hResponseMatrix = 0; + hResponseMatrixProfile = 0; + hResponseMatrixQC = 0; + hResponseMatrixFineQC = 0; + hhEcutTrigger = 0; + hhEcutFiducialArea = 0; + hhEcutStereoQuality = 0; + hhEcutTelType = 0; + hhEcutDirection = 0; + hhEcutGammaHadron = 0; + hhEcutEnergyReconstruction = 0; + hWeightedRate = 0; + // Set branch addresses and branch pointers + if(!tree ) + { + return; + } + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass( 1 ); + + fChain->SetBranchAddress( "ze", &ze, &b_ze ); + fChain->SetBranchAddress( "az", &az, &b_az ); + fChain->SetBranchAddress( "azMin", &azMin, &b_azMin ); + fChain->SetBranchAddress( "azMax", &azMax, &b_azMax ); + if( fChain->GetBranchStatus( "Xoff" ) ) + { + fChain->SetBranchAddress( "Xoff", &Xoff, &b_Xoff ); + fChain->SetBranchAddress( "Yoff", &Yoff, &b_Yoff ); + } + else + { + Xoff = 0.; + Yoff = 0.; + } + fChain->SetBranchAddress( "Woff", &Woff, &b_Woff ); + fChain->SetBranchAddress( "noise", &noise, &b_noise ); + fChain->SetBranchAddress( "pedvar", &pedvar, &b_pedvar ); + if( fChain->GetBranchStatus( "index" ) ) + { + fChain->SetBranchAddress( "index", &index, &b_index ); + } + else + { + index = 0.; + } + if( fChain->GetBranchStatus( "nbins" ) ) + { + fChain->SetBranchAddress( "nbins", &nbins, &b_nbins ); + fChain->SetBranchAddress( "e0", e0, &b_e0 ); + fChain->SetBranchAddress( "eff", eff, &b_eff ); + } + else + { + nbins = 0; + for( int i = 0; i < 1000; i++ ) + { + e0[i] = 0.; + eff[i] = 0.; + } + } + if( fChain->GetBranchStatus( "seff_L" ) ) + { + fChain->SetBranchAddress( "seff_L", seff_L, &b_seff_L ); + fChain->SetBranchAddress( "seff_U", seff_U, &b_seff_U ); + } + else + { + for( int i = 0; i < 1000; i++ ) + { + seff_L[i] = 0.; + seff_U[i] = 0.; + } + } + if( fChain->GetBranchStatus( "Rec_seff_L" ) ) + { + fChain->SetBranchAddress( "Rec_seff_L", Rec_seff_L, &b_Rec_seff_L ); + fChain->SetBranchAddress( "Rec_seff_U", Rec_seff_U, &b_Rec_seff_U ); + } + else + { + for( int i = 0; i < 1000; i++ ) + { + Rec_seff_L[i] = 0.; + Rec_seff_U[i] = 0.; + } + } + if( fChain->GetBranchStatus( "Rec_nbins" ) ) + { + fChain->SetBranchAddress( "Rec_nbins", &Rec_nbins, &b_Rec_nbins ); + fChain->SetBranchAddress( "Rec_e0", Rec_e0, &b_Rec_e0 ); + fChain->SetBranchAddress( "Rec_eff", Rec_eff, &b_Rec_eff ); + } + else { - Long64_t ientry = LoadTree( jentry ); - if( ientry < 0 ) + Rec_nbins = 0; + for( int i = 0; i < 1000; i++ ) + { + Rec_e0[i] = 0.; + Rec_eff[i] = 0.; + } + } + if( fChain->GetBranchStatus( "hEmc" ) ) + { + fChain->SetBranchAddress( "hEmc", &hEmc, &b_hEmc ); + } + else + { + hEmc = 0; + } + if( fChain->GetBranchStatus( "hEcut" ) ) + { + fChain->SetBranchAddress( "hEcut", &hEcut, &b_hEcut ); + if( fChain->GetBranchStatus( "hEcutUW" ) ) + { + fChain->SetBranchAddress( "hEcutUW", &hEcutUW, &b_hEcutUW ); + } + else + { + hEcutUW = 0; + } + fChain->SetBranchAddress( "hEcut500", &hEcut500, &b_hEcut500 ); + fChain->SetBranchAddress( "hEcutRec", &hEcutRec, &b_hEcutRec ); + if( fChain->GetBranchStatus( "hEcutRecUW" ) ) + { + fChain->SetBranchAddress( "hEcutRecUW", &hEcutRecUW, &b_hEcutRecUW ); + } + else + { + hEcutRecUW = 0; + } + fChain->SetBranchAddress( "gEffAreaMC", &gEffAreaMC, &b_gEffAreaMC ); + fChain->SetBranchAddress( "gEffAreaRec", &gEffAreaRec, &b_gEffAreaRec ); + fChain->SetBranchAddress( "hEmcSWeight", &hEmcSWeight, &b_hEmcSWeight ); + fChain->SetBranchAddress( "hEsysRec", &hEsysRec, &b_hEsysRec ); + fChain->SetBranchAddress( "hEsysMC", &hEsysMC, &b_hEsysMC ); + fChain->SetBranchAddress( "hEsys2D", &hEsys2D, &b_hEsys2D ); + fChain->SetBranchAddress( "hEmcCutCTA", &hEmcCutCTA, &b_hEmcCutCTA ); + fChain->SetBranchAddress( "hResponseMatrix", &hResponseMatrix, &b_hResponseMatrix ); + if( fChain->GetBranchStatus( "hResponseMatrixQC" ) ) + { + fChain->SetBranchAddress( "hResponseMatrixQC", &hResponseMatrixQC, &b_hResponseMatrixQC ); + } + else + { + hResponseMatrixQC = 0; + } + if( fChain->GetBranchStatus( "hResponseMatrixProfile" ) ) + { + fChain->SetBranchAddress( "hResponseMatrixProfile", &hResponseMatrixProfile, &b_hResponseMatrixProfile ); + } + else + { + hResponseMatrixProfile = 0; + } + if( fChain->GetBranchStatus( "hResponseMatrixFineQC" ) ) { - break; + fChain->SetBranchAddress( "hResponseMatrixFineQC", &hResponseMatrixFineQC, &b_hResponseMatrixFineQC ); } - nb = fChain->GetEntry( jentry ); - nbytes += nb; - // if (Cut(ientry) < 0) continue; + else + { + hResponseMatrixFineQC = 0; + } + } + else + { + hEmc = 0; + hEcut = 0; + hEcutUW = 0; + hEcut500 = 0; + hEcutRec = 0; + hEcutRecUW = 0; + gEffAreaMC = 0; + gEffAreaRec = 0; + hEmcSWeight = 0; + hEsysRec = 0; + hEsysMC = 0; + hEsysMCRelative = 0; + hEsysMCRelativeRMS = 0; + hEsys2D = 0; + hEmcCutCTA = 0; + hResponseMatrix = 0; + hResponseMatrixProfile = 0; + hResponseMatrixQC = 0; + hResponseMatrixFineQC = 0; + } + if( fChain->GetBranchStatus( "hEcutLin" ) ) + { + fChain->SetBranchAddress( "hEcutLin", &hEcutLin, &b_hEcutLin ); + } + else + { + hEcutLin = 0; + } + if( fChain->GetBranchStatus( "hEsysMCRelative" ) ) + { + fChain->SetBranchAddress( "hEsysMCRelative", &hEsysMCRelative, &b_hEsysMCRelative ); + } + else + { + hEsysMCRelative = 0; + } + if( fChain->GetBranchStatus( "hEsysMCRelativeRMS" ) ) + { + fChain->SetBranchAddress( "hEsysMCRelativeRMS", &hEsysMCRelativeRMS, &b_hEsysMCRelativeRMS ); + } + else + { + hEsysMCRelativeRMS = 0; + } + if( fChain->GetBranchStatus( "hEsysMCRelative2D" ) ) + { + fChain->SetBranchAddress( "hEsysMCRelative2D", &hEsysMCRelative2D, &b_hEsysMCRelative2D ); + } + else + { + hEsysMCRelative2D = 0; + } + if( fChain->GetBranchStatus( "hhEcutTrigger" ) ) + { + fChain->SetBranchAddress( "hhEcutTrigger", &hhEcutTrigger, &b_hhEcutTrigger ); + fChain->SetBranchAddress( "hhEcutFiducialArea", &hhEcutFiducialArea, &b_hhEcutFiducialArea ); + fChain->SetBranchAddress( "hhEcutStereoQuality", &hhEcutStereoQuality, &b_hhEcutStereoQuality ); + fChain->SetBranchAddress( "hhEcutTelType", &hhEcutTelType, &b_hhEcutTelType ); + fChain->SetBranchAddress( "hhEcutDirection", &hhEcutDirection, &b_hhEcutDirection ); + fChain->SetBranchAddress( "hhEcutEnergyReconstruction", &hhEcutEnergyReconstruction, &b_hhEcutEnergyReconstruction ); + fChain->SetBranchAddress( "hhEcutGammaHadron", &hhEcutGammaHadron, &b_hhEcutGammaHadron ); + } + else + { + hhEcutTrigger = 0; + hhEcutFiducialArea = 0; + hhEcutStereoQuality = 0; + hhEcutTelType = 0; + hhEcutDirection = 0; + hhEcutGammaHadron = 0; + hhEcutEnergyReconstruction = 0; + } + if( fChain->GetBranchStatus( "hWeightedRate" ) ) + { + fChain->SetBranchAddress( "hWeightedRate", &hWeightedRate, &b_hWeightedRate ); + } + else + { + hWeightedRate = 0; } } diff --git a/src/Cshowerpars.cpp b/src/Cshowerpars.cpp index ae6a73b1..fb7baea5 100644 --- a/src/Cshowerpars.cpp +++ b/src/Cshowerpars.cpp @@ -1,51 +1,469 @@ -#define Cshowerpars_cxx +/* + Showerpars tree definition. +*/ + #include "Cshowerpars.h" -#include -#include -#include -void Cshowerpars::Loop() +showerpars::Cshowerpars( TTree* tree, bool iMC, bool iShort ) +{ + if(!tree ) + { + return; + } + + bMC = iMC; + bDeRot = false; + bShort = iShort; + + Init( tree ); +} + + +Cshowerpars::~Cshowerpars() +{ + if(!fChain ) + { + return; + } + delete fChain->GetCurrentFile(); +} + + +Int_t Cshowerpars::GetEntry( Long64_t entry ) +{ + // Read contents of entry. + if(!fChain ) + { + return 0; + } + + return fChain->GetEntry( entry ); +} + + +Long64_t Cshowerpars::LoadTree( Long64_t entry ) { - // In a ROOT session, you can do: - // Root > .L Cshowerpars.C - // Root > Cshowerpars t - // Root > t.GetEntry(12); // Fill t data members with entry number 12 - // Root > t.Show(); // Show values of entry 12 - // Root > t.Show(16); // Read and show values of entry 16 - // Root > t.Loop(); // Loop on all entries - // - - // This is the loop skeleton where: - // jentry is the global entry number in the chain - // ientry is the entry number in the current Tree - // Note that the argument to GetEntry must be: - // jentry for TChain::GetEntry - // ientry for TTree::GetEntry and TBranch::GetEntry - // - // To read only selected branches, Insert statements like: - // METHOD1: - // fChain->SetBranchStatus("*",0); // disable all branches - // fChain->SetBranchStatus("branchname",1); // activate branchname - // METHOD2: replace line - // fChain->GetEntry(jentry); //read all branches - //by b_branchname->GetEntry(ientry); //read only this branch - if( fChain == 0 ) + // Set the environment to read one entry + if(!fChain ) + { + return -5; + } + Long64_t centry = fChain->LoadTree( entry ); + if( centry < 0 ) + { + return centry; + } + if( fChain->IsA() != TChain::Class() ) + { + return centry; + } + TChain* chain = ( TChain* )fChain; + if( chain->GetTreeNumber() != fCurrent ) + { + fCurrent = chain->GetTreeNumber(); + Notify(); + } + return centry; +} + + +void Cshowerpars::Init( TTree* tree ) +{ + + // Set branch addresses + if( tree == 0 ) { return; } + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass( 1 ); + + if( tree->GetBranchStatus( "MCe0" ) ) + { + bMC = true; + } + if( tree->GetBranchStatus( "XoffDeRot" ) ) + { + bDeRot = true; + } + + fChain->SetBranchAddress( "runNumber", &runNumber ); + fChain->SetBranchAddress( "eventNumber", &eventNumber ); + if( fChain->GetBranchStatus( "eventStatus" ) ) + { + fChain->SetBranchAddress( "eventStatus", &eventStatus ); + } + else + { + eventStatus = 0; + } + fChain->SetBranchAddress( "MJD", &MJD ); + fChain->SetBranchAddress( "Time", &Time ); + if(!bShort ) + { + fChain->SetBranchAddress( "dataFormat", &dataFormat ); + } + else + { + dataFormat = 0; + } + fChain->SetBranchAddress( "NTel", &NTel ); + if(!bShort ) + { + fChain->SetBranchAddress( "traceFit", &traceFit ); + } + else + { + traceFit = 0; + } + fChain->SetBranchAddress( "TelElevation", TelElevation ); + fChain->SetBranchAddress( "TelAzimuth", TelAzimuth ); + + if(!bMC ) + { + fChain->SetBranchAddress( "TelDec", TelDec ); + fChain->SetBranchAddress( "TelRA", TelRA ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + TelDec[i] = 0.; + TelRA[i] = 0; + } + } + + if(!bMC && !bShort ) + { + fChain->SetBranchAddress( "TelElevationVBF", TelElevationVBF ); + fChain->SetBranchAddress( "TelAzimuthVBF", TelAzimuthVBF ); + fChain->SetBranchAddress( "TelPointingMismatch", TelPointingMismatch ); + fChain->SetBranchAddress( "Tel_x_SC", Tel_x_SC ); + fChain->SetBranchAddress( "Tel_y_SC", Tel_y_SC ); + fChain->SetBranchAddress( "Tel_z_SC", Tel_z_SC ); + fChain->SetBranchAddress( "TargetElev", &TargetElev ); + fChain->SetBranchAddress( "TargetAzim", &TargetAzim ); + fChain->SetBranchAddress( "TargetDec", &TargetDec ); + fChain->SetBranchAddress( "TargetRA", &TargetRA ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + TelElevationVBF[i] = 0.; + TelAzimuthVBF[i] = 0.; + TelPointingMismatch[i] = 0.; + Tel_x_SC[i] = 0.; + Tel_y_SC[i] = 0.; + Tel_z_SC[i] = 0.; + } + TargetElev = 0.; + TargetAzim = 0.; + TargetDec = 0.; + TargetRA = 0; + } + fChain->SetBranchAddress( "WobbleN", &WobbleN ); + fChain->SetBranchAddress( "WobbleE", &WobbleE ); + fChain->SetBranchAddress( "NTrig", &NTrig ); + fChain->SetBranchAddress( "LTrig", <rig ); + fChain->SetBranchAddress( "Trig_list", Trig_list, &b_Trig_list ); + if( fChain->GetBranchStatus( "Trig_type" ) ) + { + fChain->SetBranchAddress( "Trig_type", Trig_type, &b_Trig_type ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + { + Trig_type[i] = 0; + } + } + fChain->SetBranchAddress( "NMethods", &NMethods ); + if(!bShort ) + { + fChain->SetBranchAddress( "MethodID", MethodID ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) + { + MethodID[i] = 0; + } + } + + fChain->SetBranchAddress( "NImages", NImages ); + fChain->SetBranchAddress( "img2_ang", img2_ang ); + fChain->SetBranchAddress( "ImgSel", ImgSel ); + fChain->SetBranchAddress( "ImgSel_list", ImgSel_list, &b_ImgSel_list ); + fChain->SetBranchAddress( "Ze", Ze ); + fChain->SetBranchAddress( "Az", Az ); + fChain->SetBranchAddress( "Xoff", Xoff ); + fChain->SetBranchAddress( "Yoff", Yoff ); + if( bDeRot ) + { + fChain->SetBranchAddress( "XoffDeRot", XoffDeRot ); + fChain->SetBranchAddress( "YoffDeRot", YoffDeRot ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) + { + XoffDeRot[i] = 0.; + YoffDeRot[i] = 0.; + } + } + if(!bShort ) + { + fChain->SetBranchAddress( "stds", stds ); + if( fChain->GetBranchStatus( "dec" ) ) + { + fChain->SetBranchAddress( "dec", dec ); + fChain->SetBranchAddress( "ra", ra ); + } + } + else + { + for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) + { + stds[i] = 0.; + dec[i] = 0.; + ra[i] = 0.; + } + } + fChain->SetBranchAddress( "Xcore", Xcore ); + fChain->SetBranchAddress( "Ycore", Ycore ); + if(!bShort ) + { + fChain->SetBranchAddress( "Xcore_SC", Xcore_SC ); + fChain->SetBranchAddress( "Ycore_SC", Ycore_SC ); + fChain->SetBranchAddress( "stdp", stdp ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) + { + Xcore_SC[i] = 0.; + Ycore_SC[i] = 0.; + stdp[i] = 0.; + } + } + fChain->SetBranchAddress( "Chi2", Chi2 ); + if( fChain->GetBranchStatus( "DispDiff" ) ) + { + fChain->SetBranchAddress( "DispDiff", DispDiff ); + } + else + { + for( unsigned int i = 0; i < VDST_MAXRECMETHODS; i++ ) + { + DispDiff[i] = 0.; + } + } + if( bMC ) + { + fChain->SetBranchAddress( "MCprim", &MCprim ); + fChain->SetBranchAddress( "MCe0", &MCe0 ); + fChain->SetBranchAddress( "MCxcore", &MCxcore ); + fChain->SetBranchAddress( "MCycore", &MCycore ); + if(!bShort ) + { + fChain->SetBranchAddress( "MCxcos", &MCxcos ); + fChain->SetBranchAddress( "MCycos", &MCycos ); + } + else + { + MCxcos = 0.; + MCycos = 0.; + } + fChain->SetBranchAddress( "MCze", &MCze ); + fChain->SetBranchAddress( "MCaz", &MCaz ); + fChain->SetBranchAddress( "MCxoff", &MCxoff ); + fChain->SetBranchAddress( "MCyoff", &MCyoff ); + if(!bShort ) + { + fChain->SetBranchAddress( "MCxcore_SC", &MCxcore_SC ); + fChain->SetBranchAddress( "MCycore_SC", &MCycore_SC ); + fChain->SetBranchAddress( "MCzcore_SC", &MCzcore_SC ); + } + else + { + MCxcore_SC = 0.; + MCycore_SC = 0.; + MCzcore_SC = 0.; + } + } + Notify(); +} - Long64_t nentries = fChain->GetEntriesFast(); - Long64_t nbytes = 0, nb = 0; - for( Long64_t jentry = 0; jentry < nentries; jentry++ ) +Bool_t Cshowerpars::Notify() +{ + b_runNumber = fChain->GetBranch( "runNumber" ); + b_eventNumber = fChain->GetBranch( "eventNumber" ); + b_MJD = fChain->GetBranch( "MJD" ); + b_Time = fChain->GetBranch( "Time" ); + if(!bShort ) + { + b_dataFormat = fChain->GetBranch( "dataFormat" ); + } + else + { + b_dataFormat = 0; + } + b_NTel = fChain->GetBranch( "NTel" ); + b_traceFit = fChain->GetBranch( "traceFit" ); + b_TelElevation = fChain->GetBranch( "TelElevation" ); + b_TelAzimuth = fChain->GetBranch( "TelAzimuth" ); + if(!bMC ) + { + b_TelDec = fChain->GetBranch( "TelDec" ); + b_TelRA = fChain->GetBranch( "TelRA" ); + } + else + { + b_TelDec = 0; + b_TelRA = 0; + } + if(!bShort ) + { + b_TelElevationVBF = fChain->GetBranch( "TelElevationVBF" ); + b_TelAzimuthVBF = fChain->GetBranch( "TelAzimuthVBF" ); + b_TelPointingMismatch = fChain->GetBranch( "TelPointingMismatch" ); + b_Tel_x_SC = fChain->GetBranch( "Tel_x_SC" ); + b_Tel_y_SC = fChain->GetBranch( "Tel_y_SC" ); + b_Tel_z_SC = fChain->GetBranch( "Tel_z_SC" ); + b_TargetElev = fChain->GetBranch( "TargetElev" ); + b_TargetAzim = fChain->GetBranch( "TargetAzim" ); + b_TargetDec = fChain->GetBranch( "TargetDec" ); + b_TargetRA = fChain->GetBranch( "TargetRA" ); + } + else + { + b_TelElevationVBF = 0; + b_TelAzimuthVBF = 0; + b_TelPointingMismatch = 0; + b_Tel_x_SC = 0; + b_Tel_y_SC = 0; + b_Tel_z_SC = 0; + b_TargetElev = 0; + b_TargetAzim = 0; + b_TargetDec = 0; + b_TargetRA = 0; + } + b_WobbleN = fChain->GetBranch( "WobbleN" ); + b_WobbleE = fChain->GetBranch( "WobbleE" ); + b_NTrig = fChain->GetBranch( "NTrig" ); + b_LTrig = fChain->GetBranch( "LTrig" ); + b_NMethods = fChain->GetBranch( "NMethods" ); + if(!bShort ) + { + b_MethodID = fChain->GetBranch( "MethodID" ); + } + else + { + b_MethodID = 0; + } + b_NImages = fChain->GetBranch( "NImages" ); + b_ImgSel = fChain->GetBranch( "ImgSel" ); + b_ImgSel_list = fChain->GetBranch( "ImgSel_list" ); + if(!bShort ) + { + b_img2_ang = fChain->GetBranch( "img2_ang" ); + } + else + { + b_img2_ang = 0; + } + b_Ze = fChain->GetBranch( "Ze" ); + b_Az = fChain->GetBranch( "Az" ); + b_Xoff = fChain->GetBranch( "Xoff" ); + b_Yoff = fChain->GetBranch( "Yoff" ); + if( bDeRot ) + { + b_XoffDeRot = fChain->GetBranch( "XoffDeRot" ); + b_YoffDeRot = fChain->GetBranch( "YoffDeRot" ); + } + else + { + b_XoffDeRot = 0; + b_YoffDeRot = 0; + } + if(!bShort ) + { + b_stds = fChain->GetBranch( "stds" ); + } + if( fChain->GetBranchStatus( "dec" ) ) + { + b_dec = fChain->GetBranch( "dec" ); + } + if( fChain->GetBranchStatus( "ra" ) ) + { + b_ra = fChain->GetBranch( "ra" ); + } + else + { + b_stds = 0; + b_dec = 0; + b_ra = 0; + } + b_Xcore = fChain->GetBranch( "Xcore" ); + b_Ycore = fChain->GetBranch( "Ycore" ); + if(!bShort ) + { + b_Xcore_SC = fChain->GetBranch( "Xcore_SC" ); + b_Ycore_SC = fChain->GetBranch( "Ycore_SC" ); + b_stdp = fChain->GetBranch( "stdp" ); + } + else + { + b_Xcore_SC = 0; + b_Ycore_SC = 0; + b_stdp = 0; + } + + b_Chi2 = fChain->GetBranch( "Chi2" ); + b_DispDiff = fChain->GetBranch( "DispDiff" ); + if( bMC ) { - Long64_t ientry = LoadTree( jentry ); - if( ientry < 0 ) + if(!bShort ) { - break; + b_MCprim = fChain->GetBranch( "MCprim" ); + } + else + { + b_MCprim = 0; + } + b_MCe0 = fChain->GetBranch( "MCe0" ); + b_MCxcore = fChain->GetBranch( "MCxcore" ); + b_MCycore = fChain->GetBranch( "MCycore" ); + if(!bShort ) + { + b_MCxcos = fChain->GetBranch( "MCxcos" ); + b_MCycos = fChain->GetBranch( "MCycos" ); + } + else + { + b_MCxcos = 0; + b_MCycos = 0; + } + b_MCze = fChain->GetBranch( "MCze" ); + b_MCaz = fChain->GetBranch( "MCaz" ); + b_MCxoff = fChain->GetBranch( "MCxoff" ); + b_MCyoff = fChain->GetBranch( "MCyoff" ); + if(!bShort ) + { + b_MCxcore_SC = fChain->GetBranch( "MCycore_SC" ); + b_MCycore_SC = fChain->GetBranch( "MCycore_SC" ); + b_MCycore_SC = fChain->GetBranch( "MCycore_SC" ); + } + else + { + b_MCxcore_SC = 0; + b_MCycore_SC = 0; + b_MCycore_SC = 0; } - nb = fChain->GetEntry( jentry ); - nbytes += nb; - // if (Cut(ientry) < 0) continue; } + + return kTRUE; } diff --git a/src/Ctelconfig.cpp b/src/Ctelconfig.cpp index 09cb52d3..8d68aff3 100644 --- a/src/Ctelconfig.cpp +++ b/src/Ctelconfig.cpp @@ -60,7 +60,6 @@ Long64_t Ctelconfig::LoadTree( Long64_t entry ) if( chain->GetTreeNumber() != fCurrent ) { fCurrent = chain->GetTreeNumber(); - Notify(); } return centry; } diff --git a/src/Ctpars.cpp b/src/Ctpars.cpp index 4369f8f6..9b12db76 100644 --- a/src/Ctpars.cpp +++ b/src/Ctpars.cpp @@ -1,51 +1,472 @@ -#define Ctpars_cxx #include "Ctpars.h" -#include -#include -#include -void Ctpars::Loop() +/* + + optimization of tree reading: + + bShort = 0: read all branches + bShort = 1: read limited number of branches needed for lookup table analysis + bShort = 2: read limited number of branched needed for lookup table filling + +*/ +Ctpars::Ctpars( TTree* tree, bool iMC, unsigned int iShort ) +{ + if(!tree ) + { + return; + } + bMC = iMC; + bShort = iShort; + // forward I/O + // is supposed to speed up reading significantly + // problem: large memory consumption (>12 GB for certain cta arrays) + // tree->SetCacheSize(10000000); + bsdevxy = false; + + Init( tree ); +} + + +Ctpars::~Ctpars() { - // In a ROOT session, you can do: - // Root > .L Ctpars.C - // Root > Ctpars t - // Root > t.GetEntry(12); // Fill t data members with entry number 12 - // Root > t.Show(); // Show values of entry 12 - // Root > t.Show(16); // Read and show values of entry 16 - // Root > t.Loop(); // Loop on all entries - // - - // This is the loop skeleton where: - // jentry is the global entry number in the chain - // ientry is the entry number in the current Tree - // Note that the argument to GetEntry must be: - // jentry for TChain::GetEntry - // ientry for TTree::GetEntry and TBranch::GetEntry - // - // To read only selected branches, Insert statements like: - // METHOD1: - // fChain->SetBranchStatus("*",0); // disable all branches - // fChain->SetBranchStatus("branchname",1); // activate branchname - // METHOD2: replace line - // fChain->GetEntry(jentry); //read all branches - //by b_branchname->GetEntry(ientry); //read only this branch - if( fChain == 0 ) + if(!fChain ) { return; } + delete fChain->GetCurrentFile(); +} - Long64_t nentries = fChain->GetEntriesFast(); - Long64_t nbytes = 0, nb = 0; - for( Long64_t jentry = 0; jentry < nentries; jentry++ ) +Int_t Ctpars::GetEntry( Long64_t entry ) +{ + // Read contents of entry. + if(!fChain ) { - Long64_t ientry = LoadTree( jentry ); - if( ientry < 0 ) + return 0; + } + return fChain->GetEntry( entry ); +} + + +Long64_t Ctpars::LoadTree( Long64_t entry ) +{ + // Set the environment to read one entry + if(!fChain ) + { + return -5; + } + Long64_t centry = fChain->LoadTree( entry ); + if( centry < 0 ) + { + return centry; + } + if( fChain->IsA() != TChain::Class() ) + { + return centry; + } + TChain* chain = ( TChain* )fChain; + if( chain->GetTreeNumber() != fCurrent ) + { + fCurrent = chain->GetTreeNumber(); + Notify(); + } + return centry; +} + + +void Ctpars::Init( TTree* tree ) +{ + + // Set branch addresses + if( tree == 0 ) + { + return; + } + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass( 1 ); + ///////////////////////////////////////////////// + // bShort = 2: read limited number of branched needed for lookup table filling + if( bShort <= 2 ) + { + if( fChain->GetBranchStatus( "meanPedvar_Image" ) ) + { + fChain->SetBranchAddress( "meanPedvar_Image", &meanPedvar_Image ); + } + else + { + meanPedvar_Image = 0; + } + fChain->SetBranchAddress( "ntubes", &ntubes ); + fChain->SetBranchAddress( "length", &length ); + fChain->SetBranchAddress( "width", &width ); + fChain->SetBranchAddress( "size", &size ); + fChain->SetBranchAddress( "cen_x", &cen_x ); + fChain->SetBranchAddress( "cen_y", &cen_y ); + fChain->SetBranchAddress( "loss", &loss ); + fChain->SetBranchAddress( "cosphi", &cosphi ); + fChain->SetBranchAddress( "sinphi", &sinphi ); + if( fChain->GetBranchStatus( "fui" ) ) + { + fChain->SetBranchAddress( "fui", &fui ); + } + else { - break; + fui = 0.; } - nb = fChain->GetEntry( jentry ); - nbytes += nb; - // if (Cut(ientry) < 0) continue; } + // bShort = 1: read limited number of branches needed for lookup table analysis + if( bShort <= 1 ) + { + if( fChain->GetBranchStatus( "eventNumber" ) ) + { + fChain->SetBranchAddress( "eventNumber", &eventNumber ); + } + else + { + eventNumber = 0; + } + if( fChain->GetBranchStatus( "meanPed_Image" ) ) + { + fChain->SetBranchAddress( "meanPed_Image", &meanPed_Image ); + } + else + { + meanPed_Image = 0; + } + if( fChain->GetBranchStatus( "f_d" ) ) + { + fChain->SetBranchAddress( "f_d", &f_d ); + bsdevxy = true; + } + else + { + f_d = 0.; + } + if( fChain->GetBranchStatus( "f_s" ) ) + { + fChain->SetBranchAddress( "f_s", &f_s ); + } + else + { + f_s = 0.; + } + if( fChain->GetBranchStatus( "f_sdevxy" ) ) + { + fChain->SetBranchAddress( "f_sdevxy", &f_sdevxy ); + } + else + { + f_sdevxy = 0.; + } + + if( fChain->GetBranchStatus( "fracLow" ) ) + { + + fChain->SetBranchAddress( "fracLow", &fracLow ); + } + else + { + fracLow = 0.; + } + fChain->SetBranchAddress( "dist", &dist ); + if( fChain->GetBranchStatus( "ntubesBNI" ) ) + { + fChain->SetBranchAddress( "ntubesBNI", &ntubesBNI ); + } + else + { + ntubesBNI = 0; + } + fChain->SetBranchAddress( "nsat", &nsat ); + if( fChain->GetBranchStatus( "nlowgain" ) ) + { + fChain->SetBranchAddress( "nlowgain", &nlowgain ); + } + else + { + nlowgain = 0; + } + fChain->SetBranchAddress( "asymmetry", &asymmetry ); + fChain->SetBranchAddress( "tgrad_x", &tgrad_x ); + fChain->SetBranchAddress( "Fitstat", &Fitstat ); + // reset variables which are not read out + alpha = 0.; + los = 0.; + phi = 0.; + max[0] = 0.; + max[1] = 0.; + max[2] = 0.; + index_of_max[0] = 0; + index_of_max[1] = 0; + index_of_max[2] = 0; + tchisq_x = 0.; + + //muon analysis// + if( fChain->GetBranchStatus( "muonX0" ) ) + { + fChain->SetBranchAddress( "muonX0", &muonX0 ); + } + else + { + muonX0 = 0; + } + if( fChain->GetBranchStatus( "muonY0" ) ) + { + fChain->SetBranchAddress( "muonY0", &muonY0 ); + } + else + { + muonY0 = 0; + } + if( fChain->GetBranchStatus( "muonRadius" ) ) + { + fChain->SetBranchAddress( "muonRadius", &muonRadius ); + } + else + { + muonRadius = 0; + } + if( fChain->GetBranchStatus( "muonRSigma" ) ) + { + fChain->SetBranchAddress( "muonRSigma", &muonRSigma ); + } + else + { + muonRSigma = 0; + } + if( fChain->GetBranchStatus( "muonSize" ) ) + { + fChain->SetBranchAddress( "muonSize", &muonSize ); + } + else + { + muonSize = 0; + } + if( fChain->GetBranchStatus( "muonSize" ) ) + { + fChain->SetBranchAddress( "muonSize", &muonSize ); + } + else + { + muonSize = 0; + } + if( fChain->GetBranchStatus( "muonIPCorrectedSize" ) ) + { + fChain->SetBranchAddress( "muonIPCorrectedSize", &muonIPCorrectedSize ); + } + else + { + muonIPCorrectedSize = 0; + } + if( fChain->GetBranchStatus( "muonValid" ) ) + { + fChain->SetBranchAddress( "muonValid", &muonValid ); + } + else + { + muonValid = 0; + } + if( fChain->GetBranchStatus( "houghMuonValid" ) ) + { + fChain->SetBranchAddress( "houghMuonValid", &houghMuonValid ); + } + else + { + houghMuonValid = 0; + } + + } + // bShort == 0: read all branches + if( bShort == 0 ) + { + fChain->SetBranchAddress( "alpha", &alpha ); + fChain->SetBranchAddress( "los", &los ); + fChain->SetBranchAddress( "phi", &phi ); + fChain->SetBranchAddress( "max", max ); + fChain->SetBranchAddress( "index_of_max", index_of_max ); + fChain->SetBranchAddress( "tchisq_x", &tchisq_x ); + } + Notify(); +} + +/* + Get branch pointers +*/ +Bool_t Ctpars::Notify() +{ + + b_eventNumber = 0; + b_meanPed_Image = 0; + b_meanPedvar_Image = 0; + b_length = 0; + b_width = 0; + b_size = 0; + b_cen_x = 0; + b_cen_y = 0; + b_f_s = 0; + b_f_d = 0; + b_f_sdevxy = 0; + b_loss = 0; + b_fracLow = 0; + b_alpha = 0; + b_los = 0; + b_phi = 0; + b_cosphi = 0; + b_sinphi = 0; + b_ntubesBNI = 0; + b_nlowgain = 0; + b_fui = 0; + b_max = 0; + b_index_of_max = 0; + b_tchisq_x = 0; + b_Fitstat = 0; + b_muonX0 = 0; + b_muonY0 = 0; + b_muonRadius = 0; + b_muonRSigma = 0; + b_muonSize = 0; + b_muonIPCorrectedSize = 0; + b_muonValid = 0; + b_houghMuonValid = 0; + + // get branch pointers + if( bShort <= 2 ) + { + if( fChain->GetBranchStatus( "meanPedvar_Image" ) ) + { + b_meanPedvar_Image = fChain->GetBranch( "meanPedvar_Image" ); + fChain->AddBranchToCache( b_meanPedvar_Image ); + } + else + { + b_meanPedvar_Image = 0; + } + b_ntubes = fChain->GetBranch( "ntubes" ); + fChain->AddBranchToCache( b_ntubes ); + b_length = fChain->GetBranch( "length" ); + fChain->AddBranchToCache( b_length ); + b_width = fChain->GetBranch( "width" ); + fChain->AddBranchToCache( b_width ); + b_size = fChain->GetBranch( "size" ); + fChain->AddBranchToCache( b_size ); + b_cen_x = fChain->GetBranch( "cen_x" ); + fChain->AddBranchToCache( b_cen_x ); + b_cen_y = fChain->GetBranch( "cen_y" ); + fChain->AddBranchToCache( b_cen_y ); + b_cosphi = fChain->GetBranch( "cosphi" ); + b_sinphi = fChain->GetBranch( "sinphi" ); + if( fChain->GetBranchStatus( "fui" ) ) + { + b_fui = fChain->GetBranch( "fui" ); + } + } + if( bShort <= 1 ) + { + if( fChain->GetBranchStatus( "eventNumber" ) ) + { + b_eventNumber = fChain->GetBranch( "eventNumber" ); + } + if( fChain->GetBranchStatus( "meanPed_Image" ) ) + { + b_meanPed_Image = fChain->GetBranch( "meanPed_Image" ); + } + else + { + b_meanPed_Image = 0; + } + if( fChain->GetBranchStatus( "f_d" ) ) + { + b_f_d = fChain->GetBranch( "f_d" ); + fChain->AddBranchToCache( b_f_d ); + } + if( fChain->GetBranchStatus( "f_s" ) ) + { + b_f_s = fChain->GetBranch( "f_s" ); + fChain->AddBranchToCache( b_f_s ); + } + if( fChain->GetBranchStatus( "f_sdevxy" ) ) + { + b_f_sdevxy = fChain->GetBranch( "f_sdevxy" ); + fChain->AddBranchToCache( b_f_sdevxy ); + } + b_loss = fChain->GetBranch( "loss" ); + fChain->AddBranchToCache( b_loss ); + if( fChain->GetBranchStatus( "fracLow" ) ) + { + b_fracLow = fChain->GetBranch( "fracLow" ); + fChain->AddBranchToCache( b_fracLow ); + } + b_dist = fChain->GetBranch( "dist" ); + fChain->AddBranchToCache( b_dist ); + if( fChain->GetBranchStatus( "ntubesBNI" ) ) + { + b_ntubesBNI = fChain->GetBranch( "ntubesBNI" ); + } + b_nsat = fChain->GetBranch( "nsat" ); + fChain->AddBranchToCache( b_nsat ); + if( fChain->GetBranchStatus( "nlowgain" ) ) + { + b_nlowgain = fChain->GetBranch( "nlowgain" ); + fChain->AddBranchToCache( b_nlowgain ); + } + b_asymmetry = fChain->GetBranch( "asymmetry" ); + fChain->AddBranchToCache( b_asymmetry ); + b_tgrad_x = fChain->GetBranch( "tgrad_x" ); + fChain->AddBranchToCache( b_tgrad_x ); + b_Fitstat = fChain->GetBranch( "Fitstat" ); + fChain->AddBranchToCache( b_Fitstat ); + //muon + if( fChain->GetBranchStatus( "muonX0" ) ) + { + b_muonX0 = fChain->GetBranch( "muonX0" ); + fChain->AddBranchToCache( b_muonX0 ); + } + if( fChain->GetBranchStatus( "muonY0" ) ) + { + b_muonY0 = fChain->GetBranch( "muonY0" ); + fChain->AddBranchToCache( b_muonY0 ); + } + if( fChain->GetBranchStatus( "muonRadius" ) ) + { + b_muonRadius = fChain->GetBranch( "muonRadius" ); + fChain->AddBranchToCache( b_muonRadius ); + } + if( fChain->GetBranchStatus( "muonRSigma" ) ) + { + b_muonRSigma = fChain->GetBranch( "muonRSigma" ); + fChain->AddBranchToCache( b_muonRSigma ); + } + if( fChain->GetBranchStatus( "muonSize" ) ) + { + b_muonSize = fChain->GetBranch( "muonSize" ); + fChain->AddBranchToCache( b_muonSize ); + } + if( fChain->GetBranchStatus( "muonIPCorrectedSize" ) ) + { + b_muonIPCorrectedSize = fChain->GetBranch( "muonIPCorrectedSize" ); + fChain->AddBranchToCache( b_muonIPCorrectedSize ); + } + if( fChain->GetBranchStatus( "muonValid" ) ) + { + b_muonValid = fChain->GetBranch( "muonValid" ); + fChain->AddBranchToCache( b_muonValid ); + } + if( fChain->GetBranchStatus( "houghMuonValid" ) ) + { + b_houghMuonValid = fChain->GetBranch( "houghMuonValid" ); + fChain->AddBranchToCache( b_houghMuonValid ); + } + } + if( bShort == 0 ) + { + b_alpha = fChain->GetBranch( "alpha" ); + b_los = fChain->GetBranch( "los" ); + b_phi = fChain->GetBranch( "phi" ); + b_max = fChain->GetBranch( "max" ); + b_index_of_max = fChain->GetBranch( "index_of_max" ); + b_tchisq_x = fChain->GetBranch( "tchisq_x" ); + } + + return kTRUE; } From 2cabcccb078a7e27fc48c087b9ab158b76fd62df Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:53:57 +0100 Subject: [PATCH 24/35] docstring --- inc/Ctpars.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/Ctpars.h b/inc/Ctpars.h index 27d7f55d..89441075 100644 --- a/inc/Ctpars.h +++ b/inc/Ctpars.h @@ -1,4 +1,4 @@ -// Image parameter tpars definition +// Image parameter tree 'tpars' definition. #ifndef Ctpars_h #define Ctpars_h From 2d6c35891fdc60c5be3035c0fe400e10edff8857 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 20:57:13 +0100 Subject: [PATCH 25/35] fix header --- src/CRunSummary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CRunSummary.cpp b/src/CRunSummary.cpp index 933748d8..51f502dc 100644 --- a/src/CRunSummary.cpp +++ b/src/CRunSummary.cpp @@ -2,7 +2,7 @@ * Anasum run summary tree definition. */ -#define CRunSummary_cxx +#include "CRunSummary.h" CRunSummary::CRunSummary( TTree* tree ) { From 99250c5305b41465722c2884714723df5213da29 Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 21:02:31 +0100 Subject: [PATCH 26/35] fix energy reconstruction method --- src/VAnaSumRunParameter.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/VAnaSumRunParameter.cpp b/src/VAnaSumRunParameter.cpp index ac87a48f..4277e8de 100644 --- a/src/VAnaSumRunParameter.cpp +++ b/src/VAnaSumRunParameter.cpp @@ -584,13 +584,7 @@ int VAnaSumRunParameter::readRunParameter( string i_filename ) else if( temp == "ENERGYRECONSTRUCTIONMETHOD" ) { fEnergyReconstructionMethod = ( unsigned int )atoi( temp2.c_str() ); - // horrible detour to make sure that users don't use the wrong method - else if( fEnergyReconstructionMethod == 100 ) - { - cout << "Warning: using energy reconstruction method 0" << endl; - fEnergyReconstructionMethod = 0; - } - else if( fEnergyReconstructionMethod > 1 ) + if( fEnergyReconstructionMethod > 1 ) { cout << "Unknown parameter for ENERGYRECONSTRUCTIONMETHOD in parameter file " << i_filename << ": " << temp2 << endl; cout << "allowed values are 0 and 1" << endl; From 5a8d766aa48a1d2808b834d48d8355497e8fcd3e Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 21:08:00 +0100 Subject: [PATCH 27/35] typo --- src/Cshowerpars.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cshowerpars.cpp b/src/Cshowerpars.cpp index fb7baea5..12870413 100644 --- a/src/Cshowerpars.cpp +++ b/src/Cshowerpars.cpp @@ -4,7 +4,7 @@ #include "Cshowerpars.h" -showerpars::Cshowerpars( TTree* tree, bool iMC, bool iShort ) +Cshowerpars::Cshowerpars( TTree* tree, bool iMC, bool iShort ) { if(!tree ) { From 574026b89c66aa09bcd32fe88dc8fe746b0a6abc Mon Sep 17 00:00:00 2001 From: Gernot Maier Date: Sun, 29 Dec 2024 21:16:32 +0100 Subject: [PATCH 28/35] typo --- src/Ctelconfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ctelconfig.cpp b/src/Ctelconfig.cpp index 8d68aff3..7456cd5c 100644 --- a/src/Ctelconfig.cpp +++ b/src/Ctelconfig.cpp @@ -4,7 +4,7 @@ #include "Ctelconfig.h" -telconfig::Ctelconfig( TTree* tree ) +Ctelconfig::Ctelconfig( TTree* tree ) { Init( tree ); } From b86d21bac5797d31517688d2b6eda9e3b0b798a5 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Mon, 30 Dec 2024 14:57:06 +0100 Subject: [PATCH 29/35] compile bugs --- inc/CData.h | 2 +- src/CData.cpp | 2 +- src/VDispTableAnalyzer.cpp | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/inc/CData.h b/inc/CData.h index 7a956915..67e39e93 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -258,7 +258,7 @@ class CData TBranch* b_Xoff_intersect; TBranch* b_Yoff_intersect; - CData( TTree* tree = 0, bool bMC = false, int iVersion = 5, bool bShort = false ); + CData( TTree* tree = 0, bool bMC = false, bool bShort = false ); virtual ~CData(); virtual Int_t GetEntry( Long64_t entry ); virtual Long64_t LoadTree( Long64_t entry ); diff --git a/src/CData.cpp b/src/CData.cpp index aa7697d6..8267742b 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -818,7 +818,7 @@ void CData::reconstruct_3tel_images_direction() * Reconstruct shower energy for 3-telescope events. * */ -void CData:reconstruct_3tel_images_energy() +void CData::reconstruct_3tel_images_energy() { VDispAnalyzer i_dispAnalyzer; vector< float > disp_energy_T; diff --git a/src/VDispTableAnalyzer.cpp b/src/VDispTableAnalyzer.cpp index 5633390c..a8d6b49d 100644 --- a/src/VDispTableAnalyzer.cpp +++ b/src/VDispTableAnalyzer.cpp @@ -294,7 +294,14 @@ void VDispTableAnalyzer::calculateMeanDirection( float& xs, float& ys, vector< f return; } + // use first NTOT_MAX telescopes for event reconstruction only + // (number of possible combinations is 2^NTOT_MAX ) + const unsigned int NTOT_MAX = 16; unsigned int iNTel_max = x.size(); + if( x.size() > NTOT_MAX ) + { + iNTel_max = NTOT_MAX; + } // prepare bit mask to go through all possible combinations of sign for disp calculation vector< bitset< NTOT_MAX > > iComb; From a3e7ab23e802ff08bb80d9e914ff47aeabd6d7f2 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Mon, 30 Dec 2024 14:57:26 +0100 Subject: [PATCH 30/35] astyle --- inc/CData.h | 6 +- inc/VDispAnalyzer.h | 4 +- inc/VMeanScaledVariables.h | 8 +-- inc/VTableLookupDataHandler.h | 2 +- inc/VUtilities.h | 6 +- src/CData.cpp | 66 +++++++++---------- src/VDispAnalyzer.cpp | 10 +-- src/VGammaHadronCuts.cpp | 2 +- ...InstrumentResponseFunctionRunParameter.cpp | 2 +- src/VMeanScaledVariables.cpp | 36 +++++----- src/VPlotAnasumHistograms.cpp | 12 ++-- src/VPlotInstrumentResponseFunction.cpp | 6 +- src/VSimpleStereoReconstructor.cpp | 4 +- src/VStereoAnalysis.cpp | 2 +- src/VTMVAEvaluator.cpp | 6 +- src/VTableLookup.cpp | 12 ++-- src/VTableLookupDataHandler.cpp | 6 +- src/makeEffectiveArea.cpp | 6 +- 18 files changed, 98 insertions(+), 98 deletions(-) diff --git a/inc/CData.h b/inc/CData.h index 67e39e93..cafaf432 100644 --- a/inc/CData.h +++ b/inc/CData.h @@ -29,7 +29,7 @@ class CData vector< double > fTelY; vector< double > fTelZ; - void reconstruct_3tel_images(long unsigned int); + void reconstruct_3tel_images( long unsigned int ); void reconstruct_3tel_images_direction(); void reconstruct_3tel_images_energy(); void reconstruct_3tel_images_scaled_emission_height(); @@ -273,7 +273,7 @@ class CData return fVersion; } void initialize_3tel_reconstruction( - unsigned long int telescope_combination, - double stereo_reconstruction_min_angle, vector< double > tel_x, vector< double > tel_y, vector< double > tel_z ); + unsigned long int telescope_combination, + double stereo_reconstruction_min_angle, vector< double > tel_x, vector< double > tel_y, vector< double > tel_z ); }; #endif diff --git a/inc/VDispAnalyzer.h b/inc/VDispAnalyzer.h index 51b59dd0..8c269daa 100644 --- a/inc/VDispAnalyzer.h +++ b/inc/VDispAnalyzer.h @@ -122,7 +122,7 @@ class VDispAnalyzer bool UseIntersectForHeadTail, int* img_fitstat ); - void calculateMeanEnergy(vector< float >& disp_energy_T, float* img_size, double* img_weight); + void calculateMeanEnergy( vector< float >& disp_energy_T, float* img_size, double* img_weight ); void calculateMeanShowerDirection( vector< float >& v_x, vector< float >& v_y, vector< float >& v_weight, float& xs, float& ys, float& dispdiff, unsigned int iMaxN ); @@ -134,7 +134,7 @@ class VDispAnalyzer float* img_tgrad, float* img_loss, int* img_ntubes, double* img_weight, double xoff_4, double yoff_4, - float * img_fui, float* img_pedvar, int* img_fitstat ); + float* img_fui, float* img_pedvar, int* img_fitstat ); float evaluate( float iWidth, float iLength, float iAsymm, float iDist, float iSize, float iPedvar, float itgrad, float iLoss, diff --git a/inc/VMeanScaledVariables.h b/inc/VMeanScaledVariables.h index 3d14f516..08cc40de 100644 --- a/inc/VMeanScaledVariables.h +++ b/inc/VMeanScaledVariables.h @@ -7,11 +7,11 @@ using namespace std; namespace VMeanScaledVariables { - double mean_reduced_scaled_variable(unsigned int ntel, float *data, float *mc_value, float *mc_sigma); - double mean_reduced_scaled_variable(unsigned int ntel, float *data, double *mc_value, double *mc_sigma); + double mean_reduced_scaled_variable( unsigned int ntel, float* data, float* mc_value, float* mc_sigma ); + double mean_reduced_scaled_variable( unsigned int ntel, float* data, double* mc_value, double* mc_sigma ); - double mean_scaled_variable(unsigned int ntel, float *data, float *size, float *mc_value ); - double mean_scaled_variable(unsigned int ntel, float *data, float *size, double *mc_value ); + double mean_scaled_variable( unsigned int ntel, float* data, float* size, float* mc_value ); + double mean_scaled_variable( unsigned int ntel, float* data, float* size, double* mc_value ); } #endif diff --git a/inc/VTableLookupDataHandler.h b/inc/VTableLookupDataHandler.h index 8ec1363e..b195da1b 100644 --- a/inc/VTableLookupDataHandler.h +++ b/inc/VTableLookupDataHandler.h @@ -340,7 +340,7 @@ class VTableLookupDataHandler { return fRTel; } - float * getDistanceToCore( ULong64_t iTelType ); + float* getDistanceToCore( ULong64_t iTelType ); int getEventNumber() { return eventNumber; diff --git a/inc/VUtilities.h b/inc/VUtilities.h index a9986727..313c4c70 100644 --- a/inc/VUtilities.h +++ b/inc/VUtilities.h @@ -50,13 +50,13 @@ namespace VUtilities } // friendlier colors - inline int color_id(unsigned int index) + inline int color_id( unsigned int index ) { // Array containing the specified ROOT color ID int colors[] = {12, 633, 9, 418, 801, 881, 900, 32, 423, 393, 798, 616, 409}; - unsigned int size = sizeof(colors) / sizeof(colors[0]); + unsigned int size = sizeof( colors ) / sizeof( colors[0] ); - if (index >= size) + if( index >= size ) { return index; } diff --git a/src/CData.cpp b/src/CData.cpp index 8267742b..13f0789d 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -41,7 +41,7 @@ Int_t CData::GetEntry( Long64_t entry ) if( fTelescopeCombination > 0 && fTelescopeCombination != 15 ) { - reconstruct_3tel_images(fTelescopeCombination); + reconstruct_3tel_images( fTelescopeCombination ); } return a; } @@ -632,26 +632,26 @@ Bool_t CData::Notify() * - ErecS, EChi2S, dES (lookup table based energy reconstruction results) * */ -void CData::reconstruct_3tel_images(unsigned long int telescope_combination) +void CData::reconstruct_3tel_images( unsigned long int telescope_combination ) { reconstruct_3tel_reset_variables(); - bitset tel_bitset(telescope_combination); - bitset tel_nimages(0); + bitset tel_bitset( telescope_combination ); + bitset tel_nimages( 0 ); // update list of available images UInt_t tel_list[VDST_MAXTELESCOPES]; - for(unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) + for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) { tel_list[i] = 9999; } unsigned int z = 0; - for(int i = 0; i < NImages; i++ ) + for( int i = 0; i < NImages; i++ ) { unsigned int t = ImgSel_list[i]; - if( tel_bitset.test(t) ) + if( tel_bitset.test( t ) ) { - tel_list[z]=t; - tel_nimages.set(t); + tel_list[z] = t; + tel_nimages.set( t ); z++; } else @@ -664,7 +664,7 @@ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) } // ImgSel_list lists the available images (e.g., 2, 3, 4) and is of length NImages NImages = z; - for(int i = 0; i < NImages; i++ ) + for( int i = 0; i < NImages; i++ ) { ImgSel_list[i] = tel_list[i]; } @@ -676,7 +676,7 @@ void CData::reconstruct_3tel_images(unsigned long int telescope_combination) } SizeSecondMax = 0.; - for(int i = 0; i < NImages; i++ ) + for( int i = 0; i < NImages; i++ ) { unsigned int t = ImgSel_list[i]; if( size[t] > SizeSecondMax ) @@ -749,10 +749,10 @@ void CData::reconstruct_3tel_images_scaled_emission_height() */ void CData::reconstruct_3tel_images_scaled_variables() { - MSCW = VMeanScaledVariables::mean_reduced_scaled_variable(4, width, MSCWT, MSCWTSigma ); - MSCL = VMeanScaledVariables::mean_reduced_scaled_variable(4, length, MSCLT, MSCLTSigma ); - MWR = VMeanScaledVariables::mean_scaled_variable(4, width, size, MSCWT ); - MLR = VMeanScaledVariables::mean_scaled_variable(4, length, size, MSCLT ); + MSCW = VMeanScaledVariables::mean_reduced_scaled_variable( 4, width, MSCWT, MSCWTSigma ); + MSCL = VMeanScaledVariables::mean_reduced_scaled_variable( 4, length, MSCLT, MSCLTSigma ); + MWR = VMeanScaledVariables::mean_scaled_variable( 4, width, size, MSCWT ); + MLR = VMeanScaledVariables::mean_scaled_variable( 4, length, size, MSCLT ); } /* @@ -763,12 +763,12 @@ void CData::reconstruct_3tel_images_direction() { // intersection method VSimpleStereoReconstructor i_SR; - i_SR.initialize(2, fStereoMinAngle); + i_SR.initialize( 2, fStereoMinAngle ); i_SR.reconstruct_direction( - fTelX.size(), - ArrayPointing_Elevation, ArrayPointing_Azimuth, - fTelX.data(), fTelY.data(), fTelZ.data(), - size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); + fTelX.size(), + ArrayPointing_Elevation, ArrayPointing_Azimuth, + fTelX.data(), fTelY.data(), fTelZ.data(), + size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); Xoff_intersect = i_SR.fShower_Xoffset; Yoff_intersect = i_SR.fShower_Yoffset; @@ -777,7 +777,7 @@ void CData::reconstruct_3tel_images_direction() float xs, ys, dispdiff; VDispAnalyzer i_dispAnalyzer; - i_dispAnalyzer.calculateMeanShowerDirection(v_x, v_y, v_weight, xs, ys, dispdiff, v_x.size() ); + i_dispAnalyzer.calculateMeanShowerDirection( v_x, v_y, v_weight, xs, ys, dispdiff, v_x.size() ); // expect that this is called for MC only Xoff = Xoff_derot = xs; Yoff = Yoff_derot = ys; @@ -795,21 +795,21 @@ void CData::reconstruct_3tel_images_direction() // core reconstruction i_SR.reconstruct_core( - fTelX.size(), - ArrayPointing_Elevation, ArrayPointing_Azimuth, - Xoff, Yoff, - fTelX.data(), fTelY.data(), fTelZ.data(), - size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); + fTelX.size(), + ArrayPointing_Elevation, ArrayPointing_Azimuth, + Xoff, Yoff, + fTelX.data(), fTelY.data(), fTelZ.data(), + size, cen_x, cen_y, cosphi, sinphi, width, length, 0 ); Xcore = i_SR.fShower_Xcore; Ycore = i_SR.fShower_Ycore; - bitset tel_nimages(ImgSel); + bitset tel_nimages( ImgSel ); for( unsigned int t = 0; t < fTelX.size(); t++ ) { R_core[t] = -9999.; - if( tel_nimages.test(t) && Ze >= 0. && Xcore > -9998. && Ycore > -9998. ) + if( tel_nimages.test( t ) && Ze >= 0. && Xcore > -9998. && Ycore > -9998. ) { R_core[t] = VUtilities::line_point_distance( - Ycore, -1.*Xcore, 0., Ze, Az, fTelY[t], -1.*fTelX[t], fTelZ[t] ); + Ycore, -1.*Xcore, 0., Ze, Az, fTelY[t], -1.*fTelX[t], fTelZ[t] ); } } } @@ -822,11 +822,11 @@ void CData::reconstruct_3tel_images_energy() { VDispAnalyzer i_dispAnalyzer; vector< float > disp_energy_T; - for(unsigned int t = 0; t < fTelX.size(); t++ ) + for( unsigned int t = 0; t < fTelX.size(); t++ ) { disp_energy_T.push_back( E[t] ); } - i_dispAnalyzer.calculateMeanEnergy( disp_energy_T, size, 0); + i_dispAnalyzer.calculateMeanEnergy( disp_energy_T, size, 0 ); Erec = i_dispAnalyzer.getEnergy(); EChi2 = i_dispAnalyzer.getEnergyChi2(); dE = i_dispAnalyzer.getEnergydES(); @@ -839,8 +839,8 @@ void CData::reconstruct_3tel_images_energy() * */ void CData::initialize_3tel_reconstruction( - unsigned long int telescope_combination, - double stereo_reconstruction_min_angle, vector< double > tel_x, vector< double > tel_y, vector< double > tel_z ) + unsigned long int telescope_combination, + double stereo_reconstruction_min_angle, vector< double > tel_x, vector< double > tel_y, vector< double > tel_z ) { fTelescopeCombination = telescope_combination; fStereoMinAngle = stereo_reconstruction_min_angle; diff --git a/src/VDispAnalyzer.cpp b/src/VDispAnalyzer.cpp index 43b20b12..915b8ed6 100644 --- a/src/VDispAnalyzer.cpp +++ b/src/VDispAnalyzer.cpp @@ -779,7 +779,7 @@ void VDispAnalyzer::calculateEnergies( unsigned int i_ntel, { return; } - calculateMeanEnergy(fdisp_energy_T, img_size, img_weight); + calculateMeanEnergy( fdisp_energy_T, img_size, img_weight ); } /* @@ -789,8 +789,8 @@ void VDispAnalyzer::calculateEnergies( unsigned int i_ntel, */ void VDispAnalyzer::calculateMeanEnergy( vector< float >& disp_energy_T, - float *img_size, - double* img_weight) + float* img_size, + double* img_weight ) { vector< double > energy_tel; vector< double > energy_weight; @@ -853,8 +853,8 @@ void VDispAnalyzer::calculateMeanEnergy( } if( energy_tel.size() > 1 ) { - fdisp_energy_chi /= ( (float)energy_tel.size() - 1. ); - fdisp_energy_dEs /= (float)energy_tel.size(); + fdisp_energy_chi /= (( float )energy_tel.size() - 1. ); + fdisp_energy_dEs /= ( float )energy_tel.size(); } else { diff --git a/src/VGammaHadronCuts.cpp b/src/VGammaHadronCuts.cpp index 44aff686..c7cb972e 100644 --- a/src/VGammaHadronCuts.cpp +++ b/src/VGammaHadronCuts.cpp @@ -1406,7 +1406,7 @@ bool VGammaHadronCuts::applyTMVACut( int i ) fTMVA_EvaluationResult = -99.; if( fTMVAEvaluator ) { - bool i_TMVA_Evaluation = fTMVAEvaluator->evaluate(false, true); + bool i_TMVA_Evaluation = fTMVAEvaluator->evaluate( false, true ); fTMVA_EvaluationResult = fTMVAEvaluator->getTMVA_EvaluationResult(); return i_TMVA_Evaluation; } diff --git a/src/VInstrumentResponseFunctionRunParameter.cpp b/src/VInstrumentResponseFunctionRunParameter.cpp index f17ad136..8922c1cd 100644 --- a/src/VInstrumentResponseFunctionRunParameter.cpp +++ b/src/VInstrumentResponseFunctionRunParameter.cpp @@ -551,7 +551,7 @@ bool VInstrumentResponseFunctionRunParameter::readRunParameters( string ifilenam telconfig_arraycentre_X = telconfig->getArrayCentreX(); telconfig_arraycentre_Y = telconfig->getArrayCentreY(); telconfig_arraymax = telconfig->getArrayMaxSize(); - for(unsigned int t = 0; t < telconfig->fChain->GetEntries(); t++ ) + for( unsigned int t = 0; t < telconfig->fChain->GetEntries(); t++ ) { telconfig->GetEntry( t ); telconfig_telx.push_back( telconfig->TelX ); diff --git a/src/VMeanScaledVariables.cpp b/src/VMeanScaledVariables.cpp index 37aa4e60..f1684a41 100644 --- a/src/VMeanScaledVariables.cpp +++ b/src/VMeanScaledVariables.cpp @@ -9,21 +9,21 @@ * Mean reduced scaled variable (e.g. mscw) * */ -double VMeanScaledVariables::mean_reduced_scaled_variable(unsigned int ntel, float *data_value, float *mc_value, float *mc_sigma) +double VMeanScaledVariables::mean_reduced_scaled_variable( unsigned int ntel, float* data_value, float* mc_value, float* mc_sigma ) { - double value = 0.; - double weight = 0; + double value = 0.; + double weight = 0; - if(ntel < 1) - { - return -9999.; - } + if( ntel < 1 ) + { + return -9999.; + } for( unsigned int t = 0; t < ntel; t++ ) { if( mc_value[t] > -90. && mc_sigma[t] > -90. ) { - value += ( data_value[t] - mc_value[t] ) / mc_sigma[t] * (mc_value[t] * mc_value[t]) / ( mc_sigma[t] * mc_sigma[t] ); + value += ( data_value[t] - mc_value[t] ) / mc_sigma[t] * ( mc_value[t] * mc_value[t] ) / ( mc_sigma[t] * mc_sigma[t] ); weight += ( mc_value[t] * mc_value[t] ) / ( mc_sigma[t] * mc_sigma[t] ); } } @@ -34,23 +34,23 @@ double VMeanScaledVariables::mean_reduced_scaled_variable(unsigned int ntel, flo return value / weight; } -double VMeanScaledVariables::mean_reduced_scaled_variable(unsigned int ntel, float *data_value, double *mc_value, double *mc_sigma) +double VMeanScaledVariables::mean_reduced_scaled_variable( unsigned int ntel, float* data_value, double* mc_value, double* mc_sigma ) { float f_mc_value[ntel]; float f_mc_sigma[ntel]; - for(unsigned int t = 0; t < ntel; t++ ) + for( unsigned int t = 0; t < ntel; t++ ) { - f_mc_value[t] = (float)mc_value[t]; - f_mc_sigma[t] = (float)mc_sigma[t]; + f_mc_value[t] = ( float )mc_value[t]; + f_mc_sigma[t] = ( float )mc_sigma[t]; } - return VMeanScaledVariables::mean_reduced_scaled_variable(ntel, data_value, f_mc_value, f_mc_sigma ); + return VMeanScaledVariables::mean_reduced_scaled_variable( ntel, data_value, f_mc_value, f_mc_sigma ); } /* * mean scaled variables (e.g. MWR) * */ -double VMeanScaledVariables::mean_scaled_variable(unsigned int ntel, float *data, float *size, float *mc_value ) +double VMeanScaledVariables::mean_scaled_variable( unsigned int ntel, float* data, float* size, float* mc_value ) { double imr = 0.; double inr = 0.; @@ -70,12 +70,12 @@ double VMeanScaledVariables::mean_scaled_variable(unsigned int ntel, float *data return -9999.; } -double VMeanScaledVariables::mean_scaled_variable(unsigned int ntel, float *data, float *size, double *mc_value ) +double VMeanScaledVariables::mean_scaled_variable( unsigned int ntel, float* data, float* size, double* mc_value ) { float f_mc_value[ntel]; - for(unsigned int t = 0; t < ntel; t++ ) + for( unsigned int t = 0; t < ntel; t++ ) { - f_mc_value[t] = (float)mc_value[t]; + f_mc_value[t] = ( float )mc_value[t]; } - return VMeanScaledVariables::mean_scaled_variable(ntel, data, size, f_mc_value ); + return VMeanScaledVariables::mean_scaled_variable( ntel, data, size, f_mc_value ); } diff --git a/src/VPlotAnasumHistograms.cpp b/src/VPlotAnasumHistograms.cpp index 9c38fdf9..39eb3a9b 100644 --- a/src/VPlotAnasumHistograms.cpp +++ b/src/VPlotAnasumHistograms.cpp @@ -742,13 +742,13 @@ TCanvas* VPlotAnasumHistograms::plot_theta2( double t2min, double t2max, int irb if( containment_lines ) { - TLine *iL_68 = new TLine( t_68, 0., t_68, htheta2_diff->GetMaximum()*0.5); - iL_68->SetLineStyle(2); - iL_68->SetLineColor(2); + TLine *iL_68 = new TLine( t_68, 0., t_68, htheta2_diff->GetMaximum() * 0.5 ); + iL_68->SetLineStyle( 2 ); + iL_68->SetLineColor( 2 ); iL_68->Draw(); - TLine *iL_95 = new TLine( t_95, 0., t_95, htheta2_diff->GetMaximum()*0.5); - iL_95->SetLineStyle(2); - iL_95->SetLineColor(2); + TLine *iL_95 = new TLine( t_95, 0., t_95, htheta2_diff->GetMaximum() * 0.5 ); + iL_95->SetLineStyle( 2 ); + iL_95->SetLineColor( 2 ); iL_95->Draw(); } diff --git a/src/VPlotInstrumentResponseFunction.cpp b/src/VPlotInstrumentResponseFunction.cpp index ad43c92b..b291eacb 100644 --- a/src/VPlotInstrumentResponseFunction.cpp +++ b/src/VPlotInstrumentResponseFunction.cpp @@ -102,7 +102,7 @@ bool VPlotInstrumentResponseFunction::addInstrumentResponseData( string iFile, d iTempIRFReader->setDebug( fDebug ); if( iColor < 0 ) { - iColor = VUtilities::color_id(fData.size() + 1); + iColor = VUtilities::color_id( fData.size() + 1 ); } if( iLineStyle < 0 ) { @@ -1634,12 +1634,12 @@ TCanvas* VPlotInstrumentResponseFunction::plotPSF( vector< double > i_Energy_TeV TH1D* hCumu = get_Cumulative_Histogram( h, true, true ); if( iCumulative ) { - hCumu->SetLineColor( VUtilities::color_id(i+1) ); + hCumu->SetLineColor( VUtilities::color_id( i + 1 ) ); hCumu->Draw( "same" ); } else { - h->SetLineColor( VUtilities::color_id(i+1) ); + h->SetLineColor( VUtilities::color_id( i + 1 ) ); // rebin if( iPlotTheta2 ) { diff --git a/src/VSimpleStereoReconstructor.cpp b/src/VSimpleStereoReconstructor.cpp index 59e55260..0be44692 100644 --- a/src/VSimpleStereoReconstructor.cpp +++ b/src/VSimpleStereoReconstructor.cpp @@ -80,7 +80,7 @@ bool VSimpleStereoReconstructor::reconstruct_direction( unsigned int i_ntel, if( img_weight == 0 ) { - for(unsigned int i = 0; i < i_ntel; i++ ) + for( unsigned int i = 0; i < i_ntel; i++ ) { img_weight[i] = 1.; } @@ -325,7 +325,7 @@ bool VSimpleStereoReconstructor::reconstruct_core( unsigned int i_ntel, if( img_weight == 0 ) { - for(unsigned int i = 0; i < i_ntel; i++ ) + for( unsigned int i = 0; i < i_ntel; i++ ) { img_weight[i] = 1.; } diff --git a/src/VStereoAnalysis.cpp b/src/VStereoAnalysis.cpp index c6477c52..a06cb24c 100644 --- a/src/VStereoAnalysis.cpp +++ b/src/VStereoAnalysis.cpp @@ -244,7 +244,7 @@ int VStereoAnalysis::getDataRunNumber() const } } - gROOT->SetMustClean(false); + gROOT->SetMustClean( false ); exit( EXIT_FAILURE ); return -1; } diff --git a/src/VTMVAEvaluator.cpp b/src/VTMVAEvaluator.cpp index 888e4a84..ca072d4c 100644 --- a/src/VTMVAEvaluator.cpp +++ b/src/VTMVAEvaluator.cpp @@ -2159,7 +2159,7 @@ TGraph* VTMVAEvaluator::fillfromGraph2D( TObject* i_G, double i_ze_min, double i */ void VTMVAEvaluator::calculate_average_zenith_angle() { - if( !fData ) return; + if(!fData ) return; double i_ze = 0.; double i_n = 0.; @@ -2170,10 +2170,10 @@ void VTMVAEvaluator::calculate_average_zenith_angle() Long64_t nEntries = fData->fChain->GetEntries(); if( nEntries > 1 ) { - fData->GetEntry(nEntries/2); + fData->GetEntry( nEntries / 2 ); i_ze += fData->ArrayPointing_Elevation; i_n++; - fData->GetEntry(nEntries-1); + fData->GetEntry( nEntries - 1 ); i_ze += fData->ArrayPointing_Elevation; i_n++; } diff --git a/src/VTableLookup.cpp b/src/VTableLookup.cpp index a7862578..cdc19977 100644 --- a/src/VTableLookup.cpp +++ b/src/VTableLookup.cpp @@ -792,16 +792,16 @@ void VTableLookup::readLookupTable() // set msc value (mean reduced scaled variables) // Note change of interpolation approach with v492.0 // fData->setMSCW( s_N->mscw ); - fData->setMSCW( VMeanScaledVariables::mean_reduced_scaled_variable(s_N->fNTel, fData->getWidth(), s_N->mscw_T, s_N->mscw_Tsigma) ); + fData->setMSCW( VMeanScaledVariables::mean_reduced_scaled_variable( s_N->fNTel, fData->getWidth(), s_N->mscw_T, s_N->mscw_Tsigma ) ); // fData->setMSCL( s_N->mscl ); - fData->setMSCL( VMeanScaledVariables::mean_reduced_scaled_variable(s_N->fNTel, fData->getLength(), s_N->mscl_T, s_N->mscl_Tsigma) ); + fData->setMSCL( VMeanScaledVariables::mean_reduced_scaled_variable( s_N->fNTel, fData->getLength(), s_N->mscl_T, s_N->mscl_Tsigma ) ); fData->setMWR( VMeanScaledVariables::mean_scaled_variable( - s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), - fData->getWidth(), s_N->mscw_T ) ); + s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + fData->getWidth(), s_N->mscw_T ) ); fData->setMLR( VMeanScaledVariables::mean_scaled_variable( - s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), - fData->getLength(), s_N->mscl_T ) ); + s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + fData->getLength(), s_N->mscl_T ) ); // set energy values fData->setEnergy( s_N->energySR, true ); diff --git a/src/VTableLookupDataHandler.cpp b/src/VTableLookupDataHandler.cpp index de2bf8d0..512f2a8c 100644 --- a/src/VTableLookupDataHandler.cpp +++ b/src/VTableLookupDataHandler.cpp @@ -1498,9 +1498,9 @@ bool VTableLookupDataHandler::setOutputFile( string iOutput, string iOption, str fOTree->Branch( "NTelPairs", &fNTelPairs, iTT ); fOTree->Branch( "SizeSecondMax", &fSizeSecondMax, "SizeSecondMax/D" ); -// large storage footprint; not used anywhere -// sprintf( iTT, "fEmissionHeightT[NTelPairs]/F" ); -// fOTree->Branch( "EmissionHeightT", fEmissionHeightT, iTT ); + // large storage footprint; not used anywhere + // sprintf( iTT, "fEmissionHeightT[NTelPairs]/F" ); + // fOTree->Branch( "EmissionHeightT", fEmissionHeightT, iTT ); for( unsigned int i = 0; i < getMaxNbrTel(); i++ ) { fEmissionHeightT[i] = -99.; diff --git a/src/makeEffectiveArea.cpp b/src/makeEffectiveArea.cpp index ce14822b..f8f0dabf 100644 --- a/src/makeEffectiveArea.cpp +++ b/src/makeEffectiveArea.cpp @@ -192,9 +192,9 @@ int main( int argc, char* argv[] ) CData d( c, true, true ); d.initialize_3tel_reconstruction( - fRunPara->fRerunStereoReconstruction_3telescopes, - fRunPara->fRerunStereoReconstruction_minAngle, - fRunPara->telconfig_telx, fRunPara->telconfig_tely, fRunPara->telconfig_telz + fRunPara->fRerunStereoReconstruction_3telescopes, + fRunPara->fRerunStereoReconstruction_minAngle, + fRunPara->telconfig_telx, fRunPara->telconfig_tely, fRunPara->telconfig_telz ); fCuts->setDataTree(&d ); TH1D* hE0mc = ( TH1D* )gDirectory->Get( "hE0mc" ); From efccd679c05ce10b733155b550c7afea87ad6a37 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Mon, 30 Dec 2024 15:35:39 +0100 Subject: [PATCH 31/35] printout fix --- src/VTableLookupRunParameter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VTableLookupRunParameter.cpp b/src/VTableLookupRunParameter.cpp index f3feae6e..3761ab1a 100644 --- a/src/VTableLookupRunParameter.cpp +++ b/src/VTableLookupRunParameter.cpp @@ -574,7 +574,7 @@ void VTableLookupRunParameter::print( int iP ) if( fRerunStereoReconstruction_BDTFileName.size() > 0 ) { cout << "\t reading BDT TMVA files from " << fRerunStereoReconstruction_BDTFileName << endl; - cout << "\t BDT TMVA stereo reconstruction is applied for events with <= "; + cout << "\t BDT TMVA stereo reconstruction is applied for events with: "; if( fmaxdist < 1.e3 ) { cout << "\t BDT TMVA stereo reconstruction distance cut < " << fmaxdist << endl; From 379c4ee0d1e8d90afd90f74f201ecedaf519d1d0 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Tue, 31 Dec 2024 10:14:32 +0100 Subject: [PATCH 32/35] Reset to same value as evndisp --- inc/VGlobalRunParameter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/VGlobalRunParameter.h b/inc/VGlobalRunParameter.h index 9d17bba0..fd35dd86 100644 --- a/inc/VGlobalRunParameter.h +++ b/inc/VGlobalRunParameter.h @@ -21,8 +21,8 @@ ////////////////////////////////////////////////////////////////// // HARDWIRED MAXIMUM NUMBER OF TELESCOPES AND CHANNELS, etc. // (changing anything here means that you have to rerun all stages -// of the analysis again) -#define VDST_MAXTELESCOPES 10 // maximum number of telescopes +// of the analysis (including evndisp) ) +#define VDST_MAXTELESCOPES 100 // maximum number of telescopes #define VDST_MAXTELTYPES 7 // maximum number of telescope types #define VDST_MAXNNGROUPTYPES 6 // maximum number of NN-group types searched in NN-image cleaning #define VDST_MAXCHANNELS 2900 // maximum number of channels per telescopes From 5a4c1ec994bf351a8edeaa123f4c0a9994bbc29a Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Tue, 31 Dec 2024 16:34:41 +0100 Subject: [PATCH 33/35] fix 3-telescope reconstruction (not from recid0) --- inc/VEffectiveAreaCalculatorMCHistograms.h | 4 +- inc/VTableLookupDataHandler.h | 5 +- src/VDispAnalyzer.cpp | 1 + src/VEffectiveAreaCalculatorMCHistograms.cpp | 12 ++++- src/VTableLookup.cpp | 17 ++++--- src/VTableLookupDataHandler.cpp | 52 ++++++++++++++------ src/VTableLookupRunParameter.cpp | 1 - src/mscw_energy.cpp | 3 +- 8 files changed, 64 insertions(+), 31 deletions(-) diff --git a/inc/VEffectiveAreaCalculatorMCHistograms.h b/inc/VEffectiveAreaCalculatorMCHistograms.h index 36bdaa18..de5cb73b 100644 --- a/inc/VEffectiveAreaCalculatorMCHistograms.h +++ b/inc/VEffectiveAreaCalculatorMCHistograms.h @@ -83,7 +83,7 @@ class VEffectiveAreaCalculatorMCHistograms : public TNamed { print(); } - void print(); + void print(bool bTruncate = false); bool readFromEffectiveAreaTree( string iFile ); bool readFromEffectiveAreaFile( string iFile ); bool matchDataVectors( vector< double > iAzMin, vector< double > iAzMax, vector< double > iSpectralIndex ); @@ -95,7 +95,7 @@ class VEffectiveAreaCalculatorMCHistograms : public TNamed void setDefaultValues(); bool setMonteCarloEnergyRange( double iMin, double iMax, double iMCIndex = 2. ); - ClassDef( VEffectiveAreaCalculatorMCHistograms, 13 ); + ClassDef( VEffectiveAreaCalculatorMCHistograms, 14 ); }; #endif diff --git a/inc/VTableLookupDataHandler.h b/inc/VTableLookupDataHandler.h index b195da1b..a3c701cd 100644 --- a/inc/VTableLookupDataHandler.h +++ b/inc/VTableLookupDataHandler.h @@ -300,6 +300,7 @@ class VTableLookupDataHandler // disp related variables float fXoff_edisp; float fYoff_edisp; + float fChi2_edisp; float fXoff_intersect; //! keep direction from intersection method float fYoff_intersect; //! keep direction from intersection method float fXoff_T[VDST_MAXTELESCOPES]; //! direction reconstructed for each telescope @@ -482,8 +483,8 @@ class VTableLookupDataHandler { return fOutFile; } - float* getSize( double iSizeCorrection = 1., bool iSelectedImagesOnly = false ); - float* getSize( double iSizeCorrection, ULong64_t iTelType, bool iSelectedImagesOnly ); + float* getSize( bool iSelectedImagesOnly = false ); + float* getSize( ULong64_t iTelType, bool iSelectedImagesOnly ); double* getWeight() { return fweight; diff --git a/src/VDispAnalyzer.cpp b/src/VDispAnalyzer.cpp index 915b8ed6..d84a6c6f 100644 --- a/src/VDispAnalyzer.cpp +++ b/src/VDispAnalyzer.cpp @@ -506,6 +506,7 @@ void VDispAnalyzer::calculateMeanDispDirection( unsigned int i_ntel, && img_width[i] > fWidth_min && ( img_fitstat[i] < 1 || img_fitstat[i] >= fFitstat_min ) ) { + cout << "NDISP " << i << "\t" << img_size[i] << endl; disp = evaluate(( float )img_width[i], ( float )img_length[i], ( float )img_asym[i], ( float )sqrt( img_cen_x[i] * img_cen_x[i] + img_cen_y[i] * img_cen_y[i] ), ( float )img_size[i], img_pedvar[i], ( float )img_tgrad[i], ( float )img_loss[i], diff --git a/src/VEffectiveAreaCalculatorMCHistograms.cpp b/src/VEffectiveAreaCalculatorMCHistograms.cpp index e764fa81..53e22e79 100644 --- a/src/VEffectiveAreaCalculatorMCHistograms.cpp +++ b/src/VEffectiveAreaCalculatorMCHistograms.cpp @@ -63,7 +63,7 @@ void VEffectiveAreaCalculatorMCHistograms::setDefaultValues() } -void VEffectiveAreaCalculatorMCHistograms::print() +void VEffectiveAreaCalculatorMCHistograms::print( bool bTruncate ) { cout << "VEffectiveAreaCalculatorMCHistograms::print(): found "; cout << fVSpectralIndex.size() << " spectral index bin(s), "; @@ -95,6 +95,16 @@ void VEffectiveAreaCalculatorMCHistograms::print() cout << getHistogram_EmcUnweighted( j )->GetEntries(); } cout << endl; + if( bTruncate ) + { + cout << "\t ...not printing other spectral index bins" << endl; + return; + } + } + if( bTruncate ) + { + cout << "\t ...not printing other spectral index bins" << endl; + return; } } } diff --git a/src/VTableLookup.cpp b/src/VTableLookup.cpp index cdc19977..2a64bc72 100644 --- a/src/VTableLookup.cpp +++ b/src/VTableLookup.cpp @@ -486,12 +486,14 @@ void VTableLookup::setMCTableFiles( string itablefile, string isuff, string iInt - make sure that the same number of zenith, az, NSB tables are given for each telescope type */ -bool VTableLookup::sanityCheckLookupTableFile( bool iPrint ) +bool VTableLookup::sanityCheckLookupTableFile( bool iNoPrint ) { // print a summary of the number of tables found - if( iPrint == false ) + if( iNoPrint == false ) { - cout << "Found " << fTableZe.size() << " zenith angles, " << fTableZeOffset[0].size() << " wobble offsets, " << fTableAzBins << " azimuth bins and " << fTelType_tables[0][0][0].size() << " telescope types" << endl; + cout << "Found " << fTableZe.size() << " zenith angles, "; + cout << fTableZeOffset[0].size() << " wobble offsets, "; + cout << fTableAzBins << " azimuth bins and " << fTelType_tables[0][0][0].size() << " telescope types" << endl; } return true; } @@ -503,7 +505,6 @@ bool VTableLookup::sanityCheckLookupTableFile( bool iPrint ) */ void VTableLookup::loop() { - if( fwrite ) { fillLookupTable(); @@ -567,7 +568,7 @@ void VTableLookup::fillLookupTable() ULong64_t t = iter_i_list_of_Tel_type->first; // This should be already the corrected/scaled size value for MC. - float* i_s = fData->getSize( 1., t, fTLRunParameter->fUseEvndispSelectedImagesOnly ); + float* i_s = fData->getSize( t, fTLRunParameter->fUseEvndispSelectedImagesOnly ); float* i_r = fData->getDistanceToCore( t ); unsigned int i_type = fData->getNTel_type( t ); //////////////////////////////////////////////// @@ -797,10 +798,10 @@ void VTableLookup::readLookupTable() fData->setMSCL( VMeanScaledVariables::mean_reduced_scaled_variable( s_N->fNTel, fData->getLength(), s_N->mscl_T, s_N->mscl_Tsigma ) ); fData->setMWR( VMeanScaledVariables::mean_scaled_variable( - s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + s_N->fNTel, fData->getSize( fTLRunParameter->fUseEvndispSelectedImagesOnly ), fData->getWidth(), s_N->mscw_T ) ); fData->setMLR( VMeanScaledVariables::mean_scaled_variable( - s_N->fNTel, fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + s_N->fNTel, fData->getSize( fTLRunParameter->fUseEvndispSelectedImagesOnly ), fData->getLength(), s_N->mscl_T ) ); // set energy values @@ -1263,7 +1264,7 @@ void VTableLookup::calculateMSFromTables( VTablesToRead* s, double esys ) } double i_dummy = 0.; - float* i_s = fData->getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ); + float* i_s = fData->getSize( fTLRunParameter->fUseEvndispSelectedImagesOnly ); f_calc_msc->setCalculateEnergies( false ); /////////////////// diff --git a/src/VTableLookupDataHandler.cpp b/src/VTableLookupDataHandler.cpp index 512f2a8c..33e72674 100644 --- a/src/VTableLookupDataHandler.cpp +++ b/src/VTableLookupDataHandler.cpp @@ -603,7 +603,7 @@ int VTableLookupDataHandler::fillNextEvent( bool bShort ) getNTel(), fArrayPointing_Elevation, fArrayPointing_Azimuth, fTel_type, - getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + getSize( true ), fcen_x, fcen_y, fcosphi, fsinphi, fwidth, flength, @@ -643,6 +643,7 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) // save original values fXoff_edisp = fXoff; fYoff_edisp = fYoff; + fChi2_edisp = fchi2; /////////////////////////// // stereo reconstruction // (equivalent to rcs_method4) @@ -651,7 +652,7 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) i_SR.reconstruct_direction( getNTel(), fArrayPointing_Elevation, fArrayPointing_Azimuth, fTelX, fTelY, fTelZ, - getSize( 1., bSelectedImagesOnly ), + getSize( bSelectedImagesOnly ), fcen_x, fcen_y, fcosphi, fsinphi, fwidth, flength, @@ -660,14 +661,15 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) // (used also as seed values for DispAnalyzers) fXoff_intersect = i_SR.fShower_Xoffset; fYoff_intersect = i_SR.fShower_Yoffset; + fchi2 = i_SR.fShower_Chi2; // fall back to original eventdisplay results in case // simple reconstructor fails - if(( fXoff_intersect < -999. || fYoff_intersect < -999. ) - && fchi2 >= 0 && isReconstructed() ) + if(( fXoff_intersect < -999. || fYoff_intersect < -999. ) && fChi2_edisp >= 0 ) { fXoff_intersect = fXoff_edisp; fYoff_intersect = fYoff_edisp; + fchi2 = fChi2_edisp; } //////////////////////////////////////////////////////////////////// @@ -685,7 +687,7 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) getNTel(), fArrayPointing_Elevation, fArrayPointing_Azimuth, fTel_type, - getSize( 1., bSelectedImagesOnly ), + getSize( bSelectedImagesOnly ), fcen_x, fcen_y, fcosphi, fsinphi, fwidth, flength, @@ -705,7 +707,7 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) getNTel(), fArrayPointing_Elevation, fArrayPointing_Azimuth, fTel_type, - getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + getSize( bSelectedImagesOnly ), fcen_x, fcen_y, fcosphi, fsinphi, fwidth, flength, @@ -731,7 +733,7 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) getNTel(), fArrayPointing_Elevation, fArrayPointing_Azimuth, fTel_type, - getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ), + getSize( bSelectedImagesOnly ), fcen_x, fcen_y, fcosphi, fsinphi, fwidth, flength, @@ -756,6 +758,7 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) i_SR.fillShowerDirection( fXoff, fYoff ); fnxyoff = fDispAnalyzerDirection->getXYWeight_disp().size(); fNImages = ( int )fnxyoff; + for( unsigned int t = 0; t < fnxyoff; t++ ) { fXoff_T[t] = fDispAnalyzerDirection->getXcoordinate_disp( t ); @@ -816,7 +819,7 @@ void VTableLookupDataHandler::doStereoReconstruction( bool bSelectedImagesOnly ) fArrayPointing_Elevation, fArrayPointing_Azimuth, fXoff, fYoff, fTelX, fTelY, fTelZ, - getSize( 1., bSelectedImagesOnly ), + getSize( bSelectedImagesOnly ), fcen_x, fcen_y, fcosphi, fsinphi, fwidth, flength, @@ -1973,7 +1976,7 @@ void VTableLookupDataHandler::copyMCHistograms() if( iMC_his && fOutFile ) { cout << "\t writing MC histograms" << endl; - iMC_his->print(); + iMC_his->print(true); fOutFile->cd(); iMC_his->Write(); } @@ -2015,6 +2018,7 @@ void VTableLookupDataHandler::reset() fYoff_intersect = -99.; fXoff_edisp = -99.; fYoff_edisp = -99.; + fChi2_edisp = -999.; fXcore = -9999.; fYcore = -9999.; fstdP = -99.; @@ -2266,6 +2270,7 @@ void VTableLookupDataHandler::resetAll() fYoff_intersect = 0.; fXoff_edisp = 0.; fYoff_edisp = 0.; + fChi2_edisp = 0.; fstdS = 0.; ftheta2 = 0.; fXcore = 0.; @@ -2351,6 +2356,7 @@ void VTableLookupDataHandler::resetAll() fYoff_intersect = 0.; fXoff_edisp = 0.; fYoff_edisp = 0.; + fChi2_edisp = 0.; // cut efficiency counter fNStats_All = 0; @@ -2556,21 +2562,23 @@ float* VTableLookupDataHandler::getDistanceToCore( ULong64_t iTelType ) * used for table filling only * */ -float* VTableLookupDataHandler::getSize( double iSizeCorrection, bool iSelectedImagesOnly ) +float* VTableLookupDataHandler::getSize( bool iSelectedImagesOnly ) { for( unsigned int i = 0; i < getNTel(); i++ ) { if( iSelectedImagesOnly && !fImgSel_list[i] ) { fsizeCorr[i] = -99.; - continue; } - fsizeCorr[i] = fsize[i] * iSizeCorrection; + else + { + fsizeCorr[i] = fsize[i]; + } } return fsizeCorr; } -float* VTableLookupDataHandler::getSize( double iSizeCorrection, ULong64_t iTelType, bool iSelectedImagesOnly ) +float* VTableLookupDataHandler::getSize( ULong64_t iTelType, bool iSelectedImagesOnly ) { unsigned int z = 0; for( unsigned int i = 0; i < getNTel(); i++ ) @@ -2583,7 +2591,7 @@ float* VTableLookupDataHandler::getSize( double iSizeCorrection, ULong64_t iTel z++; continue; } - fsize_telType[z] = fsize[i] * iSizeCorrection; + fsize_telType[z] = fsize[i]; z++; } } @@ -2721,13 +2729,24 @@ float VTableLookupDataHandler::getArrayPointingDeRotationAngle() */ void VTableLookupDataHandler::fill_selected_images_before_redo_stereo_reconstruction() { - float* tmp_size = getSize( 1., fTLRunParameter->fUseEvndispSelectedImagesOnly ); + float* tmp_size = getSize( fTLRunParameter->fUseEvndispSelectedImagesOnly ); unsigned int ii = 0; fImgSel = 0; bitset<8 * sizeof(unsigned long )> i_nimage; + bool i_analyse_telescope = false; for( unsigned int i = 0; i < getNTel(); i++ ) { - if( tmp_size[i] > 0. && flength[i] > 0. && fntubes[i] > fTLRunParameter->fminntubes && fArrayPointing_Elevation > 0. + i_analyse_telescope = false; + for( unsigned int t = 0; t < fTLRunParameter->fTelToAnalyse.size(); t++ ) + { + if( i == fTLRunParameter->fTelToAnalyse[t] ) + { + i_analyse_telescope = true; + break; + } + } + if( i_analyse_telescope && + tmp_size[i] > 0. && flength[i] > 0. && fntubes[i] > fTLRunParameter->fminntubes && fArrayPointing_Elevation > 0. && sqrt( fcen_x[i]*fcen_x[i] + fcen_y[i]*fcen_y[i] ) < fTLRunParameter->fmaxdist && floss[i] < fTLRunParameter->fmaxloss && ffui[i] > fTLRunParameter->fminfui ) @@ -2745,4 +2764,5 @@ void VTableLookupDataHandler::fill_selected_images_before_redo_stereo_reconstruc } } fImgSel = i_nimage.to_ulong(); + fNImages = i_nimage.count(); } diff --git a/src/VTableLookupRunParameter.cpp b/src/VTableLookupRunParameter.cpp index 3761ab1a..776c3ead 100644 --- a/src/VTableLookupRunParameter.cpp +++ b/src/VTableLookupRunParameter.cpp @@ -574,7 +574,6 @@ void VTableLookupRunParameter::print( int iP ) if( fRerunStereoReconstruction_BDTFileName.size() > 0 ) { cout << "\t reading BDT TMVA files from " << fRerunStereoReconstruction_BDTFileName << endl; - cout << "\t BDT TMVA stereo reconstruction is applied for events with: "; if( fmaxdist < 1.e3 ) { cout << "\t BDT TMVA stereo reconstruction distance cut < " << fmaxdist << endl; diff --git a/src/mscw_energy.cpp b/src/mscw_energy.cpp index 6f40dd13..33dfb6aa 100644 --- a/src/mscw_energy.cpp +++ b/src/mscw_energy.cpp @@ -71,7 +71,8 @@ int main( int argc, char* argv[] ) cout << "mscw_energy (" << fTLRunParameter->getEVNDISP_VERSION() << ")" << endl; cout << "=======================" << endl; cout << endl; - cout << "calculation of mean scaled width and length, and energy with lookup tables" << endl; + cout << "calculation of mean scaled width and length, and energy with lookup tables." << endl; + cout << "Stereo reconstruction for direction, core, and energy with dispBDTs." << endl; cout << "--------------------------------------------------------------------------" << endl; cout << endl; From 38b63752ceb9f0299e86abdabd9fb686b63b8378 Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Tue, 31 Dec 2024 16:42:19 +0100 Subject: [PATCH 34/35] printout --- inc/VEffectiveAreaCalculatorMCHistograms.h | 4 ++-- src/VDispAnalyzer.cpp | 1 - src/VEffectiveAreaCalculatorMCHistograms.cpp | 5 ----- src/VTableLookupDataHandler.cpp | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/inc/VEffectiveAreaCalculatorMCHistograms.h b/inc/VEffectiveAreaCalculatorMCHistograms.h index de5cb73b..6234a34c 100644 --- a/inc/VEffectiveAreaCalculatorMCHistograms.h +++ b/inc/VEffectiveAreaCalculatorMCHistograms.h @@ -83,7 +83,7 @@ class VEffectiveAreaCalculatorMCHistograms : public TNamed { print(); } - void print(bool bTruncate = false); + void print( bool bTruncate = false ); bool readFromEffectiveAreaTree( string iFile ); bool readFromEffectiveAreaFile( string iFile ); bool matchDataVectors( vector< double > iAzMin, vector< double > iAzMax, vector< double > iSpectralIndex ); @@ -95,7 +95,7 @@ class VEffectiveAreaCalculatorMCHistograms : public TNamed void setDefaultValues(); bool setMonteCarloEnergyRange( double iMin, double iMax, double iMCIndex = 2. ); - ClassDef( VEffectiveAreaCalculatorMCHistograms, 14 ); + ClassDef( VEffectiveAreaCalculatorMCHistograms, 13 ); }; #endif diff --git a/src/VDispAnalyzer.cpp b/src/VDispAnalyzer.cpp index d84a6c6f..915b8ed6 100644 --- a/src/VDispAnalyzer.cpp +++ b/src/VDispAnalyzer.cpp @@ -506,7 +506,6 @@ void VDispAnalyzer::calculateMeanDispDirection( unsigned int i_ntel, && img_width[i] > fWidth_min && ( img_fitstat[i] < 1 || img_fitstat[i] >= fFitstat_min ) ) { - cout << "NDISP " << i << "\t" << img_size[i] << endl; disp = evaluate(( float )img_width[i], ( float )img_length[i], ( float )img_asym[i], ( float )sqrt( img_cen_x[i] * img_cen_x[i] + img_cen_y[i] * img_cen_y[i] ), ( float )img_size[i], img_pedvar[i], ( float )img_tgrad[i], ( float )img_loss[i], diff --git a/src/VEffectiveAreaCalculatorMCHistograms.cpp b/src/VEffectiveAreaCalculatorMCHistograms.cpp index 53e22e79..da4bf4f7 100644 --- a/src/VEffectiveAreaCalculatorMCHistograms.cpp +++ b/src/VEffectiveAreaCalculatorMCHistograms.cpp @@ -95,11 +95,6 @@ void VEffectiveAreaCalculatorMCHistograms::print( bool bTruncate ) cout << getHistogram_EmcUnweighted( j )->GetEntries(); } cout << endl; - if( bTruncate ) - { - cout << "\t ...not printing other spectral index bins" << endl; - return; - } } if( bTruncate ) { diff --git a/src/VTableLookupDataHandler.cpp b/src/VTableLookupDataHandler.cpp index 33e72674..3b3f5bfb 100644 --- a/src/VTableLookupDataHandler.cpp +++ b/src/VTableLookupDataHandler.cpp @@ -1976,7 +1976,7 @@ void VTableLookupDataHandler::copyMCHistograms() if( iMC_his && fOutFile ) { cout << "\t writing MC histograms" << endl; - iMC_his->print(true); + iMC_his->print( true ); fOutFile->cd(); iMC_his->Write(); } From 41dfe1e5dff004f33095c8deb933a4fa5049afdd Mon Sep 17 00:00:00 2001 From: GernotMaier Date: Wed, 1 Jan 2025 16:24:06 +0100 Subject: [PATCH 35/35] correct default value --- src/CData.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CData.cpp b/src/CData.cpp index 13f0789d..15a26102 100644 --- a/src/CData.cpp +++ b/src/CData.cpp @@ -642,7 +642,7 @@ void CData::reconstruct_3tel_images( unsigned long int telescope_combination ) UInt_t tel_list[VDST_MAXTELESCOPES]; for( unsigned int i = 0; i < VDST_MAXTELESCOPES; i++ ) { - tel_list[i] = 9999; + tel_list[i] = -9999; } unsigned int z = 0; for( int i = 0; i < NImages; i++ ) @@ -784,7 +784,7 @@ void CData::reconstruct_3tel_images_direction() DispAbsSumWeigth = i_dispAnalyzer.get_abs_sum_disp_weight(); DispDiff = Chi2 = dispdiff; - // Average/min angle between images not updated. TODO + // Average/min angle between images not updated. // approximiation for events which are reduced to 2-tel images; // the cut on the minimal angle between images is not applied. img2_ang = -9999.;