Skip to content
Snippets Groups Projects
Commit 37e3bde5 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

v10r2

parent c2639fd9
No related branches found
Tags v10r2
No related merge requests found
Showing
with 2663 additions and 809 deletions
package MuonID
version v7r8p2
version v7r9
branches src cmt doc python
......
v7r8p2
v7r9
......@@ -2,6 +2,13 @@
! Responsible : Erica Polycarpo, Miriam Gandelman
!-----------------------------------------------------------------------------
!======================== MuonID v7r9 2010-07-20 =============================
! 2010-07-19 - Chris Jones
- Update the Muon PID algorithm to lazy load the PID tool for first time it
is really needed. Avoids loading it by default in DaVinci during
initialization, since it triggers a lot of underlying tools to get
configured which take some time and aren't needed.
!======================== MuonID v7r8p2 2010-05-21 ===========================
! 2010-05-12 - Rob Lambert
- Fix error introduced yeasterday in MuonIDAlg
......
This diff is collapsed.
......@@ -28,14 +28,14 @@ class MuonCoord;
class DeMuonDetector;
/** @class MuonIDAlg MuonIDAlg.h
*
*
* This is an Algorithm to create MuonPID objects starting from tracks and
* using the hits in the muon system
*
* @author Erica Polycarpo, Miriam Gandelman
* @date 20/03/2006
*
*
*
*
*/
class MuonIDAlg : public GaudiAlgorithm{
public:
......@@ -68,7 +68,7 @@ private:
/// Compare the coordinates of two MuonPIDs
bool compareHits( LHCb::MuonPID* muonid1, LHCb::MuonPID* muonid2 );
/// check the track is in the p and angle acceptance
StatusCode preSelection(LHCb::MuonPID* pMuid, bool &passed);
......@@ -100,12 +100,19 @@ private:
double foiX(const int &station, const int &region, const double &p, const double &dx);
/// return the FOI in y in a station and region for momentum (in MeV/c)
double foiY(const int &station, const int &region, const double &p, const double &dy);
/// clear track based local variables
void resetTrackLocals();
LHCb::Track* makeMuonTrack(const LHCb::MuonPID& pMuid);
/// Load ImuIDTool on demand (avoid loading always in initialize())
inline ImuIDTool* Chi2MuIDTool()
{
if ( !m_Chi2MuIDTool ) m_Chi2MuIDTool = tool<ImuIDTool>(m_myMuIDTool,"myMuIDTool",this);
return m_Chi2MuIDTool;
}
// Properties
/// TES path of the tracks to analyse
......@@ -124,7 +131,7 @@ private:
/// Ignore MuonID info from conditions database.
bool m_OverrideDB;
/// Preselection momentum (no attempt to ID below this)
double m_PreSelMomentum;
......@@ -135,14 +142,14 @@ private:
std::vector<double> m_distPion;
std::vector<double> m_distMuon;
// GL&SF:
// GL&SF:
bool m_weightFlag;// flag to introduce weights in IsMuon/IsMuonLoose
int m_dllFlag; // flag to discriminate among the different DLLs
/// GL&SF: Calculate weights:
void P_weights(const double& p, bool *w);
/// GL&SF: Calculates the Distance Likelihood given a MuonPID
StatusCode calcMuonLL_dist(LHCb::MuonPID* muonid, const double& p);
......@@ -158,7 +165,7 @@ private:
double calc_ProbMu(const double& dist, const double *parMu);
/// GL&SF: Calculate the compatibility with the Non-Muon hypothesis
double calc_ProbNonMu(const double& dist, const double *parNonMu);
/// GL&SF: Normalizations of the Landaus
StatusCode calcLandauNorm();
double calcNorm(double *par);
......@@ -166,29 +173,29 @@ private:
/// Return the momentum bin corresponding to p, given the region
int GetPbin(double p, int region);
/// Determine probabilities for DLL_flag=3
StatusCode calcMuonLL_tanhdist(LHCb::MuonPID * pMuid, const double& p);
double calc_ProbMu_tanh(const double& tanhdist0, int pBin, int region);
double calc_ProbNonMu_tanh(const double& tanhdist0, int pBin, int region);
double Fdist[5];
double small_dist[5];
double closest_region[5];
double closest_x[5];
double closest_y[5];
/// GL&SF: define parameters for the hypothesis test
std::vector<double> m_MupBinsR1;
std::vector<double> m_MupBinsR2;
std::vector<double> m_MupBinsR3;
std::vector<double> m_MupBinsR4;
int m_nMupBinsR1, m_nMupBinsR2, m_nMupBinsR3, m_nMupBinsR4;
std::vector<double> m_MupBinsR1;
std::vector<double> m_MupBinsR2;
std::vector<double> m_MupBinsR3;
std::vector<double> m_MupBinsR4;
int m_nMupBinsR1, m_nMupBinsR2, m_nMupBinsR3, m_nMupBinsR4;
double m_parLandauMu;
double m_parLandauNonMu;
double m_parLandauNonMu;
std::vector< double > m_MuLanParR1_1;
std::vector< double > m_MuLanParR1_2;
std::vector< double > m_MuLanParR1_3;
......@@ -208,36 +215,36 @@ private:
std::vector< double > m_MuLanParR3_3;
std::vector< double > m_MuLanParR3_4;
std::vector< double > m_MuLanParR3_5;
std::vector< double > m_MuLanParR4_1;
std::vector< double > m_MuLanParR4_2;
std::vector< double > m_MuLanParR4_3;
std::vector< double > m_MuLanParR4_4;
std::vector< double > m_MuLanParR4_5;
std::vector< double > m_NonMuLanParR1;
std::vector< double > m_NonMuLanParR2;
std::vector< double > m_NonMuLanParR3;
std::vector< double > m_NonMuLanParR4;
double m_x; // x-width for the integral
int m_nMax;// number of steps
// hyperbolic tangent mapping of distances:
// Number of bins for tanh(dist) histos
int m_nDistBins;
// tanh scale factors
std::vector< double > m_tanhScaleFactorsR1;
std::vector< double > m_tanhScaleFactorsR2;
std::vector< double > m_tanhScaleFactorsR3;
std::vector< double > m_tanhScaleFactorsR4;
std::vector< double > m_tanhScaleFactorsR1;
std::vector< double > m_tanhScaleFactorsR2;
std::vector< double > m_tanhScaleFactorsR3;
std::vector< double > m_tanhScaleFactorsR4;
typedef std::vector< std::vector< double >* > vectorOfVectors;
vectorOfVectors m_tanhScaleFactors;
// tanh(dist2) histograms contents
std::vector< double > m_tanhCumulHistoMuonR1_1;
std::vector< double > m_tanhCumulHistoMuonR1_2;
......@@ -248,7 +255,7 @@ private:
std::vector< double > m_tanhCumulHistoMuonR1_7;
vectorOfVectors m_tanhCumulHistoMuonR1;
std::vector< double > m_tanhCumulHistoMuonR2_1;
std::vector< double > m_tanhCumulHistoMuonR2_2;
std::vector< double > m_tanhCumulHistoMuonR2_3;
......@@ -269,9 +276,9 @@ private:
std::vector< double > m_tanhCumulHistoMuonR4_4;
std::vector< double > m_tanhCumulHistoMuonR4_5;
vectorOfVectors m_tanhCumulHistoMuonR4;
std::vector< vectorOfVectors * > m_tanhCumulHistoMuon;
// tanh(dist2) histograms contents
std::vector< double > m_tanhCumulHistoNonMuonR1_1;
std::vector< double > m_tanhCumulHistoNonMuonR1_2;
......@@ -282,7 +289,7 @@ private:
std::vector< double > m_tanhCumulHistoNonMuonR1_7;
vectorOfVectors m_tanhCumulHistoNonMuonR1;
std::vector< double > m_tanhCumulHistoNonMuonR2_1;
std::vector< double > m_tanhCumulHistoNonMuonR2_2;
std::vector< double > m_tanhCumulHistoNonMuonR2_3;
......@@ -303,8 +310,8 @@ private:
std::vector< double > m_tanhCumulHistoNonMuonR4_4;
std::vector< double > m_tanhCumulHistoNonMuonR4_5;
vectorOfVectors m_tanhCumulHistoNonMuonR4;
std::vector< vectorOfVectors * > m_tanhCumulHistoNonMuon;
std::vector< vectorOfVectors * > m_tanhCumulHistoNonMuon;
//want to find quality?
bool m_FindQuality;
......@@ -313,7 +320,7 @@ private:
//Which MuIDTool should be used
std::string m_myMuIDTool;
// function that defines the field of interest size
// formula is p(1) + p(2)*exp(-p(3)*momentum)
std::vector< double > m_xfoiParam1;
......@@ -340,7 +347,7 @@ private:
// fill local arrays of pad sizes and region sizes
DeMuonDetector* m_mudet;
//load muonIDtool
// muonIDtool
ImuIDTool* m_Chi2MuIDTool;
// local array of pad sizes in mm
......@@ -350,11 +357,11 @@ private:
// local array of region sizes
std::vector<double> m_regionInnerX; // inner edge in abs(x)
std::vector<double> m_regionOuterX; // outer edge in abs(x)
std::vector<double> m_regionOuterX; // outer edge in abs(x)
std::vector<double> m_regionInnerY; // inner edge in abs(y)
std::vector<double> m_regionOuterY; // outer edge in abs(y)
std::vector<double> m_regionOuterY; // outer edge in abs(y)
// These are indexed [station]
//std::vector<double> m_stationZ; // station position
double m_stationZ[5]; // station position
......@@ -366,7 +373,7 @@ private:
double m_MomentumPre; // in MeV/c
double m_trackSlopeX;
std::vector<double> m_trackX; // position of track in x(mm) in each station
std::vector<double> m_trackY; // position of track in y(mm) in each station
std::vector<double> m_trackY; // position of track in y(mm) in each station
//test if found a hit in the MuonStations
std::vector<int> m_occupancy;
......@@ -375,7 +382,7 @@ private:
// store X of hits for dx/dz matching with track (only need M2/M3)
std::vector<double> m_CoordX;
int m_xMatchStation; // first station to calculate slope (M2)
// OK nasty optimisation here, store x,dx,y,dy of each coord to test against
// track extrapolation
class coordExtent_{
......@@ -389,9 +396,9 @@ private:
LHCb::MuonCoord *m_pCoord;
};
// vector of positions of coords (innner vector coords,
// vector of positions of coords (innner vector coords,
// outer is [station* m_NRegion + region ]
std::vector<std::vector<coordExtent_> > m_coordPos;
std::vector<std::vector<coordExtent_> > m_coordPos;
};
#endif // MUONID_H
package MuonTrackMonitor
version v1r0
version v2r1
branches src cmt doc options python
include_path none
......
v1r0
v2r1
!-----------------------------------------------------------------------------
!------------------------------------------------------------------------------
! Package : Muon/MuonTrackMonitor
! Responsible : Giacomo GRAZIANI
! Purpose : High level Muon Monitoring after reconstruction
!-----------------------------------------------------------------------------
!------------------------------------------------------------------------------
!====================== MuonTrackMonitor v2r1 2010-07-20 ======================
! 2010-07-13 - Marco Cattaneo
- Fix an untested StatusCode
! 2010-07-12 - P. de Simone
- faster efficiency monitor
!====================== MuonTrackMonitor v2r0 2010-06-23 ======================
! 2010-06-23 - GG
- fix unchecked status code and windoz compil. warnings in MuEffMonitor
- bug fix in MuonTrackAligMonitor
! 2010-06-21 - P. De Simone
- new algorithm for chamber efficiency monitoring
- remove empty MuonTrackMonitor algorithm
! 2010-06-18 - S. Vecchi
- MuonTrackAligMonitor.cpp/h:
- speeded up the extrapolation for residuals calculation on each muon station
- added some useful histograms to understand if there are shearings wrt to the
tracking
- Configuration.py:
refined the track selection to produce Alignment monitoring histograms
!====================== MuonTrackMonitor v1r0 2010-05-21 ======================
! 2010-05-11 - G. Graziani
......
......@@ -3,7 +3,7 @@ from Gaudi.Configuration import *
from TrackFitter.ConfiguredFitters import ( ConfiguredEventFitter )
from TrackSys.Configuration import TrackSys
from Configurables import ( LHCbConfigurableUser, GaudiSequencer, TrackKalmanFilter, MeasurementProvider,
MuonTrackMonitor, MuonTrackAligMonitor)
MuonTrackAligMonitor, MuEffMonitor, TrackMasterExtrapolator)
class MuonTrackMonitorConf(LHCbConfigurableUser):
......@@ -28,34 +28,63 @@ class MuonTrackMonitorConf(LHCbConfigurableUser):
muonTrackFit.Fitter.MeasProvider.IgnoreIT = True
muonTrackFit.Fitter.MeasProvider.IgnoreOT = True
muonTrackFit.Fitter.MeasProvider.IgnoreMuon = False
muonTrackFit.Fitter.MeasProvider.MuonProvider.clusterize = True #=======
#muonTrackFit.Fitter.MeasProvider.MuonProvider.OutputLevel = DEBUG #=======
muonTrackFit.Fitter.NodeFitter.BiDirectionalFit = False
muonTrackFit.Fitter.ErrorX = 1000
muonTrackFit.Fitter.ErrorY = 1000
muonTrackFit.Fitter.ErrorTx = 0.7
muonTrackFit.Fitter.ErrorTy = 0.7
muonTrackFit.Fitter.NumberFitIterations = 4
muonTrackFit.Fitter.MaxNumberOutliers = 2
muonTrackFit.Fitter.MaxNumberOutliers = 0 #2
muonTrackFit.OutputLevel = self.getProp("OutputLevel")
muonMoniSeq = self.getProp("Sequencer")
## montracks = MuonTrackMonitor( "MuonTrackMonitor",
## HistoTopDir = "Muon/",
## HistoLevel = self.getProp("Histograms")
## )
monalig = MuonTrackAligMonitor( "MuonTrackAligMonitor",
HistoTopDir = "Muon/",
HistoLevel = self.getProp("Histograms")
)
monalig.OutputLevel = self.getProp("OutputLevel")
monalig.IsLongTrackState = True
#monalig.IsLongTrackState = True
monalig.LongToMuonMatch = True
monalig.pCut = 0
monalig.pCut = 6 # =========
monalig.chi2nCut = 3
monalig.chi2matchCut = 10
monalig.IsCosmics = False
muonMoniSeq.Members += [muonTrackFit, monalig]
moneff = MuEffMonitor( "MuEffMonitor",
HistoTopDir = "Muon/",
HistoLevel = self.getProp("Histograms")
)
moneff.addTool(TrackMasterExtrapolator, name = "MuEffExtrap")
moneff.Extrapolator = moneff.MuEffExtrap
moneff.MuEffExtrap.ApplyMultScattCorr = True
moneff.MuEffExtrap.ApplyEnergyLossCorr = True
moneff.MuEffExtrap.MaterialLocator = "SimplifiedMaterialLocator"
moneff.MuEffExtrap.OutputLevel = 5
moneff.DoTrigger = False
moneff.MomentumCut = 3000.
moneff.EecalMax = 1000.
moneff.EecalMin = -100.
moneff.EhcalMax = 3500.
moneff.EhcalMin = 1000.
moneff.nSigmaX = [3.5,3.5,3.5,3.5,3.5]
moneff.nSigmaY = [2.,2.,2.,2.,2.]
moneff.Chi2Min = 10
moneff.CosThetaCut = 0.99
moneff.xyDistCut = 40.
moneff.PCutEff = 12.
moneff.OutputLevel = self.getProp("OutputLevel")
muonMoniSeq.Members += [moneff]
This diff is collapsed.
// $Id: $
#ifndef MUEFFMONITOR_H
#define MUEFFMONITOR_H 1
/** @class MuEffMonitor MuEffMonitor.h
* monitoring of Muon Chamber Efficiency
*
* @author P. de Simone
* @date 2010-06-16
*/
#include <cstdio>
//#include <string>
#include <map>
#include <vector>
// from Gaudi
#include "GaudiKernel/AlgFactory.h"
#include "GaudiKernel/IRegistry.h" // IOpaqueAddress
#include "GaudiKernel/PhysicalConstants.h"
#include "GaudiKernel/SystemOfUnits.h"
// Tools for histogramming
#include "GaudiAlg/GaudiHistoAlg.h"
#include "AIDA/IHistogram1D.h"
#include "AIDA/IProfile1D.h"
#include "AIDA/IHistogram2D.h"
#include "AIDA/IProfile2D.h"
#include "Kernel/ITriggerTisTos.h"
#include "Kernel/IANNSvc.h"
#include "Kernel/ReadRoutingBits.h"
// From the MuonDetector:
#include "MuonDet/MuonBasicGeometry.h"
#include "Event/MuonCoord.h"
#include "MuonDet/DeMuonDetector.h"
// from Event:
#include "Event/ODIN.h"
#include "Event/Track.h"
#include "Event/ProtoParticle.h"
#include "Event/L0DUReport.h"
#include "Event/HltDecReports.h"
#include "Event/HltSelReports.h"
#include "Event/MuonDigit.h"
#include "Event/IntLink.h"
#include "TrackInterfaces/ITrackExtrapolator.h"
class MuonCoord;
class DeMuonDetector;
class ITrackExtrapolator;
class MuEffMonitor : public GaudiHistoAlg {
public:
/// Standard constructor
MuEffMonitor( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~MuEffMonitor( ); ///< Destructor
virtual StatusCode initialize(); ///< Algorithm initialization
virtual StatusCode execute (); ///< Algorithm execution
virtual StatusCode finalize (); ///< Algorithm finalization
private:
// Job Options properties:
bool m_notOnline;
bool m_DoTrigger; // apply trigger
double m_MomentumCut; // Minimum momentum cut
double m_EecalMax, m_EecalMin; // Asymmetric Ecal Mip enregy window
double m_EhcalMax, m_EhcalMin; // Asymmetric Hcal Mip enregy window
std::vector<double> m_nSigmaX; /// X window hits search
std::vector<double> m_nSigmaY; /// Y window hits search
double m_Chi2Min;
double m_CosThetaCut;
double m_xyDistCut;
double m_PCutEff;
std::string m_histoLevel;
std::vector<std::string> m_containers ; ///< Containers for associators
//=========
// histos:
//=========
AIDA::IHistogram1D *m_nEvts, *m_nHLT1mu, *m_nTracks, *m_nLDTrks, *m_nTrksP;
AIDA::IHistogram1D *m_nMuPreS, *m_nMuSel, *m_nMu;
AIDA::IHistogram1D *m_TrkType, *m_Chi2Hits;
AIDA::IHistogram1D *m_PpreSel, *m_PSel;
AIDA::IHistogram1D *m_Hcal, *m_Ecal, *m_Angolo, *m_Distanza;
AIDA::IHistogram1D *m_SHcal, *m_SEcal;
AIDA::IHistogram2D *m_ene, *m_Sene, *m_DeltaP;
AIDA::IHistogram1D *m_P_S1, *m_P_S2, *m_P_S3, *m_P_S4, *m_P_S5, *m_P_S;
AIDA::IHistogram1D *m_P_S1hit, *m_P_S2hit, *m_P_S3hit, *m_P_S4hit, *m_P_S5hit, *m_P_Shit;
AIDA::IHistogram1D *m_StationsEff_den, *m_StationsEff_num;
AIDA::IHistogram1D *m_RegionsEff_den, *m_RegionsEff_num;
//==================
// global variables:
//==================
//
// 1) header:
// ----------
ulonglong m_event;
unsigned int m_run, m_BX;
// Trigger:
int m_L0Decision;
int m_HLTMuon;
//--------------------------------
// variables for the candidates:
//--------------------------------
long m_nTrk;
int m_FlagMCan;
int m_carica;
double m_trtype;
double m_trflag;
double m_chi2trk;
double m_Mom;
double m_Mom0;
double m_TrMom;
double m_TrMom0;
double m_TrSlx;
double m_TrSly;
double m_TrSlx0;
double m_TrSly0;
int m_SeleTIS;
int m_SeleTOS;
int m_SeleTOB;
// These are indexed [station] <==> Tracks extrapolated
double m_trackX[5]; // x(mm) position of track in each station
double m_trackY[5]; // y(mm) position of track in each station
double m_err2X[5]; // error on x(mm) position in each station
double m_err2Y[5]; // error on y(mm) position in each station
double m_trackPX[5]; // x momentum (GeV) of track in each station
double m_trackPY[5]; // y momentum (GeV) of track in each station
double m_trackPZ[5]; // z momentum (GeV) of track in each station
int m_occupancy[5];
double m_Chisq[5];
double m_xdista[5];
double m_ydista[5];
double m_Dxa[5];
double m_Dya[5];
double m_dimx[5];
double m_dimy[5];
int m_reg[5];
int m_Sample[5];
// Calo variables:
double m_Eecal;
double m_Ehcal;
double m_Espd;
double m_Eprs;
double m_Xecal;
double m_Yecal;
double m_Xhcal;
double m_Yhcal;
//-------------------------
// Arrays of the products:
//-------------------------
std::vector<int> m_P_FlagMCan;
std::vector<int> m_P_carica;
std::vector<double> m_P_chi2trk, m_P_trtype, m_P_trflag;
std::vector<double> m_P_Mom, m_P_Mom0;
std::vector<double> m_P_TrMom, m_P_TrMom0;
std::vector<double> m_P_TrSlx, m_P_TrSlx0;
std::vector<double> m_P_TrSly, m_P_TrSly0;
std::vector<int> m_P_SeleTIS, m_P_SeleTOS, m_P_SeleTOB;
std::vector<double> m_P_Xs1, m_P_Ys1;
std::vector<double> m_P_Xs2, m_P_Ys2;
std::vector<double> m_P_Xs3, m_P_Ys3;
std::vector<double> m_P_Xs4, m_P_Ys4;
std::vector<double> m_P_Xs5, m_P_Ys5;
std::vector<double> m_P_Xp1, m_P_Yp1, m_P_Zp1;
std::vector<double> m_P_Xp2, m_P_Yp2, m_P_Zp2;
std::vector<double> m_P_Xp3, m_P_Yp3, m_P_Zp3;
std::vector<double> m_P_Xp4, m_P_Yp4, m_P_Zp4;
std::vector<double> m_P_Xp5, m_P_Yp5, m_P_Zp5;
std::vector<int> m_P_occu1;
std::vector<int> m_P_occu2;
std::vector<int> m_P_occu3;
std::vector<int> m_P_occu4;
std::vector<int> m_P_occu5;
std::vector<double> m_P_dist1, m_P_dist2, m_P_dist3, m_P_dist4, m_P_dist5;
std::vector<double> m_P_xdist1, m_P_xdist2, m_P_xdist3, m_P_xdist4, m_P_xdist5;
std::vector<double> m_P_ydist1, m_P_ydist2, m_P_ydist3, m_P_ydist4, m_P_ydist5;
std::vector<double> m_P_Dx1, m_P_Dx2, m_P_Dx3, m_P_Dx4, m_P_Dx5;
std::vector<double> m_P_Dy1, m_P_Dy2, m_P_Dy3, m_P_Dy4, m_P_Dy5;
std::vector<double> m_P_dimx1, m_P_dimx2, m_P_dimx3, m_P_dimx4, m_P_dimx5;
std::vector<double> m_P_dimy1, m_P_dimy2, m_P_dimy3, m_P_dimy4, m_P_dimy5;
std::vector<double> m_P_Chisq1, m_P_Chisq2, m_P_Chisq3, m_P_Chisq4, m_P_Chisq5;
std::vector<int> m_P_Sample1, m_P_Sample2, m_P_Sample3, m_P_Sample4, m_P_Sample5;
std::vector<int> m_P_reg1, m_P_reg2, m_P_reg3, m_P_reg4, m_P_reg5;
std::vector<double> m_P_Eecal, m_P_Ehcal;
std::vector<double> m_P_Espd, m_P_Eprs;
std::vector<double> m_P_Xecal, m_P_Yecal;
std::vector<double> m_P_Xhcal, m_P_Yhcal;
//--------------------------
// Muon Detector variables:
//--------------------------
double m_momentum0;
const LHCb::State * m_stateP;
const LHCb::State * m_stateP0;
int m_NStation; /// Number of stations
int m_NRegion; /// Number of regions
//Names of the station
std::vector<std::string> m_stationNames;
// fill local arrays of pad sizes and region sizes
DeMuonDetector* m_mudet;
std::vector<double> m_stationZ; // station position
// local array of pad sizes in mm
// all std::vectors here are indexed: [station * m_NRegion + region]
std::vector<double> m_padSizeX;
std::vector<double> m_padSizeY;
// local array of region sizes
std::vector<double> m_regionInnerX; // inner edge in abs(x)
std::vector<double> m_regionOuterX; // outer edge in abs(x)
std::vector<double> m_regionInnerY; // inner edge in abs(y)
std::vector<double> m_regionOuterY; // outer edge in abs(y)
// Store x,dx,y,dy of each coord
class coordExtent_{
public:
coordExtent_(double x, double dx, double y, double dy, double z, double dz,
LHCb::MuonCoord *pCoord) :
m_x(x), m_dx(dx), m_y(y), m_dy(dy), m_z(z), m_dz(dz), m_pCoord(pCoord) {};
double m_x;
double m_dx;
double m_y;
double m_dy;
double m_z;
double m_dz;
LHCb::MuonCoord *m_pCoord;
};
// vector of positions of coords (innner vector coords,
// outer is [station* m_NRegion + region ]
std::vector<std::vector<coordExtent_> > m_coordPos;
ITriggerTisTos* m_TriggerTisTosTool;
// LHCbID hits associated to the Selected Track
std::vector< LHCb::LHCbID > m_seleids;
std::string m_extrapolatorName;
ITrackExtrapolator* m_extrapolator; ///< extrapolator
//------------
// functions:
//------------
StatusCode LoadMuonGeometry();
StatusCode DoEvent();
StatusCode DoTrigger();
void resetTrkVariables();
bool DoTrackSelection(const LHCb::Track *pTrack);
bool DoAccCheck();
bool DoHitsInPad();
bool DoCaloMIP(const LHCb::Track *pTrack);
bool estrapola(const LHCb::Track *pTrack);
StatusCode fillCoordVectors();
void ClearSeleVecs();
void fillTrkVecs();
void fillHistos();
};
#endif
......@@ -71,15 +71,17 @@ DECLARE_ALGORITHM_FACTORY( MuonTrackAligMonitor );
MuonTrackAligMonitor::MuonTrackAligMonitor( const std::string& name,
ISvcLocator* pSvcLocator)
: GaudiHistoAlg ( name , pSvcLocator ),
m_h_resx_a(0), m_h_resy_a(0), m_h_resx_c(0), m_h_resy_c(0),
m_h_resxL_a(0), m_h_resyL_a(0), m_h_resxL_c(0), m_h_resyL_c(0),
m_h_resxM_a(0), m_h_resyM_a(0), m_h_resxM_c(0), m_h_resyM_c(0),
m_notOnline(true)
{
declareProperty( "Extrapolator", m_extrapolatorName = "TrackMasterExtrapolator" );
declareProperty( "Chi2Calculator", m_Chi2CalculatorName = "TrackChi2Calculator" );
declareProperty( "IsLongTrackState" , m_IsLongTrackState = true );
declareProperty( "LongToMuonMatch" , m_LongToMuonMatch = true );
declareProperty( "pCut" , m_pCut = 0./GeV);
declareProperty( "HistoLevel", m_histoLevel="OfflineFull");
declareProperty( "pCut" , m_pCut = 0./GeV);
declareProperty( "chi2nCut" , m_chi2nCut = 3);
declareProperty( "chi2matchCut", m_chi2matchCut = 10);
declareProperty( "HistoLevel", m_histoLevel="OfflineFull");
declareProperty( "IsCosmics" , m_IsCosmics = false);
}
......@@ -90,6 +92,7 @@ StatusCode MuonTrackAligMonitor::initialize() {
const StatusCode sc = GaudiHistoAlg::initialize();
GaudiAlg::HistoID name;
std::string title;
m_notOnline = (m_histoLevel != "Online");
m_muonDet = getDet<DeMuonDetector>(DeMuonLocation::Default);
......@@ -99,7 +102,7 @@ StatusCode MuonTrackAligMonitor::initialize() {
}
m_zM1 = m_muonDet->getStationZ(0) / mm;
double ulow = m_IsCosmics ? -1.5 : -0.7;
double ulow = m_IsCosmics ? -1.5 : -0.4;
double uhigh = -ulow;
if(m_notOnline) {
......@@ -114,11 +117,11 @@ StatusCode MuonTrackAligMonitor::initialize() {
}
if(m_LongToMuonMatch) {
//chi2 match
name = "chi2_match";
m_h_chi2 = book1D( name, "chi2 match", -3, 50, 53);
if(m_notOnline) {
//chi2 match
name = "chi2_match";
m_h_chi2 = book1D( name, "chi2 match", -3, 50, 53);
}
// x coord
name = "prof_resx_x";
m_p_resxx = bookProfile1D( name, "profile res. x vs x", -4000, 4000, 80);
......@@ -176,20 +179,43 @@ StatusCode MuonTrackAligMonitor::initialize() {
if(m_notOnline) {
for(int i = 0; i < m_muonDet->stations(); i++){
name = "residx_aSide_station_" + boost::lexical_cast<std::string>(i);
m_h_resx_a.push_back( book1D( name, name, -500, 500, 100 ));
name = "residy_aSide_station_" + boost::lexical_cast<std::string>(i);
m_h_resy_a.push_back( book1D( name, name, -500, 500, 100 ));
name = "residx_cSide_station_" + boost::lexical_cast<std::string>(i);
m_h_resx_c.push_back( book1D( name, name, -500, 500, 100 ));
name = "residy_cSide_station_" + boost::lexical_cast<std::string>(i);
m_h_resy_c.push_back( book1D( name, name, -500, 500, 100 ));
name = "residxL_aSide_station_$" + boost::lexical_cast<std::string>(i);
title = "X resid from Long tracks A side M" + boost::lexical_cast<std::string>(i+1);
m_h_resxL_a.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
name = "residyL_aSide_station_$" + boost::lexical_cast<std::string>(i);
title = "Y resid from Long tracks A side M" + boost::lexical_cast<std::string>(i+1);
m_h_resyL_a.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
name = "residxL_cSide_station_$" + boost::lexical_cast<std::string>(i);
title = "X resid from Long tracks C side M" + boost::lexical_cast<std::string>(i+1);
m_h_resxL_c.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
name = "residyL_cSide_station_$" + boost::lexical_cast<std::string>(i);
title = "Y resid from Long tracks C side M" + boost::lexical_cast<std::string>(i+1);
m_h_resyL_c.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
name = "residxM_aSide_station_$" + boost::lexical_cast<std::string>(i);
title = "X resid from Muon tracks A side M" + boost::lexical_cast<std::string>(i+1);
m_h_resxM_a.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
name = "residyM_aSide_station_$" + boost::lexical_cast<std::string>(i);
title = "Y resid from Muon tracks A side M" + boost::lexical_cast<std::string>(i+1);
m_h_resyM_a.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
name = "residxM_cSide_station_$" + boost::lexical_cast<std::string>(i);
title = "X resid from Muon tracks C side M" + boost::lexical_cast<std::string>(i+1);
m_h_resxM_c.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
name = "residyM_cSide_station_$" + boost::lexical_cast<std::string>(i);
title = "Y resid from Muon tracks C side M" + boost::lexical_cast<std::string>(i+1);
m_h_resyM_c.push_back( book1D( name, title.c_str(), -500, 500, 100 ));
}
}
name = "residx_per_halfstation";
m_resxhs = bookProfile1D( name, "average X res. per half station", -0.5, 9.5, 10);
name = "residy_per_halfstation";
m_resyhs = bookProfile1D( name, "average Y res. per half station", -0.5, 9.5, 10);
name = "residx_per_halfstationL";
m_resxhsL = bookProfile1D( name, "average X res. per half station wtr LONG", -0.5, 9.5, 10, "", -500, 500);
name = "residy_per_halfstationL";
m_resyhsL = bookProfile1D( name, "average Y res. per half station wtr LONG", -0.5, 9.5, 10, "", -500, 500);
name = "residx_per_halfstationM";
m_resxhsM = bookProfile1D( name, "average X res. per half station wtr MUON", -0.5, 9.5, 10, "", -500, 500);
name = "residy_per_halfstationM";
m_resyhsM = bookProfile1D( name, "average Y res. per half station wtr MUON", -0.5, 9.5, 10, "", -500, 500);
m_extrapolator = tool<ITrackExtrapolator>( m_extrapolatorName, "Extrapolator" ,this );
if(!m_extrapolator){
......@@ -227,13 +253,19 @@ StatusCode MuonTrackAligMonitor::execute() {
<<")... skipping" << endmsg;
continue;
}
if(!longTrack) {
warning() << "no track associated to MuonPID object.. skipping" << endmsg;
continue;
}
if( longTrack->p()/GeV > m_pCut ) {
debug() << "LongTrack p "<<longTrack->p()/GeV<<endmsg;
debug() << "LongTrack chi2 "<<longTrack->chi2PerDoF()<<" dof "<<longTrack->nDoF()<<endmsg;
debug() << "MuonTrack chi2 "<<muTrack->chi2PerDoF()<<" dof "<<muTrack->nDoF()<<endmsg;
if( longTrack->p()/GeV > m_pCut &&
longTrack->chi2PerDoF() < m_chi2nCut &&
muTrack->chi2PerDoF() < m_chi2nCut &&
muTrack->nDoF()> 3 ) {
LHCb::State muState = muTrack->closestState( m_zM1 );
LHCb::State longState = longTrack->closestState( muState.z() );
......@@ -251,6 +283,9 @@ StatusCode MuonTrackAligMonitor::execute() {
Warning("Extrapolating a muon muState to z failed ");
continue;
}
debug()<<" Extrapolation to z "<<m_zM1<<
" long = ("<<longState.x()<<","<<longState.y()<<")"<<
" muon = ("<<muState.x()<<","<<muState.y()<<")"<<endmsg;
double chi2;
if(m_notOnline) {
......@@ -266,6 +301,10 @@ StatusCode MuonTrackAligMonitor::execute() {
//info() << "Could not invert matrices" << endmsg;
continue;
}
if(chi2 > m_chi2matchCut ) {
debug()<<" matching chisquare not satisfactory "<<chi2<<endmsg;
continue;
}
double resx = longState.x() - muState.x();
double resy = longState.y() - muState.y();
......@@ -305,8 +344,8 @@ StatusCode MuonTrackAligMonitor::execute() {
m_p_restytx->fill( tx, resty );
m_p_restyty->fill( ty, resty );
m_h_chi2->fill(chi2);
}
m_h_chi2->fill(chi2);
}
std::vector<LHCb::LHCbID> list_of_tile = (muTrack)->lhcbIDs();
......@@ -328,31 +367,36 @@ StatusCode MuonTrackAligMonitor::execute() {
debug() << " x = " << x << " y = " << y << " z = " << z << endreq;
debug() << " region " << tile.region() <<" station " << tile.station() << endreq;
debug() << "*********************" << tile << endreq;
sc = m_extrapolator->propagate( longState, z, pid );
if ( sc.isFailure() ) {
Warning("Extrapolating a muon longState to z failed ");
debug() << "Extrapolating longState to z = " << z << " failed " << endmsg;
continue;
}
LHCb::State fitState = m_IsLongTrackState ? longState : muState;
double rx= x - fitState.x();
double ry= y - fitState.y();
if(m_notOnline) {
AIDA::IHistogram1D *tempx, *tempy;
tempx = x > 0 ? m_h_resx_a[ tile.station() ] : m_h_resx_c[ tile.station() ];
tempy = x > 0 ? m_h_resy_a[ tile.station() ] : m_h_resy_c[ tile.station() ];
LHCb::State fitState = m_IsLongTrackState ? longState : muState;
for (int i=0; i<2; i++){
LHCb::State fitState = i==0 ? longState : muState;
tempx->fill( rx );
tempy->fill( ry );
double deltaZ = z - fitState.z() ;
double rx= x - ( fitState.x() + fitState.tx() * deltaZ);
double ry= y - ( fitState.y() + fitState.ty() * deltaZ);
if(m_notOnline) {
AIDA::IHistogram1D *tempx, *tempy;
if(i==0){
tempx = x > 0 ? m_h_resxL_a[ tile.station() ] : m_h_resxL_c[ tile.station() ];
tempy = x > 0 ? m_h_resyL_a[ tile.station() ] : m_h_resyL_c[ tile.station() ];
}else{
tempx = x > 0 ? m_h_resxM_a[ tile.station() ] : m_h_resxM_c[ tile.station() ];
tempy = x > 0 ? m_h_resyM_a[ tile.station() ] : m_h_resyM_c[ tile.station() ];
}
tempx->fill( rx );
tempy->fill( ry );
}
if(i==0) {
m_resxhsL->fill( (x > 0 ? 0 : 5) + tile.station(), rx );
m_resyhsL->fill( (x > 0 ? 0 : 5) + tile.station(), ry );
}else {
m_resxhsM->fill( (x > 0 ? 0 : 5) + tile.station(), rx );
m_resyhsM->fill( (x > 0 ? 0 : 5) + tile.station(), ry );
}
}
m_resxhs->fill( (x > 0 ? 0 : 5) + tile.station(), rx );
m_resyhs->fill( (x > 0 ? 0 : 5) + tile.station(), ry );
}
}
}
}
}
......
......@@ -28,19 +28,20 @@ public:
private:
AIDA::IHistogram1D *m_h_chi2, *m_h_p;
std::vector<AIDA::IHistogram1D*> m_h_resx_a,m_h_resy_a,m_h_resx_c,m_h_resy_c;
std::vector<AIDA::IHistogram1D*> m_h_resxL_a,m_h_resyL_a,m_h_resxL_c,m_h_resyL_c;
std::vector<AIDA::IHistogram1D*> m_h_resxM_a,m_h_resyM_a,m_h_resxM_c,m_h_resyM_c;
AIDA::IHistogram2D *m_h_xy, *m_h_txty;
AIDA::IProfile1D *m_p_resxx, *m_p_resxy, *m_p_resxtx,*m_p_resxty, *m_p_restxx, *m_p_restxy, *m_p_restxtx,
*m_p_restxty, *m_p_resyx, *m_p_resyy, *m_p_resytx, *m_p_resyty, *m_p_restyx, *m_p_restyy, *m_p_restytx, *m_p_restyty,
*m_resxhs, *m_resyhs;
*m_resxhsL, *m_resyhsL,*m_resxhsM, *m_resyhsM;
ITrackExtrapolator *m_extrapolator; ///< extrapolator
ITrackChi2Calculator *m_chi2Calculator;
DeMuonDetector* m_muonDet;
bool m_IsLongTrackState, m_LongToMuonMatch, m_IsCosmics;
double m_pCut;
bool m_LongToMuonMatch, m_IsCosmics;
double m_pCut, m_chi2nCut, m_chi2matchCut;
double m_zM1;
std::string m_histoLevel;
......
// $Id: MuonTrackMonitor.cpp,v 1.2 2010-05-05 07:57:02 ggiacomo Exp $
// Include files
// from Gaudi
#include "GaudiKernel/DeclareFactoryEntries.h"
// local
#include "MuonTrackMonitor.h"
//-----------------------------------------------------------------------------
// Implementation file for class : MuonTrackMonitor
//
// 2009-02-25
//-----------------------------------------------------------------------------
// Declaration of the Algorithm Factory
DECLARE_ALGORITHM_FACTORY( MuonTrackMonitor );
MuonTrackMonitor::MuonTrackMonitor( const std::string& name,
ISvcLocator* pSvcLocator)
: GaudiHistoAlg ( name , pSvcLocator )
{
declareProperty( "HistoLevel", m_histoLevel="OfflineFull");
}
MuonTrackMonitor::~MuonTrackMonitor() {}
StatusCode MuonTrackMonitor::initialize() {
const StatusCode sc = GaudiHistoAlg::initialize();
if ( sc.isFailure() ) { return sc; }
return StatusCode::SUCCESS;
}
StatusCode MuonTrackMonitor::execute() {
setFilterPassed(true);
return StatusCode::SUCCESS;
}
StatusCode MuonTrackMonitor::finalize() {
return GaudiHistoAlg::finalize();
}
// $Id: MuonTrackMonitor.h,v 1.2 2010-05-05 07:57:02 ggiacomo Exp $
#ifndef MUONTRACKMONITOR_H
#define MUONTRACKMONITOR_H 1
#include "GaudiAlg/GaudiHistoAlg.h"
/** @class MuonTrackMonitor MuonTrackMonitor.h
*
*
* @author Giacomo GRAZIANI
* @date 2009-02-25
*/
class MuonTrackMonitor : public GaudiHistoAlg {
public:
MuonTrackMonitor( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~MuonTrackMonitor( ); ///< Destructor
virtual StatusCode initialize(); ///< Algorithm initialization
virtual StatusCode execute (); ///< Algorithm execution
virtual StatusCode finalize (); ///< Algorithm finalization
private:
std::string m_histoLevel;
};
#endif // MUONTRACKMONITOR_H
......@@ -3,7 +3,7 @@
# Maintainer : Jaap Panman
#============================================================================
package LumiAlgs
version v3r6
version v3r7
#============================================================================
# Structure, i.e. directories to process.
......
v3r6
v3r7
......@@ -4,6 +4,13 @@
! Purpose : Accounting of LumiSummaries (offline code)
!-----------------------------------------------------------------------------
!========================== LumiAlgs v3r7 2010-07-20 =========================
! 2010-07-08 - Yasmine Amhis
- src/GetIntegratedLuminosity.cpp/h
. update algorithm
- python/LumiIntegratedConf.py
. run GetIntegratedLuminosity
!========================== LumiAlgs v3r6 2010-06-23 ========================
! 2010-06-23 - Rob Lambert
......
......@@ -11,6 +11,8 @@ from LHCbKernel.Configuration import *
from Configurables import GaudiSequencer as Sequence
from Configurables import ( LHCbConfigurableUser, LHCbApp )
from Configurables import LumiIntegrateFSR, LumiReadBackFSR
from Configurables import GetIntegratedLuminosity
import GaudiKernel.ProcessJobOptions
......@@ -42,6 +44,10 @@ class LumiIntegratorConf(LHCbConfigurableUser):
SubtractBXTypes = ['Beam1','Beam2'],
IntegratorToolName = 'IntegrateBeamCrossing',
))
seqMembers.append( GetIntegratedLuminosity('GetIntegratedLuminosity',
IntegratorToolName = 'IntegrateBeamCrossing',
WriteCountersDetails = False
))
#seqMembers.append( LumiReadBackFSR('IntegrateReadBackBeamCrossing',
# IntegratorToolName = 'IntegrateBeamCrossing',
# ))
......
......@@ -10,10 +10,18 @@
#include "Event/EventCountFSR.h"
#include "Event/HltLumiSummary.h"
#include "Event/LumiFSR.h"
#include "Event/TimeSpanFSR.h"
#include "Event/LumiIntegral.h"
#include "Event/LumiCounters.h"
// local
#include "GetIntegratedLuminosity.h"
#include "LumiIntegrator.h"
// CondDB
#include "DetDesc/Condition.h"
#include "GaudiKernel/IDetDataSvc.h"
//-----------------------------------------------------------------------------
// Implementation file for class : GetIntegratedLuminosity
//
......@@ -29,15 +37,13 @@ DECLARE_ALGORITHM_FACTORY( GetIntegratedLuminosity );
//=============================================================================
GetIntegratedLuminosity::GetIntegratedLuminosity( const std::string& name,
ISvcLocator* pSvcLocator)
: GaudiTupleAlg ( name , pSvcLocator ),
m_nHandled ( 0 ),
m_count_input(0),
m_count_output(0),
m_incSvc(0)
: GaudiTupleAlg ( name , pSvcLocator )
{
declareProperty( "FSRName" , m_FSRName = "/LumiFSR" );
declareProperty( "FileRecordLocation" , m_FileRecordName = "/FileRecords" );
declareProperty( "WriteCountersDetails", m_countersDetails = false );
declareProperty( "IntegratorToolName" , m_ToolName = "LumiIntegrator" );
declareProperty( "EventCountFSRName" , m_EventCountFSRName = "/EventCountFSR");
}
//=============================================================================
// Destructor
......@@ -53,12 +59,10 @@ StatusCode GetIntegratedLuminosity::initialize() {
if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;
// prepare tool
m_integratorTool = tool<ILumiIntegrator>( "LumiIntegrator", m_ToolName );
//prepare the FSR
m_eventFSR = new LHCb::EventCountFSR();
m_incSvc = svc<IIncidentSvc> ( "IncidentSvc" , true );
sc=service("IncidentSvc", m_incSvc, false);
if(!sc.isSuccess() || m_incSvc== NULL) return StatusCode::FAILURE;
m_incSvc->addListener( this, IncidentType::BeginEvent);
// get the File Records service
m_fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
return StatusCode::SUCCESS;
}
......@@ -67,15 +71,12 @@ StatusCode GetIntegratedLuminosity::initialize() {
//=============================================================================
StatusCode GetIntegratedLuminosity::execute() {
if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute" << endmsg;
m_count_input++;
m_eventFSR->setInput(m_count_input);
return StatusCode::SUCCESS;
}
//=============================================================================
// Finalize
//=============================================================================
StatusCode GetIntegratedLuminosity::finalize() {
if ( msgLevel(MSG::DEBUG) ) debug() << "==> Finalize" << endmsg;
StatusCode sc = StatusCode::SUCCESS ;
......@@ -83,46 +84,141 @@ StatusCode GetIntegratedLuminosity::finalize() {
std::string fromlumi = "FromLumi_";
Tuple tuple = nTuple("LumiTuple");
double IntegratedLuminosity = -1;
double IntegratedLuminosity = -1000000000;
double IntegratedLuminosityErr = -1000000000;
info() << "From Lumi: Number of input events :" << m_eventFSR->input() << endmsg;
info() << "From Lumi: Number of output events :" << m_eventFSR->output() << endmsg;
if(check() == 1){
IntegratedLuminosity = m_integratorTool->lumiValue() ;
IntegratedLuminosityErr = m_integratorTool->lumiError() ;
info() << "The FSR were checked : " << check()<< endmsg;
info() << "number of events seen: " << m_integratorTool->events( ) << endmsg;
info() << "Integrated Luminosity : " << IntegratedLuminosity
<< " +/- " << IntegratedLuminosityErr << " [pb-1]" << endmsg;
if ( m_integratorTool->duplicates().size() > 0 ) {
warning() << "Duplicate Files: " << m_integratorTool->duplicates() << endmsg;
}
//store the integrated lumi
tuple->column("IntegratedLuminosity", IntegratedLuminosity);
tuple->column("IntegratedLuminosityErr", IntegratedLuminosityErr);
//loop over the counters
LHCb::LumiIntegral::ValuePair defValue ( -1, 0 );
for ( int key = 0; key < LHCb::LumiCounters::LastGlobal; key++ ) {
if ( m_integratorTool->integral().hasInfo(key) ) {
LHCb::LumiIntegral::ValuePair value = m_integratorTool->integral().info( key, defValue );
std::string counterName = LHCb::LumiCounters::counterKeyToString( key );
if ( value.first != -1 ) {
debug() << "From Lumi: The counter " << counterName
<< ": with the Key "
<< key << " was used : " << value.first << " times and the summed value is : " << value.second << endmsg;
//write the counters in the LumiTuple
if(m_countersDetails == true){
tuple->column(fromlumi+counterName+"_Key" ,key);
tuple->column(fromlumi+counterName+ "_Counter", value.first);
tuple->column(fromlumi+counterName+ "_Value", value.second);
}//debug mode
}//check the first value
}//take the key
else {
debug() << "No counters availables" << endmsg;
}
}//loop over the keys
}//check that all the events were processed
else {
warning() << "The FSR were not verified : " << check()<< endmsg;
warning() << "Some events were not processed " << endmsg;
warning() << "This integrated luminosity will not be computed " << endmsg;
tuple->column("IntegratedLuminosity",IntegratedLuminosity);
tuple->column("IntegratedLuminosityErr", -IntegratedLuminosityErr);
}//write dummy values
if( m_eventFSR->input() == m_eventFSR->output() ){
IntegratedLuminosity = -16;
info() << "From Lumi: For this set of data the integrated luminosity is : " << IntegratedLuminosity << endmsg;
//store the integrated lumi
tuple->column("IntegratedLuminosity", IntegratedLuminosity);
LHCb::LumiIntegral::ValuePair defValue ( -1, 0 );
for ( int key = 0; key < LHCb::LumiCounters::LastGlobal; key++ ) {
if ( m_integratorTool->integral().hasInfo(key) ) {
LHCb::LumiIntegral::ValuePair value = m_integratorTool->integral().info( key, defValue );
std::string counterName = LHCb::LumiCounters::counterKeyToString( key );
if ( value.first != -1 ) {
info() << "From Lumi: The counter " << counterName
<< ": with the Key "
<< key << " was used : " << value.first << " times and the summed value is : " << value.second << endmsg;
//write the counters in the LumiTuple
if(m_countersDetails == true){
tuple->column(fromlumi+counterName+"_Key" ,key);
tuple->column(fromlumi+counterName+ "_Counter", value.first);
tuple->column(fromlumi+counterName+ "_Value", value.second);
}//debug mode
}//check the first value
}//take the key
}//loop over the keys
}//check that all the events were processed
else {
info() << "Some events were not processed " << endmsg;
info() << "This integrated luminosity will not be computed " << endmsg;
tuple->column("IntegratedLuminosity", -1);
}
sc = tuple->write();
sc = tuple->write();
return sc;
return GaudiTupleAlg::finalize(); // must be called after all other actions
}
//=============================================================================
int GetIntegratedLuminosity::check() {
int checkTheFSR = 0;
// make an inventory of the FileRecord store
std::string fileRecordRoot = m_FileRecordName;
//touch all EventCountFSRs
std::vector< std::string > evAddresses = navigate(fileRecordRoot, m_EventCountFSRName);
for(std::vector< std::string >::iterator iAddr = evAddresses.begin() ;
iAddr != evAddresses.end() ; ++iAddr ){
if ( msgLevel(MSG::INFO) ) {
debug() << "ev address: " << (*iAddr) << endmsg;
std::string eventCountRecordAddress = *iAddr;
// read EventCountFSR
if ( !exist<LHCb::EventCountFSR>(m_fileRecordSvc, eventCountRecordAddress) ) {
Warning("An EventCount Record was not found").ignore();
if ( msgLevel(MSG::DEBUG) ) debug() << eventCountRecordAddress << " not found" << endmsg ;
} else {
if ( msgLevel(MSG::VERBOSE) ) verbose() << eventCountRecordAddress << " found" << endmsg ;
LHCb::EventCountFSR* eventCountFSR = get<LHCb::EventCountFSR>(m_fileRecordSvc, eventCountRecordAddress);
// look at the EventCountFSR
debug() << eventCountRecordAddress << ": EventCountFSR: " << *eventCountFSR << endmsg;
debug() << " Event Count FSR Flag " << eventCountFSR->statusFlag() << endmsg;
debug() << " Event Count FSR Input : " << eventCountFSR->input() << endmsg;
debug() << "Event Count FSR output : " << eventCountFSR->output() << endmsg;
if ( eventCountFSR->statusFlag() == LHCb::EventCountFSR::VERIFIED ){
debug () << "These files are checked : "
<< eventCountFSR->statusFlag() << endmsg;
checkTheFSR = 1;
}//check the flag
else {
debug () << "These files were not checked yet : "
<< eventCountFSR->statusFlag() << endmsg;
checkTheFSR = -1;
}//check the flag
}//the eventcount was found
}
}
return (checkTheFSR);
}
//=============================================================================
std::vector< std::string > GetIntegratedLuminosity::navigate(std::string rootname, std::string tag) {
// navigate recursively through the FileRecord store and report addresses which contain the tag
if ( msgLevel(MSG::DEBUG) ) debug() << "==> Explore: " << rootname << " for " << tag << endmsg;
std::vector< std::string > addresses;
SmartDataPtr<DataObject> root(m_fileRecordSvc, rootname);
if ( root ) {
explore(root->registry(), tag, addresses);
}
return addresses;
}
//=============================================================================
void GetIntegratedLuminosity::explore(IRegistry* pObj, std::string tag, std::vector< std::string >& addresses) {
// add the addresses which contain the tag to the list and search through the leaves
if ( 0 != pObj ) {
std::string name = pObj->name();
std::string::size_type f = name.find(tag);
std::string id = pObj->identifier();
// add this address to the list
if ( f != std::string::npos ) addresses.push_back(id);
// search through the leaves
SmartIF<IDataManagerSvc> mgr(m_fileRecordSvc);
if ( mgr ) {
typedef std::vector<IRegistry*> Leaves;
Leaves leaves;
StatusCode sc = mgr->objectLeaves(pObj, leaves);
if ( sc.isSuccess() ) {
for ( Leaves::const_iterator iLeaf=leaves.begin(); iLeaf != leaves.end(); iLeaf++ ) {
// it is important to redefine leafRoot->registry() way back from the identifier
std::string leafId = (*iLeaf)->identifier();
SmartDataPtr<DataObject> leafRoot(m_fileRecordSvc, leafId);
explore(leafRoot->registry(), tag, addresses);
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment