Commit 21a47681 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (TrkExExample-00-02-23)

parent dc8a8988
################################################################################
# Package: TrkExExample
################################################################################
# Declare the package name:
atlas_subdir( TrkExExample )
# Install files from the package:
atlas_install_joboptions( share/*.py )
package TrkExExample
manager Andreas Salzburger <Andreas.Salzburger@cern.ch>
use AtlasPolicy AtlasPolicy-*
use AtlasReconstructionRunTime AtlasReconstructionRunTime-*
branches run share
apply_pattern declare_joboptions files="*.py"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage The TrkExExample package
This is a run package that provides jobOption files for the execution of Algorithms that are
located in the TrkExAlgs package.
@section TrkExExampleIntroduction Introduction
This package is mainly ment for validaiton purposes, it contains a simple self-consistency
extrapolation test (ExtrapolationValidation) and a numerical check of the calculated jacobian
matrices used in the various propagation tools (RiddersAlgorithm).
@author Andreas.Salzburger@cern.ch
@section requirements Requirements
The libaray type is a pure component library.
@include requirements
*/
/**
\namespace Trk
A namespace to enclose the new Track class, and related tools.
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
void ExtrapolationValidation(const TString& fileName)
{
//================ Trying out the style ===================/
TStyle *plain = new TStyle("Plain","Plain Style (no colors/fill areas)");
// Canvas
plain->SetCanvasBorderMode(0);
plain->SetCanvasColor(0);
// Pad
plain->SetPadBorderMode(0);
plain->SetPadColor(0);
// Title
plain->SetTitleColor(0);
plain->SetTitleBorderSize(0);
plain->SetTitleX(0.25);
plain->SetTitleY(0.98);
// Stat
//plain->SetStatColor(1);
//plain->SetOptStat(0);
// Labelling
plain->SetLabelFont(132, "XY");
plain->SetLabelSize(0.05, "XY");
// Lines
//plain->SetLineWidth(0.5);
gROOT->SetStyle("Plain");
// =======================================================/
// get the file
TFile* file = TFile::Open(fileName, "READ");
// get the tree
TTree* tree = file ? file->Get("ExtrapolationValidation") : 0;
if (tree){
// draw the canvs
TCanvas* parameterCanvas = new TCanvas("parametersCanvas", "Parameter differences", 100, 100, 600, 920);
parameterCanvas->Divide(2,3);
// local 1
parameterCanvas->cd(1);
tree->Draw("(ParametersLoc1[0]-ParametersLoc1[3])>>loc1(100,-0.01,0.01)","Parameters==4");
TH1F* loc1 = (TH1F*)gDirectory->Get("loc1");
loc1->Draw();
parameterCanvas->GetPad(1)->SetLogy();
parameterCanvas->GetPad(1)->SetGridy();
// local 2
parameterCanvas->cd(2);
tree->Draw("(ParametersLoc2[0]-ParametersLoc2[3])>>loc2(100,-0.01,0.01)","Parameters==4");
TH1F* loc2 = (TH1F*)gDirectory->Get("loc2");
loc2->Draw();
parameterCanvas->GetPad(2)->SetLogy();
parameterCanvas->GetPad(2)->SetGridy();
// phi
parameterCanvas->cd(3);
tree->Draw("(ParametersPhi[0]-ParametersPhi[3])/ParametersPhi[0]>>phi(100,-0.001,0.001)","Parameters==4");
TH1F* phi = (TH1F*)gDirectory->Get("phi");
phi->Draw();
parameterCanvas->GetPad(3)->SetLogy();
parameterCanvas->GetPad(3)->SetGridy();
// theta
parameterCanvas->cd(4);
tree->Draw("(ParametersTheta[0]-ParametersTheta[3])/ParametersTheta[0]>>theta(100,-0.001,0.001)","Parameters==4");
TH1F* theta = (TH1F*)gDirectory->Get("theta");
theta->Draw();
parameterCanvas->GetPad(4)->SetLogy();
parameterCanvas->GetPad(4)->SetGridy();
// q/p
parameterCanvas->cd(5);
tree->Draw("(ParametersQoverP[0]-ParametersQoverP[3])/ParametersQoverP[0]>>qop(100,-0.001,0.001)","Parameters==4");
TH1F* qop = (TH1F*)gDirectory->Get("qop");
qop->Draw();
parameterCanvas->GetPad(5)->SetLogy();
parameterCanvas->GetPad(5)->SetGridy();
// draw the canvs
TCanvas* statCanvas = new TCanvas("statCanvas", "Track statistics", 400, 400, 600, 920);
statCanvas->Divide(1,3);
// momentum distribution
statCanvas->cd(1);
tree->Draw("StartMomentum","Parameters==4");
statCanvas->cd(2);
tree->Draw("sqrt(DestinationSurfaceR*DestinationSurfaceR+DestinationSurfaceZ*DestinationSurfaceZ)","Parameters==4");
statCanvas->cd(3);
tree->Draw("abs(sqrt(DestinationSurfaceR*DestinationSurfaceR+DestinationSurfaceZ*DestinationSurfaceZ)-sqrt(StartSurfaceR*StartSurfaceR+StartSurfaceZ*StartSurfaceZ))","Parameters==4");
}
}
\ No newline at end of file
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#define RiddersTree_cxx
#include "RiddersTree.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TStyle.h>
#include <iostream>
TH1F* RiddersTree::Loop(TString& histName, int bins, int low, int high, int entries,
bool loc1, bool loc2, bool phi, bool theta, bool qop, bool relAbs)
{
//================ Trying out the style ===================/
TStyle *plain = new TStyle("Plain","Plain Style (no colors/fill areas)");
// Canvas
plain->SetCanvasBorderMode(0);
plain->SetCanvasColor(0);
// Pad
plain->SetPadBorderMode(0);
plain->SetPadColor(0);
// Title
plain->SetTitleColor(0);
plain->SetTitleBorderSize(0);
plain->SetTitleX(0.25);
plain->SetTitleY(0.98);
// Stat
//plain->SetStatColor(1);
//plain->SetOptStat(0);
// Labelling
plain->SetLabelFont(132, "XY");
plain->SetLabelSize(0.05, "XY");
// Lines
//plain->SetLineWidth(0.5);
gROOT->SetStyle("Plain");
// =======================================================/
if (fChain == 0) return 0;
Long64_t nentries = (!entries) ? fChain->GetEntriesFast() : entries;
TH1F* relErrorLog = new TH1F(histName, "-log(#Delta C/C_{num})", bins, low,high);
int draw = relAbs ? 8 : 6;
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 (RiddersSteps < 10){
if (loc1 && Loc1Loc1[draw]>0.) relErrorLog->Fill(Loc1Loc1[draw]);
if (loc1 && Loc1Loc2[draw]>0.) relErrorLog->Fill(Loc1Loc2[draw]);
if (loc1 && Loc1Phi[draw]>0.) relErrorLog->Fill(Loc1Phi[draw]);
if (loc1 && Loc1Theta[draw]>0.) relErrorLog->Fill(Loc1Theta[draw]);
if (loc1 && Loc1qOp[draw]>0.) relErrorLog->Fill(Loc1qOp[draw]);
if (loc2 && Loc2Loc1[draw]>0.) relErrorLog->Fill(Loc2Loc1[draw]);
if (loc2 && Loc2Loc2[draw]>0.) relErrorLog->Fill(Loc2Loc2[draw]);
if (loc2 && Loc2Phi[draw]>0.) relErrorLog->Fill(Loc2Phi[draw]);
if (loc2 && Loc2Theta[draw]>0.) relErrorLog->Fill(Loc2Theta[draw]);
if (loc2 && Loc2qOp[draw]>0.) relErrorLog->Fill(Loc2qOp[draw]);
if (phi && PhiLoc1[draw]>0.) relErrorLog->Fill(PhiLoc1[draw]);
if (phi && PhiLoc2[draw]>0.) relErrorLog->Fill(PhiLoc2[draw]);
if (phi && PhiPhi[draw]>0.) relErrorLog->Fill(PhiPhi[draw]);
if (phi && PhiTheta[draw]>0.) relErrorLog->Fill(PhiTheta[draw]);
if (phi && PhiqOp[draw]>0.) relErrorLog->Fill(PhiqOp[draw]);
if (theta && ThetaLoc1[draw]>0.) relErrorLog->Fill(ThetaLoc1[draw]);
if (theta && ThetaLoc2[draw]>0.) relErrorLog->Fill(ThetaLoc2[draw]);
if (theta && ThetaPhi[draw]>0.) relErrorLog->Fill(ThetaPhi[draw]);
if (theta && ThetaTheta[draw]>0.) relErrorLog->Fill(ThetaTheta[draw]);
if (theta && ThetaqOp[draw]>0.) relErrorLog->Fill(ThetaqOp[draw]);
if (qop && QopLoc1[draw]>0.) relErrorLog->Fill(QopLoc1[draw]);
if (qop && QopLoc2[draw]>0.) relErrorLog->Fill(QopLoc2[draw]);
if (qop && QopPhi[draw]>0.) relErrorLog->Fill(QopPhi[draw]);
if (qop && QopTheta[draw]>0.) relErrorLog->Fill(QopTheta[draw]);
if (qop && QopqOp[draw]>0.) relErrorLog->Fill(QopqOp[draw]);
}
}
return relErrorLog;
}
RiddersTree::RiddersTree(TString& fileName, TString& treeName)
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
TFile* file = TFile::Open(fileName);
file = file ? file : (TFile*)gROOT->GetListOfFiles()->FindObject(fileName);
TTree* tree = file ? (TTree*)file->Get(treeName) : 0;
if (tree) {
Init(tree);
std::cout << "[m] Tree " << tree->GetName() << " sucessfully initialized!" << std::endl;
} else
std::cout << "[m] Tree could not be loaded. Loop() method not safe!" << std::endl;
}
RiddersTree::~RiddersTree()
{
if (!fChain) return;
delete fChain->GetCurrentFile();
}
Int_t RiddersTree::GetEntry(Long64_t entry)
{
// Read contents of entry.
if (!fChain) return 0;
return fChain->GetEntry(entry);
}
Long64_t RiddersTree::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 RiddersTree::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 normaly 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);
fChain->SetBranchAddress("RiddersSteps", &RiddersSteps, &b_steps);
fChain->SetBranchAddress("Loc1Loc1", Loc1Loc1, &b_Loc1Loc1);
fChain->SetBranchAddress("Loc1Loc2", Loc1Loc2, &b_Loc1Loc2);
fChain->SetBranchAddress("Loc1Phi", Loc1Phi, &b_Loc1Phi);
fChain->SetBranchAddress("Loc1Theta", Loc1Theta, &b_Loc1Theta);
fChain->SetBranchAddress("Loc1qOp", Loc1qOp, &b_Loc1qOp);
fChain->SetBranchAddress("Loc1Steps", Loc1Steps, &b_Loc1Steps);
fChain->SetBranchAddress("Loc2Loc1", Loc2Loc1, &b_Loc2Loc1);
fChain->SetBranchAddress("Loc2Loc2", Loc2Loc2, &b_Loc2Loc2);
fChain->SetBranchAddress("Loc2Phi", Loc2Phi, &b_Loc2Phi);
fChain->SetBranchAddress("Loc2Theta", Loc2Theta, &b_Loc2Theta);
fChain->SetBranchAddress("Loc2qOp", Loc2qOp, &b_Loc2qOp);
fChain->SetBranchAddress("Loc2Steps", Loc2Steps, &b_Loc2Steps);
fChain->SetBranchAddress("PhiLoc1", PhiLoc1, &b_PhiLoc1);
fChain->SetBranchAddress("PhiLoc2", PhiLoc2, &b_PhiLoc2);
fChain->SetBranchAddress("PhiPhi", PhiPhi, &b_PhiPhi);
fChain->SetBranchAddress("PhiTheta", PhiTheta, &b_PhiTheta);
fChain->SetBranchAddress("PhiqOp", PhiqOp, &b_PhiqOp);
fChain->SetBranchAddress("PhiSteps", PhiSteps, &b_PhiSteps);
fChain->SetBranchAddress("ThetaLoc1", ThetaLoc1, &b_ThetaLoc1);
fChain->SetBranchAddress("ThetaLoc2", ThetaLoc2, &b_ThetaLoc2);
fChain->SetBranchAddress("ThetaPhi", ThetaPhi, &b_ThetaPhi);
fChain->SetBranchAddress("ThetaTheta", ThetaTheta, &b_ThetaTheta);
fChain->SetBranchAddress("ThetaqOp", ThetaqOp, &b_ThetaqOp);
fChain->SetBranchAddress("ThetaSteps", ThetaSteps, &b_ThetaSteps);
fChain->SetBranchAddress("QopLoc1", QopLoc1, &b_QopLoc1);
fChain->SetBranchAddress("QopLoc2", QopLoc2, &b_QopLoc2);
fChain->SetBranchAddress("QopPhi", QopPhi, &b_QopPhi);
fChain->SetBranchAddress("QopTheta", QopTheta, &b_QopTheta);
fChain->SetBranchAddress("QopqOp", QopqOp, &b_QopqOp);
fChain->SetBranchAddress("QopSteps", QopSteps, &b_QopSteps);
Notify();
}
Bool_t RiddersTree::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 normaly 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 RiddersTree::Show(Long64_t entry)
{
// Print contents of entry.
// If entry is not specified, print current entry
if (!fChain) return;
fChain->Show(entry);
}
Int_t RiddersTree::Cut(Long64_t entry)
{
// This function may be called from Loop.
// returns 1 if entry is accepted.
// returns -1 otherwise.
return 1;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Thu May 31 13:59:15 2007 by ROOT version 5.15/06
// from TTree RiddersTree/Output of the RiddersAlgorithm
// found on file: RiddersAlgorithm_Sl.root
//////////////////////////////////////////////////////////
#ifndef RiddersTree_h
#define RiddersTree_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TH1F.h>
class RiddersTree {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
Int_t fCurrent; //!current Tree number in a TChain
// Declaration of leave types
Int_t RiddersSteps;
Float_t Loc1Loc1[9]; //[steps]
Float_t Loc1Loc2[9]; //[steps]
Float_t Loc1Phi[9]; //[steps]
Float_t Loc1Theta[9]; //[steps]
Float_t Loc1qOp[9]; //[steps]
Float_t Loc1Steps[9]; //[steps]
Float_t Loc2Loc1[9]; //[steps]
Float_t Loc2Loc2[9]; //[steps]
Float_t Loc2Phi[9]; //[steps]
Float_t Loc2Theta[9]; //[steps]
Float_t Loc2qOp[9]; //[steps]
Float_t Loc2Steps[9]; //[steps]
Float_t PhiLoc1[9]; //[steps]
Float_t PhiLoc2[9]; //[steps]
Float_t PhiPhi[9]; //[steps]
Float_t PhiTheta[9]; //[steps]
Float_t PhiqOp[9]; //[steps]
Float_t PhiSteps[9]; //[steps]
Float_t ThetaLoc1[9]; //[steps]
Float_t ThetaLoc2[9]; //[steps]
Float_t ThetaPhi[9]; //[steps]
Float_t ThetaTheta[9]; //[steps]
Float_t ThetaqOp[9]; //[steps]
Float_t ThetaSteps[9]; //[steps]
Float_t QopLoc1[9]; //[steps]
Float_t QopLoc2[9]; //[steps]
Float_t QopPhi[9]; //[steps]
Float_t QopTheta[9]; //[steps]
Float_t QopqOp[9]; //[steps]
Float_t QopSteps[9]; //[steps]
// List of branches
TBranch *b_steps; //!
TBranch *b_Loc1Loc1; //!
TBranch *b_Loc1Loc2; //!
TBranch *b_Loc1Phi; //!
TBranch *b_Loc1Theta; //!
TBranch *b_Loc1qOp; //!
TBranch *b_Loc1Steps; //!
TBranch *b_Loc2Loc1; //!
TBranch *b_Loc2Loc2; //!
TBranch *b_Loc2Phi; //!
TBranch *b_Loc2Theta; //!
TBranch *b_Loc2qOp; //!
TBranch *b_Loc2Steps; //!
TBranch *b_PhiLoc1; //!
TBranch *b_PhiLoc2; //!
TBranch *b_PhiPhi; //!
TBranch *b_PhiTheta; //!
TBranch *b_PhiqOp; //!
TBranch *b_PhiSteps; //!
TBranch *b_ThetaLoc1; //!
TBranch *b_ThetaLoc2; //!
TBranch *b_ThetaPhi; //!
TBranch *b_ThetaTheta; //!
TBranch *b_ThetaqOp; //!
TBranch *b_ThetaSteps; //!
TBranch *b_QopLoc1; //!
TBranch *b_QopLoc2; //!
TBranch *b_QopPhi; //!
TBranch *b_QopTheta; //!
TBranch *b_QopqOp; //!
TBranch *b_QopSteps; //!
RiddersTree(TString& fileName, TString& treeName);
virtual ~RiddersTree();
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 TH1F* Loop(TString& histName, int bins, int low, int high, int entries=0,
bool loc1=true, bool loc2=true, bool phi=true, bool theta=true, bool qop=true, bool relAbs=true);
virtual Bool_t Notify();
virtual void Show(Long64_t entry = -1);
};
#endif
###############################################################
#
# Job options file fro the ExtrapolatorTest Algorithm
#
#==============================================================
#theApp.setup( MONTECARLO )
include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
# Global Flags to be set ######################################
varInit=dir()
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
# some very general flags, EvtMax, SkipEvents, PoolESDInput etc...
include ("AthenaCommon/AthenaCommonFlags.py")
# prevent this file to be included a second time
include.block("AthenaCommon/AthenaCommonFlags.py")
if 'GlobalFlags' in varInit:
print "GlobalFlags already imported:"
else:
from AthenaCommon.GlobalFlags import GlobalFlags
GlobalFlags.DetGeo.set_atlas()
#GlobalFlags.DetGeo._beenSet = True
#GlobalFlags.DetGeo._flag_ctbh8 = True
GlobalFlags.DataSource._beenSet = True
GlobalFlags.DataSource._flag_geant4 = True
#--- Detector flags -------------------------------------------
from AthenaCommon.DetFlags import DetFlags
# - Select detectors
DetFlags.ID_setOff()
DetFlags.Calo_setOff()
DetFlags.Muon_setOn()
TrkCaloGeo = False
###############################################################
# Layout
DetDescrVersion = "ATLAS-CSC-02-00-00"
# needed for condDB setup
# TC: condDB is configured by GeoModel
#include( "IOVDbSvc/IOVRecExCommon.py" )
include( "AtlasGeoModel/SetGeometryVersion.py" )
include( "AtlasGeoModel/GeoModelInit.py" )
################################################################
# Number of events to be processed
theApp.EvtMax = 1
MessageSvc = Service( "MessageSvc" )
MessageSvc.OutputLevel = 3
MessageSvc.defaultLimit = 1000000
MessageSvc.Format = "% F%37W%S%7W%R%T %0W%M"
################################################################
# load the AtlasExtrapolator
include("TrkExExample/CombinedExtrapolator.py")
ToolSvc.MuonTrackingGeometryBuilder.BuildActiveMaterial = True
ToolSvc.MuonTrackingGeometryBuilder.BuildInertMaterial = True
#ToolSvc.MuonTrackingGeometryBuilder.BlendInertMaterial = False
ToolSvc.MuonTrackingGeometryBuilder.StaticPartition3D = True
ToolSvc.MuonTrackingGeometryBuilder.AdjustStatic = True
#ToolSvc.MuonTrackingGeometryBuilder.EtaBarrelPartitions = 1
#ToolSvc.MuonTrackingGeometryBuilder.EtaInnerEndcapPartitions = 1
#ToolSvc.MuonTrackingGeometryBuilder.EtaOuterEndcapPartitions = 1
#ToolSvc.MuonTrackingGeometryBuilder.PhiPartitions = 1
ToolSvc.MuonInertMaterialBuilder.OutputLevel = VERBOSE
ToolSvc.MuonInertMaterialBuilder.SimplifyGeometry = True
ToolSvc.MuonInertMaterialBuilder.SimplifyGeometryToLayers = False
#ToolSvc.MuonInertMaterialBuilder.BuildRails = 1
ToolSvc.CombinedExtrapolator.OutputLevel = VERBOSE
ToolSvc.AtlasSTEP_Propagator.MultipleScattering = True
from TrkExAlgs.TrkExAlgsConf import Trk__CETmaterial
CETmaterial = Trk__CETmaterial('CETmaterial')
CETmaterial.Extrapolator = CombinedExtrapolator
CETmaterial.NumberOfScanTracks = 360
CETmaterial.StartPerigeeMinZ0 = 0.
CETmaterial.StartPerigeeMaxZ0 = 0.
CETmaterial.StartPerigeeMinTheta = 75.*deg
CETmaterial.StartPerigeeMaxTheta = 75.*deg
#CETmaterial.StartPerigeeMinPhi = 45.*deg
#CETmaterial.StartPerigeeMaxPhi = 135*deg
#CETmaterial.StartPerigeeMinP = 10.*GeV
#CETmaterial.StartPerigeeMaxP = 10.*GeV
CETmaterial.CheckActiveLayers = False
CETmaterial.PrintMaterial = True
CETmaterial.PrintActivePos = False
topSequence += CETmaterial
#from VP1Algs.VP1AlgsConf import VP1Alg
#topSequence += VP1Alg()
# block the include for all others
include.block('TrkExExample/CombinedExtrapolator.py')
######################################################
# CombinedExtrapolator module