Commit 2edc7ca8 authored by Nectarios Benekos's avatar Nectarios Benekos Committed by Graeme Stewart
Browse files

See ChangeLog File (MuonEvtValidator-00-01-13)

parent 63faa323
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MSEFFICIENCY_H
#define MSEFFICIENCY_H
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <math.h>
using namespace std;
// Ugly method to use TMinuit
class MSEfficiency
{
public :
// Default Constructor - Empty
MSEfficiency();
void clear();
bool setupDim(int dim, float start, float end, int bins);
bool setupDim(int dim, vector <float> &bins);
void setEfficiencyForEvent(bool pass, float dim1);
void setEfficiencyForEvent(bool pass, float dim1, float dim2);
void setEfficiencyForEvent(bool pass, float dim1, float dim2, float dim3);
void getOverallEfficiency(float &Eff, float &EffError);
void getEfficiency123(float dim1, float dim2, float dim3, float &Eff, float &EffError);
void getEfficiency1(float dim1, float &Eff, float &EffError);
void getEfficiency2(float dim2, float &Eff, float &EffError);
void getEfficiency3(float dim3, float &Eff, float &EffError);
void getEfficiency12(float dim1, float dim2, float &Eff, float &EffError);
void getEfficiency23(float dim2, float dim3, float &Eff, float &EffError);
void getEfficiency13(float dim1, float dim3, float &Eff, float &EffError);
bool getDimBinInfo(int dim, int id, float &meanOfBin, float &widthOfBin);
int getNumberOfBins(int dim);
private:
double getError(int ok, int total);
int nDim1Bins;
int nDim2Bins;
int nDim3Bins;
vector<float> vecDim1Bins;
vector<float> vecDim2Bins;
vector<float> vecDim3Bins;
vector< vector <vector <int> > > nTotalEvents;
vector< vector <vector <int> > > nTotalPassedEvents;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/////////////////////////////////////////////////////////////////////
//
// Authors: Matthias Schott (LMU)
//
/////////////////////////////////////////////////////////////////////
#ifndef MSROOTINTERFACE_H
#define MSROOTINTERFACE_H
#include <vector>
#include <map>
#include <string>
using namespace std;
// Ugly method to use TMinuit
struct MSGraphPointDescription
{
float X;
float Y;
float DX;
float DY;
};
struct MSOutputDescription
{
float start;
float end;
int bins;
string name;
string xAxis;
string yAxis;
};
class MSRootInterface
{
public :
// Default Constructor - Empty
MSRootInterface();
void clear();
void setDirectory(string directory);
void setNewHistrogram(string id, string name, string xAxis, string yAxis, int bins, float start, float end);
void fill(string id, float value);
void fill(string id, float value, float weight);
void writeHistogram(string id);
void writeOverlayHistograms(string id1, string id2, string outputName);
void setNewGraph(string id, string name, string xAxis, string yAxis);
void setGraphPoint(string id, float x, float y, float dx, float dy);
void writeGraph(string id);
void writeComparisionGraph(string id1, string id2, string outputName, string Type);
void writeComparisionGraph(string id1, string id2, string outputName);
private:
string m_Directory;
void getRangeForGraph(string id, float &x1, float &y1, float &x2, float &y2);
map<string, TH1F*> map1DHistos;
map<string, vector<MSGraphPointDescription> > mapGraph;
map<string, MSOutputDescription> mapOutputDescription;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/////////////////////////////////////////////////////////////////////
// Name : MVCombined.h
// Package : MuonValidation
// Author: M.Schott (LMU)
// CERN, MAY 1, 2006
//
// DESCRIPTION:
//
// This class combines all results of the single MuonValidation results like Hits- or Digits-collections
// The Basic Idea is to store all the digit and hit information chamber per chamber and event by event
// The comparison is done within the chamberdescription
/////////////////////////////////////////////////////////////////////
#include "GaudiKernel/NTuple.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/Algorithm.h"
#include "GaudiKernel/ITHistSvc.h"
#include "GaudiKernel/ISvcLocator.h"
#include <vector>
#include <map>
#include <TFile.h>
#include <TF1.h>
#include <TH2.h>
#include <TH1.h>
#include <TChain.h>
#include <TGraphErrors.h>
#include "AIDA/IHistogram1D.h"
#include "AIDA/IHistogram2D.h"
#include "StoreGate/StoreGateSvc.h"
#include "TROOT.h"
#include "TFile.h"
#include "TTree.h"
#include "MuonEvtValidator/MVCommonStationID.h"
#include "MuonEvtValidator/MVCommonStationData.h"
#include "MuonEvtValidator/MVCommonStationData.h"
#include "MuonEvtValidator/MVCommonDataDescription.h"
#include "MuonEvtValidator/MVCommonDataLoader.h"
#include "MuonEvtValidator/MSRootInterface.h"
/////////////////////////////////////////////////////////////////////////////
class MVCombined:public Algorithm
{
public:
/** Main constructor */
MVCombined (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
/** initialising this Algorithm */
void setup();
void writeTGraph();
/** Routines for the Histogramm generation for MDT, RPC, CSC and TGC chambers separatly */
StatusCode Generate_MDT_Histograms();
StatusCode Generate_RPC_Histograms();
StatusCode Generate_CSC_Histograms();
StatusCode Generate_TGC_Histograms();
/** Routine for Histogramm generation for a single chamber */
StatusCode GenerateSingleChamberHistograms(int id, int eta, int phi);
/** MuonValidation Loader Object. This object loads the AANtuples that
contain the digit or hit informations*/
MVCommonDataLoader vtLoader;
/** Loading the AANtuples using the MVCommonDataLoader-Object*/
StatusCode loadDataFiles();
ITHistSvc* ToolRootHistSvc();
/** Each Station (MDT, RPC, CSC, TGC) can be identified with a unique ID
- see MVCommonStationID - this ID is used as Map-Identifier under which the
data of this chamber is stored*/
bool m_excludeDoubleCounting;
std::map<long, MVCommonStationData> m_MdtStationDescription;
std::map<long, MVCommonStationData> m_RpcStationDescription;
std::map<long, MVCommonStationData> m_CscStationDescription;
std::map<long, MVCommonStationData> m_TgcStationDescription;
//MVCommonMuonStationData<MVMdtDataDescription> test;
long n_EventCounter;
/// a handle on Store Gate
StoreGateSvc* m_storeGate;
// OutputFile
std::string m_OutputFile;
/// Filename of first & second inputfile. These files get compared
std::string m_InputVersion1File;
std::string m_InputVersion2File;
/** Names to distinguish between the final Histogramms. Each Histogramm
that is generated from the first input-file starts with "m_Version1Name"*/
std::string m_Version1Name;
std::string m_Version2Name;
/** Names to tell the progromm which input-File it gets, "Hits", "Digits"*/
std::string m_FileType1;
std::string m_FileType2;
/// These filenames will be implemented soon
std::string m_InputPositioningFile;
std::string m_InputPreprodDataFile;
std::string m_InputSegmentsFile;
int m_minimalDifference;
/// Identifier of MDT-Chamber which is validated alone
int m_SpecialStationNameID;
int m_SpecialStationEta;
int m_SpecialStationPhi;
/// Histogramms
std::map<std::string, IHistogram1D*> m_1D_Histos;
std::map<std::string, IHistogram2D*> m_2D_Histos;
MSRootInterface msRootInterface;
protected:
ITHistSvc* m_rootsvc;
};
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/////////////////////////////////////////////////////////////////////
// Name : MVCommonDataDescription.h
// Package : MuonValidation
// Authors: M.Schott (LMU) - N. Benekos (MPI)
//
// DESCRIPTION:
//
// This class stores the Hit/Digit-Information for one Event and for one Chamber
/////////////////////////////////////////////////////////////////////
#ifndef MVCOMMONDATADESCRIPTION_H
#define MVCOMMONDATADESCRIPTION_H
#include "GaudiKernel/Algorithm.h"
#include <vector>
#include <string>
struct CSCHit
{
int ChamberLayer;
int WireLayer;
int MeasuresPhi;
int Strip;
float StripX;
float StripY;
float StripZ;
float Charge;
};
struct MDTHit
{
int IDTube;
int IDMultilayer;
int IDLayer;
float WireX;
float WireY;
float WireZ;
float Driftradius;
};
struct RPCHit
{
int DoubletR;
int DoubletZ;
int DoubletPhi;
int DoubletGasGap;
int MeasuresPhi;
int Strip;
float StripX;
float StripY;
float StripZ;
float Stripdistance;
};
struct TGCHit
{
int GasGap;
int IsStrip;
int Channel;
float ChannelPosX;
float ChannelPosY;
float ChannelPosZ;
};
class MVCommonDataDescription
{
public:
MVCommonDataDescription();
MVCommonDataDescription(std::string Type);
MVCommonDataDescription(const MVCommonDataDescription& ob);
MVCommonDataDescription& operator = (const MVCommonDataDescription& ob);
void clear();
void setType(std::string Type);
void setDoubleCounting(bool bflag) { m_ExcludeDoubleCounting=bflag;}
void setID(long id);
long getID();
/// For CSC-Chamber
/// Adding Information of one Digit or one Hit. For a description of the given data look at ...Note
void addData( int ChamberLayer,
int WireLayer,
int MeasuresPhi,
int Strip,
float StripX,
float StripY,
float StripZ,
float Charge);
/// For MDT-Chamber
/// Adding Information of one Digit or one Hit. For a description of the given data look at ...Note
void addData( int IDTube,
int IDMultilayer,
int IDLayer,
float WireX,
float WireY,
float WireZ,
float Driftradius);
/// For RPC-Chamber
/// Adding Information of one Digit or one Hit. For a description of the given data look at ...Note
void addData( int DoubletR,
int DoubletZ,
int DoubletPhi,
int DoubletGasGap,
int MeasuresPhi,
int Strip,
float StripX,
float StripY,
float StripZ,
float Stripdistance);
/// For TGC-Chamber
void addData( int GasGap,
int IsStrip,
int Channel,
float ChannelPosX,
float ChannelPosY,
float ChannelPosZ);
bool hasSameEntry( MVCommonDataDescription &ob,
int MinDistance,
int &NumberOfCommenEntries);
void startUpHitCounter();
bool getNextHitInfo(MDTHit &tmp);
bool getNextHitInfo(CSCHit &tmp);
bool getNextHitInfo(RPCHit &tmp);
bool getNextHitInfo(TGCHit &tmp);
bool getNextHitPosition(float &x, float &y, float &z);
int getNumberOfEntries();
std::string getType();
private:
bool m_ExcludeDoubleCounting;
int m_HitCounter;
/// For CSC-Chamber
/// checks if this Digit/Hit is already stored withing this Event
bool hasSameEntry( int minDistance, /// Mininal Distance to next hit (0=same Hit)
int ChamberLayer,
int WireLayer,
int MeasuresPhi,
int Strip,
int &HitID);
/// For MDT-Chamber
/// checks if this Digit/Hit is already stored withing this Event
bool hasSameEntry( int minDistance, /// Mininal Distance to next hit (0=same Hit)
int IDTube,
int IDMultilayer,
int IDLayer,
int &HitID);
/// For RPC-Chamber
/// checks if this Digit/Hit is already stored withing this Event
bool hasSameEntry( int minDistance, /// Mininal Distance to next hit (0=same Hit)
int DoubletR,
int DoubletZ,
int DoubletPhi,
int DoubletGasGap,
int MeasuresPhi,
int Strip,
int &HitID);
/// For TGC-Chamber
/// checks if this Digit/Hit is already stored withing this Event
bool hasSameEntry( int minDistance, /// Mininal Distance to next hit (0=same Hit)
bool tag, /// This is just to distinguish MDTs and TGCs
int GasGap,
int IsStrip,
int Channel,
int &HitID);
std::string m_Type; // MDT RPC CSC TGC
long m_id;
/// CSC-Data-Description
std::vector<CSCHit> m_Validation_CSC;
/// MDT-Data-Description
/// Variables for storing all informations of each digit/hit
std::vector<MDTHit> m_Validation_MDT;
/// RPC-Data-Description
/// Variables for storing all informations of each digit/hit
std::vector<RPCHit> m_Validation_RPC;
/// TGC-Data-Description
/// Variables for storing all informations of each digit/hit
std::vector<TGCHit> m_Validation_TGC;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/////////////////////////////////////////////////////////////////////
// Name : MVCommonDataLoader.h
// Package : MuonValidation
// Authors: M.Schott (LMU) - N. Benekos (MPI)
// CERN, MAY 1, 2006
//
// DESCRIPTION:
//
// This class loads the created Hits- or Digits-collections from external root-Files.
// These root-Files are created by separate Athena-Algorithms
//
/////////////////////////////////////////////////////////////////////
#ifndef MVCOMMONDATALOADER_H
#define MVCOMMONDATALOADER_H
#include <TFile.h>
#include <TF1.h>
#include <TH2.h>
#include <TChain.h>
#include <map>
#include "MuonEvtValidator/MVCommonStationID.h"
#include "MuonEvtValidator/MVCommonDataDescription.h"
#include "MuonEvtValidator/MVCommonStationData.h"
/////////////////////////////////////////////////////////////////////
class MVCommonDataLoader
{
public:
MVCommonDataLoader();
void excludeDoubleCounting(bool bflag) { m_exludeDoubleCounting=bflag;}
/** Loading a AANtuple and map the Information to the given variables
mapMdtStationData, ... */
int loadDataFile( int Type, /// "Hits", "Digits", "Positions", "Segements", "Preprod"
std::string FileName, /// Filename
int versionID, /// Do you load the first file => 1, Do you load the 2nd File =>2
map<long, MVCommonStationData> &mapMdtStationData,
map<long, MVCommonStationData> &mapRpcStationData,
map<long, MVCommonStationData> &mapCscStationData,
map<long, MVCommonStationData> &mapTgcStationData);
/// Setting up the counter for the next routine
void startup();
/// Gives back event by event the MDT-Data - NOT chamberwise !
bool getNext_Data( std::string s_identifier, MVCommonDataDescription &mvVersion1);
private:
/// Loading the MDT-Information from the given File and writing it to mapMdtStationData
int loadMdtDataFile( int Type, /// "Hits", "Digits", "Positions", "Segements", "Preprod"
std::string FileName,
int versionID, /// Do you load the first file => 1, Do you load the 2nd File =>2
map<long, MVCommonStationData> &mapMdtStationData);
/// Loading the RPC-Information from the given File and writing it to mapRpcStationData
int loadRpcDataFile( int Type, /// "Hits", "Digits", "Positions", "Segements", "Preprod"
std::string FileName,
int versionID, /// Do you load the first file => 1, Do you load the 2nd File =>2
map<long, MVCommonStationData> &mapRpcStationData);
/// Loading the CSC-Information from the given File and writing it to mapCscStationData
int loadCscDataFile( int Type, /// "Hits", "Digits", "Positions", "Segements", "Preprod"
std::string FileName,
int versionID, /// Do you load the first file => 1, Do you load the 2nd File =>2
map<long, MVCommonStationData> &mapCscStationData);
/// Loading the TGC-Information from the given File and writing it to mapTgcStationData
int loadTgcDataFile( int Type, /// "Hits", "Digits", "Positions", "Segements", "Preprod"
std::string FileName,
int versionID, /// Do you load the first file => 1, Do you load the 2nd File =>2
map<long, MVCommonStationData> &mapTgcStationData);
/// Variables describing one Event on MDT-Level.
long m_Validation_Mdt_EventNumber; /// Event Number
long m_Validation_Mdt_RunNumber; /// Run Number
long m_Validation_Mdt_NumberOfHits; /// Number of MDT-Hits in this Event
bool m_exludeDoubleCounting;
TChain* m_mdt_tree;
TChain* m_rpc_tree;
TChain* m_csc_tree;
TChain* m_tgc_tree;
int m_nType;
long nMDTCounter;
long nRPCCounter;
long nCSCCounter;
long nTGCCounter;
long nNumberOfMDTEvents;